/* =============================================================================
   Mighty Reset — Stylesheet
   -----------------------------------------------------------------------------
   1. Tokens
   2. Base & layout
   3. Type
   4. Home screen
   5. Duration screen
   6. Reset runner
   7. Complete screen
   8. Progress screen
   9. Settings screen
   10. Buttons & controls
   11. Sheets, toast
   12. Motion & responsive
   ========================================================================== */

/* ─────────────────────────────────────────────────────────── 1. TOKENS ──── */
:root {
  /* Frost Blue — shared with the wider Mighty family */
  --accent: #8FBFEF;
  --accent-bright: #C4DEF8;

  --bg: #090D12;
  --bg-glow-a: rgba(143, 191, 239, 0.10);
  --bg-glow-b: rgba(78, 134, 196, 0.07);

  --surface: #101720;
  --surface-2: #141C27;
  --surface-hi: rgba(255, 255, 255, 0.035);
  --line: rgba(143, 191, 239, 0.14);
  --line-soft: rgba(255, 255, 255, 0.07);

  --text: #F4F7FA;
  --muted: #A6B3C0;      /* ~9:1 on the app surfaces */
  --muted-dim: #8090A0;  /* ~5:1 — the quietest text we allow */
  --warn: #E9A7A7;       /* destructive actions only */
  --on-accent: #071019;

  --r-sm: 12px;
  --r-md: 18px;
  --r-lg: 24px;
  --r-pill: 999px;

  --pad: 20px;
  --tap: 48px;

  --shadow-card: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 12px 30px rgba(0, 0, 0, 0.35);
  --glow-accent: 0 0 0 1px rgba(143, 191, 239, 0.28), 0 10px 40px rgba(143, 191, 239, 0.18);

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --dur-fast: 140ms;
  --dur: 240ms;
  --dur-slow: 460ms;
}

/* ──────────────────────────────────────────────── 2. BASE & LAYOUT ──────── */
* { box-sizing: border-box; }

/* Screens and sheets are toggled with the hidden attribute, and several of
   them are display:flex — which would otherwise beat hidden. This must stay. */
[hidden] { display: none !important; }

html, body { min-height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto,
               "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior-y: none;
}

/* Ambient frost glow — the one piece of atmosphere in the whole app. */
body::before {
  content: "";
  position: fixed;
  inset: -30% -20% auto -20%;
  height: 70vh;
  background:
    radial-gradient(60% 60% at 30% 20%, var(--bg-glow-a), transparent 70%),
    radial-gradient(50% 50% at 80% 0%, var(--bg-glow-b), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.app {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 460px;
  margin: 0 auto;
  /* dvh keeps the bottom controls clear of Safari's toolbar on iOS;
     vh is the fallback for browsers without dynamic viewport units. */
  min-height: 100vh;
  min-height: 100dvh;
  padding:
    calc(env(safe-area-inset-top, 0px) + 14px)
    calc(env(safe-area-inset-right, 0px) + var(--pad))
    calc(env(safe-area-inset-bottom, 0px) + 28px)
    calc(env(safe-area-inset-left, 0px) + var(--pad));
  display: flex;
  flex-direction: column;
}

.screen {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  animation: screen-in var(--dur-slow) var(--ease) both;
  outline: none;
}

@keyframes screen-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 50%;
  top: 8px;
  transform: translate(-50%, -200%);
  background: var(--accent);
  color: var(--on-accent);
  padding: 10px 16px;
  border-radius: var(--r-pill);
  font-weight: 600;
  z-index: 50;
  transition: transform var(--dur) var(--ease);
}
.skip-link:focus { transform: translate(-50%, 0); }

/* Focus visibility everywhere, keyboard only. */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 8px;
}
/* Screens receive focus on navigation so screen readers land in the new
   context, but they are containers — no visible ring for them. */
.screen:focus,
.screen:focus-visible { outline: none; }

/* Top bar used by every non-home screen */
.bar {
  display: grid;
  grid-template-columns: var(--tap) 1fr var(--tap);
  align-items: center;
  gap: 8px;
  margin-bottom: 22px;
}
.bar__title {
  margin: 0;
  min-width: 0;
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.01em;
  /* Long category names truncate rather than pushing the icons off screen. */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bar__title small {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-top: 2px;
}

/* ──────────────────────────────────────────────────────────── 3. TYPE ───── */
.question {
  font-size: clamp(22px, 6.4vw, 28px);
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 16px;
  max-width: 24ch;
}

.section-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted-dim);
  margin: 26px 0 10px;
}

.fine-print {
  margin: 18px 0 0;
  font-size: 12.5px;
  color: var(--muted-dim);
  text-align: center;
}

.text-link { color: var(--accent); text-decoration: none; }
.text-link:hover { text-decoration: underline; }

/* ─────────────────────────────────────────────────────── 4. HOME ───────── */
.home-head { margin: 4px 0 16px; }

.lockup { display: flex; flex-direction: column; line-height: 1; }
.lockup__parent {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.42em;
  color: var(--accent);
  opacity: 0.85;
}
.lockup__product {
  font-size: clamp(32px, 9.5vw, 40px);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-top: 5px;
  background: linear-gradient(180deg, #FFFFFF 0%, var(--accent) 130%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: var(--accent);
}
.lockup__tagline {
  margin: 8px 0 0;
  font-size: 14px;
  color: var(--muted);
  letter-spacing: 0.01em;
}

.streak-chip {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  background: rgba(143, 191, 239, 0.07);
  border-radius: var(--r-pill);
  font-size: 12.5px;
  color: var(--accent-bright);
  letter-spacing: 0.01em;
}
.streak-chip::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
}

.tile-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 11px;
}
/* If the final tile would sit alone on its row, let it span the row instead of
   leaving a hole. Works for any number of categories. */
.tile:last-child:nth-child(odd) { grid-column: span 2; }

.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 9px;
  min-height: 104px;
  padding: 13px;
  text-align: left;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  background:
    linear-gradient(180deg, var(--surface-hi), transparent 60%),
    var(--surface);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  box-shadow: var(--shadow-card);
  transition: transform var(--dur-fast) var(--ease),
              border-color var(--dur) var(--ease),
              background-color var(--dur) var(--ease);
}
.tile:hover { border-color: var(--line); }
.tile:active { transform: scale(0.975); }

.tile__icon {
  width: 34px; height: 34px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: rgba(143, 191, 239, 0.11);
  color: var(--accent);
  margin-bottom: auto;
}
.tile__icon svg { width: 19px; height: 19px; }

.tile__name {
  font-size: 14.5px;
  font-weight: 650;
  letter-spacing: -0.01em;
  line-height: 1.25;
}
.tile__blurb {
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.35;
  margin-top: -5px;
  /* One line, always — the tiles stay a calm, even grid. */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Prominent Surprise Me action */
.surprise {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 64px;
  margin-top: 12px;
  padding: 13px 17px;
  border: 1px solid rgba(143, 191, 239, 0.34);
  border-radius: var(--r-md);
  background:
    linear-gradient(135deg, rgba(143, 191, 239, 0.16), rgba(78, 134, 196, 0.08));
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  box-shadow: var(--glow-accent);
  transition: transform var(--dur-fast) var(--ease), box-shadow var(--dur) var(--ease);
}
.surprise:active { transform: scale(0.985); }
.surprise__glow {
  position: absolute;
  inset: auto -20% -80% 40%;
  height: 140%;
  background: radial-gradient(50% 50% at 50% 50%, rgba(143, 191, 239, 0.30), transparent 70%);
  pointer-events: none;
}
.surprise__icon {
  position: relative;
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 12px;
  background: rgba(143, 191, 239, 0.18);
  color: var(--accent-bright);
  flex: none;
}
.surprise__icon svg { width: 21px; height: 21px; }
.surprise__text { position: relative; display: flex; flex-direction: column; }
.surprise__text strong {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.surprise__text small { font-size: 12px; color: var(--muted); margin-top: 2px; }

.home-foot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: auto;
  padding-top: 14px;
}
.home-foot .dot {
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--muted-dim);
}

.link-btn {
  background: none;
  border: 0;
  color: var(--muted);
  font: inherit;
  font-size: 13.5px;
  padding: 10px 6px;
  min-height: var(--tap);
  cursor: pointer;
  transition: color var(--dur) var(--ease);
}
.link-btn:hover { color: var(--text); }

/* ───────────────────────────────────────────────────── 5. DURATION ─────── */
.duration-grid {
  display: grid;
  gap: 12px;
}
.duration {
  display: flex;
  align-items: baseline;
  gap: 12px;
  width: 100%;
  min-height: 74px;
  padding: 16px 18px;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  background: linear-gradient(180deg, var(--surface-hi), transparent 60%), var(--surface);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  box-shadow: var(--shadow-card);
  transition: transform var(--dur-fast) var(--ease), border-color var(--dur) var(--ease);
}
.duration:hover { border-color: var(--line); }
.duration:active { transform: scale(0.985); }
.duration__value {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.duration__unit { font-size: 14px; color: var(--muted); font-weight: 500; }
.duration__hint { margin-left: auto; font-size: 12.5px; color: var(--muted-dim); }

/* ────────────────────────────────────────────────── 6. RESET RUNNER ───── */
.segments {
  display: flex;
  gap: 5px;
  margin-bottom: 8px;
}
.segment {
  flex: 1 1 0;
  height: 3px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.10);
  overflow: hidden;
}
.segment__fill {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: 3px;
  background: var(--accent);
  transition: width 220ms linear;
}
.segment--done .segment__fill { width: 100%; }

.stage {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  /* Instruction around the upper third, timer below it — the screen reads
     top to bottom instead of floating in the middle. */
  justify-content: space-evenly;
  gap: 18px;
  padding: 8px 0 4px;
  text-align: center;
}

.ring {
  position: relative;
  width: min(196px, 50vw);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
}
.ring__svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring__track,
.ring__value {
  fill: none;
  stroke-width: 5;
  stroke-linecap: round;
}
.ring__track { stroke: rgba(255, 255, 255, 0.08); }
.ring__value {
  stroke: var(--accent);
  stroke-dasharray: 339.29;   /* 2πr, r = 54 */
  stroke-dashoffset: 339.29;
  filter: drop-shadow(0 0 8px rgba(143, 191, 239, 0.45));
  transition: stroke-dashoffset 220ms linear;
}
.ring__inner { position: absolute; text-align: center; }
.ring__time {
  margin: 0;
  font-size: clamp(32px, 9.5vw, 38px);
  font-weight: 300;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.ring__state {
  margin: 3px 0 0;
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted-dim);
}
.ring--paused .ring__value { stroke: var(--muted); filter: none; }
.ring--paused .ring__time { color: var(--muted); }
.ring--paused .ring__state { color: var(--accent); }

/* The instruction is the dominant element on this screen. */
.step-copy { max-width: 28ch; }
.step-title {
  margin: 0 0 10px;
  font-size: clamp(27px, 8.2vw, 34px);
  font-weight: 650;
  letter-spacing: -0.025em;
  line-height: 1.15;
  text-wrap: balance;
}
.step-text {
  margin: 0;
  font-size: 16px;
  color: var(--muted);
  line-height: 1.55;
}

/* ────────────────────────────────────────────────── 7. COMPLETE ───────── */
.screen--complete { align-items: center; justify-content: center; text-align: center; }
/* Everything on this screen is one centred group — no auto margins, which
   would cancel the centring and leave a hole in the middle. */
.screen--complete .controls { margin-top: 24px; padding-top: 0; max-width: 400px; }

.complete__mark { color: var(--accent); width: 84px; margin-bottom: 22px; }
.complete__mark svg { width: 100%; height: auto; }
.complete__circle {
  stroke-dasharray: 170;
  animation: draw 700ms var(--ease) both;
  opacity: 0.55;
}
.complete__check {
  stroke-dasharray: 40;
  animation: draw 520ms var(--ease) 260ms both;
}
@keyframes draw {
  from { stroke-dashoffset: var(--len, 180); opacity: 0; }
  to   { stroke-dashoffset: 0; opacity: 1; }
}
.complete__circle { --len: 170; }
.complete__check { --len: 40; }

.complete__title {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--accent);
}
.complete__line {
  margin: 14px 0 0;
  font-size: clamp(22px, 6.5vw, 27px);
  font-weight: 600;
  letter-spacing: -0.02em;
  max-width: 20ch;
}
.complete__meta {
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--muted-dim);
}

.feeling { margin: 30px 0 4px; width: 100%; }
.feeling__q {
  margin: 0 0 12px;
  font-size: 13.5px;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.feeling__opt {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted-dim);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-pill);
  padding: 2px 7px;
}
.feeling__row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }

.chip {
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  cursor: pointer;
  transition: border-color var(--dur) var(--ease), background-color var(--dur) var(--ease),
              transform var(--dur-fast) var(--ease);
}
.chip:hover { border-color: var(--line); }
.chip:active { transform: scale(0.97); }
.chip[aria-pressed="true"] {
  border-color: rgba(143, 191, 239, 0.7);
  background: rgba(143, 191, 239, 0.20);
  color: var(--accent-bright);
  font-weight: 600;
}

.complete__stat {
  margin: 20px 0 0;
  font-size: 12.5px;
  color: var(--muted-dim);
}

/* On the progress screen the privacy line sits at the bottom of the screen. */
.screen--progress .fine-print { margin-top: auto; padding-top: 26px; }

/* ────────────────────────────────────────────────── 8. PROGRESS ───────── */
.stat-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.stat {
  padding: 16px 12px;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  background: var(--surface);
  text-align: center;
}
.stat__value {
  display: block;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.stat__label {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  line-height: 1.25;
  /* Two lines of room, so "Reset minutes" wrapping does not knock the row out
     of alignment. */
  min-height: 2.5em;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--muted-dim);
}
.stat-note {
  margin: 14px 0 0;
  font-size: 13.5px;
  color: var(--muted);
  text-align: center;
}

.history { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.history__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 15px;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  background: var(--surface);
}
.history__name { font-size: 14.5px; font-weight: 550; }
.history__when { margin-left: auto; font-size: 12px; color: var(--muted-dim); }
.history__len {
  font-size: 12px;
  color: var(--accent);
  background: rgba(143, 191, 239, 0.10);
  border-radius: var(--r-pill);
  padding: 3px 9px;
  font-variant-numeric: tabular-nums;
}
.empty {
  padding: 26px 18px;
  border: 1px dashed var(--line-soft);
  border-radius: var(--r-md);
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

/* ────────────────────────────────────────────────── 9. SETTINGS ───────── */
.card {
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  background: var(--surface);
  overflow: hidden;
}
.card--pad { padding: 16px; }

.row {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 58px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line-soft);
  background: none;
  color: var(--text);
  font: inherit;
  text-align: left;
}
.card > .row:last-of-type { border-bottom: 0; }
.row--action { cursor: pointer; }
.row--action:hover { background: rgba(255, 255, 255, 0.02); }
.row__label { font-size: 15px; }
.row__label small {
  display: block;
  font-size: 12px;
  color: var(--muted-dim);
  margin-top: 2px;
}
.row__value { margin-left: auto; font-size: 13.5px; color: var(--accent); }
.row__value--warn { color: var(--warn); }
.row__hint {
  margin: 0;
  padding: 12px 16px 14px;
  font-size: 12.5px;
  color: var(--muted-dim);
  line-height: 1.5;
}
.card--pad .row__hint { padding: 10px 0 0; }

/* Switch */
.switch {
  position: relative;
  margin-left: auto;
  display: inline-flex;
  flex: none;
  width: 52px;
  height: 32px;
}
/* The input sits on top of the visual track so a tap anywhere on the switch
   hits the real control. */
.switch input {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  margin: 0;
  opacity: 0;
  z-index: 2;
  cursor: pointer;
}
.switch__track {
  width: 52px; height: 32px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid var(--line-soft);
  display: block;
  position: relative;
  transition: background-color var(--dur) var(--ease);
}
.switch__knob {
  position: absolute;
  top: 3px; left: 3px;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: #E6ECF2;
  transition: transform var(--dur) var(--ease);
}
.switch input:checked + .switch__track {
  background: rgba(143, 191, 239, 0.55);
  border-color: rgba(143, 191, 239, 0.6);
}
.switch input:checked + .switch__track .switch__knob {
  transform: translateX(20px);
  background: #FFFFFF;
}
.switch input:focus-visible + .switch__track {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.pill-row { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  min-height: 44px;
  min-width: 62px;
  padding: 10px 14px;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-pill);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: border-color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}
.pill[aria-pressed="true"] {
  border-color: rgba(143, 191, 239, 0.5);
  background: rgba(143, 191, 239, 0.14);
  color: var(--accent-bright);
}

.about { color: var(--muted); font-size: 14px; line-height: 1.6; }
.about p { margin: 0 0 12px; }
.about strong { color: var(--text); }
.about__lede { color: var(--text); }
.about__disclaimer {
  font-size: 12.5px;
  color: var(--muted-dim);
  border-top: 1px solid var(--line-soft);
  padding-top: 12px;
}
.about__version {
  margin: 0;
  font-size: 12px;
  color: var(--muted-dim);
  letter-spacing: 0.04em;
}

/* ─────────────────────────────────────────── 10. BUTTONS & CONTROLS ───── */
button { -webkit-tap-highlight-color: transparent; font-family: inherit; }

.controls {
  display: grid;
  gap: 10px;
  margin-top: auto;
  padding-top: 22px;
  width: 100%;
}
.controls__row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.btn {
  min-height: 54px;
  padding: 14px 20px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease), background-color var(--dur) var(--ease),
              border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.btn:active { transform: scale(0.985); }

.btn--primary {
  background: linear-gradient(180deg, var(--accent-bright), var(--accent));
  color: var(--on-accent);
  box-shadow: 0 8px 30px rgba(143, 191, 239, 0.22);
}
.btn--primary:hover { box-shadow: 0 10px 36px rgba(143, 191, 239, 0.32); }

.btn--quiet {
  background: transparent;
  border-color: var(--line-soft);
  color: var(--muted);
  min-height: 50px;
  font-size: 15px;
  font-weight: 500;
}
.btn--quiet:hover { color: var(--text); border-color: var(--line); }

.btn--danger { color: var(--warn); }
.btn--danger:hover { color: var(--warn); border-color: rgba(233, 167, 167, 0.4); }

/* Disabled controls read as unavailable rather than just unresponsive. */
.btn:disabled,
.btn[disabled] {
  opacity: 0.35;
  cursor: not-allowed;
}
.btn:disabled:active,
.btn[disabled]:active { transform: none; }

.icon-btn {
  width: var(--tap); height: var(--tap);
  display: grid; place-items: center;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.icon-btn:hover { color: var(--text); border-color: var(--line); }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn--ghost { border-color: transparent; background: none; }

/* ──────────────────────────────────────────────── 11. SHEETS & TOAST ──── */
.sheet-host {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.sheet-scrim {
  position: absolute;
  inset: 0;
  background: rgba(4, 7, 10, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: fade-in var(--dur) var(--ease) both;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.sheet {
  position: relative;
  width: 100%;
  max-width: 460px;
  max-height: 86vh;
  max-height: 86dvh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: 12px 20px calc(env(safe-area-inset-bottom, 0px) + 22px);
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  border-bottom: 0;
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.5);
  animation: sheet-in 320ms var(--ease) both;
}
@keyframes sheet-in {
  from { transform: translateY(14%); opacity: 0.6; }
  to   { transform: none; opacity: 1; }
}
.sheet__grip {
  width: 40px; height: 4px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.16);
  margin: 0 auto 14px;
}
.sheet__title {
  margin: 0 0 6px;
  font-size: 19px;
  font-weight: 650;
  letter-spacing: -0.01em;
}
.sheet__text { margin: 0 0 4px; font-size: 14px; color: var(--muted); }
.sheet .controls { margin-top: 18px; padding-top: 0; }
.sheet > .btn { margin-top: 16px; }

.preview-list {
  list-style: none;
  counter-reset: step;
  margin: 12px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.preview-list li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 26px 1fr auto;
  align-items: baseline;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  background: var(--surface);
  font-size: 14.5px;
}
.preview-list li::before {
  content: counter(step);
  font-size: 12px;
  color: var(--muted-dim);
  font-variant-numeric: tabular-nums;
}
.preview-list .preview__len {
  font-size: 12px;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.preview-list li[data-current="true"] {
  border-color: rgba(143, 191, 239, 0.45);
  background: rgba(143, 191, 239, 0.09);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 24px);
  transform: translateX(-50%);
  z-index: 60;
  padding: 12px 18px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 13.5px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  animation: toast-in 260ms var(--ease) both;
  max-width: calc(100% - 40px);
  text-align: center;
}
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 10px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* ─────────────────────────────────────────── 12. MOTION & RESPONSIVE ──── */

/* Honour the OS setting and the in-app switch equally. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  /* Exception: the countdown still moves smoothly. It is information, not
     decoration, and a stepping ring is harder to read than a sweeping one. */
  .ring__value,
  .segment__fill { transition-duration: 220ms !important; }
}
[data-motion="reduced"] *,
[data-motion="reduced"] *::before,
[data-motion="reduced"] *::after {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
}
/* The countdown ring should still move — just without the springy easing. */
[data-motion="reduced"] .ring__value,
[data-motion="reduced"] .segment__fill {
  transition-duration: 220ms !important;
}

/* Small phones */
@media (max-height: 700px) {
  .tile { min-height: 92px; padding: 12px; gap: 7px; }
  .tile__icon { width: 30px; height: 30px; border-radius: 10px; margin-bottom: auto; }
  .tile__icon svg { width: 17px; height: 17px; }
  .home-head { margin: 0 0 12px; }
  .lockup__product { font-size: 30px; }
  .lockup__tagline { margin-top: 6px; }
  .surprise { min-height: 58px; margin-top: 10px; }
  .ring { width: min(158px, 44vw); }
  .ring__time { font-size: 30px; }
  .stage { gap: 18px; padding: 8px 0; }
  .step-title { font-size: clamp(24px, 7.4vw, 28px); }
}

/* Large phones / small tablets */
@media (min-width: 600px) {
  :root { --pad: 28px; }
  .app { max-width: 560px; }
  .tile-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .duration-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  /* Three columns: fill whatever the last row leaves over. */
  .tile:last-child:nth-child(odd) { grid-column: auto; }
  .tile:last-child:nth-child(3n + 1) { grid-column: span 3; }
  .tile:last-child:nth-child(3n + 2) { grid-column: span 2; }
}

/* Desktop — stays an app in a calm column rather than becoming a dashboard */
@media (min-width: 1024px) {
  .app {
    max-width: 720px;
    padding-top: 48px;
    padding-bottom: 48px;
  }
  .question { font-size: 32px; max-width: 30ch; }
  .lockup__product { font-size: 44px; }
  .tile { min-height: 126px; padding: 16px; }
  .tile__name { font-size: 16px; }
  .ring { width: 232px; }
  .ring__time { font-size: 44px; }
  .step-title { font-size: 40px; }
  .step-text { font-size: 17px; }
  .controls { max-width: 460px; margin-left: auto; margin-right: auto; }
  .screen--reset .stage { gap: 36px; }
}

/* Print / very reduced environments: keep text legible */
@media (prefers-contrast: more) {
  :root {
    --muted: #C3CEDA;
    --muted-dim: #9BA9B7;
    --line-soft: rgba(255, 255, 255, 0.18);
  }
}
