/* ========================================================
   ФЕНЯ — Narrative Prison Adventure
   Aesthetic: американский тюремный фильм × русская блатная эстетика
   Cold fluorescent / concrete / surveillance / stencil + tattoo
   ======================================================== */

:root {
  --bg-deep:       #07080a;
  --bg-concrete:   #14130f;
  --bg-cell:       #161814;
  --bg-card:       #1c1c18;
  --paper:         #d6c8a8;
  --paper-dark:    #a8987a;
  --ink:           #15110a;

  --rust:          #9a3a22;
  --rust-bright:   #c44a2c;
  --blood:         #6e1a14;
  --amber:         #c8932a;
  --amber-bright:  #e5b54a;

  --bone:          #d8cfb8;
  --bone-dim:      #8a8270;
  --bone-faint:    #4a4538;

  --good:          #5a8a3a;
  --good-bright:   #8ec050;
  --bad:           #9a2a22;
  --bad-bright:    #d04030;

  /* Cold fluorescent — Shawshank / Oz blue-green */
  --fluor:         #6ea38c;
  --fluor-dim:     #2a4035;

  --stencil:       "Black Ops One", "Stalinist One", "Impact", sans-serif;
  --tattoo:        "Stalinist One", "Black Ops One", serif;
  --type:          "Special Elite", "Courier New", monospace;
  --mono:          "JetBrains Mono", "Consolas", monospace;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0;
  background: #000;
  color: var(--bone);
  font-family: var(--type);
  min-height: 100vh;
  overflow-x: hidden;
  cursor: default;
}

/* =========================================================
   STAGE — full-bleed container that switches "mood" per scene
   ========================================================= */
.stage {
  position: relative;
  min-height: 100vh;
  isolation: isolate;
  transition: filter 600ms;
}

/* Base concrete layer */
.stage::before {
  content: "";
  position: fixed; inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(110,163,140,0.07), transparent 60%),
    radial-gradient(ellipse 60% 40% at 50% 100%, rgba(154,58,34,0.05), transparent 70%),
    linear-gradient(180deg, #16140f 0%, #07080a 100%);
  z-index: -10;
  transition: opacity 600ms;
}
/* Concrete grain */
.stage::after {
  content: "";
  position: fixed; inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='400' height='400'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.08  0 0 0 0 0.07  0 0 0 0 0.05  0 0 0 0.55 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  opacity: 0.55;
  mix-blend-mode: overlay;
  pointer-events: none;
  z-index: -9;
}

/* ===== Atmospheric layers (positioned per stage) ===== */
.layer { position: fixed; inset: 0; pointer-events: none; }

/* Vertical bars — visible in cell scenes */
.bars {
  z-index: -7;
  background:
    repeating-linear-gradient(90deg,
      transparent 0,
      transparent 7vw,
      rgba(0,0,0,0.55) 7vw,
      rgba(0,0,0,0.55) calc(7vw + 8px),
      rgba(40,28,18,0.2) calc(7vw + 8px),
      rgba(40,28,18,0.2) calc(7vw + 16px),
      transparent calc(7vw + 16px),
      transparent calc(7vw + 18px)
    );
  opacity: 0;
  transition: opacity 800ms;
}
.mood-cell .bars,
.mood-corridor .bars { opacity: 0.30; }
.mood-kicha .bars { opacity: 0.55; filter: blur(0.5px); }

/* Searchlight beam — drifts across in corridor / yard */
.searchlight {
  z-index: -6;
  background: radial-gradient(ellipse 50% 80% at 50% 50%,
    rgba(220, 230, 220, 0.18) 0%,
    rgba(220, 230, 220, 0.05) 30%,
    transparent 70%);
  opacity: 0;
  transform: translateX(-100%);
}
.mood-corridor .searchlight,
.mood-yard .searchlight {
  opacity: 1;
  animation: sweep 9s ease-in-out infinite;
}
@keyframes sweep {
  0%   { transform: translateX(-100%) skewX(-15deg); }
  50%  { transform: translateX(100%)  skewX(-15deg); }
  100% { transform: translateX(-100%) skewX(-15deg); }
}

/* Fluorescent flicker — overlay for "lit" cells */
.fluorescent {
  z-index: -5;
  background:
    radial-gradient(ellipse 100% 30% at 50% 0%, rgba(110,163,140,0.18) 0%, transparent 60%),
    radial-gradient(ellipse 60% 25% at 50% 100%, rgba(110,163,140,0.08), transparent 60%);
  opacity: 0;
  mix-blend-mode: screen;
  transition: opacity 800ms;
}
.mood-cell .fluorescent,
.mood-corridor .fluorescent,
.mood-priem .fluorescent { opacity: 1; animation: flicker 6s infinite; }
@keyframes flicker {
  0%, 100% { opacity: 1; }
  3% { opacity: 0.5; }
  6% { opacity: 1; }
  41% { opacity: 1; }
  42% { opacity: 0.3; }
  43% { opacity: 1; }
  88% { opacity: 1; }
  89% { opacity: 0.6; }
  90% { opacity: 1; }
}

/* Carcer — single bulb, deep dark */
.bulb {
  z-index: -5;
  background: radial-gradient(circle 200px at 50% 22%, rgba(255,200,120,0.32) 0%, rgba(255,200,120,0.06) 40%, transparent 70%);
  opacity: 0;
  mix-blend-mode: screen;
  transition: opacity 600ms;
}
.mood-kicha .bulb {
  opacity: 1;
  animation: bulb-swing 5s ease-in-out infinite;
}
@keyframes bulb-swing {
  0%, 100% { transform: translateX(-30px); }
  50%      { transform: translateX(30px); }
}
.mood-kicha .stage::before,
.mood-kicha::before {
  filter: brightness(0.4);
}

/* Office — warm tungsten (опер) */
.tungsten {
  z-index: -5;
  background:
    radial-gradient(ellipse 50% 60% at 70% 30%, rgba(200,147,42,0.20), transparent 60%),
    radial-gradient(ellipse 80% 50% at 50% 100%, rgba(154,58,34,0.10), transparent 70%);
  opacity: 0;
  mix-blend-mode: screen;
  transition: opacity 800ms;
}
.mood-opera .tungsten,
.mood-court .tungsten { opacity: 1; }

/* Avtozak — moving headlights */
.headlights {
  z-index: -5;
  background:
    linear-gradient(180deg, transparent 0%, rgba(255,200,120,0.05) 50%, transparent 100%);
  opacity: 0;
}
.mood-avtozak .headlights {
  opacity: 1;
  animation: headlightStreak 3s linear infinite;
}
@keyframes headlightStreak {
  0% { background-position: 0 0; opacity: 0; }
  50% { opacity: 1; }
  100% { background-position: 0 100%; opacity: 0; }
}

/* CCTV scanlines — always on, very subtle */
.scanlines {
  z-index: 50;
  background-image: repeating-linear-gradient(
    180deg,
    rgba(0,0,0,0) 0px,
    rgba(0,0,0,0) 2px,
    rgba(0,0,0,0.10) 2px,
    rgba(0,0,0,0.10) 3px
  );
  opacity: 0.5;
  mix-blend-mode: multiply;
}

/* Vignette */
.vignette {
  z-index: 51;
  background: radial-gradient(ellipse 90% 80% at 50% 50%, transparent 40%, rgba(0,0,0,0.85) 100%);
}

/* Dust motes drifting */
.dust {
  z-index: -4;
  background-image:
    radial-gradient(1.5px 1.5px at 15% 30%, rgba(216,207,184,0.4), transparent 50%),
    radial-gradient(1px 1px at 70% 50%, rgba(216,207,184,0.3), transparent 50%),
    radial-gradient(2px 2px at 40% 70%, rgba(216,207,184,0.35), transparent 50%),
    radial-gradient(1px 1px at 85% 20%, rgba(216,207,184,0.4), transparent 50%),
    radial-gradient(1.5px 1.5px at 25% 85%, rgba(216,207,184,0.3), transparent 50%);
  background-size: 100% 100%;
  animation: drift 30s linear infinite;
  opacity: 0.5;
}
@keyframes drift {
  0%   { transform: translate(0, 0); }
  100% { transform: translate(40px, -60px); }
}

/* ===== SCANLINE FLASH on transitions ===== */
.flash {
  position: fixed; inset: 0;
  z-index: 200;
  pointer-events: none;
  opacity: 0;
}
.flash.up {
  background: radial-gradient(ellipse at center, rgba(142,192,80,0.45) 0%, rgba(90,138,58,0.2) 40%, transparent 70%);
  animation: flashUp 700ms ease-out;
}
.flash.down {
  background: radial-gradient(ellipse at center, rgba(208,64,48,0.55) 0%, rgba(154,42,34,0.3) 40%, transparent 70%);
  animation: flashDown 700ms ease-out;
}
@keyframes flashUp   { 0% {opacity:0} 15% {opacity:1} 100% {opacity:0} }
@keyframes flashDown { 0% {opacity:0} 15% {opacity:1} 100% {opacity:0} }

/* Shake */
.shake { animation: shake 500ms cubic-bezier(.36,.07,.19,.97); }
@keyframes shake {
  0%, 100% { transform: translate(0,0); }
  10% { transform: translate(-10px,-3px) rotate(-0.6deg); }
  20% { transform: translate(9px,4px)   rotate(0.5deg); }
  30% { transform: translate(-11px,1px) rotate(-0.4deg); }
  40% { transform: translate(8px,-3px)  rotate(0.3deg); }
  50% { transform: translate(-6px,2px); }
  60% { transform: translate(6px,-1px); }
  70% { transform: translate(-3px,1px); }
  80% { transform: translate(3px,-1px); }
}

/* Door slam — used on scene-1 entry, cell door dropping in */
.door-slam {
  position: fixed; inset: 0;
  z-index: 250;
  pointer-events: none;
  display: flex;
  animation: doorSlam 1200ms cubic-bezier(.5,.05,.6,.95) forwards;
}
.door-slam .panel {
  flex: 1;
  background: linear-gradient(180deg, #050505, #1a1a1a 50%, #050505);
  border-right: 4px solid #0a0a0a;
  position: relative;
}
.door-slam .panel:nth-child(2) {
  background: linear-gradient(180deg, #050505, #1a1a1a 50%, #050505);
  border-right: none;
}
.door-slam .panel::after {
  content: "";
  position: absolute; inset: 30% 10% 30% 10%;
  background: repeating-linear-gradient(
    90deg,
    transparent 0,
    transparent 12%,
    rgba(255,255,255,0.04) 12%,
    rgba(255,255,255,0.04) 13%
  );
}
@keyframes doorSlam {
  0%   { transform: translateY(-100%); }
  60%  { transform: translateY(0); }
  68%  { transform: translateY(-2%); }
  76%  { transform: translateY(0); }
  100% { transform: translateY(0); opacity: 0; visibility: hidden; }
}

/* ========================================================
   APP LAYOUT
   ======================================================== */

.app {
  position: relative;
  min-height: 100vh;
  max-width: 920px;
  margin: 0 auto;
  padding: 20px clamp(14px, 4vw, 40px) 60px;
  z-index: 1;
}

/* ===== Top status bar — like CCTV HUD ===== */
.hud {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 10px;
  align-items: center;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--bone-dim);
  border-top: 1px solid rgba(216,207,184,0.18);
  border-bottom: 1px solid rgba(216,207,184,0.18);
  padding: 7px 0;
  margin-bottom: 20px;
}
.hud .rec {
  display: inline-flex; align-items: center; gap: 8px;
}
.hud .rec-dot {
  width: 8px; height: 8px;
  background: var(--bad-bright);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--bad-bright);
  animation: pulse 1.4s infinite;
}
.hud .loc { text-align: center; color: var(--bone); }
.hud .right { text-align: right; }
@keyframes pulse { 50% { opacity: 0.3; } }

/* ===== INTRO ===== */
.title-screen {
  text-align: center;
  padding: 40px 0 0;
}
.title-screen .logline {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.6em;
  color: var(--fluor);
  text-transform: uppercase;
  margin-bottom: 18px;
  opacity: 0.85;
}
.title-screen h1 {
  font-family: var(--tattoo);
  font-size: clamp(64px, 14vw, 140px);
  line-height: 0.85;
  margin: 0 0 12px;
  color: var(--bone);
  letter-spacing: 0.02em;
  text-shadow:
    3px 3px 0 var(--rust),
    6px 6px 0 rgba(0,0,0,0.7),
    0 0 30px rgba(200,147,42,0.15);
}
.title-screen .sub {
  font-family: var(--stencil);
  font-size: clamp(14px, 2.5vw, 18px);
  letter-spacing: 0.4em;
  color: var(--amber);
  margin-bottom: 36px;
  text-transform: uppercase;
}
.title-screen .pitch {
  max-width: 580px;
  margin: 0 auto 40px;
  text-align: left;
  background: rgba(20,15,10,0.85);
  border: 1px solid rgba(216,207,184,0.18);
  border-left: 3px solid var(--rust);
  padding: 24px 28px;
  font-size: 15px;
  line-height: 1.7;
  position: relative;
}
.title-screen .pitch::before {
  content: "ОРИЕНТИРОВКА · ДСП";
  position: absolute;
  top: -10px; left: 18px;
  background: var(--bg-deep);
  padding: 0 10px;
  font-family: var(--stencil);
  font-size: 11px;
  letter-spacing: 0.3em;
  color: var(--amber);
}
.title-screen .pitch p { margin: 0 0 12px; }
.title-screen .pitch p:last-child { margin-bottom: 0; }
.title-screen .pitch em { color: var(--amber-bright); font-style: normal; }

.btn-play {
  font-family: var(--stencil);
  font-size: clamp(22px, 4vw, 30px);
  letter-spacing: 0.2em;
  background: var(--rust);
  color: var(--bone);
  border: none;
  padding: 22px 56px;
  cursor: pointer;
  position: relative;
  text-transform: uppercase;
  box-shadow: 6px 6px 0 rgba(0,0,0,0.7), inset 0 0 0 2px rgba(216,207,184,0.2);
  transition: transform 80ms, box-shadow 80ms;
}
.btn-play:hover { background: var(--rust-bright); }
.btn-play:active {
  transform: translate(4px, 4px);
  box-shadow: 2px 2px 0 rgba(0,0,0,0.7), inset 0 0 0 2px rgba(216,207,184,0.2);
}
.btn-play::before, .btn-play::after {
  content: "✦"; color: var(--amber); margin: 0 16px; font-size: 0.7em;
}

/* ===== POSTER (title screen redesign) ===== */
.title-screen.poster {
  text-align: center;
  padding: 0;
  position: relative;
}
.title-screen.poster .barbed {
  width: 100%;
  height: 32px;
  display: block;
  margin: 0;
  overflow: visible;
  opacity: 0.85;
}
.title-screen.poster .barbed.top    { margin-bottom: 26px; }
.title-screen.poster .barbed.bottom { margin-top: 30px; }

.title-screen.poster .logline {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.55em;
  color: var(--fluor);
  text-transform: uppercase;
  margin-bottom: 14px;
  opacity: 0.9;
}

.poster-title-wrap {
  position: relative;
  display: inline-block;
  margin-bottom: 6px;
  line-height: 0.85;
}
.poster-title {
  font-family: var(--tattoo);
  font-size: clamp(96px, 22vw, 240px);
  line-height: 0.82;
  margin: 0;
  color: var(--bone);
  letter-spacing: 0.04em;
  position: relative;
  z-index: 2;
  text-shadow:
    4px 4px 0 var(--rust),
    8px 8px 0 var(--blood),
    0 0 40px rgba(200,147,42,0.25);
  animation: titleIn 1.4s ease-out;
}
@keyframes titleIn {
  0%   { opacity: 0; transform: scale(0.7) translateY(40px); letter-spacing: 0.4em; }
  50%  { opacity: 1; }
  100% { opacity: 1; transform: scale(1) translateY(0); letter-spacing: 0.04em; }
}
.poster-title-shadow {
  position: absolute;
  inset: 0;
  font-family: var(--tattoo);
  font-size: clamp(96px, 22vw, 240px);
  line-height: 0.82;
  letter-spacing: 0.04em;
  color: transparent;
  -webkit-text-stroke: 1px rgba(216,207,184,0.18);
  z-index: 1;
  transform: translate(-10px, -8px);
  pointer-events: none;
}

.poster-orna {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin: 6px 0 20px;
}
.poster-orna .star {
  width: clamp(28px, 5vw, 42px);
  height: clamp(28px, 5vw, 42px);
  flex: none;
  filter: drop-shadow(0 0 6px rgba(200,147,42,0.35));
  animation: starSpin 30s linear infinite;
}
@keyframes starSpin { to { transform: rotate(360deg); } }
.poster-orna .creed {
  font-family: var(--stencil);
  font-size: clamp(11px, 2vw, 14px);
  letter-spacing: 0.5em;
  color: var(--amber);
  text-transform: uppercase;
  padding: 0 4px;
  white-space: nowrap;
}

.title-screen.poster .sub {
  font-family: var(--stencil);
  font-size: clamp(11px, 2vw, 14px);
  letter-spacing: 0.45em;
  color: var(--bone-dim);
  margin-bottom: 36px;
  text-transform: uppercase;
}

/* Dossier with hand-on-bars composition */
.dossier-wrap {
  position: relative;
  max-width: 640px;
  margin: 0 auto 36px;
  display: grid;
  grid-template-columns: 1fr;
}
.hand-bars {
  position: absolute;
  left: -120px;
  top: -20px;
  width: 220px;
  height: 320px;
  z-index: 0;
  opacity: 0.85;
  filter: drop-shadow(2px 4px 12px rgba(0,0,0,0.7));
  pointer-events: none;
}
.pitch.dossier {
  position: relative;
  z-index: 1;
  background: rgba(20,15,10,0.92);
  border: 1px solid rgba(216,207,184,0.22);
  border-left: 3px solid var(--rust);
  padding: 28px 30px 22px;
  font-size: 15px;
  line-height: 1.7;
  color: var(--bone);
  text-align: left;
  margin-left: 60px;
  box-shadow:
    6px 6px 0 rgba(0,0,0,0.7),
    inset 0 0 0 1px rgba(0,0,0,0.6);
}
.pitch.dossier::before {
  /* tape strip */
  content: "";
  position: absolute;
  top: -12px; left: 30px;
  width: 90px; height: 22px;
  background: rgba(200,180,140,0.22);
  border: 1px dashed rgba(216,207,184,0.35);
  transform: rotate(-3deg);
  box-shadow: 0 2px 6px rgba(0,0,0,0.5);
}
.dossier-meta {
  font-family: var(--stencil);
  font-size: 11px;
  letter-spacing: 0.4em;
  color: var(--amber);
  text-transform: uppercase;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px dashed rgba(216,207,184,0.18);
}
.pitch.dossier p { margin: 0 0 10px; }
.pitch.dossier p:last-of-type { margin-bottom: 14px; }
.dossier-line {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--bone-dim);
  text-transform: uppercase;
  padding: 6px 0;
  border-top: 1px dotted rgba(216,207,184,0.15);
}
.dossier-line .v {
  color: var(--bone);
  margin-right: 14px;
  letter-spacing: 0.05em;
  text-transform: none;
}
.dossier-stamp {
  position: absolute;
  bottom: -16px; right: -10px;
  font-family: var(--stencil);
  font-size: 14px;
  letter-spacing: 0.3em;
  color: var(--rust);
  background: rgba(20,15,10,0.95);
  padding: 6px 14px;
  border: 2px solid var(--rust);
  transform: rotate(-8deg);
  box-shadow: 0 0 0 1px rgba(154,58,34,0.4) inset;
  text-transform: uppercase;
}

/* Big ink-stamp button */
.btn-play.big {
  font-family: var(--stencil);
  font-size: clamp(26px, 5vw, 38px);
  letter-spacing: 0.22em;
  background: var(--rust);
  color: var(--bone);
  border: none;
  padding: 24px 60px 18px;
  cursor: pointer;
  position: relative;
  text-transform: uppercase;
  box-shadow:
    8px 8px 0 rgba(0,0,0,0.75),
    inset 0 0 0 2px rgba(216,207,184,0.22),
    inset 0 0 0 6px transparent,
    inset 0 0 0 7px rgba(216,207,184,0.12);
  transition: transform 80ms, box-shadow 80ms, background 200ms;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.btn-play.big::before, .btn-play.big::after { content: none; }
.btn-play.big .btn-main { line-height: 1; }
.btn-play.big .btn-sub {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.45em;
  color: rgba(216,207,184,0.55);
}
.btn-play.big:hover { background: var(--rust-bright); }
.btn-play.big:active {
  transform: translate(5px, 5px);
  box-shadow:
    3px 3px 0 rgba(0,0,0,0.75),
    inset 0 0 0 2px rgba(216,207,184,0.22),
    inset 0 0 0 7px rgba(216,207,184,0.12);
}

@media (max-width: 700px) {
  .hand-bars { display: none; }
  .pitch.dossier { margin-left: 0; }
  .poster-title { text-shadow: 3px 3px 0 var(--rust), 6px 6px 0 var(--blood); }
  .poster-title-shadow { transform: translate(-6px, -5px); }
  .poster-orna .creed { letter-spacing: 0.32em; font-size: 11px; }
  .dossier-stamp { font-size: 11px; padding: 4px 10px; right: 8px; }
}

/* ===== STAT BAR (rank + health) ===== */
.statbar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 22px;
}
.stat-card {
  background: rgba(15,12,8,0.85);
  border: 1px solid rgba(216,207,184,0.15);
  padding: 10px 14px;
}
.stat-card .lbl {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.3em;
  color: var(--bone-dim);
  text-transform: uppercase;
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
}
.stat-card .val {
  font-family: var(--tattoo);
  font-size: clamp(20px, 4vw, 28px);
  line-height: 1;
  color: var(--bone);
  letter-spacing: 0.02em;
  transition: color 200ms;
}
.stat-card.rank .val { color: var(--amber-bright); }
.stat-card .val.up   { animation: pump 600ms cubic-bezier(.18,.89,.32,1.28); color: var(--good-bright); }
.stat-card .val.down { animation: pumpDown 600ms ease-out; color: var(--bad-bright); }
@keyframes pump {
  0% { transform: scale(0.7) translateY(8px); opacity: 0; }
  50% { transform: scale(1.18); }
  100% { transform: scale(1); }
}
@keyframes pumpDown {
  0% { transform: scale(1.25) translateY(-4px); opacity: 0; }
  50% { transform: scale(0.88); }
  100% { transform: scale(1); }
}

/* Rank ladder mini */
.ladder {
  display: flex;
  gap: 2px;
  margin-top: 8px;
  height: 6px;
}
.ladder-step {
  flex: 1;
  background: rgba(216,207,184,0.10);
  transition: all 200ms;
}
.ladder-step.passed { background: rgba(200,147,42,0.4); }
.ladder-step.current {
  background: var(--amber-bright);
  box-shadow: 0 0 10px var(--amber-bright);
}

/* Health bar */
.hpbar {
  height: 8px;
  background: rgba(216,207,184,0.10);
  margin-top: 6px;
  position: relative;
  overflow: hidden;
}
.hpbar .fill {
  height: 100%;
  background: linear-gradient(90deg, var(--blood), var(--bad-bright));
  transition: width 500ms;
  box-shadow: 0 0 8px rgba(208,64,48,0.5);
}

/* ===== LOG (recent rank/event changes) ===== */
.log {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--bone-dim);
  text-transform: uppercase;
  text-align: right;
  min-height: 14px;
  margin-bottom: 10px;
  opacity: 0.8;
}
.log .item { display: inline-block; margin-left: 14px; }
.log .item.up   { color: var(--good-bright); }
.log .item.down { color: var(--bad-bright); }

/* ===== SCENE CARD ===== */
.scene {
  position: relative;
  margin-bottom: 24px;
}
.scene .location {
  font-family: var(--stencil);
  font-size: 11px;
  letter-spacing: 0.3em;
  color: var(--fluor);
  text-transform: uppercase;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px dashed rgba(110,163,140,0.35);
}
.scene .location .day {
  color: var(--bone-dim);
  margin-left: 12px;
  font-family: var(--mono);
  letter-spacing: 0.15em;
}

/* Narration text — typed reveal */
.narration {
  font-family: var(--type);
  font-size: clamp(16px, 2.4vw, 19px);
  line-height: 1.65;
  color: var(--bone);
  white-space: pre-wrap;
}
.narration p {
  margin: 0 0 14px;
}
.narration p:last-child { margin-bottom: 0; }
.narration .dialog {
  display: block;
  padding: 6px 0 6px 18px;
  border-left: 2px solid var(--amber);
  color: var(--amber-bright);
  font-style: italic;
  margin: 8px 0;
}
.narration .whisper {
  color: var(--bone-dim);
  font-size: 0.88em;
}
.narration .shout {
  font-family: var(--stencil);
  letter-spacing: 0.08em;
  color: var(--bad-bright);
  text-transform: uppercase;
  font-size: 1.05em;
}
.narration em {
  color: var(--amber-bright);
  font-style: normal;
}
.narration strong {
  color: var(--bone);
  font-weight: normal;
  background: rgba(154,58,34,0.25);
  padding: 0 4px;
  border-bottom: 1px solid var(--rust);
}

/* Typewriter cursor while typing */
.cursor {
  display: inline-block;
  width: 9px; height: 1.05em;
  background: var(--bone);
  margin-left: 3px;
  vertical-align: text-bottom;
  animation: blink 0.6s steps(2) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* Map for hata layout — small visual side */
.hata-map {
  display: inline-grid;
  grid-template-columns: repeat(5, 12px);
  gap: 2px;
  margin: 8px 0;
}
.hata-map div {
  width: 12px; height: 12px;
  background: var(--bone-faint);
  border: 1px solid rgba(0,0,0,0.4);
}

/* ===== CHOICES ===== */
.choices {
  display: grid;
  gap: 10px;
  margin-top: 24px;
}
.choice {
  text-align: left;
  background: var(--bg-card);
  border: 1px solid rgba(216,207,184,0.18);
  color: var(--bone);
  padding: 14px 18px 14px 56px;
  font-family: var(--type);
  font-size: 15px;
  line-height: 1.45;
  cursor: pointer;
  position: relative;
  transition: all 130ms;
}
.choice .letter {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  font-family: var(--stencil);
  font-size: 17px;
  color: var(--amber);
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--amber);
  background: rgba(200,147,42,0.1);
}
.choice .hint {
  display: block;
  margin-top: 4px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--bone-dim);
  letter-spacing: 0.08em;
}
.choice:hover:not(:disabled) {
  background: #251f17;
  border-color: var(--amber);
  transform: translateX(4px);
}
.choice:disabled { opacity: 0.5; cursor: default; }
.choice.taken {
  border-color: var(--amber-bright);
  background: rgba(200,147,42,0.15);
  color: var(--amber-bright);
}
.choice.locked {
  background: rgba(0,0,0,0.3);
  color: var(--bone-faint);
  border-style: dashed;
}
.choice.locked .letter {
  color: var(--bone-faint);
  border-color: var(--bone-faint);
  background: transparent;
}

/* Continue / next button when no choice (narrative) */
.btn-next {
  width: 100%;
  font-family: var(--stencil);
  font-size: 16px;
  letter-spacing: 0.25em;
  background: transparent;
  color: var(--amber);
  border: 2px solid var(--amber);
  padding: 14px;
  cursor: pointer;
  text-transform: uppercase;
  transition: all 130ms;
  margin-top: 18px;
}
.btn-next:hover {
  background: var(--amber);
  color: var(--ink);
}

/* Skip-typewriter cue */
.skip-cue {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.25em;
  color: var(--bone-dim);
  text-transform: uppercase;
  margin-top: 10px;
  text-align: right;
  opacity: 0.6;
  cursor: pointer;
}
.skip-cue:hover { opacity: 1; color: var(--amber); }

/* ===== FEEDBACK STRIP (after a choice) ===== */
.feedback {
  margin: 18px 0 0;
  padding: 14px 18px;
  border-left: 3px solid;
  background: rgba(0,0,0,0.45);
  font-family: var(--stencil);
  font-size: clamp(15px, 2.6vw, 18px);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  animation: feedIn 300ms ease;
}
@keyframes feedIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
.feedback.good { border-color: var(--good-bright); color: var(--good-bright); }
.feedback.bad  { border-color: var(--bad-bright);  color: var(--bad-bright); }
.feedback.neutral { border-color: var(--amber); color: var(--amber); }
.feedback .meta {
  display: block;
  margin-top: 6px;
  font-family: var(--type);
  font-size: 13px;
  letter-spacing: 0;
  color: var(--bone-dim);
  text-transform: none;
}

/* ===== ENDING ===== */
.ending {
  text-align: center;
  padding: 40px 0 0;
  animation: verdictIn 800ms cubic-bezier(.18,.89,.32,1.28);
}
@keyframes verdictIn {
  0% { opacity: 0; transform: scale(0.92); }
  100% { opacity: 1; transform: scale(1); }
}
.ending h1 {
  font-family: var(--tattoo);
  font-size: clamp(32px, 7vw, 56px);
  letter-spacing: 0.12em;
  color: var(--bone);
  margin: 0 0 6px;
  text-shadow: 2px 2px 0 var(--ink);
}
.ending .sub {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.5em;
  color: var(--bone-dim);
  text-transform: uppercase;
  margin-bottom: 32px;
}

.stamp-wrap { display: inline-block; margin: 0 auto 28px; position: relative; }
.stamp {
  border: 6px double var(--rust);
  color: var(--rust);
  padding: 22px 36px;
  transform: rotate(-6deg);
  background: rgba(20,15,10,0.4);
  position: relative;
  animation: stampDown 600ms cubic-bezier(.36,.07,.19,.97);
  box-shadow: inset 0 0 0 1px rgba(154,58,34,0.5);
}
.stamp.green { border-color: var(--good-bright); color: var(--good-bright); }
.stamp.black { border-color: var(--bone); color: var(--bone); transform: rotate(3deg); }
@keyframes stampDown {
  0%   { transform: rotate(-6deg) scale(3); opacity: 0; }
  60%  { transform: rotate(-6deg) scale(1.1); opacity: 1; }
  100% { transform: rotate(-6deg) scale(1); }
}
.stamp .corner {
  position: absolute; width: 10px; height: 10px; border: 2px solid currentColor;
}
.stamp .corner.tl { top: 4px; left: 4px;  border-right: none; border-bottom: none; }
.stamp .corner.tr { top: 4px; right: 4px; border-left: none;  border-bottom: none; }
.stamp .corner.bl { bottom: 4px; left: 4px;  border-right: none; border-top: none; }
.stamp .corner.br { bottom: 4px; right: 4px; border-left: none;  border-top: none; }
.stamp .small {
  font-family: var(--stencil);
  font-size: 12px;
  letter-spacing: 0.4em;
}
.stamp .big {
  font-family: var(--tattoo);
  font-size: clamp(34px, 7vw, 56px);
  letter-spacing: 0.05em;
  margin: 4px 0;
  line-height: 1;
}

.ending-stats {
  display: flex;
  justify-content: center;
  gap: 22px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}
.ending-stats .stat .num {
  font-family: var(--tattoo);
  font-size: 40px;
  color: var(--amber);
  line-height: 1;
}
.ending-stats .stat .lbl {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.3em;
  color: var(--bone-dim);
  text-transform: uppercase;
  margin-top: 6px;
}

.ending-text {
  max-width: 560px;
  margin: 0 auto 32px;
  background: rgba(15,12,8,0.85);
  border: 1px solid rgba(216,207,184,0.18);
  padding: 22px 26px;
  text-align: left;
  font-size: 15px;
  line-height: 1.7;
}
.ending-text.good { border-left: 3px solid var(--good-bright); }
.ending-text.bad  { border-left: 3px solid var(--bad-bright); }
.ending-text.amber{ border-left: 3px solid var(--amber); }
.ending-text p:first-child { margin-top: 0; }
.ending-text p:last-child  { margin-bottom: 0; }
.ending-text em { color: var(--amber-bright); font-style: normal; }

/* Path history */
.path-history {
  max-width: 560px;
  margin: 0 auto 32px;
  text-align: left;
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(216,207,184,0.12);
  padding: 16px 20px;
}
.path-history .h {
  font-family: var(--stencil);
  font-size: 11px;
  letter-spacing: 0.3em;
  color: var(--amber);
  text-transform: uppercase;
  margin-bottom: 10px;
  text-align: center;
}
.path-history ol {
  margin: 0; padding: 0 0 0 22px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  color: var(--bone-dim);
  line-height: 1.6;
}
.path-history ol li { padding: 2px 0; }
.path-history ol li.up { color: var(--good-bright); }
.path-history ol li.down { color: var(--bad-bright); }

.btn-replay {
  font-family: var(--stencil);
  font-size: 18px;
  letter-spacing: 0.25em;
  background: transparent;
  color: var(--bone);
  border: 2px solid var(--bone);
  padding: 16px 32px;
  cursor: pointer;
  text-transform: uppercase;
  transition: all 130ms;
}
.btn-replay:hover { background: var(--bone); color: var(--ink); }

/* ===== Blood drip on rank-down (cosmetic) ===== */
.blood-drip {
  position: fixed;
  top: 0; left: 20%;
  width: 3px;
  background: linear-gradient(180deg, var(--blood), transparent);
  pointer-events: none;
  z-index: 30;
  animation: dripFall 1.6s ease-in forwards;
}
@keyframes dripFall {
  0% { height: 0; opacity: 0; }
  15% { opacity: 1; }
  100% { height: 60vh; opacity: 0.7; }
}

/* ===== MOBILE ===== */
@media (max-width: 600px) {
  .app { padding: 14px 12px 40px; }
  .hud { font-size: 9px; letter-spacing: 0.1em; }
  .title-screen { padding-top: 24px; }
  .title-screen .pitch { padding: 18px 18px; font-size: 14px; }
  .scene .location { font-size: 10px; }
  .choice { padding: 12px 12px 12px 50px; font-size: 14px; }
  .choice .letter { width: 26px; height: 26px; font-size: 15px; left: 10px; }
  .ending-stats { gap: 14px; }
  .ending-stats .stat .num { font-size: 32px; }
  .stamp { padding: 18px 26px; }
  .statbar { gap: 10px; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
