/* Design stage stays uniform. Small screens get physical 44 px controls. */
:root{--hud-scale:1;--hud-inset-x:0px;--hud-inset-y:0px}
#match-ui .top{inset:calc(6px * var(--hud-scale)) calc(8px * var(--hud-scale)) auto;display:block}
#match-ui .top nav{position:absolute;right:0;top:0;gap:calc(2px * var(--hud-scale))}
#match-ui .top nav button{width:calc(44px * var(--hud-scale));height:calc(44px * var(--hud-scale));min-width:0;min-height:0;padding:0;font-size:calc(20px * var(--hud-scale));border:0;border-radius:50%;background:radial-gradient(circle,#172d42c9 50%,transparent 53%);box-shadow:none;color:#fff}
#match-ui #versus-hud{position:absolute;left:50%;top:calc(8px * var(--hud-scale));transform:translateX(-50%);display:block;width:auto;padding:0;border:0;background:none;box-shadow:none;text-align:center}
#match-timer{font:800 calc(18px * var(--hud-scale))/1.3 sans-serif;font-variant-numeric:tabular-nums;color:#fff;text-shadow:0 1px 3px #172d42}
#own-chip{position:absolute;left:calc(8px * var(--hud-scale));top:calc(10px * var(--hud-scale));width:calc(116px * var(--hud-scale));padding:calc(5px * var(--hud-scale)) calc(7px * var(--hud-scale));background:#172d42b8;color:white;border-radius:calc(8px * var(--hud-scale));pointer-events:none}
#own-chip #self-status{position:static;display:flex;align-items:center;justify-content:space-between;gap:calc(6px * var(--hud-scale));background:none;padding:0;margin:0;border:0;min-width:0;font-size:calc(12px * var(--hud-scale))}
#my-percent{font-size:calc(16px * var(--hud-scale));line-height:1.2}
#my-stocks{font-size:calc(11px * var(--hud-scale));letter-spacing:1px;color:#fff}
#max-gauge{position:relative;margin-top:calc(3px * var(--hud-scale));height:calc(16px * var(--hud-scale));border-radius:3px;overflow:hidden;background:#ffffff20;font-size:calc(10px * var(--hud-scale));text-align:center}
#max-gauge i{position:absolute;inset:0 auto 0 0;width:var(--charge,0%);background:#e0ad3677}
#max-gauge span{position:relative;line-height:calc(16px * var(--hud-scale))}
#max-gauge.armed{color:#ffe16b;box-shadow:0 0 8px #ffd45a88}
#own-chip #wall-cooldown{display:block;margin-top:2px;color:#e2f3ee;font-size:calc(9px * var(--hud-scale));text-align:center}
#match-stage{position:absolute;top:calc(68px * var(--hud-scale));left:50%;transform:translateX(-50%);font-size:calc(13px * var(--hud-scale));color:white;background:#172d4299;border-radius:8px;padding:4px 10px;white-space:nowrap}
#match-ui .bottom{bottom:calc(3px * var(--hud-scale));left:50%;right:auto;transform:translateX(-50%);width:min(440px,calc(100% - 20px * var(--hud-scale)))}
#match-ui .shot-card{height:calc(29px * var(--hud-scale));padding:calc(3px * var(--hud-scale)) calc(8px * var(--hud-scale));display:flex;align-items:center;justify-content:center;border:0;box-shadow:none;background:#172d4299;border-radius:8px 8px 0 0;color:#fff}
#match-ui #word{display:block;max-height:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;line-height:1.2;font-weight:600;font-size:calc(14px * var(--hud-scale))!important}
#match-ui #word span{font-size:inherit!important}
#match-ui #shot-label,#match-ui #metrics{display:none!important}
#match-ui .meter-row{padding:calc(3px * var(--hud-scale)) calc(8px * var(--hud-scale));height:calc(20px * var(--hud-scale));font-size:calc(10px * var(--hud-scale));background:#172d4299;color:#fff}
#match-ui .meter{height:calc(6px * var(--hud-scale));overflow:visible}
#match-ui #mic-max{font-size:calc(8px * var(--hud-scale))}
#match-ui .status-row{padding:0 calc(8px * var(--hud-scale)) calc(3px * var(--hud-scale));height:calc(17px * var(--hud-scale));background:#172d4299;color:#fff;font-size:calc(9px * var(--hud-scale));overflow:hidden}
#voice-status{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#my-buffs{position:absolute;bottom:100%;left:0;max-width:70%}
#match-ui #jump,#match-ui #max-arm{position:absolute;right:calc(14px * var(--hud-scale));width:calc(72px * var(--hud-scale));height:calc(64px * var(--hud-scale));min-width:0;min-height:0;z-index:3;pointer-events:auto;touch-action:manipulation;border-radius:50%;font-size:calc(13px * var(--hud-scale));padding:0}
#match-ui #jump{bottom:calc(86px * var(--hud-scale));background:#fff6d6dc;border:2px solid #fff9}
#match-ui #max-arm{bottom:calc(158px * var(--hud-scale));background:#ffe16bed;border:2px solid #fff3aa;box-shadow:0 0 14px #ffdd5680;display:flex;flex-direction:column;align-items:center;justify-content:center}
#max-arm b{font-size:calc(18px * var(--hud-scale))}
#max-arm small{font-size:calc(9px * var(--hud-scale));line-height:1.1}
#stick-rest{display:none;position:absolute;left:calc(22px * var(--hud-scale));bottom:calc(86px * var(--hud-scale));width:calc(104px * var(--hud-scale));height:calc(104px * var(--hud-scale));border:2px solid #ffffff40;border-radius:50%;background:#ffffff08;pointer-events:none}
#match-ui #stick{width:calc(136px * var(--hud-scale));height:calc(136px * var(--hud-scale))}
#match-ui #knob{left:calc(46px * var(--hud-scale));top:calc(46px * var(--hud-scale));width:calc(40px * var(--hud-scale));height:calc(40px * var(--hud-scale))}
#ui-stage #match-settings{width:min(calc(480px * var(--hud-scale)),calc(var(--ui-width) - 24px * var(--hud-scale)));max-height:calc(var(--ui-height) - 24px * var(--hud-scale));padding:calc(18px * var(--hud-scale));font-size:calc(14px * var(--hud-scale))}
#match-settings h2{font-size:calc(20px * var(--hud-scale));margin:0 0 calc(12px * var(--hud-scale))}
#match-settings label{display:flex;justify-content:space-between;gap:12px}
#match-settings input:not([type=checkbox]){width:100%;height:calc(44px * var(--hud-scale));margin:0}
#match-settings button{min-height:calc(44px * var(--hud-scale));font-size:calc(14px * var(--hud-scale))}
#match-online-note{font-size:calc(12px * var(--hud-scale));color:#884524}
#match-quit-online{color:#884524}
#match-settings .danger{background:#ba2447;color:#fff}
#match-settings .danger:hover{background:#98203c}
#match-settings .match-setting:has(#look-touch){display:none}
@media(pointer:coarse){
 #match-settings .match-setting:has(#look-touch){display:block}
 #match-settings .match-setting:has(#look-mouse){display:none}
}
#match-ui .top{top:calc(6px * var(--hud-scale) + var(--hud-inset-y) + env(safe-area-inset-top) / var(--ui-scale));left:calc(8px * var(--hud-scale) + var(--hud-inset-x) + env(safe-area-inset-left) / var(--ui-scale));right:calc(8px * var(--hud-scale) + var(--hud-inset-x) + env(safe-area-inset-right) / var(--ui-scale))}
#own-chip{top:calc(10px * var(--hud-scale) + var(--hud-inset-y) + env(safe-area-inset-top) / var(--ui-scale));left:calc(8px * var(--hud-scale) + var(--hud-inset-x) + env(safe-area-inset-left) / var(--ui-scale))}
#match-ui .bottom{bottom:calc(3px * var(--hud-scale) + var(--hud-inset-y) + env(safe-area-inset-bottom) / var(--ui-scale))}
#match-ui #jump,#match-ui #max-arm{right:calc(14px * var(--hud-scale) + var(--hud-inset-x) + env(safe-area-inset-right) / var(--ui-scale))}
#match-ui #jump{bottom:calc(86px * var(--hud-scale) + var(--hud-inset-y) + env(safe-area-inset-bottom) / var(--ui-scale))}
#match-ui #max-arm{bottom:calc(158px * var(--hud-scale) + var(--hud-inset-y) + env(safe-area-inset-bottom) / var(--ui-scale))}
#stick-rest{left:calc(22px * var(--hud-scale) + var(--hud-inset-x) + env(safe-area-inset-left) / var(--ui-scale));bottom:calc(86px * var(--hud-scale) + var(--hud-inset-y) + env(safe-area-inset-bottom) / var(--ui-scale))}
#match-ui #crosshair{width:calc(20px * var(--hud-scale));height:calc(20px * var(--hud-scale))}
#match-ui #crosshair i:first-child{width:100%;height:calc(2px * var(--hud-scale));top:calc(9px * var(--hud-scale))}
#match-ui #crosshair i:last-child{height:100%;width:calc(2px * var(--hud-scale));left:calc(9px * var(--hud-scale))}
@media(pointer:coarse){#match-ui #fullscreen{display:none!important}#stick-rest{display:block}.max-shortcut{display:none}}
@media(pointer:fine){#match-ui #jump{display:none}}
@container ui (min-width:700px){
 #match-ui .bottom{width:calc(340px * var(--hud-scale))}
 #match-ui #jump{bottom:calc(24px * var(--hud-scale) + var(--hud-inset-y) + env(safe-area-inset-bottom) / var(--ui-scale))}
 #match-ui #max-arm{bottom:calc(96px * var(--hud-scale) + var(--hud-inset-y) + env(safe-area-inset-bottom) / var(--ui-scale))}
 #stick-rest{bottom:calc(24px * var(--hud-scale) + var(--hud-inset-y) + env(safe-area-inset-bottom) / var(--ui-scale))}
 #ui-stage #match-settings{width:min(calc(600px * var(--hud-scale)),calc(var(--ui-width) - 24px * var(--hud-scale)))}
 #match-settings-content{display:grid;grid-template-columns:1fr 1fr;column-gap:calc(20px * var(--hud-scale));row-gap:calc(4px * var(--hud-scale))}
 #match-settings .dialog-head,#match-online-note{grid-column:1/-1;margin:0 0 calc(4px * var(--hud-scale))}
 #match-settings-content .secondary{margin-top:0}
}

/* Keep the application and its dialogs still when mobile browser chrome moves. */
html,body,button{touch-action:manipulation}
html,body{overscroll-behavior:none;-webkit-text-size-adjust:100%;text-size-adjust:100%}
#game,.fullscreen-fallback #game{position:fixed;inset:0 auto auto 0;width:var(--app-width,100vw);height:100vh;height:var(--app-height,100svh);overscroll-behavior:none}
canvas{touch-action:none}
/* Include dynamically created gift fields and counteract the uniform stage shrink. */
#game input,#game select,#game textarea{font-size:max(16px,calc(16px * var(--hud-scale,1)))}
#avatar-mini{padding:0;min-width:calc(44px * var(--hud-scale,1));min-height:calc(44px * var(--hud-scale,1));transition:transform .16s ease,box-shadow .16s ease}
#avatar-mini:hover{transform:translateY(-2px);box-shadow:0 6px 0 var(--ink)}
#avatar-mini:active{transform:translateY(2px);box-shadow:0 2px 0 var(--ink)}
#avatar-mini:focus-visible{outline:3px solid #0768ae;outline-offset:4px;box-shadow:0 0 0 7px #fff}
#avatar-mini canvas{pointer-events:none}
#match-settings .dialog-head{grid-column:1/-1;min-width:0}
#match-settings .dialog-head h2{margin:0}
#match-settings .dialog-head>button{min-width:calc(44px * var(--hud-scale))}
#match-settings[data-mode=match] .dialog-head{margin-bottom:calc(12px * var(--hud-scale))}
@media(prefers-reduced-motion:reduce){#avatar-mini{transition:none}}
#match-countdown{position:absolute;inset:0;display:grid;place-items:center;z-index:32;pointer-events:none;font-family:"M PLUS Rounded 1c",sans-serif;font-weight:900;font-size:clamp(88px,24vmin,210px);line-height:1;color:#fff5ce;-webkit-text-stroke:3px #15264b;text-shadow:0 7px 0 #15264b,0 12px 30px #634ac866}
#match-countdown[hidden]{display:none}
#match-ui.counting #match-countdown{bottom:25%}
#match-ui.counting #rule-banner{top:auto;bottom:calc(76px * var(--hud-scale) + var(--hud-inset-y) + env(safe-area-inset-bottom) / var(--ui-scale));max-height:30%;font-size:clamp(14px,1.8cqw,16px);line-height:1.35;padding:10px}
#match-ui.counting #theme-roulette{visibility:hidden}

#match-ui.counting #rule-banner{pointer-events:none}
#match-settings input[type=checkbox]{width:20px;height:20px;flex:0 0 20px;margin:0}
