:root {
  color-scheme: light;
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #edf0f6;
  --ink: #111523;
  --muted: #697083;
  --line: #dfe3ec;
  --brand: #d83b4d;
  --brand-2: #b8273a;
  --accent: #ec4355;
  --accent-soft: #ffe8ec;
  --good: #249c73;
  --danger: #b54a48;
  --info: #4776a6;
  --shadow: 0 14px 35px rgba(20, 25, 45, .10);
  --radius: 22px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #030508;
  --surface: #0e1320;
  --surface-2: #171d2c;
  --ink: #f5f6fb;
  --muted: #9ca5ba;
  --line: #272e40;
  --brand: #ef4354;
  --brand-2: #ff7b8a;
  --accent: #ef4354;
  --accent-soft: #3a1821;
  --good: #57c99c;
  --danger: #ff8a86;
  --info: #83b5e9;
  --shadow: 0 18px 42px rgba(0, 0, 0, .28);
}

* { box-sizing: border-box; }
html { background: var(--bg); scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink); }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
button, [role="button"] { -webkit-tap-highlight-color: transparent; }
a { color: var(--brand-2); }
img { max-width: 100%; }
.skip-link { position: fixed; left: 8px; top: -100px; z-index: 999; padding: 10px 14px; background: var(--surface); border-radius: 10px; }
.skip-link:focus { top: 8px; }

.topbar {
  position: sticky; top: 0; z-index: 30; height: 72px; display: flex; align-items: center; justify-content: space-between;
  padding: 10px max(16px, calc((100vw - 1120px) / 2)); background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(16px); border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
.brand { display: flex; gap: 10px; align-items: center; padding: 0; background: none; border: 0; text-align: left; cursor: pointer; }
.brand img { border-radius: 13px; box-shadow: 0 7px 18px rgba(0,0,0,.2); }
.brand-photo { object-fit: cover; object-position: 50% 20%; }
.brand span { display: grid; gap: 2px; }
.brand strong { font-size: 1rem; letter-spacing: -.01em; }
.brand small { color: var(--muted); font-size: .74rem; }
.icon-button { width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; cursor: pointer; font-size: 1.25rem; }

#app { width: min(1120px, 100%); margin: 0 auto; padding: 22px 16px calc(100px + var(--safe-bottom)); outline: none; }
.page { display: grid; gap: 18px; animation: enter .24s ease-out; }
@keyframes enter { from { opacity: .4; transform: translateY(5px); } }
.page-head { display: flex; align-items: end; justify-content: space-between; gap: 14px; }
.page-head h1, .page-head h2, h1, h2, h3, p { margin-top: 0; }
.page-head h1 { margin-bottom: 4px; font-size: clamp(1.75rem, 4.7vw, 2.65rem); line-height: 1.02; letter-spacing: -.045em; }
.page-head p { margin-bottom: 0; color: var(--muted); }
.eyebrow { margin: 0 0 5px; color: var(--brand-2); font-size: .73rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.muted { color: var(--muted); }
.tiny { font-size: .76rem; }
.stack { display: grid; gap: 14px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; }
.grid-2, .grid-3, .metric-grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.metric-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card.flat { box-shadow: none; }
.card h2, .card h3 { margin-bottom: 6px; letter-spacing: -.025em; }
.hero { position: relative; overflow: hidden; padding: 24px; color: #fff; background: linear-gradient(135deg, #1b1117, #11182a 70%, #152438); border: 0; min-height: 200px; }
.hero::after { content: ""; position: absolute; width: 260px; height: 260px; right: -85px; top: -90px; border: 1px solid rgba(255,255,255,.24); border-radius: 50%; box-shadow: 0 0 0 44px rgba(255,255,255,.05), 0 0 0 88px rgba(255,255,255,.03); }
.hero > * { position: relative; z-index: 1; }
.hero h1 { max-width: 620px; margin: 0 0 12px; font-size: clamp(2rem, 6vw, 3.6rem); letter-spacing: -.055em; line-height: .98; }
.hero p { max-width: 610px; color: rgba(255,255,255,.78); }
.hero .eyebrow { color: #ff8592; }

.legacy-hero { padding: 0; overflow: hidden; border: 1px solid color-mix(in srgb, var(--accent) 20%, var(--line)); background: linear-gradient(135deg, #1b1016 0%, #10182a 62%, #0c2031 100%); color: #fff; }
.legacy-hero-grid { display: grid; grid-template-columns: 1.12fr .88fr; min-height: 440px; }
.legacy-hero-copy { display: flex; flex-direction: column; justify-content: center; padding: clamp(26px, 5vw, 58px); }
.legacy-hero-copy h1 { margin: 8px 0 18px; max-width: 640px; font-size: clamp(2.25rem, 5.5vw, 4.4rem); line-height: .98; letter-spacing: -.065em; }
.legacy-hero-copy > p:not(.eyebrow) { max-width: 600px; color: rgba(255,255,255,.72); font-size: 1.02rem; line-height: 1.65; }
.legacy-hero-photo { position: relative; min-height: 420px; margin: 0; overflow: hidden; background: #090b0f; }
.legacy-hero-photo::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, #111729 0%, transparent 28%), linear-gradient(0deg, rgba(4,6,10,.55), transparent 45%); }
.legacy-hero-photo img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 22%; }
.legacy-hero-photo figcaption { position: absolute; z-index: 2; right: 22px; bottom: 18px; color: #fff; font-size: .76rem; font-weight: 800; }
.hero-stats { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 10px; padding: 0 20px 20px; background: linear-gradient(90deg, #181223, #111c2c); }
.hero-stat { padding: 15px; border: 1px solid rgba(255,255,255,.09); border-radius: 15px; background: rgba(5,8,14,.24); }
.hero-stat strong, .hero-stat span { display: block; }
.hero-stat strong { font-size: 1.25rem; }
.hero-stat span { margin-top: 4px; color: rgba(255,255,255,.55); font-size: .7rem; }

.nutrition-date-hero { display: grid; grid-template-columns: 48px 1fr 48px; gap: 18px; align-items: center; padding: 20px 2px; text-align: center; background: radial-gradient(circle at 50% -80%, rgba(239,67,84,.16), transparent 55%); }
.nutrition-date-hero h1 { margin: 6px 0 10px; font-size: clamp(2rem, 5vw, 3.1rem); line-height: 1; letter-spacing: -.05em; }
.nutrition-date-hero .icon-button { justify-self: center; }
.date-compact { width: auto; min-height: 32px; padding: 5px 8px; color: var(--muted); background: transparent; border-color: transparent; font-size: .72rem; }
.nutrition-reflection { padding: 24px 28px; border: 1px solid #56410b; border-radius: 20px; background: linear-gradient(105deg, #1b1405, #1b0f12); }
.nutrition-reflection .eyebrow { color: #ffce3a; }
.nutrition-reflection blockquote { margin: 6px 0 12px; color: #f5f0e4; font-family: Georgia, serif; font-size: clamp(1.05rem, 2.5vw, 1.32rem); }
.nutrition-reflection cite { color: #a9adba; font-size: .76rem; font-style: normal; }
.nutrition-overview { display: grid; grid-template-columns: minmax(260px,.72fr) minmax(0,1.55fr); gap: 14px; }
.nutrition-liquid-card h2, .nutrition-energy-card h2 { margin: 5px 0; font-size: clamp(1.65rem,4vw,2.3rem); }
.radial-progress { --progress: 0deg; width: 92px; aspect-ratio: 1; display: grid; place-items: center; border-radius: 50%; background: radial-gradient(circle at center, var(--surface) 56%, transparent 58%), conic-gradient(var(--accent) var(--progress), var(--surface-2) 0); }
.radial-progress strong { font-size: .9rem; }
.exact-entry { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: end; }
.unit-input { position: relative; }
.unit-input input { padding-right: 52px; font-weight: 800; }
.unit-input span { position: absolute; right: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: .74rem; font-weight: 800; pointer-events: none; }
.macro-cards { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; }
.macro-card { display: grid; grid-template-columns: auto 1fr; gap: 6px 9px; padding: 13px; border: 1px solid var(--line); border-radius: 16px; background: color-mix(in srgb, var(--surface) 80%, var(--bg)); }
.macro-card b { width: 25px; height: 25px; display: grid; place-items: center; border-radius: 9px; color: #ff8896; background: rgba(239,67,84,.14); font-size: .68rem; }
.macro-card strong { align-self: center; }
.macro-card small { grid-column: 1 / -1; color: var(--muted); font-size: .67rem; }

.evolution-hero { display: grid; grid-template-columns: minmax(270px,.78fr) minmax(0,1.42fr); min-height: 360px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(135deg,#211727,#111a2b 72%); }
.evolution-hero img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 22%; }
.evolution-hero > div { display: flex; flex-direction: column; justify-content: center; align-items: flex-start; padding: clamp(28px,5vw,58px); }
.evolution-hero h1 { margin: 10px 0 14px; color: #f6f5fb; font-size: clamp(2.1rem,4.7vw,3.55rem); line-height: 1.02; letter-spacing: -.055em; }
.evolution-hero p:not(.eyebrow) { max-width: 640px; color: #aeb5c7; line-height: 1.55; }

.range-tabs { width: fit-content; display: grid; grid-template-columns: repeat(4, minmax(88px,1fr)); gap: 4px; padding: 5px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.range-tabs button { min-height: 38px; padding: 7px 13px; border: 0; border-radius: 11px; background: transparent; color: var(--muted); font-weight: 800; cursor: pointer; }
.range-tabs button.active { background: var(--accent); color: #fff; }
.exercise-history-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.exercise-history-card { display: grid; grid-template-columns: 1fr auto; gap: 13px; align-items: center; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface-2); color: var(--ink); text-align: left; cursor: pointer; }
.exercise-history-card strong, .exercise-history-card small, .exercise-history-card b { display: block; }
.exercise-history-card small { margin-top: 4px; color: var(--muted); font-size: .7rem; }
.exercise-history-card > span:last-child { text-align: right; }
.exercise-record { display: grid; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface-2); }
.exercise-record small { display: block; margin-top: 3px; color: var(--muted); }
.set-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.set-chips span { padding: 6px 9px; border-radius: 999px; background: var(--surface); color: var(--muted); font-size: .72rem; }

.reflection-card { position: relative; overflow: hidden; padding: 22px 22px 22px 29px; background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 10%, var(--surface)), var(--surface)); border-left: 5px solid var(--accent); }
.reflection-card blockquote { margin: 7px 0 6px; font-size: clamp(1.05rem, 2.6vw, 1.35rem); font-weight: 750; line-height: 1.45; letter-spacing: -.018em; }
.reflection-card cite { color: var(--muted); font-size: .77rem; font-style: normal; }
.commitments { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; }
.commitment { display: flex; align-items: center; gap: 10px; min-height: 54px; padding: 12px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface-2); cursor: pointer; color: var(--ink); }
.commitment input { width: 20px; height: 20px; min-height: 0; accent-color: var(--accent); }
.commitment span { font-size: .82rem; font-weight: 800; }
.commitment.done { border-color: color-mix(in srgb, var(--good) 55%, var(--line)); background: color-mix(in srgb, var(--good) 12%, var(--surface)); }

.week-grid { display: grid; grid-template-columns: repeat(7,minmax(0,1fr)); gap: 10px; }
.week-card { position: relative; min-width: 0; min-height: 190px; padding: 14px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); cursor: pointer; text-align: left; box-shadow: var(--shadow); }
.week-card.today { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 20%, transparent), var(--shadow); }
.week-card.completed { border-color: color-mix(in srgb, var(--good) 48%, var(--line)); }
.week-check { position: absolute; top: 10px; right: 10px; width: 25px; height: 25px; display: grid; place-items: center; border-radius: 50%; background: var(--good); color: #fff; font-size: .8rem; font-weight: 950; box-shadow: 0 4px 12px color-mix(in srgb, var(--good) 30%, transparent); }
.week-card .day-date { display: block; margin-bottom: 12px; color: var(--muted); font-size: .68rem; }
.week-card strong { display: block; margin: 8px 0 7px; font-size: .96rem; }
.week-card .week-session { display: block; margin-top: 5px; overflow: hidden; color: var(--muted); font-size: .7rem; text-overflow: ellipsis; white-space: nowrap; }
.week-card .week-meta { display: grid; gap: 3px; margin-top: 12px; color: var(--muted); font-size: .65rem; }

.alert-grid { display: grid; gap: 10px; }
.alert-toggle { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: center; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface-2); }
.alert-toggle strong, .alert-toggle small { display: block; }
.alert-toggle strong { color: var(--ink); font-size: .9rem; }
.alert-toggle small { margin-top: 3px; color: var(--muted); font-size: .72rem; font-weight: 500; }
.alert-toggle input { width: 44px; height: 24px; min-height: 0; accent-color: var(--accent); }

.history-list { display: grid; gap: 10px; }
.history-item { width: 100%; display: grid; grid-template-columns: 1fr auto; gap: 13px; align-items: center; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--ink); text-align: left; cursor: pointer; }
.history-item strong, .history-item small { display: block; }
.history-item small { margin-top: 4px; color: var(--muted); }
.history-item .session-icon { width: 42px; height: 42px; }
.history-item h3 { margin: 0 0 4px; font-size: .94rem; }
.history-item p { margin: 0; color: var(--muted); font-size: .74rem; }

.button { min-height: 44px; padding: 10px 16px; border: 0; border-radius: 14px; background: var(--brand); color: var(--bg); font-weight: 800; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
:root[data-theme="dark"] .button { color: #fff; }
.button.secondary { background: var(--surface-2); color: var(--ink); border: 1px solid var(--line); }
.button.ghost { background: transparent; color: var(--brand-2); border: 1px solid var(--line); }
.button.accent { background: var(--accent); color: #2b210d; }
.button.danger { background: color-mix(in srgb, var(--danger) 14%, var(--surface)); color: var(--danger); border: 1px solid color-mix(in srgb, var(--danger) 35%, var(--line)); }
.button.small { min-height: 36px; padding: 7px 11px; border-radius: 11px; font-size: .82rem; }
.button:disabled { opacity: .48; cursor: not-allowed; }

.metric { min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.metric b { display: block; margin-top: 5px; font-size: 1.15rem; letter-spacing: -.025em; }
.metric small { color: var(--muted); }
.progress { height: 7px; margin-top: 10px; overflow: hidden; border-radius: 999px; background: var(--surface-2); }
.progress > i { display: block; height: 100%; width: var(--progress, 0%); max-width: 100%; border-radius: inherit; background: var(--accent); transition: width .25s; }
.progress.good > i { background: var(--good); }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); display: inline-block; }
.status-dot.good { background: var(--good); }

.pill, .source-badge { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; white-space: nowrap; }
.pill { padding: 6px 9px; background: var(--surface-2); color: var(--muted); font-size: .75rem; font-weight: 700; }
.source-badge { padding: 4px 7px; background: var(--accent-soft); color: color-mix(in srgb, var(--accent) 60%, var(--ink)); font-size: .67rem; font-weight: 900; letter-spacing: .05em; text-transform: uppercase; }
.source-badge.taco { background: color-mix(in srgb, #f0b62d 15%, var(--surface)); color: #d49c18; }
.source-badge.usda { background: color-mix(in srgb, var(--info) 15%, var(--surface)); color: var(--info); }
.source-badge.tbca { background: color-mix(in srgb, var(--good) 15%, var(--surface)); color: var(--good); }

.session-card { display: grid; grid-template-columns: auto 1fr auto; gap: 13px; align-items: center; }
.session-icon { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 16px; background: var(--accent-soft); font-size: 1.5rem; }
.session-card h3 { margin: 0 0 4px; }
.session-card p { margin: 0; color: var(--muted); font-size: .84rem; }
.completed-badge { display: inline-flex; align-items: center; min-height: 25px; padding: 4px 8px; border-radius: 999px; background: color-mix(in srgb, var(--good) 16%, var(--surface)); color: var(--good); font-size: .68rem; font-weight: 900; }
.button.completed-button { background: var(--good); color: #fff; }
.day-tabs { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 6px; scrollbar-width: none; }
.day-tabs::-webkit-scrollbar { display: none; }
.day-tab { min-width: 72px; padding: 10px 8px; border-radius: 15px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; text-align: center; }
.day-tab b, .day-tab small { display: block; }
.day-tab small { color: var(--muted); margin-top: 2px; }
.day-tab.active { border-color: var(--brand-2); background: var(--brand); color: var(--bg); }
.day-tab.active small { color: inherit; opacity: .78; }

label { display: grid; gap: 6px; color: var(--muted); font-size: .8rem; font-weight: 700; }
input, select, textarea { width: 100%; min-height: 44px; padding: 10px 12px; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--brand-2); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-2) 20%, transparent); }
textarea { min-height: 90px; resize: vertical; }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.search-row { display: grid; grid-template-columns: 1fr auto; gap: 9px; }

.meal-card { display: grid; gap: 13px; }
.meal-head { display: flex; justify-content: space-between; align-items: start; gap: 10px; }
.meal-head h3 { margin: 0; }
.meal-total { color: var(--muted); font-size: .8rem; }
.food-entry, .food-result { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 15px; background: color-mix(in srgb, var(--surface) 85%, var(--surface-2)); }
.food-entry h4, .food-result h4 { margin: 0 0 4px; font-size: .92rem; }
.food-entry p, .food-result p { margin: 0; color: var(--muted); font-size: .75rem; }
.macro-line { display: flex; flex-wrap: wrap; gap: 6px 10px; margin-top: 6px; color: var(--muted); font-size: .73rem; }
.empty { text-align: center; padding: 24px 14px; color: var(--muted); border: 1px dashed var(--line); border-radius: 16px; }

.exercise-list { display: grid; gap: 10px; counter-reset: exercise; }
.exercise-item { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 13px; border: 1px solid var(--line); border-radius: 15px; }
.exercise-number { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-2); font-weight: 900; }
.exercise-item h4 { margin: 0 0 4px; }
.exercise-item p { margin: 0; color: var(--muted); font-size: .77rem; }

.workout-runner { width: min(760px, 100%); margin: 0 auto; }
.runner-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.runner-status { position: sticky; z-index: 14; top: 76px; display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; padding: 11px; border: 1px solid color-mix(in srgb, var(--brand-2) 30%, var(--line)); border-radius: 17px; background: color-mix(in srgb, var(--surface) 92%, transparent); box-shadow: var(--shadow); backdrop-filter: blur(18px); }
.runner-status > div { min-width: 0; display: grid; gap: 2px; padding: 8px 10px; border-radius: 12px; background: var(--surface-2); }
.runner-status small { color: var(--muted); font-size: .67rem; }
.runner-status b { color: var(--brand-2); font-size: 1.28rem; font-variant-numeric: tabular-nums; letter-spacing: .03em; }
.runner-status strong { font-size: .88rem; font-variant-numeric: tabular-nums; }
.exercise-demo { position: relative; display: grid; gap: 9px; }
.exercise-demo > img { width: 100%; height: 260px; object-fit: cover; border-radius: 20px; background: var(--surface-2); }
.exercise-image-link { justify-self: start; }
.exercise-visual { min-height: 130px; display: grid; place-items: center; margin: 14px 0; border-radius: 20px; color: #fff; background: radial-gradient(circle at 70% 20%, rgba(255,255,255,.17), transparent 32%), linear-gradient(140deg, #1b5144, #b37d2c); font-size: 3.5rem; }
.exercise-demo .exercise-visual { margin: 0; }
.sets-scroll { overflow-x: auto; }
.sets-table { width: 100%; border-collapse: separate; border-spacing: 0 8px; }
.sets-table th { color: var(--muted); font-size: .72rem; text-align: left; }
.sets-table td { padding-right: 8px; }
.sets-table input { min-width: 66px; }
.rm-badge { display: inline-flex; min-width: 62px; min-height: 42px; align-items: center; justify-content: center; padding: 6px 8px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2); color: var(--muted); font-size: .74rem; font-weight: 800; white-space: nowrap; }
.check-button { width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 900; }
.check-button.done { border-color: var(--good); background: var(--good); color: #fff; }
.rest-card { position: sticky; bottom: calc(84px + var(--safe-bottom)); z-index: 12; display: grid; gap: 9px; background: var(--ink); color: var(--bg); border-radius: 18px; padding: 14px; box-shadow: var(--shadow); }
.rest-card b { font-size: 1.45rem; }
.rest-card .button { background: var(--bg); color: var(--ink); }
.workout-order-list { display: grid; gap: 8px; }
.workout-order-item { display: grid; grid-template-columns: auto minmax(0,1fr) auto; gap: 11px; align-items: center; padding: 11px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface-2); }
.workout-order-item.current { border-color: var(--brand-2); background: color-mix(in srgb, var(--brand) 12%, var(--surface)); }
.workout-order-item.completed:not(.current) { opacity: .7; }
.workout-order-item strong, .workout-order-item small { display: block; }
.workout-order-item small { margin-top: 3px; color: var(--muted); font-size: .7rem; }
.order-controls { display: flex; align-items: center; justify-content: end; gap: 5px; }
.order-controls .icon-button { width: 36px; height: 36px; min-height: 36px; text-decoration: none; }
.icon-button:disabled { opacity: .35; cursor: not-allowed; }
.calorie-only-entry { border-left: 4px solid var(--accent); }

.photo-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.photo-card { position: relative; aspect-ratio: 3 / 4; overflow: hidden; border-radius: 16px; background: var(--surface-2); }
.photo-card img { width: 100%; height: 100%; object-fit: cover; }
.photo-card span { position: absolute; inset: auto 6px 6px; padding: 5px 7px; border-radius: 9px; background: rgba(0,0,0,.64); color: #fff; font-size: .68rem; }

.setting-section { display: grid; gap: 12px; }
.notice { padding: 13px; border-left: 4px solid var(--info); background: color-mix(in srgb, var(--info) 10%, var(--surface)); border-radius: 10px; color: var(--muted); font-size: .82rem; }
.danger-zone { border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); }

.bottom-nav { position: fixed; z-index: 40; bottom: 0; left: 50%; transform: translateX(-50%); width: min(720px, calc(100% - 18px)); padding: 8px 9px calc(8px + var(--safe-bottom)); display: grid; grid-template-columns: repeat(6, 1fr); gap: 3px; background: color-mix(in srgb, var(--surface) 93%, transparent); border: 1px solid var(--line); border-bottom: 0; border-radius: 22px 22px 0 0; box-shadow: 0 -10px 35px rgba(0,0,0,.1); backdrop-filter: blur(18px); }
.bottom-nav button { min-width: 0; border: 0; border-radius: 14px; padding: 7px 2px; background: transparent; color: var(--muted); cursor: pointer; }
.bottom-nav span, .bottom-nav small { display: block; }
.bottom-nav span { font-size: 1.1rem; margin-bottom: 2px; }
.bottom-nav small { font-size: .63rem; font-weight: 800; }
.bottom-nav button.active { background: color-mix(in srgb, var(--brand) 24%, var(--surface)); color: var(--brand-2); }

.modal { width: min(760px, calc(100% - 20px)); max-height: calc(100vh - 28px); padding: 0; border: 0; border-radius: 24px; color: var(--ink); background: var(--surface); box-shadow: 0 25px 80px rgba(0,0,0,.35); }
.modal::backdrop { background: rgba(6, 15, 12, .64); backdrop-filter: blur(3px); }
.modal-shell { display: grid; max-height: calc(100vh - 28px); }
.modal-header { position: sticky; top: 0; z-index: 3; display: flex; justify-content: space-between; align-items: start; gap: 12px; padding: 18px; background: var(--surface); border-bottom: 1px solid var(--line); }
.modal-header h2 { margin: 0; }
.modal-body { overflow: auto; padding: 18px; }
.toast { position: fixed; z-index: 100; left: 50%; bottom: calc(90px + var(--safe-bottom)); transform: translate(-50%, 20px); max-width: calc(100% - 32px); padding: 11px 15px; border-radius: 12px; background: var(--ink); color: var(--bg); opacity: 0; pointer-events: none; transition: .2s; box-shadow: var(--shadow); text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 760px) {
  .grid-3 { grid-template-columns: 1fr; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .page-head { align-items: start; }
  .session-card { grid-template-columns: auto 1fr; }
  .session-card > .button { grid-column: 1 / -1; }
  .photo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .legacy-hero-grid { grid-template-columns: 1fr; }
  .legacy-hero-copy { min-height: 360px; }
  .legacy-hero-photo { min-height: 390px; }
  .hero-stats { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .week-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .week-card:first-child { grid-column: 1 / -1; }
  .nutrition-overview { grid-template-columns: 1fr; }
  .evolution-hero { grid-template-columns: 1fr; }
  .evolution-hero img { height: 390px; }
  .exercise-history-grid { grid-template-columns: 1fr; }
}

@media (max-width: 460px) {
  #app { padding-inline: 12px; }
  .topbar { padding-inline: 12px; }
  .brand small { display: none; }
  .grid-2, .field-row { grid-template-columns: 1fr; }
  .hero { padding: 20px; }
  .card { padding: 15px; }
  .food-result { grid-template-columns: 1fr; }
  .food-result .button { width: 100%; }
  .commitments { grid-template-columns: 1fr; }
  .legacy-hero-copy { padding: 24px 20px; min-height: 330px; }
  .legacy-hero-photo { min-height: 360px; }
  .nutrition-date-hero { grid-template-columns: 42px 1fr 42px; gap: 6px; }
  .nutrition-date-hero h1 { font-size: 1.72rem; }
  .nutrition-reflection { padding: 20px; }
  .macro-cards { grid-template-columns: 1fr; }
  .exact-entry { grid-template-columns: 1fr; }
  .range-tabs { width: 100%; grid-template-columns: repeat(4,minmax(0,1fr)); }
  .range-tabs button { padding-inline: 5px; font-size: .72rem; }
  .evolution-hero img { height: 330px; }
  .evolution-hero > div { padding: 26px 20px 30px; }
  .exercise-history-card { grid-template-columns: 1fr; }
  .exercise-history-card > span:last-child { text-align: left; }
  .runner-status { top: 68px; grid-template-columns: repeat(2,minmax(0,1fr)); }
  .runner-status > div:first-child { grid-column: 1 / -1; }
  .workout-order-item { grid-template-columns: auto minmax(0,1fr); }
  .workout-order-item .order-controls { grid-column: 1 / -1; justify-content: stretch; flex-wrap: wrap; }
  .workout-order-item .order-controls .button { flex: 1; }
  .exercise-demo > img { height: 210px; }
}

@media print {
  .topbar, .bottom-nav, .button, .icon-button { display: none !important; }
  #app { padding: 0; }
  .card { box-shadow: none; break-inside: avoid; }
}
