/* Ikuzo — one screen. Every colour comes from theme tokens (themes.js). */
:root {
  --c-work: #19C96C; --c-rest: #FF3B3B; --c-warm: #2F7BFF; --c-cool: #2F7BFF; --c-prep: #8A8FA3;
  --bg: #07080B; --fg: #fff; --accent: #19C96C;
  --font: system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
  --digits: var(--font);
  --kind: var(--c-work);
  --dim: color-mix(in srgb, var(--fg) 55%, transparent);
  --hair: color-mix(in srgb, var(--fg) 14%, transparent);
  --panel: color-mix(in srgb, var(--fg) 6%, transparent);
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px);
  --dur-hit: .34s;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  background: var(--bg); color: var(--fg); font-family: var(--font);
  min-height: 100dvh; overflow: hidden; overscroll-behavior: none; user-select: none; -webkit-user-select: none;
  transition: background-color var(--dur-hit) cubic-bezier(.2,.9,.2,1);
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
[hidden] { display: none !important; }

#app { position: relative; height: 100dvh; display: flex; flex-direction: column; padding: calc(var(--sat) + 12px) 18px calc(var(--sab) + 12px); }
.pane { flex: 1; min-height: 0; display: flex; flex-direction: column; }
#stage { display: none; }
body[data-mode="run"] #setup { display: none; }
/* the stage arrives and leaves on a short fade, so ending a workout is a
   transition rather than a jump cut */
body[data-mode="run"] #stage { display: flex; animation: stage-in .26s cubic-bezier(.2,.9,.2,1); }
#stage.leaving { animation: stage-out .2s ease forwards; pointer-events: none; }
@keyframes stage-in { from { opacity: 0; transform: scale(.986); } }
@keyframes stage-out { to { opacity: 0; transform: scale(.992); } }

/* ── brand ─────────────────────────────────────────────── */
.brand { display: flex; align-items: center; gap: 4px; margin-bottom: 10px; }
.brand .icon { flex: none; width: 34px; height: 34px; border-radius: 10px; }
.wordmark { font-weight: 800; letter-spacing: -.02em; font-size: 1.35rem; flex: 1; display: flex; align-items: center; gap: 6px; min-width: 0; overflow: hidden; white-space: nowrap; }
.wordmark .wm-name { letter-spacing: .04em; } .wordmark .wm-go { font-weight: 600; color: var(--dim); font-size: .85rem; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 360px) { .wordmark .wm-go { display: none; } }
.tagline { margin: 4px 0 12px; font-size: .85rem; line-height: 1.35; color: var(--dim); }
@media (max-height: 640px) { .tagline { display: none; } }
/* the timed / tap switch: two sides, the one in force filled */
.flip { display: inline-flex; border: 1px solid var(--hair); border-radius: 999px; padding: 2px; background: transparent; color: var(--fg); font: inherit; font-size: .78rem; cursor: pointer; }
.flip-side { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px; color: var(--dim); }
.flip-side.on { background: var(--fg); color: var(--bg); }
html[data-effect="flood"] body[data-mode="setup"] .flip-side.on { background: var(--accent); color: #000; }
.icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: var(--dim); }
.icon:hover, .icon:focus-visible { color: var(--fg); background: var(--panel); outline: none; }
a.icon { text-decoration: none; }
.icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ── prompt ────────────────────────────────────────────── */
.prompt-wrap { position: relative; }
#prompt {
  width: 100%; resize: none; border: 1px solid var(--hair); border-radius: 18px; background: var(--panel);
  color: var(--fg); font: 500 1.15rem/1.35 var(--font); padding: 16px 56px 16px 18px; outline: none;
  user-select: text; -webkit-user-select: text; caret-color: var(--accent);
}
#prompt:focus { border-color: color-mix(in srgb, var(--accent) 60%, var(--hair)); }
#prompt::placeholder { color: var(--dim); }
.mic { position: absolute; right: 8px; top: 8px; }
.scan { right: 48px; }
.recents-btn { right: 48px; }
#prompt { padding-right: 92px; }
html[data-ocr] .recents-btn { right: 88px; } html[data-ocr] .scan { right: 48px; } html[data-ocr] #prompt { padding-right: 132px; }
.mic[aria-pressed="true"] { color: var(--c-rest); animation: micpulse 1.2s ease-in-out infinite; }
@keyframes micpulse { 50% { transform: scale(1.12); } }

/* ── preview ───────────────────────────────────────────── */
.preview { margin-top: 16px; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.segbar { display: flex; gap: 3px; height: 14px; border-radius: 7px; overflow: hidden; }
.segbar .seg { height: 100%; border-radius: 2px; background: var(--kc); min-width: 3px; transition: flex-basis .25s; position: relative; }
.segbar .seg.open { background: repeating-linear-gradient(135deg, var(--kc) 0 6px, color-mix(in srgb, var(--kc) 40%, transparent) 6px 12px); }
.segbar .seg.done { opacity: .28; }
.segbar .seg.now { box-shadow: 0 0 0 2px var(--fg) inset; }
.segbar .seg.now::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent var(--p, 0%), color-mix(in srgb, var(--bg) 55%, transparent) var(--p, 0%)); }
.segbar.run { height: 10px; margin-top: 10px; }
.preview-meta { display: flex; align-items: baseline; gap: 12px; margin: 12px 2px 6px; }
.total { font: 800 2rem/1 var(--digits); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.summary { color: var(--dim); font-size: .9rem; }
.planlist { list-style: none; overflow: auto; -webkit-overflow-scrolling: touch; flex: 1; min-height: 0; padding-right: 4px; mask-image: linear-gradient(#000 85%, transparent); }
.planlist li { display: grid; grid-template-columns: 10px 1fr auto; gap: 10px; align-items: center; padding: 6px 2px; font-size: .95rem; border-bottom: 1px solid var(--hair); }
.planlist li .k { width: 10px; height: 10px; border-radius: 3px; background: var(--kc); }
.planlist li .d { color: var(--dim); font-variant-numeric: tabular-nums; }
.planlist li.grp { font-weight: 600; color: var(--dim); font-size: .8rem; letter-spacing: .06em; text-transform: uppercase; border: 0; padding-top: 12px; }
.planlist li.sub { padding-left: 14px; }
.examples { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.examples button { padding: 7px 12px; border-radius: 999px; border: 1px solid var(--hair); color: var(--dim); font-size: .85rem; }
.examples button:hover { color: var(--fg); border-color: var(--fg); }
/* your own recent prompts, ahead of ours */
.examples button[data-recent] { color: var(--fg); border-color: color-mix(in srgb, var(--accent) 55%, var(--hair)); max-width: 100%; }
.examples button[data-recent]:hover { border-color: var(--accent); }

/* ── dock: the one button ──────────────────────────────── */
.dock { padding-top: 12px; }
.big {
  width: 100%; height: 76px; border-radius: 22px; font-weight: 800; font-size: 1.5rem; letter-spacing: .01em;
  background: var(--fg); color: var(--bg); transition: transform .12s, background-color var(--dur-hit);
}
.big:active { transform: scale(.97); }
.big:disabled { opacity: .35; cursor: default; }
body[data-mode="run"] .big { background: color-mix(in srgb, var(--fg) 16%, transparent); color: var(--fg); backdrop-filter: blur(10px); }
.dock-row { display: flex; align-items: center; gap: 14px; margin-top: 10px; font-size: .82rem; color: var(--dim); flex-wrap: wrap; }
.tog { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.tog input { accent-color: var(--accent); }
.voice-pick { font: inherit; font-size: .82rem; color: var(--fg); background: var(--panel); border: 1px solid var(--hair); border-radius: 999px; padding: 4px 10px; }
.link { color: var(--dim); text-decoration: underline; text-underline-offset: 3px; margin-left: auto; }
.link:hover { color: var(--fg); }
/* only the first link is pushed right; the rest sit next to it */
.dock-row .link ~ .link { margin-left: 12px; }
body[data-mode="run"] .dock-row { display: none; }
body:not([data-done]) .done-row { display: none; }

/* ── Done: fallback row (no sponsor) ───────────────────── */
.done-row { display: flex; gap: 14px; margin-top: 10px; font-size: .82rem; color: var(--dim); }
.done-row .link { margin-left: 0; }
.done-row .link + .link { margin-left: auto; }

/* ── Done: sponsor panel ───────────────────────────────── */
/* Every colour is a theme token: --sp-bg / --sp-fg come from themes.js
   (`panel` / `panelFg`, derived from bg/fg when a theme does not name them). */
.panel {
  position: fixed; left: 0; right: 0; bottom: 0; height: 66dvh; z-index: 30;
  background: var(--sp-bg); color: var(--sp-fg); font-family: var(--font);
  border-radius: 26px 26px 0 0; padding: 22px 22px calc(var(--sab) + 18px);
  display: flex; flex-direction: column; gap: 12px;
  transform: translateY(100%); transition: transform .36s cubic-bezier(.2,.9,.2,1);
  box-shadow: 0 -12px 40px color-mix(in srgb, #000 35%, transparent);
}
.panel.on { transform: translateY(0); }
.panel-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.panel-brand img { width: 40px; height: 40px; border-radius: 11px; object-fit: contain; background: color-mix(in srgb, var(--sp-fg) 8%, transparent); }
.panel-tag { margin-left: auto; font-weight: 500; font-size: .78rem; letter-spacing: .06em; text-transform: uppercase; opacity: .55; }
.panel-head { font-family: var(--digits); font-weight: 800; font-size: 30px; line-height: 1.08; letter-spacing: -.02em; margin-top: 6px; }
html[data-digits="mono"] .panel-head { font-size: 22px; letter-spacing: 0; }
.panel-body { opacity: .7; font-size: 1rem; line-height: 1.45; }
.panel-link { color: inherit; text-decoration: underline; text-underline-offset: 3px; font-weight: 600; }
.panel-slot { flex: 1; min-height: 0; border-radius: 16px; overflow: hidden; background: color-mix(in srgb, var(--sp-fg) 5%, transparent); }
.panel-slot ins { min-height: 200px; }
.panel .panel-continue, html[data-effect="flood"] body[data-mode="run"] .panel .panel-continue,
body[data-mode="run"] .panel .panel-continue { margin-top: auto; background: var(--sp-fg); color: var(--sp-bg); height: 68px; backdrop-filter: none; }
/* while the panel is up, Done and the time move into the top third */
body[data-done="1"][data-panel="1"] .stage-mid { justify-content: flex-start; padding-top: 2vh; }
body[data-done="1"][data-panel="1"] .time { font-size: clamp(4rem, 22vw, 9rem); }
body[data-done="1"][data-panel="1"] .runbar, body[data-done="1"][data-panel="1"] .dock { visibility: hidden; }
@media (min-width: 720px) { .panel { left: 50%; right: auto; width: min(560px, 100%); transform: translate(-50%, 100%); } .panel.on { transform: translate(-50%, 0); } }
@media (prefers-reduced-motion: reduce) { .panel { transition: none; } }

/* ── consent (individual data mode only) ───────────────── */
.consent { position: fixed; left: 12px; right: 12px; bottom: calc(var(--sab) + 12px); z-index: 25; background: var(--panel); color: var(--fg);
  backdrop-filter: blur(14px); border: 1px solid var(--hair); border-radius: 18px; padding: 14px 16px; font-size: .9rem; line-height: 1.45; }
.consent .row { display: flex; gap: 8px; margin-top: 10px; }
.consent .btn { padding: 9px 14px; border-radius: 12px; border: 1px solid var(--hair); font-weight: 600; }
.consent .btn.primary { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.consent a { color: inherit; }

/* ── stage ─────────────────────────────────────────────── */
.stage-top { display: flex; flex-direction: column; gap: 10px; }
.stage-head { display: flex; align-items: center; gap: 12px; }
.stage-prompt { flex: 1; min-width: 0; color: var(--dim); font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* The way out, for people who do not know about the long press. It inherits
   the stage's colour (so it stays legible when a theme floods the screen) and
   sits at a third opacity: present if you look for it, invisible if you are
   watching the clock. Far from the thumb and far from the one big button. */
.exit {
  flex: none; width: 38px; height: 38px; margin: -6px -8px -6px 0;
  display: grid; place-items: center; border-radius: 50%;
  color: inherit; opacity: .32;
  transition: opacity .25s ease, background-color .25s ease, transform .15s ease;
}
.exit svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.exit:hover, .exit:focus-visible { opacity: 1; background: color-mix(in srgb, currentColor 14%, transparent); outline: none; }
.exit:focus-visible { box-shadow: 0 0 0 2px color-mix(in srgb, currentColor 40%, transparent); }
.exit:active { transform: scale(.86); opacity: 1; }
.fsb { margin-right: 0; }
.fsb .fs-out { display: none; }
.fsb[aria-pressed="true"] .fs-in { display: none; }
.fsb[aria-pressed="true"] .fs-out { display: inline; }
.totalbar { height: 3px; border-radius: 2px; background: var(--hair); overflow: hidden; cursor: pointer; }
/* the track and the bar are scrubbers (tap = jump there): a generous hit area without moving anything */
.totalbar::before { content: ""; display: block; margin: -14px 0; height: 31px; }
.stage-top .totalbar { overflow: visible; position: relative; } .stage-top .totalbar .totalfill { position: absolute; left: 0; top: 0; height: 3px; }
.segbar.run { cursor: pointer; }
.totalfill { height: 100%; width: 0; background: var(--fg); transition: width .5s linear; }
/* elapsed and remaining at the two ends of the track (fix 7), in the digits font, the same scrim treatment as the digits */
.track-times { display: flex; justify-content: space-between; font-family: var(--digits); font-variant-numeric: tabular-nums; font-size: .72rem; opacity: .7; margin-top: 3px; letter-spacing: .02em; }
html[data-bgimg] body[data-mode="run"] .track-times { color: #fff; text-shadow: 0 1px 1px rgba(0,0,0,.9); opacity: .85; }
html[data-effect="flood"] body[data-mode="run"] .track-times { color: rgba(255,255,255,.8); }
.stage-mid { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; min-height: 0; }
.label { font-weight: 700; font-size: clamp(1.4rem, 6vw, 2.6rem); letter-spacing: -.02em; text-transform: uppercase; opacity: .92; }
.time {
  font-family: var(--digits); font-weight: 800; letter-spacing: -.06em; line-height: .95; font-variant-numeric: tabular-nums;
  font-size: clamp(5.5rem, 34vw, 15rem); margin: 6px 0; transform-origin: 50% 55%; cursor: pointer;
}
.time.hit { animation: hit var(--dur-hit) cubic-bezier(.2,1.4,.3,1); }
@keyframes hit { 0% { transform: scale(1.16); filter: brightness(1.8); } 100% { transform: scale(1); filter: none; } }
.time.last { animation: halo 1s ease-out infinite; }
@keyframes halo { 0% { text-shadow: 0 0 0 color-mix(in srgb, var(--fg) 70%, transparent); } 100% { text-shadow: 0 0 60px transparent; } }
.time.paused { opacity: .55; animation: blink 1.4s steps(2, end) infinite; }
@keyframes blink { 50% { opacity: .25; } }
.meta-row { display: flex; gap: 18px; font-size: clamp(1rem, 4.5vw, 1.6rem); font-weight: 600; color: var(--dim); font-variant-numeric: tabular-nums; }
.rounds { color: var(--fg); }
.next { margin-top: 12px; font-size: clamp(.95rem, 4vw, 1.3rem); color: var(--dim); }
.next b { color: var(--fg); font-weight: 600; }

/* ── flood effect (Signal): the whole screen is the block colour ── */
html[data-effect="flood"] body[data-mode="run"] { background: var(--kind); color: #fff; }
html[data-effect="flood"] body[data-mode="run"] .dock .big { background: rgba(255,255,255,.18); color: #fff; }
html[data-effect="flood"] body[data-mode="run"] .totalbar { background: rgba(255,255,255,.25); }
html[data-effect="flood"] body[data-mode="run"] .totalfill { background: #fff; }
html[data-effect="flood"] body[data-mode="run"] .segbar .seg.now { box-shadow: 0 0 0 2px #fff inset; }
html[data-effect="flood"] body[data-mode="run"] .segbar .seg.now::after { background: linear-gradient(90deg, rgba(255,255,255,.55) var(--p, 0%), transparent var(--p, 0%)); }
html[data-effect="flood"] body[data-mode="run"][data-kind="prep"] { background: #1a1c22; }
html[data-effect="flood"] body[data-mode="run"] .time.last { animation: haloflood 1s ease-out infinite; }
@keyframes haloflood { 0% { text-shadow: 0 0 0 rgba(255,255,255,.9); transform: scale(1.03); } 100% { text-shadow: 0 0 80px rgba(255,255,255,0); transform: scale(1); } }
html[data-effect="flood"] body[data-mode="run"] .meta-row, html[data-effect="flood"] body[data-mode="run"] .next, html[data-effect="flood"] body[data-mode="run"] .stage-prompt { color: rgba(255,255,255,.75); }
html[data-effect="flood"] body[data-mode="run"] .next b, html[data-effect="flood"] body[data-mode="run"] .rounds { color: #fff; }


.toast { position: fixed; left: 50%; bottom: calc(var(--sab) + 110px); transform: translateX(-50%) translateY(20px); background: var(--fg); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: .9rem; opacity: 0; transition: .25s; pointer-events: none; z-index: 30; }
.toast.on { opacity: 1; transform: translateX(-50%); }

/* ── sheets ─────────────────────────────────────────────── */
.sheet { border: 0; padding: 0; background: transparent; max-width: none; width: 100%; height: 100%; max-height: none; margin: 0; }
.sheet::backdrop { background: rgba(0,0,0,.55); backdrop-filter: blur(6px); }
.sheet form { position: absolute; left: 0; right: 0; bottom: 0; max-height: 88dvh; overflow: auto; background: var(--bg); color: var(--fg); border-radius: 22px 22px 0 0; padding: 16px 18px calc(var(--sab) + 18px); border-top: 1px solid var(--hair); }
.sheet header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.sheet h2 { font-size: 1.1rem; font-weight: 700; }
.theme-list { display: flex; gap: 6px; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 2px; scrollbar-width: thin; }   /* one strip, not a wall of cards (fix 5) */
.theme-list .theme-group { display: none; }
.theme-list .theme-card { flex: none; width: 84px; padding: 6px 8px; gap: 4px; border-radius: 10px; } .theme-list .theme-card b { font-size: .72rem; } .theme-list .theme-card .sw { height: 7px; }
.settings-grid { display: grid; gap: 8px; margin-top: 8px; }
@media (min-width: 400px) { .settings-grid { grid-template-columns: 1fr 1fr; align-items: start; } }
.swatch-row { display: flex; gap: 4px; justify-content: space-between; }
.swatch-i { display: grid; justify-items: center; gap: 1px; font-size: .56rem; color: var(--dim); text-transform: uppercase; letter-spacing: .03em; }
.swatch-i input[type=color] { width: 30px; height: 24px; border: 0; background: none; padding: 0; border-radius: 6px; }
.seg-row { display: flex; gap: 6px; flex-wrap: wrap; }
@media (max-width: 420px) { .seg-row .seg { flex: 1 1 100%; } }
.seg { display: inline-flex; border: 1px solid var(--hair); border-radius: 8px; overflow: hidden; flex: 1; min-width: 0; }
.seg-i { flex: 1; text-align: center; padding: 3px 3px; font-size: .68rem; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 28px; display: flex; align-items: center; justify-content: center; }
.seg-i + .seg-i { border-left: 1px solid var(--hair); }
.seg-i.on { background: var(--fg); color: var(--bg); }
.seg-i input { position: absolute; opacity: 0; width: 0; height: 0; }
.name-row { display: flex; gap: 6px; } .name-row input { flex: 1; min-width: 0; padding: 6px 10px; } .name-row .btn { padding: 6px 12px; font-size: .84rem; }
.block { border: 1px solid var(--hair); border-radius: 12px; padding: 0 10px; }
.block summary { cursor: pointer; padding: 7px 0; font-size: .74rem; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); list-style: none; display: flex; justify-content: space-between; }
.block summary::after { content: "+"; } .block[open] summary::after { content: "−"; }
.block > div { padding-bottom: 10px; }
.settings-side { display: grid; gap: 6px; }
.sound-body { margin-top: 0; gap: 8px; } .sound-body .muted { font-size: .78rem; }
.settings form { max-height: 92dvh; padding-top: 12px; }
.theme-group { grid-column: 1 / -1; font-size: .75rem; letter-spacing: .12em; text-transform: uppercase; color: var(--dim); margin-top: 6px; }
.theme-card { border: 1px solid var(--hair); border-radius: 14px; padding: 10px; text-align: left; display: grid; gap: 8px; }
.theme-card.on { border-color: var(--fg); }
.theme-card .sw { display: flex; gap: 3px; height: 10px; border-radius: 4px; overflow: hidden; }
.theme-card .sw i { flex: 1; }
.theme-card b { font-size: .9rem; }
.theme-editor { display: grid; gap: 7px; }
.theme-editor .row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px; font-size: .9rem; }
.theme-editor input[type=color] { width: 44px; height: 30px; border: 0; background: none; padding: 0; }
.theme-editor select, .theme-editor input[type=text] { background: var(--panel); color: var(--fg); border: 1px solid var(--hair); border-radius: 8px; padding: 6px 8px; font: inherit; }
.theme-editor .actions { display: flex; gap: 10px; margin-top: 6px; }
.btn { padding: 10px 14px; border-radius: 12px; border: 1px solid var(--hair); font-weight: 600; }
.btn.primary { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.btn.on { border-color: var(--fg); }
#proBody { display: grid; gap: 12px; font-size: .95rem; }
#proBody input[type=email] { width: 100%; background: var(--panel); color: var(--fg); border: 1px solid var(--hair); border-radius: 12px; padding: 12px; font: inherit; }
#proBody .muted { color: var(--dim); font-size: .85rem; }
#proBody ul { padding-left: 18px; color: var(--dim); }
#proBody li b { color: var(--fg); }

/* ── landscape: digits left, plan right ─────────────────── */
@media (orientation: landscape) and (max-height: 500px) {
  #app { padding-top: calc(var(--sat) + 8px); }
  body[data-mode="run"] #app { display: grid; grid-template-columns: 1fr 200px; grid-template-rows: 1fr; gap: 12px; }
  body[data-mode="run"] #stage { grid-column: 1; }
  body[data-mode="run"] .dock { grid-column: 2; display: flex; align-items: center; padding: 0; }
  body[data-mode="run"] .big { height: 64px; }
  .time { font-size: clamp(4rem, 26vh, 11rem); margin: 0; }
  .label { font-size: clamp(1rem, 5vh, 1.6rem); }
  .next { margin-top: 4px; }
  body[data-mode="setup"] .preview { flex-direction: row; gap: 14px; align-items: flex-start; margin-top: 10px; }
  body[data-mode="setup"] .segbar { display: none; }
  body[data-mode="setup"] .planlist { max-height: 110px; }
  body[data-mode="setup"] .examples { display: none; }
  body[data-mode="setup"] #prompt { padding-top: 10px; padding-bottom: 10px; }
}

/* ── reduced motion ─────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  .time.hit, .time.last, .mic[aria-pressed="true"], .time.paused { animation: none !important; }
  body[data-mode="run"] #stage, #stage.leaving { animation: none !important; }
}

/* ═══════════════════════════════════════════════════════════════════
   Theme looks. Tokens set the colours/fonts; these blocks give each
   digitStyle / effect its character. No theme logic lives in JS.
   ═══════════════════════════════════════════════════════════════════ */

/* ── Mono: brutalist, hairlines, colour only on the segment bar ── */
html[data-digits="mono"] .time { font-weight: 500; letter-spacing: -.02em; }
html[data-digits="mono"] .total { font-weight: 500; }
html[data-digits="mono"] .label { font-weight: 500; letter-spacing: .18em; font-size: clamp(.9rem, 4vw, 1.4rem); }
html[data-effect="none"] body[data-mode="run"] { background: var(--bg); }
html[data-effect="none"] .big { border-radius: 0; border: 1px solid var(--fg); }
html[data-effect="none"] #prompt, html[data-effect="none"] .examples button, html[data-effect="none"] .theme-card, html[data-effect="none"] .btn { border-radius: 0; }
html[data-effect="none"] body[data-mode="run"] .stage-mid { border-top: 1px solid var(--hair); border-bottom: 1px solid var(--hair); margin: 12px 0; }
html[data-effect="none"] body[data-mode="run"] .label::before { content: "— "; }
html[data-effect="none"] body[data-mode="run"] .label::after { content: " —"; }
html[data-effect="none"] .time.last { animation: none; text-decoration: underline; text-decoration-thickness: .06em; text-underline-offset: .12em; }
html[data-effect="none"] .segbar { gap: 1px; border-radius: 0; }
html[data-effect="none"] .segbar .seg { border-radius: 0; }

/* ── Neon: dark, glowing edges, bloom digits, scanline grain ── */
html[data-digits="bloom"] .time { font-weight: 700; letter-spacing: -.02em; text-shadow: 0 0 12px var(--kind), 0 0 42px color-mix(in srgb, var(--kind) 70%, transparent), 0 0 90px color-mix(in srgb, var(--kind) 40%, transparent); color: #fff; }
html[data-digits="bloom"] .total { text-shadow: 0 0 14px var(--accent); }
html[data-effect="glow"] body[data-mode="run"] { background: radial-gradient(ellipse 80% 60% at 50% 40%, color-mix(in srgb, var(--kind) 18%, var(--bg)), var(--bg) 70%); }
html[data-effect="glow"] body[data-mode="run"] .label { color: var(--kind); text-shadow: 0 0 18px var(--kind); }
html[data-effect="glow"] .big { border: 1px solid color-mix(in srgb, var(--accent) 60%, transparent); box-shadow: 0 0 22px color-mix(in srgb, var(--accent) 35%, transparent), inset 0 0 12px color-mix(in srgb, var(--accent) 20%, transparent); background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--fg); }
html[data-effect="glow"] body[data-mode="run"] .big { border-color: var(--kind); box-shadow: 0 0 26px color-mix(in srgb, var(--kind) 45%, transparent); }
html[data-effect="glow"] #prompt { border-color: color-mix(in srgb, var(--accent) 35%, transparent); box-shadow: 0 0 18px color-mix(in srgb, var(--accent) 15%, transparent); }
html[data-effect="glow"] .segbar .seg { box-shadow: 0 0 8px var(--kc); }
html[data-effect="glow"] .totalfill { background: var(--kind); box-shadow: 0 0 10px var(--kind); }
html[data-effect="glow"] body::after { content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 5; opacity: .35;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,.25) 0 1px, transparent 1px 3px); mix-blend-mode: multiply; }
html[data-effect="glow"] .time.last { animation: neonflicker 1s steps(6) infinite; }
@keyframes neonflicker { 0%,100% { opacity: 1; } 40% { opacity: .82; } 45% { opacity: 1; } 70% { opacity: .9; } }

/* ── Analog: paper, serif numerals, a sweeping ring around the digits ── */
html[data-digits="serif"] .time { font-weight: 600; letter-spacing: -.03em; font-variant-numeric: lining-nums tabular-nums; }
html[data-digits="serif"] .label { font-family: var(--font); font-weight: 500; letter-spacing: .22em; font-size: clamp(.85rem, 3.6vw, 1.2rem); }
html[data-digits="serif"] .total { font-weight: 600; }
html[data-effect="ring"] body { background: var(--bg) radial-gradient(ellipse at 50% 30%, color-mix(in srgb, var(--fg) 4%, transparent), transparent 70%); }
html[data-effect="ring"] body[data-mode="run"] .stage-mid { position: relative; }
html[data-effect="ring"] body[data-mode="run"] .time { position: relative; z-index: 1; }
html[data-effect="ring"] body[data-mode="run"] .stage-mid::before {
  content: ""; position: absolute; left: 50%; top: 50%; width: min(78vw, 60dvh); aspect-ratio: 1; transform: translate(-50%, -50%);
  border-radius: 50%; z-index: 0;
  background: conic-gradient(var(--kind) calc(var(--ring, 0) * 1%), color-mix(in srgb, var(--fg) 10%, transparent) 0);
  -webkit-mask: radial-gradient(circle closest-side, transparent 0, transparent calc(100% - 10px), #000 calc(100% - 9px)); mask: radial-gradient(circle closest-side, transparent 0, transparent calc(100% - 10px), #000 calc(100% - 9px));
}
html[data-effect="ring"] body[data-mode="run"] .stage-mid::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: min(78vw, 60dvh); aspect-ratio: 1; transform: translate(-50%, -50%);
  border-radius: 50%; z-index: 0; background: repeating-conic-gradient(color-mix(in srgb, var(--fg) 30%, transparent) 0 .6deg, transparent .6deg 6deg);
  -webkit-mask: radial-gradient(circle closest-side, transparent 0, transparent calc(100% - 18px), #000 calc(100% - 17px), #000 calc(100% - 12px), transparent calc(100% - 11px)); mask: radial-gradient(circle closest-side, transparent 0, transparent calc(100% - 18px), #000 calc(100% - 17px), #000 calc(100% - 12px), transparent calc(100% - 11px));
}
html[data-effect="ring"] .big { border-radius: 999px; border: 2px solid var(--fg); background: var(--fg); color: var(--bg); }
html[data-effect="ring"] body[data-mode="run"] .big { background: transparent; color: var(--fg); }
html[data-effect="ring"] .segbar { height: 8px; }
html[data-effect="ring"] body[data-mode="run"] .label { color: var(--kind); }
html[data-effect="ring"] .time.last { animation: none; color: var(--kind); }
html[data-effect="ring"] #prompt { background: color-mix(in srgb, var(--fg) 4%, transparent); border-color: color-mix(in srgb, var(--fg) 25%, transparent); }

/* ── Terminal: phosphor green, blocky digits, ASCII progress ── */
html[data-digits="bitmap"] .time { font-weight: 700; letter-spacing: .02em; text-shadow: 0 0 6px var(--fg); image-rendering: pixelated; }
html[data-digits="bitmap"] .time::before { content: "["; opacity: .35; font-weight: 400; }
html[data-digits="bitmap"] .time::after { content: "]"; opacity: .35; font-weight: 400; }
html[data-digits="bitmap"] .label { font-weight: 700; letter-spacing: .1em; }
html[data-digits="bitmap"] .label::before { content: "> "; }
html[data-effect="scanline"] body { text-shadow: 0 0 4px color-mix(in srgb, var(--fg) 55%, transparent); }
html[data-effect="scanline"] body::before { content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 5;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,.35) 0 2px, transparent 2px 4px); }
html[data-effect="scanline"] body::after { content: ""; position: fixed; inset: -10%; pointer-events: none; z-index: 6; opacity: .7;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,.75) 100%); }
html[data-effect="scanline"] body[data-mode="run"] { background: var(--bg); }
html[data-effect="scanline"] .big { border-radius: 0; border: 2px solid var(--fg); background: transparent; color: var(--fg); text-transform: uppercase; letter-spacing: .12em; }
html[data-effect="scanline"] .big::before { content: "[ "; } html[data-effect="scanline"] .big::after { content: " ]"; }
html[data-effect="scanline"] #prompt { border-radius: 0; border: 1px solid var(--fg); background: transparent; }
html[data-effect="scanline"] #prompt::placeholder { color: color-mix(in srgb, var(--fg) 45%, transparent); }
html[data-effect="scanline"] .examples button, html[data-effect="scanline"] .theme-card, html[data-effect="scanline"] .btn { border-radius: 0; border-color: var(--fg); color: var(--fg); }
html[data-effect="scanline"] .segbar { height: 12px; gap: 2px; border-radius: 0; border: 1px solid var(--fg); padding: 1px; }
html[data-effect="scanline"] .segbar .seg { border-radius: 0; }
html[data-effect="scanline"] .segbar .seg.done { opacity: .2; }
html[data-effect="scanline"] .totalbar { height: 8px; border: 1px solid var(--fg); background: transparent; border-radius: 0; }
html[data-effect="scanline"] .totalfill { background: repeating-linear-gradient(90deg, var(--fg) 0 6px, transparent 6px 8px); }
html[data-effect="scanline"] .time.last { animation: termblink .5s steps(2) infinite; }
@keyframes termblink { 50% { opacity: .4; } }
html[data-effect="scanline"] body[data-mode="run"][data-kind="rest"] .time, html[data-effect="scanline"] body[data-mode="run"][data-kind="rest"] .label { opacity: .7; }

/* ── ring progress custom property is driven from JS via --ring ── */

/* ── Soft (Omarchy palettes): the editor-theme look. Calm ground, the block
   colour carries the label, the digits and the button; nothing floods. ── */
html[data-effect="soft"] body[data-mode="run"] { background: var(--bg); }
html[data-effect="soft"] body[data-mode="run"] .label { color: var(--kind); letter-spacing: .12em; }
html[data-effect="soft"] body[data-mode="run"] .time { color: var(--kind); }
html[data-effect="soft"] body[data-mode="run"] .stage-mid::before {
  content: ""; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(96vw, 70dvh); aspect-ratio: 1; border-radius: 50%; z-index: -1;
  background: radial-gradient(circle, color-mix(in srgb, var(--kind) 14%, transparent), transparent 62%);
}
html[data-effect="soft"] body[data-mode="run"] .stage-mid { position: relative; z-index: 0; }
html[data-effect="soft"] .big { background: var(--accent); color: var(--bg); border-radius: 16px; }
html[data-effect="soft"] body[data-mode="run"] .big { background: color-mix(in srgb, var(--kind) 22%, transparent); color: var(--fg); border: 1px solid color-mix(in srgb, var(--kind) 55%, transparent); }
html[data-effect="soft"] #prompt { background: color-mix(in srgb, var(--fg) 7%, transparent); border-color: color-mix(in srgb, var(--fg) 14%, transparent); border-radius: 14px; }
html[data-effect="soft"] .examples button { border-color: color-mix(in srgb, var(--fg) 18%, transparent); border-radius: 10px; }
html[data-effect="soft"] .segbar { height: 10px; border-radius: 5px; }
html[data-effect="soft"] .segbar .seg { border-radius: 3px; }
html[data-effect="soft"] .totalfill { background: var(--kind); }
html[data-effect="soft"] .time.last { animation: softpulse 1s ease-out infinite; }
@keyframes softpulse { 0% { transform: scale(1.04); } 100% { transform: scale(1); } }
html[data-effect="soft"] .total { color: var(--accent); }

/* ── a gym's mark, bottom-right, under everything (gym.js) ─────── */
.gym-mark { position: fixed; right: max(12px, var(--sar, 0px)); bottom: calc(var(--sab) + 12px); z-index: 5; opacity: .55; text-decoration: none; color: var(--fg); pointer-events: auto; transition: opacity .3s; }
.gym-mark:hover { opacity: .9; }
.gym-mark-img { height: 28px; max-width: 120px; object-fit: contain; display: block; background: var(--logo-backing, transparent); border-radius: 6px; padding: 2px; }
.gym-mark-name { font-family: var(--brand-font, var(--font)); font-weight: 800; font-size: .85rem; letter-spacing: .02em; }
body[data-panel] .gym-mark { display: none; }
html[data-gym] .dock-row { padding-right: 128px; }
html[data-gym] .panel .panel-brand img.backed { background: var(--logo-backing, transparent); padding: 3px; }
html[data-gym] .panel-link { display: inline-block; margin-top: 8px; font-weight: 700; color: inherit; }

/* ── backgrounds (phase 7): setup and Done only — never while running ── */
#app::before, #app::after { content: ""; position: absolute; inset: 0; pointer-events: none; z-index: -1; opacity: 0; transition: opacity .6s; }
html[data-season] body[data-mode="setup"] #app::before, html[data-season] body[data-done] #app::before {
  opacity: 1; background: radial-gradient(120% 80% at 50% -10%, color-mix(in srgb, var(--season-glow) 34%, transparent), transparent 60%), var(--season-tint);
}
html[data-season][data-holiday] body[data-mode="setup"] #app::before, html[data-season][data-holiday] body[data-done] #app::before {
  background: radial-gradient(90% 60% at 15% 0%, color-mix(in srgb, var(--holiday-a) 38%, transparent), transparent 60%),
              radial-gradient(90% 60% at 85% 0%, color-mix(in srgb, var(--holiday-b) 30%, transparent), transparent 60%), var(--season-tint);
}
html[data-bgimg] body[data-mode="setup"] #app::before, html[data-bgimg] body[data-done] #app::before {
  opacity: 1; background: var(--bg-image) center / cover no-repeat;
}
html[data-bgimg] body[data-mode="setup"] #app::after, html[data-bgimg] body[data-done] #app::after {
  opacity: 1; background: linear-gradient(rgba(0,0,0,calc(var(--scrim) * .85)), rgba(0,0,0,var(--scrim)) 40%, rgba(0,0,0,var(--scrim)));
}
/* Place mode: the seasonal palette is a tint over the photo */
html[data-bgimg][data-season] body[data-mode="setup"] #app::after, html[data-bgimg][data-season] body[data-done] #app::after {
  background: linear-gradient(color-mix(in srgb, var(--season-glow) 22%, rgba(0,0,0,calc(var(--scrim) * .85))), rgba(0,0,0,var(--scrim)) 45%, color-mix(in srgb, var(--season-tint) 30%, rgba(0,0,0,var(--scrim))));
}
body[data-mode="setup"] #app, body[data-done] #app, html[data-bgimg] body[data-mode="run"] #app { isolation: isolate; }
/* ── round 2, phase D: the image stays on the running screen, behind a phase-tinted scrim solved for ≥ 4.5:1;
      the phase colour moves from the flood to the track, the button and a 6 px edge glow ── */
html[data-bgimg] body[data-mode="run"]:not([data-done]) #app::before { opacity: 1; background: var(--bg-image) center / cover no-repeat; }
html[data-bgimg] body[data-mode="run"]:not([data-done]) #app::after {
  opacity: 1;
  background: linear-gradient(color-mix(in srgb, var(--kind) calc(var(--tint-run, .15) * 100%), transparent), color-mix(in srgb, var(--kind) calc(var(--tint-run, .15) * 100%), transparent)), rgba(0,0,0,var(--scrim-run, .8));
}
html[data-bgimg][data-effect="flood"] body[data-mode="run"] { background: #000; }
html[data-bgimg] body[data-mode="run"] #app { box-shadow: inset 0 0 0 6px var(--kind); border-radius: 0; }
html[data-bgimg] body[data-mode="run"] .big { background: var(--kind); color: #000; }
html[data-bgimg] body[data-mode="run"] .totalfill { background: var(--kind); }
html[data-bgimg] body[data-mode="run"] .time { text-shadow: 0 1px 1px rgba(0,0,0,.9); }
html[data-bgimg] body[data-mode="run"] .label, html[data-bgimg] body[data-mode="run"] .meta-row, html[data-bgimg] body[data-mode="run"] .next { text-shadow: 0 1px 1px rgba(0,0,0,.8); color: #fff; }
/* the credit line (Place mode) and the clock overlay */
/* the photo credit: a tiny ⓘ bottom-right that opens the line (fix 3); the full line lives in the settings sheet */
.photo-info { position: fixed; right: max(10px, var(--sar, 0px)); bottom: calc(var(--sab) + 4px); z-index: 6; background: transparent; border: 0; color: rgba(255,255,255,.7); font: inherit; padding: 6px; display: flex; align-items: center; gap: 6px; max-width: 80vw; text-shadow: 0 1px 1px rgba(0,0,0,.8); }
.photo-info-i { font-size: .95rem; opacity: .75; } .photo-info-line { font-size: .68rem; background: rgba(0,0,0,.55); padding: 4px 8px; border-radius: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body[data-mode="run"] .photo-info, body[data-panel] .photo-info { display: none; }
html[data-gym] .photo-info { bottom: calc(var(--sab) + 48px); }
/* the bottom row of links (examples, share, contact) keeps its own scrim over any photo, so it never fights the image */
html[data-bgimg] body[data-mode="setup"] .examples { background: rgba(0,0,0,.45); border-radius: 12px; padding: 6px 8px; margin-left: -8px; margin-right: -8px; backdrop-filter: blur(6px); }
html[data-bgimg] body[data-mode="setup"] .dock-row { background: rgba(0,0,0,.45); border-radius: 12px; padding: 6px 8px; backdrop-filter: blur(6px); }
/* the date/time line (fix 6): its own line, large above the input on setup, half-size at the top of the stage while running */
.clock-line { display: flex; justify-content: space-between; align-items: baseline; font-family: var(--digits); font-variant-numeric: tabular-nums; font-size: 1.8rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; margin: 0 2px 10px; opacity: .85; }
.clock-line[data-show="date"] { justify-content: flex-start; } .clock-line[data-show="time"] { justify-content: flex-end; }
#stage > .clock-line { font-size: .9rem; font-weight: 700; margin: 0 0 6px; opacity: .7; }
html[data-bgimg] #stage > .clock-line { text-shadow: 0 1px 1px rgba(0,0,0,.8); color: #fff; }
html[data-digits="mono"] .clock-line { font-weight: 500; letter-spacing: 0; }
body[data-panel] .clock-line { display: none; }
@media (max-height: 559px) { body[data-mode="run"]:not([data-done]) #stage > .clock-line { display: none; } }
.bg-clock { margin: 8px 0; font-size: .9rem; display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.bg-modes .tog.off { color: var(--dim); }
.bg-country { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.bg-country .dim { width: 100%; margin: 0; }

.holiday-tag { display: inline-flex; align-items: center; gap: 6px; margin: 10px 0 0; font-size: .82rem; color: var(--dim); }
.holiday-tag i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.holiday-tag i + i { margin-left: -3px; }
.bg-settings { margin-top: 14px; }
.bg-modes { display: flex; gap: 14px; flex-wrap: wrap; margin: 6px 0; font-size: .9rem; }
.bg-country { margin: 6px 0; font-size: .9rem; } .bg-country select { max-width: 220px; background: var(--panel); color: var(--fg); border: 1px solid var(--hair); border-radius: 8px; padding: 4px 8px; }
.bg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; margin-top: 6px; }
.bg-thumb { position: relative; aspect-ratio: 4 / 3; border-radius: 10px; border: 2px solid var(--hair); background: var(--panel) center / cover; color: var(--fg); font-size: .75rem; cursor: pointer; display: flex; align-items: center; justify-content: center; text-align: center; padding: 4px; }
.bg-thumb.on { border-color: var(--accent); } .bg-thumb.add { border-style: dashed; }
.bg-thumb i { position: absolute; top: 2px; right: 4px; font-style: normal; font-size: .8rem; background: rgba(0,0,0,.55); color: #fff; border-radius: 50%; width: 18px; height: 18px; line-height: 18px; }
.dim { color: var(--dim); font-size: .85rem; }

/* ── one screen model (screen.js) ───────────────────────────────── */
/* the ⤢ control: always there on setup; while running only after activity, fading after 3 s */
body[data-mode="run"] #fsBtn.fsb { opacity: 0; pointer-events: none; transition: opacity .4s; }
body[data-mode="run"].awake #fsBtn.fsb { opacity: .55; pointer-events: auto; }
#fsBtnSetup.fsb { margin-right: 0; min-width: 0; min-height: 0; }
.fsb { min-width: 44px; min-height: 44px; }
/* a television: bigger digits, no hover states */
html[data-screen="tv"] .time { font-size: clamp(6rem, 30vh, 18rem); }
html[data-screen="tv"] .label { font-size: clamp(1.6rem, 5vh, 3.2rem); }
html[data-screen="tv"] .exit:hover { background: transparent; opacity: .55; }
html[data-screen="desktop"] .time { font-size: clamp(5rem, 26vh, 14rem); }
.share-btn { display: inline-flex; align-items: center; gap: 6px; }
/* the account sheet: who, the tier as a label, one row per Pro feature */
.tier-label { display: inline-block; font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); border: 1px solid var(--hair); border-radius: 999px; padding: 3px 9px; margin: -4px 0 10px; }
.pro-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--hair); min-height: 44px; }
.pro-row a { text-decoration: none; font-weight: 600; } .pro-row.off { color: var(--dim); }
.pro-state { font-size: .85rem; color: var(--dim); display: inline-flex; align-items: center; gap: 6px; }
.pro-state .tag { font-style: normal; font-size: .7rem; letter-spacing: .06em; text-transform: uppercase; border: 1px solid var(--hair); border-radius: 999px; padding: 1px 7px; }
.pro-row:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--accent); border-radius: 8px; }
/* recents under the input; the plan tools row */
.prompt-wrap { position: relative; }
.recents { background: var(--panel); border: 1px solid var(--hair); border-radius: 14px; margin: 8px 0 4px; overflow: hidden; }   /* in the flow: pushes the plan bar down, never over it */
.recent-head { font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); padding: 8px 14px 2px; }
.recent.more .q { color: var(--accent); }
.recent { display: flex; justify-content: space-between; gap: 10px; padding: 10px 14px; cursor: pointer; font-size: .92rem; min-height: 44px; align-items: center; }
.recent + .recent { border-top: 1px solid var(--hair); }
.recent.on, .recent:hover { background: color-mix(in srgb, var(--fg) 8%, transparent); }
.recent .q { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent .t { color: var(--dim); font-size: .8rem; font-variant-numeric: tabular-nums; flex: none; }
.plan-tools { display: flex; gap: 14px; align-items: center; margin: 0 2px 6px; font-size: .85rem; }
.plan-tools .link { margin: 0; } .plan-tools .flip-hint { color: var(--dim); font-weight: 400; }
.plan-tools .muted-inline { color: var(--dim); }
/* the header mark: the text-free mark; on Done the full logo gets room */
#brandMark { transition: width .3s, height .3s; }
body[data-done] #brandMark.full { width: 56px; height: 56px; }

/* the "send this example" link sits inline in the summary line (finding 9) */
.example-link { margin-left: 0; font: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
