:root {
  --bg: #000000;
  --white: #f2f0eb;
  --red: #c81f2a;
  --red-dark: #7a1218;
  --muted: #9c9890;
}

* { box-sizing: border-box; }

html {
  scrollbar-gutter: stable;
  overflow-y: scroll;
}

html, body {
  height: 100%;
  margin: 0;
  background: var(--bg);
}

body {
  color: var(--white);
  font-family: 'Special Elite', 'Courier New', monospace;
  min-height: 100%;
  overflow-x: hidden;
  position: relative;
  filter: contrast(1.15) saturate(0.85);
}

/* ---- Grindhouse film texture overlay ---- */

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  opacity: 0.16;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  animation: grain-shift 0.4s steps(3) infinite;
}

@keyframes grain-shift {
  0%   { transform: translate(0,0); }
  33%  { transform: translate(-1%,1%); }
  66%  { transform: translate(1%,-1%); }
  100% { transform: translate(0,0); }
}

.vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 49;
  background: radial-gradient(ellipse at center, rgba(0,0,0,0) 40%, rgba(0,0,0,0.75) 100%);
}

.scratches {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 48;
  opacity: 0;
  background:
    linear-gradient(90deg, transparent 12%, rgba(255,255,255,0.5) 12.2%, transparent 12.4%),
    linear-gradient(90deg, transparent 47%, rgba(255,255,255,0.35) 47.15%, transparent 47.3%),
    linear-gradient(90deg, transparent 78%, rgba(255,255,255,0.4) 78.2%, transparent 78.35%);
  animation: scratch-flicker 6s infinite steps(1);
}

@keyframes scratch-flicker {
  0%, 91%, 100% { opacity: 0; }
  92% { opacity: 0.5; }
  93% { opacity: 0; }
  95% { opacity: 0.3; }
  96% { opacity: 0; }
}

.flash {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 60;
  background: #fff;
  opacity: 0;
}
.flash.hit {
  animation: flash-hit 0.18s steps(2);
}
@keyframes flash-hit {
  0% { opacity: 0.9; }
  100% { opacity: 0; }
}

/* ---- Layout ---- */

.stage {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 5.5rem 1.25rem 3rem;
}

.frame {
  width: 100%;
  max-width: 38rem;
}

/* ---- Title bar (persistent) ---- */

.game-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.9rem 1.25rem;
  background: linear-gradient(to bottom, rgba(0,0,0,0.9), transparent);
}

.game-header a.brand {
  font-family: 'Butcherman', cursive;
  color: var(--white);
  text-decoration: none;
  font-size: 1.1rem;
  letter-spacing: 0.02em;
}
.game-header a.brand span { color: var(--red); }

.endings-counter {
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--red-dark);
  padding: 0.3rem 0.6rem;
  background: rgba(122,18,24,0.15);
}
.endings-counter b { color: var(--red); }

/* ---- Title card (intro screen) ---- */

.title-card {
  text-align: center;
}
.title-card .kicker {
  color: var(--red);
  letter-spacing: 0.35em;
  text-transform: uppercase;
  font-size: 0.7rem;
  margin-bottom: 1rem;
}
.title-card h1 {
  font-family: 'Butcherman', cursive;
  font-weight: 400;
  font-size: clamp(2.4rem, 9vw, 4rem);
  line-height: 0.95;
  margin: 0 0 1.5rem;
  color: var(--white);
  text-shadow: 0 0 30px rgba(200,31,42,0.4);
  transform: rotate(-1.5deg);
}
.title-card p.blurb {
  color: var(--muted);
  font-style: italic;
  font-size: 0.95rem;
  max-width: 30rem;
  margin: 0 auto 2.5rem;
  line-height: 1.6;
}

.enter-btn {
  display: inline-block;
  background: var(--red);
  color: var(--white);
  font-family: 'Special Elite', monospace;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-size: 0.9rem;
  padding: 0.9rem 2.2rem;
  border: 2px solid var(--white);
  cursor: pointer;
  text-decoration: none;
  box-shadow: 4px 4px 0 #000, 4px 4px 0 1px var(--red-dark);
  transition: transform 0.08s ease;
}
.enter-btn:hover { transform: translate(-2px,-2px); }
.enter-btn:active { transform: translate(1px,1px); }

.warning-strip {
  margin-top: 2rem;
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--red-dark);
  border-top: 1px dashed var(--red-dark);
  border-bottom: 1px dashed var(--red-dark);
  padding: 0.6rem 0;
}

/* ---- Scene ---- */

.scene-art {
  width: 100%;
  aspect-ratio: 400 / 220;
  margin-bottom: 1.75rem;
  overflow: hidden;
  border: 1px solid var(--red-dark);
  position: relative;
  animation: art-in 0.5s ease;
}
.scene-art::before,
.scene-art::after {
  content: "";
  position: absolute;
  left: 0; right: 0;
  height: 10%;
  background: #000;
  z-index: 2;
}
.scene-art::before { top: 0; }
.scene-art::after { bottom: 0; }
.scene-art svg {
  display: block;
  width: 100%;
  height: 100%;
}
@keyframes art-in {
  from { opacity: 0; transform: scale(1.02); }
  to { opacity: 1; transform: scale(1); }
}

.skip-hint {
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 0.6;
  margin-top: 0.6rem;
}

.result-art {
  width: 7rem;
  height: 7rem;
  margin: 0 auto 1rem;
}
.result-art svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 0 20px rgba(200,31,42,0.5));
}

.scene-text {
  font-size: 1.05rem;
  line-height: 1.85;
  color: var(--white);
  min-height: 8rem;
}
.scene-text p {
  margin: 0 0 1.1rem;
}
.scene-text p:last-child { margin-bottom: 0; }

.cursor {
  display: inline-block;
  width: 0.55em;
  height: 1em;
  background: var(--red);
  vertical-align: text-bottom;
  animation: blink 0.9s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.choices {
  margin-top: 2.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.choices.show { opacity: 1; transform: translateY(0); }

.choice-btn {
  text-align: left;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--red-dark);
  color: var(--white);
  font-family: 'Special Elite', monospace;
  font-size: 0.92rem;
  padding: 0.85rem 1.1rem;
  cursor: pointer;
  letter-spacing: 0.02em;
  position: relative;
  transition: border-color 0.15s ease, background 0.15s ease, padding-left 0.15s ease;
}
.choice-btn::before {
  content: "▸";
  color: var(--red);
  margin-right: 0.6em;
}
.choice-btn:hover {
  border-color: var(--red);
  background: rgba(200,31,42,0.12);
  padding-left: 1.4rem;
}

/* ---- Death / survive card ---- */

.result-card {
  text-align: center;
  animation: card-in 0.5s ease;
}
@keyframes card-in {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}

.result-headline {
  font-family: 'Butcherman', cursive;
  font-weight: 400;
  line-height: 0.95;
  margin: 0 0 0.4rem;
  transform: rotate(-1deg);
}
.result-card.death .result-headline {
  color: var(--red);
  font-size: clamp(2.2rem, 9vw, 3.6rem);
  text-shadow: 0 0 30px rgba(200,31,42,0.6);
}
.result-card.survive .result-headline {
  color: var(--white);
  font-size: clamp(1.8rem, 7vw, 2.8rem);
  text-shadow: 0 0 24px rgba(242,240,235,0.35);
}

.result-subtitle {
  font-family: 'Special Elite', monospace;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 1.8rem;
}
.result-card.death .result-subtitle { color: var(--red-dark); }

.result-text {
  color: var(--white);
  line-height: 1.8;
  font-size: 0.98rem;
  max-width: 30rem;
  margin: 0 auto 2rem;
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.btn-secondary {
  background: transparent;
  color: var(--white);
  border: 1px solid var(--muted);
  font-family: 'Special Elite', monospace;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.8rem;
  padding: 0.7rem 1.4rem;
  cursor: pointer;
}
.btn-secondary:hover { border-color: var(--white); }

.share-feedback {
  font-size: 0.7rem;
  color: var(--red);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  height: 1rem;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.share-feedback.show { opacity: 1; }

/* ---- Endings collected list (on ending screen) ---- */

.endings-progress {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px dashed var(--red-dark);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.endings-progress b { color: var(--red); }

@media (max-width: 480px) {
  .game-header { padding: 0.75rem 1rem; }
  .game-header a.brand { font-size: 0.9rem; }
  .endings-counter { font-size: 0.6rem; padding: 0.25rem 0.45rem; }
  .scene-text { font-size: 1rem; }
  .stage { padding-top: 5rem; }
}
