/* Study Quest — gamemenu.css: the Game Menu (Esc), V4.1 (js/ui-gamemenu.js).
 * Ember & Iron (docs/DESIGN.md §14): the menu is composed from .codex-window / .codex-banner / .codex-btn /
 * .codex-divider / .codex-kbd in the markup; this sheet only places, sizes and spaces it (prefix .gm-*). */

.gm-backdrop {
  position: fixed;
  inset: 0;
  z-index: 940;                      /* over the HUD, windows (50) and the map; under glue screens (960) and dialogs (1000) */
  display: grid;
  place-items: center;
  padding: 16px;
  background: radial-gradient(ellipse at 50% 46%, rgba(7, 8, 10, 0.38), rgba(3, 3, 4, 0.72));
  animation: fadeIn var(--cx-dur-quick, 160ms) ease-out;
}
.gm-menu {
  width: 420px;                      /* V7.3 (item 26): wide enough that two plates of a pair hold their labels ("Study Radio: off") */
  min-width: 0;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 32px);
  animation: cx-rise var(--cx-dur-calm, 480ms) var(--cx-ease, ease-out) both;
}
.gm-title { min-width: 190px; text-align: center; }
.gm-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px 22px 12px;
  overflow: visible;
}
.gm-body > .gm-btn { justify-content: center; }
/* V7.2.4: two plates to a row (Study Radio | Sound, Interface | Key bindings) */
.gm-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.gm-pair > .gm-btn { justify-content: center; min-width: 0; padding-left: 6px; padding-right: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gm-body > .gm-btn { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body.sq-compact .gm-pair { gap: 5px; }
/* fixer-b (critic v724b L5): at 480×360 "Study Radio: off" and "Key bindings" ran out of their plates: the small menu is a
   little wider (two plates still share a row, so it stays as tall as before) */
.gm-body > .gm-sep { margin: 4px 0; }
.gm-hint {
  margin: 6px 0 0;
  text-align: center;
  font: 400 13px/1.4 var(--cx-font-body);
  color: var(--cx-text-dim);
}
.gm-hint .codex-kbd { font-size: 11px; }

/* compact (480×360): the tokens already shrink the plates; tighten the gaps so it fits the short window */
body.sq-compact .gm-menu { width: min(420px, calc(100vw - 16px)); }
body.sq-compact .gm-body { gap: 5px; padding: 10px 14px 6px; }
body.sq-compact .gm-body > .gm-sep { margin: 0; height: 12px; }
body.sq-compact .gm-hint { margin-top: 2px; font-size: 12px; }
@media (max-width: 560px), (max-height: 420px) {
  .gm-menu { width: min(420px, calc(100vw - 16px)); }
  .gm-body { gap: 5px; padding: 10px 14px 6px; }
  .gm-body > .gm-sep { margin: 0; height: 12px; }
  .gm-hint { margin-top: 2px; font-size: 12px; }
}

/* reduced motion: no rise, no fade */
.gm-backdrop.gm-calm, .gm-backdrop.gm-calm .gm-menu { animation: none; }
@media (prefers-reduced-motion: reduce) {
  .gm-backdrop, .gm-menu { animation: none !important; }
}
body.reduced-motion .gm-backdrop, body.reduced-motion .gm-menu { animation: none !important; }
