:root {
  --bg: #120d1c;
  --panel: #1d1530;
  --ink: #f3e9d2;
  --muted: #a99dbb;
  --fire: #ff8a1f;
  --fire-hot: #ffd23f;
  --green: #4fa84a;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: radial-gradient(ellipse at top, #2a1b45 0%, var(--bg) 60%);
  color: var(--ink);
  font-family: "Trebuchet MS", system-ui, sans-serif;
  min-height: 100vh;
}
.top { text-align: center; padding: 28px 16px 8px; }
.top h1 {
  margin: 0;
  font-family: "Courier New", monospace;
  font-size: clamp(2.2rem, 7vw, 4.2rem);
  letter-spacing: 0.04em;
  color: var(--green);
  text-shadow: 0 0 18px rgba(255, 138, 31, 0.35), 3px 3px 0 #0b0712;
}
.top h1 span { color: var(--fire); }
.tag { margin: 4px 0 0; color: var(--muted); letter-spacing: 0.2em; text-transform: uppercase; font-size: 0.85rem; }

main, .hero { max-width: 980px; margin: 0 auto; padding: 0 16px 40px; }
.hero { padding-bottom: 0; }

.stage-wrap {
  position: relative;
  margin-top: 16px;
  border: 3px solid #0b0712;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}
#stage { display: block; width: 100%; height: auto; image-rendering: pixelated; }

.target {
  position: absolute;
  left: 62%;
  top: 38%;
  transform: translate(-50%, -50%);
  font-family: "Courier New", monospace;
  font-weight: bold;
  font-size: clamp(1rem, 3.4vw, 2rem);
  white-space: nowrap;
  pointer-events: none;
  text-shadow: 2px 2px 0 #0b0712;
}
.target .ch { display: inline-block; transition: color 0.25s, text-shadow 0.25s; }
.target .ch.scorch {
  color: var(--fire-hot);
  text-shadow: 0 0 8px var(--fire), 0 0 16px #ff3d00;
  animation: flicker 0.12s infinite alternate;
}
.target .ch.ash {
  color: #3a3440;
  text-shadow: none;
  animation: crumble 1.1s ease-in forwards;
}
.target .note { color: var(--muted); font-size: 0.6em; font-weight: normal; }
@keyframes flicker { from { transform: translateY(0) scale(1); } to { transform: translateY(-2px) scale(1.06); } }
@keyframes crumble {
  0% { transform: translateY(0) rotate(0); opacity: 1; }
  100% { transform: translateY(70px) rotate(var(--rot, 25deg)); opacity: 0; }
}

.burn-form { margin-top: 20px; text-align: center; }
.burn-form label { display: block; font-size: 1.15rem; margin-bottom: 10px; }
.burn-form .row { display: flex; gap: 10px; max-width: 620px; margin: 0 auto; }
.burn-form input {
  flex: 1;
  min-width: 0;
  padding: 12px 14px;
  font-size: 1rem;
  border-radius: 8px;
  border: 2px solid #3b2d58;
  background: var(--panel);
  color: var(--ink);
}
.burn-form input:focus { outline: none; border-color: var(--fire); }
.burn-form button {
  padding: 12px 18px;
  font-family: "Courier New", monospace;
  font-weight: bold;
  font-size: 1rem;
  letter-spacing: 0.08em;
  border: none;
  border-radius: 8px;
  color: #1a0d00;
  background: linear-gradient(180deg, var(--fire-hot), var(--fire));
  cursor: pointer;
  box-shadow: 0 4px 0 #a14700;
}
.burn-form button:active { transform: translateY(2px); box-shadow: 0 2px 0 #a14700; }
.burn-form button:disabled { filter: grayscale(0.7); cursor: wait; }

.hint { display: none; }
.sound { display: none; }
.stamp { display: none; }
.quip { display: none; }
.counter { text-align: center; color: var(--muted); margin: 18px 0 6px; }
.counter strong { color: var(--fire); font-size: 1.3em; }
.ashes {
  list-style: none;
  padding: 0;
  margin: 12px auto 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  max-width: 760px;
}
.ashes li {
  background: #241b33;
  border: 1px solid #3b2d58;
  color: #8f84a0;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.85rem;
  text-decoration: line-through;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  margin-top: 40px;
}
.card {
  background: var(--panel);
  border: 1px solid #3b2d58;
  border-radius: 10px;
  padding: 16px;
}
.card h2 { margin: 0 0 6px; font-size: 1.1rem; color: var(--fire-hot); }
.card p { margin: 0; color: var(--muted); font-size: 0.92rem; }
.card ul { margin: 10px 0 0; padding-left: 18px; }
.card a { color: var(--green); }
.card.soon { opacity: 0.85; }

footer { text-align: center; color: #6f6483; font-size: 0.8rem; padding: 20px 16px 30px; }

@media (max-width: 540px) {
  .burn-form .row { flex-direction: column; }
  .target { top: 30%; }
}
@media (prefers-reduced-motion: reduce) {
  .target .ch.scorch { animation: none; }
}

/* ---------- WebGL scene: the stage becomes a full-viewport hero ---------- */
body.gl .hero {
  position: relative;
  max-width: none;
  padding: 0;
  height: 100vh;
  height: 100svh;
  min-height: 540px;
  max-height: 1300px;
  overflow: hidden;
  background: #0d0916;
}
body.gl .stage-wrap { position: absolute; inset: 0; margin: 0; border: 0; border-radius: 0; box-shadow: none; }
body.gl #stage { width: 100%; height: 100%; image-rendering: auto; touch-action: pan-y; cursor: crosshair; -webkit-user-select: none; user-select: none; }
body.gl .target { display: none; }
body.gl .stage-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 45%, rgba(0, 0, 0, 0) 55%, rgba(6, 3, 12, 0.55) 100%);
}
body.gl .hint { transition: opacity 0.8s; }
body.gl .hint.seen { opacity: 0.35; }
body.gl .top { position: absolute; inset: 0 0 auto 0; z-index: 2; pointer-events: none; padding-top: 18px; }
body.gl .top h1 { text-shadow: 0 0 26px rgba(255, 138, 31, 0.55), 3px 3px 0 #0b0712; }
body.gl .tag { color: #c9bfe0; text-shadow: 0 1px 6px #0b0712; }
body.gl .hud {
  position: absolute;
  inset: auto 0 0 0;
  z-index: 2;
  padding: 70px 16px 14px;
  background: linear-gradient(to bottom, rgba(9, 5, 16, 0), rgba(9, 5, 16, 0.86) 62%);
  pointer-events: none;
}
body.gl .hud form, body.gl .hud button { pointer-events: auto; }
body.gl .burn-form { margin-top: 0; }
body.gl .burn-form label { text-shadow: 0 2px 8px #0b0712; }
body.gl .burn-form input { background: rgba(29, 21, 48, 0.86); }
body.gl .hint { display: block; text-align: center; margin: 10px 0 0; color: #c9bfe0; font-size: 0.9rem; text-shadow: 0 1px 6px #0b0712; }
body.gl .counter { margin: 8px 0 0; font-size: 0.92rem; }
body.gl .sound {
  display: inline-block;
  margin-left: 10px;
  padding: 3px 10px;
  font: inherit;
  font-size: 0.8rem;
  color: var(--muted);
  background: rgba(29, 21, 48, 0.8);
  border: 1px solid #3b2d58;
  border-radius: 999px;
  cursor: pointer;
}
body.gl .sound[aria-pressed="true"] { color: var(--fire-hot); border-color: #7a4a12; }

body.gl .stamp {
  display: block;
  position: absolute;
  left: 50%;
  top: 40%;
  z-index: 3;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -50%) rotate(-6deg);
  font: 900 clamp(2.6rem, 10vw, 7.5rem) / 0.95 Impact, Haettenschweiler, "Arial Narrow Bold", "Arial Black", sans-serif;
  letter-spacing: 0.03em;
  text-align: center;
  white-space: nowrap;
  color: #ffd23f;
  -webkit-text-stroke: 2px #1a0500;
  text-shadow: 0 0 24px #ff5a00, 0 0 70px rgba(255, 60, 0, 0.75), 4px 5px 0 #7a1500;
}
body.gl .quip {
  display: block;
  position: absolute;
  left: 50%;
  top: 21%;
  z-index: 3;
  width: max-content;
  max-width: 88vw;
  margin: 0;
  padding: 8px 16px;
  transform: translateX(-50%);
  pointer-events: none;
  opacity: 0;
  font: italic bold clamp(1.05rem, 2.6vw, 1.7rem) / 1.25 "Trebuchet MS", system-ui, sans-serif;
  text-align: center;
  color: #fff3d0;
  background: rgba(9, 5, 16, 0.72);
  border: 2px solid #d6331b;
  border-radius: 14px;
}
body.gl .quip.go { animation: quip 4.6s ease-out forwards; }
@keyframes quip {
  0% { opacity: 0; transform: translateX(-50%) translateY(10px) scale(0.9); }
  6% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
  85% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-8px) scale(1); }
}
body.gl .stamp.long { font-size: clamp(1.5rem, 5.4vw, 4.4rem); }
body.gl .stamp small { display: block; font-size: 0.32em; letter-spacing: 0.12em; color: #fff3d0; -webkit-text-stroke: 1px #1a0500; margin-bottom: 0.25em; }
body.gl .stamp.go { animation: stamp 2.4s cubic-bezier(0.2, 1.3, 0.3, 1) forwards; }
@keyframes stamp {
  0% { opacity: 0; transform: translate(-50%, -50%) rotate(-6deg) scale(3.4); }
  11% { opacity: 1; transform: translate(-50%, -50%) rotate(-6deg) scale(1); }
  78% { opacity: 1; transform: translate(-50%, -50%) rotate(-6deg) scale(1.05); }
  100% { opacity: 0; transform: translate(-50%, -50%) rotate(-6deg) scale(1.12); }
}
@media (max-width: 540px) {
  body.gl .hud { padding-top: 50px; }
  body.gl .burn-form label { font-size: 1rem; margin-bottom: 8px; }
  body.gl .burn-form .row { flex-direction: row; gap: 8px; }
  body.gl .burn-form button { padding: 12px 12px; font-size: 0.9rem; }
  body.gl .hint { font-size: 0.8rem; }
}
@media (prefers-reduced-motion: reduce) {
  body.gl .stamp.go { animation-timing-function: linear; }
}
