/* Sunk — page chrome only.
 *
 * The game is drawn in Phaser, so this file has one job: give the canvas the
 * whole viewport, centre it, and style the one optional explanation sheet the
 * player can open from the debrief.
 */

html, body {
  height: 100%;
  overflow: hidden;           /* no rubber-banding under a full-bleed canvas */
}

body {
  display: grid;
  place-items: center;
}

/* Fixed, not `height: 100%`. As a grid item a percentage height resolves
   against the grid area, and the grid area sizes to its content — which is
   the 800px-tall canvas. That circularity lets #stage report 800px on a short
   viewport, so Phaser's FIT sees a parent big enough for the game at 1:1 and
   never scales down, putting the bottom of the game below the fold. Taking
   #stage out of flow pins it to the viewport, so parentSize is always the
   real window. (Same fix as Outbreak; same bug, so same comment.) */
#stage {
  position: fixed;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  overflow: hidden;
}

#stage canvas {
  display: block;
  touch-action: none;         /* the canvas owns every gesture */
  border-radius: 0;
}

@media (min-width: 560px) and (min-height: 900px) {
  #stage canvas {
    border-radius: 18px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ---------- the optional explanation ----------
 * Opened from a "why?" button that only exists on the debrief. The game never
 * opens this by itself. */

.why-sheet {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: end center;
  padding: 16px;
  background: rgba(8, 4, 16, 0.72);
  backdrop-filter: blur(6px);
  animation: why-fade 0.22s var(--ease-out);
}

.why-sheet[hidden] { display: none; }

@keyframes why-fade { from { opacity: 0; } }

.why-card {
  width: min(100%, 420px);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  margin-bottom: max(16px, env(safe-area-inset-bottom));
  padding: 24px 22px 18px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--panel);
  box-shadow: 0 -10px 60px rgba(0, 0, 0, 0.5);
  animation: why-rise 0.28s var(--ease-snap);
}

@keyframes why-rise { from { transform: translateY(22px); opacity: 0; } }

.why-card h2 {
  margin: 0 0 12px;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.why-card p {
  margin: 0 0 12px;
  font-size: 15px;
  line-height: 1.5;
  color: var(--dim);
}

.why-card b { color: var(--paper); font-weight: 700; }

.why-last { color: var(--paper) !important; }

.why-x {
  width: 100%;
  min-height: 48px;
  margin-top: 6px;
  padding: 14px;
  border-radius: 14px;
  background: var(--panel-lift);
  border: 1px solid var(--line);
  color: var(--paper);
  font-size: 15px;
  font-weight: 600;
}

.why-x:hover { background: var(--line); }

.nojs {
  max-width: 34ch;
  padding: 20px;
  color: var(--dim);
  font-size: 15px;
  line-height: 1.5;
  text-align: center;
}
