/* A game occupies the screen; only the world and optional panels scroll. */
body.game-active { height:100dvh; overflow:hidden; padding:0; display:flex; flex-direction:column; }
.game-active .masthead { height:44px; min-height:44px; width:100%; max-width:none; padding:0 16px; }
.game-active .wordmark { font-size:16px; }
.game-active #app.game-shell { flex:1; min-height:0; width:100%; max-width:none; margin:0; padding:8px 12px max(8px,env(safe-area-inset-bottom)); display:grid; grid-template-rows:auto auto minmax(0,1fr) auto; gap:8px; }
.game-shell [hidden] { display:none!important; }
.game-shell .game-top { margin:0; display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:4px 12px; }
.game-shell .game-top h1 { font-size:18px; margin:0; }
.game-shell .week-label { display:none; }
.game-shell .deadline { font-size:12px; padding:4px 8px; }
.game-shell .shell-turn { font-size:13px; font-weight:650; color:var(--accent); }
.game-shell .scoreboard { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); margin:0; gap:8px; }
.game-shell .score-player { padding:8px 10px; min-width:0; border-radius:8px; }
.game-shell .score-player.self { border-bottom:3px solid var(--accent); }
.game-shell .player-title { gap:5px; margin:0 0 4px; flex-wrap:nowrap; }
.game-shell .player-title strong { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:13px; min-width:0; }
.game-shell .player-title .portrait-seat { width:26px; height:26px; min-width:26px; flex-basis:26px; }
.game-shell .you { font-size:10px; }
.game-shell .stats { gap:4px; }
.game-shell .stats dt { font-size:10px; }
.game-shell .stats dd { font-size:15px; }
.game-shell .quarter { display:none; }
.game-shell .game-layout { display:grid; grid-template-columns:minmax(0,1fr) 312px; min-height:0; gap:10px; align-items:stretch; }
.game-shell .shell-map { display:flex; flex-direction:column; min-width:0; min-height:0; grid-row:auto; position:relative; }
.game-shell .board-tools { flex:none; display:flex; gap:6px; margin:0 0 6px; flex-wrap:wrap; }
.game-shell .board-tools button { padding:6px 8px; min-height:36px; font-size:12px; }
.game-shell #map-viewport { flex:1; min-height:0; height:auto; max-height:none; width:100%; padding:0; touch-action:pan-x pan-y pinch-zoom; overscroll-behavior:contain; }
.game-shell .dice-result { position:absolute; top:48px; left:12px; z-index:1; margin:0; padding:5px 8px; background:var(--surface); border-radius:8px; pointer-events:none; font-size:11px; }
.game-shell .die { width:24px; height:24px; }
.game-shell .sidebar { display:flex; flex-direction:column; min-height:0; gap:0; grid-row:auto; }
.game-shell .shell-action { overflow:auto; overscroll-behavior:contain; min-height:0; margin:0; padding:16px; max-height:100%; }
.game-shell .shell-action h2 { font-size:17px; margin:0 0 8px; }
.game-shell .shell-action p { font-size:13px; margin:8px 0; }
.game-shell .shell-action button { white-space:normal; overflow-wrap:anywhere; }
.game-shell .shell-nav { display:grid; position:static; min-height:44px; grid-template-columns:repeat(4,minmax(0,1fr)); gap:8px; padding:0; border:0; background:transparent; }
.game-shell .shell-nav button { min-width:0; font-size:13px; padding:8px 4px; }
.game-shell [data-shell-open][aria-expanded="true"] { background:var(--accent); color:var(--accent-text); }
.game-shell .shell-drawer { position:fixed; z-index:5; top:52px; right:12px; bottom:calc(64px + env(safe-area-inset-bottom)); width:min(480px,calc(100vw - 24px)); display:flex; flex-direction:column; background:var(--surface); border:1px solid var(--line); border-radius:12px; box-shadow:0 12px 48px #132b4a40; overflow:hidden; padding:0; }
.game-shell .shell-drawer > header { display:flex; flex:none; justify-content:space-between; align-items:center; gap:8px; padding:10px 14px; border-bottom:1px solid var(--line); }
.game-shell .shell-drawer > header h2 { font-size:17px; margin:0; }
.game-shell .shell-drawer-body { overflow:auto; overscroll-behavior:contain; padding:12px; min-height:0; }
.game-shell .shell-drawer .paper { margin:0 0 12px; padding:14px; }
.game-shell .shell-drawer .turn-guide,.game-shell .shell-drawer .month-panel,.game-shell .shell-drawer .map-overview { display:block; margin:0 0 12px; }
.game-shell .shell-drawer .region-nav { flex-wrap:wrap; }
.game-shell .shell-drawer .map-overview { padding:10px; }
.game-shell .shell-drawer [data-shell-group="settings"] > button,.game-shell .shell-drawer [data-shell-group="settings"] > a { margin:4px; }
.game-active #error { z-index:8; bottom:calc(72px + env(safe-area-inset-bottom)); }
.game-shell .character-banter { position:absolute; pointer-events:none; left:24px; bottom:76px; z-index:2; max-width:min(480px,calc(100vw - 48px)); max-height:100px; overflow:hidden; margin:0; font-size:13px; }
@media(max-width:767px), (max-width:1024px) and (max-height:500px) {
  .game-active .masthead { height:calc(36px + env(safe-area-inset-top)); min-height:calc(36px + env(safe-area-inset-top)); padding:env(safe-area-inset-top) max(10px,env(safe-area-inset-right)) 0 max(10px,env(safe-area-inset-left)); }
  .game-active .wordmark { font-size:14px; }
  .game-active .masthead #connection { font-size:11px; }
  .game-active #app.game-shell { padding:5px max(6px,env(safe-area-inset-right)) max(5px,env(safe-area-inset-bottom)) max(6px,env(safe-area-inset-left)); gap:5px; }
  .game-shell .game-top h1 { font-size:15px; }
  .game-shell .shell-turn { order:3; width:100%; font-size:12px; }
  .game-shell .scoreboard { grid-template-columns:repeat(4,minmax(0,1fr)); gap:3px; }
  .game-shell .score-player { padding:5px; border-radius:5px; }
  .game-shell .player-title { gap:3px; margin-bottom:3px; }
  .game-shell .player-title strong { font-size:11px; }
  .game-shell .score-player.self .player-title strong::before { content:'你·'; color:var(--accent); }
  .game-shell .player-title .portrait-seat { width:20px; height:20px; min-width:20px; flex-basis:20px; }
  .game-shell .you,.game-shell .bot-badge { display:none; }
  .game-shell .stats { display:flex; flex-direction:column; gap:1px; }
  .game-shell .stats > div { display:flex; align-items:baseline; justify-content:space-between; gap:2px; }
  .game-shell .stats dt { font-size:9px; }
  .game-shell .stats dd { font-size:12px; margin:0; }
  .game-shell .game-layout { grid-template-columns:minmax(0,1fr); grid-template-rows:minmax(100px,1fr) auto; gap:5px; }
  .game-shell .game-layout > .sidebar { display:flex; grid-row:2; max-height:min(30dvh,220px); }
  .game-shell .game-layout > .shell-map { grid-row:1; }
  .game-shell .shell-action { padding:8px 10px; }
  .game-shell .shell-action h2 { font-size:14px; margin-bottom:4px; }
  .game-shell .shell-action p { font-size:12px; margin:4px 0; }
  .game-shell .shell-action .action-list { gap:5px; }
  .game-shell .shell-action button { padding:7px 10px; font-size:13px; }
  #app.game-shell .board-tools { display:flex; gap:3px; flex-wrap:nowrap; }
  .game-shell .board-tools button { flex:1; min-width:0; min-height:44px; padding:4px 2px; font-size:10px; white-space:normal; }
  .game-shell .shell-nav { gap:3px; background:var(--surface); }
  .game-shell .shell-nav button { font-size:11px; min-height:44px; }
  .game-shell .shell-drawer { top:calc(42px + env(safe-area-inset-top)); left:max(6px,env(safe-area-inset-left)); right:max(6px,env(safe-area-inset-right)); width:auto; bottom:calc(76px + env(safe-area-inset-bottom)); }
  .game-shell .character-banter { left:14px; bottom:calc(30dvh + 65px); padding:6px 10px; max-height:70px; font-size:11px; }
}
@media(max-width:1024px) and (max-height:500px) and (orientation:landscape) {
  .game-active #app.game-shell { grid-template-rows:auto auto minmax(0,1fr) auto; }
  .game-shell .score-player:not(.self) { display:none; }
  .game-shell .score-player.self { grid-column:1/-1; display:flex; align-items:center; gap:16px; padding:3px 8px; }
  .game-shell .score-player.self .player-title { max-width:180px; margin:0; }
  .game-shell .score-player.self .stats { flex-direction:row; gap:16px; }
  .game-shell .score-player.self .stats > div { gap:5px; }
  .game-shell .game-top .shell-turn { order:0; width:auto; }
  .game-shell .game-layout { grid-template-columns:minmax(0,1fr) 280px; grid-template-rows:minmax(0,1fr); }
  .game-shell .game-layout > .sidebar { grid-row:1; max-height:none; }
  .game-shell .shell-nav button { min-height:44px; }
}
