/* Scan & Play games (/play/<book>/<n>), loaded only on game pages. Phone first: everything fits a 360px screen. */
.play-page { --world: #5B3FA0; --world-tint: #EEE8FB; --good: #2F9E44; --good-ink: #1B5E2E; --bad: #E03131; --gold: #FFC93C; padding: clamp(18px, 3.5vw, 40px) 0 clamp(48px, 7vw, 88px); background: radial-gradient(90% 60% at 100% 0%, color-mix(in srgb, var(--world-tint) 80%, transparent), transparent 70%), radial-gradient(70% 50% at 0% 30%, rgba(255, 201, 60, .10), transparent 70%); }
.play-page .wrap { width: min(980px, 100% - 40px); }
.play-head { margin-bottom: 16px; }
.play-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 12px; }
.world-badge { display: inline-flex; align-items: center; gap: 7px; padding: 6px 13px 6px 10px; border-radius: 999px; background: var(--world); color: #fff; font-size: .84rem; font-weight: 750; letter-spacing: .01em; box-shadow: 0 6px 14px -8px var(--world); }
.world-badge .icon, .world-badge .spark { width: 17px; height: 17px; color: #fff; }
.play-kind, .play-pageno { display: inline-flex; align-items: center; padding: 5px 12px; border-radius: 999px; font-size: .84rem; font-weight: 700; }
.play-kind { background: #fff; color: var(--ink); border: 1.5px solid color-mix(in srgb, var(--world) 35%, transparent); }
.play-pageno { color: var(--ink-2); }
.play-title { font-family: var(--serif); font-size: clamp(2rem, 6vw, 3.2rem); font-weight: 600; letter-spacing: -.02em; line-height: 1.05; font-variation-settings: 'opsz' 96; }
.play-instructions { margin: 10px 0 0; font-size: clamp(1.08rem, 2.4vw, 1.25rem); font-weight: 550; color: var(--ink-2); max-width: 58ch; }

/* Shell */
.game { position: relative; }
.game-board { position: relative; padding: clamp(12px, 2.6vw, 26px); border-radius: 26px; background: radial-gradient(circle at 12px 12px, color-mix(in srgb, var(--world) 10%, transparent) 2px, transparent 2.5px) 0 0 / 22px 22px, var(--world-tint); border: 2px solid color-mix(in srgb, var(--world) 22%, transparent); box-shadow: 0 1px 0 #fff inset, 0 18px 40px -26px color-mix(in srgb, var(--world) 70%, #000); }
.game-board::before { content: ''; position: absolute; left: 22px; right: 22px; top: -2px; height: 6px; border-radius: 0 0 6px 6px; background: linear-gradient(90deg, #FF6B6B, #FFA94D, #FFD43B, #69DB7C, #4DABF7, #9775FA, #F783AC); }
.game-area { position: relative; min-height: 120px; }
.game-area[inert] { cursor: default; }
.game-loading, .game-noscript { margin: 0; padding: 30px 8px; text-align: center; font-weight: 650; color: var(--ink-2); }
.game-noscript a { color: var(--teal); }
.game-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.game-status { min-height: 1.6em; margin: 14px 0 0; padding: 0 4px; font-size: 1.05rem; font-weight: 700; color: var(--ink-2); text-align: center; }
.game-status:not(:empty) { padding: 10px 16px; border-radius: 16px; background: #fff; border: 1.5px solid var(--line); }
.game-status[data-tone="good"] { color: var(--good-ink); background: #EBFBEE; border-color: #B2F2BB; }
.game-status[data-tone="try"] { color: #8A2C0D; background: #FFF4E6; border-color: #FFD8A8; }
.game-status[data-tone="hint"] { color: #4A2F8F; background: #F3F0FF; border-color: #D0BFFF; }
.game-controls { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 14px; }
.game-controls .btn { min-height: 50px; padding: 12px 20px; font-size: 1.02rem; }
.game-controls .btn-ghost { background: #fff; }
.game-check { background: var(--world); border-color: var(--world); }
.game-controls [data-reset-label] { white-space: nowrap; }
html:not(.js) .game-controls { display: none; }
.game.is-solved .game-check { background: #1E7B34; border-color: #1E7B34; }

/* Success */
.game-win { position: relative; overflow: hidden; margin-top: 18px; padding: 26px 20px 24px; border-radius: 26px; text-align: center; background: radial-gradient(80% 90% at 50% 0%, #FFF6D6, transparent 70%), linear-gradient(160deg, #FFFBEF, #F4EEFF); border: 2px solid #FFE08A; box-shadow: 0 20px 44px -28px rgba(91, 63, 160, .55); }
.game-win-star { width: 104px; height: 104px; margin: 0 auto 8px; }
.game-win.is-popping .game-win-star { animation: win-star .9s cubic-bezier(.2, 1.6, .4, 1) both; }
.game-win.is-popping { animation: win-pop .45s cubic-bezier(.2, 1.4, .4, 1) both; }
.game-win-title { font-family: var(--serif); font-size: clamp(1.9rem, 6vw, 2.6rem); font-weight: 650; letter-spacing: -.02em; color: var(--ink); }
.game-win-title:focus, .game-win-title:focus-visible { outline: none; } /* focused only so screen readers start here; not a control */
.game-win-text { margin: 8px auto 0; max-width: 46ch; font-size: 1.1rem; font-weight: 600; color: var(--ink-2); }
.game-win-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 18px; }
.game-win-actions .btn { min-height: 50px; }
.game-win-actions .btn-ghost { background: #fff; }
.game-confetti { position: absolute; left: 50%; top: 80px; width: 0; height: 0; pointer-events: none; z-index: 2; }
.game-confetti .bit { position: absolute; left: -5px; top: -7px; width: 10px; height: 14px; border-radius: 2px; background: var(--c); animation: confetti 1.9s cubic-bezier(.15, .7, .3, 1) var(--d) both; }
.game-confetti .bit.round { width: 11px; height: 11px; border-radius: 50%; }
@keyframes confetti { 0% { transform: translate(0, 0) rotate(0) scale(.4); opacity: 1; } 35% { transform: translate(calc(var(--x) * .7), var(--y)) rotate(calc(var(--r) * .5)) scale(1); opacity: 1; } 85% { opacity: 1; } 100% { transform: translate(var(--x), 280px) rotate(var(--r)) scale(.9); opacity: 0; } }
@keyframes win-pop { from { transform: scale(.9); } 60% { transform: scale(1.03); } to { transform: none; } }
@keyframes win-star { 0% { transform: scale(.2) rotate(-40deg); } 70% { transform: scale(1.12) rotate(8deg); } 100% { transform: none; } }

/* Below the game */
.play-nav { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 10px; margin-top: 28px; }
.play-nav > :last-child { justify-self: end; }
.play-nav .btn { max-width: 100%; background: #fff; }
.play-nav .btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.play-cta { margin-top: 30px; }
.play-privacy { display: flex; gap: 10px; align-items: flex-start; margin: 22px 0 0; font-size: .9rem; color: var(--ink-3); }
.play-privacy .icon { color: var(--teal); margin-top: 2px; }

/* Icons and tiles */
.gicon { display: block; width: 100%; height: 100%; overflow: visible; }
.gtile { position: relative; display: block; aspect-ratio: 1; border-radius: 16px; background: #fff; border: 2px solid rgba(28, 34, 56, .1); box-shadow: 0 3px 0 rgba(28, 34, 56, .07); }
.gtile > .gicon { position: absolute; inset: 8%; width: 84%; height: 84%; }

/* Keyboard cursor inside boards: only while the board has keyboard focus. */
.maze-board:focus-visible, .dots-board:focus-visible, .px-board:focus-visible, .count-board:focus-visible { outline: 3px solid var(--teal); outline-offset: 4px; border-radius: 14px; }

/* Maze */
.maze-board { position: relative; width: min(100%, 600px, calc((100dvh - 150px) * var(--ratio, 1))); margin: 0 auto; touch-action: none; user-select: none; -webkit-user-select: none; cursor: pointer; }
.maze-svg { width: 100%; height: auto; }
.maze-floor { fill: #fff; stroke: color-mix(in srgb, var(--world) 25%, transparent); stroke-width: 1.4; }
.maze-start-cell { fill: color-mix(in srgb, #69DB7C 30%, transparent); }
.maze-end-cell { fill: color-mix(in srgb, #FFD43B 40%, transparent); }
.maze-walls { fill: none; stroke: var(--ink); stroke-width: 1.45; stroke-linecap: round; stroke-linejoin: round; }
.maze-trail { fill: none; stroke: #FFC93C; stroke-width: 4.8; stroke-linecap: round; stroke-linejoin: round; }
.maze-arrow { fill: var(--world); }
.maze-token { transition: transform .12s ease-out; }
.maze-token-bg { fill: #fff; stroke: var(--ink); stroke-width: .8; }
.maze-goal-bg { fill: #FFF3BF; stroke: var(--ink); stroke-width: .8; }
.maze-goal { animation: bob 1.8s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.maze-hints path { fill: #F06595; stroke: #fff; stroke-width: .6; stroke-linejoin: round; opacity: 0; }
.maze-hints.is-on path { animation: sparkle 1.1s ease-in-out calc(var(--i) * 110ms) 3 both; }
.maze-board.is-bump { animation: bump .35s ease; }
.game.is-solved .maze-trail { stroke: #8CE99A; }
@keyframes sparkle { 0%, 100% { opacity: 0; } 50% { opacity: 1; } }
@keyframes bump { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
@keyframes bob { 0%, 100% { translate: 0 0; } 50% { translate: 0 -1px; } }

/* Word search */
.ws { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; justify-items: center; }
.ws-board { position: relative; width: min(100%, 540px); aspect-ratio: 1; padding: 6px; border-radius: 18px; background: #fff; border: 2px solid rgba(28, 34, 56, .12); }
.ws-marks { position: absolute; inset: 6px; width: calc(100% - 12px); height: calc(100% - 12px); pointer-events: none; }
.ws-found { stroke-width: .74; stroke-linecap: round; stroke-opacity: .5; }
.ws-preview { stroke: var(--world); stroke-opacity: .35; stroke-width: .74; stroke-linecap: round; opacity: 0; }
.ws-preview.is-on { opacity: 1; }
.ws-grid { position: relative; display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); width: 100%; height: 100%; container-type: inline-size; touch-action: none; user-select: none; -webkit-user-select: none; }
.ws-cell { display: grid; place-items: center; min-width: 0; padding: 0; border: 0; border-radius: 50%; background: transparent; font: 750 calc(100cqw / var(--n) * .54) / 1 var(--sans); color: var(--ink); cursor: pointer; }
.ws-cell:focus-visible { outline: 3px solid var(--teal); outline-offset: -2px; }
.ws-cell.is-first { background: var(--world); color: #fff; box-shadow: 0 0 0 3px color-mix(in srgb, var(--world) 30%, transparent); }
.ws-cell.is-hint { animation: glow 1.2s ease-in-out 2; }
.ws-side { width: min(100%, 540px); }
.ws-title { margin: 0 0 8px; font-size: .82rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2); }
.ws-words { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; }
.ws-word { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 6px 14px 6px 8px; border-radius: 999px; background: #fff; border: 1.5px solid rgba(28, 34, 56, .14); font-weight: 750; letter-spacing: .06em; }
.ws-tick { width: 22px; height: 22px; border-radius: 50%; border: 2px solid rgba(28, 34, 56, .3); flex: none; }
.ws-word.is-found { background: #EBFBEE; border-color: #8CE99A; color: var(--good-ink); }
.ws-word.is-found span:last-child { text-decoration: line-through; text-decoration-thickness: 2px; }
.ws-word.is-found .ws-tick { border-color: var(--good); background: var(--good) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m6 12.5 4 4 8-9' fill='none' stroke='%23fff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 100% no-repeat; }
@keyframes glow { 50% { background: #FFD43B; box-shadow: 0 0 0 6px rgba(255, 212, 59, .45); } }
@media (min-width: 860px) { .ws { grid-template-columns: minmax(0, 1fr) 230px; align-items: start; } .ws-words { flex-direction: column; align-items: flex-start; } }

/* Dot-to-dot */
.dots-board { position: relative; width: min(100%, 600px, calc((100dvh - 160px))); margin: 0 auto; border-radius: 18px; background: #fff; border: 2px solid rgba(28, 34, 56, .12); touch-action: none; user-select: none; -webkit-user-select: none; cursor: pointer; }
.dots-svg { width: 100%; height: auto; }
.dots-shape { fill: transparent; transition: fill .8s ease; }
.dots-extra { fill: none; stroke: var(--ink); stroke-opacity: .28; stroke-linecap: round; stroke-linejoin: round; transition: stroke-opacity .6s; }
.dots-board.is-complete .dots-extra { stroke-opacity: 1; }
.dots-line { fill: none; stroke: var(--world); stroke-linecap: round; stroke-linejoin: round; }
.dots-board.is-complete .dots-line { stroke: var(--ink); }
.dots-close { opacity: 0; }
.dots-close.is-on { opacity: 1; }
.dots-dot circle { fill: var(--ink); }
.dots-dot text { fill: var(--ink); font-family: var(--sans); font-weight: 800; paint-order: stroke; stroke: #fff; stroke-width: .35em; stroke-linejoin: round; }
.dots-dot.is-joined circle { fill: var(--world); }
.dots-dot.is-joined text { fill: var(--ink-3); }
.dots-board.is-complete .dots-dot { opacity: 0; transition: opacity .6s; }
.dots-ring { fill: rgba(255, 107, 107, .14); stroke: #FF6B6B; animation: ring 1.4s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.dots-ring.is-hint { stroke: #FAB005; fill: rgba(255, 212, 59, .35); animation: ring .5s ease-in-out 5; }
.dots-board.is-complete .dots-ring { display: none; }
.dots-cursor { fill: none; stroke: var(--teal); stroke-dasharray: 2 1.5; }
.dots-colors { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; margin-top: 14px; }
.dots-colors-label { font-weight: 800; color: var(--ink-2); margin-right: 4px; }
.swatch-btn { width: 44px; height: 44px; border-radius: 50%; border: 3px solid #fff; background: var(--c); box-shadow: 0 0 0 1.5px rgba(28, 34, 56, .25); cursor: pointer; }
.swatch-btn[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--ink); }
@keyframes ring { 50% { transform: scale(1.25); } }

/* Color by number */
.px { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; justify-items: center; }
.px-board { width: min(100%, 560px, calc((100dvh - 170px) * var(--ratio, 1))); touch-action: none; user-select: none; -webkit-user-select: none; cursor: crosshair; --cur: #E53935; }
.px-svg { width: 100%; height: auto; }
.px-bg { fill: #fff; stroke: rgba(28, 34, 56, .14); stroke-width: .6; }
.px-cell rect { fill: #F6F1E7; stroke: rgba(28, 34, 56, .18); stroke-width: .35; transition: fill .15s; }
.px-cell text { font: 800 6px var(--sans); fill: var(--ink-2); pointer-events: none; }
.px-cell.is-wrong rect { stroke: var(--bad); stroke-width: 1.2; animation: wiggle .35s ease 4; transform-box: fill-box; transform-origin: center; }
.px-cell.is-hint rect { stroke: #FAB005; stroke-width: 1.4; animation: glow-px 1s ease-in-out 3; }
.game.is-solved .px-cell text { opacity: 0; transition: opacity .6s; }
.game.is-solved .px-cell rect { stroke-opacity: 0; transition: stroke-opacity .6s; }
.px-cursor { fill: none; stroke: var(--ink); stroke-width: 1.1; stroke-dasharray: 2 1.4; display: none; }
.px-board:focus-visible .px-cursor { display: block; }
.px-side { display: grid; gap: 10px; width: min(100%, 560px); }
.px-tools { display: flex; justify-content: center; gap: 6px; padding: 4px; border-radius: 999px; background: #fff; border: 2px solid rgba(28, 34, 56, .1); justify-self: center; }
.px-tool { display: inline-flex; align-items: center; gap: 7px; min-height: 44px; padding: 8px 16px; border: 0; border-radius: 999px; background: transparent; font-weight: 750; color: var(--ink-2); cursor: pointer; }
.px-tool[aria-pressed="true"] { background: var(--world); color: #fff; }
.px-palette { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.px-swatch { display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 5px 14px 5px 5px; border-radius: 999px; border: 2px solid rgba(28, 34, 56, .14); background: #fff; font-weight: 750; cursor: pointer; }
.px-swatch-dot { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--c, #fff); box-shadow: inset 0 0 0 1.5px rgba(0, 0, 0, .18); }
.px-swatch-dot b { min-width: 22px; padding: 0 4px; border-radius: 999px; background: rgba(255, 255, 255, .88); color: var(--ink); font-size: .8rem; line-height: 22px; text-align: center; }
.px-eraser .px-swatch-dot { background: repeating-linear-gradient(45deg, #fff 0 5px, #F1F3F5 5px 10px); }
.px-swatch[aria-pressed="true"] { border-color: var(--ink); box-shadow: 0 0 0 2px var(--ink); }
@keyframes wiggle { 25% { transform: rotate(-8deg); } 75% { transform: rotate(8deg); } }
@keyframes glow-px { 50% { stroke-width: 2.6; } }
@media (min-width: 860px) { .px { grid-template-columns: minmax(0, 1fr) 230px; align-items: start; } .px-palette { flex-direction: column; flex-wrap: nowrap; } .px-tools { justify-self: stretch; } .px-tool { flex: 1; justify-content: center; padding: 8px 10px; } }

/* Counting */
.count { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.count-board { width: min(100%, 720px); margin: 0 auto; touch-action: manipulation; user-select: none; -webkit-user-select: none; cursor: pointer; }
.count-svg { width: 100%; height: auto; }
.count-bg { fill: #fff; stroke: color-mix(in srgb, var(--world) 30%, transparent); stroke-width: 3; }
.count-halo { fill: #69DB7C; opacity: 0; transition: opacity .2s; }
.count-thing.is-marked .count-halo { opacity: .35; }
.count-check { opacity: 0; transition: opacity .15s; }
.count-check circle { fill: var(--good); stroke: #fff; stroke-width: 2; }
.count-check path { fill: none; stroke: #fff; stroke-linecap: round; stroke-linejoin: round; }
.count-thing.is-marked .count-check { opacity: 1; }
.count-thing.is-hint { animation: hop .5s ease 5; transform-box: fill-box; transform-origin: center bottom; }
.count-cursor { fill: none; stroke: var(--teal); stroke-width: 3; stroke-dasharray: 8 5; display: none; }
.count-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); gap: 10px; list-style: none; }
.count-row { display: grid; grid-template-columns: 54px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 18px; background: #fff; border: 2px solid rgba(28, 34, 56, .1); }
.count-row .gtile { width: 54px; border: 0; box-shadow: none; padding: 4px; background: var(--world-tint); }
.count-name { font-weight: 750; text-transform: capitalize; overflow-wrap: anywhere; }
.count-row.is-right { border-color: #8CE99A; background: #F4FCF5; }
.count-row.is-wrong { border-color: #FFA8A8; background: #FFF5F5; }
.stepper { display: flex; align-items: center; gap: 4px; }
.step { width: 44px; height: 44px; border-radius: 14px; border: 2px solid rgba(28, 34, 56, .16); background: var(--paper); font: 800 1.4rem/1 var(--sans); cursor: pointer; }
.step:active { transform: translateY(1px); }
.count-input { width: 52px; height: 48px; border-radius: 14px; border: 2px solid rgba(28, 34, 56, .22); text-align: center; font: 800 1.35rem var(--sans); -moz-appearance: textfield; appearance: textfield; }
.count-input::-webkit-inner-spin-button, .count-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
@keyframes hop { 50% { transform: translateY(-14%) scale(1.06); } }

/* Patterns and odd one out */
.choice-rows { display: grid; gap: 12px; list-style: none; counter-reset: row; }
.choice-rows { padding-top: 6px; }
.choice-row { position: relative; display: grid; gap: 10px; padding: 14px 12px 12px; border-radius: 20px; background: #fff; border: 2px solid rgba(28, 34, 56, .1); }
.choice-num { position: absolute; left: -6px; top: -9px; z-index: 1; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--world); color: #fff; font-weight: 800; font-size: .9rem; box-shadow: 0 0 0 3px #fff; }
.choice-row.is-done { border-color: #8CE99A; background: #F4FCF5; }
.choice-row.is-done .choice-num { background: var(--good); }
.choice-row.is-hint { animation: glow-row 1s ease 2; }
.pat-seq { display: flex; gap: 6px; align-items: center; min-width: 0; }
.pat-seq .gtile { flex: 1 1 0; min-width: 0; max-width: 76px; border-radius: 14px; }
.pat-slot { border: 2.5px dashed color-mix(in srgb, var(--world) 55%, transparent); background: var(--world-tint); }
.pat-slot b { position: absolute; inset: 0; display: grid; place-items: center; font: 800 clamp(1.1rem, 5vw, 1.8rem) var(--serif); color: var(--world); }
.pat-slot.is-filled { border-style: solid; border-color: var(--good); background: #EBFBEE; animation: win-pop .4s ease both; }
.choice-opts { display: flex; gap: 8px; }
.choice { position: relative; display: grid; place-items: center; flex: 1 1 0; min-width: 48px; max-width: 84px; aspect-ratio: 1; padding: 6px; border-radius: 16px; border: 2.5px solid rgba(28, 34, 56, .14); background: var(--paper); cursor: pointer; transition: transform .12s, border-color .2s; }
.choice:hover:not(:disabled) { transform: translateY(-2px); border-color: var(--world); }
.choice:disabled { cursor: default; }
.choice.is-crossed { opacity: .38; }
.choice.is-crossed::after { content: ''; position: absolute; inset: 14%; background: linear-gradient(to top right, transparent calc(50% - 2px), var(--bad) calc(50% - 2px) calc(50% + 2px), transparent calc(50% + 2px)); }
.choice.is-right { border-color: var(--good); background: #EBFBEE; box-shadow: 0 0 0 4px rgba(47, 158, 68, .2); opacity: 1; }
.choice.is-shake { animation: bump .35s ease; }
.choice.is-hint { animation: glow 1s ease 2; }
@keyframes glow-row { 50% { box-shadow: 0 0 0 6px rgba(255, 212, 59, .5); } }
@media (min-width: 700px) { .choice-row { padding: 14px 16px; align-items: center; } .choice-row:has(.pat-seq) { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); } }

/* Secret code */
.code { display: grid; gap: 10px; }
.code-title { margin: 6px 0 0; font-size: .82rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2); }
.code-key { display: grid; grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 6px; list-style: none; padding: 10px; border-radius: 18px; background: #fff; border: 2px solid rgba(28, 34, 56, .1); }
.code-key li { display: flex; align-items: center; justify-content: center; gap: 4px; min-height: 36px; border-radius: 10px; background: var(--paper); font-weight: 700; color: var(--ink-2); }
.code-key li.is-used { background: color-mix(in srgb, var(--world) 12%, #fff); color: var(--ink); }
.code-key-sym { font-weight: 800; color: var(--world); }
.code-key b { font-size: 1.05rem; }
.code-message { display: flex; flex-wrap: wrap; gap: 14px 22px; padding: 14px 8px; border-radius: 18px; background: #fff; border: 2px solid rgba(28, 34, 56, .1); justify-content: center; }
.code-word { display: flex; flex-wrap: wrap; gap: 3px; justify-content: center; }
.code-cell { display: grid; justify-items: center; gap: 3px; }
.code-sym { min-width: 30px; padding: 1px 6px; border-radius: 8px; background: color-mix(in srgb, var(--world) 14%, #fff); color: var(--world); font-weight: 800; font-size: .92rem; text-align: center; }
.code-box { width: 44px; height: 52px; padding: 0; border-radius: 12px; border: 2.5px solid rgba(28, 34, 56, .25); background: var(--paper); text-align: center; text-transform: uppercase; font: 800 1.5rem var(--sans); color: var(--ink); caret-color: var(--world); }
.code-box:focus { outline: none; border-color: var(--world); background: #fff; box-shadow: 0 0 0 4px color-mix(in srgb, var(--world) 25%, transparent); }
.code-cell.is-right .code-box { border-color: var(--good); background: #EBFBEE; }
.code-cell.is-wrong .code-box { border-color: var(--bad); background: #FFF5F5; animation: bump .35s ease; }
.code-box.is-hinted { border-color: #9775FA; background: #F3F0FF; color: #4A2F8F; }
.code-cell.is-hint .code-box { animation: win-pop .4s ease; }
.game.is-solved .code-box { border-color: var(--good); background: #EBFBEE; }

/* Picture sudoku */
.sdk { display: grid; gap: 16px; justify-items: center; }
.sdk-grid { display: grid; grid-template-columns: 1fr 1fr 3px 1fr 1fr; grid-template-rows: auto auto 3px auto auto; gap: 5px; width: min(100%, 380px); padding: 8px; border-radius: 22px; background: var(--ink); }
.sdk-cell { position: relative; display: grid; place-items: center; aspect-ratio: 1; padding: 10%; border: 0; border-radius: 12px; background: #fff; cursor: pointer; }
.sdk-cell.is-given { background: color-mix(in srgb, var(--world) 16%, #fff); cursor: default; }
.sdk-cell.is-selected { box-shadow: inset 0 0 0 4px var(--world); background: #FFF9DB; }
.sdk-cell.is-clash { background: #FFE3E3; }
.sdk-cell.is-hinted { background: #F3F0FF; }
.sdk-cell.is-wrong { animation: wiggle .35s ease 4; background: #FFE3E3; }
.sdk-cell.is-hint { animation: win-pop .4s ease; }
.sdk-cell:focus-visible { outline: 3px solid #FFD43B; outline-offset: -3px; }
.sdk-picker { display: flex; justify-content: center; gap: 8px; width: min(100%, 380px); }
.sdk-pick { position: relative; display: grid; place-items: center; flex: 1 1 0; min-width: 48px; max-width: 70px; aspect-ratio: 1; padding: 8px; border-radius: 18px; border: 2.5px solid rgba(28, 34, 56, .16); background: #fff; cursor: pointer; }
.sdk-pick:hover { border-color: var(--world); }
.sdk-pick-key { position: absolute; right: -5px; top: -5px; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--ink); color: #fff; font-size: .72rem; font-weight: 800; }
.sdk-clear { font: 700 2rem/1 var(--sans); color: var(--ink-2); }

/* ---- Part 2: shared pieces ---- */
.ui { width: 22px; height: 22px; flex: none; }
.star-pic { width: 22px; height: 22px; flex: none; overflow: visible; }
.star-pic path { fill: #F1F3F5; stroke: #ADB5BD; stroke-width: 1.6; }
.star-pic.is-on path { fill: #FFC93C; stroke: var(--ink); }
.drag-ghost { position: fixed; left: 0; top: 0; z-index: 60; pointer-events: none; translate: -50% -64px; padding: 10px 18px; border-radius: 999px; border: 2.5px solid var(--ink); background: #FFD43B; color: var(--ink); font: 800 1.1rem/1.1 var(--sans); white-space: nowrap; box-shadow: 0 14px 26px -10px rgba(28, 34, 56, .55); rotate: -3deg; }
.game-win-extra { max-width: 560px; margin: 16px auto 0; text-align: left; }
.win-facts { padding: 16px 18px; border-radius: 20px; background: #fff; border: 2.5px dashed #FFD43B; }
.win-facts-title { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font-family: var(--serif); font-size: 1.3rem; font-weight: 650; }
.win-facts-title .ui { width: 26px; height: 26px; color: #E67700; }
.win-facts ul { display: grid; gap: 8px; margin: 0; padding-left: 1.25em; color: var(--ink-2); font-weight: 560; }
.win-facts li::marker { color: #F59F00; }
@keyframes draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes fade-out { 0%, 60% { opacity: 1; } 100% { opacity: 0; } }
@keyframes ring-pop { 0% { transform: scale(.6); } 70% { transform: scale(1.08); } 100% { transform: none; } }
@keyframes glow-pulse { 50% { opacity: .45; transform: scale(1.06); } }
@keyframes nudge { 50% { transform: translateX(4px); } }
@keyframes pop-in { 0% { transform: scale(.85); opacity: 0; } 100% { transform: none; opacity: 1; } }

/* Matching */
.mt { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) clamp(40px, 13vw, 130px) minmax(0, 1fr); grid-template-rows: repeat(var(--rows), auto); row-gap: 10px; max-width: 720px; margin: 0 auto; }
.mt-col { display: grid; grid-row: 1 / span var(--rows); grid-template-rows: subgrid; row-gap: 10px; }
.mt-col-l { grid-column: 1; }
.mt-col-r { grid-column: 3; }
.mt-item { grid-row: var(--row); position: relative; display: flex; align-items: center; gap: 10px; min-height: 64px; padding: 8px 12px; border-radius: 18px; border: 2.5px solid rgba(28, 34, 56, .14); background: #fff; font: 750 1.08rem/1.2 var(--sans); color: var(--ink); text-align: left; cursor: pointer; touch-action: pan-y; user-select: none; -webkit-user-select: none; box-shadow: 0 3px 0 rgba(28, 34, 56, .08); transition: transform .12s, border-color .2s, background-color .2s; }
.mt-item:hover:not(.is-matched) { border-color: var(--world); transform: translateY(-1px); }
.mt-pic { width: 52px; height: 52px; flex: none; }
.mt-item.is-pic { justify-content: center; }
.mt-text { min-width: 0; overflow-wrap: break-word; hyphens: auto; }
.mt-dot { position: absolute; top: 50%; width: 18px; height: 18px; margin-top: -9px; border-radius: 50%; background: #fff; border: 3px solid var(--ink); }
.mt-l .mt-dot { right: -11px; }
.mt-r .mt-dot { left: -11px; }
.mt-l { padding-right: 16px; }
.mt-r { padding-left: 16px; }
.mt-item.is-selected { border-color: var(--world); background: var(--world-tint); box-shadow: 0 0 0 4px color-mix(in srgb, var(--world) 25%, transparent); }
.mt-item.is-selected .mt-dot { background: var(--world); animation: ring 1s ease-in-out infinite; }
.mt-item.is-target { border-color: #FAB005; background: #FFF9DB; transform: scale(1.03); }
.mt-item.is-matched { border-color: var(--c); background: color-mix(in srgb, var(--c) 15%, #fff); cursor: default; box-shadow: 0 3px 0 color-mix(in srgb, var(--c) 45%, transparent); }
.mt-item.is-matched .mt-dot { background: var(--c); }
.mt-item.is-shake { animation: bump .35s ease; }
.mt-item.is-hint { animation: glow-row 1s ease 3; }
.mt-item.is-pop { animation: win-pop .45s ease; }
.mt-lines { position: absolute; left: 0; top: 0; z-index: 1; pointer-events: none; overflow: visible; }
.mt-link-under { stroke: var(--ink); stroke-width: 9; stroke-linecap: round; }
.mt-link-top { stroke-width: 5; stroke-linecap: round; }
.mt-link circle { stroke: var(--ink); stroke-width: 3; }
.mt-link.is-new line { stroke-dasharray: 1; animation: draw .45s ease-out both; }
.mt-link.is-new .mt-link-under { stroke-dasharray: none; animation: fade-in-line .45s ease-out both; }
@keyframes fade-in-line { from { opacity: 0; } }
.mt-rubber { stroke: var(--world); stroke-width: 5; stroke-linecap: round; stroke-dasharray: 2 10; opacity: 0; }
.mt-rubber.is-on { opacity: 1; }
.mt-wrong { stroke: var(--bad); stroke-width: 5; stroke-linecap: round; stroke-dasharray: 8 8; animation: fade-out .7s ease forwards; }

/* Quiz */
.qz { display: grid; gap: 12px; max-width: 660px; margin: 0 auto; }
.qz-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px; padding: 0 4px; }
.qz-count { margin: 0; font-weight: 800; color: var(--ink-2); }
.qz-pips { display: flex; flex-wrap: wrap; gap: 7px; margin: 0; padding: 0; list-style: none; }
.qz-pip { width: 15px; height: 15px; border-radius: 50%; background: #fff; border: 2.5px solid rgba(28, 34, 56, .25); transition: transform .2s; }
.qz-pip.is-current { border-color: var(--world); background: var(--world-tint); transform: scale(1.3); }
.qz-pip.is-right { background: var(--good); border-color: var(--good); }
.qz-pip.is-miss { background: #FFC93C; border-color: #E8A400; }
.qz-card { padding: clamp(16px, 3vw, 24px); border-radius: 24px; background: #fff; border: 2px solid rgba(28, 34, 56, .1); box-shadow: 0 4px 0 rgba(28, 34, 56, .06); }
.qz-q { margin: 0 0 16px; font-family: var(--serif); font-size: clamp(1.35rem, 4.8vw, 1.8rem); font-weight: 600; line-height: 1.2; letter-spacing: -.01em; }
.qz-q:focus { outline: none; }
.qz-opts { display: grid; gap: 10px; }
.qz-opt { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 60px; padding: 9px 12px 9px 9px; border-radius: 18px; border: 2.5px solid color-mix(in srgb, var(--c) 60%, #fff); background: color-mix(in srgb, var(--c) 11%, #fff); font: 700 1.12rem/1.25 var(--sans); color: var(--ink); text-align: left; cursor: pointer; transition: transform .12s, box-shadow .2s; animation: pop-in .3s ease both; }
.qz-opt:nth-child(2) { animation-delay: 50ms; }
.qz-opt:nth-child(3) { animation-delay: 100ms; }
.qz-opt:nth-child(4) { animation-delay: 150ms; }
.qz-opt:hover:not([aria-disabled="true"]) { transform: translateY(-2px); box-shadow: 0 5px 0 color-mix(in srgb, var(--c) 45%, transparent); }
.qz-opt[aria-disabled="true"] { cursor: default; }
.qz-opt[aria-disabled="true"]:not(.is-right):not(.is-wrong) { border-color: #DEE2E6; background: #F8F9FA; color: var(--ink-2); }
.qz-opt[aria-disabled="true"]:not(.is-right):not(.is-wrong) .qz-letter { background: #E9ECEF; border-color: #ADB5BD; color: var(--ink-2); }
.qz-letter { display: grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: 13px; border: 2.5px solid var(--ink); background: var(--c); color: var(--ink); font: 850 1.1rem/1 var(--sans); }
.qz-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.qz-mark { display: grid; place-items: center; width: 34px; height: 34px; flex: none; border-radius: 50%; color: #fff; }
.qz-mark .ui { width: 20px; height: 20px; stroke-width: 3; }
.qz-opt.is-right { border-color: var(--good); background: #EBFBEE; box-shadow: 0 0 0 4px rgba(47, 158, 68, .18); }
.qz-opt.is-right .qz-mark { background: var(--good); }
.qz-opt.is-wrong { border-color: var(--bad); background: #FFF5F5; }
.qz-opt.is-wrong .qz-mark { background: var(--bad); }
.qz-opt.is-shake { animation: bump .35s ease; }
.qz-feedback { display: flex; align-items: flex-start; gap: 12px; margin-top: 14px; padding: 14px 16px; border-radius: 18px; animation: win-pop .35s ease both; }
.qz-feedback[hidden] { display: none; }
.qz-feedback.is-good { background: #EBFBEE; border: 2px solid #B2F2BB; }
.qz-feedback.is-learn { background: #FFF9DB; border: 2px solid #FFE066; }
.qz-feedback-pic { display: grid; place-items: center; width: 44px; height: 44px; flex: none; border-radius: 50%; background: #fff; color: #E67700; box-shadow: 0 2px 0 rgba(28, 34, 56, .08); }
.qz-feedback-pic .star-pic, .qz-feedback-pic .ui { width: 28px; height: 28px; }
.qz-verdict { margin: 0; font-size: 1.1rem; font-weight: 800; color: var(--ink); }
.qz-explain { margin: 4px 0 0; color: var(--ink-2); font-weight: 560; }
.qz-next { margin-top: 14px; background: var(--world); border-color: var(--world); color: #fff; }
.qz-next .ui { width: 20px; height: 20px; }
.qz-score { display: grid; gap: 12px; }
.qz-stars { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; margin: 0; }
.qz-stars .star-pic { width: 36px; height: 36px; }
.qz-recap { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.qz-recap li { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border-radius: 14px; background: #fff; border: 1.5px solid var(--line); line-height: 1.35; }
.qz-recap-mark { display: grid; place-items: center; width: 28px; height: 28px; flex: none; border-radius: 50%; background: var(--good); color: #fff; }
.qz-recap-mark .ui { width: 17px; height: 17px; stroke-width: 3; }
.qz-recap li.is-miss .qz-recap-mark { background: #F08C00; }
.qz-recap-q { color: var(--ink-2); }
.qz-recap-a { color: var(--ink); }
@media (min-width: 560px) { .qz-opts.is-short { grid-template-columns: 1fr 1fr; } }

/* Label the picture */
.dg { display: grid; gap: 16px; }
.dg-board { position: relative; width: min(100%, 640px, calc((100dvh - 200px) * var(--ratio))); aspect-ratio: var(--ratio); margin: 0 auto; }
.dg-svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.dg-bg { fill: #fff; stroke: rgba(28, 34, 56, .12); stroke-width: 2px; vector-effect: non-scaling-stroke; }
.dg-leader line { stroke: var(--ink); stroke-linecap: round; }
.dg-leader circle { fill: #FFD43B; stroke: var(--ink); }
.dg-leader.is-placed circle { fill: #8CE99A; }
.dg-spot { position: absolute; left: var(--x); top: var(--y); z-index: 1; display: grid; place-items: center; width: var(--d, 36px); height: var(--d, 36px); padding: 0; translate: -50% -50%; border-radius: 50%; border: 3px solid var(--ink); background: #fff; color: var(--world); font: 850 calc(var(--d, 36px) * .5)/1 var(--sans); cursor: pointer; box-shadow: 0 3px 0 rgba(28, 34, 56, .3); transition: scale .15s, background-color .2s; }
.dg-spot:hover { scale: 1.08; }
.dg-spot.is-selected { background: var(--world); color: #fff; box-shadow: 0 0 0 5px color-mix(in srgb, var(--world) 30%, transparent); }
.dg-spot.is-target { background: #FFE066; color: var(--ink); scale: 1.2; }
.dg-spot.is-placed { background: var(--good); color: #fff; }
.dg-spot-tick { display: none; position: absolute; right: -7px; top: -7px; width: 20px; height: 20px; padding: 2px; border-radius: 50%; background: #fff; color: var(--good); box-shadow: 0 0 0 2px var(--good); stroke-width: 3.4; }
.dg-spot.is-placed .dg-spot-tick { display: block; }
.dg-spot.on-left .dg-spot-tick { right: auto; left: -7px; }
.dg-spot.is-no { animation: bump .3s ease 2; background: #FFE3E3; }
.dg-spot.is-hint { animation: spot-glow .9s ease-in-out 3; }
.dg-spot.is-pop { animation: win-pop .5s ease; }
@keyframes spot-glow { 50% { box-shadow: 0 0 0 9px rgba(255, 212, 59, .75); scale: 1.12; } }
.dg-tag { position: absolute; left: var(--x); top: var(--y); z-index: 1; display: none; padding: 3px 10px; border-radius: 999px; border: 2px solid var(--good); background: #fff; color: var(--good-ink); font: 800 clamp(.78rem, 2.6vw, .95rem)/1.15 var(--sans); white-space: nowrap; pointer-events: none; box-shadow: 0 2px 0 rgba(28, 34, 56, .18); }
.dg-tag.on-left { translate: calc(var(--d, 36px) / 2 + 2px) -50%; }
.dg-tag.on-right { translate: calc(-100% - var(--d, 36px) / 2 - 2px) -50%; }
.dg-tag.is-placed { display: block; animation: pop-in .35s ease both; }
.dg-side { display: grid; gap: 12px; width: min(100%, 640px); margin: 0 auto; align-content: start; }
.dg-title { margin: 0; font-size: .82rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2); }
.dg-bank { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-height: 66px; padding: 10px; border-radius: 18px; background: #fff; border: 2.5px dashed color-mix(in srgb, var(--world) 35%, transparent); }
.dg-chip { min-height: 46px; padding: 8px 18px; border-radius: 999px; border: 2.5px solid var(--ink); background: var(--c); color: var(--ink); font: 800 1.08rem/1 var(--sans); cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; box-shadow: 0 3px 0 rgba(28, 34, 56, .35); transition: transform .12s; }
.dg-chip:hover { transform: translateY(-2px); }
.dg-chip[hidden] { display: none; }
.dg-chip.is-selected { background: var(--world); color: #fff; box-shadow: 0 0 0 4px color-mix(in srgb, var(--world) 30%, transparent); }
.dg-chip.is-dragging { opacity: .35; }
.dg-chip.is-shake { animation: bump .35s ease; }
.dg-chip.is-hint { animation: glow 1s ease 3; }
.dg-bank-done { margin: 0; padding: 0 6px; font-weight: 750; color: var(--good-ink); }
.dg-slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 136px), 1fr)); gap: 8px; margin: 0; padding: 0; list-style: none; }
.dg-slot { display: flex; align-items: center; gap: 8px; min-height: 50px; padding: 6px 12px 6px 7px; border-radius: 16px; background: #fff; border: 2px solid rgba(28, 34, 56, .12); cursor: pointer; }
.dg-slot-num { display: grid; place-items: center; width: 34px; height: 34px; flex: none; border-radius: 50%; border: 2.5px solid var(--ink); background: #fff; color: var(--world); font-weight: 850; }
.dg-slot-word { flex: 1; min-width: 0; min-height: 1.4em; border-bottom: 2.5px dotted rgba(28, 34, 56, .3); font-weight: 800; overflow-wrap: anywhere; }
.dg-slot.is-placed { border-color: #8CE99A; background: #F4FCF5; cursor: default; }
.dg-slot.is-placed .dg-slot-num { background: var(--good); border-color: var(--good); color: #fff; }
.dg-slot.is-placed .dg-slot-word { border-bottom-color: transparent; color: var(--good-ink); }
.dg-slot.is-selected, .dg-slot.is-target { border-color: var(--world); background: var(--world-tint); }
.dg-slot.is-hint { animation: glow-row 1s ease 3; }
.dg-slot.is-pop { animation: win-pop .45s ease; }
@media (min-width: 860px) { .dg { grid-template-columns: minmax(0, 1.55fr) minmax(250px, 1fr); align-items: start; } .dg-board { width: min(100%, calc((100dvh - 200px) * var(--ratio))); } .dg-slots { grid-template-columns: 1fr 1fr; } }

/* Crossword */
.cw { display: grid; gap: 18px; }
.cw-main { display: grid; gap: 12px; justify-items: center; align-content: start; }
.cw-bar { display: flex; align-items: center; gap: 6px; width: min(100%, 560px); padding: 6px; border-radius: 20px; background: var(--world); color: #fff; box-shadow: 0 6px 16px -10px var(--world); }
.cw-bar-btn { display: grid; place-items: center; width: 44px; height: 44px; flex: none; border: 0; border-radius: 15px; background: rgba(255, 255, 255, .18); color: #fff; cursor: pointer; }
.cw-bar-btn:hover { background: rgba(255, 255, 255, .3); }
.cw-bar-text { flex: 1; min-width: 0; margin: 0; padding: 2px 4px; font-weight: 650; line-height: 1.35; text-align: center; }
.cw-bar-text b { display: inline-block; margin-right: 4px; padding: 1px 10px; border-radius: 999px; background: #fff; color: var(--world); font-weight: 850; white-space: nowrap; }
.cw-grid { display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: 3px; width: min(100%, calc(var(--cols) * 54px)); }
.cw-block { aspect-ratio: 1; }
.cw-cell { position: relative; aspect-ratio: 1; border-radius: 8px; border: 2.5px solid var(--ink); background: #fff; container-type: inline-size; box-shadow: 0 2px 0 rgba(28, 34, 56, .18); transition: background-color .15s; }
.cw-num { position: absolute; left: 3px; top: 1px; z-index: 1; font-size: max(9px, 27cqw); font-weight: 800; line-height: 1; color: var(--ink-2); pointer-events: none; }
.cw-input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 16% 0 0; border: 0; border-radius: 6px; background: transparent; text-align: center; text-transform: uppercase; font: 850 max(16px, 54cqw)/1 var(--sans); color: var(--ink); caret-color: transparent; cursor: pointer; }
.cw-input:focus { outline: none; }
.cw-cell.is-word { background: #FFF3BF; }
.cw-cell.is-cur { background: #FFD43B; box-shadow: 0 0 0 3px var(--world); z-index: 1; }
.cw-cell:has(.cw-input:focus-visible) { outline: 3px solid var(--teal); outline-offset: 3px; }
.cw-cell.is-right { background: #D3F9D8; }
.cw-cell.is-wrong { background: #FFE3E3; border-color: var(--bad); }
.cw-cell.is-hinted .cw-input { color: #5F3DC4; }
.cw-cell.is-pop { animation: win-pop .45s ease; }
.cw-cell.is-shake { animation: bump .35s ease; }
.game.is-solved .cw-cell { background: #D3F9D8; }
.cw-lists { display: grid; gap: 14px; width: min(100%, 560px); margin: 0 auto; align-content: start; }
.cw-list-title { margin: 0 0 6px; font-size: .82rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2); }
.cw-list ol { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.cw-clue { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 46px; padding: 8px 12px 8px 8px; border-radius: 15px; border: 2px solid rgba(28, 34, 56, .1); background: #fff; font: 600 1rem/1.35 var(--sans); color: var(--ink); text-align: left; cursor: pointer; }
.cw-clue:hover { border-color: var(--world); }
.cw-clue-n { display: grid; place-items: center; min-width: 30px; height: 30px; flex: none; border-radius: 50%; background: var(--world-tint); color: var(--world); font-weight: 850; }
.cw-clue-text { min-width: 0; }
.cw-clue-len { color: var(--ink-3); white-space: nowrap; }
.cw-clue-tick { display: none; margin-left: auto; color: var(--good); }
.cw-clue-tick .ui { stroke-width: 3; }
.cw-clue.is-active { border-color: var(--world); background: #FFF9DB; }
.cw-clue.is-done { background: #F4FCF5; }
.cw-clue.is-done .cw-clue-tick { display: inline-flex; }
.cw-clue.is-done .cw-clue-n { background: var(--good); color: #fff; }
@media (min-width: 860px) { .cw { grid-template-columns: minmax(0, 1.25fr) minmax(260px, 1fr); align-items: start; } }

/* Put it in order */
.sq { position: relative; display: grid; gap: 10px; max-width: 660px; margin: 0 auto; padding: 0; list-style: none; }
.sq-card { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 8px; padding: 8px 4px 8px 10px; border-radius: 20px; background: #fff; border: 2.5px solid rgba(28, 34, 56, .12); box-shadow: 0 3px 0 rgba(28, 34, 56, .07); transition: border-color .2s, background-color .2s, box-shadow .2s; }
.sq-card::before { content: ''; position: absolute; left: -2.5px; top: 16px; bottom: 16px; width: 6px; border-radius: 0 6px 6px 0; background: var(--c); }
.sq-num { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--world); color: #fff; font: 850 1.2rem/1 var(--sans); box-shadow: 0 0 0 3px #fff, 0 0 0 5.5px color-mix(in srgb, var(--world) 25%, transparent); transition: background-color .2s; }
.sq-pick { display: flex; align-items: center; gap: 10px; min-width: 0; min-height: 58px; padding: 4px 6px; border: 0; border-radius: 14px; background: transparent; font: 650 1.06rem/1.3 var(--sans); color: var(--ink); text-align: left; cursor: pointer; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.sq-pic { width: 56px; height: 56px; flex: none; padding: 5px; border-radius: 15px; background: color-mix(in srgb, var(--c) 24%, #fff); }
.sq-text { min-width: 0; overflow-wrap: anywhere; }
.sq-moves { display: grid; gap: 2px; }
.sq-move { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 12px; background: transparent; color: var(--ink-2); cursor: pointer; }
.sq-move:hover:not([aria-disabled="true"]) { background: var(--world-tint); color: var(--world); }
.sq-move[aria-disabled="true"] { opacity: .3; cursor: default; }
.sq-grip { display: grid; place-items: center; width: 34px; align-self: stretch; margin: -8px 0; border-radius: 0 16px 16px 0; color: var(--ink-3); cursor: grab; touch-action: none; }
.sq-grip:hover { background: var(--world-tint); color: var(--world); }
.sq-card.is-picked { border-color: var(--world); background: var(--world-tint); box-shadow: 0 0 0 4px color-mix(in srgb, var(--world) 25%, transparent); }
.sq-card.is-lifted { z-index: 3; border-color: var(--world); scale: 1.02; box-shadow: 0 20px 34px -14px rgba(28, 34, 56, .5); cursor: grabbing; transition: none; }
.sq-card.is-right { border-color: #8CE99A; }
.sq-card.is-right .sq-num { background: var(--good); }
.sq-card.is-wrong { border-color: #FFC078; }
.sq-card.is-wrong .sq-num { background: #D9480F; }
.sq-card.is-hint { animation: glow-row 1s ease 2; }
.game.is-solved .sq-card { border-color: #8CE99A; background: #F4FCF5; }
.game.is-solved .sq-num { background: var(--good); }

/* Spot the difference */
.sd { display: grid; gap: 12px; }
.sd-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 12px; width: fit-content; max-width: 100%; margin: 0 auto; padding: 7px 16px; border-radius: 999px; background: #fff; border: 2px solid rgba(28, 34, 56, .1); }
.sd-pips { display: flex; flex-wrap: wrap; gap: 2px; margin: 0; padding: 0; list-style: none; }
.sd-pip .star-pic { width: 26px; height: 26px; }
.sd-pip.is-on .star-pic path { fill: #FFC93C; stroke: var(--ink); }
.sd-pip.is-on .star-pic { animation: win-pop .4s ease; }
.sd-count-text { font-weight: 800; color: var(--ink); }
.sd-pics { display: grid; gap: 12px; }
.sd-fig { display: grid; gap: 6px; margin: 0; }
.sd-fig figcaption { text-align: center; font-size: .95rem; font-weight: 650; color: var(--ink-2); }
.sd-fig figcaption b { color: var(--ink); }
.sd-frame { position: relative; overflow: hidden; width: min(100%, calc((100dvh - 250px) / 2 * var(--ratio)), 720px); margin: 0 auto; aspect-ratio: var(--ratio); border-radius: 16px; border: 3px solid var(--ink); background: #fff; box-shadow: 0 4px 0 rgba(28, 34, 56, .14); }
.sd-svg { display: block; width: 100%; height: 100%; cursor: crosshair; }
.sd-fig.is-changed .sd-frame { border-color: var(--world); box-shadow: 0 0 0 4px color-mix(in srgb, var(--world) 22%, transparent), 0 4px 0 rgba(28, 34, 56, .14); }
.sd-board:focus-visible { outline: 3px solid var(--teal); outline-offset: 4px; }
.sd-ring-under { fill: none; stroke: #fff; }
.sd-ring-top { fill: none; stroke-linecap: round; }
.sd-ring.is-new { animation: ring-pop .5s ease both; transform-box: fill-box; transform-origin: center; }
.sd-ring.is-new .sd-ring-top { stroke-dasharray: 1; animation: draw .55s ease-out both; }
.sd-miss { fill: none; stroke: var(--bad); stroke-linecap: round; animation: fade-out .9s ease forwards; }
.sd-glow { fill: rgba(255, 212, 59, .2); stroke: #F59F00; stroke-dasharray: 3 2; animation: glow-pulse 1.1s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.sd-cursor circle { fill: rgba(255, 255, 255, .3); stroke: var(--teal); }
.sd-cursor path { stroke: var(--teal); stroke-linecap: round; }
@media (min-width: 760px) { .sd-pics { grid-template-columns: 1fr 1fr; } .sd-frame { width: 100%; } }

/* Trace */
.tr { display: grid; gap: 12px; justify-items: center; }
.tr-pager { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.tr-page { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 6px 14px; border-radius: 999px; border: 2px solid rgba(28, 34, 56, .14); background: #fff; font: 750 1.02rem/1 var(--sans); color: var(--ink); cursor: pointer; }
.tr-page:hover { border-color: var(--world); }
.tr-page.is-current { border-color: var(--world); background: var(--world); color: #fff; }
.tr-page .star-pic { width: 18px; height: 18px; }
.tr-page:not(.is-done) .star-pic { display: none; }
.tr-board { position: relative; width: min(100%, 780px, calc(min(54dvh, 430px) * var(--ratio, 2))); aspect-ratio: var(--ratio, 2); border-radius: 22px; touch-action: none; user-select: none; -webkit-user-select: none; cursor: crosshair; box-shadow: 0 4px 0 rgba(28, 34, 56, .1); }
.tr-guide, .tr-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.tr-board:focus-visible { outline: 3px solid var(--teal); outline-offset: 4px; }
.tr-paper { fill: #fff; stroke: rgba(28, 34, 56, .12); stroke-width: 2; }
.tr-rule { fill: none; stroke-linecap: round; }
.tr-rule-top { stroke: #74C0FC; stroke-width: 2.5; }
.tr-rule-mid { stroke: #74C0FC; stroke-width: 2; stroke-dasharray: 10 9; opacity: .8; }
.tr-rule-base { stroke: #3B5BDB; stroke-width: 3; }
.tr-rule-low { stroke: #A5D8FF; stroke-width: 1.5; }
.tr-lane { fill: none; stroke: color-mix(in srgb, var(--world) 12%, #fff); stroke-width: 30; stroke-linecap: round; stroke-linejoin: round; transition: stroke .4s; }
.tr-dots { fill: none; stroke: #868EA6; stroke-width: 8; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: .1 14; }
.tr-start { fill: #2F9E44; stroke: #fff; stroke-width: 3; }
.tr-demo-path { fill: none; stroke: #FFB703; stroke-width: 12; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; opacity: .92; animation: draw 1.9s ease-in-out both; }
.tr-board.is-done .tr-lane { stroke: #D3F9D8; }
.tr-board.is-cheer { animation: win-pop .5s ease; }
.tr-meter { position: relative; width: min(100% - 24px, 420px); height: 18px; margin-right: 12px; border-radius: 999px; background: #fff; border: 2px solid rgba(28, 34, 56, .14); }
.tr-meter-fill { position: absolute; left: 2px; top: 2px; bottom: 2px; width: 0; max-width: calc(100% - 4px); border-radius: 999px; background: linear-gradient(90deg, #69DB7C, #38D9A9, #4DABF7); transition: width .2s; }
.tr-meter-star { position: absolute; right: -16px; top: 50%; width: 32px; height: 32px; translate: 0 -50%; }
.tr-meter.is-full .tr-meter-star path { fill: #FFC93C; stroke: var(--ink); }
.tr-meter.is-full .tr-meter-star { animation: win-pop .45s ease; }
.tr-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px 16px; }
.tr-crayons { display: flex; gap: 6px; }
.tr-crayon { width: 44px; height: 44px; border-radius: 50%; border: 3px solid #fff; background: var(--c); box-shadow: 0 0 0 1.5px rgba(28, 34, 56, .25); cursor: pointer; }
.tr-crayon[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--ink); }
.tr-actions { display: flex; gap: 8px; }
.tr-tool { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 8px 16px; border-radius: 999px; border: 2px solid rgba(28, 34, 56, .16); background: #fff; font: 750 1rem/1 var(--sans); color: var(--ink); cursor: pointer; }
.tr-tool:hover { border-color: var(--world); }
.tr-tool[hidden] { display: none; }
.tr-next.is-ready { border-color: var(--world); background: var(--world); color: #fff; }
.tr-next.is-ready .ui { animation: nudge 1s ease-in-out infinite; }
.game.is-solved .tr-next { border-color: rgba(28, 34, 56, .16); background: #fff; color: var(--ink); }
.game.is-solved .tr-next .ui { animation: none; }

@media (max-width: 640px) {
  .play-page .wrap { width: min(980px, 100% - 24px); }
  .game-board { padding: 10px; border-radius: 22px; }
  .game-controls .btn { flex: 1 1 auto; padding: 12px 14px; }
  .play-nav { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .play-nav > .text-link { grid-column: 1 / -1; grid-row: 2; justify-self: center; }
  .choice-row { padding: 14px 8px 10px; }
  .pat-seq { gap: 4px; }
  .code-message { gap: 12px 16px; padding: 12px 4px; }
  .sq-card { gap: 6px; padding: 6px 2px 6px 8px; }
  .sq-num { width: 34px; height: 34px; font-size: 1.05rem; }
  .sq-pick { gap: 8px; padding: 4px 2px; font-size: 1rem; }
  .sq-pic { width: 46px; height: 46px; padding: 4px; border-radius: 13px; }
  .sq-grip { width: 28px; }
  .qz-card { padding: 16px 14px; }
  .qz-opt { font-size: 1.05rem; }
  .mt { grid-template-columns: minmax(0, 1fr) 46px minmax(0, 1fr); }
  .mt-item { min-height: 60px; padding: 6px 10px; font-size: 1.02rem; }
  .mt-l { padding-right: 14px; }
  .mt-r { padding-left: 14px; }
  .mt-pic { width: 46px; height: 46px; }
  .mt-item.is-both { flex-direction: column; justify-content: center; gap: 2px; text-align: center; }
}
@media (prefers-reduced-motion: reduce) {
  .game-confetti { display: none; }
  .maze-token, .dots-shape, .px-cell rect { transition: none; }
  .mt-link.is-new line, .sd-ring.is-new, .sd-ring.is-new .sd-ring-top, .qz-opt, .qz-feedback, .tr-demo-path, .tr-next.is-ready .ui, .mt-item.is-selected .mt-dot { animation: none; }
  .sd-glow { animation: none; }
}
