.game-layout{display:grid;grid-template-columns:minmax(0,1fr) 280px;gap:24px;align-items:start}
.game-shell{max-width:650px;margin-inline:auto;width:100%}
.game-heading{font-size:clamp(2rem,5vw,3.5rem)}
.game-stats{display:flex;gap:12px;justify-content:space-between;flex-wrap:wrap;margin:14px 0;font-variant-numeric:tabular-nums}
.game-stage{background:#fbf3f6;border:1px solid #e7cbd6;border-radius:18px;padding:12px;min-height:160px}
.game-stage canvas{width:100%;max-width:400px;height:auto;display:block;margin:auto;border-radius:13px;background:#fff;touch-action:none}
#game-board{max-width:440px;margin:auto}
.play-grid{display:grid;grid-template-columns:repeat(var(--columns),minmax(0,1fr));gap:5px;margin-block:12px;touch-action:manipulation}
.play-grid button,.tile{min-width:0;aspect-ratio:1;display:grid;place-items:center;border:1px solid #dfc2ce;border-radius:8px;background:white;color:#6e2041;font-weight:750;font-size:clamp(.8rem,4vw,1.6rem)}
.play-grid[style*="9"]{gap:2px}
.play-grid[style*="9"] button{font-size:clamp(.85rem,3.5vw,1.3rem);border-radius:2px}
.play-grid[style*="9"] button:nth-child(3n){border-right:2px solid #78213d}
.play-grid .editable{background:#fae3eb}
.play-grid .selected{outline:3px solid #1e7c79;z-index:1}
.maze-cell{aspect-ratio:1}
.direction-pad{display:flex;justify-content:center;gap:9px;margin-top:12px}
.direction-pad button{width:54px;height:48px;border:1px solid #b2758c;border-radius:10px;background:white;font-size:1.5rem;touch-action:manipulation}
.game-actions{display:flex;gap:10px;flex-wrap:wrap;margin-top:14px}
.game-actions button{min-height:44px;padding:8px 13px}
#game-status{min-height:3em;margin:10px 0;font-weight:650}
#nick-form{display:grid;gap:12px;background:#fff;border:1px solid var(--line);border-radius:16px;padding:18px}
#game-board form{display:grid;gap:9px}
#game-board button{cursor:pointer}
#game-board form button,#game-board>button{padding:10px;border:1px solid #a15876;border-radius:10px;background:#781c3c;color:white}
.task-wheel{margin:auto;width:100px;height:100px;border:12px solid #b67d93;border-right-color:#e2aa42;border-radius:50%;display:grid;place-items:center;font-size:2.4rem;color:#781c3c}
.spinning{transform:rotate(540deg);transition:transform .7s}
.duel-area{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.duel-area button{min-height:190px;border:0;border-radius:16px;color:white;font-size:1.2rem;font-weight:800;touch-action:manipulation}
.duel-go{background:#217558}.duel-wait{background:#8c2949}
.game-card{min-height:180px}
.game-aside ol{padding-left:24px;overflow-wrap:anywhere}
.game-aside li{padding:8px;border-bottom:1px solid var(--line)}
.game-admin-link{font-size:.85rem}
.game-note{font-size:.9rem;color:var(--muted)}
@media(max-width:800px){.game-layout{grid-template-columns:1fr}.game-aside{max-width:650px;width:100%;margin:auto}}
@media(prefers-reduced-motion:reduce){.spinning{transition:none}}

.game-page{--wine:#c20d2d;--line:#e1d9d2;--radius:16px}
.game-intro{margin:18px 0 25px;max-width:900px}
.game-page .cards{margin-top:25px}
.game-page .card-body p{margin:14px 0}
.game-page .field{display:grid;gap:6px}
.game-page .field input{width:100%;padding:10px 12px;min-width:0}
.game-page .game-aside{padding:20px}
.game-page .game-aside a{color:#c20d2d;text-decoration:underline}
.game-page .game-actions button{border:1px solid #b68290;border-radius:10px;background:#fff}
.game-page button:disabled{opacity:.55;cursor:default}
.game-page .play-grid button{padding:0}
@media(max-width:520px){.game-page .game-stage{padding:6px}.game-page .direction-pad{gap:6px}}

.game-cover{position:relative;width:100%;aspect-ratio:1.48;overflow:hidden;background:#171218}
.game-cover span{position:absolute;display:block;top:50%;left:0;width:100%;aspect-ratio:1;transform:translateY(-50%);background-image:url("game-covers.png");background-size:300% 500%;background-repeat:no-repeat}
.game-page .card .game-cover{border-bottom:2px solid #c20d2d}
.game-page .letter-rack{padding:18px 10px;border-radius:12px;background:#45162c;color:#fff;font-size:clamp(1.2rem,4vw,1.8rem);font-weight:800;text-align:center;letter-spacing:.12em;margin-bottom:12px}
#pause-game{min-width:105px}
.game-page [inert]{opacity:.55}
.game-page canvas[hidden]{display:none!important}

.task-wheel{position:relative;background:conic-gradient(#d44362 0deg 60deg,#e6af30 60deg 120deg,#3c9b89 120deg 180deg,#5488c5 180deg 240deg,#8c63bc 240deg 300deg,#df7644 300deg);border-color:#e3b65b;color:white;text-shadow:0 1px 4px #301024;width:130px;height:130px}
.task-wheel::after{content:"";position:absolute;right:-17px;top:43px;border-block:10px solid transparent;border-right:15px solid #5f1834}
.game-page .play-grid .tile{box-shadow:inset 0 1px 0 #ffffff65,0 3px 5px #45132918}

.game-page .game-stage{background:linear-gradient(145deg,#ede7e0,#fffaf2);box-shadow:inset 0 1px 8px #44233115,0 16px 40px #2b1e2910;padding:16px}
.game-stage canvas{box-shadow:0 6px 20px #18243925;border:1px solid #24374a22}
.game-page .letter-rack{display:flex;justify-content:center;gap:5px;flex-wrap:wrap;background:linear-gradient(140deg,#573e2c,#2e241e);border:4px solid #977044;box-shadow:inset 0 2px 10px #0008}
.letter-rack span{display:grid;place-items:center;min-width:33px;min-height:42px;padding:3px;color:#4c2c15;border:1px solid #c59757;border-radius:5px;background:repeating-linear-gradient(8deg,#ffffff00 0 4px,#7947150d 4px 5px),linear-gradient(130deg,#fff1c9,#ce9d58);box-shadow:inset 1px 2px 2px #fff8,0 4px 0 #91663b;text-shadow:0 1px #fff7;letter-spacing:0}
.number-board{padding:10px;gap:8px;border-radius:16px;background:repeating-linear-gradient(4deg,#ffffff00 0 8px,#20130b10 8px 9px),linear-gradient(130deg,#a17b57,#655043);box-shadow:inset 0 2px 8px #21180e77,0 7px 0 #4e3b31}
.game-page .number-board .tile{border:1px solid #f1ca97;border-radius:8px;font-size:clamp(1.3rem,6vw,2rem);background-image:linear-gradient(145deg,#ffffff55,transparent 48%,#2917252b);box-shadow:inset 0 2px 1px #ffffff80,0 4px 0 #51372e66;text-shadow:0 1px #ffffff33}
.game-page .number-board .tile[data-value="0"]{box-shadow:inset 0 2px 5px #392b2822;border-color:transparent;opacity:.45}
.sudoku-board{padding:6px;background:#6b5849;gap:1px;border-radius:8px;box-shadow:0 7px 0 #4e3d31}
.game-page .sudoku-board button{border:0;border-right:1px solid #c1bbad;border-bottom:1px solid #c1bbad;background:linear-gradient(150deg,#fffef3,#eae5d7);color:#313c4a;font-family:Georgia,serif;font-weight:500}
.game-page .sudoku-board button:nth-child(3n){border-right:2px solid #69695f}
.game-page .sudoku-board button:nth-child(n+19):nth-child(-n+27),.game-page .sudoku-board button:nth-child(n+46):nth-child(-n+54){border-bottom:2px solid #69695f}
.game-page .sudoku-board .editable{background:linear-gradient(130deg,#e1eff2,#f5fcfc);color:#256171}
.game-page .sudoku-board .selected{outline:2px solid #26787c;box-shadow:inset 0 0 0 2px #26787c}
.sudoku-keypad button{background:linear-gradient(#fff,#dfd8cc);box-shadow:0 3px 0 #a49c90}
.maze-board{gap:0;padding:6px;background:#4b514b;border-radius:10px;box-shadow:0 8px 0 #303630}
.maze-wall{background-image:linear-gradient(145deg,#ffffff24,transparent 45%,#0007)!important;border-top:1px solid #b2b5a5;border-right:1px solid #101b26;box-shadow:inset 2px 2px 2px #e0e1bb1a}
.maze-floor{background-image:repeating-linear-gradient(90deg,#8f9b8b16 0 1px,transparent 1px 7px)!important}
.maze-player,.maze-exit{position:relative}
.maze-player::after{content:"";position:absolute;inset:10%;border-radius:50%;background:radial-gradient(circle at 30% 25%,#fff8ce,#ce9031 55%,#805824);box-shadow:0 2px 3px #0008}
.maze-exit::after{content:"";position:absolute;inset:12% 20%;border:2px solid #b2ffbd;border-bottom:0;box-shadow:0 0 8px #a2ff9e;background:linear-gradient(#3fa76f,#c7ffb5)}
.gem-board{padding:8px;background:radial-gradient(ellipse at top,#273951,#15182b);border-radius:14px;box-shadow:inset 0 2px 8px #0008}
.game-page .gem-board button{border:0;background:transparent;box-shadow:none;padding:4px}
.gem-stone{display:block;width:85%;height:85%;position:relative;clip-path:polygon(20% 2%,80% 2%,100% 30%,50% 100%,0 30%);background:conic-gradient(from 0deg at 50% 28%,hsl(var(--gem-hue) 74% 70%),hsl(var(--gem-hue) 65% 25%),hsl(var(--gem-hue) 85% 58%),#fff8,hsl(var(--gem-hue) 73% 53%));filter:drop-shadow(0 3px 2px #0008)}
.gem-stone::before{content:"";position:absolute;inset:15% 15% 45%;clip-path:polygon(15% 0,85% 0,100% 100%,0 100%);background:linear-gradient(#ffffffb3,#ffffff0a);border-bottom:1px solid #fff9}
.gem-different{clip-path:polygon(20% 2%,80% 2%,100% 30%,59% 100%,0 30%);background:conic-gradient(from 30deg at 50% 28%,hsl(var(--gem-hue) 70% 82%),hsl(var(--gem-hue) 65% 28%),hsl(var(--gem-hue) 85% 60%),#fff9,hsl(var(--gem-hue) 73% 55%))}
.wheel-housing{position:relative;display:grid;place-items:center;width:190px;height:190px;margin:8px auto 20px;border-radius:50%;background:radial-gradient(circle,#b27c35 56%,#fff2bd 57% 59%,#a16828 60% 66%,#4f3426 67%);box-shadow:0 8px 0 #69492e,0 15px 25px #35201240}
.wheel-housing::after{content:"";position:absolute;right:6px;top:80px;border-block:14px solid transparent;border-right:24px solid #9f203f;filter:drop-shadow(0 2px 2px #0006)}
.wheel-housing .task-wheel{width:148px;height:148px;border:4px solid #ffdf91;box-shadow:inset 0 0 20px #0006;font-size:0}
.wheel-housing .task-wheel::after{display:none}
.wheel-housing .task-wheel::before{content:"✦";font-size:24px;display:grid;place-items:center;width:42px;height:42px;border-radius:50%;background:radial-gradient(circle at 35% 25%,#fff6d2,#d3a746 58%,#8e5e25);border:2px solid #ffdf8f;color:#704229;box-shadow:0 3px 8px #0007}
.duel-area{padding:12px;background:linear-gradient(135deg,#374354,#141f31);border-radius:18px;box-shadow:0 7px 0 #131a26}
.duel-area button{min-height:200px;position:relative;border:3px solid #778695;box-shadow:inset 0 2px 6px #fff3,0 4px 0 #0006;padding-top:115px;font-size:.9rem;letter-spacing:.1em}
.duel-area button::before{content:"";position:absolute;width:70px;height:70px;top:35px;left:50%;transform:translateX(-50%);border-radius:50%;border:7px solid #2f3c49;background:radial-gradient(circle at 35% 25%,#fff5d5,#54d887 45%,#1d714c 70%);box-shadow:0 6px 0 #142c2b,0 0 22px #5cffa144}
.duel-area .duel-go{background:linear-gradient(#2d7258,#163c37)}
.duel-area .duel-wait{background:linear-gradient(#6f3446,#3c2433)}
.duel-area .duel-wait::before{background:radial-gradient(circle at 35% 25%,#ffe1d6,#cc4d60 40%,#681d34 75%);box-shadow:0 6px 0 #381a29}
@media(max-width:520px){.game-page .game-stage{padding:8px}.letter-rack span{min-width:27px;min-height:36px}.duel-area{gap:8px;padding:8px}.duel-area button{min-height:185px}.game-page .sudoku-board{padding:4px}}

.game-stats{padding:12px 14px;border:1px solid #c7c7bf;border-radius:12px;background:linear-gradient(#fffdf4,#ece8dc);box-shadow:0 3px 0 #c1b6a5}
#game-level{font-weight:750;color:#7d2845}
#game-score{color:#23645e;font-size:1.15em}
.game-page .game-actions button{box-shadow:0 3px 0 #d1b9be}
@media(prefers-reduced-motion:no-preference){
  .game-page .play-grid button:active,.game-page .game-actions button:active{transform:translateY(2px)}
}

.game-cover img{width:100%;height:100%;object-fit:cover}
.courier-layout .game-shell{max-width:650px}
.courier-layout .game-stage{padding:8px;background:#c9cfb6}
.courier-summary{margin:12px 0;padding:10px;border-radius:10px;background:#f3e4c7;color:#4e3523;font-weight:700}
.courier-controls{display:grid;grid-template-columns:1fr 1fr 1.3fr 1.3fr;gap:8px;margin:12px 0}
.courier-controls button{min-height:60px;border:1px solid #798c9a;border-radius:12px;background:linear-gradient(#fff,#d7dfe3);box-shadow:0 4px 0 #657b89;color:#203747;font-weight:800;touch-action:none;user-select:none}
.courier-controls .courier-gas{background:linear-gradient(#55a87d,#25654c);color:white}
.courier-controls .courier-brake{background:linear-gradient(#d77079,#923f57);color:white;font-size:.8rem}
.courier-toolbar{display:flex;gap:8px;flex-wrap:wrap;margin:10px 0}
.courier-toolbar button,.courier-upgrades button{padding:10px;border-radius:9px;border:1px solid #a58777;background:#fff6e5;color:#4a3426;font-weight:650}
.courier-upgrades{display:grid;gap:8px;padding:12px;background:#e8ddc8;border-radius:12px;margin-bottom:12px}
.courier-controls button:active{transform:translateY(3px);box-shadow:0 1px 0 #657b89}
@media(max-width:520px){.courier-controls{gap:5px}.courier-controls button{min-height:58px}.courier-toolbar button{flex:1}.courier-summary{font-size:.85rem}}

.courier-career,.courier-customize{padding:14px;margin:12px 0;border:1px solid #bfa789;border-radius:14px;background:linear-gradient(145deg,#fff8e8,#e9dfcb);color:#3b3d36}
.courier-career p{margin:0 0 12px;line-height:1.7}
.courier-daily,.courier-style-group{display:grid;gap:8px}
.courier-style-group{grid-template-columns:repeat(2,minmax(0,1fr));margin-bottom:14px;padding-bottom:14px;border-bottom:1px solid #bfa78966}
.courier-style-group:last-child{margin:0;padding:0;border:0}
.courier-career button,.courier-customize button{white-space:normal;text-align:left;min-height:44px;border:1px solid #aa9780;border-radius:8px;background:#fffaf0;color:#39453b;padding:10px;font-size:.85rem;line-height:1.5}
.game-page .courier-toolbar button{min-height:44px;font-size:.8rem}
.game-page .courier-summary{line-height:1.7}
.game-page .courier-upgrades[hidden],.game-page .courier-career[hidden],.game-page .courier-customize[hidden]{display:none!important}
@media(max-width:420px){.courier-style-group{grid-template-columns:1fr}.courier-toolbar button{flex:1 1 42%}}
.courier-city-notice{padding:12px 14px;border:1px solid #cf9d54;border-left:4px solid #d89635;border-radius:10px;background:#fff1d3;color:#65451f;font-size:.9rem;line-height:1.7}
.courier-city-notice[hidden]{display:none!important}

/* One fullscreen surface for canvas games and DOM-based puzzles alike. */
.game-screenbar{display:flex;align-items:center;justify-content:space-between;gap:10px;margin:0 0 10px;font-weight:700;color:#6e2041}
.game-screenbar span{font-size:.88rem}
.game-screenbar button{min-height:44px;border:1px solid #89334e;border-radius:11px;padding:9px 14px;background:linear-gradient(135deg,#912748,#5d1b39);color:#fff;font-weight:750;cursor:pointer}
.game-viewport{position:relative;max-width:440px;margin-inline:auto;isolation:isolate}
#courier-tools-toggle{position:absolute;z-index:5;right:8px;top:110px;max-width:120px;min-height:42px;padding:8px;border:1px solid #c8dddf88;border-radius:10px;background:#1d354be8;color:#fff8e6;font-weight:750;font-size:.72rem;touch-action:manipulation}
.courier-layout #game-canvas[hidden]~#courier-tools-toggle{display:none}
.courier-layout #game-board{display:none}
.courier-layout.courier-tools-open #game-board{display:block;padding:10px}
.game-page .courier-touch-controls{position:absolute;inset:0;margin:0;display:block;pointer-events:none;z-index:4;touch-action:none}
.game-page .courier-touch-controls button{position:absolute;bottom:12px;width:62px;height:62px;min-height:62px;padding:0;border:1px solid #d9e8ed99;border-radius:22px;background:linear-gradient(145deg,#ecf4eddf,#7d9da2e8);color:#102c3d;box-shadow:inset 0 2px 1px #fff8,0 4px 10px #06151b66;font-size:1.7rem;font-weight:850;pointer-events:auto;touch-action:none;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none;backdrop-filter:blur(8px)}
.game-page .courier-touch-controls .courier-left{left:12px}
.game-page .courier-touch-controls .courier-right{left:84px}
.game-page .courier-touch-controls .courier-gas{right:12px;bottom:86px;background:linear-gradient(140deg,#72d3a5e8,#246b56ed);color:#fff;font-size:1rem}
.game-page .courier-touch-controls .courier-brake{right:12px;background:linear-gradient(140deg,#d7838de8,#8c354ded);color:#fff;font-size:.75rem;line-height:1.3}
.game-page .courier-touch-controls button.is-held{transform:translateY(3px) scale(.96);box-shadow:inset 0 2px 7px #071f2877,0 0 0 3px #fff8}
html.game-fullscreen-open,body.game-fullscreen-open{overflow:hidden!important;overscroll-behavior:none}
.game-page .game-shell.is-game-fullscreen{position:fixed;inset:0;z-index:2147483000;box-sizing:border-box;max-width:none;width:100%;height:100vh;height:100dvh;margin:0;padding:max(8px,env(safe-area-inset-top)) max(8px,env(safe-area-inset-right)) max(8px,env(safe-area-inset-bottom)) max(8px,env(safe-area-inset-left));background:#f8f2e8;display:flex;flex-direction:column;gap:6px;overflow:auto;overscroll-behavior:contain}
.game-shell:fullscreen{max-width:none}
.is-game-fullscreen .game-screenbar{flex:none;margin:0;min-height:44px}
.is-game-fullscreen .game-stats{flex:none;margin:0;padding:5px 9px;font-size:.8rem;gap:8px}
.is-game-fullscreen #game-status{flex:none;min-height:0;margin:0;font-size:.78rem;line-height:1.3;max-height:2.6em;overflow:auto}
.game-page .is-game-fullscreen .game-stage{flex:1 1 0;min-height:140px;padding:4px;border-radius:10px;overflow:auto;overscroll-behavior:contain}
.game-page .is-game-fullscreen .game-stage canvas{width:min(100%,calc(var(--play-height,400px) * .90909));max-width:none;height:auto;max-height:var(--play-height,440px);margin:auto;object-fit:contain}
.is-game-fullscreen .game-actions{flex:none;margin:0;gap:5px}
.is-game-fullscreen .game-actions button{padding:6px 10px;min-height:40px;font-size:.75rem}
.is-game-fullscreen #save-status:empty{display:none}
.is-game-fullscreen #nick-form{flex:none;padding:10px;gap:5px;max-height:45dvh;overflow:auto}
.is-game-fullscreen #nick-form .game-note{margin:2px;font-size:.75rem}
.courier-layout .is-game-fullscreen .game-stats,.courier-layout .is-game-fullscreen #game-status{display:none}
.courier-layout .is-game-fullscreen .game-stage{position:relative;overflow:hidden}
.courier-layout .is-game-fullscreen .game-viewport{width:100%;max-width:none;height:var(--play-height,440px);display:grid;place-items:center}
.courier-layout .is-game-fullscreen #game-board{position:absolute;inset:8px;z-index:6;overflow:auto;padding:52px 12px 12px;max-width:none;border:1px solid #9caaad;border-radius:12px;background:#faf3e9f5;box-shadow:0 10px 40px #081c3c66}
.courier-layout.courier-tools-open .is-game-fullscreen #courier-tools-toggle{z-index:7;top:8px}
@media(max-width:380px){.game-page .courier-touch-controls button{width:56px;height:56px;min-height:56px;border-radius:18px}.game-page .courier-touch-controls .courier-right{left:77px}.game-page .courier-touch-controls .courier-gas{bottom:80px}.game-screenbar span{font-size:.78rem}}
@media(orientation:landscape) and (max-height:520px){.is-game-fullscreen .game-screenbar{min-height:36px}.is-game-fullscreen .game-screenbar button{min-height:36px;padding:6px 12px}.is-game-fullscreen .game-stats{padding:2px 8px}.is-game-fullscreen #game-status{max-height:1.3em}.courier-layout .is-game-fullscreen #courier-tools-toggle{top:8px}}
#courier-tools-toggle{width:clamp(72px,22vw,90px);max-width:90px}
.is-game-fullscreen #restart-game:disabled{display:none}
