/* Production game shell adapted from the approved V7 play surface. */
/* Reveal names stay legible gold on both themes; controls retain their normal colors. */
.game-result #resultName,.game-result #multiResult li span,.game-result .result-group-entry strong,#modal .modal-copy.result-member-name{color:#f4ce73;text-shadow:0 1px 2px #0008,0 0 18px #eab95524}
.game-stage.result-visible .stage-ui,.game-stage.result-visible .game-caption{visibility:hidden;pointer-events:none}
body.game-page{height:100dvh;min-height:0;margin:0;overflow:hidden;background:#0b1528;color:#e8eef9}
.game-shell,.game-stage{position:relative;width:100%;height:100%;min-height:0;max-height:none}
.game-stage{overflow:hidden;border:0;border-radius:0;box-shadow:none;background:radial-gradient(ellipse at 50% 45%,#28415a 0,#162c44 31%,#0d1b30 63%,#091324 100%)}
.game-stage:before{content:none}.game-stage.cosmic-stage{background:radial-gradient(ellipse at 50% 46%,#363154 0,#202941 36%,#101a2f 68%,#0b1427 100%)}
.game-stage #stage{inset:0;top:0;right:0;bottom:0;left:0;--stage-safe-top:.10;--stage-safe-right:.11;--stage-safe-bottom:.12;--stage-safe-left:.11;cursor:grab;mask-image:none}
.game-stage #stage canvas{width:100%;height:100%}
.game-stage #brandLogo{position:absolute;right:32px;top:90px;max-width:110px;max-height:50px;object-fit:contain;z-index:3}
.game-top{position:absolute;top:25px;left:36px;right:36px;display:flex;justify-content:space-between;align-items:center;gap:20px;z-index:6}
.game-top .brand{display:flex;align-items:center;gap:9px;color:#eef2fa;font-size:18px;letter-spacing:-.03em;white-space:nowrap}
.game-top .brand img{width:33px;height:33px;object-fit:contain}.game-top .brand strong{font-size:18px;letter-spacing:0}.game-top .brand strong span{display:block;margin-top:2px;color:#91a3bd;font-size:8px;letter-spacing:.04em}.game-top .brand-mark{background:#d9e1ff14;border:1px solid #d5dbf433;box-shadow:none}
.game-scenes{display:flex;flex-direction:row;gap:4px;border:1px solid #b8c8e11e;background:#9cb9e30a;backdrop-filter:blur(15px);padding:5px;border-radius:15px}
.game-scenes .app{display:flex;align-items:center;gap:7px;padding:9px 13px;min-height:44px;border:1px solid transparent;border-radius:10px;background:none;color:#93a4be;font-size:12px;transition:background .2s,color .2s;white-space:nowrap}
.game-scenes .app-icon{width:auto;font-size:14px}.game-scenes .app.active{color:#e5def7;background:#baa3f01b;border-color:#cdb8fa36}.game-scenes .app:hover{color:white}.game-scenes .app b,.game-scenes .app small{display:none}
.game-account{display:flex;align-items:center;gap:9px}.game-account>button{min-height:44px;border:1px solid #c0d1e623;border-radius:11px;background:#aec5e80b;color:#a8b7d0;padding:4px 12px;font-size:11px}
.game-caption{position:absolute;left:40px;top:123px;z-index:2;max-width:350px;pointer-events:none}.game-caption .eyebrow{display:flex;align-items:center;gap:8px;color:#8ca6bf;font-size:10px;font-weight:400;letter-spacing:.06em;margin-bottom:16px}.game-caption h1{font-size:27px;letter-spacing:-.045em;font-weight:500;color:#e6edf8;margin:0 0 12px}.game-caption p:last-child{font-size:11px;color:#9aabc1;max-width:290px;line-height:1.9;margin:0}.game-caption .scene-number{display:none}
.machine-rail{position:absolute;left:39px;top:45%;display:grid;gap:9px;z-index:4}.machine-rail button{display:flex;align-items:center;gap:10px;min-width:124px;min-height:48px;padding:11px 13px;border:1px solid #b3c9e41a;border-radius:12px;background:#c1d5f408;color:#8199b5;text-align:left}.machine-rail button>span{font-size:17px}.machine-rail button div{font-size:11px}.machine-rail button small{display:block;margin-top:4px;color:#8295af;font-size:9px}.machine-rail button em{margin-left:auto;font-size:8px;font-style:normal;color:#8499b5}.machine-rail button.active{color:#cfc2ed;background:#a79ac61c;border-color:#baaae343}.machine-rail button:hover{background:#bcc7ee20}
.game-tool-rail{position:absolute;right:38px;top:39%;display:grid;gap:9px;z-index:4}.game-tool-rail button{display:grid;justify-items:center;gap:3px;min-width:48px;min-height:48px;border:0;background:none;color:#8ca1bc;font-size:9px;padding:4px 7px;transition:color .2s}.game-tool-rail button span{font-size:20px}.game-tool-rail button:hover{color:#e0d6fd}
.game-tools{position:absolute;top:88px;right:35px;bottom:auto;display:flex;align-items:center;gap:7px;z-index:4}.game-tools button{width:44px;height:44px;border:1px solid #c0d1e623;border-radius:10px;background:#aec5e80b;color:#a8b7d0}.game-tools select{width:94px;min-height:44px;padding:7px;background:#142238;color:#afbdd2;border-color:#c0d1e623;font-size:10px}.game-tools label{display:flex;align-items:center;gap:4px;color:#9aabc1;font-size:9px}.game-tools input{width:13px}
.game-invite{position:absolute;left:39px;bottom:34px;display:flex;min-height:48px;align-items:center;gap:12px;border:1px solid #b6afe524;border-radius:13px;padding:12px 15px;background:#af9fe908;color:#b6acd4;font-size:11px;text-align:left;z-index:4}.game-invite>span:first-child{font-size:20px;color:#9986ba}.game-invite small{display:block;color:#91a0b7;font-size:9px;margin-top:5px}.game-invite>span:last-child{font-size:17px;color:#91a0b7;margin-left:4px}.game-invite:hover{background:#af9fe915}
.candidate-chip{position:absolute;right:37px;bottom:35px;top:auto;left:auto;display:grid;gap:5px;background:#b5cfe609;border:1px solid #c6d8f125;border-radius:13px;padding:12px 16px;color:#8298b2;font-size:10px;z-index:3}.candidate-chip>span:first-child{color:#a8b7d0}.candidate-chip>span:first-child i{display:inline-block;width:6px;height:6px;border-radius:50%;background:#8cadbf;margin-right:6px}.candidate-chip b{color:#dde6f4;margin-left:5px;font-weight:500}.candidate-chip small{color:#7890ac}
.stage-bottom{position:absolute;bottom:29px;left:50%;transform:translateX(-50%);display:grid;justify-items:center;gap:9px;width:260px;z-index:5;text-align:center}.draw-context{color:#9aabc1;font-size:10px;margin:0}.game-stage .draw-button{height:57px;width:246px;border-radius:17px;box-shadow:0 0 80px #aea0ef17,0 10px 35px #050b233d;background:linear-gradient(112deg,#eee4fa,#b9cdef);color:#2c294a;border:1px solid #e3e3fc90;letter-spacing:.04em;padding:12px 20px}.game-stage .draw-button strong{font-size:15px;letter-spacing:.04em}.game-stage .draw-hint{color:#91a1ba;font-size:9px;margin:0}.draw-hint kbd{color:#b4c5dd;border:1px solid #9bafca3a;border-radius:4px;padding:1px 4px;font:inherit}
.game-result{position:absolute;z-index:7;top:auto;bottom:30px;left:50%;transform:translateX(-50%);width:min(550px,90vw);padding:17px 22px;text-align:center;background:#111e32f2;border:1px solid #bda9ee68;border-radius:18px;box-shadow:0 18px 80px #0007;backdrop-filter:blur(14px)}.game-result h2{font-size:28px;line-height:1.4;margin:8px 0;overflow-wrap:anywhere}.game-result small{color:#c2b3e6}.game-result .result-actions{display:flex;justify-content:center;gap:8px}.game-result .result-actions button{padding:8px 12px;font-size:11px}.game-result .result-actions button:first-child{background:#d8cef1;color:#25223c;border:0}.result-note{font-size:9px;color:#9aabc1;margin:10px 0 0}
.game-settings{position:fixed;z-index:30;top:0;right:0;bottom:0;width:min(420px,94vw);max-height:100dvh;overflow:auto;padding:26px 23px;background:#111d30f5;border-left:1px solid #8298b733;box-shadow:-25px 0 80px #0008;transform:translateX(105%);visibility:hidden;transition:transform .24s ease,visibility .24s}.game-settings.open{transform:translateX(0);visibility:visible}.game-settings .panel-heading>button{display:block}.game-settings textarea{min-height:150px}.game-settings .field,.game-settings .helper,.game-settings .checkbox{color:#bbc8da}.game-settings input,.game-settings select,.game-settings textarea{background:#0c1729;border-color:#8596b442;color:#edf2fa}.game-settings .rule-note{border-color:#8596b433}.settings-backdrop{position:fixed;inset:0;z-index:29;border:0;border-radius:0;background:#02091699;backdrop-filter:blur(2px)}
 .touch-exit,.edge-reveal{display:none;position:absolute;z-index:10;top:14px;right:14px;min-width:44px;min-height:44px;border:1px solid #c0d1e640;border-radius:11px;padding:10px 13px;background:#0a1425d9;color:white}.game-stage.immersive{height:100dvh;min-height:0}.game-stage.immersive #stage{--stage-safe-top:.03;--stage-safe-right:.07;--stage-safe-bottom:.04;--stage-safe-left:.07}.game-stage.busy .stage-ui,.game-stage.busy .game-tools,.game-stage.busy .game-caption,.game-stage.busy .machine-rail,.game-stage.busy .candidate-chip,.game-stage.busy .game-invite{visibility:hidden;pointer-events:none}.game-stage.busy .stage-bottom{visibility:hidden;pointer-events:none}.game-stage.busy.manual-stop .stage-bottom{visibility:visible;pointer-events:auto}.game-stage.busy .game-settings{visibility:hidden!important}.game-stage.busy #result{visibility:hidden}.game-stage.busy .edge-reveal,.game-stage.result-visible .edge-reveal{display:block;opacity:0;width:18px;height:18px;padding:0;top:12px;right:12px;border:0;background:transparent;color:transparent}.game-stage.controls-visible .edge-reveal{opacity:.35}.game-stage.controls-visible .touch-exit{display:block}.game-stage .toast{bottom:26px}.game-status{position:absolute;z-index:20;left:50%;top:50%;transform:translate(-50%,-50%);padding:12px 18px;border:1px solid #c0d1e640;border-radius:12px;background:#0a1425e8;color:#e8eef9;font-size:12px;box-shadow:0 8px 32px #0006}.game-stage.requesting .game-status{display:block}.game-stage.result-visible .stage-bottom{visibility:hidden;pointer-events:none}
body.game-page .topbar,body.game-page .sidebar,body.game-page>.mobile-settings{display:none}.game-page .workspace{display:block}.game-stage:fullscreen{height:100dvh;min-height:100dvh}.game-stage:fullscreen #stage{--stage-safe-top:.03;--stage-safe-right:.07;--stage-safe-bottom:.04;--stage-safe-left:.07}
body.game-page.display-mode .game-top,body.game-page.display-mode .machine-rail,body.game-page.display-mode .game-tool-rail,body.game-page.display-mode .game-invite,body.game-page.display-mode .game-tools,body.game-page.display-mode .stage-bottom,body.game-page.display-mode .candidate-chip{display:none}body.game-page.display-mode #stage{--stage-safe-top:.03;--stage-safe-right:.07;--stage-safe-bottom:.14;--stage-safe-left:.07}body.game-page.display-mode .game-result{bottom:35px;width:min(680px,90vw)}
dialog#modal{width:min(620px,94vw);max-height:88dvh;padding:24px;background:#111d30;color:#e8eef9;border:1px solid #a2b1c748;border-radius:18px}dialog#modal::backdrop{background:#030916b8;backdrop-filter:blur(5px)}#modal .modal-heading{margin-bottom:16px}#modal .modal-heading h2{color:#edf2fa}#modal #modalBody{max-height:calc(88dvh - 85px);overflow:auto}#modal .modal-item{border-color:#99aac32d;background:#ffffff05}#modal .modal-copy,#modal .modal-item p{color:#a9b8cf}#modal button{color:#e8eef9}#modal .solid{color:#24341b}#toast{z-index:1000}
body.game-page :focus-visible{outline:2px solid #d9ccff;outline-offset:3px}.invite-terms{padding-left:20px;color:#a9b8cf;font-size:12px;line-height:1.9}.invite-heading{margin:22px 0 10px;font-size:15px}.invite-link-row{display:flex;gap:8px}.invite-link-row input{min-width:0}.invite-link-row button{flex:none;padding:0 14px}
.game-stage.busy #stage{pointer-events:none}.game-stage.manual-stop .draw-hint{display:none}
@media(max-width:1050px){.game-top{left:24px;right:24px}.game-top .brand strong span{display:none}.game-scenes .app{padding:8px 9px;font-size:10px;gap:4px}.game-account{gap:5px}.game-account>button{padding:4px 8px;font-size:10px}.game-caption{left:28px;top:115px;max-width:240px}.game-caption h1{font-size:24px}.game-caption p:last-child{display:none}.machine-rail{left:26px}.machine-rail button{min-width:108px;padding:10px}.machine-rail button small,.machine-rail button em{display:none}.game-tool-rail{right:23px}.game-invite{left:26px;bottom:28px}.candidate-chip{right:25px;bottom:29px}}
@media(max-width:760px){.game-top{top:17px;left:17px;right:17px;align-items:flex-start}.game-top .brand .brand-mark{width:29px;height:29px}.game-top .brand strong{font-size:15px}.game-scenes{position:absolute;left:50%;top:48px;transform:translateX(-50%);width:max-content;max-width:calc(100vw - 24px);gap:2px;padding:4px;border-radius:12px}.game-scenes .app{padding:8px 10px;font-size:9px;border-radius:8px}.game-scenes .app-icon{font-size:12px}.game-account{margin-left:auto}.game-account #libraryButton{display:none}.game-account>button{min-height:44px}.game-caption{top:117px;left:19px;max-width:220px}.game-caption .eyebrow{font-size:8px;margin-bottom:8px}.game-caption h1{font-size:20px}.machine-rail{left:50%;top:auto;bottom:111px;transform:translateX(-50%);display:flex;width:max-content;max-width:calc(100vw - 28px);gap:5px}.machine-rail button{min-width:0;padding:8px 9px;font-size:9px;gap:5px}.machine-rail button div{font-size:9px;white-space:nowrap}.machine-rail button>span{font-size:13px}.game-tool-rail{right:14px;top:33%;gap:9px}.game-tool-rail button{font-size:8px;padding:3px;min-width:44px;min-height:44px}.game-tool-rail button span{font-size:18px}.game-stage #stage{--stage-safe-top:.20;--stage-safe-right:.01;--stage-safe-bottom:.20;--stage-safe-left:.01}.game-invite{left:14px;bottom:40px;display:grid;place-items:center;width:44px;height:44px;min-width:44px;min-height:44px;padding:0;gap:0;border-radius:50%}.game-invite small{display:none}.game-invite>span:nth-child(2),.game-invite>span:last-child{display:none}.candidate-chip{right:14px;bottom:146px;max-width:calc(50vw - 28px);padding:9px 10px;font-size:9px}.candidate-chip>span:last-child{display:none}.stage-bottom{bottom:23px;width:205px;gap:6px}.game-stage .draw-button{width:196px;height:48px;border-radius:13px;font-size:12px}.game-stage .draw-button strong{font-size:13px}.game-stage .draw-hint{font-size:8px}.game-tools{right:12px;top:88px;bottom:auto;gap:4px}.game-tools select,.game-tools label{display:none}.game-tools button{width:44px;height:44px}.game-stage.immersive #stage{--stage-safe-top:.07;--stage-safe-right:0;--stage-safe-bottom:.12;--stage-safe-left:0}.game-result{bottom:21px;padding:13px;width:min(540px,94vw)}.game-result h2{font-size:23px;max-height:80px;overflow:auto}.game-settings{width:min(400px,100vw);padding:20px 16px}.game-stage.controls-visible .touch-exit{display:block}}
@media(max-width:390px){.game-scenes .app{padding:7px 7px;font-size:8px;gap:3px}.game-scenes .app-icon{font-size:11px}.game-caption h1{font-size:18px}.machine-rail button{padding:7px}.game-invite>span:last-child{display:none}}
@media(max-height:620px) and (min-width:761px){.game-caption{top:88px}.game-caption p:last-child{display:none}.machine-rail{top:39%}.game-tool-rail{top:32%;gap:8px}.game-stage #stage{--stage-safe-top:.12;--stage-safe-right:.14;--stage-safe-bottom:.17;--stage-safe-left:.14}.stage-bottom{bottom:16px}.game-invite,.candidate-chip{bottom:19px}}
@media(prefers-reduced-motion:reduce){.game-settings{transition:none}}

/* Override legacy studio shell rules once, leaving scene geometry untouched. */
body.game-page{--bg:#0b1528;--line:#667e9f45;--text:#e8eef9;--muted:#9aabc1;--lime:#c9bbef;--purple:#b4a1dc;font-family:Inter,"Microsoft YaHei",system-ui,sans-serif}
.game-tools{left:auto;max-width:calc(100vw - 36px)}
.game-top .brand-mark{display:grid;place-items:center;width:35px;height:35px;border-radius:11px;color:#ddd5f8}
.game-top .brand-mark svg{width:23px;height:23px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
.machine-rail button>span{display:grid;place-items:center;width:24px;height:24px;background:transparent;color:inherit;flex:none}
.game-stage .solid{background:linear-gradient(110deg,#ddd1f3,#bacfec);color:#29283f}
.game-stage.immersive .game-caption{display:none}
.game-stage [hidden]{display:none!important}
.game-stage .edge-reveal{width:44px;height:44px;min-width:44px;min-height:44px}
.game-result .result-actions #copyButton{background:transparent;border-color:transparent;color:#a9b8cf;font-size:11px}
.game-stage .game-scenes .app,.game-stage .machine-rail button,.game-top .game-account button{min-height:44px}
.game-stage #toast{position:fixed;z-index:1000;left:50%;bottom:24px;max-width:90vw;transform:translateX(-50%);background:#15223a;color:#fff}
@media(max-height:520px) and (orientation:landscape){
 .game-top{top:10px;left:16px;right:16px;gap:9px}.game-top .brand strong span{display:none}.game-scenes{position:static;transform:none;max-width:none}.game-scenes .app{padding:6px 8px}.game-caption{display:none}.game-tools{top:66px;right:12px}.game-tools select,.game-tools label{display:none}.game-tool-rail{top:120px;gap:0;right:12px}.game-tool-rail small{display:none}.game-tool-rail button{min-height:44px}.machine-rail{top:83px;left:16px;bottom:auto;transform:none;display:grid}.machine-rail button{min-height:40px}.game-invite{left:18px;bottom:18px;width:44px;height:44px;display:grid;place-items:center;padding:0}.game-invite>span:not(:first-child){display:none}.candidate-chip{bottom:20px;top:auto}.stage-bottom{bottom:12px}.draw-hint{display:none}.game-stage #stage{--stage-safe-top:.12;--stage-safe-right:.18;--stage-safe-bottom:.14;--stage-safe-left:.18}.game-result{bottom:10px;max-height:70dvh;overflow:auto}.game-settings{max-height:100dvh}
}

/* Share tools follow the game's touch targets and theme colors. */
.invite-poster>button{min-height:44px;padding:10px 16px;border:1px solid #c7b6eb55;border-radius:11px;background:#b8a2e51a;font-size:13px;line-height:1.5}.invite-poster>button:disabled{opacity:.6;cursor:wait}
.invite-poster{margin:22px 0;padding:18px;border:1px solid #b1c4e32b;border-radius:16px;background:#b3a4eb09}.invite-poster img{display:block;width:min(100%,360px);height:auto;margin:14px auto;border-radius:14px}.invite-poster-save{display:block;width:fit-content;max-width:100%;margin:16px auto 0;padding:13px 20px;border-radius:12px;background:#d4c7ee;color:#22273e;text-align:center;font-size:14px;font-weight:600;text-decoration:none}.invite-poster .modal-copy{line-height:1.7}
/* Immersive composition stays spacious on short screens too. */
.game-stage.immersive #stage,.game-stage:fullscreen #stage{--stage-safe-top:.03;--stage-safe-right:.07;--stage-safe-bottom:.04;--stage-safe-left:.07}
@media(max-width:760px) and (orientation:portrait){.game-stage.immersive #stage,.game-stage:fullscreen #stage{--stage-safe-top:.07;--stage-safe-right:0;--stage-safe-bottom:.12;--stage-safe-left:0}}
/* On very short landscape screens, keep the tool rail clear of the summary badge. */
@media(max-height:360px) and (orientation:landscape){.game-stage .candidate-chip{display:none}}
.sound-picker{margin:24px 0;padding:20px;border:1px solid #ffffff18;border-radius:20px;background:linear-gradient(135deg,#9f8fff0a,#80e4ff05)}
.sound-picker h3{margin:0 0 8px;font-size:17px;font-weight:600}
.sound-choice{display:grid;grid-template-columns:1fr auto auto;align-items:center;gap:10px;padding:15px 0;border-top:1px solid #ffffff10}
.sound-choice p{margin:6px 0 0;font-size:12px;line-height:1.6;color:#aaa9be}
.sound-choice button[aria-pressed=true]{color:#decaff;border-color:#b99cfa88;background:#9970dc22}
.sound-volume{display:flex;align-items:center;gap:16px;margin:18px 0}
.sound-volume label{flex:1;margin:0}.sound-volume input{accent-color:#bdabed;width:100%;padding:0;min-height:26px}
.sound-volume output{min-width:42px;font-size:13px;color:#c8bbde}
@media(max-width:520px){.sound-picker{padding:14px}.sound-choice{grid-template-columns:1fr auto}.sound-choice>div{grid-column:1/-1}.sound-choice button{min-height:40px}.sound-volume{gap:10px}}

/* Keep HUD regions separate from one another and the phone's system gestures. */
body.game-page{--safe-top:env(safe-area-inset-top,0px);--safe-bottom:env(safe-area-inset-bottom,0px);--safe-left:env(safe-area-inset-left,0px);--safe-right:env(safe-area-inset-right,0px)}
.game-top{top:calc(25px + var(--safe-top));left:calc(36px + var(--safe-left));right:calc(36px + var(--safe-right))}
.game-account{min-width:0}.game-account #accountButton{max-width:190px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.game-result{bottom:calc(24px + var(--safe-bottom));max-height:calc(100dvh - 100px - var(--safe-top) - var(--safe-bottom));overflow:auto;overscroll-behavior:contain;scrollbar-gutter:stable}
.game-result .result-actions{position:sticky;bottom:-1px;background:#111e32;padding:10px 0 2px;flex-wrap:wrap}
.game-result .result-actions button{min-height:44px}
.game-settings{padding-top:calc(20px + var(--safe-top));padding-bottom:calc(24px + var(--safe-bottom));padding-right:calc(20px + var(--safe-right));overscroll-behavior:contain;scroll-padding:76px 0 90px}
.game-settings .panel-heading{position:sticky;top:calc(-20px - var(--safe-top));z-index:2;background:#111d30;padding:12px 0;margin-top:-12px}
.game-settings .panel-heading>button,#modalClose{min-width:44px;min-height:44px;flex:none}
.game-settings .panel-actions:has(#applyButton){position:sticky;bottom:calc(-12px - var(--safe-bottom));z-index:1;padding:10px 0;background:#111d30}
.game-settings button{min-height:44px}.game-settings input,.game-settings select,.game-settings textarea{max-width:100%;min-width:0}
dialog#modal{max-height:calc(100dvh - 32px - var(--safe-top) - var(--safe-bottom));padding:20px;overflow:hidden}
dialog#modal[open]{display:flex;flex-direction:column}#modal .modal-heading{flex:none;gap:12px;margin-bottom:12px}#modal .modal-heading h2{min-width:0;overflow-wrap:anywhere}#modal #modalBody{min-height:0;max-height:none;overflow:auto;overscroll-behavior:contain;scrollbar-gutter:stable}#modal .modal-item{flex-wrap:wrap;overflow-wrap:anywhere}#modal .modal-item>div{min-width:0;flex:1 1 180px}#modal .modal-item button{min-height:44px}#modal input,#modal select{min-width:0;max-width:100%}
.touch-exit,.game-stage.busy .edge-reveal,.game-stage.result-visible .edge-reveal{top:calc(12px + var(--safe-top));right:calc(12px + var(--safe-right))}
@media(max-width:1050px) and (min-width:761px){.game-top{left:24px;right:24px;gap:10px}.game-scenes .app{padding-inline:8px}.game-account #accountButton{max-width:145px}}
@media(max-width:760px) and (orientation:portrait){
 .game-top{top:calc(10px + var(--safe-top));left:calc(12px + var(--safe-left));right:calc(12px + var(--safe-right));gap:8px;align-items:center}
 .game-top .brand{gap:5px}.game-top .brand strong{font-size:14px}.game-account{gap:4px}.game-account #libraryButton{display:block;width:40px;min-width:40px;padding:0}.game-account #accountButton{max-width:145px;font-size:10px}
 .game-scenes{top:52px;width:100%;max-width:none;justify-content:space-between;gap:0}.game-scenes .app{flex:1;justify-content:center;padding:7px 3px;font-size:10px;gap:3px}.game-scenes .app-icon{font-size:12px}
 .game-caption{top:calc(124px + var(--safe-top));left:calc(16px + var(--safe-left));max-width:calc(100% - 126px)}.game-caption .eyebrow{display:none}.game-caption h1{font-size:19px;line-height:1.4;margin:0}
 .game-tools{top:calc(118px + var(--safe-top));right:calc(12px + var(--safe-right));gap:4px}
 .candidate-chip{top:calc(158px + var(--safe-top));bottom:auto;left:calc(16px + var(--safe-left));right:auto;max-width:calc(100% - 132px);padding:6px 8px;font-size:9px;pointer-events:none}
 .machine-rail{bottom:calc(122px + var(--safe-bottom));gap:5px;max-width:calc(100% - 24px - var(--safe-left) - var(--safe-right))}.machine-rail button{padding:8px;gap:4px;flex:1}.machine-rail button div{font-size:10px}.machine-rail button>span{width:20px}
 .game-tool-rail{top:auto;bottom:calc(68px + var(--safe-bottom));left:50%;right:auto;transform:translateX(-50%);display:flex;justify-content:center;gap:12px;width:max-content;max-width:calc(100% - 24px)}.game-tool-rail button{width:52px;min-height:44px;font-size:10px;gap:2px}.game-tool-rail button span{font-size:17px}.game-tool-rail button small{font-size:10px}
 .stage-bottom{bottom:calc(12px + var(--safe-bottom));width:min(210px,calc(100% - 128px));gap:0}.game-stage .draw-button{width:100%;height:48px}.game-stage .draw-hint{display:none}.draw-context{position:absolute;bottom:166px;width:max-content;max-width:calc(100vw - 32px);font-size:9px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
 .game-invite{left:calc(12px + var(--safe-left));bottom:calc(14px + var(--safe-bottom))}
 .game-stage #stage{--stage-safe-top:.23;--stage-safe-right:.02;--stage-safe-bottom:.25;--stage-safe-left:.02}
 .game-result{width:calc(100% - 24px);bottom:calc(12px + var(--safe-bottom));padding:12px;max-height:calc(100dvh - 80px - var(--safe-top) - var(--safe-bottom))}.game-result h2{max-height:25dvh}.game-result .result-actions{gap:6px}.game-result .result-actions button{padding:8px;font-size:11px}
 .game-settings{width:100%;padding-left:16px}.game-settings input,.game-settings select,.game-settings textarea,#modal input,#modal select{font-size:16px}
 dialog#modal{width:calc(100% - 24px);padding:16px}.invite-link-row{flex-wrap:wrap}.invite-link-row input{flex:1 1 100%}
}
@media(max-width:760px) and (max-height:680px) and (orientation:portrait){
 .game-caption{top:calc(120px + var(--safe-top))}.candidate-chip{top:calc(151px + var(--safe-top));padding:4px 7px}.game-stage #stage{--stage-safe-top:.30;--stage-safe-bottom:.34}.draw-context{display:none}
}
@media(max-height:520px) and (orientation:landscape){
 .game-top{top:calc(6px + var(--safe-top));left:calc(12px + var(--safe-left));right:calc(12px + var(--safe-right));gap:8px}.game-top .brand strong{font-size:14px}.game-top .brand-mark{width:28px;height:28px}.game-scenes{width:auto;flex:none;gap:0;padding:3px}.game-scenes .app{padding:5px;font-size:10px;gap:3px}.game-account #libraryButton{display:none}.game-account #accountButton{max-width:128px;padding:4px 6px;font-size:10px}
 .game-tools{top:calc(64px + var(--safe-top));right:calc(12px + var(--safe-right));gap:4px}
 .game-tool-rail{top:calc(114px + var(--safe-top));bottom:calc(62px + var(--safe-bottom));right:calc(12px + var(--safe-right));left:auto;transform:none;display:grid;grid-template-columns:repeat(2,44px);align-content:start;gap:4px;overflow:auto;max-width:92px}.game-tool-rail button{width:44px;min-width:44px;height:48px;padding:2px;font-size:9px}.game-tool-rail button small{display:block;font-size:9px}
 .machine-rail{top:calc(67px + var(--safe-top));bottom:calc(70px + var(--safe-bottom));left:calc(12px + var(--safe-left));max-width:115px;overflow:auto;align-content:start;gap:5px}.machine-rail button{min-width:0;min-height:44px;padding:6px;font-size:10px}.machine-rail button div{font-size:10px}.machine-rail button small,.machine-rail button em{display:none}
 .stage-bottom{bottom:calc(10px + var(--safe-bottom));gap:0;width:200px}.game-stage .draw-button{width:100%;height:46px}.draw-context,.game-stage .draw-hint{display:none}.game-invite{left:calc(12px + var(--safe-left));bottom:calc(12px + var(--safe-bottom));border-radius:50%}.candidate-chip{display:none}
 .game-stage #stage{--stage-safe-top:.17;--stage-safe-right:.20;--stage-safe-bottom:.18;--stage-safe-left:.20}.game-result{bottom:calc(8px + var(--safe-bottom));max-height:calc(100dvh - 64px - var(--safe-top) - var(--safe-bottom))}.game-result h2{font-size:22px}
}
/* Animation retains the entire screen, regardless of the idle HUD layout. */
.game-stage.immersive #stage,.game-stage:fullscreen #stage{--stage-safe-top:.03;--stage-safe-right:.07;--stage-safe-bottom:.04;--stage-safe-left:.07}
@media(max-width:760px) and (orientation:portrait){.game-stage.immersive #stage,.game-stage:fullscreen #stage{--stage-safe-top:.07;--stage-safe-right:0;--stage-safe-bottom:.12;--stage-safe-left:0}}
/* Account navigation and a compact appearance library. */
.game-account #libraryButton{min-width:44px;min-height:44px}
.game-page #modal{width:min(760px,calc(100vw - 28px));color:#edf0ff;background:#101e33;border-color:#34435d}
.game-page #modal button{min-height:44px;background:#ffffff08;border:1px solid #8799bd40;color:#e2e8fa;border-radius:11px;padding:10px 16px;font-size:14px}
.game-page #modal button:hover{background:#af9ce221}.game-page #modal .solid,.game-page #modal [aria-pressed=true]{background:#cdbdf0;color:#232d46;border-color:#cdbdf0}
.game-page #modal .modal-copy,.game-page #modal .modal-item p{font-size:13px;line-height:1.7;color:#b2bfd5}
.account-shortcuts{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin:22px 0}
.appearance-tabs{display:flex;gap:6px;padding:5px;margin:16px 0 22px;border:1px solid #94a6c426;border-radius:14px;background:#060e1b44}
.game-page #modal .appearance-tabs button{flex:1;border-color:transparent;background:transparent;color:#adbbd1}
.game-page #modal .appearance-tabs [aria-selected=true]{background:#d4c7f0;color:#25304c}
.appearance-panel[hidden]{display:none!important}.theme-cards{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}
.game-page #modal .theme-visual-card{position:relative;display:flex;flex-direction:column;align-items:stretch;gap:12px;padding:0 0 16px;overflow:hidden;margin:0;border:1px solid #8c9dbc30;border-radius:17px;background:#b7c8ef05}
.theme-visual-card>img{display:block;order:-2;width:100%;height:auto;aspect-ratio:3/2;object-fit:cover;background:#111b31}
.theme-visual-card>div:not(.theme-purchase),.theme-visual-card>button,.theme-purchase{margin:0 16px}.theme-visual-card>div>p{margin:8px 0 0}.theme-visual-card>b{font-size:17px}.theme-visual-card>.theme-current{position:absolute;top:12px;left:12px;padding:5px 10px;background:#101629bf;border:1px solid #ccbfec60;border-radius:20px;font-size:11px;color:#e5dbff}
.game-page #modal .theme-preview-offer>button{background:#cab8ef;color:#242941;border-color:#cab8ef}
.game-page #modal .theme-purchase .modal-item{display:flex;flex-wrap:wrap;border:0;padding:0;gap:10px;margin:0}.compact-product b{display:none}.game-page #modal .theme-purchase button{width:100%;margin:0}.theme-purchase .modal-copy{margin:0}.theme-purchase p{margin:0}
.preview-help{margin:20px 0;padding:13px 0;border-block:1px solid #a6b8df22;font-size:13px;color:#b8c5dd}.preview-help summary{cursor:pointer;min-height:28px}.preview-help p{margin:12px 0 0;line-height:1.8}.pro-offer{margin-top:24px}.pro-offer h3,.config-section h3{font-size:16px;color:#edf0ff;margin:0 0 10px}.config-section{margin:24px 0}.config-actions{display:flex;gap:8px;flex-wrap:wrap}.game-page #modal .config-actions button{font-size:12px;padding:8px 12px}.game-page #modal .sound-picker{margin-top:0}.appearance-panel .modal-item{gap:16px}.game-page #modal input{border:1px solid #8799bd50;border-radius:9px;padding:12px;background:#0b172a;color:#edf0ff;font-size:16px}
@media(max-width:600px){.theme-cards{grid-template-columns:1fr}.theme-visual-card>img{max-height:210px}.game-page #modal .modal-item{flex-wrap:wrap}.config-actions{width:100%}.appearance-tabs{margin-top:8px}.game-page #modal{width:calc(100vw - 20px)}}
.game-page #modal .theme-visual-card>div{flex:0 0 auto}.game-page #modal .theme-visual-card:not(.theme-preview-offer)>button{margin-top:auto}

/* V8 UI polish: quiet controls, generous type and an uninterrupted 3D stage. */
.game-stage #stage{--stage-framing:1.14;--stage-safe-top:.055;--stage-safe-bottom:.115}
.game-stage.immersive #stage,.game-stage:fullscreen #stage{--stage-framing:1}
.game-stage .stage-preference-state{display:none!important}
.game-top .brand strong{font-size:20px}.game-top .brand strong span{font-size:10px}
.game-scenes .app{font-size:14px;gap:8px;padding:9px 14px}.game-scenes .app-icon{font-size:16px}
.game-account>button{font-size:12px;color:#d0d9e9}.game-account #accountButton{max-width:210px}
.game-caption h1{font-size:29px}.game-caption .eyebrow,.game-caption p:last-child{font-size:12px;color:#b7c5db}
.machine-rail button{min-width:146px;padding:12px 14px;color:#bdcbe0}.machine-rail button div{font-size:14px}.machine-rail button small{font-size:11px;color:#a6b5cc}.machine-rail button em{font-size:10px}
.game-tools{top:92px;right:32px;gap:8px}.game-tools button{color:#d1dcf0;background:#a7c2ed0c}
.game-tool-rail{right:28px;gap:8px}.game-tool-rail button{min-width:56px;min-height:60px;color:#c0cce0}.game-tool-rail button small{font-size:12px}.game-tool-rail button:hover{background:#c6b4ef12;border-radius:12px}
.game-tool-rail svg,.game-tools svg{width:21px;height:21px;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round}
.game-tool-rail button>span{display:grid;place-items:center}.game-invite{font-size:13px}.game-invite small{font-size:11px;color:#afbdd2}
.candidate-chip{font-size:12px;color:#b9c8df}.candidate-chip>span:first-child{color:#d2dcf0}.stage-bottom{width:282px;gap:10px}.game-stage .draw-button{width:270px;height:60px}.game-stage .draw-button strong{font-size:17px}.draw-context,.game-stage .draw-hint{font-size:12px;color:#b4c3da}
.game-stage .game-settings{display:flex;flex-direction:column;overflow:hidden;padding:0;background:#111e33}
.game-settings{width:min(460px,94vw)}
.settings-scroll{flex:1;min-height:0;overflow:auto;overscroll-behavior:contain;padding:24px 24px 18px;scroll-padding-top:68px;scroll-padding-bottom:24px}
.game-settings .panel-heading{top:-24px;padding:14px 0;margin-top:-10px;background:#111e33;z-index:2}
.game-settings .field,.game-settings .field-heading,.game-settings .checkbox{font-size:14px}.game-settings .helper,.game-settings .rule-note p{font-size:12px;line-height:1.7}
.game-settings .settings-commit{flex:none;padding:12px 24px calc(14px + var(--safe-bottom));border-top:1px solid #afc2e32c;background:#122138;box-shadow:0 -10px 28px #020b1720}
.game-settings .settings-commit .panel-actions{position:static;margin:0;padding:0;background:none;display:grid;grid-template-columns:1fr 1fr;gap:10px}.settings-commit button{font-size:14px}
.game-settings button{background:#a7bce80b;color:#d1dbee;border-color:#97abc632}.game-settings button.solid{background:#d4c7f0;color:#25304c;border-color:#d4c7f0}
.game-result{padding:22px 24px 12px;width:min(590px,calc(100vw - 32px));border-color:#bdacf055;background:#101d32f5;box-shadow:0 20px 80px #0006,0 0 55px #bcb0f00b}
.game-result>small{font-size:13px;letter-spacing:.12em;color:#bfcce1}.game-result h2{font-size:clamp(26px,3.3vw,40px);line-height:1.35;overflow-wrap:anywhere;max-height:28dvh;overflow:auto}
.game-result .result-actions{gap:10px;display:grid;grid-template-columns:1.3fr 1fr 1fr;background:#101d32;padding:14px 0 2px}.game-result .result-actions button{font-size:13px;min-height:46px;border-radius:12px}
.game-result .result-actions #acceptButton{background:linear-gradient(110deg,#e9dcfc,#c4d7f6);color:#252e49;font-weight:600;border:1px solid #dad3f5}
.game-result .result-actions #copyButton,.game-result .result-actions #closeResult{background:transparent;border-color:#9dadce22;color:#b5c4dc;font-size:13px}
.game-result #multiResult{max-height:40dvh;overflow:auto}.game-result .result-group-entry{overflow-wrap:anywhere}.game-result #multiResult li{font-size:16px}.game-result .result-pagination{font-size:12px}
.game-result button{background:#a7bce80b;color:#d1dbee;border-color:#97abc632}.game-result button:disabled{opacity:.45}
.game-page #modal .appearance-current{font-size:13px;color:#bfcbe0;margin:0 0 18px}.game-page #modal .theme-visual-card>div>b{font-size:17px}.game-page #modal .theme-visual-card>button{margin-top:auto}.game-page #modal .theme-visual-card img{object-fit:contain}
@media(min-width:761px) and (max-width:1050px){
 .game-scenes{position:absolute;top:56px;left:50%;transform:translateX(-50%);width:max-content}.game-caption{top:144px}.game-tools{top:132px}.game-caption h1{font-size:24px}.game-stage #stage{--stage-safe-top:.18;--stage-safe-left:.18;--stage-safe-right:.14;--stage-safe-bottom:.13}.game-account #accountButton{max-width:210px}
}
@media(max-width:760px) and (orientation:portrait){
 .game-top .brand strong{font-size:16px}.game-account>button{font-size:11px}.game-account #accountButton{max-width:155px}.game-top .brand strong span{display:none}
 .game-scenes .app{font-size:12px;gap:4px;padding:7px 2px}.game-scenes .app-icon{font-size:13px}
 .game-caption{top:calc(122px + var(--safe-top));max-width:calc(100% - 126px)}.game-caption h1{font-size:21px}
 .game-tools{top:calc(116px + var(--safe-top));right:12px}.candidate-chip{top:calc(153px + var(--safe-top));padding:0;border:0;background:none;font-size:11px}.candidate-chip>span:first-child{display:none}
 .machine-rail{top:calc(181px + var(--safe-top));bottom:auto;left:50%;transform:translateX(-50%);display:flex;width:max-content;max-width:calc(100% - 24px);gap:8px}.machine-rail button{min-width:0;padding:8px 11px;gap:5px}.machine-rail button div{font-size:12px}.machine-rail button small,.machine-rail button em{display:none}
 .game-tool-rail{top:auto;bottom:calc(12px + var(--safe-bottom));right:12px;left:12px;width:auto;transform:none;display:grid;grid-template-columns:repeat(4,1fr);gap:0;max-width:none;border:1px solid #adc4e524;border-radius:19px;background:#12223de0;backdrop-filter:blur(20px);padding:3px}
 .game-tool-rail button{width:auto;min-width:0;min-height:54px;padding:5px}.game-tool-rail button small{display:block;font-size:12px}.game-tool-rail svg{width:20px;height:20px}
 .stage-bottom{bottom:calc(86px + var(--safe-bottom));width:min(280px,calc(100% - 60px));gap:6px}.game-stage .draw-button{width:100%;height:54px}.game-stage .draw-button strong{font-size:16px}.game-stage .draw-hint{display:none}.draw-context{position:static;font-size:11px}
 .game-invite{display:none}.game-stage #stage{--stage-framing:1.1;--stage-safe-top:.28;--stage-safe-bottom:.23;--stage-safe-left:.01;--stage-safe-right:.01}
 .game-settings{top:auto;bottom:0;left:0;right:0;width:100%;height:min(88dvh,850px);max-height:calc(100dvh - 16px - var(--safe-top));border:1px solid #91a7c738;border-bottom:0;border-radius:25px 25px 0 0;transform:translateY(105%)}.game-settings.open{transform:translateY(0)}
 .settings-scroll{padding:18px 18px 16px}.game-settings .panel-heading{top:-18px;padding-top:14px}.game-settings .panel-heading:before{content:'';position:absolute;top:4px;left:calc(50% - 18px);width:36px;height:3px;border-radius:4px;background:#8898b455}
 .game-settings .settings-commit{padding:12px 18px calc(14px + var(--safe-bottom))}
 .game-result{bottom:calc(14px + var(--safe-bottom));padding:18px 16px 8px;max-height:calc(100dvh - 80px - var(--safe-top) - var(--safe-bottom))}.game-result h2{font-size:30px}.game-result .result-actions{grid-template-columns:1fr 1fr;gap:6px}.game-result .result-actions #acceptButton{grid-column:1/-1;font-size:15px}
 .game-stage.immersive #stage,.game-stage:fullscreen #stage{--stage-framing:1;--stage-safe-top:.07;--stage-safe-bottom:.12}
}
@media(max-width:760px) and (max-height:680px) and (orientation:portrait){
 .game-caption{top:calc(116px + var(--safe-top))}.game-caption h1{font-size:18px}.game-tools{top:calc(120px + var(--safe-top))}.candidate-chip{top:calc(143px + var(--safe-top))}.machine-rail{top:calc(168px + var(--safe-top))}.machine-rail button{min-height:40px;padding:7px 9px}.game-stage #stage{--stage-safe-top:.36;--stage-safe-bottom:.27;--stage-framing:1.05}.draw-context{display:none}
}
@media(max-width:360px) and (orientation:portrait){.game-scenes .app{font-size:11px}.game-account #accountButton{max-width:122px}.game-top .brand strong{font-size:14px}.game-account #libraryButton{display:none}.game-caption h1{font-size:18px}}
@media(max-height:520px) and (orientation:landscape){
 .game-top .brand strong{font-size:14px}.game-top .brand strong span{display:none}.game-scenes{position:static;transform:none;width:auto}.game-scenes .app{font-size:11px;padding:5px;gap:3px}.game-scenes .app-icon{font-size:12px}.game-account #accountButton{font-size:10px;max-width:128px}
 .game-tools{top:calc(60px + var(--safe-top));right:12px}.game-tool-rail{right:12px;top:calc(112px + var(--safe-top));bottom:64px;gap:4px}.game-tool-rail button{min-width:44px;min-height:44px;height:46px;padding:2px}.game-tool-rail button small{font-size:10px}.game-tool-rail svg{width:18px;height:18px}.machine-rail button{min-width:0;padding:6px}.machine-rail button div{font-size:11px}.game-stage #stage{--stage-framing:1.05;--stage-safe-top:.17;--stage-safe-bottom:.18;--stage-safe-left:.20;--stage-safe-right:.20}
 .stage-bottom{width:210px;bottom:10px}.game-stage .draw-button{width:100%;height:46px}.game-stage .draw-button strong{font-size:14px}.game-settings{width:min(460px,92vw);height:100dvh;max-height:100dvh;top:0;bottom:0}.settings-scroll{padding:14px 18px}.game-settings .panel-heading{top:-14px}.game-settings .settings-commit{padding:8px 18px}.game-result h2{font-size:24px}.game-result .result-actions{display:grid;grid-template-columns:1.3fr 1fr 1fr}.game-result .result-actions #acceptButton{grid-column:auto}
 .game-stage.immersive #stage,.game-stage:fullscreen #stage{--stage-framing:1;--stage-safe-top:.03;--stage-safe-bottom:.04;--stage-safe-left:.07;--stage-safe-right:.07}
}

.game-account svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round}.game-account #libraryButton{display:grid;place-items:center}
.game-page #toast{background:#24334e;color:#eef0ff;border:1px solid #a99bd653;box-shadow:0 10px 35px #0004;font-size:13px}
.game-page #modal .modal-item b{color:#e8e2f8}.game-page #modal .modal-item button:disabled{color:#aab7cc}

@media(max-width:360px) and (orientation:portrait){.game-account #libraryButton{display:none}}
