/* Palette. taali's name is a clap, and a clap is two hands meeting, so the page has two inks, one for each hand, and a third where they overlap.
   Teal is the block you hold; plum is the slot that takes it; ink, the near-black of the overlap, is what is decided. Teal and plum are
   each a hue none of the other builders use (SYNTAX is cobalt and amber, ungli violet, jaisa verdigris and copper, boardgameBuilder four slate
   accents), on a cool paper that leaves them room. Colour carries meaning only here: teal = a block, plum = a slot, ink = decided.
   Every edge is --line (#7b7784), which is 3:1 or more against the paper and the sheet it sits on, measured in build.py. */
@font-face { font-family: "Schibsted Grotesk"; src: url(fonts/schibsted-grotesk.woff2) format("woff2"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: "Spline Sans Mono"; src: url(fonts/spline-sans-mono.woff2) format("woff2"); font-weight: 400 700; font-display: swap; }
:root {
  --paper: #f3f2ef; --sheet: #fbfaf8; --ink: #1d1b24; --ink2: #4a4753; --line: #7b7784; --faint: #d4d1d8;
  --teal: #178282; --plum: #732660; --teal-wash: #e4f0f0; --plum-wash: #f2e5ee;
  --sans: "Schibsted Grotesk", "Helvetica Neue", Arial, sans-serif; --mono: "Spline Sans Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html { background: var(--paper); }
body { margin: 0; background: var(--paper); color: var(--ink); font: 15px/1.45 var(--sans); }
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; }
h2, h3, h4 { margin: 0; font-weight: 700; }
p { margin: 0 0 8px; }
a { color: var(--teal); }

header { display: flex; align-items: center; gap: 18px; padding: 10px 18px; border-bottom: 1px solid var(--line); background: var(--sheet); flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand svg { width: 40px; height: 40px; }
.brand b { font-size: 30px; letter-spacing: -1px; }
.lede { color: var(--ink2); margin: 0; flex: 1 1 260px; }
nav { display: flex; gap: 6px; flex-wrap: wrap; }
nav button, .btn { background: var(--sheet); border: 1px solid var(--line); border-radius: 6px; padding: 6px 12px; }
nav button:hover, .btn:hover { background: var(--teal-wash); }
nav button:focus-visible, .btn:focus-visible, .x:focus-visible, #tabs button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid var(--teal); outline-offset: 1px; }
.btn.q { color: var(--ink2); }

.app { display: grid; grid-template-columns: minmax(250px, 310px) minmax(0, 1fr) minmax(300px, 390px); height: calc(100vh - 62px); min-height: 560px; }
.app > * { overflow-y: auto; padding: 14px 16px 28px; }
.blocks { border-right: 1px solid var(--line); background: var(--sheet); }
.reading { border-left: 1px solid var(--line); background: var(--sheet); }
.blocks h2, .reading h2, .task h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink2); margin-bottom: 6px; }
.group { margin: 14px 0 6px; }
.group h3 { display: flex; justify-content: space-between; align-items: baseline; font-size: 15px; }
em { font-style: normal; font-size: 12px; color: var(--ink2); }
em.essential { color: var(--plum); font-weight: 700; }
.what { color: var(--ink2); font-size: 13px; margin: 2px 0 6px; }
.block { background: var(--sheet); border: 1px solid var(--line); border-left: 5px solid var(--teal); border-radius: 6px; padding: 6px 9px; margin-bottom: 6px; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.block:hover { background: var(--teal-wash); }
.block b { display: block; font-size: 14px; }
.block span { display: block; font-size: 12px; color: var(--ink2); line-height: 1.3; }
.ghost { position: fixed; z-index: 30; pointer-events: none; transform: translate(-50%, -50%); width: 230px; opacity: .92; box-shadow: 0 6px 18px rgba(29, 27, 36, .3); }

.stagebox { background: var(--sheet); border: 1px solid var(--line); border-radius: 8px; padding: 10px; }
.tools { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.tools .btn.go { background: var(--ink); color: var(--sheet); border-color: var(--ink); min-width: 74px; }
#stage { display: block; width: 100%; height: min(46vh, 440px); min-height: 220px; background: var(--paper); border: 1px solid var(--line); border-radius: 6px; }
#status { font: 13px var(--mono); color: var(--ink2); margin-left: 6px; flex: 1 1 200px; }
#status.warn { color: var(--plum); }
#title { font-size: 20px; margin: 0 0 8px; }
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; margin-top: 14px; }
.slot { background: var(--sheet); border: 1px solid var(--line); border-top: 5px solid var(--plum); border-radius: 6px; padding: 8px 10px 10px; min-height: 92px; }
.slot.empty { background: var(--plum-wash); }
.slot.over, .zone.over { outline: 3px solid var(--ink); outline-offset: 1px; background: var(--paper); }
.slot h3 { display: flex; justify-content: space-between; align-items: baseline; font-size: 15px; }
.holds { font-size: 12px; color: var(--ink2); margin: 1px 0 6px; }
.hint { font-size: 13px; color: var(--ink2); }
.placed { display: flex; flex-direction: column; gap: 5px; }
.chip { display: flex; justify-content: space-between; align-items: center; gap: 6px; background: var(--ink); color: var(--sheet); border-radius: 5px; padding: 4px 6px 4px 9px; font-size: 14px; }
.x { background: transparent; border: 1px solid var(--sheet); color: var(--sheet); width: 26px; height: 26px; border-radius: 4px; line-height: 1; }
.x:hover { background: var(--plum); }
.zone { border: 1px dashed var(--line); border-radius: 5px; padding: 5px 7px; display: flex; flex-direction: column; gap: 4px; }
.kn { font: 12px var(--mono); color: var(--plum); font-weight: 700; }

.ngroup { border: 1px solid var(--line); border-radius: 6px; background: var(--sheet); padding: 8px 10px 4px; margin-bottom: 10px; }
.ngroup h4 { font-size: 13px; margin-bottom: 4px; color: var(--ink); }
.slide { display: grid; grid-template-columns: 1fr 76px; grid-template-areas: "l o" "i i"; gap: 0 8px; margin-bottom: 6px; align-items: baseline; }
.slide span { grid-area: l; font-size: 13px; color: var(--ink2); }
.slide output { grid-area: o; font: 12px var(--mono); text-align: right; }
.slide input[type=range] { grid-area: i; width: 100%; accent-color: var(--teal); }
.slide select { grid-area: i; background: var(--sheet); border: 1px solid var(--line); border-radius: 5px; padding: 4px; }
.quiet, .warnnote { font-size: 13px; color: var(--ink2); }
.warnnote { border-left: 4px solid var(--plum); padding-left: 8px; margin: 4px 0 8px; }
#charts figure { margin: 0 0 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--sheet); padding: 6px 8px; }
#charts figcaption { font-size: 12px; color: var(--ink2); }
#charts canvas { display: block; width: 100%; height: 120px; }
.legend { display: flex; gap: 12px; font: 12px var(--mono); flex-wrap: wrap; }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 4px; background: var(--c); }
#tabs { display: flex; gap: 4px; margin: 14px 0 0; }
#tabs button { background: var(--sheet); border: 1px solid var(--line); border-bottom: 0; border-radius: 6px 6px 0 0; padding: 4px 12px; }
#tabs button.on { background: var(--ink); color: var(--sheet); border-color: var(--ink); }
#modelText { margin: 0; background: var(--sheet); border: 1px solid var(--line); border-radius: 0 6px 6px 6px; padding: 10px; font: 12px/1.5 var(--mono); max-height: 360px; overflow: auto; white-space: pre; tab-size: 2; }

footer { padding: 10px 18px 16px; border-top: 1px solid var(--line); background: var(--sheet); color: var(--ink2); font-size: 13px; }
footer p { margin: 0 0 4px; }

.veil { position: fixed; inset: 0; background: rgba(29, 27, 36, .55); display: flex; align-items: flex-start; justify-content: center; padding: 4vh 12px; overflow-y: auto; z-index: 20; }
.veil[hidden], .toast[hidden] { display: none; }
.box { background: var(--sheet); border: 1px solid var(--ink); border-radius: 8px; width: min(720px, 100%); padding: 18px 20px 22px; position: relative; }
.box h2 { font-size: 22px; margin-bottom: 8px; text-transform: none; letter-spacing: 0; color: var(--ink); }
.box .close { position: absolute; top: 12px; right: 12px; }
.row { display: flex; gap: 8px; align-items: flex-start; justify-content: space-between; border-top: 1px solid var(--line); padding: 10px 0; flex-wrap: wrap; }
.row .t { flex: 1 1 320px; } .row .d { font-size: 13px; color: var(--ink2); } .row .src { font-family: var(--mono); font-size: 12px; }
.steps { list-style: none; padding: 0; margin: 10px 0; display: grid; gap: 12px; }
.steps li { display: grid; grid-template-columns: 200px 1fr; gap: 6px 14px; align-items: center; position: relative; }
.steps li svg { width: 200px; height: auto; background: var(--paper); border: 1px solid var(--line); border-radius: 6px; }
.steps .n { position: absolute; left: 6px; top: 4px; font: 700 12px var(--mono); color: var(--plum); }
.steps svg .a { fill: var(--teal); } .steps svg .b { fill: var(--plum); } .steps svg .pane { fill: var(--sheet); stroke: var(--line); }
.steps svg .slotd { fill: var(--plum-wash); stroke: var(--plum); stroke-width: 2; } .steps svg .ar { fill: none; stroke: var(--ink); stroke-width: 2.4; stroke-linecap: round; }
.steps svg .rail { stroke: var(--line); stroke-width: 2; } .steps svg .la { fill: none; stroke: var(--teal); stroke-width: 3; } .steps svg .lb { fill: none; stroke: var(--plum); stroke-width: 3; }
.steps svg .t { font: 700 15px var(--mono); fill: var(--ink); }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--ink); color: var(--sheet); padding: 9px 16px; border-radius: 6px; z-index: 40; max-width: min(520px, 92vw); }

@media (max-width: 1000px) {
  .app { grid-template-columns: minmax(0, 1fr); height: auto; }
  .app > * { overflow: visible; }
  .blocks { border-right: 0; border-bottom: 1px solid var(--line); order: 2; }
  .task { order: 1; }
  .reading { border-left: 0; border-top: 1px solid var(--line); order: 3; }
  #modelText { max-width: 100%; }
  .steps li { grid-template-columns: 1fr; }
  .steps li svg { width: 100%; max-width: 260px; }
}
@media (max-width: 520px) {
  header { padding: 8px 14px; } .app > * { padding: 12px 14px 22px; } .brand b { font-size: 26px; }
  .slots { grid-template-columns: minmax(0, 1fr); }
}
