/* K-5 math reasoning pictures (k5.js). */
:root { --k5a: #e9a23b; --k5b: #c8366a; --k5plate: #f1ebe3; --k5bag: #b98b5c; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --k5a: #f2b84b; --k5b: #ff7aa2; --k5plate: #283146; --k5bag: #8a6a4a; } }
:root[data-theme="dark"] { --k5a: #f2b84b; --k5b: #ff7aa2; --k5plate: #283146; --k5bag: #8a6a4a; }
.k5-pic { margin: 10px auto 0; text-align: center; }
svg.k5 { width: 100%; height: auto; display: block; margin: 0 auto; }
.k5 .d1 { fill: var(--k5a); }
.k5 .d2 { fill: var(--k5b); }
.k5 .card-bg { fill: var(--k5plate); stroke: var(--line); stroke-width: 2; }
.k5 .plate { fill: var(--k5plate); stroke: var(--line); stroke-width: 2; }
.k5 .frame { fill: none; stroke: var(--ink); stroke-width: 2.5; }
.k5 .frame-line { stroke: var(--ink); stroke-width: 1.5; fill: none; }
.k5 .bag { fill: var(--k5bag); stroke: var(--ink); stroke-width: 2; }
.k5 .bag-tie { fill: none; stroke: var(--ink); stroke-width: 2; }
.k5 .bag-n { fill: #fff; font: 700 30px 'IBM Plex Sans', sans-serif; text-anchor: middle; }
.k5 .op { fill: var(--ink); font: 700 30px 'IBM Plex Sans', sans-serif; text-anchor: middle; }
.k5 .rod { fill: var(--k5a); stroke: var(--ink); stroke-width: 1.5; }
.k5 .rod-line { stroke: var(--ink); stroke-width: 1; opacity: .5; }
.k5 .cube { fill: var(--k5b); stroke: var(--ink); stroke-width: 1.5; }
.k5 .nl { stroke: var(--ink); stroke-width: 2; fill: none; }
.k5 .jump { stroke: var(--accent); stroke-width: 2.5; fill: none; }
.k5 .jl { fill: var(--accent); font: 700 14px 'IBM Plex Sans', sans-serif; text-anchor: middle; }
.k5 .tl { fill: var(--ink); font: 600 13px 'IBM Plex Sans', sans-serif; text-anchor: middle; }
.flash { position: relative; margin: 10px auto 0; text-align: center; }
.flash-pic { animation: k5-hide .2s linear var(--t) forwards; }
.flash-note { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--muted); font-weight: 600; opacity: 0; animation: k5-show .2s linear var(--t) forwards; }
@keyframes k5-hide { to { opacity: 0; visibility: hidden; } }
@keyframes k5-show { to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .flash-pic, .flash-note { animation-duration: .01s; } }
table.rt { border-collapse: collapse; margin: 10px auto 0; font-size: 1.15rem; font-variant-numeric: tabular-nums; }
table.rt th, table.rt td { border: 2px solid var(--line); padding: 6px 12px; text-align: center; }
table.rt th { font-size: .85rem; color: var(--muted); font-weight: 600; text-align: left; }
table.rt td.q { color: var(--accent); font-weight: 700; }
.say { border: 0; background: none; font-size: 1.1rem; padding: 2px 6px; cursor: pointer; vertical-align: middle; border-radius: 8px; }
.say:focus-visible { outline: 2px solid var(--accent); }
.no-say .say { display: none; }
.intro svg.k5 { max-width: 260px; }
.k5 .wa { fill: #7fb4e6; }
.k5-pic .mix { margin: 8px 0 2px; font-weight: 600; color: var(--muted); }
.k5 .bag-cover { transition: opacity .9s ease; }
.k5 .bag-ghost { fill: none; stroke: var(--muted); stroke-width: 2; stroke-dasharray: 5 5; opacity: 0; transition: opacity .9s ease; }
.k5 .inside { opacity: 0; transition: opacity .9s ease .3s; }
svg.bagpic.open .bag-cover { opacity: 0; }
svg.bagpic.open .bag-ghost, svg.bagpic.open .inside { opacity: 1; }
.k5 .plate { stroke: var(--muted); stroke-width: 2.5; }
table.eqs { border-collapse: collapse; margin: 0 auto; }
table.eqs td { padding: 3px 2px; text-align: center; white-space: nowrap; }
table.eqs td:first-child { text-align: right; }
/* Phone fit (K-5 pages only): a phone-style number pad, a shorter question card, and capped pictures. */
.streak-zone { height: 26px; }
.qcard { min-height: 0; padding: 12px 12px; margin-top: 4px; }
.answers { margin-top: 8px; }
.mp-ans { font-size: 1.6rem; min-height: 1.9em; margin: 2px 0 4px; }
.mp-pad { grid-template-columns: repeat(3, 1fr); gap: 6px; max-width: 300px; }
.mp-pad .key { min-height: 42px; font-size: 1.3rem; }
.mp-pad .key.off { display: none; }
.mp-pad .key.wide { grid-column: auto; font-size: .85rem; }
/* Phone layout: 1 2 3 / 4 5 6 / 7 8 9 / ⌫ 0 next (the pad's own order is 7 8 9 first). */
.mp-pad .key:nth-child(9) { order: 1; } .mp-pad .key:nth-child(10) { order: 2; } .mp-pad .key:nth-child(11) { order: 3; }
.mp-pad .key:nth-child(5) { order: 4; } .mp-pad .key:nth-child(6) { order: 5; } .mp-pad .key:nth-child(7) { order: 6; }
.mp-pad .key:nth-child(1) { order: 7; } .mp-pad .key:nth-child(2) { order: 8; } .mp-pad .key:nth-child(3) { order: 9; }
.mp-pad .key:nth-child(4) { order: 10; } .mp-pad .key:nth-child(13) { order: 11; } .mp-pad .key:nth-child(15) { order: 12; }
.qcard svg.k5 { width: 100%; max-height: 130px; }
.qcard .k5-pic, .qcard .flash { margin-top: 6px; }
.qcard .mq { font-size: 1.6rem; margin-top: 6px; }
table.rt { font-size: 1rem; }
table.rt th, table.rt td { padding: 4px 9px; }
.check-btn { margin-top: 6px; }
#dg-msg:empty { min-height: 0; margin: 4px 0; }
/* Stop the pull-down-to-refresh gesture from restarting the game while a student drags or swipes. */
html, body { overscroll-behavior-y: none; }
