/* Layout: same column as v1. The player leads, then practice, auto-chime and the key. Each part of the day keeps its colour. */
:root {
  --bg: #f2f3f7;
  --surface: #ffffff;
  --fg: #1a1c29;
  --muted: #5b6075;
  --line: #dadde7;
  --accent: #3442c0;
  --b0: #237586;  /* early hours */
  --b1: #b9800c;  /* morning */
  --b2: #c4542e;  /* afternoon */
  --b3: #6a48a2;  /* evening */
  --good: #1f7a4a;
  --bad: #b3372b;
  --font-display: "Bricolage Grotesque", "Instrument Sans", system-ui, sans-serif;
  --font-body: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "DM Mono", ui-monospace, "SF Mono", Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #10121b; --surface: #181b27; --fg: #e7e8f1; --muted: #9a9fb5; --line: #2a2e40; --accent: #8e99ff;
    --b0: #4db2c3; --b1: #e6b146; --b2: #ee8057; --b3: #a687dd; --good: #55c48a; --bad: #f07a6c;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #10121b; --surface: #181b27; --fg: #e7e8f1; --muted: #9a9fb5; --line: #2a2e40; --accent: #8e99ff;
  --b0: #4db2c3; --b1: #e6b146; --b2: #ee8057; --b3: #a687dd; --good: #55c48a; --bad: #f07a6c;
  color-scheme: dark;
}

* { box-sizing: border-box; }
body {
  background: var(--bg); color: var(--fg);
  font: 16px/1.55 var(--font-body);
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
main { max-width: 980px; margin: 0 auto; padding-block: 40px 72px; display: grid; gap: 28px; }
h1, h2, h3 { font-family: var(--font-display); text-wrap: balance; margin: 0; line-height: 1.15; }
h1 { font-size: clamp(34px, 6vw, 48px); font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: 24px; font-weight: 700; }
h3 { font-size: 17px; font-weight: 600; }
p { margin: 0; }
a { color: var(--accent); }
.lede { max-width: 64ch; color: var(--muted); font-size: 17px; }
.head { display: grid; gap: 12px; }
.eyebrow { font: 500 12px var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 24px; display: grid; gap: 22px; min-width: 0; }
.card-head { display: grid; gap: 6px; }
.card-head p { color: var(--muted); max-width: 64ch; }

.btn {
  font: 600 15px var(--font-body); padding: 10px 18px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); color: var(--fg);
  cursor: pointer; display: inline-flex; gap: 8px; align-items: center; white-space: nowrap;
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.btn.primary:hover { opacity: 0.9; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn svg { width: 14px; height: 14px; fill: currentColor; }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.player-top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; align-items: end; }
.readout { display: grid; gap: 2px; }
.readout .time { font: 500 56px/1 var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.readout .blockname { font-weight: 600; color: var(--cur); }

/* day band */
.band { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.blk { display: grid; gap: 8px; min-width: 0; }
.blk[data-b="0"], [data-b="0"] { --c: var(--b0); } .blk[data-b="1"], [data-b="1"] { --c: var(--b1); }
.blk[data-b="2"], [data-b="2"] { --c: var(--b2); } .blk[data-b="3"], [data-b="3"] { --c: var(--b3); }
.blk-head { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); border-top: 3px solid var(--c); padding-top: 6px; line-height: 1.35; min-width: 0; }
.blk-head b { color: var(--fg); font-size: 13px; font-weight: 600; }
.contour { width: 30px; height: 16px; flex: none; }
.contour polyline { fill: none; stroke: var(--c); stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.contour circle { fill: var(--c); }
.cells { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 3px; align-items: end; }
.cell { appearance: none; border: 0; background: transparent; padding: 0; cursor: pointer; display: grid; gap: 4px; font: inherit; color: inherit; border-radius: 4px; }
.cell .pips { display: flex; flex-direction: column-reverse; gap: 2px; align-items: center; min-height: 44px; justify-content: flex-start; padding-top: 2px; }
.cell .pips i { width: 6px; height: 6px; border-radius: 50%; background: color-mix(in srgb, var(--c) 40%, transparent); }
.cell .pips i.hi { width: 5px; height: 5px; background: transparent !important; box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--c) 60%, transparent); }
.cell[aria-pressed="true"] .pips i.hi { box-shadow: inset 0 0 0 1.5px var(--c); }
.tg { display: flex; gap: 4px; align-items: center; height: 22px; }
.tg i { width: 10px; height: 10px; border-radius: 50%; background: var(--fg); }
.tg i.hi { width: 7px; height: 7px; background: transparent; box-shadow: inset 0 0 0 2px var(--fg); }
.cell .pips .zero { width: 10px; height: 2px; border-radius: 1px; background: color-mix(in srgb, var(--c) 40%, transparent); }
.cell:hover .pips i, .cell:hover .pips .zero { background: color-mix(in srgb, var(--c) 70%, transparent); }
.cell[aria-pressed="true"] .pips i, .cell[aria-pressed="true"] .pips .zero { background: var(--c); }
.cell .hr { font: 11px var(--font-mono); color: var(--muted); text-align: center; font-variant-numeric: tabular-nums; }
.cell[aria-pressed="true"] { background: color-mix(in srgb, var(--c) 12%, transparent); }
.cell[aria-pressed="true"] .hr { color: var(--fg); font-weight: 500; }
@media (max-width: 560px) {
  .band { gap: 6px; }
  .blk-head b { font-size: 11px; }
  .blk-head .contour { display: none; }
  .cell:nth-child(3n+2) .hr, .cell:nth-child(3n+3) .hr { visibility: hidden; }
}

.seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 3px; background: var(--bg); }
.seg button { border: 0; background: transparent; font: 500 14px var(--font-mono); padding: 7px 14px; border-radius: 7px; color: var(--muted); cursor: pointer; font-variant-numeric: tabular-nums; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--fg); box-shadow: 0 1px 2px rgb(0 0 0 / 0.14); }
.label { font: 500 12px var(--font-mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }

/* score */
.score { background: var(--bg); border-radius: 10px; padding: 8px 6px 2px; overflow-x: auto; }
.score svg { display: block; width: 100%; min-width: 440px; height: auto; }
.score .guide { stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 4; }
.score .axis { stroke: var(--line); stroke-width: 1; }
.score .lbl { fill: var(--muted); font: 11px var(--font-mono); }
.score .sol { fill: var(--fg); font: 500 11px var(--font-mono); }
.score .ph-n { fill: var(--cur); opacity: 0.75; transition: opacity 0.12s; }
.score .ph-line { stroke: var(--cur); stroke-width: 1.5; opacity: 0.35; fill: none; }
.score .tk { fill: var(--fg); opacity: 0.45; transition: opacity 0.12s; }
.score .tk.hi { fill: none; stroke: var(--fg); stroke-width: 2; }
.score .ch { fill: var(--fg); opacity: 0.3; transition: opacity 0.12s; }
.score .on { opacity: 1; }
.score .ch.on { opacity: 0.7; }
.score .ph { stroke: var(--fg); stroke-width: 1.5; opacity: 0; }

.parts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.part { display: grid; gap: 4px; align-content: start; min-width: 0; }
.part .v { font-weight: 600; }
.part .d { color: var(--muted); font-size: 14px; }
@media (max-width: 680px) { .parts { grid-template-columns: 1fr; } }

/* practice */
.qgroup { display: grid; gap: 8px; }
.opts { display: grid; gap: 8px; }
.opts.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.opts.six { grid-template-columns: repeat(6, minmax(0, 1fr)); }
@media (max-width: 640px) { .opts.four { grid-template-columns: repeat(2, minmax(0, 1fr)); } .opts.six { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.opt {
  appearance: none; font: inherit; color: var(--fg); background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px; cursor: pointer; display: grid; gap: 4px; justify-items: start; text-align: left; min-width: 0;
}
.opt:hover:not(:disabled) { border-color: var(--muted); }
.opt[aria-pressed="true"] { border-color: var(--fg); box-shadow: inset 0 0 0 1px var(--fg); }
.opt:disabled { opacity: 0.45; cursor: not-allowed; }
.opt .t { font-weight: 600; font-size: 14px; }
.opt .s { font-size: 12px; color: var(--muted); }
.opt.center { justify-items: center; text-align: center; }
.tdots { font: 500 16px var(--font-mono); letter-spacing: 1px; min-height: 22px; white-space: pre; }
.notes { display: flex; gap: 3px; align-items: end; height: 22px; }
.notes i { width: 8px; height: 8px; border-radius: 50%; background: var(--fg); }
.notes.w0 i { width: 10px; height: 10px; }
.notes.w1 i, .notes.w3 i { width: 6px; height: 6px; opacity: 0.55; }
.seg button.w0 { font-weight: 700; color: var(--fg); }
.seg button.w1, .seg button.w3 { font-size: 12px; }

.feedback { display: grid; gap: 14px; padding: 18px; border-radius: 12px; background: var(--bg); }
.fb-line { font-size: 17px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { font-size: 13px; font-weight: 600; padding: 4px 10px; border-radius: 999px; border: 1px solid currentColor; }
.chip.ok { color: var(--good); } .chip.no { color: var(--bad); }
.stats { font-size: 14px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center; }
.stats b { color: var(--fg); font-weight: 600; font-variant-numeric: tabular-nums; }
.linkbtn { border: 0; background: none; color: var(--muted); text-decoration: underline; cursor: pointer; font: inherit; padding: 0; }

.chime { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; align-items: center; }
.chime p { color: var(--muted); max-width: 60ch; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); margin-right: 8px; vertical-align: middle; }
.chime.live .dot { background: var(--good); box-shadow: 0 0 0 4px color-mix(in srgb, var(--good) 25%, transparent); }

/* key */
.key { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 760px) { .key { grid-template-columns: 1fr; } }
.key .card { gap: 14px; align-content: start; }
.key p { color: var(--muted); font-size: 14px; }
.keygrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.keygrid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.mini { appearance: none; font: inherit; border: 1px solid var(--line); background: var(--surface); color: var(--fg); border-radius: 8px; padding: 8px; cursor: pointer; text-align: left; display: grid; gap: 4px; font-size: 13px; min-width: 0; }
.mini:hover { border-color: var(--muted); }
.mini small { color: var(--muted); font-size: 11px; font-family: var(--font-mono); }
.mini .tdots { font-size: 14px; min-height: 0; }
.compare { font-size: 14px; color: var(--muted); }
footer { color: var(--muted); font-size: 13px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
.ag { display: flex; gap: 3px; align-items: end; height: 22px; }
.ag i { width: 5px; background: var(--fg); border-radius: 2px; }
.ag i.oct { background: var(--accent); }
.cell .pips i.oct { width: 9px; height: 9px; }
.score .ar { fill: var(--fg); opacity: 0.5; transition: opacity 0.12s; }
.versions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.versions .label { margin-right: 4px; }
.versions a, .versions .cur { font: 500 13px var(--font-mono); padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--fg); text-decoration: none; }
.versions a:hover { border-color: var(--muted); }
.versions .cur { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.versions a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.versions-note { font-size: 14px; color: var(--muted); max-width: 64ch; }
