/* Twinky — pixel character in a luxurious dark space. Round 3.
   Genuinely full-bleed: the canvas is position:fixed, inset:0, 100vw x
   100dvh — the spotlight, parallax stars, reflective floor and vignette
   fill the entire viewport edge-to-edge, zero panel borders, zero inset
   seams, zero framing lines. Header and bottom chrome are overlays.
   The rig scales the character dynamically to the viewport height so
   the full body + subtitle + hint + footer fit above the fold on
   1280x800, 437x972 and 390x844. All chrome is English; the subtitle
   line is Japanese. */
:root {
  --ink: #1a1a1a;
  --pink-accent: #ff6b9d;
  --pink-soft: #ffb3c8;
  --pink-pale: #ffd6e8;
  --gold: #ffd94a;
  --gold-hairline: rgba(255, 217, 74, 0.38);
  --ink-body: #3a2b32;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: linear-gradient(180deg, #150e2c 0%, #2a1544 42%, #4a1d4e 78%, #571f4d 100%);
  background-attachment: fixed;
  color: #fff;
  height: 100dvh;
  overflow: hidden;
}

/* Stage: the whole viewport, edge to edge. */
#stage {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  touch-action: none;
  cursor: grab;
  -webkit-tap-highlight-color: transparent;
  z-index: 1;
}
#stage:active { cursor: grabbing; }

/* Gentle vignette over the whole viewport (the scene, not the chrome). */
#vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 46%, transparent 52%, rgba(6, 2, 14, 0.34) 100%);
  z-index: 4;
}

/* Header overlay: title case "Twinky", no letterspacing, no gold rule. */
#top {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  pointer-events: none;
}
#top h1 {
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.5px;
  pointer-events: auto;
}
.mute-btn {
  border: 1px solid var(--gold-hairline);
  background: rgba(255, 255, 255, 0.92);
  border-radius: 999px;
  padding: 7px;
  cursor: pointer;
  font-family: inherit;
  line-height: 1;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
  pointer-events: auto;
}
.mute-btn:active { transform: scale(0.94); }
.mute-btn .ic { width: 18px; height: 18px; image-rendering: pixelated; display: block; }

/* Bottom overlay: subtitle, hint, footer — all above the fold. */
#bottom {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 8px 12px calc(10px + env(safe-area-inset-bottom, 0px));
  pointer-events: none;
}

/* Landscape / desktop headroom (round 4): ~20px padding below the
   footer so "twinkywinky.org" never hugs the bottom edge, and the
   subtitle has breathing room above the hint. Phones keep 10px — the
   character must not shrink on phone viewports. */
@media (min-width: 641px) {
  #bottom {
    padding-bottom: 20px;
  }
}

/* Subtitle line: plain text, never a bubble. The already-spoken part is
   full white; the not-yet-spoken part is dim, so the word-by-word
   reveal reads as karaoke. */
#subtitle {
  max-width: 94%;
  font-size: clamp(16px, 4.6vw, 22px);
  font-weight: 700;
  line-height: 1.4;
  text-align: center;
  white-space: nowrap;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.85), 0 0 2px rgba(0, 0, 0, 0.9);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.6s ease;
}
#subtitle.show { opacity: 1; }
#subtitle.fade { opacity: 0; }
#sub-todo { opacity: 0.35; }

#tap-hint {
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--pink-soft);
  letter-spacing: 0.4px;
  /* Fix 5: dark backdrop shadow so the hint stays legible even if a
     bright star sits behind it (the starfield is now also excluded
     from this band in rig.js, this is the belt-and-braces layer). */
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.85), 0 0 2px rgba(0, 0, 0, 0.9);
}
footer {
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1.5px;
  color: #d8b8d0;
  /* Fix 5: same legibility shadow as the hint. */
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.85), 0 0 2px rgba(0, 0, 0, 0.9);
}

@media (max-width: 640px) {
  #top h1 { font-size: 19px; }
  #tap-hint { font-size: 13px; }
}
