@font-face { font-family: "Inter"; src: url(../fonts/inter-var.woff2) format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Cormorant Garamond"; src: url(../fonts/cormorant-500.woff2) format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Cormorant Garamond"; src: url(../fonts/cormorant-600.woff2) format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Marcellus"; src: url(../fonts/marcellus-400.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Jost"; src: url(../fonts/jost-300.woff2) format("woff2"); font-weight: 300; font-display: swap; }
@font-face { font-family: "Jost"; src: url(../fonts/jost-400.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Jost"; src: url(../fonts/jost-500.woff2) format("woff2"); font-weight: 500; font-display: swap; }
/* Cadence — flat surfaces, hairlines, typography doing the work. 8pt grid. */
:root, [data-theme="dark"] {
  --bg: #090a0c;
  --surface: #101114;
  --surface-2: #16171b;
  --surface-3: #1d1f24;
  --line: rgba(247, 247, 245, 0.08);
  --line-2: rgba(247, 247, 245, 0.14);
  --text: #f7f7f5;
  --text-2: rgba(247, 247, 245, 0.6);
  --text-3: rgba(247, 247, 245, 0.35);
  --accent: #e8664a;
  --accent-ink: #090a0c;
  --danger: #e5484d;
  --ok: #5bb98c;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --surface-2: #efefec;
  --surface-3: #e6e6e2;
  --line: rgba(9, 10, 12, 0.08);
  --line-2: rgba(9, 10, 12, 0.16);
  --text: #090a0c;
  --text-2: rgba(9, 10, 12, 0.6);
  --text-3: rgba(9, 10, 12, 0.38);
  --accent: #d4502f;
  --accent-ink: #ffffff;
  --shadow: 0 8px 24px rgba(9, 10, 12, 0.12);
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: var(--body-size)/1.55 var(--font-body);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  user-select: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
input[type="text"], input[type="number"], select, textarea {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 6px 10px;
  outline: none;
  user-select: text;
}
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: var(--r); border: 3px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }
.num { font-variant-numeric: tabular-nums; }
svg { display: block; }

/* ---------- top bar ---------- */
.bar {
  height: 48px;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 152px 0 16px;   /* right side is reserved for the native window buttons */
  -webkit-app-region: drag;
  border-bottom: 1px solid var(--line);
}
.bar button, .bar input { -webkit-app-region: no-drag; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 600; letter-spacing: 0.01em; }
.mark { width: 22px; height: 22px; color: var(--text); }
.tabs { display: flex; gap: 4px; }
.tabs button {
  background: none; border: 0; padding: 6px 12px; border-radius: var(--r); color: var(--text-2);
  transition: color 160ms, background-color 160ms;
}
.tabs button:hover { color: var(--text); background: var(--surface-2); }
.tabs button.on { color: var(--text); background: var(--surface-3); }
.bar-right { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.lib-status { color: var(--text-3); font-size: 12px; }

/* ---------- buttons & controls ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 32px; padding: 0 14px;
  border-radius: var(--r); border: 1px solid var(--line-2);
  background: var(--surface-2); color: var(--text);
  transition: background-color 140ms, border-color 140ms, transform 140ms cubic-bezier(.2,.8,.2,1);
  white-space: nowrap;
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: scale(0.97); }
.btn svg { width: 14px; height: 14px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: none; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { color: var(--text); background: var(--surface-2); }
.btn.danger { color: var(--danger); }
.btn.small { height: 28px; padding: 0 10px; font-size: 13px; }
.btn.big { height: 44px; padding: 0 22px; font-size: 15px; }
.btn:disabled { opacity: 0.4; pointer-events: none; }
.icon-btn {
  width: 32px; height: 32px; display: inline-grid; place-items: center;
  border: 0; border-radius: var(--r); background: none; color: var(--text-2);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg { width: 16px; height: 16px; }

.toggle { position: relative; width: 36px; height: 20px; flex: none; }
.toggle input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.toggle span { position: absolute; inset: 0; border-radius: 10px; background: var(--surface-3); border: 1px solid var(--line-2); transition: background-color 160ms; pointer-events: none; }
.toggle span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--text-2); transition: transform 200ms cubic-bezier(.2,.8,.2,1), background-color 160ms; }
.toggle input:checked + span { background: var(--accent); border-color: var(--accent); }
.toggle input:checked + span::after { transform: translateX(16px); background: var(--accent-ink); }

.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r); padding: 2px; gap: 2px; }
.seg button { border: 0; background: none; padding: 4px 12px; border-radius: var(--r-sm); color: var(--text-2); font-size: 13px; }
.seg button.on { background: var(--surface-3); color: var(--text); box-shadow: 0 0 0 1px var(--line-2); }

input[type="range"] { -webkit-appearance: none; appearance: none; background: none; height: 20px; width: 100%; margin: 0; cursor: pointer; }
input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: linear-gradient(to right, var(--accent) var(--fill, 50%), var(--surface-3) var(--fill, 50%)); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--text); margin-top: -6px; border: 0; }

/* ---------- views ---------- */
#views { position: absolute; top: 48px; left: 0; right: 0; bottom: 0; }
.view { position: absolute; inset: 0; overflow: auto; display: none; }
.view.on { display: block; animation: rise 220ms cubic-bezier(.2,.8,.2,1); }
@keyframes rise { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.page { max-width: 1040px; margin: 0 auto; padding: 32px 32px 64px; }
.page h1 { font-size: 24px; font-weight: 600; margin: 0 0 4px; letter-spacing: -0.01em; }
.page .lede { color: var(--text-2); margin: 0 0 24px; }
.head-row { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 24px; }
.head-row > div:first-child { flex: 1; }
.head-row .lede { margin: 0; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.section { margin-bottom: 24px; }
.section > h2 { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-3); margin: 0 0 8px; }
.rows > .row + .row { border-top: 1px solid var(--line); }
.row { display: flex; align-items: center; gap: 16px; padding: 12px 16px; min-height: 56px; }
.row .label { flex: 1; min-width: 0; }
.row .label b { display: block; font-weight: 500; }
.row .label small { display: block; color: var(--text-2); font-size: 12.5px; }
.row .ctl { display: flex; align-items: center; gap: 12px; }
.row .ctl.wide { width: 260px; }
.val { min-width: 64px; text-align: right; color: var(--text-2); font-variant-numeric: tabular-nums; font-size: 13px; }
.empty { color: var(--text-2); padding: 32px; text-align: center; }
.hint { color: var(--text-3); font-size: 12.5px; }

/* ---------- play ---------- */
.play { display: grid; grid-template-columns: 248px 1fr; height: 100%; }
.presets { border-right: 1px solid var(--line); padding: 24px 12px; overflow: auto; display: flex; flex-direction: column; gap: 4px; }
.presets h2 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-3); margin: 0 8px 8px; font-weight: 600; }
.preset-item { text-align: left; border: 0; background: none; border-radius: var(--r); padding: 8px 12px; color: var(--text-2); }
.preset-item b { display: block; color: var(--text); font-weight: 500; }
.preset-item small { font-size: 12px; color: var(--text-3); }
.preset-item:hover { background: var(--surface-2); }
.preset-item.on { background: var(--surface-3); }
.preset-tools { display: flex; gap: 4px; margin-top: 8px; padding: 8px 4px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.editor { overflow: auto; }
.editor .page { padding-top: 24px; }
.name-input { font-size: 24px !important; font-weight: 600; background: none !important; border-color: transparent !important; padding: 2px 6px !important; margin-left: -7px; width: 100%; letter-spacing: -0.01em; }
.name-input:hover { border-color: var(--line) !important; }
.summary { color: var(--text-2); margin: 0 0 24px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 1100px) { .grid2 { grid-template-columns: 1fr; } }
.weights .row { min-height: 48px; padding: 8px 16px; }
.weight-ctl { display: flex; gap: 2px; }
.weight-ctl button { width: 56px; height: 26px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text-3); font-size: 12px; }
.weight-ctl button:first-child { border-radius: var(--r-sm) 0 0 6px; }
.weight-ctl button:last-child { border-radius: 0 6px 6px 0; }
.weight-ctl button.on { background: var(--surface-3); color: var(--text); border-color: var(--line-2); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px 16px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 10px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); font-size: 13px; }
.chip button { border: 0; background: none; color: var(--text-3); padding: 0 2px; line-height: 1; font-size: 15px; }
.chip button:hover { color: var(--text); }
.chip.pick { cursor: pointer; color: var(--text-2); padding: 4px 10px; }
.chip.pick.on { background: var(--surface-3); color: var(--text); border-color: var(--line-2); }
.add-line { display: flex; gap: 8px; padding: 0 16px 12px; }
.add-line input { flex: 1; }
.pct { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); }
.pct div { padding: 12px 16px; }
.pct div + div { border-left: 1px solid var(--line); }
.pct b { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; display: block; }
.pct small { color: var(--text-2); }
.start-row { display: flex; align-items: center; gap: 16px; margin-top: 8px; }

/* script builder */
.steps { padding: 4px 0; }
.step { display: grid; grid-template-columns: 24px 132px 1fr auto; align-items: center; gap: 12px; padding: 8px 12px 8px 8px; border-top: 1px solid var(--line); }
.step:first-child { border-top: 0; }
.step.dragging { opacity: 0.4; }
.step.over { box-shadow: inset 0 2px 0 var(--accent); }
.step .grip { color: var(--text-3); cursor: grab; display: grid; place-items: center; height: 28px; }
.step .grip svg { width: 12px; height: 12px; }
.step select { width: 100%; }
.step .fields { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.step .fields label { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); font-size: 12.5px; }
.step .fields input[type="number"] { width: 72px; padding: 4px 8px; }
.step .fields input[type="text"] { width: 200px; padding: 4px 8px; }
.step .fields select { width: auto; padding: 4px 8px; }
.step-tools { display: flex; gap: 0; }
.step-add { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px; border-top: 1px solid var(--line); }

/* ---------- library ---------- */
.folder { display: flex; align-items: center; gap: 16px; padding: 12px 16px; }
.folder + .folder { border-top: 1px solid var(--line); }
.folder .label { flex: 1; min-width: 0; }
.folder .label b { display: block; font-weight: 500; }
.folder .label small { display: block; color: var(--text-2); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder .missing { color: var(--danger); }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 8px; }
.thumb { position: relative; aspect-ratio: 1; border-radius: var(--r); overflow: hidden; background: var(--surface-2); }
.thumb img, .thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .star { position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; border-radius: var(--r-sm); border: 0; background: rgba(9, 10, 12, 0.6); color: #f7f7f5; display: grid; place-items: center; opacity: 0; transition: opacity 140ms; }
.thumb:hover .star, .thumb .star.on { opacity: 1; }
.thumb .star.on { color: var(--accent); }
.thumb .star svg { width: 14px; height: 14px; }
.thumb .kind { position: absolute; left: 6px; bottom: 6px; font-size: 11px; padding: 1px 6px; border-radius: 4px; background: rgba(9, 10, 12, 0.6); color: #f7f7f5; }
.totals { display: flex; gap: 32px; padding: 16px; border-bottom: 1px solid var(--line); }
.totals b { font-size: 20px; font-weight: 600; display: block; font-variant-numeric: tabular-nums; }
.totals small { color: var(--text-2); }

/* ---------- history ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); }
.stats div { padding: 16px; }
.stats div + div { border-left: 1px solid var(--line); }
.stats b { font-size: 24px; font-weight: 600; display: block; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.stats small { color: var(--text-2); }
.hist { display: grid; grid-template-columns: 1.3fr 1fr 72px 72px 200px 32px; gap: 16px; align-items: center; padding: 10px 16px; border-top: 1px solid var(--line); }
.hist.head { color: var(--text-3); font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; border-top: 0; }
.outcome { display: inline-flex; align-items: center; gap: 6px; }
.outcome::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--text-3); }
.outcome.finished::before { background: var(--ok); }
.outcome.denied::before, .outcome.ruined::before { background: var(--accent); }

/* ---------- toasts & drop ---------- */
#toasts { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 50; align-items: center; }
.toast { display: flex; align-items: center; gap: 16px; padding: 8px 8px 8px 16px; background: var(--surface-3); border: 1px solid var(--line-2); border-radius: var(--r); box-shadow: var(--shadow); animation: rise 200ms cubic-bezier(.2,.8,.2,1); min-height: 44px; }
.toast .btn { height: 28px; }
#drop { position: fixed; inset: 48px 0 0; background: rgba(9, 10, 12, 0.85); display: grid; place-items: center; z-index: 40; }
#drop div { border: 1px dashed var(--line-2); border-radius: var(--r-lg); padding: 48px 64px; color: #f7f7f5; font-size: 16px; }

/* ---------- game ---------- */
#game { position: fixed; inset: 0; background: #000; color: #f7f7f5; z-index: 30; overflow: hidden; --hud: #f7f7f5; }
#game.hide-cursor { cursor: none; }
.stage { position: absolute; inset: 0; }
.stage { transition: opacity 2.5s ease; }
.stage.resting { opacity: 0.35; }
.stage .layer { position: absolute; inset: 0; opacity: 0; transition: opacity var(--fade, 320ms) ease; overflow: hidden; }
.stage .layer.on { opacity: 1; }
/* the whole picture, as large as fits the screen; zoom and pan are a transform on top of that */
.stage img, .stage video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; transform-origin: 50% 50%; will-change: transform; }
.stage img.ease, .stage video.ease { transition: transform 220ms cubic-bezier(.2,.8,.2,1); }
.stage.zoomed { cursor: grab; }
.stage.zoomed.panning { cursor: grabbing; }
.zoom-tag { position: absolute; left: 50%; top: 24px; transform: translateX(-50%); padding: 4px 12px; font-size: 13px; font-variant-numeric: tabular-nums; color: #f7f7f5; cursor: pointer; transition: opacity 240ms; }
.zoom-tag small { color: rgba(247,247,245,0.6); margin-left: 8px; }
/* low on the screen, so the breathing ring in the middle never sits on top of it */
.no-media { position: absolute; left: 0; right: 0; bottom: 18%; display: grid; place-items: center; color: rgba(247,247,245,0.35); pointer-events: none; }

.hud { position: absolute; inset: 0; pointer-events: none; }
.hud > * { pointer-events: auto; }
/* flat translucent plates keep text readable over any picture */
.plate { background: rgba(9,10,12,0.62); border: 1px solid rgba(247,247,245,0.08); border-radius: var(--r-lg); }
.session-progress { position: absolute; top: 0; left: 0; right: 0; height: 2px; background: rgba(247,247,245,0.1); }
.session-progress i { display: block; height: 100%; background: rgba(247,247,245,0.7); width: 0; }
.task { position: absolute; top: 24px; left: 24px; max-width: min(640px, 60%); padding: 16px 20px; }
.task .t-title { font-size: 40px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; }
.task .t-sub { font-size: 16px; color: rgba(247,247,245,0.75); margin-top: 6px; }
.task .t-cue { display: inline-block; margin-top: 12px; font-size: 14px; padding: 4px 12px; border-radius: var(--r-lg); background: rgba(9,10,12,0.55); border: 1px solid rgba(247,247,245,0.18); }
.task .t-say { font-size: 15px; margin-top: 12px; color: rgba(247,247,245,0.9); font-style: italic; }
.task .t-bar { margin-top: 16px; width: 240px; height: 2px; background: rgba(247,247,245,0.15); }
.task .t-bar i { display: block; height: 100%; background: #f7f7f5; width: 0; }
.task.swap { animation: swap 360ms cubic-bezier(.2,.8,.2,1); }
@keyframes swap { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.task.attn .t-title { color: var(--accent); }
.meta { position: absolute; top: 8px; right: 152px; display: flex; gap: 24px; text-align: right; padding: 8px 16px; }
#game.fs .meta { right: 24px; top: 24px; }
.meta div b { display: block; font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.meta div small { color: rgba(247,247,245,0.6); font-size: 12px; }
.folder-tag { position: absolute; top: 72px; right: 152px; padding: 2px 10px; font-size: 12px; color: rgba(247,247,245,0.6); }
#game.fs .folder-tag { right: 32px; }

.beat { position: absolute; left: 50%; bottom: 88px; padding: 12px 24px 10px; transform: translateX(-50%); width: min(520px, 70%); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.beat .track { position: relative; width: 100%; height: 24px; }
.beat .track::before { content: ""; position: absolute; left: 0; right: 0; top: 11px; height: 2px; background: rgba(247,247,245,0.18); }
.beat .end { position: absolute; top: 4px; width: 2px; height: 16px; background: rgba(247,247,245,0.35); }
.beat .end.l { left: 0; } .beat .end.r { right: 0; }
.beat .dot { position: absolute; top: 4px; left: 0; width: 16px; height: 16px; margin-left: -8px; border-radius: 50%; background: #f7f7f5; }
.beat .dot.rest { background: transparent; box-shadow: inset 0 0 0 2px rgba(247,247,245,0.5); }
.beat .flash-l, .beat .flash-r { position: absolute; top: 0; width: 24px; height: 24px; margin-left: -12px; border-radius: 50%; border: 3px solid #e5262f; opacity: 0; }
.beat .flash-l { left: 0; } .beat .flash-r { left: 100%; }
.beat .flash-l.go, .beat .flash-r.go { animation: hit 260ms ease-out; }
@keyframes hit { from { opacity: 1; transform: scale(0.6); } to { opacity: 0; transform: scale(1.5); } }
.beat .bpm { font-size: 13px; color: rgba(247,247,245,0.7); font-variant-numeric: tabular-nums; display: flex; gap: 12px; align-items: center; }
.beat .bpm b { color: #f7f7f5; font-size: 15px; }
.beat .tempo { color: var(--accent); }
.beat.idle .dot { opacity: 0.25; }

.controls { position: absolute; left: 0; right: 0; bottom: 24px; display: flex; justify-content: center; gap: 8px; transition: opacity 240ms; }
.controls .btn { background: rgba(22,23,27,0.8); border-color: rgba(247,247,245,0.14); color: #f7f7f5; }
.controls .btn:hover { background: rgba(29,31,36,0.95); }
.controls .btn.primary { background: var(--accent); border-color: var(--accent); color: #090a0c; }
.controls kbd, .keys kbd { font: 11px/1 "Segoe UI", system-ui; padding: 3px 5px; border-radius: 4px; border: 1px solid rgba(247,247,245,0.25); color: rgba(247,247,245,0.7); }
.controls .btn.primary kbd { border-color: rgba(9,10,12,0.4); color: rgba(9,10,12,0.75); }
.corner { position: absolute; right: 24px; bottom: 24px; display: flex; gap: 4px; transition: opacity 240ms; }
.corner .icon-btn { color: rgba(247,247,245,0.7); background: rgba(22,23,27,0.6); }
.corner .icon-btn:hover { color: #f7f7f5; background: rgba(29,31,36,0.95); }
.corner .icon-btn.on { color: var(--accent); }
.keys { position: absolute; left: 32px; bottom: 28px; font-size: 12px; color: rgba(247,247,245,0.55); display: flex; gap: 12px; transition: opacity 240ms; }
#game.idle .controls, #game.idle .corner, #game.idle .keys { opacity: 0; }
#game.idle .controls .btn.primary { opacity: 1; }
#game.hud-off .task, #game.hud-off .meta, #game.hud-off .folder-tag, #game.hud-off .keys { display: none; }

.overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.72); display: grid; place-items: center; z-index: 5; animation: fade 200ms ease; }
@keyframes fade { from { opacity: 0; } }
.panel { width: min(440px, 90%); background: #101114; border: 1px solid rgba(247,247,245,0.12); border-radius: var(--r-lg); padding: 32px; text-align: center; }
.panel h2 { margin: 0 0 4px; font-size: 32px; font-weight: 600; letter-spacing: -0.02em; }
.panel p { color: rgba(247,247,245,0.65); margin: 0 0 24px; }
.panel .stats-mini { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid rgba(247,247,245,0.1); border-radius: var(--r); margin-bottom: 24px; }
.panel .stats-mini div { padding: 12px; }
.panel .stats-mini div + div { border-left: 1px solid rgba(247,247,245,0.1); }
.panel .stats-mini b { display: block; font-size: 20px; font-variant-numeric: tabular-nums; }
.panel .stats-mini small { color: rgba(247,247,245,0.55); font-size: 12px; }
.panel .actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.panel .btn { background: #1d1f24; border-color: rgba(247,247,245,0.14); color: #f7f7f5; }
.panel .btn.primary { background: var(--accent); border-color: var(--accent); color: #090a0c; }
.panel .vol { display: flex; align-items: center; gap: 12px; margin: 0 0 24px; color: rgba(247,247,245,0.65); font-size: 13px; text-align: left; }
.panel .vol input { flex: 1; }
.folder > span svg { width: 16px; height: 16px; }
.row.stage-row .stage-n { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; color: var(--text-3); border: 1px solid var(--line-2); flex: none; }
.row.stage-row.on .stage-n { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.row.stage-row.on .label b { color: var(--text); }

/* comfort / status note, blackout, key sheet, end-of-session question */
.note { position: absolute; left: 24px; top: 200px; max-width: min(520px, 60%); padding: 10px 16px; font-size: 14px; color: #f7f7f5; animation: rise 220ms cubic-bezier(.2,.8,.2,1); }
.blackout { position: absolute; inset: 0; background: #000; z-index: 20; cursor: none; }
.panel.keysheet { width: min(560px, 92%); text-align: left; }
.panel.keysheet h2 { text-align: center; margin-bottom: 16px; }
.keylist { display: grid; gap: 6px; margin-bottom: 24px; font-size: 13px; color: rgba(247,247,245,0.75); }
.keylist div { display: grid; grid-template-columns: 140px 1fr; gap: 12px; align-items: baseline; }
.keylist kbd { justify-self: start; }
.ask { border: 1px solid rgba(247,247,245,0.1); border-radius: var(--r); padding: 16px; margin-bottom: 16px; }
.ask-q { font-weight: 600; margin-bottom: 12px; }
.ask-opts { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-bottom: 8px; }
.ask-opts .btn kbd { margin-right: 2px; }
.ask .hint, .panel .hint { color: rgba(247,247,245,0.5); font-size: 12.5px; margin-top: 4px; }
.end-notes p { color: rgba(247,247,245,0.65); font-size: 13px; margin: 0 0 12px; }
.linkish { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; cursor: pointer; font: inherit; }

/* folder sheet before a session */
.sheet-backdrop { position: fixed; inset: 48px 0 0; background: rgba(9,10,12,0.6); display: grid; place-items: center; z-index: 45; animation: fade 160ms ease; }
.sheet { width: min(480px, 92%); max-height: 80vh; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 20px; animation: rise 200ms cubic-bezier(.2,.8,.2,1); }
.sheet-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 12px; }
.sheet-head > div:first-child { flex: 1; }
.sheet-head h2 { margin: 0; font-size: 17px; font-weight: 600; }
.sheet-head .hint { margin: 2px 0 0; }
.sheet-quick { display: flex; gap: 6px; }
.sheet-list { overflow: auto; border: 1px solid var(--line); border-radius: var(--r); }
.sheet-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; cursor: pointer; }
.sheet-item + .sheet-item { border-top: 1px solid var(--line); }
.sheet-item:hover { background: var(--surface-2); }
.sheet-item input, .sheet-remember input { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; }
.sheet-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-item:not(.on) .sheet-name { color: var(--text-3); }
.sheet kbd { font: 11px/1 "Segoe UI", system-ui; padding: 3px 5px; border-radius: 4px; border: 1px solid var(--line-2); color: var(--text-3); }
.sheet .btn.primary kbd { border-color: rgba(9,10,12,0.35); color: inherit; opacity: 0.7; }
.sheet-remember { display: flex; align-items: center; gap: 8px; margin: 12px 0 0; color: var(--text-2); font-size: 13px; cursor: pointer; }
.sheet-foot { display: flex; align-items: center; gap: 8px; margin-top: 16px; }

.sheet-backdrop.add-device { inset: 0; }
.add-device .hint { margin: 8px 0 0; line-height: 1.45; }
.add-device .sheet-head { margin-bottom: 16px; }
.add-msg { color: var(--text); min-height: 20px; }

/* Hue colour swatches, resume banner */
input[type="color"].swatch { width: 36px; height: 28px; padding: 2px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--surface-2); cursor: pointer; flex: none; }
input[type="color"].swatch::-webkit-color-swatch-wrapper { padding: 0; }
input[type="color"].swatch::-webkit-color-swatch { border: 0; border-radius: 4px; }
.resume { display: flex; align-items: center; gap: 12px; padding: 12px 16px; margin: 0 0 24px; }
.resume .label { flex: 1; min-width: 0; }
.resume .label b { display: block; font-weight: 500; }
.resume .label small { color: var(--text-2); font-size: 12.5px; }

/* metronome bar upright at a screen edge: the dot runs top to bottom */
#game.beat-left .beat, #game.beat-right .beat { top: 50%; bottom: auto; transform: translateY(-50%); width: 64px; height: min(480px, 58vh); padding: 16px 0 12px; flex-direction: column; }
#game.beat-left .beat { left: 16px; }
#game.beat-right .beat { left: auto; right: 16px; }
#game.beat-left .beat .track, #game.beat-right .beat .track { width: 24px; flex: 1; height: auto; }
#game.beat-left .beat .track::before, #game.beat-right .beat .track::before { left: 11px; right: auto; top: 0; bottom: 0; width: 2px; height: auto; }
#game.beat-left .beat .end, #game.beat-right .beat .end { left: 4px; right: auto; width: 16px; height: 2px; top: auto; }
#game.beat-left .beat .end.l, #game.beat-right .beat .end.l { top: 0; }
#game.beat-left .beat .end.r, #game.beat-right .beat .end.r { bottom: 0; }
#game.beat-left .beat .dot, #game.beat-right .beat .dot { left: 4px; top: 100%; margin: -8px 0 0; }
#game.beat-left .beat .flash-l, #game.beat-right .beat .flash-l { left: 0; top: 100%; margin: -12px 0 0; }
#game.beat-left .beat .bpm, #game.beat-right .beat .bpm { flex-direction: column; gap: 2px; font-size: 11px; }
#game.beat-left .task, #game.beat-left .note, #game.beat-left .keys { left: 96px; }
#game.beat-right .corner { right: 96px; }


/* Trance mode */
#game.clean .meta, #game.clean .keys, #game.clean .session-progress, #game.clean .folder-tag, #game.clean .beat .bpm { display: none; }
#game.clean .beat.plate { background: none; border-color: transparent; }
#game.clean .t-bar { display: none; }
.task.faded { opacity: 0; transition: opacity 1500ms ease; pointer-events: none; }
.breath { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.breath i { grid-area: 1 / 1; width: min(38vh, 320px); aspect-ratio: 1; border-radius: 50%; border: 2px solid rgba(247,247,245,0.55); animation: breathe 10s ease-in-out infinite; }
.breath span { grid-area: 1 / 1; color: rgba(247,247,245,0.7); font-size: 15px; letter-spacing: 0.04em; }
@keyframes breathe { 0%, 100% { transform: scale(0.55); } 40% { transform: scale(1); } }

/* settings: a rail of categories, one pane at a time */
.settings-layout { display: grid; grid-template-columns: 248px 1fr; height: 100%; }
.settings-rail { border-right: 1px solid var(--line); padding: 24px 12px; overflow: auto; display: flex; flex-direction: column; gap: 4px; }
.settings-rail h1 { font-size: 20px; font-weight: 600; margin: 0 8px 12px; letter-spacing: -0.01em; }
.settings-pane { overflow: auto; }
.settings-pane .page { padding-top: 24px; }
.pane-title { font-size: 24px; font-weight: 600; margin: 0 0 20px; letter-spacing: -0.01em; }

/* your own sounds */
.sound-row .label b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sound-row.off .label b { color: var(--text-3); }
.sound-vol { width: 220px; flex: none; }
.sound-vol .ctl.wide { width: 100%; }
.pause-sounds { border: 1px solid rgba(247,247,245,0.1); border-radius: var(--r); margin-bottom: 24px; text-align: left; max-height: 180px; overflow: auto; }
.pause-sound { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 12px; font-size: 13px; color: rgba(247,247,245,0.85); }
.pause-sound + .pause-sound { border-top: 1px solid rgba(247,247,245,0.08); }
.pause-sound span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* the red impact */
#game .beat .flash-l { z-index: 2; }

/* blurred background behind pictures that don't fill the screen */
.stage img.blur-fill, .stage video.blur-fill { inset: 0; width: 100%; height: 100%; object-fit: cover; filter: blur(56px) brightness(0.82) saturate(1.15); transform: scale(1.2); will-change: auto; mask: none; }
.stage canvas.halo { position: absolute; filter: blur(38px) brightness(0.94) saturate(1.1); pointer-events: none; }
.stage.zoomed canvas.halo { opacity: 0; }
.stage.no-blur .blur-fill, .stage.no-blur canvas.halo { display: none; }

/* settings search */
.settings-search { margin: 0 4px 12px; padding: 8px 12px; width: calc(100% - 8px); }
.search-hit { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 12px 16px; }
.search-hit + .search-hit { border-top: 1px solid var(--line); }
.search-hit:hover { background: var(--surface-2); }
.search-hit b { display: block; font-weight: 500; }
.search-hit small { display: block; color: var(--text-2); font-size: 12.5px; }
.settings-pane .found { background: var(--surface-3); border-radius: var(--r); transition: background-color 600ms; }

/* themes: same structure, each with its own dark tint and accent */
[data-theme="velvet"] { --bg: #130c16; --surface: #1b1220; --surface-2: #231829; --surface-3: #2d1f34; --accent: #d0588a; --accent-ink: #130c16; }
[data-theme="ember"]  { --bg: #130e0a; --surface: #1b1510; --surface-2: #241c15; --surface-3: #2f251c; --accent: #e08c3c; --accent-ink: #130e0a; }
[data-theme="forest"] { --bg: #0a120f; --surface: #101a16; --surface-2: #16231e; --surface-3: #1d2d27; --accent: #62b48b; --accent-ink: #0a120f; }
[data-theme="ocean"]  { --bg: #0a1017; --surface: #101821; --surface-2: #16212c; --surface-3: #1d2b39; --accent: #5ba3dc; --accent-ink: #0a1017; }

/* ================ THEMES ================
   A theme is a material: its own typefaces, metal, corner shape and proportions. Flat surfaces and hairlines only;
   the metal shows in the edges and the small type, never in gradients or glows. */
:root, [data-theme] {
  --font-display: "Cormorant Garamond", Georgia, serif; --font-body: "Jost", "Segoe UI", sans-serif;
  --display-weight: 500; --display-scale: 1.4; --display-track: 0; --body-size: 14.5px;
  --label-track: 0.2em; --label-size: 10.5px; --btn-track: 0.14em; --btn-case: uppercase; --btn-size: 11.5px;
  --r-sm: 2px; --r: 2px; --r-lg: 3px; --metal-line: rgba(201, 169, 110, 0.22);
  color-scheme: dark;
}
[data-theme="aurum"] { --bg: #0b0a08; --surface: #12100d; --surface-2: #1a1712; --surface-3: #242018; --line: rgba(201,169,110,0.13); --line-2: rgba(201,169,110,0.3); --text: #f1eadc; --text-2: rgba(241,234,220,0.62); --text-3: rgba(241,234,220,0.38); --accent: #c9a96e; --accent-ink: #0b0a08; --metal-line: rgba(201,169,110,0.3); }
[data-theme="velvet"] { --bg: #170a0e; --surface: #1f0e13; --surface-2: #2a141a; --surface-3: #371b23; --line: rgba(217,167,143,0.13); --line-2: rgba(217,167,143,0.3); --text: #f4e6df; --text-2: rgba(244,230,223,0.62); --text-3: rgba(244,230,223,0.38); --accent: #d9a78f; --accent-ink: #170a0e; --metal-line: rgba(217,167,143,0.3); --r-sm: 10px; --r: 14px; --r-lg: 20px; }
[data-theme="ember"] { --font-display: "Marcellus", Georgia, serif; --display-weight: 400; --display-scale: 1.12; --bg: #14100b; --surface: #1c160f; --surface-2: #261e15; --surface-3: #32281c; --line: rgba(197,138,79,0.15); --line-2: rgba(197,138,79,0.32); --text: #f0e6d6; --text-2: rgba(240,230,214,0.62); --text-3: rgba(240,230,214,0.38); --accent: #c58a4f; --accent-ink: #14100b; --metal-line: rgba(197,138,79,0.32); --r-sm: 4px; --r: 6px; --r-lg: 8px; }
[data-theme="forest"] { --font-display: "Marcellus", Georgia, serif; --display-weight: 400; --display-scale: 1.12; --bg: #07120e; --surface: #0c1a15; --surface-2: #12241d; --surface-3: #193026; --line: rgba(200,178,115,0.13); --line-2: rgba(200,178,115,0.3); --text: #eee9d9; --text-2: rgba(238,233,217,0.62); --text-3: rgba(238,233,217,0.38); --accent: #c8b273; --accent-ink: #07120e; --metal-line: rgba(200,178,115,0.3); }
[data-theme="ocean"] { --font-display: "Jost", "Segoe UI", sans-serif; --display-weight: 300; --display-scale: 1.1; --display-track: 0.02em; --bg: #080d1a; --surface: #0e1524; --surface-2: #151e30; --surface-3: #1e293e; --line: rgba(207,214,228,0.11); --line-2: rgba(207,214,228,0.26); --text: #eef1f7; --text-2: rgba(238,241,247,0.62); --text-3: rgba(238,241,247,0.38); --accent: #cfd6e4; --accent-ink: #080d1a; --metal-line: rgba(207,214,228,0.24); --r-sm: 20px; --r: 8px; --r-lg: 12px; }
[data-theme="dark"] { --font-display: "Jost", "Segoe UI", sans-serif; --display-weight: 400; --display-scale: 1.05; --display-track: -0.01em; --label-track: 0.14em; --btn-case: none; --btn-track: 0.01em; --btn-size: 13.5px; --bg: #0c0d0f; --surface: #131417; --surface-2: #1a1c20; --surface-3: #24262b; --line: rgba(240,241,243,0.08); --line-2: rgba(240,241,243,0.18); --text: #f3f4f5; --text-2: rgba(243,244,245,0.6); --text-3: rgba(243,244,245,0.36); --accent: #e4e6ea; --accent-ink: #0c0d0f; --metal-line: rgba(240,241,243,0.16); --r-sm: 6px; --r: 8px; --r-lg: 12px; }
[data-theme="light"] { --bg: #f5f0e6; --surface: #fbf8f1; --surface-2: #efe9dc; --surface-3: #e6dfcf; --line: rgba(74,60,30,0.13); --line-2: rgba(74,60,30,0.28); --text: #1d1a14; --text-2: rgba(29,26,20,0.66); --text-3: rgba(29,26,20,0.44); --accent: #8d6f35; --accent-ink: #fbf8f1; --metal-line: rgba(141,111,53,0.34); --shadow: 0 8px 24px rgba(74,60,30,0.14); color-scheme: light; }

/* type */
.page h1, .pane-title, .settings-rail h1, .name-input, .brand span, .panel h2, .task .t-title, .sheet-head h2, .theme-name {
  font-family: var(--font-display); font-weight: var(--display-weight); letter-spacing: var(--display-track);
}
.page h1, .pane-title { font-size: calc(26px * var(--display-scale)); }
.settings-rail h1 { font-size: calc(21px * var(--display-scale)); }
.name-input { font-size: calc(26px * var(--display-scale)) !important; font-weight: var(--display-weight); }
.brand span { font-size: calc(15px * var(--display-scale)); letter-spacing: 0.04em; }
.task .t-title { font-size: calc(40px * var(--display-scale)); }
.panel h2 { font-size: calc(32px * var(--display-scale)); }
.sheet-head h2 { font-size: calc(19px * var(--display-scale)); }
.section > h2, .presets h2, .hist.head { font-size: var(--label-size); letter-spacing: var(--label-track); color: var(--accent); opacity: 0.85; font-weight: 500; }
.section > h2 { margin-bottom: 12px; }
.section { margin-bottom: 36px; }
.row .label b, .preset-item b, .folder .label b { font-weight: 400; }
.page { padding-top: 40px; }

/* edges */
.bar { border-bottom-color: var(--metal-line); }
.presets, .settings-rail { border-right-color: var(--line); }
.card { background: var(--surface); border-color: var(--line); }
.row { min-height: 64px; padding: 14px 20px; }
.weights .row { min-height: 52px; }

/* navigation: a thin line of metal instead of a filled pill */
.tabs button { border-radius: 0; font-size: 13px; letter-spacing: 0.03em; padding: 6px 4px; margin: 0 8px; }
.tabs button:hover { background: none; }
.tabs button.on { background: none; box-shadow: inset 0 -1px 0 var(--accent); color: var(--text); }
.preset-item { border-radius: var(--r-sm); padding: 10px 14px; }
.preset-item.on { background: var(--surface-2); box-shadow: inset 2px 0 0 var(--accent); }

/* controls */
.btn { font-size: var(--btn-size); letter-spacing: var(--btn-track); text-transform: var(--btn-case); border-color: var(--line-2); background: transparent; }
.btn:hover { background: var(--surface-2); }
.btn.primary { font-weight: 500; }
.btn.primary:hover { filter: none; background: var(--text); border-color: var(--text); color: var(--bg); }
.btn.big { height: 46px; padding: 0 28px; }
.seg { background: transparent; border-color: var(--line-2); }
.seg button.on { background: var(--surface-3); color: var(--accent); box-shadow: none; }
input[type="range"]::-webkit-slider-runnable-track { height: 2px; }
input[type="range"]::-webkit-slider-thumb { width: 14px; height: 14px; margin-top: -6px; background: var(--accent); }
input[type="text"], input[type="number"], input[type="search"], select, textarea { background: transparent; border-color: var(--line-2); }
.toggle span { background: transparent; border-color: var(--line-2); }
.toggle span::after { background: var(--text-3); }
.toggle input:checked + span { background: transparent; border-color: var(--accent); }
.toggle input:checked + span::after { background: var(--accent); }
.settings-search { background: transparent; }
.weight-ctl button.on { color: var(--accent); }

/* the session keeps black behind the pictures, in the theme's type and metal */
.plate { border-color: var(--metal-line); }
.panel { background: #0f0e0c; border-color: var(--metal-line); }
.panel .btn, .controls .btn { background: rgba(20,20,20,0.85); }
.panel .btn.primary, .controls .btn.primary { background: var(--accent); }

/* the gallery */
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.theme-card { display: flex; flex-direction: column; align-items: flex-start; text-align: left; min-height: 158px; padding: 20px; background: var(--bg); color: var(--text); border: 1px solid var(--line-2); border-radius: var(--r-lg); font-family: var(--font-body); transition: border-color 200ms, transform 240ms cubic-bezier(.2,.8,.2,1); }
.theme-card:hover { transform: translateY(-2px); border-color: var(--accent); }
.theme-card.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.theme-name { font-size: calc(23px * var(--display-scale)); line-height: 1.15; color: var(--text); }
.theme-desc { font-size: 13px; color: var(--text-2); margin-top: 6px; }
.theme-foot { display: flex; align-items: center; gap: 10px; width: 100%; margin-top: auto; padding-top: 18px; }
.theme-dot { width: 9px; height: 9px; background: var(--accent); border-radius: 50%; flex: none; }
.theme-line { flex: 1; height: 1px; background: var(--metal-line); }
.theme-pick { font-size: var(--label-size); letter-spacing: var(--label-track); text-transform: uppercase; color: var(--accent); }

/* quick settings: slides in at the side during a session, on the side away from an upright metronome bar */
.quick {
  --text: #f4f2ec; --text-2: rgba(244,242,236,0.66); --text-3: rgba(244,242,236,0.4); --surface-2: #1d1d1d; --surface-3: #2b2b2b; --line-2: rgba(244,242,236,0.22); --line: rgba(244,242,236,0.1);
  position: absolute; z-index: 6; top: 88px; bottom: 16px; right: 16px; width: 300px; overflow: auto; padding: 16px; color: var(--text);
  background: rgba(10,10,10,0.92); border: 1px solid var(--metal-line); border-radius: var(--r-lg); animation: rise 200ms cubic-bezier(.2,.8,.2,1);
}
#game.beat-right .quick { top: 16px; }
#game.beat-right .quick { right: auto; left: 16px; }
.q-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.q-head b { font-family: var(--font-display); font-weight: var(--display-weight); font-size: calc(17px * var(--display-scale)); }
.q-close { width: 28px; height: 28px; background: none; border: 1px solid var(--line-2); border-radius: var(--r-sm); color: var(--text-2); font-size: 16px; line-height: 1; }
.q-close:hover { color: var(--text); border-color: var(--accent); }
@media (max-width: 1250px) { .keys { display: none; } }
.q-group { border-top: 1px solid var(--line); padding: 12px 0 4px; }
.q-group h3 { margin: 0 0 8px; font-size: var(--label-size); letter-spacing: var(--label-track); text-transform: uppercase; color: var(--accent); font-weight: 500; }
.q-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 32px; font-size: 13px; }
.q-line > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-note { margin: 2px 0 0; font-size: 12px; opacity: 0.65; }
.q-stack { padding: 4px 0 8px; font-size: 13px; }
.q-stack > span { display: block; margin-bottom: 2px; color: var(--text-2); }
.quick .ctl.wide { width: 100%; display: flex; align-items: center; gap: 10px; }
.quick .val { min-width: 48px; font-size: 12px; }
.quick .seg { display: flex; }
.quick .seg button { flex: 1; }
.q-sound + .q-sound { margin-top: 6px; }

details.more { margin-top: 4px; }
details.more > summary { cursor: pointer; color: var(--text-2); font-weight: 500; padding: 8px 0 16px; list-style-position: inside; }
details.more > summary:hover { color: var(--text); }
.welcome { width: min(460px, 92%); padding: 28px; }
.welcome h2 { font-family: var(--font-display); font-weight: var(--display-weight); font-size: calc(22px * var(--display-scale)); margin: 0 0 12px; }
.welcome p, .welcome li { color: var(--text-2); }
.welcome p { margin: 0; }
.welcome ul { margin: 0; padding-left: 18px; display: grid; gap: 8px; }
.welcome-back { background: var(--bg); z-index: 60; }

/* ================ THEME LANGUAGES ================
   Each theme is its own house: typefaces, geometry, layout of the rows, the shape of every control, how things move,
   and the session screen. Still flat: edges, type and shape do the work, never gradients or glows.
   Shared rules read the variables below, so the gallery cards preview each theme by themselves. Rules that only make
   sense on the whole app are written against html[data-theme]. */
:root, [data-theme] {
  --font-body: "Inter", "Segoe UI", sans-serif; --num-font: inherit; --label-font: var(--font-body);
  --body-size: 14px; --display-case: none;
  --label-size: 13px; --label-track: 0; --label-case: none; --label-color: var(--text-2); --label-weight: 600;
  --btn-track: 0; --btn-case: none; --btn-size: 13.5px; --btn-r: var(--r); --btn-h: 32px;
  --edge-w: 1px; --edge-style: solid;
  --knob-r: 50%; --knob-clip: none; --track-r: 10px; --thumb: 14px; --rail: 2px;
  --dot-w: 16px; --dot-h: 16px; --dot-r: 50%; --dot-clip: none; --row-h: 52px; --row-x: 18px; --section-gap: 28px;
  --panel: var(--surface); --breath-r: 50%; --breath-style: solid;
}

/* AURUM: a private bank. Large old-style serif, gold hairlines, nothing filled, diamonds for marks. */
[data-theme="aurum"] {
  --font-display: "Cormorant Garamond", Georgia, serif; --display-weight: 500; --display-scale: 1.38; --display-track: 0;
  --label-font: "Cormorant Garamond", Georgia, serif; --label-size: 18px; --label-color: var(--accent); --label-weight: 500;
  --r-sm: 0; --r: 0; --r-lg: 0; --track-r: 0; --knob-r: 0; --knob-clip: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); --thumb: 15px; --rail: 1px;
  --dot-w: 20px; --dot-h: 20px; --dot-r: 0; --dot-clip: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); --row-h: 58px; --section-gap: 40px; --breath-r: 0;
}
html[data-theme="aurum"] .card { background: none; border-width: 1px 0; }
html[data-theme="aurum"] .row { padding-left: 2px; padding-right: 2px; }
html[data-theme="aurum"] .btn:not(.primary):not(.ghost) { border-color: var(--accent); color: var(--accent); }
html[data-theme="aurum"] .view.on { animation: th-fade 520ms ease; }
html[data-theme="aurum"] .plate { background: rgba(8,7,5,0.72); }
html[data-theme="aurum"] .beat .track::before { height: 1px; background: var(--accent); }
html[data-theme="aurum"] .beat .dot:not(.rest) { background: var(--accent); }

/* BORDEAUX: a velvet salon. Soft serif, deep rounded forms, every row its own cushion, no lines at all. */
[data-theme="velvet"] {
  --font-display: Constantia, Georgia, serif; --display-weight: 400; --display-scale: 1.14; --display-track: 0;
  --label-font: Constantia, Georgia, serif; --label-size: 15px; --label-color: var(--accent); --label-weight: 400;
  --r-sm: 16px; --r: 18px; --r-lg: 26px; --btn-r: 999px; --btn-h: 36px; --track-r: 999px; --thumb: 20px; --rail: 6px;
  --dot-w: 26px; --dot-h: 26px; --row-h: 62px; --row-x: 24px; --section-gap: 34px; --panel: #240f15;
}
html[data-theme="velvet"] .card { background: none; border: 0; }
html[data-theme="velvet"] .rows > .row { background: var(--surface-2); border-radius: var(--r); border-top: 0; }
html[data-theme="velvet"] .rows > .row + .row { margin-top: 6px; }
html[data-theme="velvet"] .bar, html[data-theme="velvet"] .presets, html[data-theme="velvet"] .settings-rail { border-color: transparent; background: var(--surface); }
html[data-theme="velvet"] .tabs button { border-radius: 999px; margin: 0 2px; padding: 5px 16px; }
html[data-theme="velvet"] .tabs button.on { background: var(--surface-3); box-shadow: none; }
html[data-theme="velvet"] .preset-item.on { background: var(--surface-3); box-shadow: none; }
html[data-theme="velvet"] .seg { border: 0; background: var(--surface-3); border-radius: 999px; padding: 3px; }
html[data-theme="velvet"] .seg button { border-radius: 999px; }
html[data-theme="velvet"] .seg button.on { background: var(--accent); color: var(--accent-ink); }
html[data-theme="velvet"] .toggle span { background: var(--surface-3); border: 0; }
html[data-theme="velvet"] .toggle input:checked + span { background: var(--accent); }
html[data-theme="velvet"] .toggle input:checked + span::after { background: var(--accent-ink); }
html[data-theme="velvet"] .view.on { animation: th-swell 420ms cubic-bezier(.2,.8,.2,1); }
html[data-theme="velvet"] .plate { border-color: transparent; background: rgba(36,15,21,0.8); }
html[data-theme="velvet"] .beat .track::before { height: 6px; top: 9px; border-radius: 3px; background: rgba(217,167,143,0.28); }
html[data-theme="velvet"] .beat .dot:not(.rest) { background: var(--accent); }

/* COGNAC: a saddler's bench. Book serif, visible stitching, tabs like tooled leather, brass rivets. */
[data-theme="ember"] {
  --font-display: "Palatino Linotype", Palatino, Georgia, serif; --display-weight: 700; --display-scale: 1.02; --display-track: 0;
  --font-body: "Palatino Linotype", Palatino, Georgia, serif; --body-size: 14.5px;
  --label-weight: 700; --label-color: var(--accent); --label-size: 14px;
  --r-sm: 4px; --r: 6px; --r-lg: 10px; --track-r: 6px; --knob-r: 4px; --thumb: 16px; --rail: 4px; --edge-style: dashed;
  --dot-w: 18px; --dot-h: 18px; --row-h: 54px; --row-x: 22px; --panel: #221a11; --breath-style: dashed;
}
html[data-theme="ember"] .card { border: 0; outline: 1px dashed var(--line-2); outline-offset: -6px; padding: 6px; background: var(--surface-2); }
html[data-theme="ember"] .bar { background: var(--surface-2); border-bottom: 1px dashed var(--line-2); }
html[data-theme="ember"] .tabs { align-self: flex-end; }
html[data-theme="ember"] .tabs button { border-radius: 6px 6px 0 0; margin: 0 1px; padding: 8px 16px; }
html[data-theme="ember"] .tabs button.on { background: var(--bg); box-shadow: none; color: var(--accent); }
html[data-theme="ember"] .preset-item.on { background: var(--surface-2); box-shadow: none; outline: 1px dashed var(--accent); outline-offset: -3px; }
html[data-theme="ember"] .btn { border-style: dashed; }
html[data-theme="ember"] .btn.primary { border-style: solid; outline: 1px dashed var(--accent-ink); outline-offset: -4px; }
html[data-theme="ember"] .view.on { animation: th-rise 180ms ease-out; }
html[data-theme="ember"] .plate { outline: 1px dashed var(--metal-line); outline-offset: -5px; border-color: transparent; background: rgba(28,22,15,0.82); }
html[data-theme="ember"] .beat .track::before { background: none; border-top: 2px dashed var(--accent); height: 0; }
html[data-theme="ember"] .beat .dot:not(.rest) { background: var(--bg); box-shadow: inset 0 0 0 5px var(--accent); }

/* EMERALD: a members' club ledger. Engraved capitals, double rules, tightly ruled columns. */
[data-theme="forest"] {
  --font-display: "Marcellus", Georgia, serif; --display-weight: 400; --display-scale: 0.92; --display-track: 0.14em; --display-case: uppercase;
  --font-body: Cambria, Georgia, serif; --body-size: 15px; --label-font: "Marcellus", Georgia, serif; --label-size: 13px; --label-track: 0.08em; --label-color: var(--accent); --label-weight: 400;
  --r-sm: 0; --r: 1px; --r-lg: 1px; --track-r: 0; --knob-r: 0; --thumb: 12px; --rail: 3px; --edge-w: 3px; --edge-style: double;
  --dot-w: 12px; --dot-h: 24px; --dot-r: 0; --row-h: 48px; --panel: #0c1a15; --breath-r: 0; --breath-style: double;
}
html[data-theme="forest"] .bar { border-bottom: 3px double var(--line-2); }
html[data-theme="forest"] .presets, html[data-theme="forest"] .settings-rail { border-right: 3px double var(--line-2); }
html[data-theme="forest"] .rows > .row + .row { border-top-color: var(--line-2); }
html[data-theme="forest"] .section > h2 { border-bottom: 1px solid var(--line-2); padding-bottom: 6px; }
html[data-theme="forest"] .preset-item { border-bottom: 1px solid var(--line); border-radius: 0; }
html[data-theme="forest"] .preset-item.on { box-shadow: none; background: none; }
html[data-theme="forest"] .preset-item.on b { color: var(--accent); }
html[data-theme="forest"] .btn { border-width: 3px; border-style: double; }
html[data-theme="forest"] .view.on { animation: th-fade 280ms ease; }
html[data-theme="forest"] .task .t-title { font-size: 34px; }
html[data-theme="forest"] .plate { border: 3px double var(--metal-line); background: rgba(7,18,14,0.82); }
html[data-theme="forest"] .beat .track::before { top: 10px; height: 4px; background: none; border: solid var(--accent); border-width: 1px 0; }
html[data-theme="forest"] .beat .dot:not(.rest) { background: var(--accent); }

/* SAPPHIRE: a modern yacht. Light geometric sans, wide air, capsules and hairlines that barely touch. */
[data-theme="ocean"] {
  --font-display: "Jost", "Segoe UI", sans-serif; --display-weight: 300; --display-scale: 1.32; --display-track: 0.01em;
  --font-body: "Jost", "Segoe UI", sans-serif; --body-size: 15.5px; --label-size: 14px; --label-weight: 400; --label-track: 0.02em;
  --btn-size: 14.5px; --btn-r: 999px; --btn-h: 38px; --r-sm: 999px; --r: 999px; --r-lg: 20px; --track-r: 999px; --thumb: 12px; --rail: 1px;
  --dot-w: 10px; --dot-h: 10px; --row-h: 68px; --row-x: 28px; --section-gap: 48px; --panel: #0e1524;
}
html[data-theme="ocean"] .page { max-width: 860px; padding-top: 48px; }
html[data-theme="ocean"] .card { background: none; }
html[data-theme="ocean"] .bar { border-bottom-color: transparent; }
html[data-theme="ocean"] .presets, html[data-theme="ocean"] .settings-rail { border-right-color: transparent; }
html[data-theme="ocean"] .tabs { border: 1px solid var(--line-2); border-radius: 999px; padding: 2px; gap: 0; }
html[data-theme="ocean"] .tabs button { border-radius: 999px; margin: 0; padding: 3px 16px; }
html[data-theme="ocean"] .tabs button.on { background: var(--accent); color: var(--accent-ink); box-shadow: none; }
html[data-theme="ocean"] .preset-item { border-radius: 16px; }
html[data-theme="ocean"] .preset-item.on { box-shadow: inset 0 0 0 1px var(--line-2); background: none; }
html[data-theme="ocean"] .seg { border-radius: 999px; }
html[data-theme="ocean"] .seg button { border-radius: 999px; }
html[data-theme="ocean"] .view.on { animation: th-slide 460ms cubic-bezier(.16,1,.3,1); }
html[data-theme="ocean"] .plate { background: rgba(8,13,26,0.5); border-color: rgba(207,214,228,0.14); }
html[data-theme="ocean"] .beat .track::before { height: 1px; top: 12px; }
html[data-theme="ocean"] .beat .dot:not(.rest) { top: 7px; box-shadow: 0 0 0 7px rgba(207,214,228,0.14); }
html[data-theme="ocean"] .task .t-title { font-size: 52px; }

/* ONYX: a Swiss instrument. Monospaced readouts, numbered sections, a strict grid, instant response, inverted selection. */
[data-theme="dark"] {
  --font-display: "Inter", "Segoe UI", sans-serif; --display-weight: 700; --display-scale: 1; --display-track: -0.03em;
  --num-font: Consolas, monospace; --label-font: Consolas, monospace; --label-size: 12.5px; --label-weight: 400; --label-color: var(--text-2);
  --btn-size: 13px; --btn-h: 30px; --r-sm: 0; --r: 0; --r-lg: 0; --track-r: 0; --knob-r: 0; --thumb: 8px; --rail: 2px;
  --dot-w: 4px; --dot-h: 24px; --dot-r: 0; --row-h: 44px; --row-x: 14px; --section-gap: 24px; --panel: #000; --breath-r: 0;
}
html[data-theme="dark"] .page { counter-reset: sec; max-width: 1120px; }
html[data-theme="dark"] .section { counter-increment: sec; }
html[data-theme="dark"] .section > h2::before { content: counter(sec, decimal-leading-zero) "  "; white-space: pre; color: var(--text-3); }
html[data-theme="dark"] .card { background: none; border-color: var(--line-2); }
html[data-theme="dark"] .rows > .row + .row { border-top-color: var(--line-2); }
html[data-theme="dark"] .tabs button, html[data-theme="dark"] .preset-item b { font-family: Consolas, monospace; }
html[data-theme="dark"] .tabs button { margin: 0 1px; padding: 4px 10px; }
html[data-theme="dark"] .tabs button.on, html[data-theme="dark"] .preset-item.on { background: var(--text); box-shadow: none; }
html[data-theme="dark"] .tabs button.on, html[data-theme="dark"] .preset-item.on b { color: var(--bg); }
html[data-theme="dark"] .preset-item.on small { color: var(--bg); opacity: 0.65; }
html[data-theme="dark"] .seg { padding: 0; gap: 0; }
html[data-theme="dark"] .seg button.on { background: var(--text); color: var(--bg); }
html[data-theme="dark"] .btn:hover:not(.primary) { background: var(--text); color: var(--bg); }
html[data-theme="dark"] .toggle input:checked + span { background: var(--text); border-color: var(--text); }
html[data-theme="dark"] .toggle input:checked + span::after { background: var(--bg); }
html[data-theme="dark"] .view.on { animation: none; }
html[data-theme="dark"] .btn, html[data-theme="dark"] .tabs button { transition: none; }
html[data-theme="dark"] .plate { background: rgba(0,0,0,0.85); border-color: rgba(243,244,245,0.3); }
html[data-theme="dark"] .beat .track::before { background: rgba(243,244,245,0.45); height: 1px; top: 12px; }
html[data-theme="dark"] .task .t-title { letter-spacing: -0.03em; }

/* IVORY: a broadsheet. Printed on paper: heavy rules over each section, no boxes, ink selections. Paper in the session too. */
[data-theme="light"] {
  --font-display: Georgia, "Times New Roman", serif; --display-weight: 700; --display-scale: 1.2; --display-track: -0.015em;
  --font-body: Georgia, "Times New Roman", serif; --body-size: 14.5px; --label-font: Georgia, serif; --label-size: 15px; --label-weight: 700; --label-color: var(--text);
  --r-sm: 0; --r: 0; --r-lg: 0; --track-r: 0; --knob-r: 50%; --thumb: 13px; --rail: 2px;
  --dot-w: 14px; --dot-h: 14px; --row-h: 50px; --row-x: 0px; --section-gap: 36px; --panel: #fbf8f1; --accent: #1d1a14; --accent-ink: #fbf8f1;
}
html[data-theme="light"] .card { background: none; border: 0; }
html[data-theme="light"] .section > h2 { border-top: 3px solid var(--text); padding-top: 8px; }
html[data-theme="light"] .bar { border-bottom: 3px solid var(--text); }
html[data-theme="light"] .brand span { font-size: 21px; font-weight: 700; letter-spacing: -0.01em; }
html[data-theme="light"] .tabs button.on { box-shadow: none; text-decoration: underline; text-underline-offset: 5px; font-weight: 700; }
html[data-theme="light"] .preset-item { border-bottom: 1px solid var(--line); border-radius: 0; }
html[data-theme="light"] .preset-item.on { background: none; box-shadow: inset 3px 0 0 var(--text); }
html[data-theme="light"] .preset-item.on b { font-weight: 700; }
html[data-theme="light"] .view.on { animation: th-fade 240ms ease; }
html[data-theme="light"] .plate, html[data-theme="light"] .panel, html[data-theme="light"] .quick { background: rgba(251,248,241,0.95); border: 0; border-top: 3px solid #1d1a14; color: #1d1a14; }
html[data-theme="light"] .quick { --text: #1d1a14; --text-2: rgba(29,26,20,0.66); --text-3: rgba(29,26,20,0.44); --surface-2: #efe9dc; --surface-3: #e6dfcf; --line: rgba(74,60,30,0.13); --line-2: rgba(74,60,30,0.28); }
html[data-theme="light"] .task .t-sub, html[data-theme="light"] .task .t-say, html[data-theme="light"] .meta div small, html[data-theme="light"] .folder-tag, html[data-theme="light"] .note { color: rgba(29,26,20,0.75); }
html[data-theme="light"] .task .t-cue { background: none; border-color: #1d1a14; }
html[data-theme="light"] .task .t-bar { background: rgba(29,26,20,0.16); }
html[data-theme="light"] .task .t-bar i { background: #1d1a14; }
html[data-theme="light"] .beat .track::before { background: rgba(29,26,20,0.3); }
html[data-theme="light"] .beat .end { background: rgba(29,26,20,0.5); }
html[data-theme="light"] .beat .dot { background: #1d1a14; }
html[data-theme="light"] .beat .dot.rest { background: transparent; box-shadow: inset 0 0 0 2px rgba(29,26,20,0.5); }
html[data-theme="light"] .beat .bpm { color: rgba(29,26,20,0.7); }
html[data-theme="light"] .beat .bpm b { color: #1d1a14; }
html[data-theme="light"] .panel p, html[data-theme="light"] .panel .vol, html[data-theme="light"] .panel .stats-mini small, html[data-theme="light"] .pause-sound, html[data-theme="light"] .keylist, html[data-theme="light"] .end-notes p { color: rgba(29,26,20,0.68); }
html[data-theme="light"] .panel .stats-mini, html[data-theme="light"] .panel .stats-mini div + div, html[data-theme="light"] .pause-sounds, html[data-theme="light"] .ask { border-color: rgba(29,26,20,0.2); }
html[data-theme="light"] .panel .btn { background: none; border-color: #1d1a14; color: #1d1a14; }
html[data-theme="light"] .panel .btn.primary { background: #1d1a14; color: #fbf8f1; }
html[data-theme="light"] .controls .btn.primary, html[data-theme="light"] .session-progress i { background: #1d1a14; color: #fbf8f1; border-color: #fbf8f1; }
html[data-theme="light"] .controls .btn.primary kbd { color: #fbf8f1; border-color: rgba(251,248,241,0.5); }
html[data-theme="light"] .session-progress { background: rgba(251,248,241,0.5); }
html[data-theme="light"] .task.attn .t-title { color: #b3261e; }

/* the plain option in General: one sans throughout, whichever theme */
html[data-plain], html[data-plain] [data-theme] { --font-display: "Inter", "Segoe UI", sans-serif; --font-body: "Inter", "Segoe UI", sans-serif; --label-font: "Inter", "Segoe UI", sans-serif; --num-font: inherit; --display-weight: 600; --display-scale: 1; --display-track: -0.015em; --display-case: none; --label-size: 13px; --label-track: 0; --body-size: 14px; }

/* shared rules, reading the variables */
body { font-size: var(--body-size); }
.page h1, .pane-title, .settings-rail h1, .name-input, .brand span, .panel h2, .task .t-title, .sheet-head h2, .theme-name, .welcome h2, .q-head b { text-transform: var(--display-case); }
.section > h2, .presets h2, .hist.head, .q-group h3 { font-family: var(--label-font); font-size: var(--label-size); letter-spacing: var(--label-track); text-transform: var(--label-case); color: var(--label-color); font-weight: var(--label-weight); opacity: 1; }
.card { border-width: var(--edge-w); border-style: var(--edge-style); border-color: var(--line-2); }
.row { min-height: var(--row-h); padding: 10px var(--row-x); }
.section { margin-bottom: var(--section-gap); }
.btn { border-radius: var(--btn-r); height: var(--btn-h); }
.btn.small { height: calc(var(--btn-h) - 4px); }
.toggle span { border-radius: var(--track-r); }
.toggle span::after { border-radius: var(--knob-r); clip-path: var(--knob-clip); }
input[type="range"]::-webkit-slider-runnable-track { height: var(--rail); border-radius: var(--rail); }
input[type="range"]::-webkit-slider-thumb { width: var(--thumb); height: var(--thumb); margin-top: calc((var(--rail) - var(--thumb)) / 2); border-radius: var(--knob-r); clip-path: var(--knob-clip); }
.val, .pct b, .stats b, .totals b, .meta div b, .meta div small, .beat .bpm, .q-stack .val, .stats-mini b { font-family: var(--num-font); }
.panel { background: var(--panel); border-radius: var(--r-lg); }
.plate, .sheet, .quick { border-radius: var(--r-lg); }
.controls .btn { border-radius: var(--btn-r); }
.session-progress i, .task .t-bar i { background: var(--accent); }
.beat .dot { width: var(--dot-w); height: var(--dot-h); top: calc(12px - var(--dot-h) / 2); margin-left: calc(var(--dot-w) / -2); border-radius: var(--dot-r); clip-path: var(--dot-clip); }
#game.beat-left .beat .dot, #game.beat-right .beat .dot { width: var(--dot-h); height: var(--dot-w); left: calc(12px - var(--dot-h) / 2); margin: calc(var(--dot-w) / -2) 0 0; }
.beat .dot.rest { clip-path: none; }
.breath i { border-radius: var(--breath-r); border-style: var(--breath-style); border-color: var(--accent); }
@keyframes th-fade { from { opacity: 0; } }
@keyframes th-rise { from { opacity: 0; transform: translateY(3px); } }
@keyframes th-swell { from { opacity: 0; transform: scale(0.985); } }
@keyframes th-slide { from { opacity: 0; transform: translateX(14px); } }

/* the gallery: each card is a small sample of its own house */
.theme-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.theme-card { border-width: var(--edge-w); border-style: var(--edge-style); border-radius: var(--r-lg); min-height: 176px; font-size: var(--body-size); }
.theme-name { font-size: calc(24px * var(--display-scale)); }
.theme-desc { font-size: 13px; }
.theme-foot { gap: 14px; }
.ts-btn { font-style: normal; font-size: 12px; height: 26px; padding: 0 12px; display: inline-flex; align-items: center; background: var(--accent); color: var(--accent-ink); border-radius: var(--btn-r); flex: none; }
.ts-line { position: relative; flex: 1; height: var(--rail); background: var(--line-2); border-radius: var(--rail); }
.ts-line i { position: absolute; left: 62%; top: 50%; width: var(--dot-w); height: var(--dot-h); transform: translate(-50%, -50%) scale(0.75); background: var(--accent); border-radius: var(--dot-r); clip-path: var(--dot-clip); }
.theme-pick { font-family: var(--font-body); font-size: 12px; letter-spacing: 0; color: var(--text-2); }
.theme-card.on .theme-pick { color: var(--accent); font-weight: 600; }

/* small things the theme rules must not lose */
.theme-pick { text-transform: none; }
input[type="search"], .settings-search { border-radius: var(--r); }
.row .label b, .preset-item b, .folder .label b { font-weight: 500; }
.row .label small, .preset-item small { color: var(--text-2); }

/* experimental flashing, night mode, charts, heart rate */
.flash { position: absolute; inset: 0; pointer-events: none; opacity: 0; background: #fff; }
html.night body::after { content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 9999; background: rgb(255, 158, 84); mix-blend-mode: multiply; opacity: calc(var(--night, 0) * 0.36); }
html.night body::before { content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 9998; background: #000; opacity: calc(var(--night, 0) * 0.22); }
.chart svg { width: 100%; height: 120px; display: block; overflow: visible; }
.chart polyline { fill: none; stroke-width: 1.6; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.chart .c-hr { stroke: var(--accent); }
.chart .c-pace { stroke: var(--text-3); stroke-dasharray: 3 3; }
.chart .c-edge { stroke: var(--line-2); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart-key { display: flex; gap: 16px; font-size: 12px; color: var(--text-2); margin-top: 8px; flex-wrap: wrap; }
.chart-key span::before { content: ""; display: inline-block; width: 14px; height: 2px; margin-right: 6px; vertical-align: middle; background: var(--accent); }
.chart-key .k-pace::before { background: var(--text-3); }
.chart-key .k-edge::before { background: var(--line-2); width: 2px; height: 10px; }
.hist.has-chart { cursor: pointer; }
.hist.has-chart:hover { background: var(--surface-2); }
.hist-chart { padding: 12px 16px 16px; border-top: 1px solid var(--line); }
.end-chart { margin: 0 0 20px; text-align: left; }
.panel .chart-key { color: rgba(247,247,245,0.6); }

/* breathing guide, several pictures at once */
.breath i { animation: none; transform: scale(0.55); }
.breath span { font-size: 15px; letter-spacing: 0.02em; }
.breath-mini { display: flex; align-items: center; gap: 10px; width: 100%; margin-top: 10px; font-size: 12px; color: rgba(247,247,245,0.7); }
.breath-mini i { position: relative; flex: 1; height: 2px; background: rgba(247,247,245,0.15); }
.breath-mini i::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: var(--b, 0%); background: var(--accent); }
.breath-mini span { min-width: 78px; text-align: right; }
.task .breath-mini { max-width: 240px; }
#game.clean .breath-mini { margin-top: 6px; }
html[data-theme="light"] .breath-mini { color: rgba(29,26,20,0.7); }
html[data-theme="light"] .breath-mini i { background: rgba(29,26,20,0.15); }
html[data-theme="light"] .breath-mini i::after { background: #1d1a14; }

.pulsoid-panel { padding: 4px var(--row-x) 16px; display: grid; gap: 10px; }
.pulsoid-panel .hint { margin: 0; }

/* the picture grid */
.grid { position: absolute; inset: 0; display: grid; gap: 4px; background: #000; }
.grid .cell { position: relative; overflow: hidden; cursor: pointer; background: #000; }
.grid .cell-layer { position: absolute; inset: 0; }
.grid .cell img, .grid .cell video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.grid .cell img.bg { object-fit: cover; filter: blur(28px) brightness(0.7); transform: scale(1.15); }
.grid .cell.pinned { box-shadow: inset 0 0 0 2px var(--accent); }
.grid .cell.pinned::after { content: "Pinned"; position: absolute; top: 8px; left: 8px; font-size: 11px; padding: 2px 8px; background: rgba(9,10,12,0.7); color: #f7f7f5; border-radius: var(--r-sm); }

/* Hottest */
.heat-badge { position: absolute; right: 6px; bottom: 6px; font-size: 11px; padding: 1px 7px; border-radius: 4px; background: var(--accent); color: var(--accent-ink); font-variant-numeric: tabular-nums; }
.thumb .cool { position: absolute; top: 6px; left: 6px; width: 24px; height: 24px; border: 0; border-radius: var(--r-sm); background: rgba(9,10,12,0.6); color: #f7f7f5; opacity: 0; transition: opacity 140ms; line-height: 1; font-size: 15px; }
.thumb:hover .cool { opacity: 1; }
.hot-folders { margin: -4px 0 12px; }

/* arousal meter: a slim upright gauge at the right edge, with the edge zone marked at the top */
.meter { position: absolute; right: 24px; top: 50%; transform: translateY(-50%); width: 44px; padding: 12px 0 10px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.meter-bar { position: relative; width: 6px; height: min(260px, 34vh); background: rgba(247,247,245,0.14); border-radius: 3px; overflow: hidden; }
.meter-bar i { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: var(--accent); transition: height 900ms ease, background-color 400ms; }
.meter-zone { position: absolute; left: 0; right: 0; top: 0; height: 15%; background: rgba(229,38,47,0.28); }
.meter small { font-size: 10px; color: rgba(247,247,245,0.7); writing-mode: vertical-rl; transform: rotate(180deg); letter-spacing: 0.04em; }
.meter.hot .meter-bar i { background: #e5262f; }
.meter.hot small { color: #ff6b70; }
#game.beat-right .meter { right: 96px; }
#game.hud-off .meter { display: none; }
html[data-theme="light"] .meter-bar { background: rgba(29,26,20,0.15); }
html[data-theme="light"] .meter small { color: rgba(29,26,20,0.7); }

/* the second monitor */
body.second-screen { background: #000; cursor: none; }
body.second-screen .stage { position: absolute; inset: 0; }

/* the heart rate, wherever it shows */
.hb { display: inline-block; width: 0.8em; height: 0.8em; margin-right: 0.3em; color: var(--accent); vertical-align: -0.04em; animation: hb 1s ease-out infinite; }
.hb svg { width: 100%; height: 100%; }
.hb.still { animation: none; opacity: 0.45; }
@keyframes hb { 0%, 45%, 100% { transform: scale(1); } 12% { transform: scale(1.22); } 26% { transform: scale(0.96); } }
.hr-trend { margin-left: 0.2em; font-weight: 400; opacity: 0.8; }
.hr-box.near .hb, .hr-box.near small, .heart-pill.near .hb, .heart-pill.near small { color: #e5262f; }
.heart-pill { display: inline-flex; align-items: baseline; gap: 2px; background: none; border: 0; padding: 4px 6px; color: var(--text); border-radius: var(--r-sm); font-variant-numeric: tabular-nums; white-space: nowrap; }
.heart-pill:hover { background: var(--surface-2); }
.heart-pill b { font-weight: 600; font-family: var(--num-font); }
.heart-pill small { margin-left: 6px; font-size: 12px; color: var(--text-2); }
.heart-pill.quiet small { margin-left: 0; }
.meter-hr { display: none; font-size: 13px; font-variant-numeric: tabular-nums; }
#game.clean .meter-hr { display: block; }

/* connected or not, always in words and a mark */
.conn-dot { width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; align-self: center; flex: none; background: #4fb37c; }
.conn-dot[data-state="warn"] { background: #e0a030; }
.conn-dot[data-state="off"] { background: none; box-shadow: inset 0 0 0 1.5px var(--text-3); }
.heart-pill.off .hb { display: none; }
.heart-pill.off small { margin-left: 0; color: var(--text-2); }
.conn { display: inline-block; margin-left: 8px; padding: 0 8px; font-size: 11.5px; font-weight: 500; line-height: 18px; border-radius: 9px; background: rgba(79,179,124,0.18); color: #4fb37c; }
.conn[data-state="warn"] { background: rgba(224,160,48,0.18); color: #e0a030; }
.conn[data-state="off"] { background: var(--surface-3); color: var(--text-2); }
html[data-theme="light"] .conn { color: #2c7a50; }
html[data-theme="light"] .conn[data-state="warn"] { color: #94640f; }
@media (max-width: 1000px) { .heart-pill small { display: none; } .heart-pill.off small { display: inline; } }

/* running high today */
.why { position: absolute; left: 24px; bottom: 96px; padding: 12px 16px; display: grid; gap: 4px; max-width: 380px; }
.why small { color: rgba(247,247,245,0.7); }
.why-opts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
html[data-theme="light"] .why small { color: rgba(29,26,20,0.7); }
html[data-theme="light"] .why .btn { background: none; border-color: #1d1a14; color: #1d1a14; }
#game.beat-left .why { left: 96px; }

/* heart-rate setup, and the list of what changed and why */
.heart-setup { width: min(460px, 92%); padding: 28px; }
.heart-setup h2 { font-family: var(--font-display); font-weight: var(--display-weight); font-size: calc(22px * var(--display-scale)); margin: 0 0 12px; }
.heart-setup p, .heart-setup li { color: var(--text-2); margin: 0; }
.heart-setup ul { margin: 0; padding-left: 18px; display: grid; gap: 8px; }
.setup-num { display: block; font-size: 36px; font-weight: 600; font-variant-numeric: tabular-nums; margin: 14px 0 8px; }
.setup-bar { height: 3px; background: var(--surface-3); }
.setup-bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width 900ms linear; }
.why-list { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 4px; font-size: 13px; color: var(--text-2); }
.why-list li { display: flex; gap: 12px; }
.why-list .num { min-width: 44px; color: var(--text-3); }

.brand { white-space: nowrap; flex: none; }

/* ================ ESSENTIAL ================
   The default look: one thing to do next, the picture edge to edge, one floating control. Follows Windows light or dark.
   Solid surfaces, no glass or glows. A session is always dark, whatever the mode. */
[data-theme="essential"] {
  --font-display: "Inter", "Segoe UI", sans-serif; --font-body: "Inter", "Segoe UI", sans-serif; --label-font: "Inter", "Segoe UI", sans-serif;
  --display-weight: 600; --display-scale: 1.22; --display-track: -0.022em; --display-case: none; --body-size: 14px;
  --label-size: 13px; --label-track: 0; --label-case: none; --label-color: var(--text-2); --label-weight: 400;
  --btn-track: 0; --btn-case: none; --btn-size: 13.5px; --btn-r: 999px; --btn-h: 34px; --edge-w: 0; --edge-style: solid;
  --r-sm: 8px; --r: 10px; --r-lg: 14px; --track-r: 999px; --knob-r: 50%; --knob-clip: none; --thumb: 20px; --rail: 4px;
  --dot-w: 14px; --dot-h: 14px; --dot-r: 50%; --dot-clip: none; --row-h: 46px; --row-x: 16px; --section-gap: 30px; --breath-r: 50%; --breath-style: solid;
  --bg: #000; --surface: #1c1c1e; --surface-2: #2c2c2e; --surface-3: #3a3a3c; --line: rgba(255,255,255,0.1); --line-2: rgba(255,255,255,0.18);
  --text: #f5f5f7; --text-2: #a1a1a6; --text-3: #6e6e73; --accent: #ff375f; --accent-ink: #fff; --metal-line: transparent; --panel: #1c1c1e;
  --spring: linear(0, 0.06 3%, 0.22 7.5%, 0.62 16%, 0.86 24%, 0.97 32%, 1.01 40%, 1.015 50%, 1.005 65%, 1);
  color-scheme: dark;
}
html[data-theme="essential"][data-mode="light"] {
  --bg: #f5f5f7; --surface: #fff; --surface-2: #e9e9ee; --surface-3: #dcdce2; --line: rgba(0,0,0,0.08); --line-2: rgba(0,0,0,0.16);
  --text: #1d1d1f; --text-2: #6e6e73; --text-3: #98989d; --accent: #e8264f; --panel: #fff; color-scheme: light;
}
html[data-theme="essential"] #game { --panel: #1c1c1e; --surface: #1c1c1e; --surface-2: #2c2c2e; --surface-3: #3a3a3c; --line: rgba(255,255,255,0.1); --line-2: rgba(255,255,255,0.18); --text: #f5f5f7; --text-2: #a1a1a6; --text-3: #6e6e73; color-scheme: dark; }
html[data-theme="essential"] .brand span, html[data-theme="essential"] #startBtn, html[data-theme="essential"] .lib-status { display: none; }
html[data-theme="essential"] .bar { border-bottom: 0; }
html[data-theme="essential"] .tabs { background: var(--surface); border-radius: 999px; padding: 3px; gap: 0; }
html[data-theme="essential"] .tabs button { border-radius: 999px; margin: 0; padding: 4px 16px; color: var(--text-2); }
html[data-theme="essential"] .tabs button.on { background: var(--surface-3); color: var(--text); box-shadow: none; }
html[data-theme="essential"] .view.on { animation: es-in 420ms var(--spring); }
@keyframes es-in { from { opacity: 0; transform: translateY(8px); } }
html[data-theme="essential"] .presets, html[data-theme="essential"] .settings-rail { border-right: 0; }
html[data-theme="essential"] .preset-item { border-radius: var(--r); }
html[data-theme="essential"] .preset-item.on { background: var(--surface); box-shadow: none; }
html[data-theme="essential"] .card { background: var(--surface); border: 0; border-radius: var(--r-lg); overflow: hidden; }
html[data-theme="essential"] .section > h2 { margin-bottom: 8px; padding-left: 16px; }
html[data-theme="essential"] .group-title { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; margin: 34px 0 14px; }
html[data-theme="essential"] .group-title:first-of-type { margin-top: 0; }
html[data-theme="essential"] .btn { background: var(--surface-2); border: 0; transition: transform 300ms var(--spring), background-color 140ms; }
html[data-theme="essential"] .btn:hover { background: var(--surface-3); }
html[data-theme="essential"] .btn:active { transform: scale(0.96); }
html[data-theme="essential"] .btn.primary { background: var(--accent); color: var(--accent-ink); font-weight: 500; }
html[data-theme="essential"] .btn.primary:hover { background: var(--accent); color: var(--accent-ink); filter: brightness(1.08); }
html[data-theme="essential"] .btn.ghost { background: none; color: var(--accent); }
html[data-theme="essential"] .btn.ghost.danger { color: var(--danger); }
html[data-theme="essential"] .seg { background: var(--surface-2); border: 0; border-radius: 9px; padding: 2px; }
html[data-theme="essential"] .seg button { border-radius: 7px; color: var(--text); }
html[data-theme="essential"] .seg button.on { background: var(--surface-3); color: var(--text); box-shadow: none; font-weight: 500; }
html[data-theme="essential"][data-mode="light"] .seg button.on { background: #fff; }
html[data-theme="essential"] .toggle { width: 44px; height: 26px; }
html[data-theme="essential"] .toggle span { background: var(--surface-3); border: 0; }
html[data-theme="essential"] .toggle span::after { top: 2px; left: 2px; width: 22px; height: 22px; background: #fff; transition: transform 320ms var(--spring); }
html[data-theme="essential"] .toggle input:checked + span { background: var(--accent); }
html[data-theme="essential"] .toggle input:checked + span::after { transform: translateX(18px); background: #fff; }
html[data-theme="essential"] input[type="range"]::-webkit-slider-thumb { background: #fff; box-shadow: 0 0 0 0.5px rgba(0,0,0,0.25); }
html[data-theme="essential"] input[type="text"], html[data-theme="essential"] input[type="number"], html[data-theme="essential"] input[type="search"], html[data-theme="essential"] select, html[data-theme="essential"] textarea { background: var(--surface); border: 0; border-radius: var(--r); }
html[data-theme="essential"] .sheet { border: 0; border-radius: 20px; animation: es-sheet 420ms var(--spring); }
@keyframes es-sheet { from { opacity: 0; transform: scale(0.94); } }

/* Today */
.today { max-width: 720px; margin: 0 auto; padding: 40px 32px 48px; }
.today .when { color: var(--text-2); font-size: 14px; }
.today h1 { font-size: 40px; font-weight: 600; letter-spacing: -0.028em; margin: 2px 0 22px; }
.today-card { background: var(--surface); border-radius: 22px; padding: 22px 24px; display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 12px; }
.today-card .eyebrow { color: var(--accent); font-size: 13px; font-weight: 500; }
.today-card .name { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; margin: 2px 0; }
.today-card .reason { color: var(--text-2); }
.today-card .btn.primary { height: 44px; padding: 0 30px; font-size: 16px; }
.today-more { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.today-more button { text-align: left; background: var(--surface); border: 0; border-radius: 16px; padding: 14px; color: var(--text); transition: transform 300ms var(--spring); }
.today-more button:hover { background: var(--surface-2); }
.today-more button:active { transform: scale(0.96); }
.today-more button.on { box-shadow: inset 0 0 0 2px var(--accent); }
.today-more b { display: block; font-weight: 500; }
.today-more small { color: var(--text-2); font-size: 12.5px; }
.today-edit { margin-top: 18px; }
.back-today { margin-bottom: 12px; }
.simple-choices .row .seg { flex: none; }

/* the session: nothing around the picture but the words, one ring and one capsule */
#game.essential .meta, #game.essential .controls, #game.essential .keys { display: none; }
#game.essential .task.plate { background: none; border: 0; padding: 0; left: 32px; top: 28px; }
#game.essential .t-title { font-size: 46px; font-weight: 600; letter-spacing: -0.028em; text-shadow: 0 1px 14px rgba(0,0,0,0.65); }
#game.essential .t-sub, #game.essential .t-say { text-shadow: 0 1px 10px rgba(0,0,0,0.75); color: #fff; }
#game.essential .t-cue { border: 0; background: rgba(0,0,0,0.55); border-radius: 999px; }
#game.essential .t-bar { display: none; }
#game.essential .task.attn .t-title { color: #fff; }
#game.essential .breath-mini { color: #fff; text-shadow: 0 1px 8px rgba(0,0,0,0.75); }
#game.essential .plate { border: 0; }
#game.essential .capsule { position: absolute; left: 50%; bottom: 26px; transform: translateX(-50%); display: flex; align-items: center; gap: 14px; padding: 8px 10px; background: rgba(28,28,30,0.92); border-radius: 999px; white-space: nowrap; transition: padding 300ms; }
#game.essential .capsule .btn { height: 38px; background: rgba(255,255,255,0.1); color: #fff; font-size: 14px; padding: 0 18px; transition: opacity 240ms, transform 300ms var(--spring); }
#game.essential .capsule .btn kbd { display: none; }
#game.essential .capsule .btn.primary { background: var(--accent); color: #fff; }
#game.essential .capsule .pause-only { width: 38px; padding: 0; justify-content: center; font-size: 0; gap: 0; }
#game.essential.idle .capsule .pause-only { width: 0; opacity: 0; margin-right: -14px; pointer-events: none; }
#game.essential .capsule .beat { position: static; transform: none; width: 230px; padding: 0; background: none; flex-direction: row; gap: 12px; }
#game.essential .capsule .beat .track::before { height: 3px; top: 10.5px; border-radius: 2px; background: rgba(255,255,255,0.22); }
#game.essential .capsule .beat .end { display: none; }
#game.essential .capsule .beat .dot { background: #fff; }
#game.essential .capsule .beat .bpm { min-width: 26px; color: #fff; font-size: 14px; }
#game.essential .capsule .beat .bpm span:first-child { font-size: 0; }
#game.essential .capsule .beat .bpm b { font-size: 14px; font-weight: 500; }
#game.essential .ring { position: absolute; right: 152px; top: 20px; display: grid; justify-items: center; gap: 2px; }
#game.essential.fs .ring { right: 28px; }
#game.essential.hud-off .ring { display: none; }
#game.essential .ring small { font-size: 11px; color: #fff; text-shadow: 0 1px 8px rgba(0,0,0,0.75); }
.ring-dial { position: relative; width: 62px; height: 62px; }
.ring-dial svg { display: block; width: 100%; height: 100%; }
.ring-dial circle { fill: rgba(28,28,30,0.72); stroke-width: 6; }
.ring-track { stroke: rgba(255,255,255,0.2); }
.ring-arc { fill: none !important; stroke: var(--accent); stroke-linecap: round; stroke-dasharray: 175.93; stroke-dashoffset: 175.93; transition: stroke-dashoffset 900ms ease, stroke 400ms; }
.ring.hot .ring-arc { stroke: #e5262f; }
#game.essential .ring .meter-hr { display: block; position: absolute; inset: 0; display: grid; place-items: center; font-size: 17px; font-weight: 600; color: #fff; font-variant-numeric: tabular-nums; }
#game.essential .panel { border: 0; border-radius: 22px; animation: es-sheet 420ms var(--spring); }
#game.essential .panel .btn { background: #3a3a3c; color: #fff; }
#game.essential .panel .btn.primary { background: var(--accent); color: #fff; }

/* Journal */
.journal { max-width: 720px; margin: 0 auto; padding: 40px 32px 48px; }
.journal h1 { font-size: 40px; font-weight: 600; letter-spacing: -0.028em; margin: 0 0 4px; }
.journal .lede { color: var(--text-2); margin: 0 0 22px; }
.j-card { background: var(--surface); border-radius: 18px; padding: 16px 20px; margin-bottom: 10px; }
.j-card.has-chart { cursor: pointer; }
.j-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.j-when { color: var(--text-2); font-size: 12.5px; }
.j-title { font-size: 19px; font-weight: 600; letter-spacing: -0.015em; margin: 1px 0; }
.j-meta { color: var(--text-2); }
.j-card .chart { margin-top: 12px; }

/* echoes */
.echo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; opacity: 0; pointer-events: none; mix-blend-mode: screen; }
/* the oracle */
.oracle { width: min(520px, 94%); padding: 26px; }
.oracle h2 { font-family: var(--font-display); font-weight: var(--display-weight); font-size: calc(22px * var(--display-scale)); margin: 0 0 4px; }
.o-row { display: flex; gap: 14px; justify-content: center; margin: 22px 0 6px; perspective: 900px; }
.o-card { position: relative; width: 120px; height: 172px; border: 0; padding: 0; background: none; transform-style: preserve-3d; transition: transform 700ms cubic-bezier(.2,.8,.2,1), opacity 400ms; }
.o-card > span { position: absolute; inset: 0; border-radius: 14px; backface-visibility: hidden; display: grid; place-items: center; }
.o-back { background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line-2); }
.o-back i { width: 46px; height: 46px; border-radius: 50%; box-shadow: inset 0 0 0 2px var(--accent), 0 0 0 9px var(--surface-2), 0 0 0 10px var(--line-2); }
.o-face { background: var(--accent); color: var(--accent-ink); font-weight: 600; letter-spacing: 0.02em; transform: rotateY(180deg); }
.o-card:hover:not(.chosen):not(.gone) { transform: translateY(-6px); }
.o-card.chosen { transform: rotateY(180deg) scale(1.06); }
.o-card.gone { opacity: 0.15; pointer-events: none; }
.oracle-reveal { margin: 0 0 18px; padding: 14px 16px; border-radius: 14px; background: rgba(255,255,255,0.06); text-align: left; }
.oracle-reveal small { display: block; color: rgba(247,247,245,0.6); font-size: 12px; }
.oracle-reveal b { font-size: 17px; }
.oracle-reveal p { margin: 4px 0 0; color: rgba(247,247,245,0.8); }
.today-oracle { margin-top: 10px; }

/* ================ THE WHOLE WINDOW ================
   No narrow column in the middle of a wide screen: pages fill the window, with padding that grows with it,
   and wide windows get more columns. */
.page, html[data-theme] .page { max-width: none; margin: 0; padding-left: clamp(24px, 3.2vw, 64px); padding-right: clamp(24px, 3.2vw, 64px); }
@media (min-width: 1250px) {
  .settings-pane .page { columns: 2 480px; column-gap: clamp(24px, 2.4vw, 48px); }
  .settings-pane .page > .pane-title, .settings-pane .page > .lede, .settings-pane .page > .group-title, .settings-pane .page > p { column-span: all; }
  .settings-pane .section { break-inside: avoid; display: inline-block; width: 100%; }
}
.today { max-width: none; margin: 0; padding: clamp(28px, 4.5vh, 64px) clamp(24px, 4vw, 80px) 48px; display: grid; grid-template-columns: minmax(0, 1fr); column-gap: clamp(24px, 3vw, 56px); align-content: start; }
.today > * { grid-column: 1; }
.today h1 { font-size: clamp(36px, 3.4vw, 56px); }
.today-card { padding: clamp(22px, 2.4vw, 36px) clamp(24px, 2.6vw, 40px); }
.today-card .name { font-size: clamp(24px, 2vw, 32px); }
.today-more { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.today-side { display: grid; gap: 12px; align-content: start; margin-top: 24px; }
.side-card { background: var(--surface); border-radius: 18px; padding: 18px 20px; }
.side-card h3 { margin: 0 0 12px; font-size: 15px; font-weight: 600; }
.week-strip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.wk { background: var(--surface-2); border-radius: 12px; padding: 10px 6px; text-align: center; min-width: 0; }
.wk b { display: block; font-size: 13px; font-weight: 600; }
.wk small { display: block; font-size: 11px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wk.is-today { box-shadow: inset 0 0 0 2px var(--accent); }
.wk.payoff b, .wk.done b { color: var(--accent); }
.recent { padding: 8px 0; border-top: 1px solid var(--line); }
.recent:first-of-type { border-top: 0; padding-top: 0; }
.recent b { display: block; font-weight: 500; }
.recent small { color: var(--text-2); }
@media (min-width: 1100px) {
  .today { grid-template-columns: minmax(0, 1.7fr) minmax(320px, 1fr); }
  .today > .today-side { grid-column: 2; grid-row: 1 / span 12; margin-top: 0; }
}
.journal { max-width: none; margin: 0; padding: clamp(28px, 4.5vh, 64px) clamp(24px, 4vw, 80px) 48px; }
.journal h1 { font-size: clamp(36px, 3.4vw, 56px); }
.j-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; }
.j-grid .j-card { margin: 0; }
.j-grid .j-card.open { grid-column: 1 / -1; }

/* ================ ANY DISPLAY ================
   Columns come and go with the space: Settings runs in as many columns as fit, the library preview, Today and the
   Journal fill whatever width there is, and session type grows with the screen. */
@media (min-width: 1250px) { .settings-pane .page { columns: auto; column-width: 460px; } }
.thumbs { grid-template-columns: repeat(auto-fill, minmax(clamp(132px, 9vw, 240px), 1fr)); }
.today { min-height: 100%; grid-template-rows: auto auto auto auto auto auto auto 1fr; }
.today-hot { margin-top: 28px; min-height: 0; display: flex; flex-direction: column; }
.today-hot h3 { margin: 0 0 10px; font-size: 15px; font-weight: 600; }
.hot-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(clamp(120px, 10vw, 220px), 1fr)); grid-auto-rows: clamp(120px, 10vw, 220px); gap: 8px; overflow: hidden; }
.hot-strip img { width: 100%; height: 100%; object-fit: cover; border-radius: 12px; background: var(--surface); }
#game.essential .t-title { font-size: clamp(34px, 3.2vw, 76px); }
#game .task .t-title { font-size: clamp(30px, 2.6vw, 64px); }
#game.essential .capsule .beat { width: clamp(200px, 16vw, 420px); }
.ring-dial { width: clamp(56px, 4.2vw, 96px); height: clamp(56px, 4.2vw, 96px); }

/* ================ INSTRUMENT ================
   The default look: a precise, physical device in the spirit of Braun and Teenage Engineering. A warm aluminium body,
   black ink and one orange signal; labels and every number in IBM Plex Mono; hairline rules instead of rounded boxes;
   square, mechanical controls. Follows Windows light or dark. Sessions are always dark. Flat throughout. */
@font-face { font-family: "Plex Mono"; src: url(../fonts/plexmono-400.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Plex Mono"; src: url(../fonts/plexmono-500.woff2) format("woff2"); font-weight: 500; font-display: swap; }
[data-theme="instrument"] {
  --font-display: "Inter", "Segoe UI", sans-serif; --font-body: "Inter", "Segoe UI", sans-serif; --num-font: "Plex Mono", Consolas, monospace; --label-font: "Plex Mono", Consolas, monospace;
  --display-weight: 600; --display-scale: 1.15; --display-track: -0.03em; --display-case: none; --body-size: 14px;
  --label-size: 11px; --label-track: 0.09em; --label-case: uppercase; --label-color: var(--text-2); --label-weight: 500;
  --btn-track: 0.07em; --btn-case: uppercase; --btn-size: 11.5px; --btn-r: 4px; --btn-h: 34px; --edge-w: 1px; --edge-style: solid;
  --r-sm: 3px; --r: 4px; --r-lg: 6px; --track-r: 3px; --knob-r: 2px; --knob-clip: none; --thumb: 14px; --rail: 2px;
  --dot-w: 6px; --dot-h: 22px; --dot-r: 1px; --dot-clip: none; --row-h: 50px; --row-x: 16px; --section-gap: 28px; --breath-r: 50%; --breath-style: solid;
  --bg: #e8e6e1; --surface: #f3f2ee; --surface-2: #dcdad4; --surface-3: #cecbc4; --line: rgba(18,18,18,0.12); --line-2: rgba(18,18,18,0.3);
  --text: #121212; --text-2: #5e5c57; --text-3: #8d8a83; --accent: #ff5a1f; --accent-ink: #121212; --panel: #f3f2ee; --metal-line: transparent;
  --ink: #121212; --ink-inv: #e8e6e1;
  --spring: linear(0, 0.06 3%, 0.22 7.5%, 0.62 16%, 0.86 24%, 0.97 32%, 1.01 40%, 1.015 50%, 1.005 65%, 1);
  color-scheme: light;
}
html[data-theme="instrument"][data-mode="dark"] {
  --bg: #121211; --surface: #1b1b1a; --surface-2: #262624; --surface-3: #31312e; --line: rgba(236,235,230,0.1); --line-2: rgba(236,235,230,0.26);
  --text: #ecebe6; --text-2: #9a978f; --text-3: #6c6a64; --panel: #1b1b1a; --ink: #ecebe6; --ink-inv: #121211; color-scheme: dark;
}
html[data-theme="instrument"] #game { --panel: #1b1b1a; --surface: #1b1b1a; --surface-2: #262624; --surface-3: #31312e; --line: rgba(236,235,230,0.1); --line-2: rgba(236,235,230,0.26); --text: #ecebe6; --text-2: #9a978f; --text-3: #6c6a64; --ink: #ecebe6; --ink-inv: #121211; color-scheme: dark; }

/* frame */
html[data-theme="instrument"] #startBtn, html[data-theme="instrument"] .lib-status { display: none; }
html[data-theme="instrument"] .bar { border-bottom: 1px solid var(--line-2); }
html[data-theme="instrument"] .brand span { font-family: var(--num-font); font-size: 12px; font-weight: 500; letter-spacing: 0.16em; text-transform: uppercase; }
html[data-theme="instrument"] .tabs { gap: 0; border: 1px solid var(--line-2); border-radius: 4px; overflow: hidden; }
html[data-theme="instrument"] .tabs button { border-radius: 0; margin: 0; padding: 5px 16px; font-family: var(--num-font); font-size: 11px; font-weight: 500; letter-spacing: 0.09em; text-transform: uppercase; color: var(--text-2); }
html[data-theme="instrument"] .tabs button + button { border-left: 1px solid var(--line-2); }
html[data-theme="instrument"] .tabs button:hover { background: var(--surface-2); color: var(--text); }
html[data-theme="instrument"] .tabs button.on { background: var(--ink); color: var(--ink-inv); box-shadow: none; text-decoration: none; }
html[data-theme="instrument"] .heart-pill b, html[data-theme="instrument"] .heart-pill small { font-family: var(--num-font); }
html[data-theme="instrument"] .heart-pill small { text-transform: uppercase; letter-spacing: 0.06em; font-size: 10.5px; }
html[data-theme="instrument"] .view.on { animation: in-in 260ms ease-out; }
@keyframes in-in { from { opacity: 0; } }
html[data-theme="instrument"] .presets, html[data-theme="instrument"] .settings-rail { border-right: 1px solid var(--line-2); }
html[data-theme="instrument"] .preset-item { border-radius: 0; }
html[data-theme="instrument"] .preset-item.on { background: none; box-shadow: inset 3px 0 0 var(--accent); }
html[data-theme="instrument"] .settings-rail h1 { font-size: 26px; letter-spacing: -0.03em; }

/* modules: numbered, ruled, square */
html[data-theme="instrument"] .page { counter-reset: sec; }
html[data-theme="instrument"] .section { counter-increment: sec; }
html[data-theme="instrument"] .section > h2 { padding-left: 0; margin-bottom: 8px; }
html[data-theme="instrument"] .section > h2::before { content: counter(sec, decimal-leading-zero) "  "; white-space: pre; color: var(--accent); }
html[data-theme="instrument"] .pane-title { font-size: clamp(30px, 2.6vw, 44px); letter-spacing: -0.035em; }
html[data-theme="instrument"] .group-title { font-family: var(--num-font); font-size: 12px; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase; border-top: 1px solid var(--ink); padding-top: 10px; margin: 30px 0 16px; }
html[data-theme="instrument"] .card { background: var(--surface); border: 1px solid var(--line-2); border-radius: 4px; overflow: hidden; }
html[data-theme="instrument"] .rows > .row + .row { border-top-color: var(--line); }
html[data-theme="instrument"] .row .label b { font-weight: 500; }

/* controls: mechanical */
html[data-theme="instrument"] .btn { background: transparent; border: 1px solid var(--line-2); color: var(--text); font-family: var(--num-font); font-weight: 500; transition: transform 160ms ease-out, background-color 120ms; }
html[data-theme="instrument"] .btn:hover { background: var(--surface-2); }
html[data-theme="instrument"] .btn:active { transform: translateY(1px); }
html[data-theme="instrument"] .btn.primary { background: var(--accent); border-color: var(--accent); color: #121212; }
html[data-theme="instrument"] .btn.primary:hover { background: #ff6e3a; border-color: #ff6e3a; color: #121212; filter: none; }
html[data-theme="instrument"] .btn.ghost { border-color: transparent; text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }
html[data-theme="instrument"] .btn.ghost:hover { background: none; color: var(--accent); }
html[data-theme="instrument"] .seg { background: transparent; border: 1px solid var(--line-2); border-radius: 4px; padding: 0; gap: 0; overflow: hidden; }
html[data-theme="instrument"] .seg button { border-radius: 0; font-family: var(--num-font); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-2); padding: 6px 12px; }
html[data-theme="instrument"] .seg button + button { border-left: 1px solid var(--line-2); }
html[data-theme="instrument"] .seg button.on { background: var(--ink); color: var(--ink-inv); box-shadow: none; }
html[data-theme="instrument"] .toggle { width: 42px; height: 22px; }
html[data-theme="instrument"] .toggle span { background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 3px; }
html[data-theme="instrument"] .toggle span::after { top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 2px; background: var(--text-3); transition: transform 180ms ease-out, background-color 120ms; }
html[data-theme="instrument"] .toggle input:checked + span { background: var(--ink); border-color: var(--ink); }
html[data-theme="instrument"] .toggle input:checked + span::after { transform: translateX(20px); background: var(--accent); }
html[data-theme="instrument"] input[type="range"]::-webkit-slider-runnable-track { height: 2px; border-radius: 0; }
html[data-theme="instrument"] input[type="range"]::-webkit-slider-thumb { width: 10px; height: 20px; margin-top: -9px; border-radius: 2px; background: var(--ink); clip-path: none; }
html[data-theme="instrument"] input[type="text"], html[data-theme="instrument"] input[type="number"], html[data-theme="instrument"] input[type="search"], html[data-theme="instrument"] select, html[data-theme="instrument"] textarea { background: var(--surface); border: 1px solid var(--line-2); border-radius: 4px; }
html[data-theme="instrument"] .sheet { border: 1px solid var(--line-2); border-radius: 6px; background: var(--surface); }
html[data-theme="instrument"] .conn { border-radius: 3px; font-family: var(--num-font); text-transform: uppercase; letter-spacing: 0.06em; font-size: 10.5px; }

/* Today */
html[data-theme="instrument"] .today .when, html[data-theme="instrument"] .dial-meta .eyebrow, html[data-theme="instrument"] .side-card h3, html[data-theme="instrument"] .today-hot h3 { font-family: var(--num-font); font-size: 11px; font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-2); }
html[data-theme="instrument"] .today h1 { letter-spacing: -0.04em; }
.dial-hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: clamp(20px, 3vw, 56px); align-items: center; background: var(--surface); border: 1px solid var(--line-2); border-radius: 6px; padding: clamp(22px, 2.6vw, 44px); margin-bottom: 12px; }
.dial-meta .eyebrow { color: var(--accent) !important; }
.dial-meta .name { font-size: clamp(30px, 2.8vw, 52px); font-weight: 600; letter-spacing: -0.04em; line-height: 1.02; margin: 8px 0 10px; }
.dial-meta .reason { color: var(--text-2); max-width: 46ch; }
.readouts { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--ink); }
.readouts div { padding: 12px 12px 0 0; font-family: var(--num-font); font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-2); }
.readouts div + div { border-left: 1px solid var(--line); padding-left: 14px; }
.readouts b { display: block; margin-top: 4px; font-size: clamp(22px, 2vw, 34px); font-weight: 500; letter-spacing: -0.03em; color: var(--text); text-transform: none; }
.dial { position: relative; width: clamp(190px, 15vw, 300px); aspect-ratio: 1; border: 0; padding: 0; border-radius: 50%; background: none; color: var(--text); cursor: pointer; display: grid; place-items: center; }
.dial svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.dial .tick { stroke: var(--text); stroke-width: 1; }
.dial .tick.major { stroke-width: 2.4; }
.dial-face { position: relative; width: 70%; aspect-ratio: 1; border-radius: 50%; border: 2px solid var(--ink); display: grid; place-content: center; text-align: center; transition: background-color 160ms, transform 300ms var(--spring); }
.dial:hover .dial-face { background: var(--accent); border-color: var(--accent); color: #121212; }
.dial:active .dial-face { transform: scale(0.96); }
.dial-num { font-family: var(--num-font); font-size: clamp(40px, 3.4vw, 68px); font-weight: 500; line-height: 1; letter-spacing: -0.04em; }
.dial-lab { font-family: var(--num-font); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; margin-top: 6px; }
.dial-hand { position: absolute; inset: 0; animation: dial-spin linear infinite; pointer-events: none; }
.dial-hand::after { content: ""; position: absolute; left: calc(50% - 3px); top: 2%; width: 6px; height: 11%; background: var(--accent); border-radius: 1px; }
@keyframes dial-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .dial-hand { animation: none; } }
html[data-theme="instrument"] .today-more button { border-radius: 4px; border: 1px solid var(--line-2); background: var(--surface); }
html[data-theme="instrument"] .today-more button.on { box-shadow: inset 0 0 0 2px var(--ink); }
html[data-theme="instrument"] .today-more small, html[data-theme="instrument"] .recent small, html[data-theme="instrument"] .wk small { font-family: var(--num-font); letter-spacing: 0.02em; }
html[data-theme="instrument"] .side-card { border-radius: 6px; border: 1px solid var(--line-2); }
html[data-theme="instrument"] .wk { border-radius: 3px; background: transparent; border: 1px solid var(--line); }
html[data-theme="instrument"] .wk b { font-family: var(--num-font); font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; font-size: 11px; }
html[data-theme="instrument"] .wk.is-today { box-shadow: none; background: var(--ink); color: var(--ink-inv); border-color: var(--ink); }
html[data-theme="instrument"] .wk.is-today small { color: var(--ink-inv); opacity: 0.75; }
html[data-theme="instrument"] .hot-strip img { border-radius: 2px; }

/* Journal */
html[data-theme="instrument"] .j-card { border-radius: 4px; border: 1px solid var(--line-2); }
html[data-theme="instrument"] .j-when, html[data-theme="instrument"] .j-meta { font-family: var(--num-font); font-size: 11px; letter-spacing: 0.04em; }
html[data-theme="instrument"] .j-when { text-transform: uppercase; }
html[data-theme="instrument"] .j-title { letter-spacing: -0.025em; }

/* the session: same structure, the instrument's hardware */
html[data-theme="instrument"] #game.essential .capsule { border-radius: 6px; background: rgba(18,18,17,0.94); border: 1px solid rgba(236,235,230,0.18); padding: 6px; gap: 10px; }
html[data-theme="instrument"] #game.essential .capsule .btn { border-radius: 3px; height: 36px; font-family: var(--num-font); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; background: rgba(236,235,230,0.08); border: 0; color: #ecebe6; }
html[data-theme="instrument"] #game.essential .capsule .btn.primary { background: #ff5a1f; color: #121212; }
html[data-theme="instrument"] #game.essential .capsule .beat .bpm, html[data-theme="instrument"] #game.essential .capsule .beat .bpm b { font-family: var(--num-font); }
html[data-theme="instrument"] #game.essential .capsule .beat .dot { border-radius: 1px; }
html[data-theme="instrument"] #game.essential .t-title { letter-spacing: -0.035em; }
html[data-theme="instrument"] #game.essential .t-sub, html[data-theme="instrument"] #game.essential .breath-mini { font-family: var(--num-font); font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; }
html[data-theme="instrument"] .ring-arc { stroke: #ff5a1f; stroke-linecap: butt; }
html[data-theme="instrument"] #game.essential .ring small, html[data-theme="instrument"] #game.essential .ring .meter-hr { font-family: var(--num-font); }
html[data-theme="instrument"] #game.essential .ring small { text-transform: uppercase; letter-spacing: 0.06em; font-size: 10px; }
html[data-theme="instrument"] #game.essential .panel { border-radius: 6px; border: 1px solid rgba(236,235,230,0.18); }
html[data-theme="instrument"] #game.essential .panel h2 { letter-spacing: -0.035em; }
html[data-theme="instrument"] #game.essential .panel .btn { border-radius: 3px; background: transparent; border: 1px solid rgba(236,235,230,0.26); color: #ecebe6; font-family: var(--num-font); }
html[data-theme="instrument"] #game.essential .panel .btn.primary { background: #ff5a1f; border-color: #ff5a1f; color: #121212; }
html[data-theme="instrument"] #game .stats-mini b, html[data-theme="instrument"] #game .stats-mini small { font-family: var(--num-font); }

/* what's new */
.whatsnew { width: min(640px, 94%); max-height: 84vh; padding: 26px; }
.whatsnew h2 { font-family: var(--font-display); font-weight: var(--display-weight); font-size: calc(24px * var(--display-scale)); letter-spacing: var(--display-track); margin: 0 0 14px; }
.wn-list { overflow: auto; display: grid; gap: 4px; padding-right: 4px; }
.wn-date { font-family: var(--num-font); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-3); margin: 12px 0 2px; }
.wn-item { padding: 12px 0; border-top: 1px solid var(--line); }
.wn-item b { font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.wn-item p { margin: 4px 0 0; color: var(--text-2); }
.wn-off { font-family: var(--num-font); font-size: 10.5px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); }
.wn-where { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px; }
.wn-where small { font-family: var(--num-font); color: var(--text-3); font-size: 11.5px; }
.discover-card p { margin: 0 0 10px; color: var(--text-2); }
.discover-card.is-on h3::after { content: " · on"; color: var(--accent); }

/* ================ POLISH ================
   One system for every screen: the same page header, quiet section heads, ink buttons with the orange kept for
   the one thing that starts a session, balanced settings columns, and nothing cut off. */
/* pages: one header and one margin everywhere */
#view-library > .page { padding: clamp(28px, 4.5vh, 64px) clamp(24px, 4vw, 80px) 48px; }
html[data-theme="instrument"] #view-library h1, html[data-theme="essential"] #view-library h1 { font-size: clamp(36px, 3.4vw, 56px); letter-spacing: -0.04em; line-height: 1.05; margin: 0 0 10px; }
.sec-title { font-size: 16px; margin: 0; }
html[data-theme="instrument"] .sec-title { font-family: var(--num-font); font-size: 11px; font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text); margin: 0 0 6px; }
.lib-page .head-row { margin-bottom: 14px; }
.lib-page .lede { max-width: 90ch; }
.totals { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 8px 40px; }
.totals-note { margin-left: auto; text-align: right; }
.totals-note b { color: var(--text); }

/* buttons: ink is the main action, orange only starts a session */
html[data-theme="instrument"] .btn.primary { background: var(--ink); border-color: var(--ink); color: var(--ink-inv); }
html[data-theme="instrument"] .btn.primary:hover { background: var(--accent); border-color: var(--accent); color: #121212; }
html[data-theme="instrument"] .btn.ghost { border-color: transparent; text-decoration: none; color: var(--text-2); }
html[data-theme="instrument"] .btn.ghost:hover { background: var(--surface-2); color: var(--text); }
html[data-theme="instrument"] .btn:disabled { opacity: 0.45; }
html[data-theme="instrument"] .btn:focus-visible, html[data-theme="instrument"] .seg button:focus-visible, html[data-theme="instrument"] .tabs button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
html[data-theme="instrument"] .toggle span, html[data-theme="instrument"] .toggle span::after { transition: background-color 140ms, border-color 140ms, transform 200ms cubic-bezier(.2,.8,.2,1); }
html[data-theme="instrument"] .toggle:hover span { border-color: var(--ink); }

/* settings: balanced columns */
.settings-pane .page.masonry { columns: auto; column-width: auto; }
.set-cols { display: grid; grid-template-columns: repeat(var(--n, 1), minmax(0, 1fr)); column-gap: clamp(24px, 2.4vw, 48px); align-items: start; }
.set-col { min-width: 0; }
.page.masonry .section { display: block; width: auto; }
.set-group + .set-group { margin-top: 12px; }
.set-group > p { max-width: 90ch; }

/* looks: the one in use, the others folded away */
.looks .theme-card { width: 100%; min-height: 0; }
.other-looks { margin-top: 10px; }
.other-looks summary { cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 8px; padding: 6px 0; color: var(--text-2); font-family: var(--num-font); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; }
.other-looks summary::-webkit-details-marker { display: none; }
.other-looks summary::before { content: "+"; display: inline-grid; place-items: center; width: 16px; height: 16px; border: 1px solid var(--line-2); border-radius: 2px; }
.other-looks[open] summary::before { content: "\2212"; }
.other-looks summary:hover { color: var(--text); }
.other-looks .theme-grid { margin-top: 10px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.other-looks .theme-card { min-height: 0; padding: 14px 16px; }
.other-looks .theme-name { font-size: calc(18px * var(--display-scale)); }
.other-looks .theme-desc { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 12px; }
.other-looks .theme-foot { padding-top: 12px; }

/* trance voices: a list you pick from */
#voicePick { padding: 4px 0; }
.voice-row { display: flex; align-items: center; gap: 12px; padding: 0 var(--row-x, 16px); min-height: 42px; }
.voice-row + .voice-row { border-top: 1px solid var(--line); }
.voice-row:hover { background: var(--surface-2); }
.voice-play { flex: none; width: 28px; height: 28px; display: grid; place-items: center; border: 1px solid var(--line-2); border-radius: var(--r-sm, 3px); background: transparent; color: var(--text); cursor: pointer; }
.voice-play svg { width: 11px; height: 11px; }
.voice-play:hover { background: var(--ink, var(--text)); color: var(--ink-inv, var(--bg)); border-color: var(--ink, var(--text)); }
.voice-pick { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 10px; text-align: left; background: none; border: 0; padding: 11px 0; color: var(--text); font: inherit; cursor: pointer; }
.voice-pick:disabled { cursor: default; color: var(--text-3); }
.voice-pick small { color: var(--text-3); font-size: 12px; }
.voice-mark { flex: none; font-family: var(--num-font); font-size: 10.5px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.voice-row.on .voice-pick { font-weight: 600; }
.voice-row.on { box-shadow: inset 3px 0 0 var(--accent); }

/* Today */
.today-more { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.today-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.wk small { font-size: 10.5px; }
html[data-theme="instrument"] .wk.done small { color: var(--accent); letter-spacing: 0.2em; }
html[data-theme="instrument"] .wk.is-today.done small { color: var(--accent); opacity: 1; }
.discover-card .btn { margin-top: 2px; }

/* Journal */
.j-readouts { margin: 8px 0 28px; padding-bottom: 4px; }
.j-readouts small { display: block; margin-top: 2px; font-size: 10.5px; color: var(--text-3); text-transform: none; letter-spacing: 0.02em; }
.j-month { grid-column: 1 / -1; font-family: var(--num-font); font-size: 11px; font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-2); margin: 14px 0 2px; }
.j-month:first-child { margin-top: 0; }
.j-card .icon-btn, .j-card .iconbtn, .j-card button[title="Delete entry"] { opacity: 0; transition: opacity 120ms; }
.j-card:hover button[title="Delete entry"], .j-card button[title="Delete entry"]:focus-visible { opacity: 1; }
.more-rows { border-top: 1px solid var(--line); }
.more-rows > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 10px; padding: 14px var(--row-x, 16px); color: var(--text-2); }
.more-rows > summary::-webkit-details-marker { display: none; }
.more-rows > summary::before { content: "+"; display: inline-grid; place-items: center; width: 16px; height: 16px; border: 1px solid var(--line-2); border-radius: 2px; font-family: var(--num-font); font-size: 11px; }
.more-rows[open] > summary::before { content: "\2212"; }
.more-rows > summary:hover { color: var(--text); background: var(--surface-2); }

/* Today in a narrow window: what to start comes first, the side panels after */
.today > .today-side { order: 50; }
.today > .today-hot { order: 60; }

/* the session editor */
.editor-pair { align-items: start; margin-top: 8px; }
.editor-pair > .section { margin-bottom: 0; }
.simple-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.simple-choices > .row { flex-direction: column; align-items: flex-start; gap: 12px; padding-top: 16px; padding-bottom: 18px; }
.rows.simple-choices > .row + .row { border-top: 0; border-left: 1px solid var(--line); }
@media (max-width: 760px) { .rows.simple-choices > .row + .row { border-left: 0; border-top: 1px solid var(--line); } }
html[data-theme="instrument"] .simple-choices .label b { font-family: var(--num-font); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-2); }
details.more > summary { list-style: none; display: inline-flex; align-items: center; gap: 10px; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::before { content: "+"; display: inline-grid; place-items: center; width: 16px; height: 16px; border: 1px solid var(--line-2); border-radius: 2px; font-family: var(--num-font); font-size: 11px; }
details.more[open] > summary::before { content: "\2212"; }
html[data-theme="instrument"] details.more > summary { font-family: var(--num-font); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; }
html[data-theme="instrument"] .back-today { margin-left: -12px; }
html[data-theme="instrument"] .chip { border-radius: 3px; }
html[data-theme="instrument"] .chip.pick.on { background: var(--ink); color: var(--ink-inv); border-color: var(--ink); }
html[data-theme="instrument"] .presets .preset-item small { font-family: var(--num-font); font-size: 11px; letter-spacing: 0.01em; }

/* session tips sit above the controls, never over the task text */
#game.essential .note { left: 50%; top: auto; bottom: 96px; transform: translateX(-50%); max-width: min(560px, 80%); text-align: center; animation: none; }
html[data-theme="instrument"] #game.essential .note { border-radius: 4px; background: rgba(18,18,17,0.9); border: 1px solid rgba(236,235,230,0.18); }
.dial-lab { white-space: nowrap; font-size: clamp(8.5px, 0.62vw, 10px); }
.presets .preset-item small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.simple-choices { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

/* Discover: chosen tags and communities, with the field to add more */
.discover-pick { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 8px; max-width: 520px; }
/* the tag picker in Settings takes its own line under the row's title, so the title isn't squeezed into a sliver */
.row:has(> .discover-pick) { flex-wrap: wrap; }
.row:has(> .discover-pick) > .label { flex: 1 1 100%; max-width: none; }
.row > .discover-pick { flex: 1 1 100%; max-width: none; justify-content: flex-start; }
.row > .discover-pick .chips { justify-content: flex-start; }
.discover-pick .chips { justify-content: flex-end; }
.chip.niche small { margin-left: 6px; color: var(--text-2); font-size: 11px; letter-spacing: .02em; }

/* the screen before a session: folders and online sources side by side, with how much is ready */
.sheet.media-sheet { width: min(980px, 94%); max-height: 86vh; }
.media-sheet .sheet-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; overflow: auto; min-height: 0; }
.media-sheet .sheet-cols > div { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.media-sheet .sec-title { margin: 0; }
.sheet-online { border: 1px solid var(--line); border-radius: var(--r); }
.sheet-online > .hint { padding: 12px; margin: 0; }
.sheet-online .sheet-item + .sheet-tags, .sheet-online .sheet-tags + .sheet-item, .sheet-online .sheet-item + .sheet-item { border-top: 1px solid var(--line); }
.sheet-name { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.sheet-about { color: var(--text-2); font-size: 12px; font-weight: 400; }
.sheet-tags { padding: 0 12px 12px 40px; }
.sheet-tags .discover-pick { justify-content: flex-start; max-width: none; }
.sheet-tags .discover-pick .chips { justify-content: flex-start; }
.ready-line { display: flex; flex-direction: column; gap: 6px; padding: 12px; border-top: 1px solid var(--line); }
.ready-line:empty { display: none; }
.ready-meter { height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; }
.ready-meter i { display: block; height: 100%; background: var(--accent); transition: width 600ms ease; }
.ready-line small { color: var(--text-2); }
.chips.popular { align-items: center; flex-basis: 100%; justify-content: flex-end; }
.chips.popular small { color: var(--text-2); margin-right: 2px; }
.chips.popular .chip { font-size: 12px; }
.sheet-tags .chips.popular { justify-content: flex-start; }

/* how close: your answer lands on the meter with a short pulse */
.meter.told, .ring.told { animation: told 0.6s ease-out; }
@keyframes told { 0% { transform: scale(1.08); } 100% { transform: scale(1); } }
.meter, .ring { cursor: ns-resize; }
.chart .c-close { stroke: var(--text); stroke-width: 1.2; opacity: 0.75; }
.chart .c-self { fill: var(--accent); }
.chart-key .k-close::before { background: var(--text); }
.chart-key .k-self::before { width: 6px; height: 6px; border-radius: 50%; }
/* a video's own script is leading the beat and the toys */
.script-tag { position: absolute; top: 100px; right: 152px; padding: 2px 10px; font-size: 12px; color: rgba(247,247,245,0.75); }
.script-tag::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 6px; vertical-align: middle; background: var(--accent); }
#game.fs .script-tag { right: 32px; }
#game.hud-off .script-tag, #game.clean .script-tag { display: none; }
.end-extra { margin: 12px 0 0; }
/* the microphone is on: always visible while it is, above everything else in the session */
.mic-badge { position: absolute; left: 28px; bottom: 60px; z-index: 60; display: flex; align-items: center; gap: 10px; pointer-events: none; }
.mic-badge .mic-icon { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: #e5262f; flex: none; }
.mic-badge .mic-icon svg { width: 15px; height: 15px; }
.mic-badge.listening .mic-icon { animation: micpulse 1.8s ease-in-out infinite; }
.mic-badge.starting .mic-icon { background: rgba(229,38,47,0.45); animation: micdot 1.2s ease-in-out infinite; }
.mic-badge.error .mic-icon { background: rgba(247,247,245,0.25); animation: none; }
.mic-badge .mic-text { max-width: 0; overflow: hidden; white-space: nowrap; opacity: 0; padding: 0; font-size: 14px; color: #f7f7f5;
  background: rgba(12,12,12,0.8); border: 1px solid rgba(229,38,47,0.7); transition: max-width 220ms ease, opacity 220ms ease, padding 220ms ease; }
.mic-badge.says .mic-text { max-width: 420px; opacity: 1; padding: 6px 12px; }
@keyframes micpulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.45; transform: scale(0.9); } }
@keyframes micdot { 50% { opacity: 0.35; } }
/* teaching a voice phrase, in the pause menu */
.teach-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 16px; padding-top: 14px; border-top: 1px solid rgba(247,247,245,0.14); }
.teach-row .hint { flex: 1 1 220px; color: rgba(247,247,245,0.7); }
.teach-row select { background: transparent; color: inherit; border: 1px solid rgba(247,247,245,0.25); padding: 4px 6px; }
.teach-row select option { color: #111; }
.mic-badge.teaching .mic-icon { animation: micpulse 0.9s ease-in-out infinite; }
.phrase-list { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.phrase-list .phrase { display: flex; align-items: center; gap: 10px; }
.phrase-list .phrase span { color: var(--text-2); font-size: 13px; }

/* previous / next picture: a slim target at each side, fading with the other controls */
.side-arrow { position: absolute; top: 50%; transform: translateY(-50%); z-index: 6; width: 44px; height: 88px; display: grid; place-items: center;
  border: 0; border-radius: 6px; color: rgba(247,247,245,0.75); background: rgba(22,23,27,0.38); cursor: pointer; transition: opacity 240ms, background 160ms; }
.side-arrow svg { width: 22px; height: 22px; }
.side-arrow:hover { background: rgba(29,31,36,0.85); color: #f7f7f5; }
.side-arrow.l { left: 12px; }
.side-arrow.r { right: 12px; }
#game.beat-left .side-arrow.l { left: 84px; }
#game.beat-right .side-arrow.r { right: 84px; }
#game.idle .side-arrow, #game.hud-off .side-arrow { opacity: 0; }
#game.idle .side-arrow:hover { opacity: 1; }

/* technique windows: one way of stroking only, clearly marked */
.task.technique .t-title { color: var(--accent, #ff5a1f); }
.task.technique { outline: 1px solid color-mix(in srgb, var(--accent, #ff5a1f) 55%, transparent); outline-offset: 10px; }
.breath span small { display: block; font-size: 11px; opacity: 0.6; letter-spacing: 0.04em; margin-top: 2px; }
.pause-fs { display: flex; align-items: center; gap: 12px; margin: 4px 0 14px; flex-wrap: wrap; }
.pause-fs .btn svg { width: 14px; height: 14px; }
.media-switches { display: flex; gap: 8px; flex-wrap: wrap; }
.switch-chip { display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border: 1px solid var(--line, rgba(127,127,127,.35)); background: transparent; color: var(--text, inherit); font: inherit; cursor: pointer; border-radius: 4px; }
.switch-chip small { opacity: .6; font-variant-numeric: tabular-nums; }
.switch-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3, #888); opacity: .5; }
.switch-chip.on .dot { background: var(--accent, #ff5a1f); opacity: 1; }
.switch-chip:not(.on) { opacity: .7; }
.row-chips { padding: 0 17px 16px; margin-top: -6px; }

.thumb.missing { display: grid; place-items: center; background: var(--surface-2, rgba(127,127,127,.12)); min-height: 120px; }
.thumb.missing .kind { position: static; }

/* Settings rail: small group labels between the pages */
.settings-rail .rail-group { margin: 18px 0 4px; padding: 0 12px; font-family: var(--mono, 'IBM Plex Mono', monospace); font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-3, rgba(127,127,127,.8)); }
.settings-rail .rail-group:first-of-type { margin-top: 8px; }
.settings-rail .preset-item { padding-top: 7px; padding-bottom: 7px; }

/* Voices: one row per personality, its choices underneath */
.voice-pick-row { padding: 14px 16px; border-bottom: 1px solid var(--line, rgba(127,127,127,.2)); display: grid; gap: 10px; }
.voice-pick-row .label { display: flex; flex-direction: column; gap: 2px; }
.voice-pick-row .label small { color: var(--text-2); }
.voice-pick-row .switch-chip:disabled { opacity: .35; cursor: default; }
.rec-bar { display: flex; align-items: center; gap: 12px; }
.rec-bar .ready-meter { flex: 0 0 220px; }
.rec-bar small { color: var(--text-2); }

/* first-time tour: one real part of the screen lit at a time, a note beside it */
.tour-block { position: fixed; inset: 0; z-index: 70; }
.tour-hole { position: fixed; z-index: 71; border-radius: 8px; box-shadow: 0 0 0 9999px rgba(9,10,12,0.62); outline: 1px solid var(--line-2); pointer-events: none; transition: left 220ms ease, top 220ms ease, width 220ms ease, height 220ms ease; }
.tour-tip { position: fixed; z-index: 72; width: min(380px, calc(100vw - 24px)); max-height: calc(100vh - 24px); overflow: auto; padding: 20px; animation: fade 160ms ease; }
.tour-tip.centre { left: 50% !important; top: 50% !important; transform: translate(-50%, -50%); width: min(460px, calc(100vw - 24px)); box-shadow: 0 0 0 9999px rgba(9,10,12,0.62), var(--shadow); }
.tour-tip h2 { font-family: var(--font-display); font-weight: var(--display-weight); font-size: calc(19px * var(--display-scale)); margin: 4px 0 8px; text-transform: var(--display-case); }
.tour-tip p { margin: 0 0 4px; color: var(--text-2); line-height: 1.5; }
.tour-count { font-family: var(--num-font, inherit); font-size: 11px; letter-spacing: 0.1em; color: var(--text-3); }
.tour-keys { display: grid; grid-template-columns: auto 1fr; gap: 7px 14px; margin: 12px 0 4px; align-items: center; }
.tour-keys dt { margin: 0; }
.tour-keys dd { margin: 0; color: var(--text-2); }
.tour-keys kbd { display: inline-block; min-width: 26px; text-align: center; padding: 2px 7px; border: 1px solid var(--line-2); border-radius: 4px; font-family: var(--num-font, inherit); font-size: 11.5px; color: var(--text); background: var(--surface-2); }
.tour-tip .sheet-foot { margin-top: 16px; gap: 8px; }

/* side reels: a column of short looping clips on each side; the main picture stays whole in the middle */
#game { --reel-w: clamp(160px, 21vw, 440px); }
.reel { position: absolute; top: 0; bottom: 0; width: var(--reel-w); overflow: hidden; background: #000; }
.reel.l { left: 0; border-right: 1px solid rgba(255,255,255,0.08); }
.reel.r { right: 0; border-left: 1px solid rgba(255,255,255,0.08); }
.reel-media { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.reel-note { position: absolute; inset: auto 16px 50% 16px; transform: translateY(50%); margin: 0; text-align: center; font-size: 13px; line-height: 1.5; color: rgba(247,247,245,0.55); }
#game.with-reels .stage, #game.with-reels .flash, #game.with-reels .echo { left: var(--reel-w); right: var(--reel-w); width: auto; }
#game.with-reels .side-arrow.l { left: calc(var(--reel-w) + 12px); }
#game.with-reels .side-arrow.r { right: calc(var(--reel-w) + 12px); }
.folder-role .seg button { padding: 4px 9px; font-size: 11px; }
#game.with-reels .hud { left: var(--reel-w); right: var(--reel-w); }
.choice-list { display: grid; gap: 8px; margin: 16px 0 4px; }
.choice { display: grid; gap: 2px; text-align: left; padding: 12px 14px; border: 1px solid var(--line-2); border-radius: 6px; background: var(--surface-2); color: var(--text); cursor: pointer; font: inherit; }
.choice:hover, .choice:focus-visible { border-color: var(--text-2); background: var(--surface-3); }
.choice small { color: var(--text-2); }

/* change what is on screen */
.cust-layer { position: absolute; inset: 0; z-index: 40; background: rgba(9,10,12,0.35); }
.cust-boxes { position: absolute; inset: 0; }
.cust-box { position: fixed; border: 1.5px dashed rgba(247,247,245,0.85); border-radius: 6px; background: rgba(247,247,245,0.06); cursor: pointer; padding: 0; color: inherit; }
.cust-box:hover { background: rgba(247,247,245,0.16); border-style: solid; }
.cust-box.off { border-color: rgba(247,247,245,0.35); background: repeating-linear-gradient(135deg, rgba(9,10,12,0.55) 0 6px, rgba(9,10,12,0.3) 6px 12px); }
.cust-tag { position: absolute; left: 6px; top: -11px; padding: 1px 7px; border-radius: 4px; background: #f7f7f5; color: #121211; font-size: 11px; font-weight: 600; white-space: nowrap; }
.cust-box.off .cust-tag { background: #3a3a37; color: #f7f7f5; }
.cust-panel { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(440px, calc(100vw - 32px)); z-index: 41; color: var(--text); }
.cust-panel h2 { margin: 0 0 8px; font-size: 19px; }
.cust-panel p { margin: 0 0 12px; color: var(--text-2); line-height: 1.5; }
.cust-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 8px; }
.cust-menu { position: fixed; z-index: 45; min-width: 220px; padding: 4px; border: 1px solid rgba(247,247,245,0.18); border-radius: 6px; background: #1b1b1a; box-shadow: 0 10px 30px rgba(0,0,0,0.5); display: grid; }
.cust-menu button { text-align: left; padding: 8px 10px; border: 0; border-radius: 4px; background: none; color: #ecebe6; font: inherit; font-size: 13px; cursor: pointer; }
.cust-menu button:hover, .cust-menu button:focus-visible { background: #31312e; outline: none; }
.q-more { margin-top: 4px; }
.q-more > summary { cursor: pointer; padding: 10px 0; color: var(--text-2); font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; }
.q-wide { width: 100%; justify-content: center; }

/* "Watch how it works": a self-playing preview of a session */
.pv { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; background: rgba(9,10,12,0.82); animation: fade 200ms ease; }
.pv-frame { width: min(920px, calc(100vw - 32px)); display: grid; gap: 14px; }
.pv-screen { position: relative; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 8px; border: 1px solid rgba(247,247,245,0.16); background: #000; color: #f7f7f5; --rw: 0%; }
.pv-screen.reels { --rw: 21%; }
.pv-reel { position: absolute; top: 0; bottom: 0; width: var(--rw); transition: width 600ms ease; background: linear-gradient(160deg, #3b2a3f, #1d2330 50%, #402a28); background-size: 100% 300%; animation: pv-reel 4s ease-in-out infinite alternate; }
.pv-reel.l { left: 0; } .pv-reel.r { right: 0; animation-delay: -2s; }
@keyframes pv-reel { from { background-position: 0 0; } to { background-position: 0 100%; } }
.pv-stage { position: absolute; top: 0; bottom: 0; left: var(--rw); right: var(--rw); transition: left 600ms ease, right 600ms ease, opacity 600ms ease; display: grid; place-items: center; background: radial-gradient(ellipse at 50% 45%, #4a4038 0%, #221e1b 55%, #0f0e0d 100%); }
.pv-stage span { font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; color: rgba(247,247,245,0.45); }
.pv-screen.resting .pv-stage { opacity: 0.35; }
.pv-screen.ended .pv-stage { opacity: 0.2; }
.pv-task { position: absolute; left: calc(var(--rw) + 4%); top: 6%; transition: left 600ms ease; }
.pv-title { font-size: clamp(22px, 4vw, 40px); font-weight: 700; }
.pv-sub { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; opacity: 0.8; margin-top: 4px; }
.pv-beat { position: absolute; left: 50%; bottom: 8%; transform: translateX(-50%); display: flex; align-items: center; gap: 14px; padding: 10px 16px; border-radius: 6px; background: rgba(18,18,17,0.8); font-size: 12px; }
.pv-track { position: relative; width: clamp(140px, 24vw, 260px); height: 2px; background: rgba(247,247,245,0.3); }
.pv-dot { position: absolute; top: -6px; width: 14px; height: 14px; border-radius: 50%; background: #f7f7f5; }
.pv-screen.resting .pv-beat, .pv-screen.ended .pv-beat { opacity: 0.3; }
.pv-ring { position: absolute; left: 50%; top: 46%; width: 90px; height: 90px; margin: -45px 0 0 -45px; border-radius: 50%; border: 2px solid rgba(247,247,245,0.7); opacity: 0; }
.pv-screen.resting .pv-ring { opacity: 1; animation: pv-breathe 5s ease-in-out infinite; }
@keyframes pv-breathe { 0%, 100% { transform: scale(0.7); } 50% { transform: scale(1.15); } }
.pv-e { position: absolute; right: calc(var(--rw) + 5%); bottom: 9%; padding: 8px 14px; border-radius: 6px; border: 1px solid rgba(247,247,245,0.5); background: rgba(18,18,17,0.8); font-size: 15px; opacity: 0; transition: opacity 300ms, transform 120ms; }
.pv-e.show { opacity: 1; }
.pv-e.pressed { transform: scale(0.9); background: #ff5a1f; border-color: #ff5a1f; }
.pv-quick { position: absolute; top: 4%; right: calc(var(--rw) + 2%); width: 30%; padding: 12px; border-radius: 6px; background: rgba(27,27,26,0.95); font-size: 11px; display: grid; gap: 9px; transform: translateX(130%); transition: transform 450ms cubic-bezier(.2,.8,.2,1); }
.pv-screen.quick-open .pv-quick { transform: none; }
.pv-quick div { display: grid; gap: 4px; color: rgba(247,247,245,0.75); }
.pv-quick div i { height: 2px; background: linear-gradient(to right, #ff5a1f 55%, rgba(247,247,245,0.25) 55%); }
.pv-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(247,247,245,0.12); }
.pv-progress { display: block; height: 100%; width: 0; background: #ff5a1f; }
.pv-caption { margin: 0; min-height: 3em; font-size: 16px; line-height: 1.5; color: #ecebe6; text-align: center; }
.pv-foot { display: flex; align-items: center; gap: 8px; }
/* "At the edge" stays out of the way while stroking: it appears when a session asks for it, or with the mouse */
#game .edge-btn { transition: opacity 250ms ease, max-width 300ms ease, padding 300ms ease, margin 300ms ease; max-width: 220px; overflow: hidden; white-space: nowrap; }
#game.idle .edge-btn:not(.asked) { opacity: 0; max-width: 0; padding-left: 0; padding-right: 0; margin: 0; border-width: 0; pointer-events: none; }

/* beat marker shapes (Settings, Look, Session screen) */
html[data-beat-marker="bar"] #game .beat .dot { width: 5px; height: 26px; margin-left: -2.5px; top: -1px; border-radius: 2px; }
html[data-beat-marker="ring"] #game .beat .dot { width: 18px; height: 18px; margin-left: -9px; top: 3px; background: transparent !important; border: 2.5px solid #f7f7f5; box-sizing: border-box; }
html[data-beat-marker="bar"] #game.beat-left .beat .dot, html[data-beat-marker="bar"] #game.beat-right .beat .dot { width: 26px; height: 5px; margin: -2.5px 0 0; left: -1px; }

/* make it yours: colour swatches, screen styles */
.swatches { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line-2); cursor: pointer; padding: 0; position: relative; }
.swatch.theme { background: conic-gradient(var(--text-3) 0 25%, var(--surface-3) 0 50%, var(--text-3) 0 75%, var(--surface-3) 0); }
.swatch.on { outline: 2px solid var(--text); outline-offset: 2px; }
.swatch-custom { width: 34px; height: 30px; padding: 0; border: 1px solid var(--line-2); border-radius: 6px; background: none; cursor: pointer; }
.styles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.style-card { display: grid; gap: 4px; text-align: left; padding: 12px; border: 1px solid var(--line-2); border-radius: var(--r, 6px); background: var(--surface); color: var(--text); cursor: pointer; font: inherit; }
.style-card small { color: var(--text-2); line-height: 1.4; }
.style-card.on { border-color: var(--text); box-shadow: inset 0 0 0 1px var(--text); }
.style-card .mini { height: 46px; border-radius: 4px; background: #1b1b1a; position: relative; overflow: hidden; margin-bottom: 4px; }
.style-card .mini i { position: absolute; background: rgba(247,247,245,0.75); border-radius: 1px; }
.theme-pick { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; }
.theme-pick button { padding: 10px; border-radius: 6px; border: 1px solid var(--line-2); background: var(--surface-2); color: var(--text); cursor: pointer; font: inherit; text-align: left; }
.theme-pick button.on { border-color: var(--text); box-shadow: inset 0 0 0 1px var(--text); }
.yours h3 { margin: 16px 0 8px; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-2); }
.row-block { padding: 4px var(--row-x, 16px) 14px; }
.welcome.yours { width: min(760px, 94%); max-height: 92vh; overflow: auto; }
/* selection marks that every look keeps (some looks restyle all buttons) */
.swatches .swatch.on { outline: none !important; box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--text) !important; }
.styles .style-card.on, .theme-pick button.on { border-color: var(--text) !important; box-shadow: inset 0 0 0 1px var(--text), 0 0 0 1px var(--text) !important; }
/* help: the ? in the top bar */
.help-btn { width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line-2); background: none; color: var(--text-2); font: 600 13px/1 var(--font-body, inherit); cursor: pointer; margin-right: 6px; }
.help-btn:hover, .help-btn:focus-visible { color: var(--text); border-color: var(--text-2); }
.help-menu { position: fixed; z-index: 80; width: 280px; padding: 6px; border: 1px solid var(--line-2); border-radius: var(--r-lg, 8px); background: var(--surface); box-shadow: var(--shadow); display: grid; }
.help-menu button { display: grid; gap: 2px; text-align: left; padding: 9px 10px; border: 0; border-radius: var(--r, 6px); background: none; color: var(--text); font: inherit; cursor: pointer; }
.help-menu button small { color: var(--text-2); font-size: 12px; }
.help-menu button:hover, .help-menu button:focus-visible { background: var(--surface-2); outline: none; }
.tour-again, .welcome .welcome-again { margin: 10px 0 0 !important; font-size: 12.5px; color: var(--text-3) !important; }
.sheet-empty { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; }
.sheet-empty .hint { margin: 0; }
/* feedback */
.feedback { width: min(560px, 94%); max-height: 90vh; overflow: auto; gap: 12px; }
.feedback h2 { margin: 0; }
.feedback > p { margin: 0; color: var(--text-2); line-height: 1.5; }
.fb-q { display: grid; gap: 6px; }
.fb-q textarea { width: 100%; box-sizing: border-box; resize: vertical; padding: 8px 10px; border: 1px solid var(--line-2); border-radius: var(--r, 6px); background: var(--surface-2); color: var(--text); font: inherit; }
.fb-rate { display: flex; gap: 6px; }
.fb-rate button { width: 40px; height: 34px; border: 1px solid var(--line-2); border-radius: var(--r, 6px); background: var(--surface-2); color: var(--text); font: inherit; cursor: pointer; }
.fb-rate button.on { background: var(--text) !important; color: var(--surface) !important; }
.fb-check { display: flex; gap: 8px; align-items: flex-start; color: var(--text-2); font-size: 13px; }
.fb-info { margin: 0; padding: 8px 10px; border-radius: var(--r, 6px); background: var(--surface-2); color: var(--text-2); font-size: 12px; white-space: pre-wrap; }
.fb-nudge { margin: 12px 0 0; color: var(--text-2); font-size: 13px; }
.fb-nudge .linkish { background: none; border: 0; padding: 0; color: inherit; text-decoration: underline; cursor: pointer; font: inherit; }
/* no pace number and no tempo change: nothing beside the beat */
.beat .bpm:has(> span[hidden]):has(> .tempo[hidden]) { display: none; }

/* "Try it": small demos beside settings (views/try-it.js). Flat placeholder shapes, no pictures. */
.tryit-block { padding-top: 0; }
.tryit { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.ti-btn { min-width: 118px; }
.ti-note { flex: 1 1 180px; color: var(--text-2); line-height: 1.4; }
.ti-stage { width: 220px; aspect-ratio: 16 / 9; flex: none; border-radius: 6px; overflow: hidden; background: #111110; border: 1px solid var(--line-2); position: relative; }
.ti-tile { position: absolute; inset: 0; --beat: 0.6s; color: #f7f7f5; }
.ti-label { position: absolute; left: 6px; bottom: 4px; font-size: 9px; letter-spacing: 0.08em; text-transform: uppercase; color: rgba(247,247,245,0.5); }
.ti-pic { position: absolute; inset: 14% 18%; background: #3a3631; border-radius: 3px; }
.ti-beat { display: grid; place-items: center; align-content: center; gap: 10px; }
.ti-pips { display: flex; gap: 10px; }
.ti-pip { width: 14px; height: 14px; border-radius: 50%; background: rgba(247,247,245,0.2); transition: background 80ms, transform 80ms; }
.ti-pip.first { box-shadow: inset 0 0 0 2px rgba(247,247,245,0.55); }
.ti-pip.on { background: var(--accent); transform: scale(1.3); }
.ti-beat b { font-size: 11px; font-weight: 500; opacity: 0.8; }
.ti-space .ti-head { position: absolute; left: 50%; top: 50%; width: 34px; height: 34px; margin: -17px; border-radius: 50%; border: 1px solid rgba(247,247,245,0.5); display: grid; place-items: center; font-size: 9px; }
.ti-orbit-dot { position: absolute; left: 50%; top: 12%; width: 12px; height: 12px; margin: -6px; border-radius: 50%; background: var(--accent); }
.ti-space::before { content: ""; position: absolute; left: 50%; top: 50%; width: 76%; aspect-ratio: 1; transform: translate(-50%, -50%); border: 1px dashed rgba(247,247,245,0.25); border-radius: 50%; }
.ti-bounce .ti-pic { background: #4a4038; }
.ti-bounce.go .ti-pic { animation: ti-bounce var(--beat) ease-out infinite; }
@keyframes ti-bounce { 0% { scale: 1; } 18% { scale: var(--depth, 0.982); } 100% { scale: 1; } }
.ti-marker .ti-track { position: absolute; left: 14%; right: 14%; top: 50%; height: 2px; background: rgba(247,247,245,0.3); }
.ti-mark { position: absolute; top: -6px; left: 0; width: 14px; height: 14px; border-radius: 50%; background: #f7f7f5; }
.ti-marker.bar .ti-mark { width: 4px; height: 26px; top: -12px; border-radius: 1px; }
.ti-marker.ring .ti-mark { background: none; border: 2px solid #f7f7f5; box-sizing: border-box; width: 18px; height: 18px; top: -8px; }
.ti-marker.go .ti-mark { animation: ti-sweep calc(var(--beat) * 2) linear infinite alternate; }
@keyframes ti-sweep { from { left: 0; } to { left: calc(100% - 14px); } }
.ti-reels .ti-mid { position: absolute; top: 0; bottom: 0; left: 22%; right: 22%; background: #3a3631; }
.ti-col { position: absolute; top: 0; bottom: 0; width: 22%; display: grid; grid-template-rows: repeat(3, 1fr); gap: 3px; padding: 3px; box-sizing: border-box; overflow: hidden; }
.ti-col.l { left: 0; } .ti-col.r { right: 0; }
.ti-col i { background: #5a4a58; border-radius: 2px; }
.ti-col.r i { background: #4a5260; }
.ti-reels.go .ti-col i { animation: ti-loop 1.2s ease-in-out infinite alternate; }
.ti-reels.go .ti-col.r i { animation-delay: -0.6s; }
.ti-reels.go .ti-col i:nth-child(2) { animation-delay: -0.3s; }
@keyframes ti-loop { from { transform: translateY(-14%); opacity: 0.7; } to { transform: translateY(14%); opacity: 1; } }
.ti-fades .ti-half { position: absolute; top: 0; bottom: 0; width: 50%; overflow: hidden; }
.ti-fades .ti-half:first-child { left: 0; } .ti-fades .ti-half.slow { right: 0; border-left: 1px solid rgba(247,247,245,0.25); }
.ti-fades i { position: absolute; inset: 0; }
.ti-fades i.a { background: #4a4038; } .ti-fades i.b { background: #38455a; opacity: 0; }
.ti-fades.go .ti-half i.b { animation: ti-swap calc(var(--beat) * 6) steps(1, end) infinite; }
.ti-fades.go .ti-half.slow i.b { animation: ti-swapslow calc(var(--beat) * 6) linear infinite; }
@keyframes ti-swap { 0%, 49.9% { opacity: 0; } 50%, 100% { opacity: 1; } }
@keyframes ti-swapslow { 0%, 25% { opacity: 0; } 50%, 75% { opacity: 1; } 100% { opacity: 0; } }
.ti-dim .ti-state { position: absolute; right: 8px; top: 6px; font-size: 10px; opacity: 0; letter-spacing: 0.08em; text-transform: uppercase; }
.ti-dim .ti-pic { background: #4a4038; }
.ti-dim.go .ti-pic { animation: ti-dim 5s ease-in-out infinite; }
.ti-dim.go .ti-state { animation: ti-state 5s ease-in-out infinite; }
@keyframes ti-dim { 0%, 20% { opacity: 1; } 40%, 70% { opacity: 0.15; } 90%, 100% { opacity: 1; } }
@keyframes ti-state { 0%, 30% { opacity: 0; } 40%, 70% { opacity: 0.8; } 85%, 100% { opacity: 0; } }
.ti-open .ti-pic { background: #4a4038; opacity: 0; }
.ti-open.go .ti-pic { animation: ti-openin 5s ease-out forwards; }
@keyframes ti-openin { from { opacity: 0; } to { opacity: 1; } }
.ti-night .ti-pic { background: #4a4038; }
.ti-night::after { content: ""; position: absolute; inset: 0; background: rgb(255, 150, 60); opacity: 0; mix-blend-mode: multiply; }
.ti-night.go::after { animation: ti-night 5s ease-in-out forwards; }
@keyframes ti-night { from { opacity: 0; } to { opacity: calc(0.15 + 0.5 * var(--str, 0.6)); } }
.ti-soft { display: flex; align-items: center; justify-content: space-around; }
.ti-soft > div { position: relative; display: grid; justify-items: center; padding-bottom: 14px; }
.ti-soft .ti-label { left: 50%; bottom: -6px; transform: translateX(-50%); white-space: nowrap; }
.ti-flash-wrap .ti-warn { display: grid; gap: 8px; max-width: 520px; padding: 12px 14px; border: 1px solid var(--line-2); border-radius: 6px; }
.ti-warn small { color: var(--text-2); line-height: 1.45; }
.ti-warn .btn { justify-self: start; }
.ti-kinds { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.ti-flash .ti-pic { background: #4a4038; }
.ti-flash.go[data-kind="beatFlash"]::after, .ti-flash.go[data-kind="peakStrobe"]::after, .ti-flash.go[data-kind="edgeFlash"]::after { content: ""; position: absolute; inset: 0; opacity: 0; animation: ti-flash var(--beat) steps(1, end) infinite; }
.ti-flash.go[data-kind="beatFlash"]::after { background: #c9b8a0; }
.ti-flash.go[data-kind="peakStrobe"]::after { background: #8a8a88; }
.ti-flash.go[data-kind="edgeFlash"]::after { background: #b32a1d; }
.ti-flash.go[data-kind="punch"] .ti-pic { animation: ti-punch var(--beat) ease-out infinite; }
@keyframes ti-flash { 0% { opacity: calc(0.7 * var(--str, 0.6)); } 25%, 100% { opacity: 0; } }
@keyframes ti-punch { 0% { scale: 1; } 12% { scale: 0.9; } 100% { scale: 1; } }
@media (prefers-reduced-motion: reduce) { .ti-flash.go::after { animation: none !important; } }

/* the screen-style pictures move a little, so you see what each part does */
.style-card .mini i.m-beat { animation: mini-beat 2.4s ease-in-out infinite alternate; transform-origin: left; }
.style-card .mini i.m-ring { animation: mini-ring 2.4s ease-in-out infinite; border-radius: 50%; }
.style-card .mini i.m-progress { animation: mini-progress 8s linear infinite; transform-origin: left; }
.style-card .mini i.m-task { animation: mini-task 4.8s steps(1, end) infinite; }
@keyframes mini-beat { from { transform: scaleX(0.3); } to { transform: scaleX(1); } }
@keyframes mini-ring { 0%, 100% { transform: scale(0.75); } 50% { transform: scale(1.1); } }
@keyframes mini-progress { from { transform: scaleX(0.05); } to { transform: scaleX(1); } }
@keyframes mini-task { 0%, 49.9% { opacity: 0.75; } 50%, 100% { opacity: 0.45; } }
@media (prefers-reduced-motion: reduce) { .style-card .mini i { animation: none !important; } }

/* screen layout: a picture of the screen, a status line, and a Middle / Sides tick for every source */
.layout-setup { display: grid; gap: 16px; padding: 18px var(--row-x, 16px); }
.lay-top { display: grid; grid-template-columns: minmax(0, 1fr) minmax(200px, 260px); gap: 20px; align-items: center; }
.lay-screen { display: grid; grid-template-columns: 0fr 1fr 0fr; aspect-ratio: 16 / 7; border-radius: var(--r, 6px); overflow: hidden; border: 1px solid var(--line-2); background: #111; transition: grid-template-columns 300ms ease; }
.lay-screen.with-sides { grid-template-columns: 1fr 2.6fr 1fr; }
.lay-pane { display: grid; align-content: center; justify-items: center; gap: 4px; padding: 10px; min-width: 0; overflow: hidden; text-align: center; color: #f7f7f5; }
.lay-pane.m { background: #2a2622; }
.lay-pane.l, .lay-pane.r { background: #1c1f26; }
.lay-pane.l { border-right: 1px solid rgba(255,255,255,0.08); } .lay-pane.r { border-left: 1px solid rgba(255,255,255,0.08); }
.lay-pane b { font-size: 13px; white-space: nowrap; }
.lay-pane small { font-size: 11.5px; color: rgba(247,247,245,0.65); }
.lay-pane.off small { color: rgba(247,247,245,0.4); }
.lay-side-switch { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; }
.lay-side-switch small { grid-column: 1; color: var(--text-2); line-height: 1.4; }
.lay-side-switch .toggle { grid-row: 1 / span 2; grid-column: 2; }
.lay-status p { margin: 0; line-height: 1.5; }
.lay-status { padding: 10px 12px; border-radius: var(--r, 6px); border: 1px solid var(--line-2); background: var(--surface-2); }
.lay-status.warn { border-color: var(--accent); }
.lay-status.warn p + p { margin-top: 4px; }
.lay-table { display: grid; }
.lay-head, .lay-row { display: grid; grid-template-columns: minmax(0, 1fr) 150px 150px; gap: 12px; align-items: center; padding: 9px 0; border-top: 1px solid var(--line); }
.lay-head { border-top: 0; padding-top: 0; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); }
.lay-src { display: grid; gap: 2px; min-width: 0; }
.lay-src b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lay-src small { color: var(--text-2); }
.lay-tick { display: flex; gap: 8px; align-items: center; cursor: pointer; }
.lay-tick.disabled { opacity: 0.45; cursor: default; }
.lay-tick input { width: 16px; height: 16px; accent-color: var(--accent); }
@media (max-width: 900px) { .lay-top { grid-template-columns: 1fr; } .lay-head, .lay-row { grid-template-columns: minmax(0, 1fr) 90px 90px; } }

/* online rules: never show, show more of, quality */
.rules { display: grid; gap: 10px; justify-items: end; min-width: min(420px, 45vw); }
.rule-add { display: flex; gap: 6px; }
.rule-input { width: 200px; padding: 6px 10px; border: 1px solid var(--line-2); border-radius: var(--r, 6px); background: var(--surface-2); color: var(--text); font: inherit; }
.rule { width: 100%; display: grid; gap: 6px; padding: 8px 10px; border: 1px solid var(--line-2); border-radius: var(--r, 6px); }
.rule-head { display: flex; justify-content: space-between; align-items: center; }
.rule-takes small { color: var(--text-2); }
.rule-tag.allowed { text-decoration: line-through; opacity: 0.55; }
.chip-x { border: 0; background: none; color: var(--text-2); cursor: pointer; font-size: 15px; line-height: 1; padding: 0 0 0 6px; }
.rule-ticks { display: flex; flex-wrap: wrap; gap: 14px; justify-content: flex-end; }
.row.stacked { flex-direction: column; align-items: stretch; gap: 10px; }
.row.stacked > .label { max-width: none; }
.row.stacked .rules { justify-items: start; min-width: 0; width: 100%; }
.row.stacked .rule-ticks { justify-content: flex-start; }
.adv-switch { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 18px; padding: 12px 10px 4px; border-top: 1px solid var(--line); cursor: pointer; }
.adv-switch span { display: grid; gap: 2px; }
.adv-switch small { color: var(--text-3); font-size: 11.5px; }
