/* October 19-23. Builds on week-2026-09-21.css and week-2026-10-05.css (Chloe's island look).
   Sections: top bar; hub cards; the full-screen adventure frame (.kw on #adventure); panel parts:
   keypad, crayons, letters, typing, compare; finish card. */

/* ---------- top bar: island, last week, sound, drawings, stars ---------- */
.topbar{display:flex;flex-wrap:wrap;align-items:center;gap:10px}
.topbar [data-sound]{margin-left:auto}
.topbar button{font-size:16px;min-height:48px}
.star-count{margin-left:0}

/* ---------- hub ---------- */
.masthead .pip.js-drawing{width:190px}
.week-cards{align-items:stretch}
.week-card>canvas{border-bottom:3px solid var(--ink)}
.teacher-note{margin-top:26px}
.teacher-note p{max-width:880px}

/* ---------- the adventure frame: picture and controls always on one screen ---------- */
html.kw-open,html.kw-open body{overflow:hidden}
#adventure.kw{position:fixed;z-index:60;inset:0;margin:0;width:auto;height:100vh;height:100dvh;border:0;border-radius:0;box-shadow:none;
  padding:8px 12px calc(8px + env(safe-area-inset-bottom));display:grid;grid-template-rows:auto minmax(0,1fr);grid-template-columns:minmax(0,1fr);row-gap:8px;
  background:#f1f4de;background-image:radial-gradient(#43644d12 1px,transparent 1px);background-size:18px 18px}
#adventure.kw .adventure-head{display:flex;align-items:center;gap:10px;margin:0;min-width:0}
#adventure.kw #menu-button,#adventure.kw .kw-sound{min-height:44px;padding:6px 12px;font-size:15px;flex:0 0 auto}
#adventure.kw #adventure-title{flex:1 1 auto;min-width:0;margin:0;font-size:clamp(19px,4.4vw,27px);line-height:1.1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#adventure.kw #activity-progress{font-size:14px;font-weight:600;white-space:nowrap}
#adventure.kw #subject,#adventure.kw #instruction{position:absolute;width:1px;height:1px;margin:-1px;padding:0;border:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
#adventure.kw #play-space{min-height:0;height:100%;display:flex}
.kw-body{flex:1 1 auto;min-width:0;min-height:0;display:flex;flex-direction:column;gap:8px}
.kw-stage{flex:1 1 0;min-height:96px;min-width:0;container-type:size;display:grid;place-items:end center}
.kw-stage canvas.kw-art{width:min(100cqw,calc(100cqh * var(--ar)));max-width:100%;border:3px solid var(--ink);border-radius:18px;background:#fffdf6;box-shadow:3px 4px 0 #b9cab0}
.kw-stage canvas.kw-tap{pointer-events:auto;cursor:pointer;touch-action:manipulation}
.kw-panel{flex:0 0 auto;display:flex;flex-direction:column;gap:7px;min-height:0;overflow:auto;padding:2px}
/* upright: the picture keeps one size (so it never resizes while the controls change) and the controls sit right under it */
@media (max-aspect-ratio:1/1){
  .kw-stage{flex:0 0 auto;height:min(calc((100vw - 24px) / var(--ar) + 2px),44vh)}
}
@media (min-aspect-ratio:1/1){
  .kw-body{flex-direction:row}
  .kw-stage{place-items:center}
  .kw-panel{flex:0 0 min(45%,420px);justify-content:center}
}
@media (max-width:420px){#adventure.kw .kw-sound{display:none}}
@media (max-height:420px){#adventure.kw{padding-top:5px;padding-bottom:5px;row-gap:5px}}

/* ---------- panel parts ---------- */
.kw-ask{margin:0;font-size:18px;line-height:1.3;font-weight:500}
.kw-cap{margin:0;font-size:18px;line-height:1.3;font-weight:500;min-height:3.9em}
.kw-row{display:flex;flex-wrap:wrap;gap:8px;align-items:center}
.kw-row button{min-height:46px;padding:8px 14px;font-size:16px}
.kw-row.kw-small button{min-height:44px;font-size:15px;padding:6px 12px;background:transparent;box-shadow:none}
.kw-line{margin:0;min-height:1.3em;font-size:16px;line-height:1.3;color:#3b5c4d}
.kw-line.good{color:#246b3b;font-weight:600}
.kw-line.bad{color:#9b4a1c;font-weight:600}
.kw-answer{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.kw-eq{font:700 30px/1 'Baloo 2',system-ui,sans-serif;white-space:nowrap}
.kw-out{display:inline-grid;place-items:center;min-width:86px;min-height:48px;padding:0 10px;border:3px dashed #789378;border-radius:14px;background:#fff;font:700 32px/1 'Baloo 2',system-ui,sans-serif}
.kw-answer .primary{margin-left:auto}
.kw-pad{display:grid;grid-template-columns:repeat(6,minmax(44px,1fr));gap:6px}
.kw-pad button{min-height:46px;padding:4px;font:700 24px/1 'Baloo 2',system-ui,sans-serif}
.kw-pad button:disabled{opacity:.45;box-shadow:none}
.kw-crayons{display:grid;grid-template-columns:repeat(5,minmax(48px,1fr));gap:6px}
.crayon{display:grid;justify-items:center;gap:1px;padding:5px 4px;min-height:58px;font-size:15px;line-height:1}
.crayon i{display:block;width:100%;height:13px;border:2px solid var(--ink);border-radius:7px 14px 14px 7px;background:var(--c)}
.crayon b{font:700 20px/1.05 'Baloo 2',system-ui,sans-serif}
.crayon small{font-size:12px}
.crayon.no{opacity:.4;box-shadow:none;animation:kw-no .35s}
.crayon:disabled{opacity:.55}
.kw-letters{display:flex;flex-wrap:wrap;gap:6px;align-items:center}
.kw-letters button{min-width:48px;min-height:52px;padding:4px 8px;font:700 30px/1 'Baloo 2',system-ui,sans-serif;background:#fffdf6}
.kw-letters button.no{animation:kw-no .35s;background:#fde6da}
.kw-letters button.gone{background:#efe3fa;color:#8d62c4;text-decoration:line-through}
.kw-suffix{display:inline-grid;place-items:center;min-height:52px;padding:0 12px;border:2px solid #2f7a45;border-radius:14px;background:#d8f0d0;color:#2f7a45;font:700 26px/1 'Baloo 2',system-ui,sans-serif}
.kw-type{display:flex;gap:8px;align-items:center}
.kw-type input{flex:1 1 0;width:0;min-width:0;min-height:50px;font:600 26px/1.1 Fredoka,system-ui,sans-serif;padding:6px 12px}
.kw-type button{min-height:50px;flex:0 0 auto}
.kw-compare{display:grid;gap:4px;margin:4px 0 0;padding:8px 12px;border-radius:14px;background:#fffdf6;border:2px solid #d8d4b8}
.kw-compare p{margin:0;display:flex;align-items:baseline;gap:10px}
.kw-compare small{flex:0 0 7.2em;font-size:14px}
.kw-compare b{font:700 27px/1.15 'Baloo 2',system-ui,sans-serif;letter-spacing:.06em}
.kw-compare .off{color:#b4542c;text-decoration:line-through}
.kw-compare .glow{color:#8d3fd0;background:#f6ce72;border-radius:6px;padding:0 2px;animation:kw-glow 1.2s ease-in-out infinite}
@keyframes kw-glow{50%{background:#fff0b6}}
@keyframes kw-no{25%{transform:translateX(-5px)}75%{transform:translateX(5px)}}

.kw-grown{display:grid;gap:6px}
.kw-grown p{margin:0;font-size:15px;color:#466556}
.kw-grown>button{justify-self:start;min-height:46px;font-size:16px}
.kw-card{display:flex;flex-wrap:wrap;align-items:center;gap:6px 14px;padding:8px 12px;border:2px dashed #9b542c;border-radius:14px;background:#fff7e8}
.kw-card b{font:700 30px/1.1 'Baloo 2',system-ui,sans-serif;color:#9b542c}
.kw-card span{flex:1 1 12em;font-size:16px}
.kw-card button{min-height:44px;font-size:15px;padding:6px 12px}

/* ---------- finish card ---------- */
.kw-done{flex:1 1 auto;overflow:auto;text-align:center;padding:6px 8px}
.kw-done .reward-drawing{max-width:min(380px,70vw);margin:0 auto}
.kw-done h3{font-size:clamp(24px,5vw,32px);margin:8px 0}
.kw-done p{font-size:18px;margin:0 auto 12px;max-width:620px}
.kw-done .kw-row{justify-content:center}
@media (max-height:500px) and (orientation:landscape){
  .kw-done{display:grid;grid-template-columns:minmax(0,.8fr) minmax(0,1.2fr);align-items:center;text-align:left;gap:14px}
  .kw-done .reward-drawing{grid-row:1/4;max-width:100%}
  .kw-done .kw-row{justify-content:flex-start}
  .kw-done p{margin:0 0 10px}
}
@media (max-width:700px){
  .masthead .pip.js-drawing{width:120px}
  .kw-eq{font-size:26px}
}
@media (max-height:420px){
  .kw-cap,.kw-ask{font-size:16px}
  .kw-pad button,.kw-row button{min-height:44px}
  .kw-letters button,.kw-suffix{min-height:46px}
  .kw-out{min-height:44px}
  .kw-type input,.kw-type button{min-height:46px}
  .kw-compare b{font-size:22px}
  .crayon{min-height:50px}
}
@media(prefers-reduced-motion:reduce){.kw-compare .glow,.crayon.no,.kw-letters button.no{animation:none}}
