/* ═══════════════════════════════════════════
   SCREENS (shared)
   ═══════════════════════════════════════════ */
.screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  /* transform joins the transition so a back-swipe can slide the screen out
     and spring it back; while a finger is on it the transition is off and
     the screen tracks the touch exactly. */
  transition: opacity var(--t-slow), transform 180ms ease-out;
  z-index: var(--z-overlay);
}

.screen--dragging {
  transition: none;
}

.screen[hidden] { display: none; }

/* Every control answers the first tap.
   iOS ignores `user-scalable=no`, so WKWebView keeps double-tap-to-zoom
   alive and holds a click for ~300ms waiting for a second tap. The tap
   reads as lost, the player taps again, and the second one goes through
   immediately — "the button needs pressing twice". `manipulation` drops
   the double-tap gesture on these elements and the click fires at once;
   panning and pinch-zoom elsewhere are untouched. */
button,
a[href],
[role="button"],
.btn,
.archive__card,
.hero-card,
.ws-card,
.bestiary__tab,
.combat__zone {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.screen--blurred {
  filter: blur(4px) brightness(0.4);
  pointer-events: none;
}

.screen--dead {
  filter: blur(6px) brightness(0.2) grayscale(0.6);
}

/* ─── Game Screen ─── */
/* Depth grading no longer filters the whole screen (that rasterized the HUD,
   sidebars and log through a full-screen filter every frame). Saturation/hue
   live on .grid-wrap, brightness is a compositor-cheap veil on the viewport
   (see camera.css). */
.screen--game {
  background: transparent;
  justify-content: flex-start;
  align-items: stretch;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 16px
           calc(10px + env(safe-area-inset-bottom, 0px));
  gap: 10px;
}

/* The game keeps rendering under combat/game-over overlays, blurred — its
   infinite animations (portal pulse, chest breathing, boss aura) would burn
   GPU invisibly. Freeze them while blurred. */
.screen--blurred *,
.screen--blurred *::before,
.screen--blurred *::after {
  animation-play-state: paused !important;
}

/* ═══════════════════════════════════════════
   GAME AREA — 3-column layout
   ═══════════════════════════════════════════ */
.game-area {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 16px;
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
}

.game-area__left {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  width: 180px;
  align-self: stretch;
}

.game-area__right {
  width: 240px;
  flex-shrink: 0;
  align-self: stretch;
  min-height: 200px;
  display: flex;
  flex-direction: column;
}

/* ═══════════════════════════════════════════
   GRID CONTAINER
   ═══════════════════════════════════════════ */
.grid-container {
  position: relative;
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

/* ═══════════════════════════════════════════
   D-PAD
   ═══════════════════════════════════════════ */

/* ═══════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════ */
@media (max-width: 700px) {
  .game-area {
    flex-direction: column;
    gap: 8px;
  }
  .game-area__left {
    order: 2;
    flex-direction: row;
    width: 100%;
    flex-wrap: wrap;
    justify-content: center;
  }
  .game-area__left .sidebar__section { width: auto; flex: 1; min-width: 120px; }
  .game-area__right {
    order: 3;
    width: 100%;
    min-height: 80px;
    max-height: 130px;
  }
  .screen--title h1 { font-size: 2rem; }
}

@media (min-width: 1024px) {
  .game-area__right { width: 250px; }
}
