:root {
  --bg: #f4f5f7;
  --card-bg: #ffffff;
  --text: #1c1e21;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --primary: #2563eb;
  --primary-light: #eff4ff;
  --error-bg: #fef2f2;
  --error-text: #b91c1c;
  --error-border: #fecaca;
  --radius: 14px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14161a;
    --card-bg: #1e2126;
    --text: #f0f1f3;
    --text-muted: #9aa0ab;
    --border: #2c3036;
    --primary: #5b8def;
    --primary-light: #1c2636;
    --error-bg: #2a1616;
    --error-text: #f87171;
    --error-border: #4c1f1f;
  }
}

:root[data-theme="dark"] {
  --bg: #14161a;
  --card-bg: #1e2126;
  --text: #f0f1f3;
  --text-muted: #9aa0ab;
  --border: #2c3036;
  --primary: #5b8def;
  --primary-light: #1c2636;
  --error-bg: #2a1616;
  --error-text: #f87171;
  --error-border: #4c1f1f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.page {
  max-width: 560px;
  margin: 0 auto;
  padding: 32px 16px 48px;
}

.breadcrumb {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.breadcrumb a {
  color: var(--text-muted);
  text-decoration: none;
}

.breadcrumb a:hover {
  color: var(--primary);
  text-decoration: underline;
}

.header {
  text-align: center;
  margin-bottom: 24px;
}

.header h1 {
  font-size: 1.6rem;
  margin: 0 0 6px;
}

.subtitle {
  color: var(--text-muted);
  margin: 0;
  font-size: 0.95rem;
}

.intro {
  color: var(--text-muted);
  margin: 10px 0 0;
  font-size: 0.85rem;
  line-height: 1.5;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.ad-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  color: var(--text-muted);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.ad-slot-top {
  margin-bottom: 20px;
}

.ad-slot-bottom {
  margin-top: 20px;
}

.field {
  margin-bottom: 18px;
}

.field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-muted);
}

.input-group {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg);
  transition: border-color 0.15s ease;
}

.input-group:focus-within {
  border-color: var(--primary);
}

.input-group input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 12px 14px;
  font-size: 1rem;
  color: var(--text);
  min-width: 0;
}

.input-group input:focus {
  outline: none;
}

.input-group .unit {
  padding: 0 14px;
  color: var(--text-muted);
  font-size: 0.9rem;
  border-left: 1px solid var(--border);
  align-self: stretch;
  display: flex;
  align-items: center;
}

.tabs {
  display: flex;
  gap: 6px;
  background: var(--bg);
  padding: 4px;
  border-radius: 10px;
  margin-bottom: 20px;
}

.tab {
  flex: 1;
  border: none;
  background: transparent;
  padding: 10px 8px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: 8px;
  cursor: pointer;
  line-height: 1.3;
}

.tab.active {
  background: var(--card-bg);
  color: var(--primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.panel.hidden {
  display: none;
}

.error {
  background: var(--error-bg);
  border: 1px solid var(--error-border);
  color: var(--error-text);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 0.85rem;
  margin-bottom: 18px;
}

.error.hidden {
  display: none;
}

.result {
  background: var(--primary-light);
  border-radius: 12px;
  padding: 20px;
}

.result-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.result-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.result-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
}

.result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.result-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.result-item-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.result-item-value {
  font-size: 1.1rem;
  font-weight: 600;
}

.footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-top: 20px;
}
