/* Dark is the default look; [data-theme="light"] is the toggle. */
:root {
  --bg: #0e0f11;
  --surface: #17191c;
  --surface-2: #212428;
  --text: #f4f5f2;
  --muted: #9a9fa6;
  --border: #2a2d32;
  --accent: #b6f23a;
  --accent-text: #0e0f11;
  --accent-soft: rgb(182 242 58 / .14);
  --hero-1: #1f2226;
  --hero-2: #121315;
  --warn: #ff9f43;
  --warn-soft: #3a2a14;
  --danger: #ff6b6b;
  --danger-soft: #3b1717;
  --radius: 20px;
  --display: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f4f5f1;
  --surface: #ffffff;
  --surface-2: #eceee8;
  --text: #121314;
  --muted: #5f646b;
  --border: #e0e3dc;
  --accent: #4d7c0f;
  --accent-text: #ffffff;
  --accent-soft: rgb(77 124 15 / .12);
  --hero-1: #ffffff;
  --hero-2: #eef3e4;
  --warn: #b45309;
  --warn-soft: #fdf0dc;
  --danger: #b91c1c;
  --danger-soft: #fde4e4;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(84px + env(safe-area-inset-bottom));
  -webkit-tap-highlight-color: transparent;
}

/* ---------- shell ---------- */
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: var(--bg);
}
.brand { font-family: var(--display); font-weight: 800; font-size: 1.4rem; letter-spacing: .04em; }
.logo { color: var(--accent); }
.icon-btn {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
}

main { max-width: 560px; margin: 0 auto; padding: 8px 16px 16px; outline: none; }
h1 { font-family: var(--display); font-size: 2rem; line-height: 1.05; margin: 4px 0 8px; letter-spacing: .01em; }
h2 { font-size: 1.05rem; margin: 0 0 8px; }
h3 { font-size: .8rem; margin: 14px 0 6px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
p { margin: 0 0 8px; }
a { color: var(--accent); }
.display { font-family: var(--display); font-weight: 800; text-transform: uppercase; letter-spacing: .01em; }
.muted { color: var(--muted); font-size: .92rem; }
.center { text-align: center; }
.ic { flex: none; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; margin-bottom: 14px;
}
.card.warn { background: var(--warn-soft); border-color: transparent; }
.card.danger { background: var(--danger-soft); border-color: transparent; }
.card-label { font-size: .85rem; color: var(--muted); font-weight: 600; margin-bottom: 6px; }
details.card summary { cursor: pointer; }
details.card ul { margin-top: 8px; }

.sec-head { display: flex; justify-content: space-between; align-items: baseline; margin: 18px 0 10px; }
.sec-head h2 { margin: 0; font-size: 1.05rem; }
.sec-head a { font-size: .88rem; font-weight: 600; text-decoration: none; }

/* ---------- forms ---------- */
label { display: block; font-weight: 600; font-size: .9rem; margin: 14px 0 6px; }
input, select, textarea {
  width: 100%; font: inherit; color: inherit; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px;
}
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.check { display: flex; gap: 10px; align-items: center; font-weight: 500; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); flex: none; }

/* ---------- buttons ---------- */
button { font: inherit; cursor: pointer; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 14px 16px; margin-top: 14px; border-radius: 14px; border: 0;
  background: var(--accent); color: var(--accent-text); font-weight: 700;
  transition: transform .1s;
}
.btn:active { transform: scale(.98); }
.btn.secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn.small { width: auto; padding: 8px 14px; margin-top: 0; font-size: .9rem; }
.btn.link { background: none; color: var(--muted); font-weight: 600; text-decoration: underline; margin-top: 6px; }
.btn.big { padding: 18px 12px; font-size: 1.05rem; }
.btn:disabled { opacity: .55; cursor: wait; }

.scale { display: flex; gap: 6px; }
.scale button {
  flex: 1; padding: 12px 0; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font-weight: 700;
}
.scale button.on { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.scale.big button { padding: 18px 0; font-size: 1.3rem; }

.badge { display: inline-block; font-size: .72rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.badge.offline { background: var(--warn-soft); color: var(--warn); }

ul.plain { margin: 0; padding-left: 18px; }
ol.plain { padding-left: 20px; margin: 0 0 8px; }

/* ---------- home ---------- */
.hello { margin: 4px 0 14px; }
.hello h1 { font-size: 2.3rem; margin-top: 4px; }

.weekly .weekly-body { display: flex; align-items: center; gap: 18px; }
.weekly-side { flex: 1; display: grid; gap: 10px; }
.mini { display: flex; gap: 10px; align-items: center; background: var(--surface-2); border-radius: 14px; padding: 10px 12px; }
.mini-ic { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); }
.mini small { display: block; color: var(--muted); font-size: .75rem; }
.mini b { font-size: .98rem; }
.weekly-foot { margin-top: 12px; font-size: .88rem; color: var(--muted); }
.streak { font-weight: 700; color: var(--warn); }

.ring { flex: none; }
.ring circle { fill: none; stroke-width: 8; transform: rotate(-90deg); transform-origin: 40px 40px; }
.ring-bg { stroke: var(--surface-2); }
.ring-fg { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset .6s; }
.ring-big { fill: var(--text); font-family: var(--display); font-size: 20px; font-weight: 800; }
.ring-small { fill: var(--muted); font-size: 8px; font-weight: 600; }

.install { border: 2px dashed var(--accent); }

.chips { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.chip {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 0 10px;
  border-radius: 16px; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-weight: 600; font-size: .82rem;
}
.chip-ic { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: var(--surface-2); color: var(--muted); }
.chip.on { border-color: var(--accent); }
.chip.on .chip-ic { background: var(--accent); color: var(--accent-text); }

.hero-card {
  position: relative; overflow: hidden; border-radius: var(--radius); padding: 18px; margin-bottom: 14px;
  background: radial-gradient(circle at 90% 10%, var(--accent-soft), transparent 60%), linear-gradient(135deg, var(--hero-1), var(--hero-2));
  border: 1px solid var(--border);
}
.hero-card > * { position: relative; }
.hero-bg { position: absolute; right: -18px; bottom: -22px; color: var(--accent); opacity: .12; pointer-events: none; }
.hero-card h3 { font-size: 1.9rem; color: var(--text); margin: 8px 0 4px; letter-spacing: .01em; text-transform: uppercase; }
.hero-stats { display: flex; flex-wrap: wrap; gap: 8px 14px; margin: 10px 0 2px; font-size: .88rem; color: var(--muted); }
.hero-stats span { display: inline-flex; align-items: center; gap: 6px; }
.hero-stats .ic { color: var(--accent); }
.btn.cta { width: auto; padding: 12px 22px; }
.hero-card .check { margin-top: 12px; font-size: .92rem; }
.tip { margin: 0 4px 14px; }

.list { padding: 6px; }
.ex-row {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 10px; border: 0; border-radius: 14px; background: none; color: var(--text);
}
.ex-row + .ex-row { margin-top: 2px; }
.ex-row:hover { background: var(--surface-2); }
.ex-ic { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 12px; background: var(--surface-2); color: var(--accent); flex: none; }
.ex-txt { flex: 1; min-width: 0; }
.ex-txt b { display: block; }
.ex-txt small { color: var(--muted); }
.ex-count { font-family: var(--display); font-weight: 700; color: var(--muted); }
.ex-row > .ic:last-child { color: var(--muted); }
.ex-row.done .ex-ic { background: var(--accent); color: var(--accent-text); }
.ex-row.done b { color: var(--muted); }

.timer { margin-top: 10px; font-family: var(--display); font-size: 1.8rem; font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums; }

/* ---------- check-in and onboarding ---------- */
.chiprow { display: flex; gap: 6px; }
.pill {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 50px; padding: 8px 4px;
  border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  font-size: 1.35rem; font-weight: 700; line-height: 1.1;
}
.pill small { font-size: .68rem; font-weight: 600; color: var(--muted); }
.pill.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.pill.on small { color: var(--accent); }
#checkinForm .chiprow:first-of-type .pill, #obForm .chiprow .pill { font-size: .95rem; }

.options { display: grid; gap: 10px; margin-bottom: 14px; }
.option {
  display: flex; align-items: center; gap: 14px; text-align: left; padding: 14px 16px;
  border-radius: 16px; border: 2px solid var(--border); background: var(--surface); color: var(--text);
}
.option b { display: block; }
.option small { color: var(--muted); }
.option-icon { font-size: 1.8rem; }
.option.on { border-color: var(--accent); background: var(--accent-soft); }

.dots { display: flex; gap: 6px; justify-content: center; margin: 4px 0 14px; }
.dots span { width: 32px; height: 6px; border-radius: 3px; background: var(--border); }
.dots span.on { background: var(--accent); }

/* ---------- focus mode ---------- */
body.focus-on { padding-bottom: 16px; }
.focus { display: flex; flex-direction: column; min-height: calc(100dvh - 110px); }
.ftop { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.ftop .timer { margin: 0; font-size: 1.5rem; }
.fbar { display: flex; gap: 4px; margin: 12px 0 20px; }
.fbar span { flex: 1; height: 6px; border-radius: 3px; background: var(--border); }
.fbar span.done { background: var(--accent); }
.fbar span.cur { background: var(--warn); }
.fbody { flex: 1; }
.ex-name { font-family: var(--display); font-size: 2.6rem; line-height: 1; text-transform: uppercase; margin: 8px 0 8px; }
.ex-meta { font-family: var(--display); font-size: 1.6rem; font-weight: 800; color: var(--accent); margin-bottom: 8px; }
.sets { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.sets button {
  min-width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--border);
  background: var(--surface-2); color: var(--text); font-weight: 700;
}
.sets button.on { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.sets button.next { border-color: var(--accent); }
.sets.big { gap: 14px; margin: 20px 0; }
.sets.big button { min-width: 68px; height: 68px; font-size: 1.5rem; font-family: var(--display); }
.load { width: 140px; padding: 8px 10px; margin-top: 6px; font-size: 1rem; }
.fnav { display: grid; grid-template-columns: 56px 1fr 56px; gap: 10px; align-items: center; margin-top: 16px; }
.fnav .btn { margin: 0; font-size: 1.4rem; padding: 10px 0; }
.upnext { color: var(--muted); text-align: center; }
.rest-panel { display: flex; flex-direction: column; justify-content: center; }
.big-num { font-family: var(--display); font-size: 7rem; font-weight: 800; line-height: 1; color: var(--accent); font-variant-numeric: tabular-nums; margin: 8px 0 20px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.row3 .btn { margin: 0; }
.rest-panel .upnext { margin-top: 22px; font-size: 1.05rem; }
.big-emoji { font-size: 4rem; margin-top: 24px; }
.go-pill { display: inline-block; background: var(--accent); color: var(--accent-text); font-weight: 800; padding: 4px 14px; border-radius: 999px; }
.focus.flash .fbody { animation: flash .5s ease-in-out 4 alternate; }
@keyframes flash { to { opacity: .55; } }

/* ---------- rest banner ---------- */
.restbar {
  position: fixed; left: 16px; right: 16px; bottom: calc(92px + env(safe-area-inset-bottom)); z-index: 9;
  max-width: 528px; margin: 0 auto; padding: 10px 12px; border-radius: 16px;
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  background: var(--accent); color: var(--accent-text); font-size: 1.05rem; font-weight: 700;
  box-shadow: 0 8px 24px rgb(0 0 0 / .35);
}
.restbar[hidden] { display: none; }
body:has(.restbar:not([hidden])) { padding-bottom: calc(170px + env(safe-area-inset-bottom)); }
.restbar b { font-family: var(--display); font-variant-numeric: tabular-nums; font-size: 1.5rem; margin-left: 6px; }
.restbar button { background: rgb(0 0 0 / .14); color: inherit; border: 0; border-radius: 10px; padding: 8px 12px; font-weight: 700; }
.restbar.go { justify-content: center; background: var(--warn); color: #fff; animation: flash .5s ease-in-out 4 alternate; }

/* ---------- run ---------- */
.prep { padding-top: 40px; }
.countdown { font-family: var(--display); font-size: 11rem; font-weight: 800; color: var(--accent); line-height: 1; margin: 20px 0; }
.gps-pulse { font-size: 3.5rem; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.15); opacity: .6; } }
.run-head { display: flex; justify-content: space-between; align-items: center; font-size: 1.1rem; }
.run-time { text-align: center; margin: 14px 0 4px; }
.run-time b { display: block; font-family: var(--display); font-size: 5.5rem; line-height: 1; font-variant-numeric: tabular-nums; }
.run-time span, .run-pair span { color: var(--muted); font-size: .85rem; }
.run-pair { display: grid; grid-template-columns: 1fr 1fr; text-align: center; margin: 10px 0; }
.run-pair b { display: block; font-family: var(--display); font-size: 3.2rem; line-height: 1; color: var(--accent); font-variant-numeric: tabular-nums; }
.map { height: 280px; border-radius: 16px; overflow: hidden; margin: 12px 0; padding: 0; background: var(--surface-2); z-index: 0; position: relative; }
.map.small { height: 190px; }
.map-off { padding: 16px; margin: 0; }
.hold { position: relative; overflow: hidden; touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.hold span { position: relative; }
.hold::before { content: ""; position: absolute; inset: 0; width: 0; background: rgb(0 0 0 / .25); }
.hold.holding::before { width: 100%; transition: width 1.5s linear; }

/* ---------- progress ---------- */
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; margin-bottom: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; }
.seg button { border: 0; border-radius: 10px; padding: 9px 0; background: none; color: var(--muted); font-weight: 600; }
.seg button.on { background: var(--accent); color: var(--accent-text); }
.big-stat { color: var(--muted); font-size: .9rem; }
.big-stat b { font-family: var(--display); font-size: 2.2rem; color: var(--text); margin-right: 4px; }
.bars { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; height: 140px; margin-top: 10px; }
.bar-col { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.bar-col > span { font-size: .75rem; color: var(--muted); font-weight: 600; }
.bar-col.today > span { color: var(--accent); }
.bar-wrap { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; }
.bar { position: relative; width: 70%; max-width: 26px; border-radius: 8px; background: var(--surface-2); }
.bar:not(.zero) { background: color-mix(in srgb, var(--accent) 45%, var(--surface-2)); }
.bar-col.today .bar:not(.zero) { background: var(--accent); }
.bar-tip { position: absolute; top: -26px; left: 50%; transform: translateX(-50%); background: var(--accent); color: var(--accent-text); font-size: .72rem; font-weight: 800; padding: 1px 7px; border-radius: 6px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.two-col .big-stat b { font-size: 1.7rem; }
.spark { width: 100%; height: 44px; margin-top: 6px; display: block; }
.spark-line { fill: none; stroke: var(--accent); stroke-width: 2.5; vector-effect: non-scaling-stroke; }
.spark-area { fill: var(--accent-soft); }
.goal { display: flex; align-items: center; gap: 14px; }
.goal > div:first-child { flex: 1; }
.goal-bar { height: 10px; border-radius: 5px; background: var(--surface-2); overflow: hidden; margin: 10px 0 8px; }
.goal-bar span { display: block; height: 100%; background: var(--accent); border-radius: 5px; }
.pb { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-top: 1px solid var(--border); }
.pb:first-of-type { border-top: 0; }
.pb span { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); }
.pb .ic { color: var(--accent); }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 12px 8px; text-align: center; }
.stat b { display: block; font-family: var(--display); font-size: 1.7rem; color: var(--accent); line-height: 1.1; }
.stat span { font-size: .75rem; color: var(--muted); }

.chart { width: 100%; height: auto; display: block; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2.5; }
.chart .dot { fill: var(--accent); }
.chart text { fill: var(--muted); font-size: 10px; }

/* ---------- log and coach ---------- */
.log-item { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.as-link { width: 100%; text-align: left; color: inherit; font: inherit; cursor: pointer; }

.chat { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.msg { max-width: 85%; padding: 10px 14px; border-radius: 18px; white-space: pre-wrap; }
.msg.user { align-self: flex-end; background: var(--accent); color: var(--accent-text); border-bottom-right-radius: 4px; }
.msg.coach { align-self: flex-start; background: var(--surface); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.msg.safety { background: var(--danger-soft); border-color: transparent; }
.chat-form { display: flex; gap: 8px; position: sticky; bottom: calc(84px + env(safe-area-inset-bottom)); background: var(--bg); padding: 8px 0; }
.chat-form input { flex: 1; }
.chat-form .btn { width: auto; margin: 0; }

/* ---------- celebration ---------- */
.celebrate { padding-top: 12px; }
.celebrate h1 { font-size: 2.4rem; text-transform: uppercase; }
.celebrate .stats { margin-top: 16px; }
.pop { animation: pop .6s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes pop { from { transform: scale(.3); opacity: 0; } }

/* ---------- tab bar and toast ---------- */
.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 5;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabs[hidden] { display: none; }
.tab { background: none; border: 0; color: var(--muted); padding: 10px 0 12px; font-size: .75rem; font-weight: 600; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.tab.active { color: var(--accent); }

.toast {
  position: fixed; left: 16px; right: 16px; bottom: calc(96px + env(safe-area-inset-bottom)); z-index: 10;
  max-width: 528px; margin: 0 auto; padding: 12px 14px; border-radius: 14px;
  background: var(--text); color: var(--bg); font-size: .92rem; font-weight: 500;
  opacity: 0; transform: translateY(10px); pointer-events: none; transition: .25s;
}
.toast.show { opacity: 1; transform: none; }
.toast.has-action { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.toast.has-action.show { pointer-events: auto; }
.toast button { background: none; border: 0; color: var(--accent); font-weight: 800; padding: 4px 8px; }
:root[data-theme="light"] .toast button { color: #b6f23a; }

/* ---------- food ---------- */
.daybar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.daybar .icon-btn:disabled { opacity: .35; }
.food-top { display: flex; align-items: center; gap: 16px; }
.food-top .ring-big { font-size: 17px; }
.food-top .ring-small { font-size: 7px; }
.macros { flex: 1; display: grid; gap: 10px; }
.macro-top { display: flex; justify-content: space-between; font-size: .85rem; }
.macro-top span { color: var(--muted); font-weight: 600; }
.macro-top small { color: var(--muted); font-weight: 500; }
.macro .goal-bar { height: 8px; margin: 4px 0 0; }
.m-p .goal-bar span { background: var(--accent); }
.m-c .goal-bar span { background: var(--warn); }
.m-f .goal-bar span { background: #5ab0ff; }
.food-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px; margin-top: 14px; color: var(--muted); font-size: .9rem; }
.food-foot b { font-family: var(--display); font-size: 1.3rem; color: var(--text); }
.food-foot .over { color: var(--danger); }
.burned { display: inline-flex; align-items: center; gap: 4px; }
.burned .ic { color: var(--warn); }

.meal { padding: 12px 14px; }
.meal-head { display: flex; align-items: center; gap: 12px; }
.meal-emoji { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--surface-2); font-size: 1.4rem; }
.meal-title { flex: 1; }
.meal-title b { display: block; }
.meal-title small { color: var(--muted); }
.add-btn { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; border: 0; background: var(--accent); color: var(--accent-text); }
.food-row { display: grid; grid-template-columns: 1fr auto 32px; align-items: center; gap: 8px; padding: 10px 0 2px; border-top: 1px solid var(--border); margin-top: 10px; }
.food-row b { display: block; font-size: .95rem; font-weight: 600; }
.food-row small { color: var(--muted); font-size: .78rem; }
.food-row > span { font-weight: 700; font-size: .9rem; }
.del { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; border: 0; background: none; color: var(--muted); }
.del:hover { background: var(--surface-2); color: var(--danger); }

body:has(.sheet) { padding-bottom: 24px; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.sheet-head h1 { margin: 0; font-size: 1.8rem; }
.sheet .seg { margin-top: 12px; }
.search { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 0 12px; margin-bottom: 6px; color: var(--muted); }
.search input { border: 0; background: none; padding: 12px 0; }
.search input:focus { outline: none; }
.search:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.food-pick { display: grid; grid-template-columns: 1fr auto 20px; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 12px 6px; border: 0; border-bottom: 1px solid var(--border); background: none; color: var(--text); }
.food-pick b { display: block; font-weight: 600; }
.food-pick small { color: var(--muted); }
.food-pick > span { color: var(--muted); font-size: .88rem; font-weight: 600; }
.food-pick .ic { color: var(--accent); }
.picked { border-color: var(--accent); }
.picked-sum { margin: 12px 0 0; color: var(--muted); }
.picked-sum b { font-family: var(--display); font-size: 1.4rem; color: var(--text); }
.ai-row { display: grid; grid-template-columns: 1fr 84px 32px; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); }
.ai-row input { padding: 9px 10px; }
.ai-row small { grid-column: 1 / -1; }
.macro-inputs label { font-size: .8rem; }
.sheet .seg { grid-template-columns: repeat(4, 1fr); }
.sheet .seg button { font-size: .85rem; padding: 9px 2px; }
.photo-empty { text-align: center; padding: 18px 8px 4px; color: var(--muted); }
.photo-empty span { font-size: 3rem; display: block; margin-bottom: 6px; }
.photo-preview { display: block; width: 100%; max-height: 320px; object-fit: cover; border-radius: 14px; background: var(--surface-2); }
.photo-card .row .btn { margin-top: 12px; }

.spinner { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- splash ---------- */
/* The 4 s CSS fade is a safety net: the splash disappears even if app.js never runs. */
.splash {
  position: fixed; inset: 0; z-index: 100;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  background: var(--bg); color: var(--text);
  animation: splash-out .4s ease 4s forwards;
}
.splash.hide { opacity: 0; pointer-events: none; transition: opacity .4s ease; }
.splash-logo { border-radius: 22px; box-shadow: 0 10px 40px rgb(182 242 58 / .25); animation: pop .7s cubic-bezier(.2, 1.6, .4, 1); }
.splash-word { font-family: var(--display); font-weight: 800; font-size: 2.6rem; letter-spacing: .06em; margin-top: 10px; }
.splash-word span { color: var(--accent); }
.splash-tag { color: var(--muted); font-size: .95rem; }
.splash-bar { width: 140px; height: 4px; border-radius: 2px; background: var(--surface-2); overflow: hidden; margin-top: 22px; }
.splash-bar span { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 2px; animation: splash-fill 1.2s ease-out forwards; }
@keyframes splash-fill { to { width: 100%; } }
@keyframes splash-out { to { opacity: 0; visibility: hidden; pointer-events: none; } }

@media (prefers-reduced-motion: reduce) {
  .splash-logo { animation: none; }
  .splash-bar span { animation: none; width: 100%; }
  .spinner, .restbar.go, .gps-pulse, .pop, .focus.flash .fbody { animation: none; }
  .toast, .ring-fg, .btn { transition: none; }
}
