@font-face {
  font-family: Outfit;
  src: url("../fonts/outfit-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: Outfit;
  src: url("../fonts/outfit-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: Outfit;
  src: url("../fonts/outfit-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: Fraunces;
  src: url("../fonts/fraunces-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

:root,
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #12130f;
  --bg-elev: #1c1e17;
  --bg-sunken: #0d0e0b;
  --text: #f4f2ea;
  --muted: #a8a292;
  --faint: #7b766c;
  --line: rgba(244, 242, 234, 0.12);
  --accent: #dff25a;
  --accent-ink: #17190c;
  --accent-text: #dff25a;
  --good: #b7d98a;
  --warn: #f0b36a;
  --bad: #f0a090;
  --bad-ink: #2a1210;
  --jack: #dff25a;
  --wife: #b7c9ff;
  --chart-grid: rgba(244, 242, 234, 0.08);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  --nav: rgba(18, 19, 15, 0.94);
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f0e6;
  --bg-elev: #fffdf8;
  --bg-sunken: #e7e2d4;
  --text: #1b1a16;
  --muted: #5c574e;
  --faint: #7d776c;
  --line: rgba(27, 26, 22, 0.12);
  --accent: #d5e85a;
  --accent-ink: #1a1c0c;
  --accent-text: #3f4e12;
  --good: #217a45;
  --warn: #8a4e10;
  --bad: #9d342c;
  --bad-ink: #fff;
  --jack: #4e5e12;
  --wife: #2f4f9e;
  --chart-grid: rgba(27, 26, 22, 0.08);
  --shadow: 0 16px 40px rgba(40, 32, 16, 0.12);
  --nav: rgba(243, 240, 230, 0.94);
}

/* Colour schemes chosen on the profile. data-theme still sets dark or light. */
html[data-scheme="mono"][data-theme="dark"] {
  --bg: #0b0b0b;
  --bg-elev: #171717;
  --bg-sunken: #050505;
  --text: #f5f5f5;
  --muted: #a3a3a3;
  --faint: #767676;
  --line: rgba(245, 245, 245, 0.13);
  --accent: #f5f5f5;
  --accent-ink: #0b0b0b;
  --accent-text: #ffffff;
  --good: #d4d4d4;
  --jack: #f5f5f5;
  --chart-grid: rgba(245, 245, 245, 0.08);
  --nav: rgba(11, 11, 11, 0.94);
  --glow: rgba(255, 255, 255, 0.05);
}
html[data-scheme="mono"][data-theme="light"] {
  --bg: #fafafa;
  --bg-elev: #ffffff;
  --bg-sunken: #ececec;
  --text: #0a0a0a;
  --muted: #525252;
  --faint: #737373;
  --line: rgba(10, 10, 10, 0.13);
  --accent: #111111;
  --accent-ink: #fafafa;
  --accent-text: #111111;
  --good: #404040;
  --jack: #111111;
  --chart-grid: rgba(10, 10, 10, 0.08);
  --nav: rgba(250, 250, 250, 0.94);
  --glow: rgba(0, 0, 0, 0.04);
}
html[data-scheme="pink"][data-theme="dark"] {
  --bg: #140f12;
  --bg-elev: #1f171c;
  --bg-sunken: #0d090b;
  --text: #f8eef3;
  --muted: #b89dab;
  --faint: #8a717e;
  --line: rgba(248, 238, 243, 0.12);
  --accent: #ff7eb6;
  --accent-ink: #2a0b19;
  --accent-text: #ff94c4;
  --good: #8fd6b0;
  --jack: #ff7eb6;
  --chart-grid: rgba(248, 238, 243, 0.08);
  --nav: rgba(20, 15, 18, 0.94);
  --glow: rgba(255, 126, 182, 0.09);
}
html[data-scheme="pink"][data-theme="light"] {
  --bg: #fdf3f8;
  --bg-elev: #ffffff;
  --bg-sunken: #f5e2ec;
  --text: #24121b;
  --muted: #6b4e5c;
  --faint: #8a6f7d;
  --line: rgba(36, 18, 27, 0.12);
  --accent: #f472b6;
  --accent-ink: #2a0b19;
  --accent-text: #b0276e;
  --good: #1f7a4d;
  --jack: #c2357f;
  --chart-grid: rgba(36, 18, 27, 0.08);
  --nav: rgba(253, 243, 248, 0.94);
  --glow: rgba(244, 114, 182, 0.12);
}
html[data-scheme="blue"][data-theme="dark"] {
  --bg: #0e1218;
  --bg-elev: #161c26;
  --bg-sunken: #0a0d12;
  --text: #eef3fa;
  --muted: #9aa8bb;
  --faint: #6f7d91;
  --line: rgba(238, 243, 250, 0.12);
  --accent: #6ab0ff;
  --accent-ink: #071a30;
  --accent-text: #85bfff;
  --good: #8fd6b0;
  --jack: #6ab0ff;
  --chart-grid: rgba(238, 243, 250, 0.08);
  --nav: rgba(14, 18, 24, 0.94);
  --glow: rgba(106, 176, 255, 0.09);
}
html[data-scheme="blue"][data-theme="light"] {
  --bg: #f2f6fc;
  --bg-elev: #ffffff;
  --bg-sunken: #e0e9f5;
  --text: #111a26;
  --muted: #4d5b6e;
  --faint: #6c7a8e;
  --line: rgba(17, 26, 38, 0.12);
  --accent: #60a5fa;
  --accent-ink: #08213f;
  --accent-text: #1d5fb8;
  --good: #1f7a4d;
  --jack: #1d5fb8;
  --chart-grid: rgba(17, 26, 38, 0.08);
  --nav: rgba(242, 246, 252, 0.94);
  --glow: rgba(96, 165, 250, 0.12);
}

* { box-sizing: border-box; }
html { touch-action: manipulation; }
body {
  margin: 0;
  /* lvh, not the live visual viewport: Android's address bar would resize the page on scroll. */
  min-height: 100lvh;
  background: var(--bg-sunken);
  color: var(--text);
  font-family: Outfit, "Avenir Next", "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.4;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
img { max-width: 100%; display: block; }
p, h1, h2, h3 { margin: 0; }
h1, h2, h3 { font-weight: 600; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.92em; }
::placeholder { color: var(--faint); }
:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; }
#app {
  width: min(480px, 100%);
  min-height: 100lvh;
  margin: 0 auto;
  background: var(--bg);
  position: relative;
}

.splash {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px;
  text-align: center;
}
.splash { background: #000; }
.splash p { font-family: Fraunces, "Iowan Old Style", Palatino, serif; font-size: 52px; letter-spacing: -0.04em; }
.splash span { color: #9a9a9a; letter-spacing: 0.08em; text-transform: uppercase; font-size: 12px; font-weight: 600; }
.splash-logo { width: min(240px, 64vw); height: auto; animation: logo-breathe 1.8s ease-in-out infinite; }
@keyframes logo-breathe {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 0 rgba(255, 255, 255, 0)); }
  50% { transform: scale(1.03); filter: drop-shadow(0 0 18px rgba(255, 255, 255, 0.18)); }
}

.top {
  position: sticky;
  top: 0;
  z-index: 15;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 12px;
  background: var(--bg);
}
.top-row, .top-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.brand { display: inline-flex; padding: 0; border-radius: 12px; }
/* The artwork sits on black, so it always gets a black badge. That reads as a
   logo plate in light themes instead of a black box. */
.brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 40px;
  padding: 0 10px 0 4px;
  border-radius: 12px;
  background: #000;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08), 0 6px 18px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  position: relative;
}
.brand-badge img { display: block; height: 30px; width: auto; }
.brand-badge img + img { height: 25px; }
.brand-badge::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, 0.22) 50%, transparent 65%);
  transform: translateX(-120%);
  animation: sheen 6s ease-in-out 1.2s infinite;
  pointer-events: none;
}
@keyframes sheen {
  0%, 82% { transform: translateX(-120%); }
  100% { transform: translateX(120%); }
}
.icon-btn, .icon-hit {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: var(--text);
}
.icon { width: 22px; height: 22px; display: block; }
.mode-pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 600;
}
.mode-pill.is-live { color: var(--good); }
.mode-pill.is-wait { color: var(--warn); }
.mode-pill.is-local { color: var(--muted); }
.mode-pill.is-live::before, .mode-pill.is-wait::before {
  content: "";
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border-radius: 99px;
  background: currentColor;
}
.who {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 2px 0 0;
  font-weight: 600;
}
.dot { width: 8px; height: 8px; border-radius: 99px; background: var(--faint); }
.dot-jack { background: var(--jack); }
.dot-wife { background: var(--wife); }
.lvl-pill {
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--accent-text);
  font-size: 12px;
  font-weight: 600;
}
.rank {
  min-width: 52px;
  padding: 3px 8px;
  border-radius: 8px;
  background: var(--bg-sunken);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
}
.rank-c, .rank-b { color: var(--good); }
.rank-a, .rank-s { background: var(--accent); color: var(--accent-ink); }
.levelup { text-align: center; align-items: center; }
.xp-top { display: flex; align-items: center; gap: 14px; }
.xp-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.xp-text strong { font-size: 20px; }
.xp-gauge-big { display: grid; place-items: center; padding: 4px 0; }
.rank-table { display: flex; flex-direction: column; }
.rank-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); }
.rank-row:first-child { border-top: 0; }
.rank-row .rank { min-width: 36px; }
.rank-row.is-here .rank-name strong { color: var(--accent-text); }
.rank-name { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.rank-name span { color: var(--muted); font-size: 13px; }
.levelup-num {
  font-family: Fraunces, "Iowan Old Style", Palatino, serif;
  font-size: 48px;
  letter-spacing: -0.03em;
  line-height: 1;
}
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}
.net {
  margin: 0;
  padding: 8px 16px;
  background: var(--bg-sunken);
  color: var(--muted);
  font-size: 13px;
}
.net-moved { color: var(--text); line-height: 1.45; }
.net-moved a { color: var(--accent-text); font-weight: 600; }
.moved { text-align: left; }
.moved h1 { font-size: 30px; }
.net-update { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 0; padding-bottom: 0; color: var(--text); }
.net-update .text-btn { color: var(--accent-text); }

.page {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 8px 16px calc(96px + env(safe-area-inset-bottom) + var(--pad-h, 0px));
}
.page > h1, .page-head h1, .auth h1 {
  font-family: Fraunces, "Iowan Old Style", Palatino, serif;
  font-size: 36px;
  letter-spacing: -0.03em;
  line-height: 1.05;
}
.page-head { display: flex; flex-direction: column; gap: 4px; }
.section-label {
  margin-top: 4px;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
}
.eyebrow { color: var(--muted); font-size: 14px; }
.hint { color: var(--muted); font-size: 13px; line-height: 1.45; }
.pad { padding: 0 2px; }
.empty { color: var(--muted); }
.error-text { color: var(--bad); font-size: 14px; }
.foot { color: var(--faint); font-size: 12px; line-height: 1.45; }
.callout {
  padding: 10px 12px;
  border-left: 3px solid var(--accent);
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.hero { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.hero-num {
  font-family: Fraunces, "Iowan Old Style", Palatino, serif;
  font-size: clamp(68px, 20vw, 88px);
  line-height: 0.86;
  letter-spacing: -0.045em;
  font-weight: 600;
}
.hero-unit {
  margin-left: 6px;
  font-family: Outfit, sans-serif;
  font-size: 18px;
  letter-spacing: 0;
  color: var(--muted);
  font-weight: 500;
}
.hero-empty { color: var(--faint); }
.hero-sub { font-size: 15px; line-height: 1.4; }
.target-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  color: var(--muted);
  font-size: 13px;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--bg-elev);
}
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.session-title { font-size: 22px; font-family: Fraunces, serif; letter-spacing: -0.02em; }
.chart-box { height: 190px; }
.link-card { color: inherit; flex-direction: row; justify-content: space-between; align-items: center; text-align: left; }
.link-card strong { font-weight: 500; color: var(--muted); text-align: right; }
.head-link { display: inline-flex; align-items: center; gap: 4px; padding: 0; color: inherit; font: inherit; text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: 4px; }
.head-link span { color: var(--accent-text); }
.pace-list { display: flex; flex-direction: column; gap: 8px; }
.pace { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; }
.pace:has(input:checked) { border-color: var(--accent-text); background: var(--bg-sunken); }
.pace input { margin-top: 3px; accent-color: var(--accent-text); }
.pace span { display: flex; flex-direction: column; gap: 2px; }
.pace small { color: var(--muted); font-size: 13px; line-height: 1.35; }
.targets-card { background: var(--bg-sunken); }
.target-summary { font-weight: 600; border-radius: 8px; }
.target-summary.is-new { animation: flash 0.9s ease; }
@keyframes flash {
  0% { background: color-mix(in srgb, var(--accent) 35%, transparent); }
  100% { background: transparent; }
}

.meter { display: flex; flex-direction: column; gap: 6px; }
.meter-top { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; }
.meter-track { height: 8px; overflow: hidden; border-radius: 99px; background: var(--bg-sunken); }
.meter-fill { height: 100%; border-radius: inherit; background: var(--accent); }
.meter-fill.is-good { background: var(--good); }
.meter-fill.is-over { background: var(--warn); }

.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.quick-btn {
  min-height: 72px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--bg-elev);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  text-align: left;
}
.quick-btn strong { font-size: 15px; }
.quick-btn span { color: var(--muted); font-size: 12px; line-height: 1.3; }
.quick .quick-btn:last-child:nth-child(odd) { grid-column: 1 / -1; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg);
  color: var(--text);
  font-weight: 600;
}
.btn-block { width: 100%; }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn-danger { background: var(--bad); color: var(--bad-ink); border-color: transparent; }
.btn:disabled { opacity: 0.6; }
.btn:active, .quick-btn:active, .switch-btn:active { transform: scale(0.985); }
.text-btn { min-height: 44px; color: var(--muted); font-weight: 600; }

.seg { display: flex; gap: 2px; padding: 3px; border-radius: 12px; background: var(--bg-sunken); }
.seg-wrap { width: 100%; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.seg-btn {
  flex: 1;
  min-height: 36px;
  padding: 0 8px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}
.seg-btn.is-on { background: var(--bg-elev); color: var(--text); }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.chips.wrap { flex-wrap: wrap; overflow: visible; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-elev);
}
.chip.is-on { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.chip.is-off { background: color-mix(in srgb, var(--bad) 18%, transparent); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, transparent); text-decoration: line-through; }
.fav { color: #ff5c8a; font-size: 14px; }
.warn-text { color: var(--warn) !important; font-size: 12px !important; }
.text-btn.inline { min-height: 0; padding: 0 2px; color: var(--accent-text); text-decoration: underline; }
.recipe-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.fav-btn {
  flex: none;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 99px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 22px;
  transition: transform 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.fav-btn.is-on { color: #ff5c8a; border-color: color-mix(in srgb, #ff5c8a 50%, transparent); animation: heart 0.45s ease-out; }
@keyframes heart {
  0% { transform: scale(0.7); }
  60% { transform: scale(1.2); }
  100% { transform: scale(1); }
}
.mini-details { gap: 0; padding: 10px 14px; background: transparent; border-style: dashed; }
.mini-details[open] { gap: 10px; padding: 14px; background: var(--bg-elev); border-style: solid; }
.mini-details summary { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 36px; cursor: pointer; list-style: none; }
.mini-details summary::-webkit-details-marker { display: none; }
.mini-details summary::after { content: "▾"; color: var(--faint); }
.mini-details[open] summary::after { content: "▴"; }
.mini-details summary span { display: flex; flex-direction: column; gap: 1px; }
.mini-details summary strong { font-size: 14px; }
.mini-details summary small { color: var(--faint); font-size: 12px; }
.ex-lines li.is-now span { color: var(--accent-text); font-weight: 600; }
.plain.small { font-size: 13px; color: var(--muted); padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.prefs-card { gap: 0; }
.prefs-card[open] { gap: 10px; }
.prefs-card summary { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 32px; cursor: pointer; list-style: none; }
.prefs-card summary::-webkit-details-marker { display: none; }
.prefs-card summary .hint { text-align: right; }

.list { display: flex; flex-direction: column; }
.item { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.item-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.item-main span, .group-head span { color: var(--muted); font-size: 13px; }
.item-actions { display: flex; }
button.item { width: 100%; text-align: left; color: inherit; min-height: 52px; }

.menu-day { gap: 0; }
.menu-day summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  cursor: pointer;
  list-style: none;
}
.menu-day summary::-webkit-details-marker { display: none; }
.menu-day summary::after { content: "▾"; color: var(--faint); margin-left: 4px; }
.menu-day[open] summary::after { content: "▴"; }
.menu-day summary .hint { margin-left: auto; }
.menu-rows { display: flex; flex-direction: column; margin-top: 8px; }
.menu-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-top: 1px solid var(--line);
}
.menu-slot { color: var(--faint); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.menu-meal { display: flex; flex-direction: column; gap: 2px; min-width: 0; text-align: left; color: inherit; min-height: 44px; justify-content: center; }
.menu-meal strong { font-weight: 600; font-size: 15px; }
.menu-meal span { color: var(--muted); font-size: 13px; }
.portion { color: var(--accent-text); font-size: 13px; }
.menu-row .text-btn { padding: 0 4px; }

.shop-item { gap: 12px; }
.shop-box {
  flex: none;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 2px solid var(--line);
  border-radius: 7px;
  color: var(--accent-ink);
  font-weight: 700;
  font-size: 14px;
}
.shop-item.is-done .shop-box { background: var(--accent); border-color: transparent; }
.shop-item.is-done .item-main strong { color: var(--faint); text-decoration: line-through; }
.shop-qty { color: var(--muted); font-size: 14px; white-space: nowrap; }

.macro-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.macro-grid div { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 4px; border-radius: 12px; background: var(--bg-sunken); }
.macro-grid strong { font-size: 20px; }
.macro-grid span { color: var(--muted); font-size: 12px; }
.group-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-top: 8px; }
.group-head h3 { font-size: 15px; }
.ex-lines, .plain, .swaps { margin: 0; }
.ex-lines { list-style: none; padding: 0; }
.ex-lines li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.ex-lines li span:last-child { color: var(--muted); white-space: nowrap; }
.plain { padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
.swaps { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; list-style: none; }
.swaps li { padding: 6px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 13px; }

.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.photo-tile { display: flex; flex-direction: column; gap: 4px; text-align: left; color: var(--muted); font-size: 12px; }
.photo-tile img, .photo-tile span {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 12px;
  background: var(--bg-sunken);
}
.photo-tile span { display: grid; place-items: center; }
.preview { width: 100%; max-height: 320px; object-fit: cover; border-radius: 16px; background: #000; }

.field, fieldset.field { display: flex; flex-direction: column; gap: 6px; border: 0; margin: 0; padding: 0; }
.field span, .field legend { color: var(--muted); font-size: 13px; padding: 0; }
.field input, .field textarea, .field select, .ex input {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  font-size: 16px;
}
.field textarea { min-height: 88px; resize: vertical; }
.field-lg input {
  font-family: Fraunces, serif;
  font-size: 40px;
  text-align: center;
  letter-spacing: -0.03em;
}
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.file-btn { position: relative; }
.file-btn input { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.energy { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.energy label { position: relative; }
.energy input { position: absolute; opacity: 0; }
.energy span {
  display: grid;
  place-items: center;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
}
.energy input:checked + span { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.energy input:focus-visible + span { outline: 2px solid var(--accent-text); outline-offset: 2px; }
.check { display: flex; gap: 10px; align-items: flex-start; }
.check input { width: 20px; height: 20px; margin-top: 3px; accent-color: var(--accent-text); }
.check span { display: flex; flex-direction: column; }
.check small { color: var(--muted); }
.ex-list { display: flex; flex-direction: column; }
.ex {
  display: grid;
  grid-template-columns: 1fr 76px;
  gap: 8px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.ex input { min-height: 44px; text-align: center; }
.set-list { display: flex; flex-direction: column; gap: 14px; }
.set-block { display: flex; flex-direction: column; gap: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.set-block h3 { font-size: 16px; }
.set-row { display: grid; grid-template-columns: 32px minmax(0, 1fr) minmax(0, 1fr); gap: 8px; align-items: center; }
.set-row input { width: 100%; min-width: 0; min-height: 44px; text-align: center; }
.set-done { justify-content: center; }
.picker { display: flex; flex-direction: column; gap: 10px; }
.picker-list { display: flex; flex-direction: column; max-height: 280px; overflow: auto; border: 1px solid var(--line); border-radius: 14px; }
.picker-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-height: 52px;
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  background: transparent;
}
.picker-item span { color: var(--muted); font-size: 13px; }
.picker-item[hidden] { display: none; }
.plan-list { display: flex; flex-direction: column; gap: 12px; }
.plan-card.is-on { border-color: var(--accent-text); }
.group-head span { text-align: right; }
.barcode-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: end; }
.product { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 16px; background: var(--bg-sunken); }
#qr-region { overflow: hidden; min-height: 220px; border-radius: 16px; background: #000; }
#qr-region video { width: 100% !important; border-radius: 16px; }

.backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(8, 9, 6, 0.55); }
.sheet {
  position: fixed;
  z-index: 45;
  left: 50%;
  bottom: var(--pad-h, 0px);
  width: min(480px, 100%);
  max-height: calc(var(--vvh, 100dvh) - 8px - var(--pad-h, 0px));
  overflow: auto;
  transform: translateX(-50%);
  border-radius: 22px 22px 0 0;
  background: var(--bg-elev);
  box-shadow: var(--shadow);
}
.grabber { width: 42px; height: 4px; margin: 8px auto 0; border-radius: 99px; background: var(--line); }
.sheet-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 8px 0 16px;
  background: var(--bg-elev);
}
.sheet-body { display: flex; flex-direction: column; gap: 12px; padding: 8px 16px 16px; }
.numpad {
  position: fixed;
  z-index: 70;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(480px, 100%);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  background: var(--bg-elev);
  border-top: 1px solid var(--line);
}
.numpad[hidden] { display: none; }
.pad-key {
  min-height: 44px;
  border-radius: 12px;
  background: var(--bg-sunken);
  font-size: 20px;
  font-weight: 600;
}
input[data-pad]:focus { outline: 2px solid var(--accent-text); outline-offset: 1px; }
.sheet-actions {
  position: sticky;
  bottom: 0;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: var(--bg-elev);
}
.confirm-back { z-index: 80; }
.ex-name { display: inline-flex; align-items: center; gap: 6px; padding: 0; color: inherit; font: inherit; font-weight: inherit; text-align: left; }
.ex-name > span:first-child { text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent-text) 45%, transparent); text-underline-offset: 3px; }
.ex-info {
  flex: none;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border-radius: 99px;
  border: 1.5px solid var(--accent-text);
  color: var(--accent-text);
  font-family: Fraunces, serif;
  font-size: 11px;
  font-style: italic;
  font-weight: 700;
}
.ex-lines li .ex-name { color: var(--text); }
.guide-back { z-index: 84; }
.guide {
  position: fixed;
  z-index: 85;
  left: 50%;
  bottom: 0;
  width: min(480px, 100%);
  max-height: calc(var(--vvh, 100dvh) - 40px);
  overflow: auto;
  transform: translateX(-50%);
  border-radius: 22px 22px 0 0;
  background: var(--bg-elev);
  box-shadow: var(--shadow);
  animation: sheet-up 0.32s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.guide-body { display: flex; flex-direction: column; gap: 12px; padding: 8px 16px calc(18px + env(safe-area-inset-bottom)); }
.guide-muscles { color: var(--accent-text); font-size: 13px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.guide-steps { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 8px; line-height: 1.45; }
.guide-steps li::marker { color: var(--accent-text); font-weight: 700; }
a.btn { display: flex; align-items: center; justify-content: center; text-decoration: none; color: inherit; }
.confirm {
  position: fixed;
  z-index: 81;
  left: 50%;
  top: 50%;
  width: min(420px, calc(100% - 32px));
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  transform: translate(-50%, -50%);
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--bg-elev);
}
#toast {
  position: fixed;
  z-index: 90;
  left: 50%;
  bottom: calc(84px + env(safe-area-inset-bottom));
  width: min(440px, calc(100% - 24px));
  padding: 12px 14px;
  transform: translateX(-50%);
  border-radius: 14px;
  background: var(--text);
  color: var(--bg);
  font-weight: 600;
  text-align: center;
}

.nav {
  position: fixed;
  z-index: 20;
  left: 50%;
  bottom: 0;
  width: min(480px, 100%);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  border-top: 1px solid var(--line);
  background: var(--nav);
  backdrop-filter: blur(16px);
}
.nav-btn {
  min-height: 52px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--faint);
  font-size: 11px;
  font-weight: 600;
}
.nav-btn.is-on { color: var(--accent-text); }

.consent { align-items: flex-start; font-size: 14px; line-height: 1.45; color: var(--muted); }
.consent a, .foot a { color: var(--accent-text); }
.auth-logo { width: 100%; max-width: 360px; height: auto; align-self: center; border-radius: 22px; background: #000; }
.auth {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: calc(48px + env(safe-area-inset-top)) 20px 32px;
}

@media (min-width: 840px) {
  body {
    background:
      radial-gradient(900px 420px at 80% -10%, var(--glow, rgba(223, 242, 90, 0.08)), transparent 50%),
      var(--bg-sunken);
  }
}
/* Home page: greeting, plan hero, rings, week strip, folding weight card. */
.greet { display: flex; flex-direction: column; gap: 2px; padding-top: 4px; }
.greet-title {
  font-family: Fraunces, "Iowan Old Style", Palatino, serif;
  font-size: clamp(30px, 8.5vw, 38px);
  letter-spacing: -0.03em;
  line-height: 1.05;
}
.plan-hero {
  position: relative;
  overflow: hidden;
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
  background:
    radial-gradient(120% 90% at 100% 0%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 60%),
    var(--bg-elev);
}
.plan-hero .eyebrow { color: var(--accent-text); font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
.plan-hero h2 { font-family: Fraunces, serif; font-size: 24px; letter-spacing: -0.02em; }
.plan-progress { height: 4px; border-radius: 99px; background: var(--bg-sunken); overflow: hidden; }
.plan-progress span { display: block; height: 100%; border-radius: inherit; background: var(--accent); transform-origin: left; }
.week-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.week-day { display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--faint); font-size: 11px; font-weight: 600; }
.week-dot {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 99px;
  background: var(--bg-sunken);
  color: var(--accent-ink);
  font-size: 13px;
  font-weight: 700;
  transition: background 0.3s ease, transform 0.3s ease;
}
.week-day.is-done .week-dot { background: var(--accent); }
.week-day.is-today .week-dot { box-shadow: 0 0 0 2px var(--accent-text); }
.week-day.is-today small { color: var(--accent-text); }
.week-day.is-future .week-dot { opacity: 0.5; }

.rings { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
.ring-cell { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 13px; font-weight: 600; color: var(--muted); }
.ring { flex: none; max-width: 100%; height: auto; }
.ring-track { fill: none; stroke: var(--bg-sunken); stroke-width: 10; }
.ring-fill { fill: none; stroke: var(--accent); stroke-width: 10; stroke-linecap: round; transition: stroke-dashoffset 0.6s cubic-bezier(0.2, 0.8, 0.2, 1); }
.ring.is-good .ring-fill { stroke: var(--good); }
.ring.is-over .ring-fill { stroke: var(--warn); }
.ring-top { fill: var(--text); font-size: 21px; font-weight: 600; text-anchor: middle; }
.ring-bottom { fill: var(--muted); font-size: 10px; font-weight: 600; text-anchor: middle; }
.ring-xp .ring-top { font-family: Fraunces, serif; font-size: 32px; }
.ring-xp .ring-bottom { font-size: 9px; letter-spacing: 0.12em; }
.rings-card .hint { text-align: center; }

.weight-card { gap: 0; }
.weight-card.is-open { gap: 10px; }
.weight-toggle { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; min-height: 40px; text-align: left; color: inherit; }
.weight-head { display: flex; flex-direction: column; gap: 2px; }
.weight-head span { color: var(--muted); font-size: 13px; }
.chev { color: var(--faint); transition: transform 0.25s ease; }
.weight-card.is-open .chev { transform: rotate(180deg); }

.profile-card { gap: 12px; }
.stat-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.stat-row div { display: flex; flex-direction: column; gap: 2px; padding: 10px; border-radius: 12px; background: var(--bg-sunken); }
.stat-row strong { font-family: Fraunces, serif; font-size: 22px; letter-spacing: -0.02em; }
.stat-row span { color: var(--muted); font-size: 12px; }
.field-note { color: var(--faint); font-size: 12px; }

/* Motion. Cards rise in one after another when a tab opens, rings draw in,
   and buttons give a little when pressed. Re-renders inside a tab stay still. */
@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
@keyframes ring-draw {
  from { stroke-dashoffset: var(--len); }
}
@keyframes grow {
  from { transform: scaleX(0); }
}
@keyframes pop {
  0% { transform: scale(0.6); }
  70% { transform: scale(1.08); }
  100% { transform: scale(1); }
}
.is-entering > * { animation: rise 0.45s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.is-entering > *:nth-child(2) { animation-delay: 40ms; }
.is-entering > *:nth-child(3) { animation-delay: 80ms; }
.is-entering > *:nth-child(4) { animation-delay: 120ms; }
.is-entering > *:nth-child(5) { animation-delay: 160ms; }
.is-entering > *:nth-child(6) { animation-delay: 200ms; }
.is-entering > *:nth-child(n + 7) { animation-delay: 240ms; }
.is-entering .ring-fill { animation: ring-draw 1.1s cubic-bezier(0.2, 0.8, 0.2, 1) 0.15s both; }
.is-entering .meter-fill, .is-entering .plan-progress span { animation: grow 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) 0.15s both; transform-origin: left; }
.is-entering .week-day.is-done .week-dot { animation: pop 0.45s ease-out both; }
.is-entering .week-day:nth-child(2) .week-dot { animation-delay: 30ms; }
.is-entering .week-day:nth-child(3) .week-dot { animation-delay: 60ms; }
.is-entering .week-day:nth-child(4) .week-dot { animation-delay: 90ms; }
.is-entering .week-day:nth-child(5) .week-dot { animation-delay: 120ms; }
.is-entering .week-day:nth-child(6) .week-dot { animation-delay: 150ms; }
.is-entering .week-day:nth-child(7) .week-dot { animation-delay: 180ms; }
.btn, .quick-btn, .chip, .seg-btn, .nav-btn, .link-card, .recipe-item, .pad-key {
  transition: transform 0.12s ease, background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.btn:active, .quick-btn:active, .chip:active, .link-card:active, .recipe-item:active, .pad-key:active { transform: scale(0.97); }
.nav-btn:active { transform: translateY(1px); }
.quick-btn { position: relative; overflow: hidden; }
.quick-btn:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }

/* Sheets, dialogs, toasts, the active tab, and the level-up confetti. */
@keyframes sheet-up {
  from { transform: translate(-50%, 100%); }
  to { transform: translate(-50%, 0); }
}
@keyframes fade-in {
  from { opacity: 0; }
}
@keyframes dialog-in {
  from { opacity: 0; transform: translate(-50%, -46%) scale(0.94); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 14px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}
@keyframes tab-pop {
  0% { transform: scale(0.6); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes confetti-fall {
  0% { transform: translate(0, -10vh) rotate(0); opacity: 1; }
  100% { transform: translate(var(--x), 105vh) rotate(var(--r)); opacity: 0.9; }
}
.sheet.is-opening { animation: sheet-up 0.34s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.backdrop.is-opening, .guide-back, .confirm-back { animation: fade-in 0.25s ease both; }
.confirm { animation: dialog-in 0.28s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
#toast { animation: toast-in 0.3s cubic-bezier(0.2, 0.8, 0.2, 1) both; box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3); }
.nav-btn { position: relative; }
.nav-btn.is-on::before {
  content: "";
  position: absolute;
  top: 4px;
  left: 50%;
  width: 52px;
  height: 30px;
  margin-left: -26px;
  border-radius: 99px;
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  animation: tab-pop 0.3s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.nav-btn .icon, .nav-btn span { position: relative; }
.confetti { position: fixed; inset: 0; z-index: 82; pointer-events: none; overflow: hidden; }
.confetti i {
  position: absolute;
  top: 0;
  width: 8px;
  height: 14px;
  border-radius: 2px;
  background: var(--c);
  animation: confetti-fall 2.4s cubic-bezier(0.25, 0.6, 0.4, 1) var(--d) both;
}
.install-head { display: flex; align-items: center; gap: 12px; }
.install-head img { width: 56px; height: 56px; border-radius: 14px; background: #000; box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3); }
.install-head h2 { margin-bottom: 2px; }
.install-steps summary { cursor: pointer; font-weight: 600; color: var(--accent-text); min-height: 32px; display: flex; align-items: center; }
.install-steps .guide-steps { margin-top: 8px; }
.install-steps .hint { margin-top: 8px; }
.levelup-logo { width: 108px; height: auto; border-radius: 12px; background: #000; animation: pop 0.5s ease-out both; }
.levelup-num { animation: pop 0.6s ease-out 0.1s both; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; animation: none !important; }
  .confetti { display: none; }
}
