/* Snusee — components and screens, on the house style of 2026-09-23: print
 * headings in Unageo SemiBold tracked tight, paper
 * cards on a lavender hairline and a soft shadow, a light floating rail, no
 * doodles and no handwriting.
 *
 * The house components (`.yu-card`, `.yu-btn`, `.yu-label`, `.yu-chip`,
 * `.yu-input`, `.yu-rail`, `.yu-nav`, `.yu-stat`, `.yu-empty`, `.yu-auth` ...)
 * come from assets/design/yumee.components.css and are used as they are. The
 * Snusee class that sits beside each one adds sizes, layout and state only.
 * Every value below is a token from tokens.css; nothing states a colour, a
 * font or a radius. Light only.
 *
 * Mobile first: target 390x844, must survive 360x800 and 430x932 with no
 * sideways scroll. From 1024px the phone
 * column becomes the house app shell: the floating paper rail on the left,
 * paper on the right.
 *
 * Rules that outlived the restyle, stated once:
 *
 *  1. TEXT USES INKS, FILLS USE PASTELS. A pastel is never a text colour; the
 *     `-ink` tokens set type on them.
 *  2. THE APP IS A COLUMN on a phone and every fixed element aligns to it.
 *  3. SOS IS IN THE TAB BAR, the raised middle slot, so nothing floats over
 *     the content of a screen.
 *  4. NO RED. Over a limit is amber; an error is the quiet amber block.
 */

/* ------------------------------------------------------------- reset ---- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

html, body { height: 100%; }

/* SIDEWAYS SCROLL IS OFF ON BOTH ELEMENTS. `overflow-x` on <body> alone does
 * nothing on a phone when the root is unconstrained: the viewport hands the
 * overflow back to <html>. `clip` refuses the scroll without making a scroll
 * container (sticky still works); `hidden` is the fallback. This is the safety
 * net, not the fix -- an element that is too wide is fixed where it is.
 *
 * touch-action: manipulation kills double-tap-to-zoom; pinch zoom stays. */
html {
  overflow-x: hidden;
  overflow-x: clip;
  touch-action: manipulation;
}

body {
  background: var(--cream);
  color: var(--ink);
  overflow-x: hidden;
  overflow-x: clip;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* Safari applies the double-tap gesture per element. */
button, a, input, textarea, select, label,
[role="button"], [role="tab"] { touch-action: manipulation; }

/* Anything the user typed can hold a word longer than the column: one pasted
 * URL in a diary note must not widen the page. */
.tl__note, .tl__title, .record__note, .record__title, .checkin__note,
.prose p, .card__note, .toast span, .reason__text, .link-row__label,
.sym__name, .option__title { overflow-wrap: anywhere; }

button, input, textarea, select { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; padding: 0; text-align: inherit; }
ul, ol { list-style: none; padding: 0; }
a { color: var(--pink-ink); text-decoration: none; }
svg { display: block; flex: none; }

h1, h2, h3 { font-family: var(--font-display); font-weight: var(--w-display); letter-spacing: var(--track-head); line-height: 1.25; }
/* Unageo has no 700: a default bold would jump to Black. Emphasis is 600. */
b, strong { font-weight: 600; }
/* A card label written as a heading (h2.yu-label) keeps the label's face: the
 * house heading rule on `.yu h2` would otherwise outrank the class. */
:is(h1, h2, h3).yu-label { font-family: var(--font-body); font-weight: var(--w-ui); letter-spacing: var(--track-label); line-height: 1.4; }

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

/* ------------------------------------------------------------ layout ---- */
#app {
  position: relative;
  z-index: var(--z-content);
  min-height: 100%;
  max-width: var(--app-max);
  margin-inline: auto;
}

.screen {
  /* svh, not dvh: the dynamic unit changes on every scroll as the browser
   * chrome collapses, and the page grew and shrank under the thumb. */
  min-height: 100svh;
  padding:
    calc(var(--sp-4) + env(safe-area-inset-top))
    var(--screen-pad)
    calc(var(--tabbar-h) + 48px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: var(--card-gap);
  min-width: 0;
}
.screen > * { min-width: 0; }
.screen--plain {   /* no tab bar: onboarding, auth, SOS */
  padding-bottom: calc(var(--sp-6) + env(safe-area-inset-bottom));
}

.screen-head { margin-bottom: var(--sp-1); min-width: 0; }
.screen-head h1 {
  font-size: clamp(1.75rem, 1.4rem + 1.2vw, 2.25rem);
  line-height: 1.12;
  letter-spacing: var(--track-display);
}
.screen-head p { font-size: 14px; color: var(--ink-soft); line-height: 1.45; margin-top: var(--sp-1); }
.screen-head--center { text-align: center; }
.screen-head--center h1 { font-size: clamp(1.6rem, 1.3rem + 1.2vw, 2.1rem); text-wrap: balance; }

.topbar {
  display: flex; align-items: center; gap: var(--sp-3);
  margin-bottom: var(--sp-2);
  min-width: 0;
}
.topbar .screen-head { flex: 1; }

/* -------------------------------------------------------------- card ---- */
/* `.yu-card` draws the card. `.card` is Snusee's spacing inside it. */
.card { padding: var(--card-pad); min-width: 0; }

.card__title {
  display: flex; align-items: center; gap: var(--sp-2);
  margin: 0 0 var(--sp-3);
}
.card__note { font-size: 13px; color: var(--ink-quiet); margin-top: var(--sp-2); line-height: 1.45; }

.zdroj {
  font-size: 12px; color: var(--ink-quiet);
  margin-top: var(--sp-3); line-height: 1.45;
  padding-top: var(--sp-3);
  border-top: var(--outline-soft);
}

/* ------------------------------------------------------------ button ---- */
/* `.yu-btn` draws the pill. In a phone column every action is full width. */
/* House pills do not wrap; a long Slovak label on a 360px phone must. */
.btn { width: 100%; min-height: 50px; white-space: normal; text-align: center; line-height: 1.25; padding-block: 8px; }
.btn--ghost { min-height: 44px; font-size: 14px; }
.btn--fail svg { color: var(--peach-ink); }

.btn-icon { flex: none; }
.btn-icon svg { width: 20px; height: 20px; }

/* A quiet full-width row that goes somewhere: the knowledge base, the crisis
 * line, the voyage. A row of the "More" list on the house phone sheet. */
.link-row {
  display: flex; align-items: center; gap: var(--sp-3);
  width: 100%; min-height: 52px; padding: var(--sp-3) var(--sp-4);
  text-align: left; font-size: 14px; color: var(--ink);
  background: var(--card);
  border: var(--outline-soft);
  border-radius: var(--radius-tile);
  transition: border-color var(--dur-fast) var(--ease-soft), background-color var(--dur-fast) var(--ease-soft);
}
.link-row:hover { border-color: var(--accent-line); background: var(--lav-50); }
.link-row:active { transform: translateY(1px); }
.link-row__label { flex: 1; min-width: 0; }
.link-row__label .yu-row-title { font-size: 16px; }
.link-row svg { color: var(--pink-ink); }
/* Needs the element in the selector to outrank `.link-row svg`. */
.link-row svg.link-row__chevron { color: var(--ink-faint); }

/* ------------------------------------------------------------- input ---- */
.field { display: flex; flex-direction: column; gap: var(--sp-2); }
.field > label { font-size: 13px; font-weight: 500; color: var(--ink-soft); padding-left: var(--sp-1); }

.input-wrap { position: relative; display: flex; align-items: center; min-width: 0; }
.input-wrap > svg:first-child {
  position: absolute; left: var(--sp-4); color: var(--ink-quiet);
}
.input-wrap:has(> svg:first-child) .input { padding-left: calc(var(--sp-4) * 2 + 20px); }

.input { min-width: 0; }
input.input { min-height: 50px; }
textarea.input { min-height: 110px; }

/* A native datetime-local renders in the browser's locale; screens that use
 * one echo the value back in Slovak underneath. */
.field-echo {
  font-size: 12px; color: var(--ink-soft);
  padding-left: var(--sp-1); margin-top: calc(var(--sp-1) * -1);
}

.input-toggle {
  position: absolute; right: var(--sp-4);
  color: var(--ink-quiet); display: grid; place-items: center;
  width: 44px; height: 44px;
}

/* Errors never use red: the quiet amber block and plain words. */
.form-error {
  display: flex; gap: var(--sp-3); align-items: flex-start;
  padding: var(--sp-3) var(--sp-4);
  background: var(--peach-wash);
  color: var(--peach-ink);
  border-radius: var(--radius-input);
  font-size: 14px; line-height: 1.45;
}
.form-error span { color: var(--ink); }

/* -------------------------------------------------------------- chip ---- */
/* A toggle: an outlined pill that turns lavender when chosen. */
.chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); }

.chip {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  min-height: 40px; padding: 0 var(--sp-4);
  background: var(--card);
  border: var(--outline-soft);
  border-radius: var(--radius-chip);
  font-size: 14px;
  color: var(--ink);
  transition: background-color var(--dur-fast) var(--ease-soft), border-color var(--dur-fast) var(--ease-soft);
}
.chip svg { color: var(--ink-soft); }
.chip:hover { border-color: var(--accent-line); }
.chip:active { transform: translateY(1px); }
.chip[aria-pressed="true"] {
  background: var(--lavender-wash);
  border-color: var(--lavender);
  font-weight: 500;
}
.chip[aria-pressed="true"] svg { color: var(--ink); }

.pill { gap: var(--sp-2); white-space: normal; line-height: 1.3; }

/* ------------------------------------------------------------- timer ---- */
.timer { display: flex; align-items: center; gap: var(--sp-1); }

/* Paper tiles on the tinted timer card; the days figure leads in purple. */
.timer__tile {
  flex: 1;
  display: flex; flex-direction: column; align-items: center;
  gap: 6px; padding: var(--sp-3) 2px 10px;
  border-radius: var(--radius-tile);
  background: var(--card);
  border: var(--outline-soft);
  min-width: 0;
}
.timer__value {
  font-family: var(--font-display); font-weight: var(--w-display);
  font-size: clamp(1.75rem, 1.3rem + 2vw, 2.4rem);
  line-height: 1;
  letter-spacing: var(--track-display);
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.timer__tile--days .timer__value { color: var(--purple-ink); }
.timer__label {
  font-size: 10px; font-weight: 500; letter-spacing: var(--track-caps);
  text-transform: uppercase; color: var(--ink-soft);
}
.timer__sep {
  font-family: var(--font-display); font-size: 22px; font-weight: var(--w-display);
  color: var(--ink-faint); padding-bottom: 16px;
}

/* Transform-only so the tick never reflows the row. */
@keyframes tick { 0% { transform: scale(1); } 40% { transform: scale(1.06); } 100% { transform: scale(1); } }
.timer__tile--seconds .timer__value.is-ticking {
  animation: tick var(--dur-fast) var(--ease-spring);
}

.timer__slips[hidden] { display: none; }
.timer__slips { margin-top: var(--sp-3); }

/* -------------------------------------------------------------- stats --- */
.stat-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); }

.stat { min-height: 0; padding: var(--card-pad); }
.stat .yu-label { margin-bottom: var(--sp-2); }
.stat__value { font-size: clamp(1.5rem, 1.1rem + 1.8vw, 2.25rem); overflow-wrap: anywhere; }
.stat__note { max-width: none; font-size: 12px; }

/* The numbers a relapse never takes away. */
.kept-row {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3);
  margin-top: var(--sp-1);
}
.kept-row .kept__item { margin: 0; }

/* ----------------------------------------------------------- progress --- */
.progress { display: flex; flex-direction: column; gap: var(--sp-2); }
.progress__track {
  position: relative; height: 10px;
  background: var(--card); border: var(--outline-soft);
  border-radius: var(--radius-chip);
}
.progress__fill {
  height: 100%; border-radius: var(--radius-chip);
  background: var(--yu-purple);
  transition: width var(--dur-slow) var(--ease-soft);
}
.progress__knob {
  position: absolute; top: 50%; translate: -50% -50%;
  width: 26px; height: 26px;
  transition: left var(--dur-slow) var(--ease-soft);
}
.progress__meta {
  display: flex; justify-content: space-between;
  font-size: 12px; color: var(--ink-soft);
}

/* ------------------------------------------------------------ tabbar ---- */
/* The house ink bar, floating above the bottom edge (the one large ink
 * surface the app keeps). Sentence-case labels. Five slots; the middle
 * one is the craving button (or the quick log in reduction mode), raised out
 * of the bar so it covers nothing and is still the most reachable thing on
 * screen. */
.tabbar {
  position: fixed;
  left: 50%; translate: -50% 0;
  bottom: calc(10px + env(safe-area-inset-bottom));
  width: min(calc(100% - 20px), calc(var(--app-max) - 20px));
  z-index: var(--z-tabbar);
  grid-template-columns: repeat(5, minmax(0, 1fr));
  grid-auto-flow: row;
  padding: 6px 4px;
  transition: transform var(--dur-base) var(--ease-soft);
}

/* THE BAR LEAVES WHILE THE KEYBOARD IS UP. app.js measures the keyboard and
 * sets the class. No transition on the way out: an animated exit is 240 ms of
 * a bar sliding in the wrong place, which is the bug. */
body.is-keyboard .tabbar {
  transform: translateY(160%);
  pointer-events: none;
  transition: none;
}

.tabbar__item {
  min-height: 56px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px;
  border-radius: var(--radius-tile);
  color: var(--yu-rail-muted);
  min-width: 0;
}
.tabbar__icon {
  display: grid; place-items: center;
  width: 38px; height: 34px;
  border-radius: var(--radius-chip);
  transition: background-color var(--dur-fast) var(--ease-soft);
}
.tabbar__label {
  font-size: .6875rem; font-weight: var(--w-ui);
  line-height: 1.2;
  /* One line each, or a wrapped label drags its tab taller than the rest. */
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tabbar__item[aria-current="page"] { color: var(--yu-rail-ink); }
.tabbar__item[aria-current="page"] .tabbar__icon { background: var(--lavender); color: var(--ink); }
.tabbar__item:focus-visible { outline-color: var(--yu-lavender); }

.tabbar__item--sos { position: relative; justify-content: flex-end; padding-bottom: 6px; color: var(--yu-rail-ink); }
.tabbar__fab {
  position: absolute; top: -24px; left: 50%; translate: -50% 0;
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--yu-purple); color: var(--yu-paper);
  border: 3px solid var(--cream);
  display: grid; place-items: center;
  transition: transform var(--dur-fast) var(--ease-spring);
}
.tabbar__item--sos:active .tabbar__fab { transform: scale(.94); }

/* -------------------------------------------------------------- rail ---- */
/* The same destinations for a desktop window: the house's floating paper
 * rail (`.yu-rail`), the site header's twin. Hidden on a phone. */
.rail { display: none; }

.rail__brand { display: inline-flex; text-decoration: none; }
.rail__brand yumee-logo { --yu-logo-size: 2rem; }
.rail__nav .yu-nav__item svg { width: 20px; height: 20px; }

/* The raised slot of the phone bar, at the foot of the rail: one quiet line
 * and the button. The palest lavender, a hairline -- found without looking. */
.rail__action {
  display: flex; flex-direction: column; gap: var(--sp-3);
  padding: 14px;
  background: var(--lav-50);
  border: var(--hairline);
  border-radius: var(--radius-tile);
}
.rail__action-line { font-size: 13px; line-height: 1.45; color: var(--ink-soft); }
.rail__action-btn { min-height: 44px; font-size: 14px; }

/* ----------------------------------------------------------- journey ---- */
.stop__when { font-size: 12px; color: var(--ink-soft); }

/* A small round icon tile: lavender, ink glyph. */
.stop__icon {
  width: 42px; height: 42px; flex: none;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--lavender-wash);
  color: var(--ink);
}

/* --------------------------------------------------------------- log ---- */
/* A segmented control: a mist pill, the chosen part lavender. */
.tabs {
  display: flex; gap: var(--sp-1);
  background: var(--card-sunk);
  border: var(--outline-soft);
  padding: 4px; border-radius: var(--radius-chip);
}
.tabs__item {
  flex: 1; min-width: 0; min-height: 42px; border-radius: var(--radius-chip);
  font-size: 14px; font-weight: 500; color: var(--ink-soft);
  text-align: center;
  transition: background-color var(--dur-fast) var(--ease-soft);
}
.tabs__item[aria-selected="true"] { background: var(--card); color: var(--purple-ink); box-shadow: var(--shadow-card); }

/* The 1-5 faces: the clinical ramp fills, each on a hairline. */
.faces { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--sp-2); }
.face {
  display: flex; flex-direction: column; align-items: center; gap: var(--sp-2);
  padding: var(--sp-2) 0;
  min-width: 0;
  text-align: center;
}
.face__dot {
  width: 46px; height: 46px; border-radius: 50%;
  display: grid; place-items: center;
  color: var(--on-scale);
  border: 1px solid var(--line-card);
  transition: transform var(--dur-base) var(--ease-spring);
}
.face__label { font-size: 11px; color: var(--ink-soft); line-height: 1.2; }
.face[aria-pressed="true"] .face__dot {
  transform: scale(1.12);
  outline: 2.5px solid var(--yu-purple);
  outline-offset: 2px;
}
.face[aria-pressed="true"] .face__label { color: var(--ink); font-weight: 600; }

.face--1 .face__dot { background: var(--scale-1); }
.face--2 .face__dot { background: var(--scale-2); }
.face--3 .face__dot { background: var(--scale-3); }
.face--4 .face__dot { background: var(--scale-4); }
.face--5 .face__dot { background: var(--scale-5); }

/* A compact five-step scale for the symptom rows: five dots, one tap. */
.scale5 { display: flex; gap: 6px; flex: none; }
.scale5__dot {
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--card-sunk);
  border: var(--outline-soft);
  font-size: 12px; font-weight: 600; color: var(--ink-quiet);
}
.scale5__dot:active { transform: scale(.92); }
.scale5__dot[aria-pressed="true"] { color: var(--on-scale); border-color: var(--accent-line); }
.scale5__dot--1[aria-pressed="true"] { background: var(--scale-1); }
.scale5__dot--2[aria-pressed="true"] { background: var(--scale-2); }
.scale5__dot--3[aria-pressed="true"] { background: var(--scale-3); }
.scale5__dot--4[aria-pressed="true"] { background: var(--scale-4); }
.scale5__dot--5[aria-pressed="true"] { background: var(--scale-5); }

.severity { display: flex; align-items: center; gap: var(--sp-3); }

/* The range in the edit sheet, styled explicitly: accent-color leaves the
 * unfilled track in the platform's near-black. */
.severity input[type="range"] {
  flex: 1; min-width: 0;
  -webkit-appearance: none; appearance: none;
  height: 26px; background: transparent; cursor: pointer;
}
.severity input[type="range"]::-webkit-slider-runnable-track {
  height: 10px; border-radius: var(--radius-chip); background: var(--lavender-wash);
}
.severity input[type="range"]::-moz-range-track {
  height: 10px; border-radius: var(--radius-chip); background: var(--lavender-wash);
}
.severity input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 24px; height: 24px; margin-top: -7px;
  border-radius: 50%; border: 3px solid var(--card);
  background: var(--yu-purple); outline: 1.5px solid var(--yu-purple);
}
.severity input[type="range"]::-moz-range-thumb {
  width: 18px; height: 18px;
  border-radius: 50%; border: 3px solid var(--card);
  background: var(--yu-purple); outline: 1.5px solid var(--yu-purple);
}
.severity input[type="range"]::-moz-range-progress {
  height: 10px; border-radius: var(--radius-chip); background: var(--yu-purple);
}

.symptom-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-3); padding: var(--sp-3) 0;
  border-bottom: var(--outline-soft);
}
.symptom-row:last-child { border-bottom: 0; }
.symptom-row__name {
  flex: 1; min-width: 0; text-align: left;
  font-family: var(--font-display); font-weight: var(--w-display); font-size: 15px; line-height: 1.3;
  letter-spacing: -.01em;
  overflow-wrap: anywhere;
}
.symptom-row__phase {
  font-family: var(--font-body);
  font-size: 10px; font-weight: 500; letter-spacing: var(--track-caps);
  text-transform: uppercase; color: var(--ink-quiet);
  display: block; margin-top: 2px;
}

/* ------------------------------------------------------------ badges ---- */
.badge-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-2); }

.badge {
  display: flex; flex-direction: column; align-items: center; gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-1);
  background: var(--card);
  border: var(--outline-soft);
  border-radius: var(--radius-tile);
  min-width: 0;
}
.badge:hover { border-color: var(--accent-line); }
.badge:active { transform: translateY(1px); }
.badge__art { width: 46px; height: 46px; }
.badge__name { font-size: 11px; text-align: center; line-height: 1.2; color: var(--ink-soft); overflow-wrap: anywhere; }

/* One art asset per badge: the locked state is CSS, not a second image. */
.badge--locked { background: var(--locked-bg); border-style: dashed; }
.badge--locked .badge__art { filter: grayscale(1) opacity(.45); }
.badge--locked .badge__name { color: var(--locked-ink); }
.badge__lock { position: absolute; color: var(--ink-soft); }
.badge__wrap { position: relative; display: grid; place-items: center; }

/* ------------------------------------------------------------- sheet ---- */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: var(--z-sheet);
  /* The panel sits ABOVE the keyboard: --kb is the measured keyboard height
   * (app.js watchKeyboard), 0px the rest of the time. After `inset`. */
  bottom: var(--kb, 0px);
  background: var(--scrim);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade var(--dur-base) var(--ease-soft);
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.sheet {
  position: relative;
  width: 100%; max-width: var(--app-max);
  max-height: calc(86dvh - var(--kb, 0px)); overflow-y: auto;
  background: var(--card);
  border: var(--outline);
  border-bottom: 0;
  border-radius: var(--radius-panel) var(--radius-panel) 0 0;
  box-shadow: var(--shadow-lift);
  padding: var(--sp-5) var(--screen-pad)
           calc(var(--sp-6) + env(safe-area-inset-bottom));
  animation: rise var(--dur-base) var(--ease-soft);
}
.sheet h2 { line-height: 1.2; }
@keyframes rise { from { transform: translateY(6%); } to { transform: translateY(0); } }

.sheet__grab {
  width: 44px; height: 5px; border-radius: var(--radius-chip);
  background: var(--lavender-wash); margin: 0 auto var(--sp-4);
}

/* A visible way out, sticky so it stays reachable in a long sheet. */
.sheet__close {
  position: sticky; top: 0; float: right;
  width: 40px; height: 40px; margin: -6px -6px 0 0;
  display: grid; place-items: center;
  border-radius: 50%;
  color: var(--ink);
  background: var(--card-sunk);
  border: var(--outline-soft);
  z-index: 2;
}
.sheet__close:active { transform: scale(.94); }

/* ------------------------------------------------------------- toast ---- */
.toast {
  position: fixed; left: 50%; translate: -50% 0;
  bottom: calc(var(--tabbar-h) + 36px + env(safe-area-inset-bottom));
  z-index: var(--z-takeover);
  width: max-content;
  max-width: min(calc(100% - var(--sp-8)), calc(var(--app-max) - var(--sp-8)));
  padding: var(--sp-3) var(--sp-5);
  /* The house toast: paper, a hairline, the hover shadow. */
  background: var(--card); color: var(--ink);
  border: var(--hairline);
  border-radius: var(--radius-tile);
  box-shadow: var(--shadow-hover);
  font-size: 14px; text-align: center; line-height: 1.4;
  animation: rise var(--dur-base) var(--ease-spring);
}

/* A toast that can be acted on: the undo after recording a pouch. */
.toast--action {
  display: flex; align-items: center; gap: var(--sp-3);
  text-align: left; padding-right: var(--sp-2);
}
.toast__undo {
  flex: none; padding: var(--sp-2) var(--sp-4);
  border-radius: var(--radius-chip);
  background: var(--lavender-wash); color: var(--ink);
  font-weight: 600; font-size: 14px;
}

/* -------------------------------------------------------- onboarding ---- */
.wizard { flex: 1; display: flex; flex-direction: column; gap: var(--card-gap); }
.wizard__body { flex: 1; display: flex; flex-direction: column; gap: var(--card-gap); }

.dots { display: flex; gap: var(--sp-2); justify-content: center; }
.dots span {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--lavender);
  transition: width var(--dur-base) var(--ease-spring);
}
.dots span.is-on { width: 20px; border-radius: var(--radius-chip); background: var(--yu-purple); }

.stepper { display: flex; align-items: center; justify-content: center; gap: var(--sp-5); }
.stepper__btn {
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--card); border: var(--outline);
  box-shadow: var(--shadow-card);
  display: grid; place-items: center; color: var(--ink);
}
.stepper__btn:hover { background: var(--card-sunk); }
.stepper__btn:active { transform: scale(.94); }
.stepper__value {
  font-family: var(--font-display); font-size: 52px; font-weight: var(--w-display);
  letter-spacing: var(--track-display);
  min-width: 92px; text-align: center; font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.stepper__presets { display: flex; flex-wrap: wrap; gap: var(--sp-2); justify-content: center; margin-top: var(--sp-4); }

/* An option row: a paper tile on a hairline; chosen, it turns the palest
 * lavender with a purple ring (Framee's chosen tile). */
.option {
  display: flex; align-items: center; gap: var(--sp-3);
  width: 100%; padding: var(--sp-4);
  background: var(--card);
  border: var(--hairline);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  text-align: left;
  min-width: 0;
  transition: background-color var(--dur-fast) var(--ease-soft), border-color var(--dur-fast) var(--ease-soft),
              box-shadow var(--dur-base) var(--ease-soft);
}
.option:hover { border-color: var(--accent-line); box-shadow: var(--shadow-hover); }
.option:active { transform: translateY(1px); }
.option svg { color: var(--pink-ink); }
.option[aria-pressed="true"] { border-color: var(--yu-purple); background: var(--lav-50); box-shadow: inset 0 0 0 1px var(--yu-purple); }
.option > div { min-width: 0; }
.option__title { font-family: var(--font-display); font-size: 17px; font-weight: var(--w-display); letter-spacing: -.01em; line-height: 1.3; }
.option__sub { font-size: 12px; color: var(--ink-soft); }
.option--tall { align-items: flex-start; }
.option--tall svg { margin-top: 2px; }

/* --------------------------------------------------------------- sos ---- */
/* The rotating distraction: a row title, not handwriting. */
.sos__try { font-family: var(--font-display); font-weight: var(--w-display); font-size: 16px; line-height: 1.35; letter-spacing: -.01em; }

/* The end of a craving held off: a check in a mint circle, the status line's
   "done", at the size of the screen it closes. */
.done-check {
  width: 56px; height: 56px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--mint-wash); color: var(--mint-ink);
  border: 1px solid var(--mint);
}
.sos {
  position: fixed; inset: 0; z-index: var(--z-takeover);
  background: var(--cream);
  display: flex; flex-direction: column;
  /* The background covers the window; the content keeps to the column. */
  padding:
    calc(var(--sp-5) + env(safe-area-inset-top))
    max(var(--screen-pad), calc((100% - var(--app-max)) / 2))
    calc(var(--sp-5) + env(safe-area-inset-bottom));
  gap: var(--card-gap);
  overflow-y: auto;
}
.sos > * { flex: none; }
.sos__lead {
  font-family: var(--font-display); font-size: clamp(1.4rem, 1.2rem + 1vw, 1.75rem); font-weight: var(--w-display); letter-spacing: -.01em;
  text-align: center; line-height: 1.3; text-wrap: balance;
}

.breath { position: relative; display: grid; place-items: center; height: 220px; flex: none; }
.breath__circle {
  width: 150px; height: 150px; border-radius: 50%;
  background: var(--tint);
  border: var(--outline);
  animation: breathe 10s var(--ease-soft) infinite;
}
.breath__inner {
  position: absolute; display: grid; place-items: center; gap: var(--sp-1);
  text-align: center;
}
.breath__phase { font-family: var(--font-display); font-size: 22px; font-weight: var(--w-display); letter-spacing: -.01em; }
.breath__count { font-size: 13px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }

/* 4s in, 6s out. */
@keyframes breathe {
  0%   { transform: scale(.72); }
  40%  { transform: scale(1.12); }
  100% { transform: scale(.72); }
}
/* With reduced motion the circle holds still; the phase label and the
 * countdown keep updating, so the guide still works. */
@media (prefers-reduced-motion: reduce) {
  .breath__circle { transform: scale(1); }
}

.ring { --p: 0; width: 74px; height: 74px; flex: none; }
.ring circle { fill: none; stroke-width: 7; stroke-linecap: round; }
.ring__track { stroke: var(--lavender-wash); }
.ring__fill  { stroke: var(--yu-purple); transition: stroke-dashoffset 1s linear; }

.sos__clock {
  font-family: var(--font-display); font-size: 26px; font-weight: var(--w-display); letter-spacing: var(--track-display);
  font-variant-numeric: tabular-nums;
}
.sos__clock-note { font-size: 13px; color: var(--ink-soft); margin-top: 2px; }
.sos.is-past-three .ring__fill { stroke: var(--chart-good); }

.reason { padding: var(--card-pad); }
.reason__label { margin-bottom: var(--sp-2); }
.reason__text { font-family: var(--font-display); font-weight: var(--w-display); letter-spacing: -.01em; font-size: 17px; line-height: 1.45; }

/* ----------------------------------------------------------- relapse ---- */
.kept {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3);
}
/* The comebacks count makes three: one row, not a lone tile underneath. */
.kept:has(> :nth-child(3)) { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-2); }
.kept:has(> :nth-child(3)) .kept__value { font-size: 21px; }
.kept__item {
  background: var(--card-sunk);
  border: var(--outline-soft);
  border-radius: var(--radius-tile);
  padding: var(--sp-3) var(--sp-2); text-align: center;
  min-width: 0;
}
.kept__value {
  font-family: var(--font-display); font-size: 24px; font-weight: var(--w-display); letter-spacing: var(--track-display);
  line-height: 1.2;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.kept__label { font-size: 12px; color: var(--ink-soft); line-height: 1.3; margin-top: 2px; }

/* ------------------------------------------------------ knowledge base -- */
.kb-item {
  width: 100%; display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4); min-height: 56px;
  background: var(--card);
  border: var(--outline-soft);
  border-radius: var(--radius-tile);
  text-align: left;
}
.kb-item:hover { border-color: var(--accent-line); }
.kb-item:active { transform: translateY(1px); }
.kb-item svg { color: var(--pink-ink); }
.kb-item svg:last-child { color: var(--ink-faint); }
.kb-item__title { flex: 1; min-width: 0; font-family: var(--font-display); font-size: 16px; font-weight: var(--w-display); letter-spacing: -.01em; line-height: 1.3; }

.prose h3 {
  font-size: 18px; margin: var(--sp-4) 0 var(--sp-2);
  color: var(--ink);
}
.prose p { margin-bottom: var(--sp-3); line-height: 1.55; }
.prose strong { font-weight: 600; }

.callout {
  padding: var(--card-pad); display: flex; flex-direction: column; gap: var(--sp-2);
}
.callout__title { font-family: var(--font-display); font-size: 19px; font-weight: var(--w-display); letter-spacing: -.01em; line-height: 1.3; }

.tel {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-3); padding: var(--sp-3) var(--sp-4);
  background: var(--card);
  border: var(--outline-soft);
  border-radius: var(--radius-tile);
  color: var(--ink);
  min-width: 0;
}
.tel > div { min-width: 0; }
.tel svg { color: var(--pink-ink); }
.tel:hover { border-color: var(--accent-line); }
.tel__number { font-family: var(--font-display); font-size: 20px; font-weight: var(--w-display); letter-spacing: -.01em; }
.tel__meta { font-size: 12px; color: var(--ink-soft); }

/* ------------------------------------------------------------ splash ---- */
.splash {
  min-height: 100svh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: var(--sp-4);
  padding: calc(var(--sp-6) + env(safe-area-inset-top)) 0
           calc(var(--sp-6) + env(safe-area-inset-bottom));
  text-align: center;
}
.splash__tagline { font-size: 17px; line-height: 1.5; color: var(--ink-soft); }
.splash__actions { width: 100%; display: flex; flex-direction: column; gap: var(--sp-3); margin-top: var(--sp-4); }

/* ------------------------------------------------------------ sign-in ---- */
/* The layout is `.yu-auth` from the design files. Two additions: svh instead
 * of dvh (see .screen), and one centred column for the wordmark, the card and
 * the language switch. */
.yu-auth {
  min-height: 100svh;
  padding-top: calc(var(--sp-6) + env(safe-area-inset-top));
  padding-bottom: calc(var(--sp-6) + env(safe-area-inset-bottom));
}

.auth-col {
  width: 100%;
  max-width: 440px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-4);
}
.auth-col > .yu-auth__card { width: 100%; padding: clamp(28px, 5vw, 38px) clamp(22px, 5vw, 36px) clamp(24px, 5vw, 36px); }
.auth-col > .yu-auth__brand { margin-bottom: 0; }
.auth-col .yu-auth__brand yumee-logo { --yu-logo-size: clamp(2.6rem, 2rem + 2vw, 3.2rem); }
.auth-col .yu-auth__title { margin-top: 0; }

.auth-form { display: flex; flex-direction: column; gap: var(--sp-4); margin-top: var(--sp-5); }
.auth-form .btn { margin-top: var(--sp-1); }
/* Room for the show/hide button inside the field. */
.input-wrap--toggle .input { padding-right: calc(var(--sp-4) + 44px); }
.input-wrap--toggle .input-toggle { right: var(--sp-1); }

/* English / Slovensky: quiet text under the card, each a full tap target. */
.auth-lang { display: flex; align-items: center; justify-content: center; gap: var(--sp-2); font-size: 14px; }
.auth-lang__option, .auth-lang__current { min-height: 44px; padding: 0 var(--sp-3); display: inline-flex; align-items: center; border-radius: var(--radius-chip); }
.auth-lang__option { color: var(--ink-soft); text-decoration: underline; text-underline-offset: 3px; }
.auth-lang__option:hover { color: var(--ink); }
.auth-lang__current { color: var(--ink); font-weight: 500; }

/* ------------------------------------------------------------ states ---- */
.empty > img { border-radius: var(--radius-tile); border: var(--outline-soft); }
.empty > svg { color: var(--ink-soft); }

.offline-bar {
  position: fixed; top: env(safe-area-inset-top); left: 50%; translate: -50% 0;
  z-index: var(--z-takeover);
  padding: var(--sp-2) var(--sp-4); margin-top: var(--sp-2);
  max-width: calc(100% - var(--sp-8));
  background: var(--peach-wash); color: var(--ink);
  border-radius: var(--radius-chip);
  font-size: 12px; text-align: center;
}

.skeleton {
  background: var(--card-sunk); border-radius: var(--radius-card);
  animation: pulse 1.4s var(--ease-soft) infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }

/* ---------------------------------------------------------- arrival ----- */
/* A milestone crossed since the last visit: shown once, dismissible. */
.arrival {
  padding: var(--card-pad);
  padding-right: 52px;
  animation: arrive var(--dur-slow) var(--ease-spring);
}
@keyframes arrive {
  from { opacity: 0; transform: translateY(10px) scale(.98); }
  to   { opacity: 1; transform: none; }
}
.arrival__body { min-width: 0; }
.arrival__eyebrow { display: flex; align-items: center; gap: var(--sp-2); color: var(--pink-ink); margin-bottom: var(--sp-1); }
.arrival__title {
  font-family: var(--font-display); font-size: 20px; font-weight: var(--w-display); letter-spacing: -.01em;
  line-height: 1.25; text-wrap: balance;
}
.arrival__note { font-size: 13px; color: var(--ink-soft); margin-top: var(--sp-2); line-height: 1.45; }
.arrival__close {
  position: absolute; top: var(--sp-2); right: var(--sp-2);
  width: 40px; height: 40px; display: grid; place-items: center;
  border-radius: 50%; color: var(--ink-soft);
}
.arrival__close:hover { background: var(--card-sunk); }

/* ================================================================ sea ==== */
/* The Cesta tab: the open sea, drawn flat in the notebook's lavender with
 * pen-thin swell lines. Motion is decoration: with reduced motion everything
 * below stops, and the screen still says where the boat is, because that comes
 * from the transform JS sets, never from an animation. */
.screen--sea { background-color: var(--sea); }

.sea-status {
  position: sticky; top: var(--sp-2); z-index: 3;
  padding: var(--sp-3) var(--sp-4);
  margin-bottom: var(--sp-4);
}
.sea-status__line {
  display: flex; align-items: center; gap: var(--sp-2);
  font-family: var(--font-display); font-size: 16px; font-weight: var(--w-display); letter-spacing: -.01em;
  min-width: 0;
}
.sea-status__line span { min-width: 0; }
.sea-status__line svg { flex: none; color: var(--pink-ink); }
.sea-status__meta { font-size: 12px; color: var(--ink-soft); margin-top: var(--sp-1); }

.sea-progress {
  height: 8px; border-radius: var(--radius-chip);
  background: var(--card); border: 1px solid var(--lavender);
  overflow: hidden; margin-top: var(--sp-2);
}
.sea-progress__fill {
  height: 100%; border-radius: var(--radius-chip);
  background: var(--yu-purple);
  transition: width var(--dur-slow) var(--ease-soft);
}

/* The map is clipped to itself: the drifting water layer is inset past its
 * edges on purpose and must never widen the page. */
.sea-map {
  position: relative;
  margin: 0 calc(var(--screen-pad) * -1);
  overflow: hidden;
  overflow: clip;
}

/* Crests on their own layer so the drift is a transform on a composited
 * layer, not a repaint of a four-thousand-pixel element. */
.sea-water {
  position: absolute; inset: -80px -60px;
  z-index: 0; pointer-events: none;
  background-image: var(--sea-swell);
  background-size: 100% 96px;
  animation: sea-drift 14s var(--ease-soft) infinite alternate;
  will-change: transform;
}
@keyframes sea-drift {
  from { transform: translate3d(-16px, 0, 0); }
  to   { transform: translate3d(16px, 6px, 0); }
}

/* ---- route ---- */
.sea-route { position: absolute; inset: 0; width: 100%; z-index: 1; pointer-events: none; }
/* Ahead: a dashed pen line, plainly "not yet". */
.sea-route__line {
  fill: none; stroke: var(--sea-route); stroke-width: 3;
  stroke-linecap: round; stroke-dasharray: 2 10; opacity: .9;
}
/* Behind: solid purple and wider. The contrast between the two IS the
 * progress indicator on this screen. */
.sea-route__wake {
  fill: none; stroke: var(--wake); stroke-width: 5;
  stroke-linecap: round;
  transition: stroke-dashoffset var(--dur-slow) linear;
}

/* ---- islands ---- */
.sea-islands { position: absolute; inset: 0; z-index: 2; }

/* The button is exactly the artwork, so translate(-50%,-50%) centres the
 * island on its route point; the label hangs off the side. */
.sea-island {
  position: absolute; translate: -50% -50%;
  width: var(--island-size);
  display: grid; place-items: center;
  background: none; border: 0; padding: 0; cursor: pointer;
  transition: transform var(--dur-base) var(--ease-spring);
}
.sea-island:active { transform: scale(.96); }

.sea-island__text {
  position: absolute; top: 50%; translate: 0 -50%;
  left: calc(100% + 14px);
  width: 132px; text-align: left;
  display: flex; flex-direction: column; align-items: flex-start; gap: var(--sp-1);
}
.sea-island--flip .sea-island__text {
  left: auto; right: calc(100% + 14px);
  text-align: right; align-items: flex-end;
}

/* The connector, in the 14px gap, centred on the label. */
.sea-island__text::before {
  content: ''; position: absolute; top: 50%; translate: 0 -50%;
  left: -14px; width: 14px; height: 1.5px;
  background: var(--ink-faint); opacity: .6;
}
.sea-island--flip .sea-island__text::before { left: auto; right: -14px; }

.sea-island__art {
  /* Not yet reached: hazy and pale, like something on the horizon. Not grey:
   * a grey island reads as broken. */
  filter: saturate(.6) brightness(1.04);
  opacity: .78;
  transition: filter var(--dur-slow) var(--ease-soft), opacity var(--dur-slow) var(--ease-soft);
}
.sea-island.is-reached .sea-island__art { filter: none; opacity: 1; }

/* Labels on open water are little drawn cards. */
.sea-island__label {
  font-family: var(--font-display);
  font-size: 13px; font-weight: var(--w-display); letter-spacing: -.01em;
  color: var(--ink); line-height: 1.25;
  text-wrap: balance;
  padding: 6px 10px;
  border-radius: var(--radius-input);
  background: var(--card);
  border: var(--outline);
  max-width: 100%;
  overflow-wrap: anywhere;
}
.sea-island:not(.is-reached) .sea-island__label {
  color: var(--ink-soft);
  border: var(--outline-soft);
}
.sea-island.is-reached .sea-island__label { border-color: var(--accent-line); box-shadow: var(--shadow-card); }

/* The countdown is a chip: a different kind of fact that changes every second. */
.sea-island__when {
  font-size: 11px; font-weight: 500;
  color: var(--ink);
  padding: 3px 9px; border-radius: var(--radius-chip);
  background: var(--lavender-wash);
  white-space: nowrap;
}
.sea-island__when:empty { display: none; }

/* The island the traveller is at right now: the one label with a purple
 * ring and purple type, like a chosen tile. */
.sea-island.is-current { z-index: 3; }
.sea-island.is-current .sea-island__art { animation: island-bob 4.5s var(--ease-soft) infinite; }
.sea-island.is-current .sea-island__label {
  font-size: 14px;
  background: var(--card);
  border-color: var(--yu-purple);
  box-shadow: inset 0 0 0 1px var(--yu-purple), var(--shadow-card);
  color: var(--purple-ink);
}
/* The one pink on this screen: the connector to where the traveller is. */
.sea-island.is-current .sea-island__text::before { background: var(--blush); opacity: 1; height: 2px; }

@keyframes island-bob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-5px); }
}

/* ---- the traveller ---- */
.sea-boat-wrap {
  position: absolute; left: 0; top: 0; z-index: 4;
  width: 64px; height: 64px;
  display: grid; place-items: center;
  pointer-events: none;
  /* No transition on transform: JS sets a position derived from the clock,
   * and easing between two truths would put the boat where it is not. */
  animation: boat-bob 3.2s var(--ease-soft) infinite;
}
.sea-boat-wrap.is-docked { animation-duration: 5s; }
.sea-boat { width: 64px; height: 64px; transition: transform var(--dur-slow) var(--ease-soft); }
.closeup__boat { width: 62px; height: 62px; }

/* The boat itself (art.js boatMark()): a hull, a mast and two sails, in the
 * app's own purples on paper. No face and no figure aboard. */
.boat-mark { display: block; overflow: visible; }
.boat-mark path { stroke: var(--purple-ink); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.boat-mark__sail { fill: var(--card); }
.boat-mark__jib  { fill: var(--lavender); }
.boat-mark__mast { fill: none; stroke-width: 2.5; }
.boat-mark__hull { fill: var(--pink); }

@keyframes boat-bob {
  0%, 100% { margin-top: 0; }
  50%      { margin-top: -6px; }
}

/* ---- dressing ---- */
.sea-deco-layer { position: absolute; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.sea-deco { position: absolute; opacity: .75; }
.sea-deco--cloud { animation: deco-drift 26s linear infinite; opacity: .8; }
.sea-deco--bird  { animation: deco-drift 19s linear infinite; opacity: .7; }
.sea-deco--wave  { animation: deco-swell 5.5s var(--ease-soft) infinite; opacity: .55; }
.sea-deco--fish  { animation: deco-jump 7s var(--ease-soft) infinite; opacity: .8; }

@keyframes deco-drift {
  0%   { transform: translateX(-14px); }
  50%  { transform: translateX(14px); }
  100% { transform: translateX(-14px); }
}
@keyframes deco-swell {
  0%, 100% { transform: translateY(0) scaleX(1); }
  50%      { transform: translateY(-4px) scaleX(1.06); }
}
@keyframes deco-jump {
  0%, 70%, 100% { transform: translateY(0) rotate(0); }
  80%           { transform: translateY(-12px) rotate(-12deg); }
  90%           { transform: translateY(-4px) rotate(6deg); }
}

/* ============================================================ records ==== */
.records { display: flex; flex-direction: column; }

.record {
  display: flex; align-items: flex-start; gap: var(--sp-3);
  width: 100%; padding: var(--sp-3) var(--sp-1); text-align: left;
  background: none; border: 0; border-bottom: var(--outline-soft);
  border-radius: 0;
  cursor: pointer; font: inherit; color: inherit;
}
.record:last-child { border-bottom: 0; }
.record:hover { background: var(--lav-50); }
.record:active { opacity: .7; }

.record__face {
  flex: none; width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; color: var(--on-scale);
  border: 1px solid var(--line-card);
  font-family: var(--font-display); font-weight: var(--w-display); font-size: 14px;
}
.record__face--1 { background: var(--scale-1); }
.record__face--2 { background: var(--scale-2); }
.record__face--3 { background: var(--scale-3); }
.record__face--4 { background: var(--scale-4); }
.record__face--5 { background: var(--scale-5); }
/* No score: neutral, because "not reported" is not a quiet 1. */
.record__face--none { background: var(--card-sunk); color: var(--ink-soft); border-color: var(--line); }

.record__body { flex: 1; min-width: 0; }
.record__when  { font-size: 12px; color: var(--ink-soft); }
.record__title { font-family: var(--font-display); font-size: 16px; font-weight: var(--w-display); letter-spacing: -.01em; line-height: 1.3; }
.record__tags  { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.record__tag {
  font-size: 11px; padding: 2px var(--sp-2); border-radius: var(--radius-chip);
  background: var(--card-sunk); color: var(--ink-soft);
}
.record__note {
  font-size: 13px; color: var(--ink-soft); margin-top: 4px;
  overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
}
.record__side {
  flex: none; display: flex; align-items: center; gap: var(--sp-2);
  color: var(--ink-faint); align-self: center;
}
.record__flag {
  font-size: 11px; padding: 2px var(--sp-2); border-radius: var(--radius-chip);
  background: var(--peach-wash); color: var(--peach-ink); font-weight: 600;
}

/* ======================================================== statistics ===== */
/* Thin bars anchored to the baseline, recessive axis text, a value printed
 * only on the peak. Every chart here is one series in one colour. */
.chart {
  display: flex; align-items: flex-end; gap: 2px;
  height: 108px; margin-top: var(--sp-2);
  padding-top: 18px;
  border-bottom: 1px solid var(--chart-grid);
}
.chart__col {
  flex: 1; min-width: 0; height: 100%;
  display: flex; flex-direction: column; justify-content: flex-end; align-items: center;
  position: relative;
}
.chart__bar {
  width: 100%; border-radius: 4px 4px 0 0;
  background: var(--chart-bar); opacity: .45;
  transition: opacity var(--dur-base) var(--ease-soft);
}
.chart__bar.is-peak { opacity: 1; }
.chart__col:hover .chart__bar { opacity: .8; }

.chart__value {
  position: absolute; top: -18px; left: 50%; translate: -50% 0;
  font-family: var(--font-display); font-size: 12px; font-weight: var(--w-display); letter-spacing: -.01em;
  color: var(--ink); white-space: nowrap;
}
.chart__tick {
  font-size: 9px; color: var(--ink-quiet); margin-top: 3px;
  white-space: nowrap; line-height: 1;
}

/* Ranked horizontal bars, where the label is a word. */
.hbars { display: flex; flex-direction: column; gap: var(--sp-2); margin-top: var(--sp-2); }
.hbar { display: flex; align-items: center; gap: var(--sp-3); min-width: 0; }
.hbar__label {
  flex: 0 0 34%; min-width: 0; font-size: 13px; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.hbar__track {
  flex: 1; min-width: 0; height: 12px; background: var(--card-sunk);
  border-radius: var(--radius-chip);
}
.hbar__fill  { height: 100%; border-radius: var(--radius-chip); background: var(--chart-bar); }
.hbar__value {
  flex: none; font-size: 12px; color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

/* The one categorical pair. Both halves carry a word and a number. */
.split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); margin-top: var(--sp-2); }
.split__part {
  padding: var(--sp-3) var(--sp-2); border-radius: var(--radius-tile); text-align: center;
  border: var(--outline-soft);
  border-top: 3px solid transparent;
  min-width: 0;
}
.split__part--good { background: var(--mint-wash);  border-top-color: var(--chart-good); }
.split__part--bad  { background: var(--peach-wash); border-top-color: var(--chart-bad); }
.split__value { font-family: var(--font-display); font-size: 26px; font-weight: var(--w-display); letter-spacing: var(--track-display); color: var(--ink); line-height: 1.2; }
.split__label { font-size: 12px; color: var(--ink-soft); line-height: 1.3; }

.stat-line {
  display: flex; align-items: center; gap: var(--sp-2);
  font-size: 14px; color: var(--ink); margin-bottom: var(--sp-2);
  min-width: 0;
}
.stat-line svg { flex: none; color: var(--pink-ink); }

/* ============================================================ home ======= */
/* The page head: the greeting as the wide-set label, the motivating line as
 * the page title, the settings button at its right. The sentence changes
 * with elapsed time (BANDS in home.js). */
.home-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--sp-3);
  margin: var(--sp-1) 0 var(--sp-1);
}
.home-head__text { flex: 1; min-width: 0; }
.hero__greet { margin: 6px 0 var(--sp-2); }
.hero__line {
  font-size: clamp(1.75rem, 1.35rem + 1.6vw, 2.5rem);
  font-weight: var(--w-display); line-height: 1.12;
  letter-spacing: var(--track-display);
  color: var(--ink);
  text-wrap: balance;
}
/* Only on a change, never on first paint (paint() in home.js). */
@keyframes hero-in {
  from { opacity: 0; transform: translateY(7px); }
  to   { opacity: 1; transform: none; }
}
.hero__line.is-new { animation: hero-in var(--dur-slow) var(--ease-soft); }

/* ---------------------------------------------- home: island closeup ---- */
.closeup {
  display: block; width: 100%; text-align: left;
  border: 0; cursor: pointer; font: inherit; color: inherit;
}
.closeup:active { transform: translateY(1px); }

.closeup__scene {
  position: relative; height: 180px; overflow: hidden;
  border-radius: var(--radius-tile);
  background: var(--tint);
  border: var(--outline-soft);
  margin-bottom: var(--sp-3);
}

/* The same swell the map draws, so the little scene and the map are
 * recognisably the same ocean. Confined to the water half. */
.closeup__scene::after {
  content: ''; position: absolute; inset: 42% -30px 0 -30px;
  pointer-events: none;
  background-image: var(--sea-swell);
  background-size: 100% 72px;
  animation: sea-drift 11s var(--ease-soft) infinite alternate;
}

.closeup__sky {
  position: absolute; inset: 0 0 55% 0;
  background: var(--sea-far);
  border-bottom: var(--outline-soft);
}

/* The island the traveller is on, and the next one small on the horizon. */
.closeup__island { position: absolute; left: 10px; bottom: 4px; z-index: 2; }
.closeup__next {
  position: absolute; right: 12px; bottom: 62px; z-index: 1;
  opacity: .5; filter: saturate(.5);
}

.closeup__cat {
  position: absolute; z-index: 3;
  left: 85px; bottom: 66px; translate: -50% 0;
  animation: boat-bob 3.4s var(--ease-soft) infinite;
}
/* Sailing: `--sail` is the real leg progress from the same voyage maths the
 * map uses, so this scene cannot claim different progress from the Cesta tab. */
.closeup__cat.is-sailing {
  bottom: 20px;
  left: calc(30% + var(--sail, 0) * 48%);
}

/* A row of paper foam bumps along the shoreline. Hard stops, not a fade to
 * `transparent`, which interpolates through grey. */
.closeup__waves {
  position: absolute; inset: auto 0 0 0; height: 20px; z-index: 4;
  background: radial-gradient(circle at 50% 100%,
    var(--card) 0 9px, transparent 9px);
  background-size: 32px 20px;
  background-repeat: repeat-x;
  background-position: bottom center;
  animation: deco-swell 4.5s var(--ease-soft) infinite;
}

.closeup__label {
  font-family: var(--font-display); font-size: 17px; font-weight: var(--w-display); letter-spacing: -.01em; color: var(--ink); line-height: 1.3;
}
.closeup__meta { font-size: 13px; color: var(--ink-soft); margin-top: 2px; margin-bottom: var(--sp-2); }

.now__title { font-size: 18px; }

/* ============================================================ health ===== */
/* Twenty-one symptoms, each against its own clock. The track is the whole
 * lifetime of the symptom with its peak marked and the user's position on it,
 * so whether the worst is ahead or behind reads without a word. The three
 * loudest are inline; the rest are one tap away. */
.health__lead { font-size: 14px; color: var(--ink-soft); line-height: 1.45; }
.health { display: flex; flex-direction: column; gap: var(--sp-5); margin-top: var(--sp-4); }
.health__group { display: flex; flex-direction: column; gap: var(--sp-2); }

.health__heading {
  display: flex; align-items: center; gap: var(--sp-2);
  font-size: 16px;
}
.health__heading::before {
  content: ''; width: 10px; height: 10px; flex: none;
  border-radius: 50%; background: var(--ink-faint);
  border: 1px solid var(--accent-line);
}
.health__group--now   .health__heading::before { background: var(--sym-peak); }
.health__group--ahead .health__heading::before { background: var(--card); }
.health__group--past  .health__heading::before { background: var(--sym-fall); }

.health__hint {
  font-size: 12px; color: var(--ink-quiet); line-height: 1.4;
  margin-bottom: var(--sp-1);
}

/* The shared sentence, hoisted out of the rows that all said it. */
.health__shared {
  font-size: 13px; font-weight: 500; color: var(--mint-ink);
  display: flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  background: var(--mint-wash); border-radius: var(--radius-input);
}

/* The disclosure says how many and what kind. */
.health__more {
  display: flex; align-items: center; justify-content: center; gap: var(--sp-2);
  width: 100%; min-height: 46px; padding: 0 var(--sp-4);
  border-radius: var(--radius-chip);
  background: var(--card); border: var(--outline-soft);
  box-shadow: var(--shadow-card);
  font-size: 14px; font-weight: var(--w-ui); color: var(--ink);
}
.health__more:hover { border-color: var(--accent-line); }
.health__more:active { transform: translateY(1px); }

.health__rest[hidden] { display: none; }
.health__rest { display: flex; flex-direction: column; gap: var(--sp-2); }

/* ---- one symptom ---- */
.sym {
  display: block; width: 100%; text-align: left;
  padding: var(--sp-3) var(--sp-4);
  font: inherit; color: inherit;
  border-radius: var(--radius-tile);
  background: var(--card);
  border: var(--outline-soft);
}
.sym:hover { border-color: var(--accent-line); }
.sym:active { transform: translateY(1px); }

.sym__head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: var(--sp-2);
  min-width: 0;
}
.sym__name { font-family: var(--font-display); font-size: 16px; font-weight: var(--w-display); letter-spacing: -.01em; min-width: 0; }

.sym__phase {
  flex: none;
  font-size: 10px; font-weight: 500; letter-spacing: var(--track-caps);
  text-transform: uppercase; white-space: nowrap;
  padding: 4px 9px; border-radius: var(--radius-chip);
  background: var(--card-sunk); color: var(--ink-soft);
}

/* The rail holds the peak marker above the track, so the two never collide. */
.sym__rail { position: relative; margin: var(--sp-4) 0 var(--sp-2); }

.sym__track {
  position: relative; height: 10px;
  border-radius: var(--radius-chip);
  /* The ramp is set inline per row: it encodes where THAT symptom peaks. */
}

/* Everything still ahead, greyed over the curve: visible, plainly not yet. */
.sym__veil {
  position: absolute; top: 0; right: 0; bottom: 0;
  border-radius: 0 var(--radius-chip) var(--radius-chip) 0;
  background: var(--card-sunk);
  opacity: .9;
  transition: left var(--dur-slow) var(--ease-soft);
}

/* Where the worst of it is: a notch above the track. */
.sym__peak {
  position: absolute; bottom: 12px; translate: -50% 0;
  width: 0; height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid var(--blush-ink);
}

/* Where they are: the only round thing on the row. */
.sym__here {
  position: absolute; top: 50%; translate: -50% -50%;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--card);
  border: 3.5px solid var(--ink);
  transition: left var(--dur-slow) var(--ease-soft);
}

.sym__meta { font-size: 12px; color: var(--ink-soft); line-height: 1.4; }

/* ---- per phase: through the craving scale's own hues, never red ---- */
.sym--ahead .sym__peak { border-top-color: var(--sym-ahead); }
.sym--past  .sym__peak { opacity: .45; }

.sym--rising  .sym__phase { background: var(--peach-wash);    color: var(--peach-ink); }
.sym--peak    .sym__phase { background: var(--blush-wash);    color: var(--blush-ink); }
.sym--easing  .sym__phase { background: var(--mint-wash);     color: var(--mint-ink); }
.sym--ongoing .sym__phase { background: var(--lavender-wash); color: var(--ink); }
.sym--past    .sym__phase { background: var(--mint-wash);     color: var(--mint-ink); }
.sym--ahead   .sym__phase { background: var(--locked-bg);     color: var(--locked-ink); }

/* At its worst, a symptom row is drawn in pink: it is the row that explains
 * how the person feels while reading. Scoped to the row (`.sym`): the detail
 * sheet's head carries the phase class too, for its chip, and must not get
 * the frame. */
.sym.sym--peak { border: 2px solid var(--blush); }

/* Not yet, and already done: recessed. */
.sym.sym--ahead, .sym.sym--past { background: var(--card-sunk); }
.sym--ahead .sym__name, .sym--past .sym__name { color: var(--ink-soft); }
.sym--ahead .sym__here { border-color: var(--ink-faint); }
.sym--past  .sym__here { border-color: var(--sym-done); }
/* Nothing left ahead: a zero-width veil still paints its rounded cap. */
.sym--past .sym__veil, .sym--ongoing .sym__veil { display: none; }

/* ---- the detail sheet ---- */
.sym-sheet__head {
  display: flex; flex-direction: column; align-items: flex-start;
  gap: var(--sp-2); margin-bottom: var(--sp-4);
}
.sym__phase--lg { font-size: 11px; padding: 5px 12px; }

/* ==========================================================================
   Two modes, a diary and a set of goals
   ========================================================================== */

/* The reduction home ring. No chart library: inline SVG from charts.js. */
.ring-wrap { position: relative; display: grid; place-items: center; margin: var(--sp-2) 0 var(--sp-4); }
.ring { display: block; }
.ring__centre {
  position: absolute; inset: 0;
  display: grid; place-content: center; text-align: center; gap: 2px;
  pointer-events: none;
}
.ring__value {
  font-family: var(--font-display); font-weight: var(--w-display); letter-spacing: var(--track-display); font-size: 46px;
  line-height: 1; color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.ring__label { font-size: 13px; color: var(--ink-soft); }
.ring__sub   { font-size: 12px; color: var(--ink-quiet); }

.bars-wrap, .spark-wrap { width: 100%; margin: var(--sp-3) 0 var(--sp-2); }
/* preserveAspectRatio="none" plus a fixed height lets fourteen bars fill any
 * width; the dashed limit line keeps a non-scaling stroke. */
.bars, .spark { display: block; width: 100%; height: 100%; }

.chart-empty {
  padding: var(--sp-5) 0; text-align: center;
  font-size: 13px; color: var(--ink-quiet);
}

/* ------------------------------------------------------- reduction home -- */
/* THE DAY COUNTER. Named nothing like `.ring`, which is the SOS countdown's
 * 74px class; sharing it once squashed this counter. Everything here is in
 * normal flow, so there is no centring to get wrong. */
.daycount { margin: var(--sp-2) 0 var(--sp-4); }

.daycount__head {
  display: flex; align-items: baseline; justify-content: center; flex-wrap: wrap;
  gap: var(--sp-2); margin-bottom: var(--sp-3);
}
.daycount__value {
  font-family: var(--font-display); font-weight: var(--w-display); letter-spacing: var(--track-display);
  font-size: 58px; line-height: 1; color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.daycount__value.is-over { color: var(--peach-ink); }
.daycount__of {
  font-family: var(--font-display); font-size: 18px; font-weight: var(--w-display); letter-spacing: -.01em;
  color: var(--ink-soft);
}
.daycount__sub {
  margin-top: var(--sp-2); text-align: center;
  font-size: 13px; color: var(--ink-quiet);
}

/* One box per allowed pouch. It wraps: a limit of twenty on a 360px phone
 * takes a second row rather than shrinking below a countable width. */
.daycount__track {
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: 6px; min-height: 22px;
}
.daycount__seg {
  flex: 1 1 18px; max-width: 34px; height: 22px;
  border-radius: 7px;
  background: var(--card);
  border: 1px solid var(--accent-line);
  transition: background-color var(--dur-base) var(--ease-soft);
}
.daycount__seg.is-filled { background: var(--chart-good-fill); border-color: var(--chart-good); }
/* Past the limit: amber, never red, and the sentence says it too. */
.daycount__seg.is-over           { background: var(--peach-wash); border-color: var(--peach); }
.daycount__seg.is-over.is-filled { background: var(--peach); border-color: var(--peach-ink); }

/* The fallback for a limit too large to draw as boxes. */
.daycount__bar {
  flex: 1 1 100%; height: 22px; border-radius: var(--radius-chip);
  background: var(--card); border: 1px solid var(--accent-line);
  overflow: hidden;
}
.daycount__bar-fill {
  display: block; height: 100%; border-radius: var(--radius-chip);
  background: var(--chart-good-fill);
  transition: width var(--dur-base) var(--ease-soft);
}
.daycount__bar-fill.is-over { background: var(--peach); }

/* A third column for "dalo sa mu vyhnúť", where "nepovedal/a som" is a real
 * answer with its own box. */
.split--three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.split--three .split__value { font-size: 22px; }
.split--three .split__label { font-size: 11px; }

/* The quick log's two choices, the same weight as each other. */
.quick__choices {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}
.quick__choice {
  min-height: 116px; padding: var(--sp-4) var(--sp-3);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; text-align: center;
  border-radius: var(--radius-card);
  border: var(--outline);
  background: var(--card); color: var(--ink);
  box-shadow: var(--shadow-card);
  min-width: 0;
}
.quick__choice:hover { background: var(--lav-50); border-color: var(--accent-line); }
.quick__choice:active { transform: translateY(1px); }
.quick__choice.is-busy { opacity: .6; }
.quick__choice-icon {
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--lavender-wash); color: var(--ink);
}
.quick__choice-label { font-family: var(--font-display); font-size: 17px; font-weight: var(--w-display); letter-spacing: -.01em; line-height: 1.2; }
.quick__choice-hint  { font-size: 12px; color: var(--ink-soft); line-height: 1.3; }

.today__ring { margin-top: var(--sp-2); }
.today__note {
  text-align: center; font-size: 15px; color: var(--ink-soft);
  margin: 0 0 var(--sp-2);
}
.today__since {
  text-align: center; font-size: 13px; color: var(--ink-quiet);
  margin-bottom: var(--sp-4);
}
.today .link-row { margin-top: var(--sp-2); }

/* The one control this screen exists for: tapped several times a day,
 * often one-handed. */
.btn--log { margin-bottom: var(--sp-1); }

/* ------------------------------------------------------------ the pouch --
 * The two buttons on the decision are DELIBERATELY IDENTICAL. Making "keep
 * counting" the pretty one would repeat V4's mistake from the other side. */
.pouch__field { margin-bottom: var(--sp-5); }
.pouch__field .card__title { margin-bottom: var(--sp-2); }

.pouch__decide {
  margin-top: var(--sp-5); padding-top: var(--sp-4);
  border-top: var(--outline-soft);
}
.pouch__choices {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3);
  margin-top: var(--sp-3);
}
.btn--choice {
  min-height: 60px; height: auto; padding: var(--sp-2) var(--sp-3);
  flex-direction: column;
  gap: 4px; text-align: center;
  white-space: normal;
  line-height: 1.2;
  font-size: 14px;
}
.btn--choice[disabled] { opacity: .45; }
.btn--choice.is-busy { opacity: .6; }

/* ---------------------------------------------------------- the timeline -- */
.diary__actions {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3);
  margin-bottom: var(--card-gap);
}
.diary__actions .btn { white-space: normal; line-height: 1.2; }

.timeline { display: flex; flex-direction: column; gap: var(--card-gap); }

.tl__day { padding: var(--card-pad); }
.tl__head {
  display: flex; align-items: center; gap: var(--sp-2);
  padding-bottom: var(--sp-3); margin-bottom: var(--sp-2);
  border-bottom: var(--outline-soft);
  min-width: 0;
}
.tl__date {
  font-family: var(--font-display); font-weight: var(--w-display); letter-spacing: -.01em; font-size: 18px;
  flex: 1; min-width: 0;
}
.tl__count {
  font-size: 12px; font-weight: 600; color: var(--ink-soft);
  background: var(--card-sunk); border-radius: var(--radius-chip);
  padding: 3px 10px; white-space: nowrap;
}
.tl__count.is-under { color: var(--mint-ink); background: var(--mint-wash); }
.tl__count.is-over  { color: var(--peach-ink); background: var(--peach-wash); }
.tl__mood { color: var(--ink-quiet); display: flex; }

.tl__rows { display: flex; flex-direction: column; }

.tl__row {
  display: grid; grid-template-columns: 46px 24px minmax(0, 1fr);
  align-items: start; gap: var(--sp-2);
  padding: var(--sp-3) 0;
  border-bottom: var(--outline-soft);
  text-align: left; width: 100%;
}
.tl__row:last-child { border-bottom: 0; }
button.tl__row:hover { background: var(--lav-50); }
button.tl__row:active { opacity: .7; }

.tl__time {
  font-size: 12px; color: var(--ink-quiet);
  font-variant-numeric: tabular-nums; padding-top: 3px;
}
.tl__dot {
  width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--card-sunk); color: var(--ink-soft);
}
.tl__row--pouch   .tl__dot { background: var(--peach-wash); color: var(--peach-ink); }
.tl__row--craving .tl__dot { background: var(--mint-wash);  color: var(--mint-ink); }
.tl__row--checkin .tl__dot { background: var(--lavender-wash); color: var(--ink); }
.tl__row--event   .tl__dot { background: var(--sky-wash); color: var(--lavender-ink); }

.tl__body { min-width: 0; }
.tl__title { font-family: var(--font-display); font-size: 16px; font-weight: var(--w-display); letter-spacing: -.01em; line-height: 1.3; }
.tl__meta  { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }
.tl__note  { font-size: 13px; color: var(--ink-soft); margin-top: var(--sp-2); }
.tl__row .record__tags { margin-top: var(--sp-2); }

/* An editable row carries a fourth column for the pencil: an affordance, not
 * a call to action. */
.tl__row--edit { grid-template-columns: 46px 24px minmax(0, 1fr) 18px; }
.tl__edit { color: var(--ink-faint); margin-top: 4px; }
button.tl__row--edit:active .tl__edit { color: var(--pink-ink); }

/* ---------------------------------------------------------------- goals -- */
.goals__row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); }
.goals__row .btn { white-space: normal; line-height: 1.2; }

/* The taper wizard's live preview. */
.taper__preview {
  margin-top: var(--sp-2); padding: var(--sp-3) var(--sp-4);
  background: var(--card-sunk); border-radius: var(--radius-input);
  border: var(--outline-soft);
}
.taper__preview-line {
  font-family: var(--font-display); font-size: 16px; font-weight: var(--w-display); letter-spacing: -.01em;
  color: var(--ink);
}

.family { margin-top: var(--sp-5); }
.family:first-of-type { margin-top: var(--sp-3); }
.family__head {
  display: flex; align-items: baseline; gap: var(--sp-2);
  margin-bottom: var(--sp-3);
}
.family__title {
  font-size: 16px;
  flex: 1; min-width: 0;
}
.family__count {
  font-size: 12px; font-weight: 600; color: var(--ink-quiet);
  font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------ knowledge cards -- */
.know-card {
  display: flex; align-items: flex-start; gap: var(--sp-3);
  text-align: left; width: 100%;
}
.know-card:hover { border-color: var(--accent-line); box-shadow: var(--shadow-hover); }
.know-card:active { transform: translateY(1px); }
.know-card > svg { color: var(--ink-faint); align-self: center; }
.know-card__icon {
  width: 40px; height: 40px; flex: none; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--lavender-wash); color: var(--ink);
}
.know-card__body { flex: 1; min-width: 0; }
.know-card__title {
  font-family: var(--font-display); font-size: 17px; font-weight: var(--w-display); letter-spacing: -.01em;
  line-height: 1.3; margin-bottom: 2px;
}
/* One paragraph of preview, clamped; the sheet has the rest. */
.know-card__body .card__note {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ------------------------------------------------------------- check-in -- */
.checkin__q { margin-bottom: var(--sp-5); }
.checkin__q .card__title { margin-bottom: var(--sp-1); }

.checkin__row { display: flex; flex-wrap: wrap; gap: var(--sp-3) var(--sp-5); margin: var(--sp-3) 0; }
.checkin__stat {
  display: flex; align-items: center; gap: var(--sp-2);
  color: var(--ink-soft);
  min-width: 0;
}
.checkin__stat-label { font-size: 14px; }
.checkin__note {
  font-size: 14px; color: var(--ink-soft); margin: 0 0 var(--sp-3);
}

/* ------------------------------------------------------------- narrow ---- */
@media (max-width: 370px) {
  :root { --card-pad: 16px; }
  .ring__value      { font-size: 38px; }
  .daycount__value  { font-size: 46px; }
  .daycount__seg    { height: 18px; border-radius: 6px; }
  .quick__choice    { min-height: 104px; }
  .split--three     { gap: var(--sp-2); }
  .pouch__choices   { grid-template-columns: 1fr; }
  .goals__row       { grid-template-columns: 1fr; }
  .diary__actions   { grid-template-columns: 1fr; }
  .tl__row          { grid-template-columns: 40px 22px minmax(0, 1fr); }
  .tl__row--edit    { grid-template-columns: 40px 22px minmax(0, 1fr) 16px; }
  .timer__sep       { font-size: 18px; }
  .badge-grid       { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .sea-island__text { width: 112px; }
  .scale5           { gap: 4px; }
  .scale5__dot      { width: 27px; height: 27px; }
  .face__dot        { width: 42px; height: 42px; }
  .tabbar__label    { font-size: .625rem; }
}

/* ============================================================ desktop ==== */
/* From 1024px the phone column becomes the house app shell (Framee's): the
 * floating paper rail pinned to the left with paper around it, and the page
 * beside it, the home screen laid out as a dashboard. Screens without chrome
 * (the wizard, settings, SOS) stay one centred column. */
@media (min-width: 1024px) {
  :root { --screen-pad: 0px; --card-pad: 24px; --card-gap: 20px; }

  #app.has-chrome {
    max-width: none;
    display: grid;
    grid-template-columns: var(--rail-w) minmax(0, 1fr);
    column-gap: 0;
    align-items: start;
  }
  #app.has-chrome > .tabbar { display: none; }
  #app.has-chrome > .rail {
    display: flex;
    grid-column: 1; grid-row: 1;
    position: sticky; top: var(--rail-gap);
    height: calc(100svh - 2 * var(--rail-gap));
    margin: var(--rail-gap) 0 var(--rail-gap) var(--rail-gap);
    overflow-y: auto;
    scrollbar-width: none;
  }
  #app.has-chrome > .rail::-webkit-scrollbar { display: none; }
  #app.has-chrome > .screen {
    grid-column: 2; grid-row: 1;
    width: 100%;
    max-width: calc(780px + 2 * clamp(16px, 3vw, 36px));
    padding: 32px clamp(16px, 3vw, 36px) 72px;
  }
  #app.has-chrome > .screen--home { max-width: calc(1120px + 2 * clamp(16px, 3vw, 36px)); }

  #app:not(.has-chrome) > .screen { padding-inline: 0; }
  .toast { bottom: 32px; }
  .sheet { border-bottom: var(--outline); border-radius: var(--radius-panel); margin-bottom: 24px; }

  .screen-head p { font-size: 15px; }

  /* The map keeps its own margins on a desktop column. */
  .sea-map { margin: 0; border-radius: var(--radius-panel); border: var(--outline-soft); }
  .screen--sea { background-color: transparent; }

  /* ---- home: the dashboard ---- */
  .screen--home {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: var(--card-gap);
    align-content: start;
  }
  .screen--home > * { grid-column: span 12; }
  .screen--home > .home__arrival:empty { display: none; }

  .home__hero { margin-bottom: var(--sp-1); }
  .home__hero .hero__line { max-width: 26ch; font-size: clamp(2.1rem, 1.3rem + 1.6vw, 2.75rem); }

  /* cold turkey: 7 | 5 rows */
  .home__timer  { grid-column: span 7; }
  .home__closeup{ grid-column: span 5; }
  .home__stats  { grid-column: span 7; }
  .home__kept   { grid-column: span 5; }
  .home__checkin{ grid-column: span 5; }
  .home__now    { grid-column: span 7; }

  /* The timer fills its half of the row rather than leaving a hole beside
   * the taller island card. */
  .home__timer { display: flex; flex-direction: column; }
  .home__timer .timer { flex: 1; align-items: stretch; }
  .home__timer .timer__sep { align-self: center; }
  .home__timer .timer__tile { justify-content: center; gap: 12px; padding: 18px 4px; }
  .home__timer .timer__value { font-size: 4rem; }
  .home__stats { gap: var(--card-gap); }
  .home__stats .stat { min-height: 150px; }
  .home__closeup .closeup__scene { height: 170px; }

  /* reduction: 5 | 7 rows */
  .home__today  { grid-column: span 5; }
  .home__week   { grid-column: span 7; }
  .screen--home-red .home__stats { grid-column: span 5; grid-template-columns: minmax(0, 1fr); }
  .screen--home-red .home__stats .stat { min-height: 0; }
  .home__dose   { grid-column: span 7; }
  .home__checkin-slot { grid-column: span 5; }
  .home__cards  { grid-column: span 7; align-content: start; }
  .home__checkin-slot:empty, .home__cards:empty { display: none; }

  /* The health section reads in two columns on a wide screen. */
  .home__health .health { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-5) var(--sp-6); align-items: start; }
  .home__health .health__group--now { grid-column: 1 / -1; }
  .home__health .health__group--now > .sym { max-width: none; }

  .badge-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: var(--sp-3); }
  .stepper__value { font-size: 60px; }
}
