/* The Script Shield (Breakout, Stage 1 prototype) — play.html only. */
.ss-field { height: auto !important; max-width: 100%; position: relative; width: min(100%, 768px, calc((100svh - 13rem) * 256 / 224)); min-width: 256px; margin: 0 auto; aspect-ratio: 256 / 224; background: #000; }
#game-canvas { display: block; width: 100%; height: 100%; touch-action: none; image-rendering: pixelated; image-rendering: crisp-edges; cursor: none; outline: none; }
#game-canvas:focus-visible { box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.6); }
.ss-field .game-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 0.75rem; background: rgba(7, 6, 12, 0.72); overflow: auto; }
.ss-field .game-overlay[hidden] { display: none; }
.ss-field .game-card { width: min(100%, 26rem); padding: 1.1rem 1.2rem; border: 2px solid #c98a1b; background: #120a24; color: #f4f1ea; text-align: center; }
.ss-field .game-card h2 { margin: 0 0 0.4rem; font-size: 1.4rem; letter-spacing: 0.06em; text-transform: uppercase; color: #ffd166; }
#game-final-score { margin: 0 0 0.8rem; font-size: 0.95rem; }
.ss-name-form label { display: block; font-size: 0.8rem; margin-bottom: 0.35rem; color: #cfc6b4; }
.ss-name-row { display: flex; gap: 0.5rem; }
#game-name { flex: 1; min-width: 0; font: inherit; font-size: 16px; /* no iOS zoom */ padding: 0.6rem 0.7rem; border: 1px solid #c98a1b; background: #07060c; color: #fff; text-transform: uppercase; }
#game-board { margin: 0.9rem 0; text-align: left; }
#game-board .kicker { font-size: 0.7rem; }
#game-board-list { margin: 0.3rem 0 0; padding-left: 1.4rem; font-size: 0.88rem; }
#game-board-list li span { display: inline-block; min-width: 8.5em; }
.ss-controls { display: flex; gap: 0.5rem; width: min(100% - 1.5rem, 768px); margin: 0.7rem auto 0.4rem; }
.game-ctrl { flex: 1 1 0; min-height: 3.2rem; border-radius: 12px; border: 1px solid rgba(232, 194, 122, 0.4); background: rgba(8, 10, 14, 0.9); color: #f4f1ea; font: inherit; font-size: 0.85rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; cursor: pointer; touch-action: none; user-select: none; -webkit-user-select: none; }
.game-ctrl-wide { flex: 1.4 1 0; }
.game-ctrl[hidden] { display: none; }
.game-ctrl:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.5); }
.game-ctrl:active { background: rgba(45, 212, 191, 0.18); }
.ss-note { width: min(100% - 1.5rem, 768px); margin: 0 auto 1.2rem; font-size: 0.78rem; color: #a8a3b8; text-align: center; }
@media (hover: hover) and (pointer: fine) { #game-left, #game-right { display: none; } }
@media (prefers-reduced-motion: reduce) { .game-ctrl { transition: none; } }

/* ===== t217: compact game page on phones / short screens (play.html only) =====
   The site nav stays available behind an accessible Menu button; the canvas is sized
   by game.js (fitGame) from the real visual viewport minus the header + controls,
   keeping 256:224 and integer-free crisp pixels. No overflow clipping is used. */
@media (max-width: 900px), (max-height: 560px) {
  body.game-page { --gp-gap: 6px; }
  body.game-page .site-header { position: sticky !important; top: 0; z-index: 60; height: auto !important; min-height: 0 !important; padding: calc(4px + env(safe-area-inset-top, 0px)) calc(10px + env(safe-area-inset-right, 0px)) 4px calc(10px + env(safe-area-inset-left, 0px)) !important; background: #000; }
  body.game-page .site-header .nav-inner { flex-wrap: nowrap !important; align-items: center; justify-content: space-between; gap: 8px; min-height: 0; padding: 0; width: 100%; }
  body.game-page .logo-link img { height: 30px !important; width: auto !important; max-width: 46vw; }
  body.game-page .site-header .nav-toggle { display: flex !important; width: 44px; height: 44px; flex: none; }
  body.game-page .site-header .nav-links {
    display: flex !important; position: fixed !important; left: 0; right: 0; top: var(--gp-hdr, 52px); z-index: 1001;
    flex-direction: column; align-items: stretch; gap: 0.15rem; padding: 0.5rem 1rem 1rem; margin: 0;
    max-height: calc(100dvh - var(--gp-hdr, 52px)); overflow-y: auto; overscroll-behavior: contain;
    background: rgba(0,0,0,0.97); border-bottom: 1px solid rgba(255,255,255,0.12);
    transform: translateY(-8px); opacity: 0; visibility: hidden; pointer-events: none; transition: opacity 0.2s, transform 0.2s;
  }
  body.game-page .site-header .nav-links.is-open { transform: none; opacity: 1; visibility: visible; pointer-events: auto; }
  body.game-page .site-header .nav-links a { display: block; padding: 0.7rem 0.5rem; min-height: 44px; }
  /* Title stays in the document for screen readers; visually compact */
  body.game-page .game-top { padding: 0 !important; margin: 0 !important; min-height: 0 !important; }
  body.game-page .game-top .kicker { display: none; }
  body.game-page .game-top .game-title { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; margin: 0; padding: 0; }
  body.game-page .game-shell { padding: 0 !important; margin: 0 !important; min-height: 0 !important; }
  body.game-page .game-stage { padding: var(--gp-gap) 0 0 !important; margin: 0 !important; border: 0 !important; background: none !important; box-shadow: none !important; min-height: 0 !important; }
  body.game-page .ss-field { min-width: 0; width: var(--gp-w, min(calc(100vw - 12px), calc((100svh - 130px) * 256 / 224))); max-width: none; margin: 0 auto; }
  body.game-page .ss-controls { width: var(--gp-w, calc(100vw - 12px)); min-width: min(100vw - 12px, 300px); margin: var(--gp-gap) auto 0; padding-bottom: env(safe-area-inset-bottom, 0px); gap: 6px; }
  body.game-page .game-ctrl { min-height: 48px; padding: 0.4rem 0.3rem; font-size: 0.8rem; letter-spacing: 0.06em; }
  body.game-page #game-left, body.game-page #game-right { display: block; }
  body.game-page .ss-note { margin-top: 0.8rem; }
  /* End-of-game name entry: full-screen panel with its own scroll so the virtual keyboard never hides it */
  body.game-page .ss-field .game-overlay { position: fixed; inset: 0; z-index: 1100; align-items: flex-start; padding: calc(12px + env(safe-area-inset-top, 0px)) 12px 24px; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
  body.game-page .ss-field .game-card { margin: auto 0; }
}
/* Landscape phones: controls to the sides would change UX; keep one slim row */
@media (max-height: 560px) and (orientation: landscape) {
  body.game-page .game-ctrl { min-height: 42px; }
  body.game-page .logo-link img { height: 24px !important; }
  body.game-page .site-header .nav-toggle { width: 40px; height: 40px; }
}
@media (max-width: 900px), (max-height: 560px) {
  body.game-page .game-shell { display: flex; flex-direction: column; justify-content: center; min-height: calc(100vh - var(--gp-hdr, 52px)); min-height: calc(100dvh - var(--gp-hdr, 52px)) !important; }
}
@media (max-width: 900px), (max-height: 560px) {
  /* no transform on the shell, so the fixed name-entry panel is truly viewport-fixed */
  html.js body.game-page.is-entered .game-shell { animation: none !important; transform: none !important; }
  body.game-page .game-stage { overflow: visible !important; border-radius: 0 !important; }
  body.game-page .ss-field .game-card { max-height: none; }
}

/* t218: rival dialogue box under the game (full taunt text, wraps, never covers bricks/HUD) */
.ss-taunt { width: min(100% - 1.5rem, 768px); margin: 0.45rem auto 0; padding: 0.35rem 0.7rem; min-height: 2.6em; display: flex; align-items: center; justify-content: center; text-align: center;
  font-size: 0.85rem; line-height: 1.25; color: #ffe1e1; background: #1a0a12; border: 2px solid #9a120e; border-radius: 8px; box-sizing: border-box; }
.ss-taunt[hidden] { display: none; }
@media (max-width: 900px), (max-height: 560px) {
  body.game-page .ss-taunt { width: var(--gp-w, calc(100vw - 12px)); min-width: min(100vw - 12px, 300px); margin-top: 6px; font-size: 0.78rem; min-height: 2.7em; padding: 0.25rem 0.5rem; }
}
@media (max-height: 560px) and (orientation: landscape) { body.game-page .ss-taunt { min-height: 1.6em; font-size: 0.72rem; } }
/* t242 mobile: gameplay surfaces never hand a thumb drag to browser zoom/scroll (page, menus and the score dialog stay zoomable) */
#game-canvas, .game-controls .game-ctrl { touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
.game-controls { touch-action: pan-y; }

/* t258 stage 3: purple MEGABYTE dialogue bubble below the playfield, whole line wraps */
.ss-taunt.ss-taunt-s3 { background: #1c0a33; color: #f0e0ff; border: 2px solid #a040ff; box-shadow: 0 0 10px rgba(160,64,255,0.45); white-space: normal; overflow-wrap: anywhere; text-overflow: clip; overflow: visible; height: auto; }

/* t278 leaderboard */
.ss-board-scroll { max-height: 14rem; overflow-y: auto; overscroll-behavior: contain; margin: 0; padding: 0 0.2rem; }
.ss-your-rank { margin: 0.55rem 0 0; font-weight: 700; color: #ffd166; letter-spacing: 0.04em; }
.ss-made-top { font-family: var(--display), "Syne", system-ui, sans-serif; font-weight: 800; font-size: 1.05rem; letter-spacing: 0.05em; line-height: 1.35; color: #ffd166; text-shadow: 2px 2px 0 #000; font-variant-numeric: lining-nums tabular-nums; }
.ss-made-top { font-family: var(--display), "Syne", system-ui, sans-serif; font-weight: 800; font-size: 1.05rem; letter-spacing: 0.05em; line-height: 1.35; color: #ffd166; text-shadow: 2px 2px 0 #000; font-variant-numeric: lining-nums tabular-nums; }
.ss-name-reject { color: #ff5a6e !important; animation: ss-flash 0.35s ease 2; }
@keyframes ss-flash { 50% { opacity: 0.35; } }

/* p1x: volume slider beside mute; compact, touch-friendly */
.game-page .game-top-actions {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.45rem 0.65rem;
  max-width: none;
}
.game-vol {
  display: flex;
  align-items: center;
  margin: 0;
  min-width: 0;
}
.game-vol input[type="range"] {
  width: 88px;
  height: 28px;
  margin: 0;
  padding: 0;
  accent-color: #e8c050;
  touch-action: manipulation;
  cursor: pointer;
  vertical-align: middle;
}
@media (max-width: 430px) {
  .game-vol input[type="range"] { width: 72px; }
}

/* p1x: GAME OVER desk animation sits above the score/name form; never covers the input */
.game-over-anim {
  display: block;
  width: 100%;
  max-width: 320px;
  height: auto;
  margin: 0 auto 0.55rem;
  background: #141820;
  border: 2px solid #c98a1b;
  box-sizing: border-box;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  pointer-events: none;
}
.game-over-anim[hidden] { display: none !important; }
.game-card-pixel #game-score-form,
.game-card-pixel #game-name,
.game-card-pixel #game-again {
  position: relative;
  z-index: 2;
}
@media (max-width: 900px), (max-height: 560px) {
  .game-over-anim { max-width: 100%; margin-bottom: 0.4rem; }
}

/* p2g: random hen-name button beside the high-score field */
.ss-name-row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: stretch; }
.ss-name-row #game-name { flex: 1 1 8rem; min-width: 0; }
.ss-random-name {
  flex: 0 0 auto;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  padding: 0 0.7rem;
  min-height: 44px;
  white-space: nowrap;
  touch-action: manipulation;
  cursor: pointer;
}
.game-card-pixel #game-random-name { position: relative; z-index: 2; }
@media (max-width: 430px) {
  .ss-random-name { font-size: 0.72rem; padding: 0 0.55rem; }
}


/* p2o: title-screen challenge line is an overlay inside the playfield.
   It must not take layout space or shrink the canvas vs p2m. */
.game-top100 {
  position: absolute;
  top: 8px;
  left: 0;
  right: 0;
  z-index: 2;
  margin: 0;
  padding: 0 0.5rem;
  box-sizing: border-box;
  text-align: center;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(0.95rem, 4.2vw, 1.2rem);
  font-variant-numeric: lining-nums tabular-nums;
  font-feature-settings: "lnum" 1, "tnum" 1;
  line-height: 1.2;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #ffd166;
  text-shadow:
    1px 0 0 #3a1a08, -1px 0 0 #3a1a08, 0 1px 0 #3a1a08, 0 -1px 0 #3a1a08,
    2px 2px 0 #7a4a0a,
    0 0 10px rgba(255, 209, 102, 0.35);
  pointer-events: none;
}
.game-top100-num {
  font-family: var(--display), "DM Sans", system-ui, sans-serif;
  font-style: normal;
  font-weight: 800;
  font-variant-numeric: lining-nums tabular-nums;
  font-feature-settings: "lnum" 1, "tnum" 1;
  font-size: 1.18em;
  letter-spacing: 0.04em;
  line-height: 1;
}
.game-top100[hidden] { display: none !important; }
@media (max-width: 400px) {
  .game-top100 { font-size: 0.95rem; letter-spacing: 0.06em; top: 6px; }
}
