/* Outbreak — page chrome only.
 *
 * The game itself 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 if they want it.
 */

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

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

/* Phaser's FIT scale mode letterboxes inside this box. The backlit glow from
   tokens.css shows through around the canvas on wide screens, which makes the
   letterboxing look deliberate rather than accidental.
 *
 * Fixed, not `height: 100%`. As a grid item, a percentage height resolves
 * against the grid area — and the grid area sizes itself to its content, which
 * is the 800px-tall canvas. That circularity let #stage report 800px on a
 * 537px viewport, so Phaser's FIT saw a parent big enough for the game at 1:1
 * and never scaled down. The bottom of the game (timer, fact-check pips) then
 * sat below the fold with no way to reach it. Taking #stage out of flow pins
 * it to the viewport, so parentSize is always the real window. */
#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 appears on the results screen. 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);
  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-last { color: var(--paper) !important; }

.why-x {
  width: 100%;
  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;
}
