/* Physical separation, rather than a camera workaround: thumbs never cover the world. */
body{--touch-deck:106px}
body.large-touch{--touch-deck:118px}
.game-frame>.game-feedback #touch-controls{display:none}
.touch-device .game-frame>.game-feedback{display:grid;grid-template-columns:1fr minmax(70px,auto) 1fr;grid-template-rows:64px 22px;align-items:center;justify-content:stretch;gap:3px 6px;height:var(--touch-deck);min-height:var(--touch-deck);padding:7px 9px;background:#f5efdF;border-top:1px solid #d6c8b6}
.touch-device .game-frame>.game-feedback #touch-controls{display:contents;position:static;inset:auto;pointer-events:auto}
.game-feedback .touch-direction{grid-column:1;grid-row:1;justify-self:start;gap:7px;align-items:center;touch-action:none}
.game-feedback .touch-abilities{grid-column:3;grid-row:1;justify-self:end;gap:7px;align-items:center}
.game-feedback .touch-controls button{width:46px;height:50px;border:2px solid var(--ink);border-radius:13px;background:#fffaf1;box-shadow:0 3px 0 #27243870;backdrop-filter:none;touch-action:none;user-select:none;-webkit-user-select:none}
.game-feedback .touch-controls .touch-jump{width:54px;height:58px;background:#c4e996}
.game-feedback .touch-controls .touch-dash{width:43px;height:47px;background:#cbb9ed}
.game-feedback .touch-controls button .ui-icon{width:24px;height:24px}
.game-feedback .touch-controls .touch-jump .ui-icon{width:30px;height:30px}
.game-feedback .touch-controls button.pressed{transform:translateY(3px);box-shadow:none;background:#ffd478}
.touch-device .game-frame .game-feedback #ability-bar{grid-column:2;grid-row:1;position:static;display:flex;flex-direction:column;gap:4px;align-items:center;min-height:0;width:auto;max-width:120px}
.touch-device .game-feedback .ability-bar>span{font-size:9px;line-height:1.3;white-space:nowrap;padding:4px 6px;border-radius:6px}
.touch-device .game-frame .game-feedback .floating-message{grid-column:1/-1;grid-row:2;font-size:10px;height:22px;min-height:22px;line-height:1.2;overflow:hidden}
.touch-device .game-frame .game-feedback .floating-message.hidden{display:flex!important;visibility:hidden}
.swap-controls .game-feedback .touch-direction{grid-column:3;justify-self:end;order:0}
.swap-controls .game-feedback .touch-abilities{grid-column:1;justify-self:start;order:0}
.large-touch .game-feedback .touch-controls button{width:52px;height:57px}
.large-touch .game-feedback .touch-controls .touch-jump{width:60px;height:64px}
.large-touch .game-feedback .touch-controls .touch-dash{width:48px;height:53px}
.large-touch .game-frame>.game-feedback{grid-template-rows:72px 22px}
.game-feedback .touch-controls button:focus-visible{outline:3px solid #9970b9;outline-offset:3px}
.touch-device body.game-active .site-header{display:none}
html.touch-device:has(body.game-active){scroll-padding-top:8px}
.touch-device .game-active .game-section{scroll-margin-top:0}
.touch-device .game-active .app-screen{padding-top:8px}
.touch-device .game-active .game-stage>canvas{height:clamp(230px,calc(100dvh - 230px),480px)}
.touch-device .focus-mode .game-frame>.game-feedback{flex-shrink:0}
.touch-device #game-frame>.game-feedback{height:var(--touch-deck);min-height:var(--touch-deck);overflow:visible}
.touch-device .game-active .game-stage>canvas{height:clamp(190px,calc(100dvh - var(--touch-deck) - 180px),480px)}
.touch-device .focus-mode .game-stage>canvas,.touch-device .game-frame:fullscreen .game-stage>canvas{height:100%}
@media(max-width:360px){.game-feedback .touch-direction,.game-feedback .touch-abilities{gap:5px}.game-feedback .touch-controls button{width:41px;height:47px}.game-feedback .touch-controls .touch-jump{width:48px;height:54px}.game-feedback .touch-controls .touch-dash{width:38px;height:43px}.touch-device .game-feedback .ability-bar>span{font-size:8px;padding:4px}.touch-device .game-frame>.game-feedback{padding-left:7px;padding-right:7px;column-gap:4px}.large-touch .game-feedback .touch-controls button{width:46px;height:54px}.large-touch .game-feedback .touch-controls .touch-jump{width:52px;height:60px}.large-touch .game-feedback .touch-controls .touch-dash{width:42px;height:49px}}
@media(max-height:520px) and (orientation:landscape){.touch-device .game-active:not(.focus-mode) .game-stage>canvas{height:calc(100dvh - var(--touch-deck) - 20px);min-height:140px}.touch-device .game-active:not(.focus-mode) .game-heading,.touch-device .game-active:not(.focus-mode) .room-briefing{display:none}}
/* Every result action, including the recording, is part of the primary card. */
#result-overlay{width:min(480px,calc(100vw - 20px));max-width:none;max-height:calc(100dvh - 16px);padding:0;overflow:visible;border:0;background:transparent;box-shadow:none;margin:auto;inset:0}
#result-overlay .result-card{width:100%;max-width:none;max-height:none;min-width:0;margin:0;padding:17px 18px;border:2px solid var(--ink);border-radius:18px;background:#fff9ed;box-shadow:0 5px 0 var(--ink);display:block;overflow:visible;text-align:left;transform:none}
.result-topline{display:flex;align-items:center;justify-content:space-between;gap:10px;min-height:18px}
#result-overlay .result-eyebrow{font-size:10px;line-height:1.35;letter-spacing:.2px;max-width:72%}
#result-overlay .result-stars{display:flex;align-items:center;gap:3px;margin:0;flex:none}
#result-overlay .result-stars .ui-icon{width:18px;height:18px}
.result-title-row{display:flex;align-items:center;justify-content:space-between;gap:8px;min-height:52px;margin:3px 0}
#result-overlay h3{font-size:26px;line-height:1.2;letter-spacing:-.6px;margin:0;flex:1}
#result-character{width:60px;height:52px;position:static;transform:none;flex:none}
#result-overlay .result-record{font-size:11px;line-height:1.45;margin:3px 0 9px;padding:7px 9px;border:1px solid #dfd0e6;border-radius:8px;min-height:0;text-align:left}
#result-overlay .result-stats{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:7px;margin:0}
#result-overlay .result-stats>div{padding:8px 4px;border-radius:9px;text-align:center}
#result-overlay .result-stats strong{font-size:23px;line-height:1.2}
#result-overlay .result-stats span{font-size:10px;line-height:1.3;margin-top:3px}
#result-overlay .result-mastery{font-size:10px;line-height:1.35;margin:6px 0 0;min-height:0}
.result-actions{margin-top:9px}
#result-overlay .result-next-room{font-size:11px;line-height:1.4;margin:0 0 8px;min-height:0;text-align:left}
#result-overlay .result-buttons{display:grid;grid-template-columns:1.2fr 1fr;gap:8px;margin:0 0 9px}
#result-overlay .result-buttons button{padding:8px;min-height:42px;line-height:1.3;font-size:12px;box-shadow:0 3px 0 var(--ink)}
#result-overlay button .ui-icon{width:16px;height:16px;flex:none}
.result-video{padding:8px 9px;border:1px solid #b9c9af;border-radius:9px;background:#eaf1df;margin:0 0 6px}
.result-video>span{display:block;font-size:9px;line-height:1.3;letter-spacing:.5px;font-weight:900;color:#5a704e;margin-bottom:6px}
.result-video>div{display:flex;gap:7px}
#result-overlay .result-video button{flex:1;font-size:11px;min-height:34px;padding:7px;line-height:1.3;box-shadow:none;background:#fffaf0;border-width:1px;white-space:nowrap}
#result-overlay .result-links{display:grid;grid-template-columns:.8fr 1fr 1.2fr;gap:5px;margin:0}
#result-overlay .result-links .text-button{grid-column:auto;font-size:10px;padding:5px 2px;min-height:30px;line-height:1.3;text-align:center;justify-content:center;border:0;background:none;border-radius:6px;max-width:none;box-shadow:none}
#result-overlay .result-links .result-build-link{background:#f0e8f5;border:0;font-size:10px!important}
#result-overlay .result-links .ui-icon{width:13px;height:13px}
.result-crew{display:flex;align-items:center;gap:7px;width:100%;margin-top:7px;padding:7px 9px;border:1px solid #cbb7db;border-radius:8px;background:#eee6f4;text-align:left;min-height:33px;font:900 11px/1.3 var(--font);color:#654976}
.result-crew>span:nth-child(2){flex:1;min-width:0}
.result-crew .ui-icon{width:17px;height:17px}
@media(max-width:400px){#result-overlay .result-card{padding:12px 13px;border-radius:15px}#result-overlay h3{font-size:22px}.result-title-row{min-height:46px}#result-character{width:52px;height:45px}#result-overlay .result-record{font-size:10px;padding:6px 8px;margin-bottom:7px}#result-overlay .result-eyebrow{font-size:9px}#result-overlay .result-stats strong{font-size:21px}#result-overlay .result-stats>div{padding:7px 3px}#result-overlay .result-buttons button{font-size:10px;min-height:39px}#result-overlay .result-video button{font-size:10px;min-height:32px}#result-overlay .result-links .text-button,#result-overlay .result-links .result-build-link{font-size:9px!important}.result-video>span{font-size:8px}.result-crew{font-size:10px;padding:6px 8px;min-height:30px}}
@media(max-height:560px) and (orientation:portrait){#result-overlay .result-card{padding:10px 12px}#result-overlay .result-record{margin:2px 0 5px;padding:4px 7px}#result-overlay .result-stats>div{padding:5px 3px}.result-actions{margin-top:6px}#result-overlay .result-next-room{margin-bottom:5px}#result-overlay .result-buttons{margin-bottom:6px}.result-video{padding:5px 7px;margin-bottom:3px}.result-video>span{margin-bottom:4px}.result-title-row{min-height:42px}#result-character{width:46px;height:40px}.result-crew{margin-top:4px}#result-overlay .result-mastery{margin-top:4px;font-size:9px}}
@media(max-height:520px) and (orientation:landscape){#result-overlay{width:min(820px,calc(100vw - 24px))}#result-overlay .result-card{display:grid;grid-template-columns:.95fr 1.2fr;gap:17px;padding:12px 15px}#result-overlay h3{font-size:23px}#result-overlay .result-eyebrow{font-size:9px}#result-overlay .result-actions{margin:0}#result-overlay .result-record{font-size:10px;margin:3px 0 7px}#result-overlay .result-stats strong{font-size:22px}#result-overlay .result-stats>div{padding:6px 3px}#result-overlay .result-buttons button{min-height:36px;font-size:11px}#result-overlay .result-next-room{font-size:10px;margin-bottom:6px}.result-video{padding:6px 7px}#result-overlay .result-video button{min-height:30px;font-size:10px}.result-crew{min-height:30px;font-size:10px;margin-top:5px}#result-overlay .result-links .text-button{min-height:27px;font-size:9px!important}}
.touch-device .focus-mode .game-section{padding-left:max(8px,env(safe-area-inset-left));padding-right:max(8px,env(safe-area-inset-right));padding-bottom:max(8px,env(safe-area-inset-bottom))}
.touch-device .game-frame:fullscreen>.game-feedback{height:calc(var(--touch-deck) + env(safe-area-inset-bottom));min-height:calc(var(--touch-deck) + env(safe-area-inset-bottom));padding-left:max(9px,env(safe-area-inset-left));padding-right:max(9px,env(safe-area-inset-right));padding-bottom:calc(7px + env(safe-area-inset-bottom))}
@media(max-height:520px) and (orientation:landscape){.touch-device .game-active:not(.focus-mode) main{padding-left:max(10px,env(safe-area-inset-left));padding-right:max(10px,env(safe-area-inset-right))}#result-overlay{width:min(820px,calc(100vw - 24px - env(safe-area-inset-left) - env(safe-area-inset-right)))}}
#result-overlay{max-height:calc(100dvh - 16px - env(safe-area-inset-top) - env(safe-area-inset-bottom))}
.character-options{grid-template-columns:repeat(4,minmax(0,1fr))}
.character-option canvas{filter:none}.character-option.locked canvas{filter:grayscale(.9);opacity:.6}
.character-option.locked small{color:#87728d}.character-option small{line-height:1.45}
@media(max-width:600px){.character-options{grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}.character-option strong{font-size:11px}.character-option small{font-size:10px}.character-option canvas{width:65px;height:75px}.character-studio{grid-template-columns:100px minmax(0,1fr);gap:12px}.character-stage-wrap{min-height:135px}.character-action-buttons{gap:5px}.character-action-buttons button{font-size:9px;padding:6px}.character-dossier h3{font-size:20px}.character-dossier p{font-size:11px}}

/* A game is a touch surface: don't let a long press select its HUD or summon iOS callouts. */
.touch-device .game-stage,.touch-device .game-stage *,.touch-device .game-feedback,.touch-device .game-feedback *{-webkit-user-select:none;user-select:none;-webkit-touch-callout:none}
.touch-device .game-stage :is(input,textarea,select,[contenteditable="true"]),.touch-device .game-feedback :is(input,textarea,select,[contenteditable="true"]){-webkit-user-select:text;user-select:text;-webkit-touch-callout:default}
.friend-entry{display:block;width:100%;margin:5px 0 9px;padding:8px 12px;border:1px solid #b9a4ce;border-radius:10px;background:#f0e8f5;color:#59416f;font:inherit;font-size:12px;font-weight:800;text-align:left;cursor:pointer}
.friend-entry:hover{background:#e6d8ef}.friend-entry:focus-visible,.result-friend-button:focus-visible{outline:3px solid #765690;outline-offset:3px}
body.game-active .friend-entry{display:none}
#result-overlay .result-friend-button{display:flex;align-items:center;justify-content:center;gap:7px;width:100%;min-height:38px;padding:6px 8px;margin:0 0 6px;border:2px solid #a287ba;border-radius:9px;background:#f0e8f5;color:#543b6c;font:inherit;font-size:12px;font-weight:900;line-height:1.2;cursor:pointer}
#result-overlay .result-friend-button:hover{background:#e4d4f0}#result-overlay .result-friend-button .ui-icon{width:16px;height:16px;flex:none}
#result-overlay .result-links{grid-template-columns:1fr 1fr}
@media(max-width:400px){#result-overlay .result-friend-button{font-size:10px;min-height:34px;margin-bottom:4px}}
@media(max-height:560px){#result-overlay .result-friend-button{min-height:30px;padding:4px;margin-bottom:3px;font-size:10px}}
