/* Toy 容器的安全区属于屏幕 UI，不改变战场内部物理坐标。 */
:root {
  --toy-safe-top: 0px;
  --toy-safe-right: 0px;
  --toy-safe-bottom: 0px;
  --toy-safe-left: 0px;
}
#soundBtn { font-size: 12px; width: 48px; }
.toy-sound-panel { position: absolute; z-index: 26; top: 8px; right: 8px; width: min(260px, calc(100% - 16px)); padding: 12px; border: 1px solid #3b506b; border-radius: 12px; background: #0e1827; box-shadow: 0 12px 35px #0009; }
.toy-sound-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; font-size: 14px; }
.toy-sound-panel button { color: #f4f7fb; cursor: pointer; }
#toySoundClose { width: 44px; height: 44px; background: transparent; border: 0; font-size: 23px; }
#toyMusicToggle, #toySfxToggle { display: block; width: 100%; min-height: 48px; margin-top: 8px; padding: 10px 14px; text-align: left; border: 1px solid #3b506b; border-radius: 7px; background: #172638; font-size: 14px; }
.toy-sound-panel button[aria-pressed="true"] { border-color: #42cde5; color: #8eebff; }
.toy-sound-panel button[aria-pressed="false"] { color: #a2abba; background: #111923; }
.toy-sound-panel button:focus-visible { outline: 2px solid #8eebff; outline-offset: 2px; }
.creator-links { grid-template-columns: 1fr; }
.creator-link { justify-content: center; min-height: 44px; }
.creator-link strong { font-size: 12px; }
.thanks-letter-button { width: 48px; height: 44px; }
.thanks-envelope { line-height: 42px; }
.toy-edition { font-size: 10px; color: #8c96a8; white-space: nowrap; }
.statusbar { gap: 8px; }
#modeStatus { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toy-pause { z-index: 24; background: rgba(4, 7, 12, .94); gap: 18px; }
.toy-pause h2 { margin: 0; font-size: 28px; }
.toy-pause p { margin: 0; color: #9eafc4; font-size: 13px; }
.toy-pause .text-button { min-height: 44px; padding: 8px 20px; }
.creator-links-menu { width: min(86%, 360px); }
.result-actions { margin-top: 20px; }
.game-shell { height: var(--app-height, 100vh); min-height: 0; }
@media (max-width: 980px) {
  .game-shell {
    padding-left: max(env(safe-area-inset-left, 0px), var(--toy-safe-left));
    padding-right: max(env(safe-area-inset-right, 0px), var(--toy-safe-right));
  }
  .stage-column {
    width: 100%;
    height: var(--app-height, 100vh);
    min-height: 0;
    grid-template-rows:
      calc(52px + max(env(safe-area-inset-top, 0px), var(--toy-safe-top)))
      minmax(0, 1fr)
      calc(30px + max(env(safe-area-inset-bottom, 0px), var(--toy-safe-bottom)));
  }
  .topbar { padding-top: max(env(safe-area-inset-top, 0px), var(--toy-safe-top)); }
  .statusbar { padding-bottom: max(env(safe-area-inset-bottom, 0px), var(--toy-safe-bottom)); }
}
@media (max-height: 640px) {
  .menu-copy h1 { font-size: 36px; margin: 5px 0; }
  .menu-copy p { font-size: 10px; }
  .mode-grid { margin-top: 12px; gap: 5px; }
  .mode-card { min-height: 50px; padding: 7px 12px; }
  .mode-no { top: 12px; }
  .mode-label { font-size: 14px; }
  .menu-note { margin-top: 6px; }
  .creator-links-menu { margin-top: 6px; }
  .thanks-letter-button { margin-top: 4px; }
  .difficulty-overlay h2 { font-size: 26px; margin: 8px 0; }
  .difficulty-grid { margin-top: 12px; gap: 6px; }
  .difficulty-card { min-height: 52px; padding-block: 6px; }
  .difficulty-overlay > .text-button { margin-top: 5px; min-height: 44px; }
  .result-overlay h2 { font-size: 32px; }
  .result-actions { gap: 7px; margin-top: 12px; }
}
