/* Layout: Notion-style page; a vertical segmented dial with six notches, stat cards dragged onto the notches, one Check button. */
:root {
  --bg: #f1f1ee;        /* overcast paper, slightly cool */
  --page: #f8f8f6;
  --ink: #2c2c29;
  --muted: #85847d;
  --line: #e0dfda;
  --chip: #e7e6e1;
  --face: #e9e8e2;      /* dial face */
  --face-edge: #d3d2ca;
  --bezel: #3a3a37;
  --bezel-hi: #6b6a65;
  --tick: #33332f;
  --needle: #9a3d31;    /* tired brick red */
  --good: #4f7a5a;      /* faded ledger green */
  --glass: rgba(255,255,255,.35);
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: Inter, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #1b1b1a; --page: #222221; --ink: #e4e3dd; --muted: #8d8c85; --line: #34342f; --chip: #2e2e2b;
  --face: #2c2c29; --face-edge: #3d3d39; --bezel: #121211; --bezel-hi: #4a4a46; --tick: #d9d8d0; --needle: #c25a49; --glass: rgba(255,255,255,.06); --good: #7fa888;
  color-scheme: dark } }
:root[data-theme="dark"] {
  --bg: #1b1b1a; --page: #222221; --ink: #e4e3dd; --muted: #8d8c85; --line: #34342f; --chip: #2e2e2b;
  --face: #2c2c29; --face-edge: #3d3d39; --bezel: #121211; --bezel-hi: #4a4a46; --tick: #d9d8d0; --needle: #c25a49; --glass: rgba(255,255,255,.06); --good: #7fa888;
  color-scheme: dark }

[hidden] { display: none !important; }
html, body { min-height: 100%; }
body { background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 15px; line-height: 1.5;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); padding-block: 40px 56px; }
.page { max-width: 980px; margin: 0 auto; background: var(--page); border: 1px solid var(--line); border-radius: 4px; padding: 36px clamp(18px, 6vw, 56px) 40px; }

h1 { font-family: var(--serif); font-weight: 600; font-size: 34px; line-height: 1.15; margin: 14px 0 18px; letter-spacing: -.01em; text-wrap: balance; }
.kicker { margin: -12px 0 18px; display: flex; align-items: center; justify-content: space-between; gap: 12px; font-family: var(--mono); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.prog { display: inline-flex; align-items: center; gap: 10px; letter-spacing: .04em; text-transform: none; }
.dots { display: inline-flex; gap: 5px; }
.dots i { width: 9px; height: 9px; border-radius: 50%; border: 1px solid var(--muted); }
.dots i.on { background: var(--ink); border-color: var(--ink); }
.dots i.ok { background: var(--good); border-color: var(--good); }
.dots i.bad { background: var(--needle); border-color: var(--needle); }
.lede { margin: 0 0 4px; font-size: 16px; color: var(--ink); max-width: 40ch; }

.play { display: grid; grid-template-columns: 1fr 1fr; gap: 0 36px; margin-top: 22px; padding-top: 22px; border-top: 1px solid var(--line); align-items: start; }
.board { position: relative; display: grid; grid-template-columns: 58px 1fr; gap: 0 14px; height: 600px; }
.side { display: grid; gap: 18px; align-content: start; }
.dial { position: relative; height: 100%; }
.dial .seg { position: absolute; right: 0; width: 16px; border-radius: 2px; background: var(--chip); border: 1px solid var(--line); box-sizing: border-box; }
.dial .seg.lit { background: var(--ink); border-color: var(--ink); }
.dial .end { position: absolute; right: -8px; width: 32px; text-align: center; font: 600 15px var(--mono); color: var(--ink); }
.notch { position: absolute; left: 0; right: -14px; height: 0; }
.notch b { position: absolute; left: -6px; right: 36px; top: var(--label-y, 0px); transform: translateY(-50%); text-align: right; font: 600 12.5px var(--mono); color: var(--ink); }
.notch::after { content: ""; position: absolute; right: -14px; width: 34px; top: -1px; border-top: 2px solid var(--needle); }
.slots { position: relative; height: 100%; }
.slot { position: absolute; left: 0; right: 0; height: var(--sh, 54px); transform: translateY(-50%); border: 1.5px dashed var(--line); border-radius: 6px; display: flex; align-items: stretch; transition: border-color .15s, background .15s; }
.slot.hot { border-color: var(--needle); background: color-mix(in srgb, var(--needle) 6%, transparent); }
.slot.armed { border-color: var(--muted); }
.slot .card { flex: 1; margin: -1.5px; min-height: 0; min-width: 0; overflow: hidden; }
.slots, .slot { min-width: 0; }
.slot .card .lbl { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.compact .slot .card .lbl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.compact .slot .card { font-size: 11px; gap: 8px; padding: 0 8px; }
.compact .slot .card .ico { font-size: 15px; width: 18px; }

.pool { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; min-height: 54px; }
.done .pool { display: none; }
.pool.empty::before { content: "All six placed"; display: block; text-align: center; font: 400 12px var(--mono); color: var(--muted); letter-spacing: .08em; text-transform: uppercase; padding: 18px 0; border: 1.5px dashed var(--line); border-radius: 6px; }
.card { display: flex; align-items: center; gap: 12px; padding: 0 14px; min-height: 54px; box-sizing: border-box; border-radius: 6px; background: var(--bg); border: 1px solid var(--line);
  font: 600 12.5px/1.25 var(--sans); letter-spacing: .04em; text-transform: uppercase; color: var(--ink); cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.card .ico { font-size: 19px; width: 22px; text-align: center; filter: saturate(.55) contrast(.95); flex: none; }
.card .lbl { flex: 1; min-width: 0; }
.card .fb { flex: none; padding: 1px 6px; border-radius: 3px; font: 600 12.5px var(--mono); letter-spacing: 0; }
.card .fb.off { color: var(--needle); background: color-mix(in srgb, var(--needle) 12%, transparent); }
.card .fb.ok { color: var(--good); background: color-mix(in srgb, var(--good) 14%, transparent); font-size: 14px; }
.card.sel { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.card.ghost { opacity: .35; }
.card.drag { position: fixed; z-index: 50; pointer-events: none; box-shadow: 0 10px 24px rgba(0,0,0,.18); background: var(--page); transform: rotate(-1.5deg); cursor: grabbing; }
.card.right { border-color: var(--good); box-shadow: inset 3px 0 0 var(--good); }
.card.wrong { border-color: var(--needle); box-shadow: inset 3px 0 0 var(--needle); }
.done .card { cursor: default; }

.result { display: grid; gap: 12px; align-content: start; }
.score { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); }
.score-n { font: 600 40px/1 var(--serif); font-variant-numeric: tabular-nums; }
.score-l { font: 400 11px/1.35 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.pctl { margin: 0; font-size: 14px; color: var(--ink); }
.pctl b { font-weight: 600; }
.res-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.res-actions button { flex: 1; min-width: 140px; }
.sheet::backdrop { background: rgba(20,20,18,.35); }
.sheet { position: fixed; inset: auto auto 0 50%; margin: 0; color: var(--ink); max-width: 100%; transform: translateX(-50%); width: min(560px, 100%); box-sizing: border-box; max-height: 80dvh; overflow-y: auto;
  background: var(--page); border: 1px solid var(--line); border-bottom: 0; border-radius: 10px 10px 0 0; box-shadow: 0 -10px 30px rgba(0,0,0,.15);
  padding: 16px max(16px, env(safe-area-inset-left, 0px)) calc(18px + env(safe-area-inset-bottom, 0px)); animation: up .22s ease-out; }
@keyframes up { from { transform: translate(-50%, 30px); opacity: 0; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.sheet h2 { margin: 0; font: 500 12px var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.sheet h2.perfect { color: var(--good); }
.sheet-head button { padding: 5px 12px; font-size: 13px; }
.toast { position: absolute; z-index: 5; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%); width: max-content; background: var(--ink); color: var(--page);
  font: 500 13.5px var(--sans); padding: 9px 16px; border-radius: 6px; box-shadow: 0 6px 20px rgba(0,0,0,.2); max-width: calc(100% - 32px); box-sizing: border-box; text-align: center; }
.manual { display: block; width: 100%; min-height: 90px; margin-top: 8px; font: 12px var(--mono); color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 4px; padding: 8px; box-sizing: border-box; }
.slot.need { border-color: var(--needle); animation: nudge .35s ease-in-out 2; }
@keyframes nudge { 50% { transform: translateY(-50%) translateX(4px); } }
@media (prefers-reduced-motion: reduce) { .sheet, .slot.need { animation: none; } }
.result h2 { margin: 6px 0 0; font: 500 12px var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.result.perfect h2 { color: var(--good); }
.sol { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.sol li { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 6px; background: var(--bg); font: 600 12px/1.25 var(--sans); letter-spacing: .03em; text-transform: uppercase; }
.sol li .p { font: 600 13px var(--mono); width: 38px; flex: none; text-align: right; }
.sol li .ico { font-size: 16px; filter: saturate(.55) contrast(.95); flex: none; }
.sol li.miss { box-shadow: inset 3px 0 0 var(--good); }
.done .actions { display: none; }
.done .side { grid-template-rows: auto; overflow-y: auto; min-height: 0; }
.actions { display: flex; justify-content: center; align-items: flex-start; }
button { font: 500 14px var(--sans); color: var(--ink); background: var(--page); border: 1px solid var(--line); border-radius: 4px; padding: 8px 22px; cursor: pointer; }
button.primary { background: var(--ink); color: var(--page); border-color: var(--ink); }
button.primary:hover:not(:disabled) { opacity: .88; }
button:disabled { opacity: .4; cursor: default; }
button:focus-visible, .card:focus-visible, .slot:focus-visible, .promo:focus-visible { outline: 2px solid var(--needle); outline-offset: 2px; }
/* phones / narrow: one screen, top half the dial + slots, bottom half the cards */
@media (max-width: 760px) {
  body { margin: 0; padding-block: calc(10px + env(safe-area-inset-top, 0px)) calc(10px + env(safe-area-inset-bottom, 0px)); }
  .page { padding: 18px 14px 14px; height: calc(100dvh - 20px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; box-sizing: border-box; }
  h1 { font-size: 26px; margin: 0 0 14px; } .kicker { margin: -8px 0 8px; } .lede { font-size: 14px; }
  .play { flex: 1; min-height: 0; grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; gap: 12px; margin-top: 12px; padding-top: 12px; align-items: stretch; }
  .board { height: auto; min-height: 0; grid-template-columns: 50px 1fr; gap: 0 10px; }
  .side { min-height: 0; grid-template-rows: 1fr auto; gap: 10px; }
  .pool { overflow-y: auto; min-height: 0; align-content: start; }
  .card { gap: 10px; padding: 0 10px; font-size: 11.5px; letter-spacing: .02em; min-height: 46px; } .card .ico { font-size: 17px; width: 20px; }
  .dial .end { font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) { .slot, .card { transition: none; } }

.notch::before { content: ""; position: absolute; right: -14px; top: var(--leader-top, 0px); height: var(--leader-height, 0px); border-right: 1px solid var(--needle); }
.slot { box-sizing: border-box; }
.actions, .res-actions { position: relative; }
.curve { display: block; width: 100%; }
.curve-area { fill: var(--chip); }
.curve-line { fill: none; stroke: var(--muted); stroke-width: 1.5; }
.curve-axis { stroke: var(--face-edge); }
.curve-marker { stroke: var(--ink); stroke-dasharray: 2 3; }
.curve-dot { fill: var(--ink); }
.curve text { font: 11px var(--mono); fill: var(--muted); }
.curve .lab { fill: var(--ink); font-weight: 500; }
.next { margin: 0; font: 12px var(--mono); color: var(--muted); }
.next b, .next a { color: var(--ink); }
.promos { display: grid; gap: 6px; }
.promo { display: flex; align-items: center; gap: 10px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 6px;
  background: var(--bg); color: var(--ink); text-decoration: none; }
.promo:hover { border-color: var(--muted); }
.promo-ico { font-size: 17px; filter: saturate(.55) contrast(.95); }
.promo-txt { display: grid; flex: 1; font-size: 12px; }
.promo-kicker, .promo-go { color: var(--muted); }
@media (max-width: 760px) {
  .kicker { flex-wrap: wrap; gap: 2px 8px; }
  .pool { container-type: size; gap: 5px; }
  .pool .card { height: clamp(27px, calc((100cqh - 25px) / 6), 46px); min-height: 0; }
  .done .side { grid-template-rows: max-content; scrollbar-width: thin; }
  .result { gap: 8px; }
  .res-actions button { min-width: 0; padding-inline: 8px; }
  .curve { max-height: 96px; }
}
@media (max-width: 760px) and (max-height: 530px) {
  .pool:not(.empty) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pool .card { height: clamp(27px, calc((100cqh - 10px) / 3), 46px); }
}
