/* The menu and desktop arena share one visible viewport; cards never push
   confirmation controls off screen. Mobile combat retains its touch layout. */
.wordmark .brand-icon{flex-shrink:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:0;line-height:1}
.wordmark .brand-icon>span{font-size:8px;letter-spacing:-.3px}
.wordmark .brand-icon>b{font-size:17px;color:#172010;line-height:1}
.wordmark>span:last-child{white-space:nowrap}
body[data-scene]{height:var(--game-height,100dvh);min-height:0;overflow:hidden}
body[data-scene="menu"] .app-shell,
body[data-scene="match"][data-touch-mode="false"] .app-shell{position:fixed;top:var(--game-top,0px);left:var(--game-left,0px);width:var(--game-width,100vw);height:var(--game-height,100dvh);max-width:none;margin:0;padding:max(8px,env(safe-area-inset-top)) max(16px,env(safe-area-inset-right)) max(8px,env(safe-area-inset-bottom)) max(16px,env(safe-area-inset-left));display:grid;grid-template-rows:52px minmax(0,1fr);gap:10px}
body[data-scene="menu"] .site-header,
body[data-scene="match"][data-touch-mode="false"] .site-header{height:100%;width:100%;max-width:1420px;justify-self:center}
body[data-scene="menu"] main,
body[data-scene="match"][data-touch-mode="false"] main{min-height:0;width:100%;max-width:1420px;justify-self:center}

#menu-screen{height:100%;min-height:0;display:grid;grid-template-rows:minmax(0,1fr) 28px;gap:8px}
#menu-screen .menu-intro,#menu-screen>footer{display:none}
#menu-screen .setup-panel{position:relative;min-height:0;display:grid;grid-template-rows:36px 56px minmax(0,1fr) 72px;box-shadow:0 14px 50px #0002}
#menu-screen .setup-steps{grid-row:1}
#menu-screen .setup-steps li{height:100%;font-size:8px;letter-spacing:1.1px;gap:8px}
#menu-screen .setup-steps li>span{font-size:17px}
#menu-screen .selection-heading{grid-row:2;min-height:0;padding:9px 16px;align-items:center;gap:14px}
#menu-screen .selection-heading .eyebrow{font-size:6px;letter-spacing:1.3px;margin:0 0 4px}
#menu-screen .selection-heading h2{font-size:27px;line-height:1}
#menu-screen .selection-heading>span{font-size:9px;max-width:48%;line-height:1.3}
#menu-screen .loading-note{position:absolute;z-index:3;top:48%;left:50%;transform:translate(-50%,-50%);margin:0;padding:12px 18px;background:#101a10f5;border:1px solid #8bb75966;border-radius:6px;white-space:nowrap}

#menu-screen .fighter-grid{grid-row:3;min-height:0;grid-template-columns:repeat(3,minmax(0,1fr));grid-template-rows:repeat(3,minmax(0,1fr));gap:10px;padding:0 16px 12px}
#menu-screen .fighter-card{min-height:0;min-width:0;display:grid;grid-template-rows:minmax(0,1fr) 42px;isolation:isolate}
#menu-screen .fighter-card:not(:disabled):hover{transform:none}
#menu-screen .fighter-card.selected{box-shadow:inset 0 0 0 2px var(--lime),0 0 20px #c8f36b10}
#menu-screen .portrait-scene{height:auto;min-height:0;overflow:hidden}
#menu-screen .portrait-scene canvas{height:170%;width:auto;max-width:none;left:50%;bottom:-70%;transform:translateX(-50%)}
#menu-screen .card-number{left:9px;top:4px;font-size:clamp(34px,5vh,62px);pointer-events:none}
#menu-screen .pick-badge{top:7px;right:7px;padding:4px 6px;font-size:6px;letter-spacing:.4px;opacity:0}
#menu-screen .selected .pick-badge{opacity:1}
#menu-screen .player-picked:before{content:'P1';position:absolute;z-index:2;left:7px;top:7px;padding:4px 6px;font-size:7px;font-weight:800;letter-spacing:.5px;background:#c8f36b;color:#203313;border-radius:2px}
#menu-screen .fighter-card-copy{display:flex;align-items:center;justify-content:space-between;min-height:0;padding:5px 10px;gap:6px}
#menu-screen .fighter-card-copy>div{min-width:0}
#menu-screen .fighter-card-copy small{display:none}
#menu-screen .fighter-card-copy strong{display:block;font-size:clamp(16px,1.8vw,24px);line-height:1.05;letter-spacing:.35px}
#menu-screen .fighter-card-copy>span{display:block;flex-shrink:0;font-size:0;line-height:1;margin:0;white-space:nowrap}
#menu-screen .fighter-card-copy>span br{display:none}
#menu-screen .fighter-card-copy b{font-size:10px;margin:0}

#menu-screen .menu-actions{grid-row:4;display:flex;flex-wrap:nowrap;gap:14px;padding:10px 16px;background:#202c19;min-width:0}
#menu-screen #menu-hint{display:none}
#menu-screen #menu-back{flex-shrink:0;min-width:64px;min-height:40px;font-size:9px}
.menu-pick{min-width:0;flex:1;display:flex;flex-direction:column;gap:3px}
.menu-pick>span{font-size:6px;font-weight:700;letter-spacing:1.3px;color:#96ad80}
.menu-pick>strong{font-family:var(--display);font-size:25px;font-weight:800;line-height:1;letter-spacing:.5px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--choice-accent,var(--lime))}
.menu-pick>small{font-size:8px;letter-spacing:.5px;color:#b6c7a5;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#menu-screen .menu-actions>.lime-button{flex-shrink:0;min-height:42px;min-width:160px;gap:18px;padding:9px 16px;font-size:10px}
#menu-screen .menu-actions>.fight-button{font-family:var(--display);font-size:25px;min-width:170px}
#menu-screen .control-settings{display:flex;align-items:center;gap:14px;min-height:0;margin:0;padding:0 3px;border:0;background:none;box-shadow:none}
#menu-screen .control-settings>div{flex:1;min-width:0;display:flex;flex-direction:row;gap:12px;align-items:center}
#menu-screen .control-settings>div strong{font-size:8px;letter-spacing:.7px;white-space:nowrap}
#menu-screen .control-settings>div span{font-size:7px;line-height:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#menu-screen .control-settings>.outline-button{font-size:7px;line-height:1;min-height:25px;padding:5px 11px;max-width:none;flex-shrink:0}
#menu-screen .privacy-link{font-size:7px;min-height:25px;display:flex;align-items:center;white-space:nowrap;padding:5px}

#difficulty-panel{grid-row:3;min-height:0;display:grid;grid-template-rows:minmax(0,1fr) minmax(70px,.65fr) 16px;gap:10px;padding:0 16px 10px}
#menu-screen .versus-preview{min-height:0;height:100%;align-items:stretch;justify-content:center;gap:clamp(16px,5vw,80px);padding:0}
#menu-screen .versus-preview>div{height:100%;min-height:0;min-width:0;max-width:280px;flex:1;display:grid;grid-template-rows:minmax(0,1fr) auto auto;justify-items:center;gap:3px}
#menu-screen .versus-preview canvas{height:100%;width:auto;max-width:100%;max-height:240px;min-height:0;object-fit:contain;align-self:end}
#menu-screen .versus-preview span{font-size:7px;letter-spacing:1px;margin:0}
#menu-screen .versus-preview strong{font-size:23px;line-height:1.05;margin:0;text-align:center}
#menu-screen .versus-mark{align-self:center;font-size:40px}
#menu-screen .difficulty-grid{min-height:0;height:100%;padding:0;gap:10px;grid-template-columns:repeat(3,minmax(0,1fr))}
#menu-screen .difficulty-card{min-height:0;padding:12px;display:flex;flex-direction:column;justify-content:center}
#menu-screen .difficulty-card>span{font-size:7px}
#menu-screen .difficulty-card strong{font-size:clamp(23px,4vh,36px);line-height:1;margin:8px 0}
#menu-screen .difficulty-card small{font-size:10px;line-height:1.4}
#menu-screen .match-rules{padding:0;gap:12px;min-width:0;font-size:7px;letter-spacing:.5px;line-height:1;white-space:nowrap}

/* Desktop combat also fits, including every keyboard/button control. */
body[data-scene="match"][data-touch-mode="false"] #match-screen{height:100%;min-height:0;display:grid;grid-template-rows:32px minmax(0,1fr);gap:8px}
body[data-scene="match"][data-touch-mode="false"] .match-topbar{min-height:0;padding:0;gap:10px}
body[data-scene="match"][data-touch-mode="false"] .match-topbar b{font-size:17px}
body[data-scene="match"][data-touch-mode="false"] .arena-shell{height:100%;min-height:0;display:grid;grid-template-rows:28px minmax(0,1fr) auto}
body[data-scene="match"][data-touch-mode="false"] .arena-topline{height:100%}
body[data-scene="match"][data-touch-mode="false"] .arena-viewport{min-height:0;height:100%;aspect-ratio:auto}
body[data-scene="match"][data-touch-mode="false"] #game{position:absolute;inset:0;width:100%;height:100%;object-fit:contain}
body[data-scene="match"][data-touch-mode="false"] .controls-hint{display:none}
body[data-scene="match"][data-touch-mode="false"] .controls-bar{display:flex;flex-wrap:nowrap;gap:10px;padding:8px 12px;min-height:0}
body[data-scene="match"][data-touch-mode="false"] .control-key{height:36px}
body[data-scene="match"][data-touch-mode="false"] .super-button{min-height:40px;min-width:220px;padding:5px 10px;gap:8px}
body[data-scene="match"][data-touch-mode="false"] .super-button strong{font-size:21px}

@media(orientation:portrait) and (max-width:700px){
  #menu-screen .fighter-grid{grid-template-columns:repeat(3,minmax(0,1fr));grid-template-rows:repeat(3,minmax(0,1fr));gap:7px}
  #menu-screen .fighter-card{grid-template-rows:minmax(0,1fr) 34px}
  #menu-screen .fighter-card-copy strong{font-size:13px}
  #menu-screen .fighter-card-copy>span{display:none}
  #menu-screen .fighter-card-copy b{font-size:8px}
  #menu-screen .selection-heading>span{font-size:7px;max-width:44%}
  #menu-screen .selection-heading h2{font-size:23px}
  #menu-screen .control-settings>div{display:none}
  #menu-screen .control-settings{justify-content:space-between}
  #menu-screen .menu-actions{gap:7px;padding:8px 10px}
  #menu-screen #menu-back{min-width:44px;font-size:8px}
  #menu-screen .menu-actions>.lime-button{min-width:125px;font-size:8px;gap:8px;padding:9px}
  #menu-screen .menu-actions>.fight-button{font-size:23px}
  .menu-pick>strong{font-size:20px}
  .menu-pick>small{font-size:7px}
  #menu-screen .match-rules{font-size:5px;gap:6px;letter-spacing:0}
  #menu-screen .versus-preview strong{font-size:20px}
  #menu-screen .difficulty-card{padding:9px}
  #menu-screen .difficulty-card small{font-size:9px}
}

@media(max-width:650px){
  body[data-scene="menu"] .wordmark,body[data-scene="match"][data-touch-mode="false"] .wordmark{font-size:19px;gap:7px}
  body[data-scene="menu"] .brand-icon,body[data-scene="match"][data-touch-mode="false"] .brand-icon{width:26px;height:29px;font-size:15px}
  body[data-scene="menu"] .header-tag,body[data-scene="match"][data-touch-mode="false"] .header-tag{display:none}
  body[data-scene="menu"] .audio-controls,body[data-scene="match"][data-touch-mode="false"] .audio-controls{gap:5px}
  body[data-scene="menu"] .audio-controls .small-button,body[data-scene="match"][data-touch-mode="false"] .audio-controls .small-button{height:28px;padding:0 7px;font-size:6px;letter-spacing:.3px}
  #menu-screen .fighter-card-copy{padding:5px 7px;gap:3px}
}

@media(max-height:650px){
  body[data-scene="menu"] .app-shell,body[data-scene="match"][data-touch-mode="false"] .app-shell{grid-template-rows:38px minmax(0,1fr);padding:max(5px,env(safe-area-inset-top)) max(10px,env(safe-area-inset-right)) max(5px,env(safe-area-inset-bottom)) max(10px,env(safe-area-inset-left));gap:6px}
  #menu-screen{grid-template-rows:minmax(0,1fr) 24px;gap:5px}
  #menu-screen .setup-panel{grid-template-rows:30px 42px minmax(0,1fr) 60px}
  #menu-screen .setup-steps li{font-size:7px;gap:5px}
  #menu-screen .selection-heading{padding:5px 12px}
  #menu-screen .selection-heading h2{font-size:23px}
  #menu-screen .fighter-grid{padding:0 12px 8px;gap:7px}
  #menu-screen .fighter-card{grid-template-rows:minmax(0,1fr) 32px}
  #menu-screen .fighter-card-copy strong{font-size:16px}
  #menu-screen .fighter-card-copy b{font-size:8px}
  #menu-screen .menu-actions{padding:7px 12px;gap:10px}
  #menu-screen .menu-actions>.lime-button{min-height:36px;min-width:140px;font-size:9px;padding:7px 12px;gap:10px}
  .menu-pick>strong{font-size:22px}
}

@media(orientation:landscape) and (max-height:480px){
  #menu-screen .fighter-grid{grid-template-columns:repeat(5,minmax(0,1fr));grid-template-rows:repeat(2,minmax(0,1fr))}
  body[data-scene="menu"] .app-shell{grid-template-rows:32px minmax(0,1fr);gap:4px}
  body[data-scene="menu"] .site-header .wordmark{font-size:19px}
  body[data-scene="menu"] .site-header .brand-icon{height:26px;width:25px;font-size:14px}
  body[data-scene="menu"] .site-header .small-button{height:25px;font-size:6px;padding:0 8px}
  body[data-scene="menu"] .site-header .header-tag{font-size:6px}
  #menu-screen{grid-template-rows:minmax(0,1fr) 20px;gap:4px}
  #menu-screen .setup-panel{grid-template-rows:26px 33px minmax(0,1fr) 48px}
  #menu-screen .setup-steps li{font-size:6px;letter-spacing:.5px}
  #menu-screen .setup-steps li>span{font-size:13px}
  #menu-screen .selection-heading{padding:4px 10px}
  #menu-screen .selection-heading .eyebrow{display:none}
  #menu-screen .selection-heading h2{font-size:20px}
  #menu-screen .selection-heading>span{font-size:7px}
  #menu-screen .fighter-grid{gap:6px;padding:0 10px 7px}
  #menu-screen .fighter-card{grid-template-rows:minmax(0,1fr) 26px}
  #menu-screen .fighter-card-copy strong{font-size:12px}
  #menu-screen .fighter-card-copy>span{display:none}
  #menu-screen .fighter-card-copy b{font-size:7px}
  #menu-screen .pick-badge{font-size:5px;top:4px;right:4px;padding:3px}
  #menu-screen .menu-actions{gap:10px;padding:5px 10px}
  #menu-screen #menu-back{min-height:32px;min-width:54px;font-size:8px}
  #menu-screen .menu-actions>.lime-button{min-height:33px;min-width:137px;gap:10px;padding:6px 12px;font-size:8px}
  #menu-screen .menu-actions>.fight-button{font-size:22px}
  .menu-pick{gap:2px}.menu-pick>span{font-size:5px;letter-spacing:1px}.menu-pick>strong{font-size:19px}.menu-pick>small{font-size:6px}
  #menu-screen .control-settings>div strong{font-size:6px}
  #menu-screen .control-settings>div span{font-size:6px}
  #menu-screen .control-settings>.outline-button,#menu-screen .privacy-link{min-height:20px;font-size:6px;padding:3px 7px}
  #difficulty-panel{grid-template-rows:minmax(0,1fr) 64px 10px;gap:5px;padding:0 10px 6px}
  #menu-screen .versus-preview{gap:25px}
  #menu-screen .versus-preview>div{grid-template-columns:minmax(0,1fr) auto;grid-template-rows:1fr 1fr;align-items:center;justify-items:start;max-width:240px;column-gap:8px}
  #menu-screen .versus-preview canvas{grid-row:1 / span 2;max-height:110px;justify-self:center}
  #menu-screen .versus-preview span{font-size:6px;align-self:end}
  #menu-screen .versus-preview strong{font-size:18px;text-align:left;align-self:start}
  #menu-screen .versus-mark{font-size:27px}
  #menu-screen .difficulty-grid{gap:7px}
  #menu-screen .difficulty-card{padding:7px 10px}
  #menu-screen .difficulty-card>span{display:none}
  #menu-screen .difficulty-card strong{font-size:22px;margin:0 0 3px}
  #menu-screen .difficulty-card small{font-size:8px;line-height:1.2}
  #menu-screen .match-rules{font-size:5px;gap:8px}
}

@media(max-width:800px){
  body[data-scene="match"][data-touch-mode="false"] .controls-bar{display:grid;grid-template-columns:1fr auto;gap:5px;padding:6px 9px}
  body[data-scene="match"][data-touch-mode="false"] .movement-controls{grid-column:1;grid-row:1;justify-content:start}
  body[data-scene="match"][data-touch-mode="false"] .attack-controls{grid-column:2;grid-row:1;margin:0}
  body[data-scene="match"][data-touch-mode="false"] .super-button{grid-column:1 / -1;grid-row:2;min-width:0;min-height:34px}
}

@media(orientation:landscape) and (max-height:500px){
  .controls-dialog{width:min(94vw,760px);max-height:94dvh;padding:15px 20px}
  .controls-dialog>.eyebrow,.controls-dialog>p:not(.binding-note){display:none}
  .controls-dialog h2{font-size:23px}
  .controls-dialog .binding-rows{grid-template-columns:repeat(4,minmax(0,1fr));gap:6px;margin:12px 0 8px}
  .controls-dialog .binding-rows>div{padding:5px 6px;gap:5px}
  .controls-dialog .binding-rows span{font-size:8px}
  .controls-dialog .binding-rows button{min-width:42px;min-height:34px;font-size:9px;padding:5px}
  .controls-dialog .binding-note{min-height:24px;font-size:8px;line-height:1.35;margin:5px 0}
  .controls-dialog .binding-actions{margin-top:8px;padding-top:8px}
  .controls-dialog .binding-actions>button{min-height:32px;padding:6px 12px;font-size:8px}
}

/* Browser toolbars can reduce the visible height before CSS viewport units
   settle. Use the measured viewport for this compact landscape layout. */
@media(orientation:landscape){
  body[data-scene="menu"][data-compact-controls="true"] .app-shell{grid-template-rows:24px minmax(0,1fr);padding:4px 8px;gap:2px}
  body[data-scene="menu"][data-compact-controls="true"] .site-header .wordmark{font-size:17px}
  body[data-scene="menu"][data-compact-controls="true"] .site-header .brand-icon{width:21px;height:21px;font-size:12px}
  body[data-scene="menu"][data-compact-controls="true"] .site-header .small-button{height:22px;font-size:6px}
  body[data-scene="menu"][data-compact-controls="true"] #menu-screen{grid-template-rows:minmax(0,1fr) 18px;gap:2px}
  body[data-scene="menu"][data-compact-controls="true"] #menu-screen .setup-panel{grid-template-rows:20px 24px minmax(0,1fr) 40px}
  body[data-scene="menu"][data-compact-controls="true"] #menu-screen .setup-steps li{font-size:5px}
  body[data-scene="menu"][data-compact-controls="true"] #menu-screen .selection-heading{padding:3px 8px}
  body[data-scene="menu"][data-compact-controls="true"] #menu-screen .selection-heading h2{font-size:17px}
  body[data-scene="menu"][data-compact-controls="true"] #menu-screen .fighter-grid{padding:0 8px 3px;gap:3px}
  body[data-scene="menu"][data-compact-controls="true"] #menu-screen .fighter-card{grid-template-rows:minmax(0,1fr) 22px}
  body[data-scene="menu"][data-compact-controls="true"] #menu-screen .fighter-card-copy strong{font-size:10.5px}
  body[data-scene="menu"][data-compact-controls="true"] #menu-screen .menu-actions{padding:4px 8px;gap:8px}
  body[data-scene="menu"][data-compact-controls="true"] #menu-screen .menu-actions>.lime-button{min-height:30px;min-width:125px;padding:4px 10px}
  body[data-scene="menu"][data-compact-controls="true"] #menu-screen .menu-pick>span{display:none}
  body[data-scene="menu"][data-compact-controls="true"] #menu-screen .menu-pick>strong{font-size:17px}
  body[data-scene="menu"][data-compact-controls="true"] #menu-screen #menu-back{min-height:30px}
  body[data-scene="menu"][data-compact-controls="true"] #menu-screen .control-settings>.outline-button,
  body[data-scene="menu"][data-compact-controls="true"] #menu-screen .privacy-link{min-height:18px;padding:2px 7px}
  body[data-scene="menu"][data-compact-controls="true"] #menu-screen #difficulty-panel{grid-template-rows:minmax(0,1fr) 48px 8px;gap:3px;padding:0 8px 4px}
  body[data-scene="menu"][data-compact-controls="true"] #menu-screen .difficulty-card strong{font-size:19px;margin:0 0 2px}
  body[data-scene="menu"][data-compact-controls="true"] #menu-screen .difficulty-card small{font-size:7px}
  body[data-scene="menu"][data-compact-controls="true"] #menu-screen .versus-preview strong{font-size:15px}
  body[data-compact-controls="true"] .controls-dialog{padding:9px 14px}
  body[data-compact-controls="true"] .controls-dialog h2{font-size:20px}
  body[data-compact-controls="true"] .controls-dialog .binding-rows{gap:4px;margin:7px 0 5px}
  body[data-compact-controls="true"] .controls-dialog .binding-rows>div{padding:3px 5px}
  body[data-compact-controls="true"] .controls-dialog .binding-rows span{font-size:7px}
  body[data-compact-controls="true"] .controls-dialog .binding-rows button{min-height:28px;padding:3px;font-size:8px}
  body[data-compact-controls="true"] .controls-dialog .binding-note{min-height:18px;margin:4px 0;font-size:7px}
  body[data-compact-controls="true"] .controls-dialog .binding-actions{margin-top:5px;padding-top:5px}
  body[data-compact-controls="true"] .controls-dialog .binding-actions>button{min-height:28px;padding:4px 9px;font-size:7px}
}
.controls-dialog{position:fixed;inset:auto;top:calc(var(--game-top,0px) + var(--game-height,100dvh) / 2);left:calc(var(--game-left,0px) + var(--game-width,100vw) / 2);transform:translate(-50%,-50%);margin:0;max-height:calc(var(--game-height,100dvh) - 16px)}
