/* =========================================================
   Camp SLO — The Planning Period
   Field-guide manila, olive drab, hazard mustard, signal red.
   ========================================================= */
:root {
  --ink: #1D1914;
  --olive: #4F5A2A;
  --olive-deep: #343C1B;
  --manila: #E6D4A2;
  --manila-light: #F1E6C6;
  --field: #FBF7EA;
  --mustard: #D9A520;
  --signal: #B5382F;
  --go: #2E7D4F;
  --page: #2A2620;
  --display: "Saira Stencil One", "Arial Black", Impact, sans-serif;
  --body: "Atkinson Hyperlegible", "Segoe UI", Arial, sans-serif;
  --ts: 1;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --page: #141210; }
}
:root[data-theme="dark"] { --page: #141210; }
html.large-text { --ts: 1.2; }
*, *::before, *::after { box-sizing: inherit; }
html { scroll-padding-top: env(safe-area-inset-top, 0px); }
html, body { height: 100%; margin: 0; }
body { background: var(--page); color: var(--ink); font-family: var(--body); overflow: hidden; }

#app {
  height: 100%; width: 100%;
  display: grid; place-items: center;
  background: var(--page);
}
#stage {
  position: relative;
  width: min(100vw, calc(100vh * 16 / 9));
  width: min(100vw, calc((100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)) * 16 / 9));
  aspect-ratio: 16 / 9;
  overflow: hidden;
  container-type: size;
  background: #E7DEC9;
  font-size: calc(clamp(12px, 1.72cqw, 22px) * var(--ts));
  line-height: 1.45;
}
#view { position: absolute; inset: 0; width: 100%; height: 100%; display: block; outline: none; touch-action: none; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--mustard); outline-offset: 3px; box-shadow: 0 0 0 6px var(--ink); }

/* ---------- Buttons ---------- */
.btn {
  border: 2px solid var(--ink);
  background: var(--field);
  padding: 0.5em 1.1em;
  border-radius: 4px;
  font-weight: 700;
  box-shadow: 3px 3px 0 var(--ink);
  min-height: 2.6em;
}
.btn:hover { background: #fff; }
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.btn.primary { background: var(--olive); color: var(--field); }
.btn.primary:hover { background: var(--olive-deep); }
.btn.big { font-size: 1.2em; padding: 0.6em 1.4em; }
.btn.quiet { background: transparent; box-shadow: none; border-color: transparent; text-decoration: underline; font-weight: 400; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; box-shadow: none; }
.actions { display: flex; gap: 0.7em; justify-content: flex-end; flex-wrap: wrap; margin-top: 1em; }
.actions.stack { flex-direction: column; align-items: stretch; justify-content: flex-start; max-width: 20em; }

/* ---------- HUD ---------- */
#hud { position: absolute; inset: 0; pointer-events: none; }
.clock {
  position: absolute; left: 1.5cqw; top: 2cqh;
  background: var(--field); border: 3px solid var(--ink); border-radius: 4px;
  padding: 0.25em 0.8em 0.35em;
  box-shadow: 4px 4px 0 var(--ink);
  display: grid; grid-template-columns: auto auto; column-gap: 0.6em; align-items: baseline;
}
.clock-label { grid-column: 1 / -1; font-size: 0.72em; font-weight: 700; letter-spacing: 0.02em; color: var(--olive); }
.clock-time { font-family: var(--display); font-size: 2.1em; line-height: 1; font-variant-numeric: tabular-nums; }
.clock-flag { grid-column: 1 / -1; font-weight: 700; font-size: 0.75em; line-height: 1.1; }
.clock-flag:empty { display: none; }
.clock.low { background: #F7E2A6; }
.clock.critical { background: #F2C2BC; color: #6d1510; }
.clock.loss { animation: loss 0.6s; }
.clock.gain { animation: gain 0.8s; }
@keyframes loss { 0%, 100% { transform: none; } 25% { transform: translateX(-4px); background: #F2C2BC; } 60% { transform: translateX(3px); } }
@keyframes gain { 0%, 100% { transform: none; } 40% { transform: scale(1.08); background: #CFE8D3; } }
.reduced-motion .clock.loss, .reduced-motion .clock.gain { animation: none; }

.beans {
  position: absolute; left: 1.5cqw; top: calc(2cqh + 5.2em);
  display: flex; align-items: center; gap: 0.4em;
  background: var(--field); border: 2px solid var(--ink); border-radius: 4px;
  padding: 0.15em 0.6em; font-weight: 700; box-shadow: 3px 3px 0 var(--ink);
}
.bean-ico { width: 1em; height: 1.2em; }
.hud-buttons { position: absolute; right: 1.5cqw; top: 2cqh; display: flex; gap: 0.5em; pointer-events: auto; }
.hud-btn {
  width: 2.4em; height: 2.4em; border: 2px solid var(--ink); border-radius: 4px;
  background: var(--field); box-shadow: 3px 3px 0 var(--ink); font-weight: 700;
}
.hud-btn[aria-pressed="false"] { background: #d9d3c2; }

.zone-banner {
  position: absolute; top: 2.4cqh; left: 50%; transform: translateX(-50%);
  margin: 0; padding: 0.2em 1em; background: var(--olive); color: var(--field);
  font-family: var(--display); font-size: 1.15em; border: 2px solid var(--ink);
  opacity: 0; transition: opacity 0.4s; pointer-events: none; white-space: nowrap;
}
.zone-banner.show { opacity: 1; }
.radio {
  position: absolute; right: 1.5cqw; top: calc(2cqh + 3.6em); max-width: 36cqw;
  background: var(--olive-deep); color: var(--field); border: 2px solid var(--ink);
  border-left: 8px solid var(--mustard);
  padding: 0.5em 0.9em; border-radius: 3px; box-shadow: 4px 4px 0 var(--ink);
  opacity: 0; transform: translateY(-8px); transition: opacity 0.3s, transform 0.3s; pointer-events: none;
}
.radio.show { opacity: 1; transform: none; }
.radio p { margin: 0; }
.radio-from { font-size: 0.78em; color: var(--mustard); font-weight: 700; }
.reduced-motion .radio, .reduced-motion .zone-banner { transition: none; }

/* Optional "[E] Try to fix it?" prompt over the copier */
.copier-prompt {
  position: absolute; transform: translate(-50%, -100%);
  padding: 0.25em 0.7em; font-size: 0.9em; font-weight: 700; white-space: nowrap;
  background: var(--field); border: 2px solid var(--ink); border-radius: 4px; box-shadow: 3px 3px 0 var(--ink);
}
.copier-prompt[hidden] { display: none; }
.copier-prompt kbd {
  display: inline-block; min-width: 1.4em; padding: 0 0.3em; margin-right: 0.2em; text-align: center;
  font: inherit; font-size: 0.85em; border: 2px solid var(--ink); border-radius: 3px; background: #fff;
}
.copier-prompt:focus-visible { outline: 3px solid var(--mustard); outline-offset: 2px; }

/* ---------- Touch ---------- */
.touch { position: absolute; inset: auto 0 2cqh 0; display: flex; gap: 1.2cqw; padding: 0 2cqw; pointer-events: none; }
.touch[hidden] { display: none; }
.tbtn {
  pointer-events: auto; width: 9cqw; height: 9cqw; min-width: 52px; min-height: 52px;
  border-radius: 50%; border: 3px solid var(--ink); background: rgba(251,247,234,0.82);
  font-weight: 700; font-size: 1.2em; touch-action: none; user-select: none; -webkit-user-select: none;
}
.tbtn.held { background: var(--mustard); }
.tbtn.jump { margin-left: auto; width: 11cqw; height: 11cqw; }

/* ---------- Overlay shells ---------- */
.overlay { position: absolute; inset: 0; display: grid; }
.overlay[hidden] { display: none; }
.kind-title, .kind-screen, .kind-callout { place-items: center; }
.kind-talk { align-items: start; justify-items: center; padding-top: 2.5cqh; }
.kind-board { place-items: center; padding: 2cqh 2cqw; }
.kind-dialog { align-items: end; padding: 0 3cqw 3cqh; }

.sheet, .talk, .board-task, .dialog-box {
  background: var(--manila);
  border: 3px solid var(--ink);
  border-radius: 4px;
  box-shadow: 6px 6px 0 var(--ink);
}
.sheet { width: min(64cqw, 40em); max-height: 92cqh; overflow: auto; padding: 1.3em 1.6em; }
.sheet h2 { font-family: var(--display); font-weight: 400; font-size: 1.8em; margin: 0 0 0.4em; line-height: 1.1; }
.fine { font-size: 0.9em; color: #4a4338; }

/* nameplate = file-folder tab */
.nameplate {
  display: inline-block; margin: -0.2em 0 0.4em; padding: 0.1em 0.8em;
  background: var(--olive); color: var(--field); font-weight: 700; font-size: 0.85em;
  border: 2px solid var(--ink); border-radius: 3px 3px 0 0;
}
.line { margin: 0 0 0.6em; font-size: 1.15em; font-weight: 700; }
.stage { margin: 0; font-style: italic; }

/* ---------- Talk (quick question) ---------- */
.talk { width: min(62cqw, 42em); max-height: 68cqh; overflow: auto; padding: 0.8em 1.2em 0.9em; }
.talk .line { font-size: 1.05em; margin-bottom: 0.3em; }
.talk .feedback { margin-bottom: 0.6em; }
.talk .review-tag { margin-top: 0.6em; }
.prompt { font-family: var(--body); font-size: 1.25em; margin: 0.1em 0 0.5em; line-height: 1.25; }
.answers { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 0.6em; }
.answer {
  width: 100%; text-align: left; display: flex; gap: 0.6em; align-items: center;
  background: var(--field); border: 2px solid var(--ink); border-radius: 4px;
  padding: 0.45em 0.7em; box-shadow: 3px 3px 0 var(--ink); min-height: 2.6em; line-height: 1.25;
}
.answer:hover { background: #fff; }
.answer .key {
  flex: none; width: 1.6em; height: 1.6em; display: grid; place-items: center;
  border: 2px solid var(--ink); border-radius: 50%; font-weight: 700; font-size: 0.85em;
}
.answer.tried { background: #e2dccb; color: #5b544a; text-decoration: line-through; box-shadow: none; }
.feedback { border: 2px solid var(--ink); border-radius: 4px; padding: 0.5em 0.8em; margin: 0 0 0.8em; }
.feedback p { margin: 0; }
.feedback.wrong { background: #F6D8D3; border-left: 8px solid var(--signal); }
.feedback.right { background: #D6EBD9; border-left: 8px solid var(--go); }
.feedback .cost { font-weight: 700; color: #7d1f18; margin-top: 0.2em; }
.review-tag {
  margin: 0.9em 0 0; font-size: 0.75em; font-weight: 700; color: #6d1510;
  border: 1.5px dashed #6d1510; display: inline-block; padding: 0.1em 0.5em;
}

/* ---------- Bulletin board ---------- */
.board-task { width: min(92cqw, 62em); max-height: 95cqh; overflow: auto; padding: 0.7em 1.1em 0.8em; }
.board-task .line { font-size: 1.05em; margin-bottom: 0.4em; }
.board-task .nameplate { margin-bottom: 0.25em; }
.board-task .actions { margin-top: 0.6em; }
.board-task .feedback { margin: 0 0 0.5em; }
.board-head .line { margin-bottom: 0.5em; }
.cork {
  background-color: #C79A64;
  background-image: radial-gradient(rgba(80,50,20,0.25) 1px, transparent 1.5px);
  background-size: 9px 9px;
  border: 8px solid #7A5A3A; border-radius: 3px; padding: 0.5em 0.8em 0.7em;
  position: relative;
}
.board-title {
  font-family: var(--display); font-weight: 400; margin: 0 auto 0.3em; width: fit-content;
  background: #2F3A1E; color: var(--manila-light); padding: 0.05em 0.9em; font-size: 1.15em;
}
.board-instr { font-size: 0.88em; margin: 0 0 0.5em; text-align: center; background: rgba(251,247,234,0.88); padding: 0.2em 0.6em; border-radius: 3px; }
.slots { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.6em; }
.slot {
  position: relative; min-height: 5em; border: 2px dashed rgba(29,25,20,0.55); border-radius: 4px;
  display: grid; padding: 1.35em 0.3em 0.3em; background: rgba(251,247,234,0.18);
}
.slot.over { background: rgba(217,165,32,0.45); border-style: solid; }
.slot-num {
  position: absolute; top: 0.2em; left: 50%; transform: translateX(-50%);
  font-family: var(--display); font-size: 1.15em; color: var(--ink); line-height: 1;
}
.slot-empty {
  border: none; background: transparent; width: 100%; height: 100%; color: #3b2f22; font-weight: 700; border-radius: 3px;
}
.card {
  width: 100%; min-height: 3em; background: var(--field); border: 2px solid var(--ink); border-radius: 3px;
  box-shadow: 2px 3px 0 rgba(29,25,20,0.6); font-weight: 700; padding: 0.4em 0.4em; text-align: center;
  touch-action: none; user-select: none; -webkit-user-select: none; position: relative; line-height: 1.2;
  display: grid; place-items: center;
}
.card.selected { background: #F7E2A6; outline: 3px solid var(--ink); }
.card.dragging { opacity: 0.35; }
.card.pinned { background: #E3F1E5; cursor: default; }
.pin { position: absolute; top: 0.25em; right: 0.3em; width: 0.75em; height: 0.75em; border-radius: 50%; background: var(--go); border: 2px solid var(--ink); }
.card.ghost { position: fixed; z-index: 1000; pointer-events: none; transform: translate(-50%, -50%) rotate(-3deg); font-family: var(--body); box-shadow: 6px 6px 0 rgba(29,25,20,0.5); }
.tray-wrap { margin-top: 0.5em; }
.tray-label { margin: 0 0 0.3em; font-weight: 700; }
.tray { list-style: none; margin: 0; padding: 0.45em; display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.6em; background: var(--manila-light); border: 2px solid var(--ink); border-radius: 4px; min-height: 4em; }
.tray .card:hover { background: #fff; }
.tray-empty { grid-column: 1 / -1; text-align: center; align-self: center; color: #5b544a; }
.stamp {
  margin: 0.8em auto 0; width: fit-content; font-family: var(--display); font-size: 2em; line-height: 1;
  color: var(--go); border: 4px solid var(--go); padding: 0.15em 0.5em; transform: rotate(-3deg); background: rgba(251,247,234,0.9);
}
.stamp span { display: block; font-size: 0.5em; text-align: center; margin-top: 0.15em; }
.board-task.done .board-head { margin-top: 0.8em; }

/* ---------- Bulletin board artwork (assets/ui/board, from the SLO Process sheet) ---------- */
.cork.art {
  background: url("assets/ui/board/board-empty.webp") center / 100% 100% no-repeat; border: 0; border-radius: 0; padding: 0;
  aspect-ratio: 816 / 405; filter: drop-shadow(4px 5px 0 rgba(29, 25, 20, 0.45));
  width: min(100%, 112cqh); margin: 0 auto;   /* leave room for the loose cards and buttons */
  container-type: inline-size;                  /* note text scales with the board (cqi) */
}
.cork.art .board-title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); padding: 0; margin: 0; }
.cork.art .slots { position: absolute; inset: 0; display: block; }
/* the five dashed spots, measured from the artwork (% of the board) */
.cork.art .slot { position: absolute; top: 34.8%; width: 15.9%; height: 40.5%; min-height: 0; padding: 0; border: 0; background: transparent; display: grid; }
.cork.art .slot:nth-child(1) { left: 6.74%; }
.cork.art .slot:nth-child(2) { left: 24.39%; }
.cork.art .slot:nth-child(3) { left: 42.16%; }
.cork.art .slot:nth-child(4) { left: 59.68%; }
.cork.art .slot:nth-child(5) { left: 77.21%; }
.cork.art .slot-num { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.cork.art .slot.over { background: rgba(217, 165, 32, 0.35); border-radius: 4px; }
.cork.art .slot-empty { color: transparent; padding-top: 30%; }
.cork.art .slot-empty:focus-visible, .cork.art .slot-empty[aria-label*="place"] { color: var(--ink); background: rgba(251, 247, 234, 0.35); }
/* cards are paper notes */
.card[class*="note-"] { background: transparent center / 100% 100% no-repeat; border: 0; border-radius: 0; box-shadow: none;
  filter: drop-shadow(2px 3px 0 rgba(29, 25, 20, 0.45)); color: var(--ink); padding: 0.9em 0.5em 0.6em; min-height: 4.2em; }
.card.note-1 { background-image: url("assets/ui/board/note-1.webp"); }
.card.note-2 { background-image: url("assets/ui/board/note-2.webp"); }
.card.note-3 { background-image: url("assets/ui/board/note-3.webp"); }
.card.note-4 { background-image: url("assets/ui/board/note-4.webp"); }
.card.note-5 { background-image: url("assets/ui/board/note-5.webp"); }
.card.note-6 { background-image: url("assets/ui/board/note-6.webp"); }
.card.note-7 { background-image: url("assets/ui/board/note-7.webp"); }
.card.note-8 { background-image: url("assets/ui/board/note-8.webp"); }
.card[class*="note-"].selected { background-color: transparent; outline: 0; filter: drop-shadow(0 0 0 var(--ink)) drop-shadow(0 0 4px var(--mustard)) drop-shadow(3px 4px 0 rgba(29, 25, 20, 0.55)); transform: translateY(-3px) rotate(-1.5deg); }
.tray .card[class*="note-"]:hover { background-color: transparent; transform: translateY(-2px); }
.card.pinned[class*="note-"] { background-color: transparent; padding-top: 1.6em; }
.cork.art .card { height: 100%; font-size: clamp(9px, 2.1cqi, 15px); padding: 1em 0.3em 0.4em; line-height: 1.15; }
.cork.art .card.pinned { padding-top: 1.7em; }
.cork.art .slot-empty { font-size: clamp(9px, 2.1cqi, 15px); }
.card .card-num { position: absolute; top: 0.55em; left: 50%; transform: translateX(-50%); font-family: var(--display); font-size: 1.05em; line-height: 1; }
/* the slot's coloured pushpin, once a card is right */
.card .pin { position: absolute; top: -0.9em; left: 50%; right: auto; transform: translateX(-50%); width: 1.25em; height: 2.1em;
  border: 0; border-radius: 0; background: transparent center / contain no-repeat; }
.pin.pin-1 { background-image: url("assets/ui/board/pin-red.webp"); }
.pin.pin-2 { background-image: url("assets/ui/board/pin-yellow.webp"); }
.pin.pin-3 { background-image: url("assets/ui/board/pin-green.webp"); }
.pin.pin-4 { background-image: url("assets/ui/board/pin-blue.webp"); }
.pin.pin-5 { background-image: url("assets/ui/board/pin-purple.webp"); }
.approved { position: absolute; right: 2%; bottom: 3%; width: 30%; aspect-ratio: 245 / 131; transform: rotate(-8deg);
  background: url("assets/ui/board/stamp.webp") center / contain no-repeat; animation: stamp-in 0.35s ease-out both; }
@keyframes stamp-in { from { transform: rotate(-8deg) scale(1.8); opacity: 0; } to { transform: rotate(-8deg) scale(1); opacity: 1; } }
.reduced-motion .approved { animation: none; }
.stamp-note { margin: 0.6em 0 0; text-align: center; font-weight: 700; color: var(--go); }

/* ---------- Dialogue (Spud) ---------- */
.dialog { display: flex; align-items: flex-end; gap: 1.5cqw; width: 100%; }
.dialog .portrait { width: 20cqw; height: 46cqh; flex: none; }
.dialog-box { flex: 1; max-width: 46em; padding: 0.9em 1.3em 1em; }
.dialog-box .line { font-size: 1.3em; }
.dialog.beat { justify-content: center; }
.dialog.beat .dialog-box { flex: none; text-align: center; }
.beat-line { font-family: var(--display); font-size: 2.4em !important; letter-spacing: 0.2em; margin: 0; }

/* ---------- Callout (whistle / GO) ---------- */
.callout p { margin: 0; font-family: var(--display); color: var(--field); -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; text-shadow: 6px 6px 0 var(--ink); }
.callout .sfx { font-size: 3.4em; }
.callout .go { font-size: 7em; line-height: 1; }

/* ---------- Title ---------- */
.title-screen { width: min(86cqw, 60em); display: grid; gap: 2cqh; }
.placard {
  background: var(--olive); color: var(--manila-light); border: 4px solid var(--ink);
  box-shadow: 8px 8px 0 var(--ink); padding: 1.2em 1.6em 1em; position: relative;
  border-bottom: 18px solid var(--mustard);
  border-image: none;
}
.placard::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -18px; height: 18px;
  background: repeating-linear-gradient(-45deg, var(--mustard) 0 14px, var(--ink) 14px 28px);
}
.placard::before {
  content: ""; position: absolute; inset: 0.55em; pointer-events: none;
  background:
    radial-gradient(circle, #8a9361 0 3px, var(--ink) 3.5px 5px, transparent 5.5px) top left / 12px 12px no-repeat,
    radial-gradient(circle, #8a9361 0 3px, var(--ink) 3.5px 5px, transparent 5.5px) top right / 12px 12px no-repeat;
}
.facility { margin: 0; font-weight: 700; font-size: 0.95em; color: var(--mustard); }
.placard h1 {
  font-family: var(--display); font-weight: 400; margin: 0.05em 0 0.1em; line-height: 0.95;
  font-size: 4.6em; color: var(--field); text-shadow: 4px 4px 0 var(--ink);
}
.module { margin: 0; font-size: 1.05em; }
.title-body { display: flex; align-items: flex-end; gap: 2cqw; }
.title-body .portrait { width: 18cqw; height: 40cqh; flex: none; }
.title-copy { flex: 1; background: var(--manila); border: 3px solid var(--ink); box-shadow: 6px 6px 0 var(--ink); padding: 1em 1.4em; border-radius: 4px; }
.premise { margin: 0 0 0.6em; font-size: 1.25em; font-weight: 700; max-width: 30em; }
.title-copy .actions.stack { flex-direction: row; flex-wrap: wrap; max-width: none; justify-content: flex-start; }
.notice { margin: 0.8em 0 0; font-weight: 700; color: #6d1510; }
.build { position: absolute; right: 1.5cqw; bottom: 1cqh; margin: 0; color: var(--field); font-size: 0.75em; opacity: 0.8; }

/* ---------- Results ---------- */
.result-kicker { margin: 0; font-weight: 700; color: var(--olive); }
.result-title { font-size: 2.2em !important; }
.result-sub { font-size: 1.15em; margin: 0 0 0.8em; }
.stats { border-collapse: collapse; width: 100%; margin: 0.4em 0; background: var(--field); border: 2px solid var(--ink); }
.stats th, .stats td { padding: 0.35em 0.8em; border-bottom: 1px solid #c9bb92; text-align: left; }
.stats td { text-align: right; font-family: var(--display); font-size: 1.2em; font-variant-numeric: tabular-nums; }

/* ---------- Settings / controls ---------- */
.toggles { list-style: none; padding: 0; margin: 0.4em 0; display: grid; gap: 0.45em; }
.toggle {
  width: 100%; display: flex; justify-content: space-between; align-items: center;
  border: 2px solid var(--ink); background: var(--field); border-radius: 4px; padding: 0.45em 0.8em; font-weight: 700;
}
.toggle-state { min-width: 3.2em; text-align: center; border: 2px solid var(--ink); border-radius: 3px; padding: 0 0.4em; background: #d9d3c2; }
.toggle[aria-pressed="true"] .toggle-state { background: var(--olive); color: var(--field); }
.controls { display: grid; grid-template-columns: auto 1fr; gap: 0.25em 1.2em; margin: 0.6em 0; }
.controls dt { font-weight: 700; }
.controls dd { margin: 0; }
.controls-wrap summary { font-weight: 700; cursor: pointer; margin-top: 0.6em; }

/* ---------- Small screens ---------- */
@container (max-width: 640px) {
  .answers { grid-template-columns: 1fr; }
  .slots, .tray { grid-template-columns: repeat(3, 1fr); }
  .placard h1 { font-size: 3em; }
  .title-body .portrait, .dialog .portrait { display: none; }
  .sheet, .talk { width: 94cqw; }
}
@container (max-height: 460px) {
  .title-screen { gap: 1.5cqh; }
  .placard { padding: 0.6em 1.2em 0.6em; }
  .placard h1 { font-size: 2.8em; }
  .title-body .portrait, .dialog .portrait { display: none; }
  .premise { font-size: 1.05em; }
  .btn.big { font-size: 1em; }
}

.talk:focus, .board-task:focus { outline: none; box-shadow: 6px 6px 0 var(--ink); }
.stats td.coffee-cell { font-family: var(--body); font-weight: 700; font-size: 1em; }

/* ===================== Phase 2 ===================== */
.tbtn.duck { margin-left: auto; }
.tbtn.duck + .tbtn.jump { margin-left: 0; }

/* "No." response panel — sits low so the student stays visible */
.kind-prompt { align-items: start; justify-items: center; padding-top: 14cqh; pointer-events: none; }
.prompt-panel {
  pointer-events: auto; display: flex; align-items: center; gap: 1em;
  background: var(--manila); border: 3px solid var(--ink); border-radius: 4px; box-shadow: 6px 6px 0 var(--ink);
  padding: 0.6em 0.9em;
}
.prompt-said { margin: 0; font-weight: 700; max-width: 22em; }
.prompt-said:empty { display: none; }
.no-btn { font-size: 1.35em; min-width: 5.5em; }
.no-btn kbd {
  font-family: var(--body); font-size: 0.65em; border: 2px solid currentColor; border-radius: 3px;
  padding: 0 0.35em; margin-right: 0.35em; vertical-align: 0.15em;
}

/* Growth papers */
.papers { display: flex; gap: 1.2em; justify-content: center; margin: 0.4em 0 0.6em; flex-wrap: wrap; }
.paper {
  background: #FFFDF6; border: 2px solid var(--ink); box-shadow: 4px 5px 0 rgba(29,25,20,0.55);
  padding: 0.6em 1em 0.7em; min-width: 14em; transform: rotate(var(--tilt, 0deg));
  background-image: repeating-linear-gradient(transparent 0 1.55em, rgba(46,74,122,0.12) 1.55em calc(1.55em + 1px));
}
.paper-title { margin: 0 0 0.3em; font-family: var(--display); font-weight: 400; font-size: 1.25em; border-bottom: 2px solid var(--signal); }
.paper-rows { border-collapse: collapse; width: 100%; }
.paper-rows th { text-align: left; font-weight: 400; padding: 0.15em 0.6em 0.15em 0; }
.paper-rows td { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.paper-note { text-align: center; margin: 0 0 0.4em; font-size: 0.9em; font-style: italic; }
.answers.one-col { grid-template-columns: 1fr; }
.papers-task .prompt { margin-top: 0.3em; }

/* Training cards (matching) */
.cart-top { background: #CFD6DB; border: 6px solid #6E757C; border-radius: 4px; padding: 0.5em 0.8em 0.7em; }
.match-cols { display: grid; grid-template-columns: 1fr 1.6fr; gap: 1em; }
.col-label { margin: 0.2em 0 0.3em; font-weight: 700; }
.match-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.35em; }
.match-card { min-height: 2.2em; padding: 0.25em 0.5em; }
.match-task .board-instr { margin-bottom: 0.3em; }
.match-card.term { font-family: var(--display); font-weight: 400; font-size: 1.1em; }
.match-card.meaning { font-weight: 400; text-align: left; place-items: center start; padding-left: 0.8em; }
.pairs { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.35em; }
.pair { position: relative; background: #E3F1E5; border: 2px solid var(--ink); border-radius: 3px; padding: 0.35em 2em 0.35em 0.7em; }
.pair .pin { left: auto; }

/* What happens next */
.step-count { margin: 0; font-size: 0.85em; font-weight: 700; color: var(--olive); }
.stage-row { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.5em; }
.stage-card { min-height: 3.6em; position: relative; padding-top: 1.2em; }
.stage-num { position: absolute; top: 0.15em; left: 0.4em; font-family: var(--display); font-size: 0.85em; color: var(--olive); }
.stage-card.tried { background: #e2dccb; color: #5b544a; text-decoration: line-through; box-shadow: none; }
@container (max-width: 640px) {
  .stage-row { grid-template-columns: repeat(2, 1fr); }
  .match-cols { grid-template-columns: 1fr; }
}

/* Teacher select */
.choose { text-align: center; }
.teacher-pick { list-style: none; margin: 0.6em 0 0; padding: 0; display: flex; gap: 1.2em; justify-content: center; }
.pick {
  display: grid; justify-items: center; gap: 0.3em; background: var(--field); border: 3px solid var(--ink); border-radius: 6px;
  box-shadow: 5px 5px 0 var(--ink); padding: 0.6em 1.2em 0.7em; min-width: 11em;
}
.pick:hover { background: #fff; }
.pick:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--ink); }
.pick .portrait { width: 9em; height: 10em; }
.pick-name { font-family: var(--display); font-size: 1.4em; }
.pick.picked { background: #fff; transform: scale(1.06); box-shadow: 0 0 0 4px var(--mustard), 4px 4px 0 var(--ink); }
.pick.not-picked { opacity: 0.45; }
.pick:disabled { cursor: default; }
.pick-callout { margin: 0.7em 0 0; text-align: center; font-size: 1.2em; }
.reduced-motion .pick.picked { transform: none; }

/* Spud's face on radio messages */
.radio { display: flex; gap: 0.6em; align-items: center; }
.radio-face { width: 3.4em; height: 4.2em; flex: none; }

/* ===================== Artwork UI (assets/ui) ===================== */
.title-art {
  position: absolute; inset: 0;
  background: #2b2a24 url("assets/ui/cover.jpg") center / cover no-repeat;
}
.title-buttons { position: absolute; right: 1.2cqw; bottom: 2cqh; width: 27.5cqw; display: grid; justify-items: center; gap: 0.6cqh; }
.title-side { display: flex; gap: 1cqw; width: 100%; justify-content: center; }
.title-notice { position: absolute; left: 50%; top: 2cqh; transform: translateX(-50%); background: var(--field); padding: 0.3em 0.8em; border: 2px solid var(--ink); }

.img-btn {
  border: 0; padding: 0; margin: 0; cursor: pointer; display: block;
  background: transparent center / contain no-repeat;
  filter: drop-shadow(3px 4px 0 rgba(29, 25, 20, 0.55));
  transition: transform 0.08s, filter 0.12s;
}
.img-btn:hover { filter: drop-shadow(3px 4px 0 rgba(29, 25, 20, 0.55)) brightness(1.1) saturate(1.1); transform: translateY(-2px); }
.img-btn:active { transform: translateY(1px); filter: drop-shadow(1px 1px 0 rgba(29, 25, 20, 0.55)); }
.img-btn:focus-visible { outline: 4px solid var(--mustard); outline-offset: 3px; box-shadow: none; border-radius: 6px; }
.reduced-motion .img-btn, .reduced-motion .img-btn:hover, .reduced-motion .img-btn:active { transform: none; transition: none; }

.ui-begin    { background-image: url("assets/ui/begin.png");    width: 100%;  aspect-ratio: 556 / 240; }
.ui-howto    { background-image: url("assets/ui/howto.png");    width: 49%;   aspect-ratio: 346 / 106; }
.ui-settings { background-image: url("assets/ui/settings.png"); width: 47%;   aspect-ratio: 332 / 100; }
.ui-continue { background-image: url("assets/ui/continue.png"); width: 10em;  aspect-ratio: 200 / 55; }
.ui-back     { background-image: url("assets/ui/back.png");     width: 9.5em; aspect-ratio: 190 / 55; }

.hud-btn.img { border: 0; box-shadow: none; background: transparent center / contain no-repeat; width: 2.9em; height: 2.65em;
  filter: drop-shadow(2px 3px 0 rgba(29, 25, 20, 0.5)); }
.hud-btn.img .ico { display: none; }
.hud-btn.img:hover { filter: drop-shadow(2px 3px 0 rgba(29, 25, 20, 0.5)) brightness(1.1); }
.hud-btn.ui-sound { background-image: url("assets/ui/i-sound.png"); }
.hud-btn.ui-mute  { background-image: url("assets/ui/i-mute.png"); }
.hud-btn.ui-full  { background-image: url("assets/ui/i-full.png"); }
.hud-btn.ui-gear  { background-image: url("assets/ui/i-gear.png"); }
.hud-btn.ui-pause { background-image: url("assets/ui/i-pause.png"); }
.hud-btn.img[aria-pressed="false"] { background-color: transparent; }

.title-art .build { left: 1.5cqw; right: auto; bottom: 0.8cqh; text-shadow: 0 1px 2px #000; }

/* ===================== Panel artwork (assets/ui/p-*.png) ===================== */

/* Conversation panel: Spud briefing / debrief */
.convo-wrap { width: min(80cqw, 100%); margin: 0 auto; display: grid; gap: 0.6cqh; }
.convo { position: relative; width: 100%; aspect-ratio: 614 / 206; background: url("assets/ui/p-convo.png") center / 100% 100% no-repeat;
  filter: drop-shadow(4px 5px 0 rgba(29, 25, 20, 0.5)); }
.convo-photo { position: absolute; left: 3.4%; top: 21%; width: 14.4%; height: 59%; background: #d9d2bd; transform: rotate(-2deg); }
.convo-text { position: absolute; left: 20.5%; right: 16.5%; top: 24%; bottom: 12%; overflow: auto; display: flex; flex-direction: column; justify-content: center; }
.convo-name { margin: 0 0 0.2em; font-weight: 700; font-size: 0.8em; color: var(--olive); text-transform: uppercase; letter-spacing: 0.04em; }
.convo-text .line { font-size: 1.25em; margin: 0; }
.convo-text .stage { margin: 0.2em 0 0; }
.convo-actions { margin-top: 0; }
.convo-wrap.beat .convo-text { left: 20.5%; align-items: center; }
.kind-dialog { align-items: end; padding: 0 2cqw 2cqh; }

/* SLO Challenge panel: quick admin questions */
.talk.challenge {
  width: min(66cqw, 100%); aspect-ratio: 590 / 316; max-height: none; overflow: visible; padding: 0; position: relative;
  background: url("assets/ui/p-challenge.png") center / 100% 100% no-repeat; border: 0; border-radius: 0; box-shadow: none;
  filter: drop-shadow(4px 5px 0 rgba(29, 25, 20, 0.5));
}
.challenge .ch-left { position: absolute; left: 3.8%; top: 22%; width: 50%; bottom: 6%; overflow: auto; padding-right: 0.4em; }
.challenge .nameplate { font-size: 0.75em; }
.challenge .line { font-size: 0.95em; margin-bottom: 0.2em; }
.challenge .prompt { font-size: 1.15em; margin: 0.1em 0 0.4em; }
.challenge .feedback { font-size: 0.85em; padding: 0.35em 0.6em; margin-bottom: 0.3em; }
.challenge .review-tag { font-size: 0.65em; margin-top: 0.3em; }
.challenge .answers { display: block; position: static; }
.challenge .answers li { position: absolute; left: 58.2%; width: 37.6%; height: 12.4%; }
.challenge .answers li:nth-child(1) { top: 34.6%; }
.challenge .answers li:nth-child(2) { top: 49.8%; }
.challenge .answers li:nth-child(3) { top: 65%; }
.challenge .answers li:nth-child(4) { top: 80.2%; }
.challenge .answer {
  width: 100%; height: 100%; min-height: 0; background: transparent; border: 0; box-shadow: none; border-radius: 3px;
  padding: 0 0.4em 0 16%; font-size: 0.8em; line-height: 1.1; font-weight: 700; text-align: left;
}
.challenge .answer .key {
  position: absolute; left: 10.2%; top: 50%; transform: translate(-50%, -50%); width: 1.6em; height: 1.6em;
  border: 0; font-size: 0.8em; background: transparent; display: grid; place-items: center;
}
.challenge .answer:hover { background: rgba(217, 165, 32, 0.22); }
.challenge .answer.tried { background: rgba(181, 56, 47, 0.12); color: #6b5f52; }

/* Radio messages on the notification panel */
.radio {
  width: 50cqw; max-width: none; aspect-ratio: 593 / 142; padding: 0; border: 0; border-radius: 0; box-shadow: none;
  background: url("assets/ui/p-notify.png") center / 100% 100% no-repeat; color: var(--ink);
  filter: drop-shadow(3px 4px 0 rgba(29, 25, 20, 0.45)); display: block;
}
.radio .radio-face { display: none; }
.radio > div { position: absolute; left: 18%; right: 17%; top: 33%; bottom: 10%; display: flex; flex-direction: column; justify-content: center; overflow: hidden; }
.radio p { font-size: 0.8em; line-height: 1.22; margin: 0; }
.radio .radio-from { display: none; }

/* HUD: clock, bean counter, location bar */
.clock {
  background: url("assets/ui/p-clock.png") center / 100% 100% no-repeat; border: 0; border-radius: 0; box-shadow: none;
  width: 23cqw; aspect-ratio: 332 / 66; padding: 0 0 0 6.6cqw; display: flex; align-items: center; gap: 0.5em; color: var(--field);
  filter: drop-shadow(2px 3px 0 rgba(29, 25, 20, 0.45));
}
.clock-label { grid-column: auto; color: #cfc6a8; font-size: 0.55em; line-height: 1.05; width: 4.8em; }
.clock-time { font-size: 1.6em; }
.clock-flag { grid-column: auto; font-size: 0.6em; }
.clock.low, .clock.critical { background-color: transparent; }
.clock.low .clock-time, .clock.low .clock-flag { color: #F2C14E; }
.clock.critical .clock-time, .clock.critical .clock-flag { color: #FF6B5E; }
@keyframes loss { 0%, 100% { transform: none; } 25% { transform: translateX(-4px); } 60% { transform: translateX(3px); } }
@keyframes gain { 0%, 100% { transform: none; } 40% { transform: scale(1.06); } }

.beans {
  top: calc(2cqh + 5.6cqw); background: url("assets/ui/p-beans.png") center / 100% 100% no-repeat; border: 0; border-radius: 0; box-shadow: none;
  width: 23cqw; aspect-ratio: 378 / 71; padding: 0; filter: drop-shadow(2px 3px 0 rgba(29, 25, 20, 0.45));
}
.beans .bean-ico { display: none; }
/* lit beans over the six empty slots in the artwork; each fills bottom-up (src/ui.js fillBeanSlots) */
.bean-slots { position: absolute; inset: 0; pointer-events: none; }
.bean-slot { position: absolute; top: 28%; width: 7.6%; height: 46%; }
.bean-slot b { position: absolute; inset: 0; display: block; clip-path: inset(100% 0 0 0); transition: clip-path 0.25s ease-out; }
.bean-slot svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 0 2px rgba(255, 200, 120, 0.55)); }
.bean-slot.pop { animation: gain 0.45s ease-out; }
.reduced-motion .bean-slot b { transition: none; }
.reduced-motion .bean-slot.pop { animation: none; }
.beans #beans { position: absolute; left: 79%; width: 17%; top: 50%; transform: translateY(-50%); text-align: center;
  color: var(--field); font-family: var(--display); font-weight: 400; font-size: 0.85em; white-space: nowrap; }

.zone-banner {
  background: url("assets/ui/p-zone.png") center / 100% 100% no-repeat; border: 0; width: 33cqw; aspect-ratio: 356 / 49;
  padding: 0 1.4cqw 0 14.6cqw; display: flex; align-items: center; color: var(--ink); font-family: var(--body); font-weight: 700; font-size: 0.82em; white-space: nowrap;
  filter: drop-shadow(2px 3px 0 rgba(29, 25, 20, 0.45)); overflow: hidden; text-overflow: ellipsis;
}

/* How to play panel */
.howto-wrap { display: grid; justify-items: center; gap: 1cqh; }
.howto-panel { position: relative; width: min(62cqw, 122cqh); aspect-ratio: 604 / 426;
  background: url("assets/ui/p-howto.png") center / 100% 100% no-repeat; filter: drop-shadow(5px 6px 0 rgba(29, 25, 20, 0.5)); }
.howto-body { position: absolute; left: 9%; right: 7%; top: 33%; bottom: 16%; overflow: auto; font-size: 0.9em; }
.howto-body p { margin: 0 0 0.5em; }
.howto-body .controls { margin: 0; gap: 0.15em 1em; font-size: 0.95em; }
.howto-body .fine { margin: 0.4em 0 0; font-size: 0.85em; }
.pager { position: absolute; top: 84.6%; height: 8.4%; width: 8.6%; border: 0; background: transparent; padding: 0; cursor: pointer; border-radius: 4px; }
.pager.prev { left: 33.8%; } .pager.next { left: 57.6%; }
.pager:hover:not([disabled]) { background: rgba(255, 255, 255, 0.15); }
.pager[disabled] { cursor: default; background: rgba(239, 230, 200, 0.45); }
.pager-count { position: absolute; left: 42.8%; width: 14.2%; top: 85%; height: 7.6%; display: grid; place-items: center;
  font-family: var(--display); font-size: 1em; color: var(--ink); }
