.game-shell{max-width:540px;margin:auto}.game-shell p{line-height:1.5}.game-grid{display:grid;grid-template-columns:repeat(var(--cols),minmax(0,1fr));gap:4px;margin:18px 0}.game-grid button{aspect-ratio:1;padding:2px;min-width:0;min-height:30px;font:700 clamp(14px,4vw,24px)/1 system-ui;border:1px solid var(--line,#748578);border-radius:6px;color:var(--text,#243c2d);background:var(--surface,#edf5ec);cursor:pointer}.game-grid button:focus-visible{outline:3px solid #ec9b33;outline-offset:1px}.game-grid .selected{outline:3px solid #eaa849;outline-offset:-3px}.game-grid .legal{box-shadow:inset 0 0 0 4px #239b71}.game-grid .chess-cell{font-size:clamp(20px,6vw,40px);color:#10241c;background:#f0e6ce}.game-grid .chess-dark{background:#8faf92}.game-grid button:disabled{opacity:1;cursor:default}.game-grid .filled{background:#dce6b6;color:#233122}.game-grid .simon-0{background:#447d53;color:white}.game-grid .simon-1{background:#345f96;color:white}.game-grid .simon-2{background:#a55b13;color:white}.game-grid .simon-3{background:#9c3a6c;color:white}.game-shell .lit{outline:6px solid #f9bc43;outline-offset:-6px;filter:brightness(1.5)}.game-grid.sudoku{gap:0;border:2px solid #65836d}.sudoku input{width:100%;min-width:0;min-height:0;aspect-ratio:1;padding:0;text-align:center;font:600 clamp(14px,4vw,24px) system-ui;border-radius:0;border:1px solid #acb8af;margin:0}.sudoku input[readonly]{font-weight:900;background:#d9e6d8;color:#183e29}.sudoku .box-left{border-left:2px solid #65836d}.sudoku .box-top{border-top:2px solid #65836d}.game-canvas{display:block;width:100%;max-width:400px;height:auto;margin:18px auto;border-radius:8px;touch-action:none}.reaction-target{width:100%;min-height:160px;margin:18px 0;font-size:30px}.game-shell #gameControls{display:flex;flex-wrap:wrap;gap:8px}.game-shell #gameControls button{min-height:44px}.game-shell #gameStatus{min-height:48px;font-weight:700;overflow-wrap:anywhere}

/* Puzzle arcade: text-labelled controls, responsive boards and theme variables. */
dialog.puzzle-dialog{width:min(800px,96vw)}.puzzle-shell{max-width:620px;margin:auto}.puzzle-head,.puzzle-stats{display:flex;justify-content:space-between;gap:12px;flex-wrap:wrap}.puzzle-head{font-size:10px;letter-spacing:1px;color:var(--green)}.puzzle-private{font-size:9px;color:var(--muted)}.puzzle-options{display:grid;grid-template-columns:1fr 1fr;gap:16px}.puzzle-toolbar{display:flex;gap:7px;flex-wrap:wrap;margin:14px 0}.puzzle-toolbar button{min-height:40px;flex-grow:1}.puzzle-stats{padding:12px 15px;border:1px solid var(--line);border-radius:8px;font-size:11px;color:var(--muted);font-variant-numeric:tabular-nums}.puzzle-shell #puzzleProgress{font-weight:700;color:var(--green);overflow-wrap:anywhere}.puzzle-rules{padding:15px 0}.puzzle-rules summary{cursor:pointer;font-size:12px;font-weight:650}.puzzle-rules p{font-size:12px}.puzzle-grid{display:grid;grid-template-columns:repeat(var(--pcols),minmax(0,1fr));gap:4px;margin:16px 0;max-width:460px;width:100%;margin-inline:auto}.puzzle-grid .puzzle-cell{position:relative;aspect-ratio:1;padding:2px;border:1px solid var(--line);border-radius:7px;min-width:0;min-height:0;font:650 clamp(12px,3.5vw,24px)/1.2 system-ui;background:var(--surface,#fff);color:var(--ink);touch-action:manipulation}.puzzle-cell:focus-visible,.p-loop-edge:focus-visible{outline:3px solid #d18c0b;outline-offset:1px;z-index:1}.puzzle-grid .p-fixed{background:var(--paper);font-weight:900;opacity:1}.puzzle-grid .p-filled{background:var(--green);color:#fff}.puzzle-shell .p-selected{outline:3px solid #d99116;outline-offset:-3px}.puzzle-shell .p-hint{box-shadow:inset 0 0 0 3px #d99116;outline:2px dashed #d99116;outline-offset:-5px}.puzzle-grid .p-wall{background:var(--ink);border-color:var(--ink);opacity:1}.puzzle-grid .p-goal{background:#d9edcd;color:#254824}.puzzle-grid .p-player{background:#256c52;color:white}.puzzle-grid .p-box{background:#ba743b;color:#fff}.puzzle-grid .p-void{visibility:hidden}.puzzle-grid .p-gone{opacity:.15}.puzzle-grid .p-checker{background:#e1ddcf;color:#26332d}.puzzle-grid .p-pipe{font:900 clamp(29px,8vw,57px)/1 monospace;padding:0}.puzzle-grid.p-maze{gap:1px}.p-maze .puzzle-cell{border:0;border-radius:1px;font-size:clamp(8px,2.5vw,18px)}.puzzle-shell .p-colour-0{background:#a83931;color:#fff}.puzzle-shell .p-colour-1{background:#285a9c;color:#fff}.puzzle-shell .p-colour-2{background:#866100;color:#fff}.puzzle-shell .p-colour-3{background:#2c7044;color:#fff}.puzzle-shell .p-colour-4{background:#75469c;color:#fff}.puzzle-shell .p-colour-5{background:#156c75;color:#fff}.puzzle-grid .p-endpoint{font-weight:900;border:3px double #fff}.p-clues{font-size:11px;line-height:2.2;overflow-wrap:anywhere}.puzzle-grid .p-cage-0{border-color:#b17633;border-bottom:3px solid #b17633}.puzzle-grid .p-cage-1{border-color:#637ac0;border-bottom:3px solid #637ac0}.p-cage-label{position:absolute;top:2px;left:4px;font-size:9px;font-weight:500}.p-clue-board{display:grid;grid-template-columns:minmax(30px,44px) minmax(0,1fr) minmax(20px,30px);grid-template-rows:auto auto auto;max-width:510px;margin:16px auto;gap:3px}.p-clue-board .puzzle-grid{grid-column:2;grid-row:2;margin:0;gap:3px}.p-clue-corner{grid-column:1;grid-row:1}.p-top-clues{grid-column:2;grid-row:1;align-items:end}.p-bottom-clues{grid-column:2;grid-row:3}.p-top-clues,.p-bottom-clues{display:grid;grid-template-columns:repeat(var(--pcols),minmax(0,1fr));gap:3px;text-align:center;font-size:11px;white-space:pre-line}.p-left-clues{grid-column:1;grid-row:2}.p-right-clues{grid-column:3;grid-row:2}.p-left-clues,.p-right-clues{display:grid;grid-auto-rows:1fr;font-size:11px;gap:3px}.p-left-clues span,.p-right-clues span{display:grid;align-content:center;text-align:center}.p-tubes,.p-pegs{display:flex;flex-wrap:wrap;justify-content:center;gap:12px;margin:20px 0}.p-stack{background:transparent;border:2px solid var(--line);border-radius:8px 8px 18px 18px;padding:8px;min-width:64px;max-width:110px;flex:1;color:var(--ink);font-size:10px}.p-stack-items{display:flex;flex-direction:column;align-items:center;gap:3px;margin-top:8px}.p-stack-unit{display:block;min-height:26px;width:100%;border-radius:4px;border:1px solid var(--line);padding:4px}.p-disk{background:var(--green);color:#fff}.p-loop{display:grid;grid-template-columns:repeat(var(--loop-n),10px minmax(0,1fr)) 10px;grid-template-rows:repeat(var(--loop-n),22px minmax(25px,1fr)) 22px;max-width:460px;margin:16px auto;align-items:stretch;aspect-ratio:1}.p-loop-dot{width:5px;height:5px;border-radius:50%;background:var(--ink);align-self:center;justify-self:center}.p-loop-clue{display:grid;place-items:center;font-size:15px}.p-loop-edge{padding:0;min-width:0;min-height:0;border:0;border-radius:4px;background:var(--paper);color:var(--muted);font-size:18px;overflow:visible}.p-loop-edge.p-edge-on{background:var(--green);color:#fff}.p-word-list{display:flex;gap:8px;flex-wrap:wrap;font-size:11px}.p-word-list span{padding:7px 10px;border:1px solid var(--line);border-radius:20px}.puzzle-shell .p-found{background:#d9edcd;color:#254824}.p-answer{font-size:21px!important;text-align:center;letter-spacing:2px;overflow-wrap:anywhere}.p-code{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:9px;margin:18px 0}.p-code button{min-height:60px;white-space:normal}.p-code-history{padding-left:20px;font-size:11px;line-height:2;color:var(--muted);overflow-wrap:anywhere}.p-piece-tray{display:flex;gap:8px;margin:16px 0}.p-piece-tray button{display:flex;flex:1;gap:8px;align-items:center;flex-direction:column;min-width:0;justify-content:center;min-height:85px}.p-shape{display:grid;grid-template-columns:repeat(var(--shape-cols),10px);gap:2px}.p-shape i{width:10px;height:10px}.p-shape .p-shape-on{background:var(--green);border-radius:2px}.p-hub-banner{display:flex;justify-content:space-between;align-items:center;background:var(--green);color:#fff;border-radius:14px;padding:25px 28px;margin:25px 0;gap:20px}.p-hub-banner strong{font-size:20px;letter-spacing:-.5px}.p-hub-banner p{font-size:11px;opacity:.8;line-height:1.7;margin-bottom:0}.p-hub-banner>span{font-size:58px;line-height:1;opacity:.75}.p-hub-search{max-width:600px;font-size:11px}.p-hub-search input{margin-top:8px;height:48px}.puzzle-shell button:disabled{cursor:default}.puzzle-shell #puzzleFeedback{min-height:25px;color:var(--ink);overflow-wrap:anywhere}
@media(max-width:700px){dialog.puzzle-dialog{padding:18px;width:96vw}.puzzle-toolbar button{min-height:44px;font-size:10px;padding:9px}.puzzle-grid{gap:3px}.puzzle-options{gap:10px}.puzzle-head{font-size:9px}.puzzle-private{font-size:8px}.p-stack{min-width:48px;padding:6px}.p-tubes{gap:6px}.p-stack-unit{min-height:23px}.p-hub-banner{padding:19px}.p-hub-banner strong{font-size:17px}.p-hub-banner>span{font-size:42px}.p-clue-board{grid-template-columns:30px minmax(0,1fr) 22px}.p-code-history{font-size:10px}}
/* Use theme button contrast for filled states, while preserving game colours. */
.puzzle-grid .p-filled,.p-disk,.p-loop-edge.p-edge-on,.p-hub-banner{background:var(--button,#256c52);color:var(--button-ink,#fff)}
:root[data-theme] .puzzle-shell .p-colour-0{background:#a83931;color:#fff}:root[data-theme] .puzzle-shell .p-colour-1{background:#285a9c;color:#fff}:root[data-theme] .puzzle-shell .p-colour-2{background:#866100;color:#fff}:root[data-theme] .puzzle-shell .p-colour-3{background:#2c7044;color:#fff}:root[data-theme] .puzzle-shell .p-colour-4{background:#75469c;color:#fff}:root[data-theme] .puzzle-shell .p-colour-5{background:#156c75;color:#fff}
