/* Shared styles: tokens, layout, header, components used by more than one screen, nav, toast.
   Larva is used on a phone (#3): keep tap targets about 44 px tall or more. */
:root {
  --page: #050608; --bg: #0c0d11; --surface: #15171d; --surface2: #1f222a; --line: #282c36;
  --text: #f4f5f7; --muted: #8a909e; --faint: #5b6170;
  --strength: #ff6a45; --cardio: #34d9a5; --focus: #7b93ff; --warn: #ffb443; --bad: #ff5468;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body { margin: 0; background: var(--page); color: var(--text); font: 15px/1.4 -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif; font-variant-numeric: tabular-nums; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
.phone { position: relative; max-width: 430px; height: 100dvh; margin: 0 auto; background: var(--bg); display: flex; flex-direction: column; overflow: hidden; }
@media (min-width: 600px) and (min-height: 700px) {
  .phone { height: calc(100dvh - 48px); margin-top: 24px; border-radius: 40px; border: 1px solid var(--line); box-shadow: 0 30px 80px rgba(0,0,0,.6); }
}
/* Hidden until the app has loaded its state and drawn the first screen (no empty-frame flash). */
html:not([data-ready]) .phone { opacity: 0; }
.scroll { flex: 1; overflow-y: auto; padding: 22px 20px 28px; scrollbar-width: none; }
.scroll::-webkit-scrollbar { display: none; }

/* Header */
.top { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 22px; }
.brand { font-size: 11px; font-weight: 700; letter-spacing: 1.5px; white-space: nowrap; color: var(--faint); text-transform: uppercase; }
.title { font-size: 30px; font-weight: 800; letter-spacing: -.8px; line-height: 1.1; margin-top: 4px; }
.iconbtn { width: 44px; height: 44px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; color: var(--muted); }
.iconbtn.on { color: var(--text); background: var(--surface2); }
svg.i { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.switch { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--surface); border-radius: 12px; padding: 3px; margin-bottom: 18px; }
.switch button { padding: 12px 10px; border-radius: 9px; font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.switch button.on { background: var(--surface2); color: var(--text); }

.card { background: var(--surface); border-radius: 22px; padding: 18px; margin-bottom: 14px; }
.label { font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 14px; }

/* Numbers and notes */
.num { font-size: 30px; font-weight: 800; letter-spacing: -.8px; line-height: 1; }
.num small { font-size: 14px; font-weight: 600; color: var(--muted); letter-spacing: 0; margin-left: 2px; }
.note { font-size: 12px; color: var(--muted); margin-top: 8px; }
.note.ok { color: var(--cardio); } .note.warn { color: var(--warn); }

/* Stepper and presets (Train, Fuel, Settings) */
.stepper { display: flex; align-items: center; justify-content: space-between; }
.stepper button { width: 48px; height: 48px; border-radius: 50%; background: var(--surface2); font-size: 24px; font-weight: 400; line-height: 1; }
.stepper .num { font-size: 44px; }
.presets { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 16px; }
.presets button { padding: 12px 0; border-radius: 10px; background: var(--surface2); font-size: 13px; font-weight: 600; color: var(--muted); }
.presets button.on { color: var(--text); box-shadow: inset 0 0 0 1.5px var(--faint); }

/* Lists (Fuel, Log) */
.row { display: flex; align-items: center; gap: 12px; padding: 13px 0; border-top: 1px solid var(--line); }
.row:first-of-type { border-top: 0; padding-top: 0; }
.row:last-child { padding-bottom: 0; }
.row .main { flex: 1; min-width: 0; font-weight: 600; }
.row .main div { font-size: 12px; font-weight: 400; color: var(--muted); margin-top: 1px; }
.row .val { font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.tag { font-size: 10px; font-weight: 700; letter-spacing: .5px; color: var(--cardio); border: 1px solid currentColor; border-radius: 5px; padding: 1px 5px; margin-left: 6px; vertical-align: 1px; }

/* Fields and buttons (Fuel, Settings) */
.field { display: flex; gap: 10px; }
input { flex: 1; min-width: 0; background: var(--surface2); border: 0; outline: 0; color: var(--text); border-radius: 12px; padding: 12px 14px; font: inherit; }
input:focus { box-shadow: inset 0 0 0 1.5px var(--faint); }
.btn { padding: 12px 18px; border-radius: 12px; background: var(--surface2); font-weight: 600; font-size: 14px; white-space: nowrap; }

nav { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); background: var(--bg); padding: 8px 8px max(10px, env(safe-area-inset-bottom)); }
nav button { display: grid; justify-items: center; gap: 3px; padding: 6px 0; color: var(--faint); font-size: 11px; font-weight: 600; }
nav button.on { color: var(--text); }
#toast { position: absolute; left: 50%; bottom: 86px; transform: translate(-50%, 30px); opacity: 0; background: var(--text); color: #0c0d11; font-weight: 700; font-size: 14px;
  padding: 11px 18px; border-radius: 999px; transition: .25s; pointer-events: none; text-align: center; width: max-content; max-width: 86%; box-shadow: 0 10px 30px rgba(0,0,0,.5); }
#toast.show { transform: translate(-50%, 0); opacity: 1; }
/* Undo after a log (#10): a small dark pill inside the light toast. The toast ignores the pointer;
   the button doesn't. It only exists while the offer is open. */
#toast .undo { pointer-events: auto; margin-left: 12px; padding: 5px 12px; border-radius: 999px; background: var(--bg); color: var(--text);
  font-size: 13px; font-weight: 700; vertical-align: 1px; }
#toast .undo:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Narrow screens; the ring parts of this rule are in today.css */
@media (max-width: 340px) { .scroll { padding-left: 14px; padding-right: 14px; } .card { padding: 14px; } }
