/* AI PLAY CLUB 站点壳避让与大厅默认静音开关（独立样式，不影响 standalone 布局基线） */

html, body, #game {
  max-width: 100%;
  overflow: hidden;
}

/* 大厅可见声音开关（默认关闭，点击后才创建 AudioContext 与加载配乐配音） */
#lobby-mute {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  left: max(14px, env(safe-area-inset-left));
  z-index: 4;
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  min-width: 92px;
  padding: 6px 13px 6px 10px;
  border: 2px solid #201826;
  border-radius: 22px;
  background: #fff5d9eb;
  color: #261c28;
  font: 800 13px/1 var(--body, -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif);
  letter-spacing: 0.02em;
  box-shadow: 2px 2px 0 #201826;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease, color 0.12s ease;
}
#lobby-mute:hover {
  transform: translateY(-1px);
  background: #fffae8;
}
#lobby-mute:active {
  transform: translateY(1px);
}
#lobby-mute:focus-visible {
  outline: 3px solid #f5c148;
  outline-offset: 2px;
}
#lobby-mute svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}
#lobby-mute[aria-pressed="false"] {
  background: #b84433f2;
  color: #fff6dd;
  border-color: #201826;
}

/* 宽屏与横屏：站点导航条固定在顶部居中空天区，顶部 HUD 状态胶囊整体下移避让 */
@media (min-width: 601px) {
  .aiplay-shell.aiplay-scene {
    top: max(11px, env(safe-area-inset-top));
    bottom: auto;
  }
  #hud #turn {
    margin-top: 46px;
  }
  #hud #stage-badge {
    top: max(56px, calc(env(safe-area-inset-top) + 56px));
  }
  #hud #puzzle-hud {
    top: calc(env(safe-area-inset-top) + 56px);
  }
  #hud :is(#weather-sign, #sprint-scroll) {
    top: calc(env(safe-area-inset-top) + 56px);
  }
  #hud:has(#stage-badge:not([hidden])) :is(#weather-sign, #sprint-scroll) {
    top: calc(env(safe-area-inset-top) + 94px);
  }
  #hud #tabletop-bar {
    top: calc(env(safe-area-inset-top) + 56px);
  }
  #hud.tabletop :is(#weather-sign, #sprint-scroll) {
    top: calc(env(safe-area-inset-top) + 128px);
  }
  #hud.tabletop:has(#stage-badge.party-status:not([hidden])) #stage-badge {
    top: calc(env(safe-area-inset-top) + 124px);
  }
  #hud.tabletop:has(#stage-badge.party-status:not([hidden])) :is(#weather-sign, #sprint-scroll) {
    top: calc(env(safe-area-inset-top) + 158px);
  }
}

/* 矮横屏手机（如 844×390）：收紧顶部站点条高度，留足中央天空与对手头顶空间 */
@media (min-width: 601px) and (max-height: 480px) and (orientation: landscape) {
  .aiplay-shell.aiplay-scene {
    top: max(8px, env(safe-area-inset-top));
  }
  .aiplay-shell.aiplay-scene > a,
  .aiplay-shell.aiplay-scene summary {
    padding: 5px 10px;
    font-size: 11px;
  }
  .aiplay-shell.aiplay-scene > a.aiplay-filing {
    padding: 4px 9px;
    min-block-size: 24px;
    font-size: 10px;
  }
  .aiplay-shell.aiplay-scene details > div {
    top: 38px;
  }
  #lobby-mute {
    top: max(8px, env(safe-area-inset-top));
    left: max(10px, env(safe-area-inset-left));
    min-height: 34px;
    padding: 4px 10px 4px 8px;
    font-size: 12px;
  }
  #hud #turn {
    margin-top: 36px;
  }
  #hud #stage-badge,
  #hud #puzzle-hud,
  #hud :is(#weather-sign, #sprint-scroll) {
    top: calc(env(safe-area-inset-top) + 42px);
  }
  #hud:has(#stage-badge:not([hidden])) :is(#weather-sign, #sprint-scroll) {
    top: calc(env(safe-area-inset-top) + 74px);
  }
}

/* 窄屏竖屏手机（≤600px，如 390×844、360×780）：顶部已被双方头像与时钟占满，站点条移至底部并整体抬高底部控件 */
@media (max-width: 600px) {
  .aiplay-shell.aiplay-scene {
    top: auto;
    bottom: max(6px, env(safe-area-inset-bottom));
    border-radius: 18px;
  }
  .aiplay-shell.aiplay-scene > a,
  .aiplay-shell.aiplay-scene summary {
    padding: 6px 11px;
    font-size: 11.5px;
  }
  .aiplay-shell.aiplay-scene > a.aiplay-filing {
    flex-basis: 100%;
    text-align: center;
    padding: 1px 10px 4px;
    min-block-size: 22px;
    font-size: 10.5px;
  }
  .aiplay-shell.aiplay-scene details > div {
    top: auto;
    bottom: 62px;
  }
  #lobby-mute {
    top: max(8px, env(safe-area-inset-top));
    left: max(10px, env(safe-area-inset-left));
    min-height: 36px;
    padding: 4px 11px 4px 9px;
    font-size: 12px;
  }
  #lobby .mast {
    top: max(54px, calc(env(safe-area-inset-top) + 48px));
  }
  #lobby .selection {
    bottom: calc(max(6px, env(safe-area-inset-bottom)) + 64px);
  }
  #hud .control-hint {
    bottom: calc(max(8px, env(safe-area-inset-bottom)) + 64px);
  }
  #hud #ultimate {
    bottom: calc(max(10px, env(safe-area-inset-bottom)) + 64px);
  }
  #hud #home-speech {
    bottom: calc(max(8px, env(safe-area-inset-bottom)) + 114px);
  }
  #hud #cancel-zone {
    bottom: calc(max(10px, env(safe-area-inset-bottom)) + 112px);
  }
  #hud #touch-meter {
    bottom: calc(max(10px, env(safe-area-inset-bottom)) + 64px);
  }
  #hud #coop-loads {
    bottom: calc(max(8px, env(safe-area-inset-bottom)) + 64px);
  }
  #hud:not(.white-seat) #reload {
    translate: 0 -56px;
  }
}

/* 截图封面时临时隐藏站点导航条的内部类名（与线上默认无关） */
body.aiplay-hide-shell .aiplay-shell {
  display: none !important;
}
