/* ============================================================
   FitCalc — dark & sporty theme
   Step 1: shell, layout, navigation, shared components
   ============================================================ */

:root {
  /* Palette */
  --bg:            #0b0d12;
  --bg-soft:       #10131a;
  --surface:       #161a23;
  --surface-2:     #1d2230;
  --border:        #262c3b;
  --border-strong: #333b50;

  --text:          #eef1f7;
  --text-dim:      #9aa3b5;
  --text-faint:    #6b7385;

  --accent:        #c8ff2e;      /* volt / lime */
  --accent-deep:   #9fd400;
  --accent-ink:    #10131a;      /* text on accent */
  --accent-glow:   rgba(200, 255, 46, 0.22);

  --danger:        #ff5d5d;
  --warn:          #ffb020;
  --ok:            #3ddc84;
  --info:          #4cc3ff;

  /* Metrics */
  --radius:        14px;
  --radius-sm:     9px;
  --shadow:        0 10px 30px rgba(0, 0, 0, 0.45);
  --container:     1080px;

  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  background:
    radial-gradient(900px 420px at 85% -10%, rgba(200, 255, 46, 0.07), transparent 60%),
    radial-gradient(700px 380px at -10% 0%, rgba(76, 195, 255, 0.05), transparent 55%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: 20px;
}

/* ============ Header ============ */

.site-header {
  padding: 26px 0 18px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(200, 255, 46, 0.04), transparent);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 0 24px var(--accent-glow);
}

.brand-text {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  font-style: normal;
}

.brand-text em {
  font-style: normal;
  color: var(--accent);
}

.brand-tagline {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
}

/* ============ Nav tabs ============ */

.site-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(11, 13, 18, 0.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav-inner::-webkit-scrollbar { display: none; }

.nav-tab {
  position: relative;
  flex: 0 0 auto;
  padding: 14px 18px;
  text-decoration: none;
  color: var(--text-dim);
  font-weight: 700;
  font-size: 0.86rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border-bottom: 3px solid transparent;
  transition: color 0.18s ease, border-color 0.18s ease;
}

.nav-tab:hover { color: var(--text); }

.nav-tab.is-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ============ Main / routes ============ */

.main-content {
  flex: 1;
  padding: 34px 20px 56px;
}

.page-title {
  margin: 0 0 6px;
  font-size: clamp(1.5rem, 3.2vw, 2.1rem);
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.page-title::after {
  content: "";
  display: block;
  width: 56px;
  height: 4px;
  margin-top: 10px;
  border-radius: 2px;
  background: var(--accent);
  box-shadow: 0 0 16px var(--accent-glow);
}

.page-subtitle {
  margin: 14px 0 28px;
  color: var(--text-dim);
  max-width: 60ch;
}

/* ============ Overview cards ============ */

.calc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}

.calc-card {
  position: relative;
  display: block;
  padding: 22px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.calc-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.5), 0 0 0 1px var(--accent-glow);
}

.calc-card h2 {
  margin: 0 0 8px;
  font-size: 1.15rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.calc-card p {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.92rem;
}

.calc-card.is-live { border-left: 3px solid var(--accent); }

.calc-card-status {
  position: absolute;
  top: 16px;
  right: 16px;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 4px 10px;
  border-radius: 999px;
}

.calc-card-status.is-planned {
  color: var(--text-faint);
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.calc-card-status.is-live {
  color: var(--accent-ink);
  background: var(--accent);
}

/* ============ Panels & placeholders ============ */

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  box-shadow: var(--shadow);
}

.placeholder {
  color: var(--text-dim);
  border-style: dashed;
}

.placeholder-badge {
  display: inline-block;
  margin-bottom: 12px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.placeholder p { margin: 0; }

/* ============ Shared form components (for upcoming steps) ============ */

.calc-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

@media (max-width: 820px) {
  .calc-layout { grid-template-columns: 1fr; }
}

.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
}

.field input[type="number"],
.field input[type="text"],
.field select {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-soft);
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  appearance: none;
  -webkit-appearance: none;
}

.field select {
  padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' fill='none' stroke='%239aa3b5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  cursor: pointer;
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.field input::placeholder { color: var(--text-faint); }

/* Unit toggle (metric / imperial) */
.unit-toggle {
  display: inline-flex;
  padding: 4px;
  gap: 4px;
  border-radius: 999px;
  background: var(--bg-soft);
  border: 1px solid var(--border-strong);
}

.unit-toggle button {
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 7px 18px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.unit-toggle button.is-active {
  background: var(--accent);
  color: var(--accent-ink);
}

/* Primary button */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 22px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--accent-ink);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  cursor: pointer;
  box-shadow: 0 6px 20px var(--accent-glow);
  transition: transform 0.12s ease, filter 0.15s ease;
}

.btn-primary:hover  { filter: brightness(1.08); }
.btn-primary:active { transform: scale(0.985); }

/* Result panel pieces */
.result-hero {
  text-align: center;
  padding: 10px 0 18px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
}

.result-hero .value {
  font-size: clamp(2.4rem, 6vw, 3.4rem);
  font-weight: 800;
  line-height: 1.1;
  color: var(--accent);
  text-shadow: 0 0 26px var(--accent-glow);
}

.result-hero .label {
  margin-top: 4px;
  color: var(--text-dim);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-weight: 700;
}

.result-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 0.95rem;
}

.result-row:last-child { border-bottom: none; }
.result-row .k { color: var(--text-dim); }
.result-row .v { font-weight: 700; }

.error-msg {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 93, 93, 0.4);
  background: rgba(255, 93, 93, 0.1);
  color: var(--danger);
  font-size: 0.9rem;
}

.hint {
  margin: -6px 0 18px;
  color: var(--text-faint);
  font-size: 0.82rem;
}

.disclaimer {
  margin: 18px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  color: var(--text-faint);
  font-size: 0.8rem;
}

.result-empty {
  padding: 34px 10px;
  text-align: center;
  color: var(--text-dim);
}

.result-empty p { margin: 0; max-width: 42ch; margin-inline: auto; }

/* Category colours */
.cat-under  { color: var(--info); }
.cat-normal { color: var(--ok); }
.cat-over   { color: var(--warn); }
.cat-obese  { color: var(--danger); }

/* BMI gauge */
.bmi-gauge {
  position: relative;
  display: flex;
  height: 14px;
  margin: 8px 0 6px;
  border-radius: 999px;
  overflow: visible;
  background: var(--bg-soft);
}

.bmi-gauge .seg { height: 100%; }
.bmi-gauge .seg:first-child { border-radius: 999px 0 0 999px; }
.bmi-gauge .seg:last-child  { border-radius: 0 999px 999px 0; }

.seg-under  { background: rgba(76, 195, 255, 0.55); }
.seg-normal { background: rgba(61, 220, 132, 0.65); }
.seg-over   { background: rgba(255, 176, 32, 0.6); }
.seg-obese  { background: rgba(255, 93, 93, 0.55); }

.gauge-marker {
  position: absolute;
  top: -7px;
  width: 5px;
  height: 28px;
  border-radius: 3px;
  background: var(--text);
  transform: translateX(-50%);
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.35), 0 2px 6px rgba(0, 0, 0, 0.6);
  transition: left 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.gauge-labels {
  display: flex;
  justify-content: space-between;
  margin: 2px 0 20px;
  color: var(--text-faint);
  font-size: 0.72rem;
  letter-spacing: 0.05em;
}

/* Segmented choice (radio pills) */
.seg-choice {
  display: flex;
  gap: 8px;
}

.seg-option {
  position: relative;
  flex: 1;
}

.seg-option input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  margin: 0;
}

.seg-option span {
  display: block;
  text-align: center;
  padding: 11px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-soft);
  color: var(--text-dim);
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.05em;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.seg-option input:checked + span {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(200, 255, 46, 0.07);
  box-shadow: 0 0 18px var(--accent-glow);
}

.seg-option input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Two fields side by side */
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

@media (max-width: 420px) {
  .field-row { grid-template-columns: 1fr; gap: 0; }
}

/* Unit suffix inside hero value */
.result-hero .value .unit {
  margin-left: 10px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-dim);
  text-shadow: none;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Results sub-heading */
.results-heading {
  margin: 24px 0 8px;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-dim);
}

/* Goal table */
.goal-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.93rem;
}

.goal-table th {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border-strong);
  color: var(--text-faint);
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.goal-table td {
  padding: 10px 8px;
  border-bottom: 1px dashed var(--border);
  vertical-align: middle;
}

.goal-table tbody tr:last-child td { border-bottom: none; }

.goal-table .num { text-align: right; }
.goal-table .kcal { font-weight: 800; font-variant-numeric: tabular-nums; }
.goal-table .rate { color: var(--text-dim); font-size: 0.85rem; font-variant-numeric: tabular-nums; }

.goal-name { display: block; font-weight: 700; }
.goal-note { display: block; color: var(--text-faint); font-size: 0.75rem; }

.goal-table tr.is-maint td {
  background: rgba(200, 255, 46, 0.05);
}

.goal-table tr.is-maint td:first-child {
  border-left: 3px solid var(--accent);
  padding-left: 10px;
}

/* Warning note */
.warn-note {
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 176, 32, 0.4);
  background: rgba(255, 176, 32, 0.08);
  color: var(--warn);
  font-size: 0.87rem;
}

/* Optional-field note inside labels */
.opt {
  color: var(--text-faint);
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.75rem;
}

/* Macro cards */
.macro-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.macro-card {
  padding: 14px 10px;
  text-align: center;
  border: 1px solid var(--border);
  border-top: 3px solid var(--macro-color);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
}

.macro-card .m-name {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-dim);
  margin-bottom: 4px;
}

.macro-card .grams {
  font-size: 1.65rem;
  font-weight: 800;
  line-height: 1.15;
  color: var(--macro-color);
  font-variant-numeric: tabular-nums;
}

.macro-card .grams .g {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-dim);
  margin-left: 2px;
}

.macro-card .m-kcal {
  margin-top: 4px;
  font-size: 0.75rem;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}

.macro-card.m-protein { --macro-color: var(--accent); }
.macro-card.m-carbs   { --macro-color: var(--info); }
.macro-card.m-fat     { --macro-color: var(--warn); }

/* Stacked split bar */
.split-bar {
  display: flex;
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--bg-soft);
  border: 1px solid var(--border);
}

.split-bar span {
  height: 100%;
  transition: width 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.sb-protein { background: var(--accent); }
.sb-carbs   { background: var(--info); }
.sb-fat     { background: var(--warn); }

.split-legend {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 8px 0 18px;
  color: var(--text-dim);
  font-size: 0.75rem;
}

.split-legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  margin-right: 6px;
}

.lg-protein { background: var(--accent); }
.lg-carbs   { background: var(--info); }
.lg-fat     { background: var(--warn); }

@media (max-width: 480px) {
  .macro-cards { grid-template-columns: 1fr; }
}

/* Field flash when pre-filled from another calculator */
.field-flash input {
  animation: flash-pop 1.1s ease-out 1;
}

@keyframes flash-pop {
  0%   { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-glow); }
  100% { border-color: var(--border-strong); box-shadow: 0 0 0 0 rgba(0, 0, 0, 0); }
}

/* Very small screens: hide the "Est. change" column in the BMR goals table */
@media (max-width: 520px) {
  #bmr-output .rate-col { display: none; }
}

/* Water calculator — blue hero + cup row */
.result-hero .value.water {
  color: var(--info);
  text-shadow: 0 0 26px rgba(76, 195, 255, 0.35);
}

.cup-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  padding: 6px 0 2px;
}

.cup {
  position: relative;
  width: 22px;
  height: 30px;
  border: 2px solid var(--border-strong);
  border-radius: 3px 3px 7px 7px;
  background: var(--bg-soft);
  overflow: hidden;
}

.cup .fill {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 0;
  background: linear-gradient(180deg, rgba(76, 195, 255, 0.95), rgba(76, 195, 255, 0.5));
  transition: height 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.cup-caption {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.82rem;
  margin: 6px 0 16px;
}

/* Steps gauge (reuses .gauge-marker / .gauge-labels from the BMI gauge) */
.steps-gauge {
  position: relative;
  display: flex;
  height: 14px;
  margin: 8px 0 6px;
  border-radius: 999px;
  overflow: visible;
  background: var(--bg-soft);
}

.steps-gauge .seg { height: 100%; }
.steps-gauge .seg:first-child { border-radius: 999px 0 0 999px; }
.steps-gauge .seg:last-child  { border-radius: 0 999px 999px 0; }

.seg-low     { background: rgba(255, 93, 93, 0.5); }
.seg-some    { background: rgba(76, 195, 255, 0.55); }
.seg-optimal { background: rgba(61, 220, 132, 0.65); }
.seg-high    { background: rgba(200, 255, 46, 0.6); }

/* Developer credit banner (overview page) */
.dev-credit {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0 6px;
  padding: 10px 20px;
  border-radius: 999px;
  border: 1px solid var(--accent);
  background: linear-gradient(90deg, rgba(200, 255, 46, 0.12), rgba(76, 195, 255, 0.07));
  box-shadow: 0 0 24px var(--accent-glow);
  color: var(--text);
  font-size: 0.92rem;
  letter-spacing: 0.04em;
}

.dev-credit svg {
  color: var(--accent);
  filter: drop-shadow(0 0 6px var(--accent-glow));
  flex: 0 0 auto;
}

.dev-credit strong {
  color: var(--accent);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Footer credit */
.footer-credit strong {
  color: var(--accent);
  font-weight: 700;
}

/* Goal timeline — journey bar */
.journey {
  margin: 6px 0 18px;
}

.journey-track {
  position: relative;
  height: 10px;
  border-radius: 999px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
}

.journey-fill {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(200, 255, 46, 0.3), var(--accent));
  opacity: 0.85;
}

.journey-dot {
  position: absolute;
  top: 50%;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--accent);
  transform: translate(-50%, -50%);
}

.journey-ends {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

/* Profile status banner (overview) */
.profile-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin: 0 0 26px;
  padding: 14px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-dim);
  font-size: 0.92rem;
}

.profile-status.is-saved {
  border-color: var(--accent);
  box-shadow: 0 0 18px var(--accent-glow);
}

.profile-status strong { color: var(--text); }

.btn-mini {
  flex: 0 0 auto;
  padding: 7px 16px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  text-decoration: none;
  white-space: nowrap;
  transition: filter 0.15s ease;
}

.btn-mini:hover { filter: brightness(1.08); }

/* Secondary (outline) button */
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 14px;
  padding: 10px 20px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--text-dim);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  text-decoration: none;
  transition: color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.btn-secondary:hover {
  color: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 14px var(--accent-glow);
}

/* Success note */
.ok-msg {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(61, 220, 132, 0.4);
  background: rgba(61, 220, 132, 0.08);
  color: var(--ok);
  font-size: 0.9rem;
}

/* Profile form panel */
.profile-panel {
  max-width: 680px;
}

/* Profile summary list in calculator panels */
.summary-list .result-row:first-child {
  border-top: 1px dashed var(--border);
}

/* PDF report bar (overview) */
.report-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin: -12px 0 26px;
}

.report-btn {
  width: auto;
  padding: 12px 24px;
  gap: 10px;
  flex: 0 0 auto;
}

.report-note {
  color: var(--text-faint);
  font-size: 0.82rem;
}

/* ============ Diet plan ============ */
.day-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.day-chip {
  padding: 8px 13px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-dim);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.day-chip:hover { border-color: var(--border-strong); color: var(--text); }

.day-chip.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.meal-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
  padding: 13px 16px;
  margin-bottom: 12px;
}

.meal-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font-weight: 800;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.meal-head .mk {
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.food-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  border-top: 1px dashed var(--border);
  font-size: 0.92rem;
}

.food-line .fq { color: var(--text-dim); font-size: 0.85rem; }

.food-line .fk {
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.diet-totals { margin-top: 16px; }

.match-bar {
  height: 8px;
  border-radius: 99px;
  background: var(--surface-2);
  overflow: hidden;
  margin: 4px 0 14px;
}

.match-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent-deep), var(--accent));
  border-radius: 99px;
}

.panel-inset {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
  padding: 6px 16px;
  margin-top: 16px;
}

/* ============ Footer ============ */

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-soft);
  padding: 20px 0;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--text-faint);
  font-size: 0.82rem;
}

.footer-inner p { margin: 0; }

.footer-step { letter-spacing: 0.06em; }

/* ============ Small screens ============ */

@media (max-width: 560px) {
  .brand-tagline { display: none; }
  .main-content { padding: 26px 16px 44px; }
  .panel { padding: 20px; }
}

/* ============ Language gate ============ */
.lang-gate {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(1000px 500px at 80% -10%, rgba(200, 255, 46, 0.08), transparent 60%),
    radial-gradient(800px 400px at 10% 110%, rgba(76, 195, 255, 0.06), transparent 60%),
    var(--bg);
}

.lang-gate[hidden] { display: none; }

.lang-gate-card {
  width: min(680px, 100%);
  text-align: center;
  padding: 44px 32px 36px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.lang-gate-brand {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.lang-gate-brand em {
  font-style: normal;
  color: var(--accent);
}

.lang-gate-title {
  margin: 10px 0 26px;
  color: var(--text-dim);
  font-size: 1.05rem;
}

.lang-gate-buttons {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

.lang-btn {
  flex: 1 1 220px;
  max-width: 280px;
  padding: 26px 20px;
  border-radius: 16px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  display: grid;
  gap: 8px;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.lang-btn:hover,
.lang-btn:focus-visible {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 10px 30px var(--accent-glow);
}

.lang-btn-name {
  font-size: 1.7rem;
  font-weight: 800;
  line-height: 1.4;
}

#lang-ur .lang-btn-name {
  font-family: "Noto Nastaliq Urdu", "Urdu Typesetting", "Jameel Noori Nastaleeq", serif;
  font-size: 2rem;
  color: var(--accent);
}

.lang-btn-sub {
  color: var(--text-dim);
  font-size: 0.85rem;
}

.lang-gate-note {
  margin: 26px 0 0;
  color: var(--text-faint);
  font-size: 0.82rem;
}

/* ============ Header language switcher ============ */
.lang-switch {
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.lang-switch:hover { border-color: var(--accent); color: var(--accent); }

/* ============ Urdu / RTL mode ============ */
html[dir="rtl"] body {
  font-family: "Noto Nastaliq Urdu", "Urdu Typesetting", "Jameel Noori Nastaleeq",
    "Nafees Web Naskh", "Segoe UI", system-ui, -apple-system, sans-serif;
  line-height: 2;
}

html[dir="rtl"] .page-title { line-height: 1.9; }
html[dir="rtl"] .nav-tab { line-height: 1.7; }
html[dir="rtl"] .btn-primary,
html[dir="rtl"] .btn-secondary,
html[dir="rtl"] .btn-mini,
html[dir="rtl"] .day-chip,
html[dir="rtl"] .lang-switch { line-height: 1.7; }
html[dir="rtl"] .result-hero .label { line-height: 1.8; }
html[dir="rtl"] .meal-head { line-height: 1.8; }

/* bars & gauges keep their LTR direction in RTL mode */
html[dir="rtl"] .bmi-gauge,
html[dir="rtl"] .steps-gauge,
html[dir="rtl"] .split-bar,
html[dir="rtl"] .match-bar,
html[dir="rtl"] .cup-row,
html[dir="rtl"] .journey-track {
  direction: ltr;
}

/* ============ Small-screen polish ============ */
@media (max-width: 480px) {
  .goal-table { font-size: 0.86rem; }
  .goal-table th,
  .goal-table td { padding: 8px 6px; }
  .nav-tab { padding: 12px 13px; font-size: 0.8rem; }
  .report-bar { gap: 10px; }
  .report-btn { width: 100%; }
  .lang-gate-card { padding: 32px 18px 26px; }
  .lang-btn { padding: 20px 16px; }
  .meal-card { padding: 12px 13px; }
  .food-line { font-size: 0.87rem; }
}

/* ============ Theme system ============ */
/* Page-canvas tokens (text/chips that sit ON the page background) */
:root {
  --on-bg: #eef1f7;
  --on-bg-dim: #9aa3b5;
  --on-bg-faint: #6b7385;
  --nav-bg: rgba(11, 13, 18, 0.88);
  --header-tint: rgba(200, 255, 46, 0.04);
  --bg-glow-a: rgba(200, 255, 46, 0.07);
  --bg-glow-b: rgba(76, 195, 255, 0.05);
  --tint-accent-soft: rgba(200, 255, 46, 0.07);
}

/* Heritage theme — emerald + gold (design concept 3b) */
html[data-theme="heritage"] {
  --bg: #0b3826;
  --bg-soft: #f4f1e8;
  --surface: #fdfbf6;
  --surface-2: #efe9db;
  --border: #e2dcc8;
  --border-strong: #c9c0a6;
  --text: #17362a;
  --text-dim: #4d6a58;
  --text-faint: #7c9081;
  --accent: #c9a227;
  --accent-deep: #a8841a;
  --accent-ink: #241c05;
  --accent-glow: rgba(201, 162, 39, 0.25);
  --on-bg: #f2efe4;
  --on-bg-dim: #c8dcc8;
  --on-bg-faint: #9dbba4;
  --nav-bg: rgba(9, 44, 31, 0.92);
  --header-tint: rgba(201, 162, 39, 0.06);
  --bg-glow-a: rgba(212, 175, 55, 0.10);
  --bg-glow-b: rgba(122, 180, 140, 0.08);
  --tint-accent-soft: rgba(201, 162, 39, 0.10);
}

/* Canvas: tokenised gradients + page-level text colour */
body {
  color: var(--on-bg);
  background:
    radial-gradient(900px 420px at 85% -10%, var(--bg-glow-a), transparent 60%),
    radial-gradient(700px 380px at -10% 0%, var(--bg-glow-b), transparent 55%),
    var(--bg);
}
.site-header { background: linear-gradient(180deg, var(--header-tint), transparent); }
.site-nav { background: var(--nav-bg); }

/* Text on the page canvas (light in both themes) */
.page-title,
.brand-text { color: var(--on-bg); }
.page-subtitle,
.brand-tagline,
.site-footer p { color: var(--on-bg-dim); }
.report-note { color: var(--on-bg-faint); }
.nav-tab { color: var(--on-bg-dim); }
.nav-tab:hover { color: var(--on-bg); }
.nav-tab.is-active { color: var(--accent); }

/* Card containers carry the in-card text colour */
.panel,
.calc-card,
.meal-card,
.panel-inset,
.lang-gate-card { color: var(--text); }

/* Accent tints follow the theme */
.dev-credit {
  background: linear-gradient(90deg, var(--tint-accent-soft), rgba(255, 255, 255, 0.05));
  color: var(--on-bg);
}
.seg-option input:checked + span { background: var(--tint-accent-soft); }
.goal-table tr.is-maint td { background: var(--tint-accent-soft); }

/* Heritage-only touches */
html[data-theme="heritage"] .journey-fill {
  background: linear-gradient(90deg, var(--accent-deep), var(--accent));
}
html[data-theme="heritage"] .lang-switch {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.28);
  color: var(--on-bg);
}
html[data-theme="heritage"] .lang-switch:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ---- Theme: Sunrise — light editorial (cream + coral) ---- */
html[data-theme="sunrise"] {
  --bg: #faf6ef;
  --bg-soft: #f3eee3;
  --surface: #ffffff;
  --surface-2: #f1eadf;
  --border: #e7ddcb;
  --border-strong: #d3c6ae;
  --text: #2b2622;
  --text-dim: #6b6257;
  --text-faint: #98897a;
  --accent: #e85d3d;
  --accent-deep: #c74a2c;
  --accent-ink: #fff8f2;
  --accent-glow: rgba(232, 93, 61, 0.22);
  --on-bg: #2b2622;
  --on-bg-dim: #6b6257;
  --on-bg-faint: #98897a;
  --nav-bg: rgba(250, 246, 239, 0.92);
  --header-tint: rgba(232, 93, 61, 0.05);
  --bg-glow-a: rgba(232, 93, 61, 0.07);
  --bg-glow-b: rgba(240, 180, 80, 0.09);
  --tint-accent-soft: rgba(232, 93, 61, 0.08);
  --shadow: 0 10px 30px rgba(96, 72, 40, 0.12);
}
html[data-theme="sunrise"] .lang-switch {
  background: rgba(43, 38, 34, 0.07);
  border-color: rgba(43, 38, 34, 0.22);
  color: #2b2622;
}
html[data-theme="sunrise"] .lang-switch:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ---- Theme: Neon Night — cyber magenta + cyan ---- */
html[data-theme="neon"] {
  --bg: #07070d;
  --bg-soft: #0d0d17;
  --surface: #12121f;
  --surface-2: #1a1a2b;
  --border: #26263c;
  --border-strong: #3a3a58;
  --text: #eaf2ff;
  --text-dim: #9aa8c8;
  --text-faint: #66719a;
  --accent: #ff2e88;
  --accent-deep: #d1146b;
  --accent-ink: #14040c;
  --accent-glow: rgba(255, 46, 136, 0.28);
  --info: #2ee6ff;
  --on-bg: #eaf2ff;
  --on-bg-dim: #9aa8c8;
  --on-bg-faint: #66719a;
  --nav-bg: rgba(7, 7, 13, 0.9);
  --header-tint: rgba(255, 46, 136, 0.05);
  --bg-glow-a: rgba(255, 46, 136, 0.1);
  --bg-glow-b: rgba(46, 230, 255, 0.07);
  --tint-accent-soft: rgba(255, 46, 136, 0.1);
}

/* ---- Theme: Ocean — deep teal + aqua ---- */
html[data-theme="ocean"] {
  --bg: #07293c;
  --bg-soft: #0b3349;
  --surface: #0e3a52;
  --surface-2: #14465f;
  --border: #1d5570;
  --border-strong: #2b6c8a;
  --text: #eaf7fb;
  --text-dim: #a7c9d6;
  --text-faint: #6f97a8;
  --accent: #35d0ba;
  --accent-deep: #1fa894;
  --accent-ink: #04262a;
  --accent-glow: rgba(53, 208, 186, 0.25);
  --on-bg: #eaf7fb;
  --on-bg-dim: #a7c9d6;
  --on-bg-faint: #6f97a8;
  --nav-bg: rgba(6, 38, 58, 0.92);
  --header-tint: rgba(53, 208, 186, 0.05);
  --bg-glow-a: rgba(53, 208, 186, 0.09);
  --bg-glow-b: rgba(76, 195, 255, 0.06);
  --tint-accent-soft: rgba(53, 208, 186, 0.1);
}

/* Shared: journey fill follows the accent in every theme */
.journey-fill {
  background: linear-gradient(90deg, var(--accent-deep), var(--accent));
}

/* ============ Motion & graphics ============ */

/* Ambient drifting glow orbs behind everything */
.bg-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(70px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.55;
}
.bg-orb.a {
  width: 46vw; height: 46vw; top: -12vw; right: -10vw;
  background: radial-gradient(circle at 35% 35%, var(--accent-glow), transparent 65%);
  animation: drift-a 26s ease-in-out infinite alternate;
}
.bg-orb.b {
  width: 38vw; height: 38vw; bottom: -14vw; left: -8vw;
  background: radial-gradient(circle at 60% 40%, var(--bg-glow-b), transparent 65%);
  animation: drift-b 32s ease-in-out infinite alternate;
}
@keyframes drift-a {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(-6vw, 8vh, 0) scale(1.15); }
}
@keyframes drift-b {
  from { transform: translate3d(0, 0, 0) scale(1.1); }
  to   { transform: translate3d(7vw, -6vh, 0) scale(0.95); }
}
.main-content, .site-footer { position: relative; z-index: 1; }

/* Entrance motion */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}
.route { animation: fade-up 0.45s ease both; }
.calc-grid > a { animation: fade-up 0.5s ease both; }
.calc-grid > a:nth-child(2) { animation-delay: 0.06s; }
.calc-grid > a:nth-child(3) { animation-delay: 0.12s; }
.calc-grid > a:nth-child(4) { animation-delay: 0.18s; }
.calc-grid > a:nth-child(5) { animation-delay: 0.24s; }
.calc-grid > a:nth-child(6) { animation-delay: 0.3s; }
.calc-grid > a:nth-child(7) { animation-delay: 0.36s; }
.meal-card { animation: fade-up 0.4s ease both; }
.meal-card:nth-of-type(2) { animation-delay: 0.07s; }
.meal-card:nth-of-type(3) { animation-delay: 0.14s; }
.meal-card:nth-of-type(4) { animation-delay: 0.21s; }
.lang-gate-card { animation: fade-up 0.5s ease both; }
.lang-btn { animation: fade-up 0.55s ease both; }
#lang-ur { animation-delay: 0.08s; }

/* Brand glow pulse */
@keyframes glow-pulse {
  0%, 100% { box-shadow: 0 0 24px var(--accent-glow); }
  50%      { box-shadow: 0 0 42px var(--accent-glow), 0 0 10px var(--accent-glow); }
}
.brand-mark { animation: glow-pulse 3.2s ease-in-out infinite; }

/* Data motion: markers, bars, cups */
.gauge-marker {
  transition: left 0.7s cubic-bezier(0.22, 0.9, 0.35, 1),
    border-color 0.15s ease, color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.split-bar span, .match-bar span { transition: width 0.7s cubic-bezier(0.22, 0.9, 0.35, 1); }
.cup .fill { transition: height 0.55s ease; }

/* Journey grow + milestone pops */
@keyframes grow-x { from { transform: scaleX(0); } }
.journey-fill {
  transform-origin: left center;
  animation: grow-x 0.9s cubic-bezier(0.22, 0.9, 0.35, 1) both;
}
@keyframes pop-in {
  0%   { transform: scale(0); opacity: 0; }
  70%  { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
.journey-dot { animation: pop-in 0.45s ease both; }
.journey-dot:nth-child(2) { animation-delay: 0.3s; }
.journey-dot:nth-child(3) { animation-delay: 0.5s; }
.journey-dot:nth-child(4) { animation-delay: 0.7s; }

/* Nav tab icons */
.nav-ic { display: inline-flex; margin-inline-end: 7px; vertical-align: -2px; opacity: 0.85; }
.nav-ic svg { width: 14px; height: 14px; }

/* Diet day progress ring */
.day-ring {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 2px 0 10px;
}
.day-ring svg { transform: rotate(-90deg); flex: 0 0 auto; }
.day-ring circle { transition: stroke-dashoffset 0.9s cubic-bezier(0.22, 0.9, 0.35, 1); }
.day-ring b { font-size: 1.15rem; color: var(--accent); font-variant-numeric: tabular-nums; }
.day-ring span { color: var(--text-dim); font-size: 0.82rem; }
.meal-emoji { margin-inline-end: 7px; }

/* Respect users who prefer less motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* Nav: wrap to two rows on medium widths so no tab label is ever
   clipped (horizontal scroll with hidden scrollbar stays for phones) */
@media (max-width: 1200px) {
  .nav-inner {
    flex-wrap: wrap;
    overflow-x: visible;
    row-gap: 2px;
    padding-bottom: 2px;
  }
}
@media (max-width: 640px) {
  .nav-inner {
    flex-wrap: nowrap;
    overflow-x: auto;
  }
}
