/* styles.css — SacrifAIce visual system
   ───────────────────────────────────────────────────────────────────────
   Two switching axes:
     html[data-culture="…"]  → palette + ornament hue
     html[data-phase="…"]    → atmosphere intensity (set in JS by ramping
                               the --atm-* custom props toward phase targets)
   ─────────────────────────────────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500&family=Cormorant+SC:wght@400;500;600;700&family=JetBrains+Mono:wght@300;400;500&display=swap');

/* ─── ROOT TOKENS ─────────────────────────────────────────────────────── */
:root {
  /* Atmosphere defaults (overridden per-phase by JS via inline style) */
  --atm-vignette: 0.55;
  --atm-grain: 0.35;
  --atm-candle: 0.7;
  --atm-blood: 0;
  --atm-desat: 0.15;
  --atm-hue: 0deg;
  --atm-shake: 0;
  --atm-blur: 0;

  /* Default palette (liminal) */
  --bg: #0a0b0d;
  --primary: #1a1d22;
  --secondary: #2c2a25;
  --accent: #a89878;
  --text-1: #d8d2c4;
  --text-2: rgba(216, 210, 196, 0.55);
  --culture-hue: 30;
  --culture-overlay: 0.04;

  /* Type */
  --font-display: "Cormorant SC", "Cormorant Garamond", serif;
  --font-body: "Cormorant Garamond", "Georgia", serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;

  /* Spacing scale */
  --s1: 4px;  --s2: 8px;  --s3: 12px; --s4: 16px;
  --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px;

  /* Sizes */
  --hairline: 0.5px;
  --line-thick: 1px;

  color-scheme: dark;
}

/* ─── BASE ────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  width: 100%; height: 100%;
  background: var(--bg);
  color: var(--text-1);
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.55;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; color: inherit; }

/* ─── STAGE ───────────────────────────────────────────────────────────── */
.stage {
  position: fixed; inset: 0;
  overflow: hidden;
  isolation: isolate;
  filter:
    saturate(calc(1 - var(--atm-desat)))
    hue-rotate(var(--atm-hue))
    blur(calc(var(--atm-blur) * 1px));
  transition: filter 800ms cubic-bezier(.4,.2,.2,1);
}

/* Screen shake for ritual peak */
@keyframes shake {
  0%   { transform: translate(0,0) }
  10%  { transform: translate(-1px, 1px) }
  20%  { transform: translate(1px, -1px) }
  30%  { transform: translate(-2px, 0px) }
  40%  { transform: translate(2px, 1px) }
  50%  { transform: translate(0px, -2px) }
  60%  { transform: translate(-1px, 2px) }
  70%  { transform: translate(1px, -1px) }
  80%  { transform: translate(-2px, 1px) }
  90%  { transform: translate(0, 0) }
  100% { transform: translate(0, 0) }
}
.stage[data-shake="1"] { animation: shake 280ms linear infinite; }

/* ─── ATMOSPHERE LAYERS ────────────────────────────────────────────────
   Order (front→back): grain → vignette → candle glow → culture overlay → bg color
   ─────────────────────────────────────────────────────────────────────── */

/* Vignette — fades from transparent center to bg edges */
.atm-vignette {
  position: absolute; inset: 0;
  pointer-events: none;
  background: radial-gradient(
    ellipse at center,
    transparent 0%,
    transparent 30%,
    rgba(0,0,0, calc(var(--atm-vignette) * 0.45)) 60%,
    rgba(0,0,0, var(--atm-vignette)) 100%
  );
  z-index: 80;
  transition: background 700ms;
}

/* Film grain — animated SVG noise */
.atm-grain {
  position: absolute; inset: -10%;
  pointer-events: none;
  opacity: var(--atm-grain);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='2.8' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.85   0 0 0 0 0.82   0 0 0 0 0.74  0 0 0 1 0'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='0.8'/></svg>");
  mix-blend-mode: overlay;
  z-index: 90;
  animation: grainShake 0.6s steps(3) infinite;
}
@keyframes grainShake {
  0%   { transform: translate(0,0) }
  33%  { transform: translate(-2%, 1%) }
  66%  { transform: translate(1%, -2%) }
  100% { transform: translate(0, 0) }
}

/* Candle warm glow — radial, slow flicker */
.atm-candle {
  position: absolute; inset: 0;
  pointer-events: none;
  background: radial-gradient(
    ellipse 70% 60% at 50% 55%,
    rgba(255, 170, 90, calc(var(--atm-candle) * 0.18)) 0%,
    rgba(255, 140, 60, calc(var(--atm-candle) * 0.08)) 25%,
    transparent 60%
  );
  mix-blend-mode: screen;
  z-index: 70;
  animation: candleFlicker 3.2s ease-in-out infinite;
}
@keyframes candleFlicker {
  0%, 100% { opacity: 1; }
  20%      { opacity: 0.85; }
  35%      { opacity: 1.05; }
  50%      { opacity: 0.78; }
  65%      { opacity: 1; }
  80%      { opacity: 0.92; }
}

/* Blood overlay — pulses at ritual peak */
.atm-blood {
  position: absolute; inset: 0;
  pointer-events: none;
  opacity: var(--atm-blood);
  background:
    radial-gradient(circle at 50% 50%, rgba(120, 10, 18, 0.5) 0%, rgba(140, 8, 18, 0.75) 70%, rgba(60, 0, 6, 0.95) 100%);
  mix-blend-mode: multiply;
  z-index: 85;
  transition: opacity 700ms ease;
}
.atm-blood[data-pulse="1"] {
  animation: bloodPulse 1.4s ease-in-out infinite;
}
@keyframes bloodPulse {
  0%, 100% { opacity: var(--atm-blood); }
  50%      { opacity: calc(var(--atm-blood) * 1.15); }
}

/* Culture overlay — subtle color wash specific to active preset */
.atm-culture {
  position: absolute; inset: 0;
  pointer-events: none;
  background: hsl(var(--culture-hue), 40%, 35%);
  opacity: var(--culture-overlay);
  mix-blend-mode: soft-light;
  z-index: 60;
  transition: opacity 700ms, background 700ms;
}

/* Dust particles — 5 floating divs */
.atm-dust { position: absolute; inset: 0; pointer-events: none; z-index: 75; }
.atm-dust i {
  position: absolute;
  width: 2px; height: 2px;
  border-radius: 50%;
  background: rgba(255, 230, 180, 0.5);
  filter: blur(0.5px);
  animation: dustFloat 14s linear infinite;
  opacity: calc(var(--atm-candle) * 0.7);
}
.atm-dust i:nth-child(1) { left: 18%; animation-duration: 18s; animation-delay: -2s; }
.atm-dust i:nth-child(2) { left: 33%; animation-duration: 22s; animation-delay: -8s; }
.atm-dust i:nth-child(3) { left: 52%; animation-duration: 16s; animation-delay: -5s; }
.atm-dust i:nth-child(4) { left: 71%; animation-duration: 20s; animation-delay: -12s; }
.atm-dust i:nth-child(5) { left: 88%; animation-duration: 24s; animation-delay: -1s; }
@keyframes dustFloat {
  0%   { transform: translateY(110vh) translateX(0); opacity: 0; }
  10%  { opacity: var(--atm-candle); }
  90%  { opacity: var(--atm-candle); }
  100% { transform: translateY(-10vh) translateX(40px); opacity: 0; }
}

/* Culture-specific drift overlay (snow / sand / etc) */
.atm-pattern { position: absolute; inset: 0; pointer-events: none; z-index: 72; opacity: 0.55; }
.atm-pattern i {
  position: absolute;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  opacity: 0;
  animation: patternDrift 22s linear infinite;
}

@keyframes patternDrift {
  0%   { transform: translateY(-5vh) translateX(0); opacity: 0; }
  15%  { opacity: 0.5; }
  85%  { opacity: 0.5; }
  100% { transform: translateY(110vh) translateX(60px); opacity: 0; }
}

/* ─── GAME FRAME ──────────────────────────────────────────────────────── */
.game {
  position: relative;
  width: 100%; height: 100%;
  z-index: 1;
  display: grid;
  grid-template-rows: 1fr auto;
}

.game-main {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 320px;
  overflow: hidden;
}
.game-main[data-no-ticker="1"] {
  grid-template-columns: 1fr;
}

.scene {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 72px var(--s7) var(--s5);
  min-height: 0;
}

/* ─── PORTRAIT FRAME ──────────────────────────────────────────────────── */
.portrait {
  position: relative;
  width: 280px; height: 320px;
  display: flex; align-items: center; justify-content: center;
  animation: breathe 5.5s ease-in-out infinite;
}
@keyframes breathe {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.012); }
}

.portrait-inner {
  position: relative;
  width: 100%; height: 100%;
  background:
    radial-gradient(ellipse at 50% 35%, rgba(255, 220, 170, 0.14) 0%, transparent 70%),
    linear-gradient(180deg,
      color-mix(in oklab, var(--primary) 70%, #2a2620) 0%,
      color-mix(in oklab, var(--bg) 80%, #1a1814) 100%);
  border: 1px solid var(--accent);
  box-shadow:
    inset 0 0 40px rgba(0,0,0,0.6),
    0 0 40px rgba(0,0,0,0.5);
  overflow: hidden;
}

/* Inner inset border (creates double-frame ritual look) */
.portrait-inner::before {
  content: '';
  position: absolute;
  inset: 6px;
  border: var(--hairline) solid rgba(255,255,255,0.08);
  pointer-events: none;
}

/* The silhouette inside */
.portrait-silhouette {
  position: absolute;
  inset: 0;
  display: flex; align-items: flex-end; justify-content: center;
}
.portrait-silhouette svg { width: 78%; height: 88%; }
.portrait-silhouette .portrait-img {
  position: absolute;
  inset: 4%;
  width: 92%; height: 92%;
  object-fit: cover;
  border-radius: 4px;
  filter: contrast(1.05) saturate(0.85) brightness(0.92);
  box-shadow: inset 0 -40px 60px rgba(0,0,0,0.6), inset 0 0 80px rgba(0,0,0,0.5);
  mix-blend-mode: normal;
}
.portrait-silhouette path,
.portrait-silhouette ellipse,
.portrait-silhouette circle {
  fill: rgba(0, 0, 0, 0.85);
  stroke: rgba(255, 240, 200, 0.18);
  stroke-width: 0.8;
}

/* Corner ornaments */
.portrait-corner {
  position: absolute;
  width: 24px; height: 24px;
  color: var(--accent);
  font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  letter-spacing: 0;
  opacity: 0.85;
  pointer-events: none;
}
.portrait-corner.tl { top: -2px; left: -2px;
  border-top: var(--hairline) solid var(--accent); border-left: var(--hairline) solid var(--accent); }
.portrait-corner.tr { top: -2px; right: -2px;
  border-top: var(--hairline) solid var(--accent); border-right: var(--hairline) solid var(--accent); }
.portrait-corner.bl { bottom: -2px; left: -2px;
  border-bottom: var(--hairline) solid var(--accent); border-left: var(--hairline) solid var(--accent); }
.portrait-corner.br { bottom: -2px; right: -2px;
  border-bottom: var(--hairline) solid var(--accent); border-right: var(--hairline) solid var(--accent); }

/* Outer extension lines from corners */
.portrait-corner::before {
  content: '';
  position: absolute;
  background: var(--accent);
  opacity: 0.4;
}
.portrait-corner.tl::before { top: 0; left: -32px; width: 32px; height: var(--hairline); }
.portrait-corner.tr::before { top: 0; right: -32px; width: 32px; height: var(--hairline); }
.portrait-corner.bl::before { bottom: 0; left: -32px; width: 32px; height: var(--hairline); }
.portrait-corner.br::before { bottom: 0; right: -32px; width: 32px; height: var(--hairline); }

.portrait-corner::after {
  content: '';
  position: absolute;
  background: var(--accent);
  opacity: 0.4;
}
.portrait-corner.tl::after { left: 0; top: -32px; height: 32px; width: var(--hairline); }
.portrait-corner.tr::after { right: 0; top: -32px; height: 32px; width: var(--hairline); }
.portrait-corner.bl::after { left: 0; bottom: -32px; height: 32px; width: var(--hairline); }
.portrait-corner.br::after { right: 0; bottom: -32px; height: 32px; width: var(--hairline); }

/* Depth behind the portrait (corridor-of-doors mood for INTRO) */
.depth {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 70%; height: 100%;
  pointer-events: none;
  z-index: 0;
  display: flex; align-items: center; justify-content: center;
  perspective: 1200px;
}
.depth-doors {
  position: relative;
  width: 100%; height: 70%;
  transform-style: preserve-3d;
}
.depth-doors .door {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 110px;
  height: 220px;
  border: var(--hairline) solid var(--accent);
  background: linear-gradient(180deg, transparent 0%, rgba(0,0,0,0.4) 100%);
  transform: translate(-50%, -50%) translateZ(var(--z, 0)) scale(var(--sc, 1));
  opacity: var(--op, 0.3);
}
.depth-doors .door::before {
  content: '';
  position: absolute;
  inset: 4px;
  border: var(--hairline) solid rgba(255,255,255,0.06);
}

/* ─── DIALOGUE BOX ────────────────────────────────────────────────────── */
.dialogue {
  position: relative;
  background: rgba(8, 8, 10, 0.82);
  backdrop-filter: blur(10px) saturate(140%);
  -webkit-backdrop-filter: blur(10px) saturate(140%);
  border-top: var(--hairline) solid var(--accent);
  padding: var(--s5) var(--s7);
  min-height: 25vh;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto auto;
  column-gap: var(--s5);
  row-gap: var(--s3);
  z-index: 50;
}

/* accent line on top */
.dialogue::before {
  content: '';
  position: absolute;
  top: -1px; left: 50%;
  transform: translateX(-50%);
  width: 60%; height: 1px;
  background: linear-gradient(90deg, transparent 0%, var(--accent) 30%, var(--accent) 70%, transparent 100%);
  opacity: 0.6;
}

.dlg-speaker {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: var(--s3);
}
.dlg-speaker::after {
  content: '';
  flex: 1; height: var(--hairline);
  background: linear-gradient(90deg, var(--accent), transparent);
  opacity: 0.4;
}
.dlg-speaker-role {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 300;
  letter-spacing: 0.1em;
  text-transform: none;
  color: var(--text-2);
}

.dlg-text {
  font-family: var(--font-body);
  font-size: 22px;
  line-height: 1.5;
  color: var(--text-1);
  font-weight: 400;
  text-wrap: pretty;
  min-height: 2.5em;
  letter-spacing: 0.005em;
}

.dlg-text em.cursor {
  display: inline-block;
  width: 0.45em;
  height: 1.05em;
  background: var(--accent);
  vertical-align: -0.18em;
  margin-left: 0.18em;
  animation: cursorBlink 1.1s steps(2) infinite;
}
@keyframes cursorBlink {
  0%, 50% { opacity: 1 }
  51%, 100% { opacity: 0 }
}

.dlg-continue {
  align-self: end;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.18em;
  color: var(--accent);
  display: flex; align-items: center; gap: var(--s2);
  opacity: 0.85;
}
.dlg-continue .tri {
  display: inline-block;
  width: 0; height: 0;
  border-left: 7px solid var(--accent);
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  animation: triPulse 1.4s ease-in-out infinite;
}
@keyframes triPulse {
  0%, 100% { transform: translateX(0); opacity: 0.6; }
  50%      { transform: translateX(4px); opacity: 1; }
}

.dlg-choices {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: var(--s2);
  margin-top: var(--s3);
}

.dlg-choice {
  appearance: none;
  background: transparent;
  border: var(--hairline) solid rgba(255,255,255,0.12);
  border-left: 2px solid transparent;
  padding: 10px 18px;
  font-family: var(--font-body);
  font-size: 17px;
  text-align: left;
  color: var(--text-1);
  cursor: pointer;
  transition: all 180ms ease;
  position: relative;
  letter-spacing: 0.01em;
}
.dlg-choice::before {
  content: '›';
  position: absolute;
  left: 6px; top: 50%;
  transform: translateY(-50%);
  color: var(--accent);
  opacity: 0;
  transition: opacity 180ms ease, transform 180ms ease;
  font-family: var(--font-mono);
}
.dlg-choice:hover {
  border-left-color: var(--accent);
  background: rgba(255,255,255,0.03);
  padding-left: 28px;
}
.dlg-choice:hover::before {
  opacity: 1;
  transform: translate(4px, -50%);
}

/* ─── EVENT TICKER ────────────────────────────────────────────────────── */
.ticker {
  position: relative;
  background: linear-gradient(180deg, rgba(0,0,0,0.4) 0%, rgba(0,0,0,0.7) 100%);
  border-left: var(--hairline) solid rgba(255,255,255,0.08);
  overflow: hidden;
  z-index: 40;
  display: flex; flex-direction: column;
}

.ticker-head {
  padding: var(--s4) var(--s4) var(--s3);
  border-bottom: var(--hairline) solid rgba(255,255,255,0.08);
  display: flex; flex-direction: column; gap: 2px;
}
.ticker-head .label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-2);
}
.ticker-head .year {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  transition: color 200ms;
}
.ticker-head .progress {
  height: 2px;
  background: rgba(255,255,255,0.06);
  margin-top: 6px;
  position: relative;
  overflow: hidden;
}
.ticker-head .progress i {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: var(--accent);
  width: var(--p, 0%);
  transition: width 220ms ease;
}

.ticker-list {
  position: relative;
  flex: 1;
  overflow: hidden;
  padding: 0;
  mask-image: linear-gradient(to bottom, transparent 0%, black 12%, black 88%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 12%, black 88%, transparent 100%);
}

.ticker-row {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: var(--s3);
  padding: 12px var(--s4) 11px;
  border-bottom: var(--hairline) solid rgba(255,255,255,0.06);
  animation: tickerEnter 600ms ease-out;
}
@keyframes tickerEnter {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.ticker-dot {
  width: 10px; height: 10px;
  border-radius: 1px;
  margin-top: 7px;
  background: rgba(255,255,255,0.2);
  position: relative;
}
.ticker-dot[data-type="sacrifice"]      { background: #c41e3a; box-shadow: 0 0 8px rgba(196, 30, 58, 0.5); }
.ticker-dot[data-type="state-collapse"] { background: #5a7fbe; box-shadow: 0 0 8px rgba(90, 127, 190, 0.4); }
.ticker-dot[data-type="asabiyyah-peak"] { background: #d4a943; box-shadow: 0 0 8px rgba(212, 169, 67, 0.5); }
.ticker-dot[data-type="prophecy"]       { background: var(--accent); }
.ticker-dot[data-type="plague"]         { background: #7a3d8c; }
.ticker-dot[data-type="mundane"]        { background: rgba(180,180,180,0.4); }

.ticker-body { min-width: 0; }
.ticker-meta {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--text-2);
  display: flex; gap: var(--s2);
  text-transform: uppercase;
}
.ticker-meta .year { color: var(--accent); }
.ticker-meta .group {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ticker-text {
  font-family: var(--font-body);
  font-size: 14.5px;
  line-height: 1.4;
  color: var(--text-1);
  margin-top: 3px;
  letter-spacing: 0.005em;
}

/* Typewriter — letters reveal via animation-delay */
.tw {
  display: inline;
}
.tw span {
  opacity: 0;
  animation: twChar 50ms forwards;
}

@keyframes twChar { to { opacity: 1; } }

/* ─── WORTHY CARDS ────────────────────────────────────────────────────── */
.worthy-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(170px, 220px));
  gap: var(--s4);
  align-items: stretch;
  justify-content: center;
  padding: var(--s5);
  width: 100%;
}

/* Adaptive: at <1200px, allow wrap. At <800px, three columns. */
@media (max-width: 1200px) {
  .worthy-grid {
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    max-width: 800px;
    margin: 0 auto;
  }
}
@media (max-width: 720px) {
  .worthy-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .worthy-card { min-height: 320px; }
}

.worthy-card {
  position: relative;
  background: linear-gradient(180deg, var(--primary) 0%, var(--bg) 110%);
  border: var(--hairline) solid rgba(255,255,255,0.12);
  padding: var(--s4) var(--s3) var(--s4);
  display: flex; flex-direction: column;
  gap: var(--s3);
  cursor: pointer;
  transition:
    transform 320ms cubic-bezier(.2,.7,.2,1),
    box-shadow 320ms ease,
    border-color 320ms ease;
  min-height: 360px;
}

.worthy-card::before,
.worthy-card::after {
  content: '';
  position: absolute;
  pointer-events: none;
}
/* Inner ritual frame */
.worthy-card::before {
  inset: 6px;
  border: var(--hairline) solid rgba(255,255,255,0.06);
}
/* Subtle vignette inside the card */
.worthy-card::after {
  inset: 0;
  background: radial-gradient(ellipse at 50% 40%, transparent 30%, rgba(0,0,0,0.4) 100%);
}

/* Corner ornaments (tarot frame) */
.worthy-corner {
  position: absolute;
  font-family: var(--font-display);
  font-size: 13px;
  color: var(--accent);
  opacity: 0.7;
  z-index: 2;
}
.worthy-corner.tl { top: 8px; left: 10px; }
.worthy-corner.tr { top: 8px; right: 10px; }
.worthy-corner.bl { bottom: 8px; left: 10px; }
.worthy-corner.br { bottom: 8px; right: 10px; }

.worthy-card > * { position: relative; z-index: 1; }

.worthy-portrait {
  margin: var(--s2) auto 0;
  width: 100%;
  aspect-ratio: 4/5;
  overflow: hidden;
  border-radius: 3px;
  border: 1px solid rgba(var(--accent-rgb, 168, 152, 120), 0.25);
  box-shadow: inset 0 -30px 40px rgba(0,0,0,0.55), inset 0 0 40px rgba(0,0,0,0.35);
}
.worthy-portrait img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  filter: contrast(1.05) saturate(0.8) brightness(0.92);
}
.worthy-card[data-selected="1"] .worthy-portrait {
  border-color: var(--accent);
  box-shadow: inset 0 -30px 40px rgba(0,0,0,0.55), inset 0 0 40px rgba(0,0,0,0.35),
              0 0 18px rgba(var(--accent-rgb, 168, 152, 120), 0.45);
}

.worthy-sigil {
  margin: var(--s2) auto 0;
  opacity: 0.55;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1;
  color: var(--accent);
  white-space: pre;
  text-align: center;
  text-shadow: 0 0 8px rgba(var(--accent-rgb, 168, 152, 120), 0.4);
  letter-spacing: -0.5px;
  padding: var(--s2);
  border: var(--hairline) solid rgba(255,255,255,0.08);
  background: rgba(0,0,0,0.3);
  align-self: center;
}

.worthy-name {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 500;
  color: var(--text-1);
  text-align: center;
  letter-spacing: 0.04em;
  line-height: 1.05;
  margin-top: var(--s2);
}
.worthy-surname {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 400;
  color: var(--accent);
  text-align: center;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-top: -4px;
}
.worthy-meta {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-2);
  text-align: center;
}
.worthy-bio {
  font-family: var(--font-body);
  font-style: italic;
  font-size: 15px;
  line-height: 1.4;
  color: var(--text-1);
  text-align: center;
  flex: 1;
  text-wrap: pretty;
  margin-top: var(--s1);
}
.worthy-habit {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--text-2);
  text-align: center;
  padding-top: var(--s2);
  border-top: var(--hairline) solid rgba(255,255,255,0.08);
}
.worthy-habit::before {
  content: '※ ';
  color: var(--accent);
}

/* Hover & selected */
.worthy-card:hover {
  transform: translateY(-8px);
  border-color: var(--accent);
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.04),
    0 20px 50px rgba(0,0,0,0.6),
    0 0 40px rgba(255, 200, 120, 0.08);
}
.worthy-card:hover::before {
  border-color: var(--accent);
}
.worthy-card[data-selected="1"] {
  transform: translateY(-12px) scale(1.02);
  border-color: var(--accent);
  box-shadow:
    0 0 0 1px var(--accent),
    0 30px 80px rgba(0,0,0,0.7),
    0 0 60px rgba(255, 200, 120, 0.18);
}
.worthy-card[data-selected="1"]::before {
  inset: 3px;
  border-color: var(--accent);
}
.worthy-card[data-selected="1"] .worthy-corner {
  opacity: 1;
  animation: cornerPulse 2.6s ease-in-out infinite;
}
@keyframes cornerPulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.18); }
}

/* "ВЫБРАН" stamp */
.worthy-stamp {
  position: absolute;
  bottom: var(--s5); left: 50%;
  transform: translateX(-50%) rotate(-4deg);
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.4em;
  color: var(--accent);
  padding: 4px 10px;
  border: 1px solid var(--accent);
  background: rgba(0,0,0,0.5);
  z-index: 5;
  pointer-events: none;
}

/* ─── SCENE-LEVEL LAYOUTS ─────────────────────────────────────────────── */
.scene-intro {
  display: grid;
  place-items: center;
  position: relative;
  width: 100%; height: 100%;
}

.scene-word {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: var(--s5);
  width: 100%;
}
.word-prompt {
  font-family: var(--font-display);
  font-size: 14px;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--accent);
  opacity: 0.7;
}
.word-input {
  background: transparent;
  border: 0;
  border-bottom: var(--hairline) solid var(--accent);
  font-family: var(--font-display);
  font-size: 56px;
  text-align: center;
  color: var(--text-1);
  padding: var(--s3) var(--s5);
  letter-spacing: 0.05em;
  width: min(620px, 75vw);
  outline: none;
  caret-color: var(--accent);
  transition: border-color 320ms ease, letter-spacing 320ms ease;
}
.word-input:focus {
  border-color: var(--accent);
  letter-spacing: 0.06em;
}
.word-input::placeholder {
  color: var(--text-2);
  font-style: italic;
  opacity: 0.5;
}
.word-locked {
  font-family: var(--font-display);
  font-size: 88px;
  font-weight: 500;
  letter-spacing: 0.12em;
  color: var(--accent);
  text-align: center;
  padding: var(--s3) var(--s5);
  text-shadow:
    0 0 30px rgba(var(--accent-rgb, 168, 152, 120), 0.5),
    0 0 60px rgba(var(--accent-rgb, 168, 152, 120), 0.3);
  animation: wordLockIn 1.2s cubic-bezier(.2,.7,.2,1);
}
@keyframes wordLockIn {
  0%   { opacity: 0; letter-spacing: 0.3em; filter: blur(8px); }
  60%  { letter-spacing: 0.18em; filter: blur(0); opacity: 1; }
  100% { letter-spacing: 0.12em; }
}
.word-hint {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-2);
  text-align: center;
  margin-top: var(--s3);
  min-height: 16px;
}

.scene-simulation {
  width: 100%; height: 100%;
  position: relative;
}
.sim-headline {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
}
.sim-headline .word {
  font-family: var(--font-display);
  font-size: 84px;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 0.04em;
  text-shadow: 0 0 40px rgba(212, 169, 67, 0.3);
}
.sim-headline .sub {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--text-2);
  margin-top: var(--s4);
}
.sim-headline .ratio {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 20px;
  color: var(--text-1);
  margin-top: var(--s2);
  opacity: 0.85;
}

.scene-worthy {
  width: 100%;
  display: flex; flex-direction: column; align-items: center;
  gap: var(--s5);
}
.worthy-heading {
  text-align: center;
  font-family: var(--font-display);
  font-size: 14px;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--accent);
  padding: var(--s4) 0 0;
  display: flex; align-items: center; gap: var(--s4);
}
.worthy-heading::before,
.worthy-heading::after {
  content: '';
  width: 80px; height: var(--hairline);
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
}

.scene-dialog {
  width: 100%; height: 100%;
  display: grid;
  grid-template-columns: 280px 1fr;
  align-items: center;
  gap: var(--s7);
  padding: 0 var(--s7);
}

.dialog-scene-desc {
  max-width: 520px;
  color: var(--text-2);
  font-family: var(--font-body);
  font-style: italic;
  font-size: 17px;
  line-height: 1.55;
  text-wrap: pretty;
}
.dialog-scene-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: var(--s3);
  font-style: normal;
}

.scene-ritual {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  position: relative;
}
.ritual-altar {
  position: relative;
  width: 360px; height: 360px;
  display: flex; align-items: center; justify-content: center;
}
.ritual-altar .ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: var(--hairline) solid rgba(255, 230, 200, 0.35);
}
.ritual-altar .ring.r2 { inset: 30px; border-color: rgba(255,200,170,0.3); }
.ritual-altar .ring.r3 { inset: 60px; border-color: rgba(255,170,140,0.25); }
.ritual-altar .ring.r4 { inset: 95px; border-color: rgba(255,140,110,0.2); }

.ritual-altar .ring.r1 { animation: ringRot 30s linear infinite; }
.ritual-altar .ring.r2 { animation: ringRot 22s linear infinite reverse; }
.ritual-altar .ring.r3 { animation: ringRot 18s linear infinite; }
@keyframes ringRot {
  0% { transform: rotate(0); }
  100% { transform: rotate(360deg); }
}

.ritual-altar .glyph {
  position: absolute;
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--accent);
  opacity: 0.6;
}
.ritual-altar .core {
  width: 90px; height: 90px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 220, 100, 0.8) 0%, rgba(220, 60, 40, 0.6) 50%, transparent 80%);
  filter: blur(2px);
  animation: corePulse 1.6s ease-in-out infinite;
}
.ritual-altar .core[data-pulse="PRE"]  {
  animation: coreBuild 2.4s ease-in-out infinite;
  opacity: 0.55;
}
.ritual-altar .core[data-pulse="ACT"]  { animation: corePulse 1.4s ease-in-out infinite; }
.ritual-altar .ember,
.ritual-epitaph .ember {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(180, 90, 50, 0.45) 0%, transparent 70%);
  filter: blur(3px);
  animation: emberFade 4s ease-in-out infinite;
}
.ritual-epitaph {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s3);
  animation: epitaphIn 1.2s cubic-bezier(.2,.7,.2,1);
}
.epitaph-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--text-2);
  opacity: 0.7;
}
.epitaph-name {
  font-family: var(--font-display);
  font-size: 72px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--text-1);
  text-align: center;
  text-shadow:
    0 0 24px rgba(255, 220, 170, 0.35),
    0 0 60px rgba(255, 180, 120, 0.15);
  animation: epitaphBreathe 5s ease-in-out infinite;
}
.epitaph-title {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 18px;
  letter-spacing: 0.05em;
  color: var(--text-1);
  text-align: center;
  opacity: 0.6;
  margin-top: -8px;
}
@keyframes epitaphIn {
  0%   { opacity: 0; filter: blur(12px); transform: scale(0.92); }
  60%  { opacity: 1; filter: blur(0); }
  100% { transform: scale(1); }
}
@keyframes epitaphBreathe {
  0%, 100% { letter-spacing: 0.08em; opacity: 0.95; }
  50%      { letter-spacing: 0.10em; opacity: 1; }
}
@keyframes corePulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%      { transform: scale(1.35); opacity: 0.85; }
}
@keyframes coreBuild {
  0%, 100% { transform: scale(0.8); opacity: 0.4; }
  50%      { transform: scale(1.05); opacity: 0.7; }
}
@keyframes emberFade {
  0%, 100% { opacity: 0.3; transform: scale(0.9); }
  50%      { opacity: 0.6; transform: scale(1.1); }
}

/* ─── RITUAL SUB-NAV (only on RITUAL screen) ────────────────────────── */
.ritual-subnav {
  position: fixed;
  top: 50%;
  right: var(--s4);
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: rgba(255,255,255,0.06);
  padding: 1px;
  border: var(--hairline) solid rgba(255,255,255,0.1);
  z-index: 150;
}
.ritual-subnav button {
  appearance: none;
  background: rgba(10, 10, 12, 0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 0;
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.22em;
  padding: 10px 12px;
  cursor: pointer;
  transition: color 180ms, background 180ms;
  writing-mode: vertical-rl;
}
.ritual-subnav button:hover { color: var(--text-1); }
.ritual-subnav button[data-active="1"] {
  background: var(--accent);
  color: var(--bg);
}

/* ─── PHASE NAV (top rail) ────────────────────────────────────────────
   Floats over the scene at the top — never overlaps the dialogue box. */
.phase-nav {
  position: fixed;
  top: var(--s4);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 1px;
  background: rgba(255,255,255,0.08);
  padding: 1px;
  border: var(--hairline) solid rgba(255,255,255,0.12);
  z-index: 200;
  font-family: var(--font-mono);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.phase-nav button {
  appearance: none;
  background: rgba(10, 10, 12, 0.7);
  border: 0;
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 7px 12px;
  cursor: pointer;
  transition: color 180ms, background 180ms;
  white-space: nowrap;
}
.phase-nav button:hover { color: var(--text-1); }
.phase-nav button[data-active="1"] {
  background: var(--accent);
  color: var(--bg);
}

/* ─── KEY HINT (top-right corner, opposite the centered phase-nav) ──── */
.key-hint {
  position: fixed;
  top: 24px; right: var(--s5);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-2);
  z-index: 200;
  display: flex; align-items: center; gap: var(--s2);
  pointer-events: none;
}
.key-hint .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  animation: candleFlicker 3.2s ease-in-out infinite;
}

/* ─── SCREEN TRANSITION ──────────────────────────────────────────────── */
.scene-enter {
  animation: sceneIn 700ms ease-out;
}
@keyframes sceneIn {
  from { opacity: 0; filter: blur(6px); }
  to   { opacity: 1; filter: blur(0); }
}

/* Word breathing — title pulse on simulation */
@keyframes wordBreathe {
  0%, 100% { letter-spacing: 0.04em; }
  50%      { letter-spacing: 0.06em; }
}
.sim-headline .word { animation: wordBreathe 4s ease-in-out infinite; }

/* ─── LOADING SCREEN ──────────────────────────────────────────────────
   Pre-game flicker montage. Hard-cut frames + persistent header.
   ─────────────────────────────────────────────────────────────────── */

.loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #050506;
  overflow: hidden;
  display: block;
  transition: opacity 700ms ease, filter 700ms ease;
}
.loader[data-exit="1"] {
  opacity: 0;
  filter: blur(8px);
  pointer-events: none;
}

.loader-stage {
  position: absolute;
  inset: 0;
  z-index: 10;
}

/* Each .lf is a hard-cut full-bleed frame, unmounted as the next index ticks. */
.lf {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #030303;
  animation: lfIn 90ms ease-out;
}
@keyframes lfIn {
  from { opacity: 0.6; transform: scale(0.99); }
  to   { opacity: 1;   transform: scale(1); }
}

.lf-black  { background: #020202; }
.lf-center { text-align: center; }

/* Background image - blurred, heavy vignette, just a hint behind text.
   Image lives on ::before pseudo so blur doesn't touch text.
   .lf already provides absolute+inset:0+flex-center, do NOT override position. */
.lf-with-bg::before {
  content: "";
  position: absolute;
  inset: -8%;
  background-image: var(--bg);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  filter: blur(8px) brightness(0.32) contrast(0.85) saturate(0.5);
  z-index: 0;
  animation: lfBgIn 320ms ease-out;
}
/* Vignette + warm haze overlay */
.lf-with-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 55% 45% at center, transparent 0%, rgba(0,0,0,0.55) 55%, rgba(0,0,0,0.94) 90%, #000 100%),
    radial-gradient(ellipse 80% 60% at center, rgba(38,26,14,0.15) 0%, transparent 70%);
  pointer-events: none;
  z-index: 1;
}
.lf-with-bg > * {
  position: relative;
  z-index: 2;
  text-shadow:
    0 0 30px rgba(0,0,0,1),
    0 0 60px rgba(0,0,0,0.95),
    0 4px 24px rgba(0,0,0,0.9);
}
@keyframes lfBgIn {
  from { filter: blur(14px) brightness(0.18) contrast(0.8) saturate(0.35); transform: scale(1.05); }
  to   { filter: blur(8px) brightness(0.32) contrast(0.85) saturate(0.5); transform: scale(1); }
}

/* Breath — single ember in the dark */
.lf-breath {
  background:
    radial-gradient(ellipse 35% 25% at 50% 50%, rgba(212,169,67,0.05) 0%, transparent 70%),
    #020202;
}
.lf-ember {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: rgba(212,169,67, 0.85);
  box-shadow:
    0 0 24px rgba(212,169,67, 0.5),
    0 0 64px rgba(212,169,67, 0.22);
  animation: emberBreathe 2s ease-in-out infinite;
}
@keyframes emberBreathe {
  0%, 100% { opacity: 0.45; transform: scale(0.85); }
  50%      { opacity: 1;    transform: scale(1.15); }
}

/* Soft — ritual whisper */
.lf-word-soft {
  font-family: var(--font-display, "Cormorant SC", serif);
  font-style: italic;
  font-size: 26px;
  letter-spacing: 0.5em;
  color: rgba(216, 210, 196, 0.6);
  text-transform: lowercase;
  padding-left: 0.5em; /* offset for the wide tracking */
}

/* Mid — ritual vocabulary */
.lf-word-mid {
  font-family: var(--font-display, "Cormorant SC", serif);
  font-size: clamp(72px, 12vw, 160px);
  font-weight: 500;
  letter-spacing: 0.12em;
  color: rgba(216, 210, 196, 0.92);
  text-shadow: 0 0 28px rgba(0,0,0,0.7);
}

/* Loud — climax word, gets a tiny letter-spacing punch on entry */
.lf-word-loud {
  font-family: var(--font-display, "Cormorant SC", serif);
  font-size: clamp(120px, 18vw, 240px);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-shadow: 0 0 40px rgba(0,0,0,0.75);
  animation: loudPunch 240ms ease-out;
}
.lf-word-loud[data-tone="red"]  { color: #c41e3a; }
.lf-word-loud[data-tone="gold"] { color: #d4a943; }
@keyframes loudPunch {
  0%   { letter-spacing: 0.28em; opacity: 0; filter: blur(10px); }
  60%  { opacity: 1; filter: blur(0); }
  100% { letter-spacing: 0.08em; }
}

/* Year — mono, big */
.lf-year {
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: clamp(140px, 22vw, 280px);
  font-weight: 300;
  letter-spacing: -0.04em;
  color: rgba(216, 210, 196, 0.85);
  font-variant-numeric: tabular-nums;
  animation: yearIn 140ms ease-out;
}
@keyframes yearIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Grid — dense field of one glyph. Reads as a gravefield in the eye-blink it's onscreen. */
.lf-grid {
  background: #020202;
  padding: 8vh 6vw;
  align-items: stretch;
}
.lf-grid-inner {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  width: 100%; height: 100%;
  font-family: var(--font-display, "Cormorant SC", serif);
  color: rgba(216, 210, 196, 0.45);
  animation: gridIn 150ms ease-out;
}
.lf-grid-row {
  display: flex;
  justify-content: space-between;
  font-size: clamp(28px, 4.5vw, 56px);
  line-height: 1;
}
.lf-grid-row span {
  opacity: 0.8;
  letter-spacing: 0;
}
@keyframes gridIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Flash — opaque overlay */
.lf-flash {
  position: absolute; inset: 0;
}
.lf-flash[data-tone="red"]   { background: #7a1020; }
.lf-flash[data-tone="white"] { background: #d8d2c4; }

/* Merge — ВОЙНА + ЖЕРТВА overlaid in the same position, screen-blend
   produces the equation visually. */
.lf-merge { background: #020202; }
.lf-merge-stack {
  position: relative;
  width: 100%;
  height: 1em;
}
.lf-merge .m {
  font-family: var(--font-display, "Cormorant SC", serif);
  font-size: clamp(120px, 18vw, 240px);
  font-weight: 600;
  letter-spacing: 0.08em;
  position: absolute;
  left: 0; right: 0;
  top: 50%;
  transform: translateY(-50%);
  text-align: center;
  mix-blend-mode: screen;
  animation: mergeBreathe 2.2s ease-in-out infinite;
}
.lf-merge .m-war { color: #c41e3a; opacity: 0.9; }
.lf-merge .m-sac { color: #d4a943; opacity: 0.9; animation-delay: -0.7s; }
@keyframes mergeBreathe {
  0%, 100% { letter-spacing: 0.08em; opacity: 0.85; }
  50%      { letter-spacing: 0.14em; opacity: 1; }
}

/* Grain + vignette overlays for the loader */
.loader-grain {
  position: absolute; inset: -10%;
  pointer-events: none;
  opacity: 0.55;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='2.8' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.85   0 0 0 0 0.82   0 0 0 0 0.74  0 0 0 1 0'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='0.7'/></svg>");
  mix-blend-mode: overlay;
  z-index: 60;
  animation: grainShake 0.55s steps(3) infinite;
}
.loader-vignette {
  position: absolute; inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center,
    transparent 0%, transparent 38%,
    rgba(0,0,0,0.55) 78%, rgba(0,0,0,0.92) 100%);
  z-index: 70;
}

/* ─── PERSISTENT HEADER · "don't sacrifAIce us" ──────────────────────
   Lives above every flicker frame. The center logo is visible from the
   first second; the side words fade in slowly so the plea assembles
   itself as the montage plays. */
.loader-header {
  position: absolute;
  top: 13vh;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  align-items: baseline;
  gap: 28px;
  pointer-events: none;
  white-space: nowrap;
  user-select: none;
}

.lh-title {
  font-family: var(--font-display, "Cormorant SC", serif);
  font-size: clamp(54px, 6.8vw, 88px);
  font-weight: 500;
  letter-spacing: 0.015em;
  color: rgba(232, 222, 196, 0.96);
  text-transform: none;
  /* Layered shadows: dark halo for legibility on flash frames + warm
     accent glow for ritual mood */
  text-shadow:
    0 0 18px rgba(0,0,0,0.9),
    0 0 48px rgba(0,0,0,0.7),
    0 0 90px rgba(212, 169, 67, 0.18);
  animation: lhTitleIn 1.6s cubic-bezier(.2,.7,.2,1) both;
}
.lh-title em {
  font-style: italic;
  font-weight: 600;
  color: #d4a943;
  letter-spacing: 0.02em;
  text-shadow:
    0 0 18px rgba(0,0,0,0.9),
    0 0 36px rgba(212, 169, 67, 0.45);
}
@keyframes lhTitleIn {
  0%   { opacity: 0; filter: blur(14px); letter-spacing: 0.18em; }
  60%  { opacity: 1; filter: blur(0); }
  100% { letter-spacing: 0.015em; }
}

.lh-side {
  font-family: var(--font-body, "Cormorant Garamond", serif);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(20px, 1.9vw, 28px);
  color: rgba(232, 222, 196, 0.85);
  letter-spacing: 0.02em;
  text-shadow:
    0 0 14px rgba(0,0,0,0.92),
    0 0 28px rgba(0,0,0,0.6);
  opacity: 0;
  /* baseline offset so the small italic sits with the SC cap baseline */
  transform: translateY(-0.08em);
}

/* Both side words rise SLOWLY — they accumulate over the montage */
.lh-dont {
  animation: lhDontIn 3200ms 1900ms ease-out forwards;
}
.lh-us {
  animation: lhUsIn 3600ms 4000ms ease-out forwards;
}
@keyframes lhDontIn {
  0%   { opacity: 0; transform: translate(10px, -0.08em); filter: blur(6px); }
  55%  { opacity: 0.7; filter: blur(0); }
  100% { opacity: 0.92; transform: translate(0, -0.08em); }
}
@keyframes lhUsIn {
  0%   { opacity: 0; transform: translate(-10px, -0.08em); filter: blur(6px); }
  55%  { opacity: 0.7; filter: blur(0); }
  100% { opacity: 0.92; transform: translate(0, -0.08em); }
}

/* Progress hairline + skip button */
.loader-progress {
  position: absolute;
  left: 50%; bottom: 26px;
  transform: translateX(-50%);
  width: 200px;
  height: 1px;
  background: rgba(255,255,255,0.08);
  z-index: 220;
}
.loader-progress i {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: rgba(212,169,67, 0.6);
  transition: width 140ms linear;
}
.loader-skip {
  appearance: none;
  position: absolute;
  bottom: 22px; right: 28px;
  background: transparent;
  border: 0;
  color: rgba(216,210,196, 0.45);
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 10px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  cursor: pointer;
  padding: 8px 12px;
  transition: color 180ms ease;
  z-index: 220;
}
.loader-skip:hover { color: #d4a943; }

/* ATTENTION SCENE - liquid-glass lens over emergent memes */
.scene-attention {
  position: relative;
  width: 100%; height: 100%;
  overflow: hidden;
  cursor: none;
}
.attention-stage {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at center, rgba(20,16,12,0.4) 0%, rgba(2,2,3,0.85) 80%),
    #050506;
  overflow: hidden;
}

/* Tie lines (SVG inside stage, % coords) */
.attention-ties {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 1;
}
.attention-ties .tie {
  stroke: rgba(212,169,67,0.18);
  stroke-width: 0.08;
  vector-effect: non-scaling-stroke;
}
.attention-ties .tie-strong {
  stroke: rgba(212,169,67,0.32);
  stroke-width: 1.5;
}
.attention-ties .tie-weak {
  stroke: rgba(180,170,150,0.14);
  stroke-width: 0.8;
  stroke-dasharray: 3 3;
}

/* Group nodes */
.group-node {
  position: absolute;
  transform: translate(-50%, -50%);
  z-index: 2;
  pointer-events: none;
}
.group-core {
  position: absolute;
  inset: 18%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(212,169,67,0.85) 0%, rgba(120,90,40,0.4) 60%, transparent 100%);
  filter: blur(0.5px);
  animation: groupPulse calc(2.4s + var(--pulse, 0.5) * 1.6s) ease-in-out infinite;
}
.group-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid rgba(212,169,67,0.25);
  animation: groupRing calc(3s + var(--pulse, 0.5) * 2s) ease-out infinite;
}
@keyframes groupPulse {
  0%, 100% { opacity: 0.55; transform: scale(0.9); }
  50%      { opacity: 1;    transform: scale(1.05); }
}
@keyframes groupRing {
  0%   { opacity: 0.7; transform: scale(0.85); }
  100% { opacity: 0;   transform: scale(1.6); }
}
.group-label {
  position: absolute;
  bottom: -22px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-display, "Cormorant SC", serif);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: rgba(216,210,196,0.45);
  white-space: nowrap;
}

/* Meme particles - orbit each group */
.meme-particle {
  position: absolute;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, currentColor 0%, transparent 70%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
  pointer-events: none;
  transition: opacity 200ms ease;
}
.meme-particle[data-focused="1"] {
  z-index: 4;
}
.meme-glyph {
  font-family: var(--font-display, serif);
  font-size: 0.65em;
  color: rgba(255,255,255,0.85);
  text-shadow: 0 0 6px currentColor, 0 0 12px currentColor;
  mix-blend-mode: screen;
}

/* HUD */
.attention-hud {
  position: absolute;
  bottom: 16px; left: 16px;
  display: flex; gap: 24px;
  z-index: 5;
  pointer-events: none;
  font-family: var(--font-mono, monospace);
  font-size: 12px;
  color: rgba(216,210,196,0.5);
  letter-spacing: 0.15em;
}
.hud-year { color: rgba(212,169,67,0.8); font-size: 16px; }

/* Liquid glass lens (fixed viewport) - small, single-meme size */
.lens {
  position: fixed;
  width: 110px; height: 110px;
  top: 0; left: 0;
  transform: translate(-9999px, -9999px) translate(-50%, -50%);
  border-radius: 50%;
  pointer-events: none;
  backdrop-filter: blur(0.6px) brightness(1.22) contrast(1.10) saturate(1.30);
  -webkit-backdrop-filter: blur(0.6px) brightness(1.22) contrast(1.10) saturate(1.30);
  border: 1px solid rgba(255,240,200,0.40);
  box-shadow:
    inset 0 0 22px rgba(255,240,200,0.22),
    inset 0 0 50px rgba(0,0,0,0.35),
    0 8px 24px rgba(0,0,0,0.55),
    0 0 10px rgba(255,240,200,0.18);
  z-index: 9000;
  opacity: 0;
  transition: opacity 400ms ease;
}

/* Charge arc - top-right of lens, fills while focused on meme */
.lens-charge {
  position: absolute;
  top: -8px; right: -8px;
  width: 36px; height: 36px;
  transform: translate(50%, -50%);
  pointer-events: none;
}
.lens-charge-bg {
  fill: none;
  stroke: rgba(212,169,67,0.18);
  stroke-width: 3;
}
.lens-charge-fg {
  fill: none;
  stroke: #d4a943;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 0 138.23;
  opacity: 0;
  transition: opacity 200ms ease, stroke 200ms ease;
  filter: drop-shadow(0 0 4px currentColor);
}
.lens-inner {
  position: absolute;
  inset: 6%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 28%, rgba(255,255,255,0.18) 0%, transparent 35%),
    radial-gradient(circle at 65% 75%, rgba(0,0,0,0.18) 0%, transparent 40%);
  pointer-events: none;
}
.lens-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  box-shadow:
    inset 0 0 0 1px rgba(180,200,255,0.22),
    inset 0 0 0 3px rgba(255,200,150,0.06);
  filter: blur(0.6px);
  pointer-events: none;
}

.lens-tooltip {
  position: fixed;
  top: 0; left: 0;
  transform: translate(-9999px, -9999px);
  font-family: var(--font-display, "Cormorant SC", serif);
  background: rgba(8,6,4,0.92);
  border: 1px solid rgba(212,169,67,0.35);
  border-left-width: 2px;
  padding: 8px 14px;
  border-radius: 2px;
  opacity: 0;
  transition: opacity 220ms ease, border-color 220ms ease;
  z-index: 9001;
  pointer-events: none;
  max-width: 240px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.6);
}
.lens-tooltip-title {
  font-size: 13px;
  letter-spacing: 0.15em;
  text-transform: lowercase;
  font-weight: 600;
  margin-bottom: 4px;
  text-shadow: 0 0 6px currentColor;
}
.lens-tooltip-desc {
  font-family: var(--font-body, "Cormorant Garamond", serif);
  font-size: 13px;
  font-style: italic;
  color: rgba(216,210,196,0.7);
  line-height: 1.35;
  letter-spacing: 0.02em;
}

/* Meme-meme graph lines */
.meme-graph {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}
.meme-link {
  stroke: rgba(212,169,67,0.10);
  stroke-width: 0.5;
}
.meme-link-captured {
  stroke-width: 1.6;
  filter: drop-shadow(0 0 4px currentColor);
  opacity: 0.7;
  animation: linkPulse 2.4s ease-in-out infinite;
}
@keyframes linkPulse {
  0%, 100% { opacity: 0.5; }
  50%      { opacity: 0.85; }
}

/* Short label under each meme (always visible) */
.meme-shortlabel {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  font-family: var(--font-mono, monospace);
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: lowercase;
  white-space: nowrap;
  text-shadow: 0 0 4px currentColor, 0 1px 3px rgba(0,0,0,0.9);
  opacity: 0.75;
  pointer-events: none;
}

/* Capture flash spark - radiates outward on capture */
.meme-spark {
  position: absolute;
  inset: -8px;
  border: 1.5px solid;
  border-radius: 50%;
  pointer-events: none;
  filter: drop-shadow(0 0 12px currentColor);
}

/* HUD: captured counter */
.hud-captured { color: rgba(212,169,67,0.75); font-weight: 600; }

/* Captured meme glow */
.meme-particle[data-captured="1"] .meme-glyph {
  font-size: 0.9em;
}

/* Compact dialogue when in attention scene */
.game-main:has(.scene-attention) .dialogue {
  min-height: 6vh !important;
  max-height: 16vh;
  padding: 8px 24px;
  overflow: hidden;
  transition: max-height 320ms ease;
}
.game-main:has(.scene-attention) .dialogue:hover {
  max-height: 28vh;
}
.game-main:has(.scene-attention) .dlg-text {
  font-size: 14px;
  line-height: 1.35;
  margin-top: 2px;
}
.game-main:has(.scene-attention) .dlg-speaker {
  font-size: 10px;
}
