/* GM Warfare 9.24.59: device-adaptive shell.
   Phone: intentionally unchanged. Tablet portrait: full-width touch layout.
   Tablet landscape, Steam Deck and desktop: full-viewport game with side navigation.
   Respond to available viewport, not a brittle browser user-agent string. */

/* iPad portrait, tablet split-view when wide enough, and desktop-sized windows. */
@media (min-width: 700px) and (min-height: 600px) {
  #app { width:100%; max-width:none; margin:0; }
  .shell-active > .game-header { padding-inline:clamp(22px,3vw,52px); }
  .shell-active > #main {
    width:100%; padding:24px clamp(22px,3.25vw,54px) calc(74px + env(safe-area-inset-bottom,0px));
  }
  .shell-active > .bottom-nav, .shell-draft > .bottom-nav { max-width:none; }
  .shell-landing > .start-screen, .shell-draft > .start-screen {
    padding:26px clamp(24px,4vw,54px);
  }
  .shell-landing .arcade-frame, .shell-draft .arcade-frame {
    width:min(800px,100%); padding:26px clamp(22px,3vw,36px);
  }
  .shell-draft .draft-list { height:min(51dvh,560px); }
  .shell-active > .music-bar, .shell-draft > .music-bar { right:18px; }
  .dialog { width:min(680px,calc(100% - 28px)); padding:22px; }
  .picker-dialog { width:min(740px,calc(100% - 28px)); }
}

/* Full-width landscape cockpit on iPad, Steam Deck (1280x800), and computers.
   Navigation lives in a dedicated rail; only the content pane scrolls. */
@media (min-width: 960px) and (min-height: 600px) and (orientation: landscape) {
  #app.shell-active, #app.shell-draft {
    --device-nav-width:clamp(174px,15.5vw,214px);
    display:grid;
    grid-template-columns:var(--device-nav-width) minmax(0,1fr);
    grid-template-rows:auto minmax(0,1fr);
    grid-template-areas:"header header" "nav content";
    width:100%; height:100%; max-width:none;
    min-height:0; overflow:hidden;
  }
  #app.shell-draft {
    grid-template-rows:minmax(0,1fr);
    grid-template-areas:"nav content";
  }
  .shell-active > .game-header {
    grid-area:header; min-width:0; min-height:72px;
    padding:10px clamp(18px,2.7vw,40px);
  }
  .shell-active > #main, .shell-draft > .start-screen {
    grid-area:content; min-width:0; min-height:0;
    width:100%; height:100%; max-height:100%; overflow-y:auto; overflow-x:hidden;
    overscroll-behavior:contain;
  }
  .shell-active > #main {
    padding:24px clamp(22px,3vw,52px) 68px;
    scroll-padding-bottom:60px;
  }
  .shell-active > .bottom-nav, .shell-draft > .bottom-nav {
    grid-area:nav; position:relative; inset:auto; transform:none;
    min-width:0; width:100%; max-width:none; height:100%; min-height:0;
    padding:17px 10px 84px; margin:0;
    border:0; border-right:3px solid #59687c;
    background:linear-gradient(180deg,#16283f,#0d1728);
    box-shadow:inset -3px 0 0 #0b1522;
    display:flex; flex-direction:column; justify-content:flex-start; align-items:stretch; gap:7px;
    overflow-y:auto; overflow-x:hidden;
    overscroll-behavior:contain;
  }
  .shell-active > .bottom-nav .nav-item,
  .shell-draft > .bottom-nav .nav-item {
    width:100%; min-height:59px; flex:0 0 auto;
    display:flex; flex-direction:row; justify-content:flex-start; align-items:center;
    gap:10px; padding:9px 11px; border:2px solid transparent;
    background:#1a2c43; color:#c6d2de;
    font:900 12px/1.2 ui-monospace,monospace; text-align:left;
  }
  .shell-active > .bottom-nav .nav-item .nav-symbol,
  .shell-draft > .bottom-nav .nav-item .nav-symbol {
    width:31px; flex:0 0 31px; font-size:23px; text-align:center;
  }
  .shell-active > .bottom-nav .nav-item.selected,
  .shell-draft > .bottom-nav .nav-item.selected {
    color:#ffe4a4; background:#30425b;
    border-color:#8e7850; border-left:4px solid var(--accent);
  }
  .shell-active > .bottom-nav .nav-item:focus-visible,
  .shell-draft > .bottom-nav .nav-item:focus-visible {
    outline:3px solid #f7d58c; outline-offset:-2px;
  }
  .shell-active > .music-bar, .shell-draft > .music-bar {
    position:absolute; left:11px; right:auto; bottom:11px;
    width:calc(var(--device-nav-width) - 25px); max-width:calc(100vw - 24px);
  }
  .shell-active > .music-bar.music-open,
  .shell-draft > .music-bar.music-open {
    width:min(312px,calc(100vw - 24px));
  }
  .shell-active > .music-bar .music-dock,
  .shell-draft > .music-bar .music-dock { min-width:0; }
  .shell-active > .music-bar .music-dock button,
  .shell-draft > .music-bar .music-dock button { font-size:10px; }
  .shell-active > .music-bar.music-open .music-content,
  .shell-draft > .music-bar.music-open .music-content {
    max-height:min(390px,calc(100dvh - 120px)); overflow-y:auto;
  }
  /* A larger content area is useful without inflating every card to monitor width. */
  .shell-active .match-stack { grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; }
  .shell-active .match-card { min-height:132px; }
  .shell-active .action-stack { grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; }
  .shell-active .wrestler-list { grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
  .shell-active .more-menu { grid-template-columns:repeat(3,minmax(0,1fr)); }
  .shell-active .page-heading { margin-bottom:22px; }
  .shell-active .show-logo-line .show-logo { width:min(360px,100%); }
  .shell-landing .arcade-frame, .shell-draft .arcade-frame { width:min(940px,100%); }
  .shell-landing > .start-screen, .shell-draft > .start-screen {
    padding:24px clamp(28px,4vw,62px);
  }
  .shell-landing .start-step[data-start-step="1"]:not([hidden]) {
    display:grid; grid-template-columns:minmax(0,0.98fr) minmax(0,1.02fr);
    grid-template-areas:"lead lead" "brand roster" "gm roster" "continue continue";
    align-items:start; gap:8px 22px;
  }
  .shell-landing .start-step[data-start-step="1"] > .eyebrow { grid-area:lead; }
  .shell-landing .start-step[data-start-step="1"] > .start-section:nth-of-type(1) { grid-area:brand; }
  .shell-landing .start-step[data-start-step="1"] > .start-section:nth-of-type(2) { grid-area:roster; }
  .shell-landing .start-step[data-start-step="1"] > .start-section:nth-of-type(3) { grid-area:gm; }
  .shell-landing .start-step[data-start-step="1"] > [data-start-next] { grid-area:continue; }
  .shell-landing .start-step[data-start-step="2"] > .start-section:first-of-type {
    display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px 20px;
  }
  .shell-landing .start-step[data-start-step="2"] > .start-section:first-of-type > .eyebrow,
  .shell-landing .start-step[data-start-step="2"] > .start-section:first-of-type > p { grid-column:1/-1; }
  .shell-draft .arcade-frame { text-align:left; }
  .shell-draft .draft-list { height:min(55dvh,560px); }
  .display-fullscreen { display:none; }
  .fullscreen-capable .display-fullscreen {
    display:inline-flex; align-items:center; gap:6px; justify-content:center;
    min-height:44px; padding:8px 12px;
    border:2px solid #556e86; background:#1c3048; color:#e2e7ee;
    white-space:nowrap; font:900 10px ui-monospace,monospace;
  }
}

/* On all other viewports fullscreen is not an extra, distracting control. */
.display-fullscreen { display:none; }
@media (min-width: 960px) and (min-height: 600px) and (orientation: landscape) {
  .fullscreen-capable .display-fullscreen { display:inline-flex; }
}

/* More columns only when there is sufficient actual content width. */
@media (min-width: 1450px) and (min-height: 650px) and (orientation: landscape) {
  .shell-active .match-stack { grid-template-columns:repeat(3,minmax(0,1fr)); }
  .shell-active .wrestler-list { grid-template-columns:repeat(3,minmax(0,1fr)); }
  .shell-active > #main { padding-inline:clamp(40px,4vw,76px); }
}

/* Keep the narrow music dock readable in the landscape navigation rail. */
@media (min-width: 960px) and (min-height: 600px) and (orientation: landscape) {
  .shell-active > .music-bar .music-toggle,
  .shell-draft > .music-bar .music-toggle {
    min-width:0; padding:5px 6px; font-size:10px; white-space:nowrap;
  }
  .shell-active > .music-bar .music-toggle > span,
  .shell-draft > .music-bar .music-toggle > span { white-space:nowrap; }
  .shell-active > .music-bar .music-quick-play,
  .shell-draft > .music-bar .music-quick-play {
    min-width:61px; padding:5px 4px; font-size:10px; white-space:nowrap;
  }
}
