:root {
  --red: #b3120c;
  --red-glow: #ff2a1a;
  --bone: #e9e2d4;
  --dim: #8c857a;
  --panel: rgba(8, 6, 6, 0.78);
  --line: rgba(233, 226, 212, 0.14);
  --char: #d0342c;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #000;
  color: var(--bone);
  font-family: 'Avenir Next', 'Segoe UI', Roboto, Arial, sans-serif;
  user-select: none;
  -webkit-font-smoothing: antialiased;
}

#scene {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
}

.hidden { display: none !important; }

/* ---------- плёнка и виньетка ---------- */
#vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(0,0,0,0) 45%, rgba(0,0,0,0.55) 75%, rgba(0,0,0,0.92) 100%);
  z-index: 2;
}
#grain {
  position: fixed;
  inset: -50%;
  pointer-events: none;
  opacity: 0.5;
  mix-blend-mode: overlay;
  z-index: 3;
  animation: grain 0.45s steps(4) infinite;
}
@keyframes grain {
  0% { transform: translate(0, 0); }
  25% { transform: translate(-7%, 4%); }
  50% { transform: translate(5%, -6%); }
  75% { transform: translate(-3%, -2%); }
  100% { transform: translate(6%, 5%); }
}

.screen {
  position: fixed;
  inset: 0;
  z-index: 5;
}

/* ---------- заголовок ---------- */
.title {
  position: relative;
  margin: 0;
  font-family: 'Didot', 'Bodoni 72', 'Times New Roman', serif;
  font-weight: 900;
  font-size: clamp(64px, 11vw, 150px);
  letter-spacing: 0.12em;
  line-height: 0.95;
  color: #efe7d8;
  text-shadow:
    0 0 18px rgba(255, 40, 20, 0.45),
    0 0 60px rgba(180, 10, 5, 0.6),
    3px 3px 0 #2a0000;
  animation: title-flicker 6s infinite;
}
.title::before,
.title::after {
  content: attr(data-text);
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  overflow: hidden;
  pointer-events: none;
}
.title::before {
  color: var(--red-glow);
  mix-blend-mode: screen;
  clip-path: inset(0 0 62% 0);
  animation: glitch-a 3.7s infinite steps(1);
  opacity: 0.8;
}
.title::after {
  color: #6cf;
  mix-blend-mode: screen;
  clip-path: inset(58% 0 0 0);
  animation: glitch-b 4.3s infinite steps(1);
  opacity: 0.35;
}
@keyframes title-flicker {
  0%, 100% { opacity: 1; }
  41% { opacity: 1; }
  42% { opacity: 0.35; }
  43% { opacity: 1; }
  45% { opacity: 0.6; }
  46% { opacity: 1; }
  78% { opacity: 1; }
  79% { opacity: 0.15; }
  81% { opacity: 1; }
}
@keyframes glitch-a {
  0%, 88%, 100% { transform: translate(0, 0); opacity: 0; }
  89% { transform: translate(-6px, 2px); opacity: 0.85; }
  91% { transform: translate(5px, -1px); opacity: 0.85; }
  93% { transform: translate(0, 0); opacity: 0; }
}
@keyframes glitch-b {
  0%, 70%, 100% { transform: translate(0, 0); opacity: 0; }
  71% { transform: translate(7px, 0); opacity: 0.5; }
  73% { transform: translate(-4px, 1px); opacity: 0.5; }
  75% { transform: translate(0, 0); opacity: 0; }
}

.subtitle {
  margin: 14px 0 0 6px;
  font-family: Georgia, serif;
  font-style: italic;
  font-size: 19px;
  color: #b9a99a;
  letter-spacing: 0.08em;
  opacity: 0.85;
}

/* ---------- заставка ---------- */
#splash {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  background: radial-gradient(ellipse at center, rgba(40,0,0,0.25), rgba(0,0,0,0.85));
}
.splash-inner .title { display: inline-block; }
.warning {
  margin-top: 40px;
  color: var(--dim);
  font-size: 15px;
  line-height: 1.6;
}
.enter {
  margin-top: 28px;
  font-family: Georgia, serif;
  font-style: italic;
  font-size: 20px;
  color: #d9c9b8;
  letter-spacing: 0.15em;
}
.blink { animation: blink 2.4s ease-in-out infinite; }
@keyframes blink {
  0%, 100% { opacity: 0.25; }
  50% { opacity: 1; }
}

/* ---------- меню ---------- */
#menu {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 7vw;
  background: linear-gradient(90deg, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.4) 45%, rgba(0,0,0,0) 70%);
}
.menu-left { max-width: 620px; }
.menu-buttons {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 46px;
}

.menu-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  width: fit-content;
  min-width: 340px;
  padding: 14px 26px 14px 18px;
  background: linear-gradient(90deg, rgba(20, 4, 4, 0.7), rgba(0, 0, 0, 0));
  border: none;
  border-left: 2px solid rgba(233, 226, 212, 0.12);
  color: #d8cfc0;
  font-family: 'Didot', 'Times New Roman', serif;
  font-weight: 700;
  font-size: 25px;
  letter-spacing: 0.22em;
  text-align: left;
  cursor: pointer;
  transition: color 0.15s, background 0.25s, border-color 0.2s, padding 0.2s;
}
.menu-btn .btn-mark {
  width: 10px;
  height: 10px;
  transform: rotate(45deg);
  border: 1px solid rgba(233, 226, 212, 0.3);
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.menu-btn:hover,
.menu-btn:focus-visible {
  outline: none;
  color: #fff;
  padding-left: 30px;
  border-left-color: var(--red-glow);
  background: linear-gradient(90deg, rgba(150, 10, 5, 0.55), rgba(60, 0, 0, 0.15) 70%, rgba(0, 0, 0, 0));
  text-shadow: 0 0 12px rgba(255, 50, 30, 0.8);
}
.menu-btn:hover .btn-text { animation: jitter 0.25s infinite; }
.menu-btn:hover .btn-mark {
  background: var(--red-glow);
  border-color: var(--red-glow);
  box-shadow: 0 0 12px var(--red-glow);
}
.menu-btn:active { transform: translateX(3px); }
@keyframes jitter {
  0% { transform: translate(0, 0); }
  25% { transform: translate(0.6px, -0.6px); }
  50% { transform: translate(-0.6px, 0.4px); }
  75% { transform: translate(0.4px, 0.6px); }
  100% { transform: translate(0, 0); }
}
.menu-btn.compact { min-width: 240px; font-size: 19px; padding: 11px 22px 11px 14px; }
.menu-btn.primary { border-left-color: var(--red); background: linear-gradient(90deg, rgba(120, 8, 4, 0.6), rgba(0,0,0,0)); }
.menu-btn.disabled { opacity: 0.4; pointer-events: none; }

.link-btn {
  margin: 22px 0 0 20px;
  padding: 0;
  background: none;
  border: none;
  color: var(--dim);
  font-size: 15px;
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
}
.link-btn:hover { color: var(--bone); }

.current-char {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 40px 0 0 20px;
  color: var(--dim);
  font-size: 15px;
}
.current-char .swatch {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  box-shadow: 0 0 10px currentColor;
}
.current-char b { color: var(--bone); font-weight: 600; }

/* ---------- панели ---------- */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: 24px 26px;
}
.panel-title {
  font-family: 'Didot', 'Times New Roman', serif;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.4em;
  color: var(--red-glow);
  margin-bottom: 18px;
}
#lobby-panel { width: 380px; }
.code-label { font-size: 12px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--dim); margin-bottom: 6px; }
.code {
  font-family: 'Courier New', monospace;
  font-size: 54px;
  font-weight: 700;
  letter-spacing: 0.25em;
  color: #fff;
  text-shadow: 0 0 20px rgba(255, 40, 20, 0.6);
  margin-bottom: 14px;
}
.invite-row { display: flex; gap: 8px; }
.invite-row input,
.name-row input {
  flex: 1;
  min-width: 0;
  padding: 9px 11px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid var(--line);
  color: var(--bone);
  font-size: 14px;
  font-family: inherit;
  user-select: text;
}
#join-code {
  font-family: 'Courier New', monospace;
  font-size: 22px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  text-align: center;
}
.invite-row input:focus,
.name-row input:focus { outline: none; border-color: rgba(255, 60, 40, 0.6); }
.small-btn {
  padding: 9px 16px;
  background: #6d0a06;
  border: 1px solid #a3160e;
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
}
.small-btn:hover { background: #8e0f08; box-shadow: 0 0 14px rgba(255, 40, 20, 0.45); }
.small-btn.ghost { background: transparent; border-color: var(--line); color: var(--dim); }
.small-btn.ghost:hover { color: var(--bone); border-color: rgba(233,226,212,0.35); box-shadow: none; }
.hint { margin: 10px 0 4px; font-size: 12.5px; line-height: 1.5; color: var(--dim); }
.slots { display: flex; flex-direction: column; gap: 6px; margin: 18px 0; }
.slot {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.45);
  font-size: 15px;
}
.slot.empty { color: #5d5750; border-style: dashed; font-style: italic; }
.slot .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.slot .role { margin-left: auto; font-size: 12px; color: var(--dim); }
.slot .host { font-size: 11px; color: var(--red-glow); letter-spacing: 0.1em; }
.name-row { display: flex; flex-direction: column; gap: 6px; font-size: 12px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--dim); margin-bottom: 14px; }
.lobby-status { font-size: 14px; color: #d9c9b8; margin-bottom: 14px; min-height: 20px; }
#lobby-join { margin-top: 6px; padding-top: 16px; border-top: 1px solid var(--line); }
#lobby-in:not(.hidden) + #lobby-join { margin-top: 18px; }
#lobby-error { margin-top: 12px; color: #ff6a55; font-size: 14px; min-height: 18px; }

/* ---------- выбор персонажа ---------- */
#characters { background: linear-gradient(180deg, rgba(0,0,0,0.6) 0%, rgba(0,0,0,0) 22%, rgba(0,0,0,0) 70%, rgba(0,0,0,0.85) 100%); }
.char-top { position: absolute; top: 5vh; left: 0; right: 0; text-align: center; }
.screen-title {
  margin: 0;
  font-family: 'Didot', 'Times New Roman', serif;
  font-size: clamp(26px, 3.4vw, 44px);
  letter-spacing: 0.3em;
  color: #efe7d8;
  text-shadow: 0 0 18px rgba(255, 40, 20, 0.5);
}
.char-panel {
  position: absolute;
  right: 6vw;
  top: 50%;
  transform: translateY(-58%);
  width: 400px;
  border-left: 3px solid var(--char);
}
.char-role { font-size: 13px; letter-spacing: 0.35em; text-transform: uppercase; color: var(--char); font-weight: 700; }
.char-name { font-family: 'Didot', 'Times New Roman', serif; font-size: 52px; font-weight: 900; letter-spacing: 0.08em; margin: 4px 0 10px; }
.char-desc { font-size: 15.5px; line-height: 1.55; color: #c9c0b2; margin: 0 0 14px; }
.char-ability {
  font-size: 14px;
  padding: 9px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  margin-bottom: 18px;
}
.char-ability::before { content: '★ '; color: var(--char); }
.stats { display: flex; flex-direction: column; gap: 9px; }
.stat { display: grid; grid-template-columns: 120px 1fr; align-items: center; gap: 10px; font-size: 13px; color: var(--dim); }
.stat .pips { display: flex; gap: 4px; }
.stat .pip { flex: 1; height: 8px; background: rgba(255, 255, 255, 0.08); transform: skewX(-18deg); }
.stat .pip.on { background: var(--char); box-shadow: 0 0 8px var(--char); }
.char-taken { margin-top: 14px; color: #ff6a55; font-size: 14px; }

.char-cards {
  position: absolute;
  left: 50%;
  bottom: 13vh;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
}
.char-card {
  position: relative;
  width: 150px;
  padding: 12px 14px;
  background: rgba(10, 8, 8, 0.75);
  border: 1px solid var(--line);
  border-bottom: 3px solid var(--c);
  color: var(--bone);
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.15s, background 0.15s, box-shadow 0.15s;
}
.char-card:hover { transform: translateY(-3px); background: rgba(30, 20, 20, 0.85); }
.char-card.active { background: rgba(40, 10, 10, 0.9); box-shadow: 0 0 24px color-mix(in srgb, var(--c) 45%, transparent); transform: translateY(-6px); }
.char-card .cc-name { font-size: 18px; font-weight: 700; }
.char-card .cc-role { font-size: 12px; color: var(--dim); letter-spacing: 0.1em; text-transform: uppercase; }
.char-card .cc-mine { position: absolute; top: 8px; right: 10px; font-size: 11px; color: var(--c); }
.char-card.taken { opacity: 0.45; }
.char-card.taken::after { content: 'занят'; position: absolute; top: 8px; right: 10px; font-size: 11px; color: #ff6a55; }
.char-actions {
  position: absolute;
  bottom: 4vh;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 18px;
}

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 6; }
#crosshair {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 4px;
  height: 4px;
  margin: -2px 0 0 -2px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.55);
  transition: transform 0.12s, background 0.12s;
}
#crosshair.active { transform: scale(2.2); background: rgba(255, 220, 200, 0.9); }
#prompt {
  position: absolute;
  left: 50%;
  top: calc(50% + 26px);
  transform: translateX(-50%);
  padding: 6px 12px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid var(--line);
  font-size: 15px;
  letter-spacing: 0.05em;
  opacity: 0;
  transition: opacity 0.15s;
  white-space: nowrap;
}
#prompt.show { opacity: 1; }
#objective {
  position: absolute;
  top: 22px;
  left: 26px;
  font-family: Georgia, serif;
  font-style: italic;
  font-size: 17px;
  color: #d9c9b8;
  text-shadow: 0 1px 3px #000;
}
#hud-players { position: absolute; top: 20px; right: 24px; display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.hp-row { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 4px 10px; background: rgba(0,0,0,0.5); }
.hp-row .dot { width: 8px; height: 8px; border-radius: 50%; }
.bars { position: absolute; left: 26px; bottom: 24px; display: flex; flex-direction: column; gap: 7px; }
.bar { display: grid; grid-template-columns: 76px 180px; align-items: center; font-size: 12px; color: var(--dim); letter-spacing: 0.08em; text-transform: uppercase; }
.track { height: 6px; background: rgba(255, 255, 255, 0.1); }
.fill { height: 100%; width: 100%; transition: width 0.1s linear; }
.fill.health { background: #a3160e; }
.fill.stamina { background: #d8cfc0; }
.fill.battery { background: #f2c218; }
#controls-hint {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 16px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid var(--line);
  font-size: 13.5px;
  color: #c9c0b2;
  white-space: nowrap;
}
#controls-hint b { color: #fff; }

#toast {
  position: fixed;
  left: 50%;
  top: 18%;
  transform: translate(-50%, -10px);
  max-width: 640px;
  padding: 12px 20px;
  background: rgba(0, 0, 0, 0.75);
  border-left: 3px solid var(--red);
  font-family: Georgia, serif;
  font-style: italic;
  font-size: 18px;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
  z-index: 20;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- оверлеи ---------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 12;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: rgba(0, 0, 0, 0.78);
}
.overlay.light { background: rgba(0, 0, 0, 0.35); cursor: pointer; }
#intro { background: #000; cursor: pointer; }
#intro p { max-width: 560px; font-family: Georgia, serif; font-size: 19px; line-height: 1.6; color: #b9a99a; }
.intro-chapter { font-size: 14px; letter-spacing: 0.6em; color: var(--red-glow); margin-bottom: 10px; }
.intro-title { font-family: 'Didot', 'Times New Roman', serif; font-size: 72px; font-weight: 900; letter-spacing: 0.2em; margin-bottom: 18px; }
.intro-title.small { font-size: 44px; }
#chapter { pointer-events: none; background: rgba(0,0,0,0.65); animation: fade-in 1.2s ease; }
#chapter p { font-family: Georgia, serif; font-style: italic; font-size: 19px; color: #b9a99a; line-height: 1.6; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.pause-buttons { display: flex; flex-direction: column; gap: 6px; margin-top: 30px; align-items: flex-start; }

.paper {
  position: relative;
  width: min(540px, 90vw);
  padding: 40px 44px 30px;
  background:
    radial-gradient(ellipse at 20% 10%, rgba(120, 90, 50, 0.25), transparent 50%),
    radial-gradient(ellipse at 90% 90%, rgba(90, 30, 20, 0.3), transparent 40%),
    #d7ccb2;
  color: #2a1e16;
  box-shadow: 0 20px 80px rgba(0, 0, 0, 0.8), inset 0 0 60px rgba(80, 50, 20, 0.4);
  transform: rotate(-1.2deg);
  text-align: left;
}
.paper pre {
  margin: 0 0 22px;
  white-space: pre-wrap;
  font-family: 'Bradley Hand', 'Segoe Print', 'Comic Sans MS', cursive;
  font-size: 19px;
  line-height: 1.5;
}
.paper .small-btn.ghost { color: #4a3a2e; border-color: rgba(60, 40, 30, 0.35); }

#lock-box { display: flex; flex-direction: column; align-items: center; }
#lock-box.shake { animation: lock-shake 0.4s; }
@keyframes lock-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-12px) rotate(-2deg); }
  40% { transform: translateX(10px) rotate(2deg); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(4px); }
}
.lock-shackle {
  width: 190px;
  height: 120px;
  border: 26px solid #8d8d8d;
  border-bottom: none;
  border-radius: 100px 100px 0 0;
  background: transparent;
  box-shadow: inset 0 6px 10px rgba(0,0,0,0.5);
  margin-bottom: -4px;
}
.lock-body {
  padding: 26px 34px 24px;
  background: linear-gradient(160deg, #a8823a, #6b4f1e 60%, #4a3512);
  border-radius: 16px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.9), inset 0 2px 0 rgba(255, 255, 255, 0.25);
  color: #1d1408;
}
.lock-title { font-size: 12px; letter-spacing: 0.4em; font-weight: 700; opacity: 0.7; margin-bottom: 16px; }
#lock-wheels { display: flex; gap: 14px; justify-content: center; }
.wheel { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px; border-radius: 8px; cursor: pointer; }
.wheel.active { background: rgba(0, 0, 0, 0.18); box-shadow: 0 0 0 2px rgba(255, 230, 160, 0.4); }
.wheel-label { font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.wheel-digit {
  width: 64px;
  height: 78px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #111 0%, #3a3a3a 50%, #111 100%);
  color: #f1e9d6;
  font-family: 'Courier New', monospace;
  font-size: 46px;
  font-weight: 700;
  border-radius: 6px;
  box-shadow: inset 0 0 10px #000;
}
.wheel-btn {
  width: 64px;
  padding: 3px 0;
  background: rgba(0, 0, 0, 0.25);
  border: none;
  border-radius: 4px;
  color: #1d1408;
  font-size: 14px;
  cursor: pointer;
}
.wheel-btn:hover { background: rgba(0, 0, 0, 0.4); color: #fff; }
#lock-msg { margin: 16px 0 14px; font-size: 14px; min-height: 20px; max-width: 360px; }
#lock-msg.bad { color: #5a0000; font-weight: 700; }
#lock-msg.ok { color: #0d3d10; font-weight: 700; }
.lock-actions { display: flex; gap: 10px; justify-content: center; }
.lock-body .small-btn.ghost { color: #2a1e10; border-color: rgba(0,0,0,0.3); }

#scream {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  animation: scream-flash 0.12s steps(2) 3;
}
#scream img {
  height: 115vh;
  animation: scream-zoom 0.9s cubic-bezier(.1,.9,.2,1) forwards, scream-jitter 0.06s infinite;
  filter: contrast(1.3) saturate(1.2);
}
#scream.fade { opacity: 0; transition: opacity 0.35s; }
@keyframes scream-zoom { from { transform: scale(0.55); } to { transform: scale(1.12); } }
@keyframes scream-jitter {
  0% { translate: 0 0; }
  33% { translate: 8px -6px; }
  66% { translate: -7px 5px; }
  100% { translate: 0 0; }
}
@keyframes scream-flash {
  0% { background: #400; }
  100% { background: #000; }
}

@media (max-width: 1000px) {
  #menu { flex-direction: column; justify-content: safe center; gap: 24px; overflow-y: auto; padding-top: 40px; padding-bottom: 40px; }
  #lobby-panel { width: 100%; max-width: 420px; }
  .menu-btn { min-width: 280px; font-size: 21px; }
  .char-panel { right: 50%; transform: translate(50%, -50%); top: 38%; width: 90vw; max-width: 420px; }
}

/* ================= v2: новые экраны ================= */
#objective.flash { animation: obj-flash 1.4s ease; }
@keyframes obj-flash { 0% { color: #fff; text-shadow: 0 0 14px #ff3a20; } 100% { color: #d9c9b8; } }
#objective { max-width: 46vw; line-height: 1.35; }

#inv { position: absolute; right: 24px; bottom: 24px; display: flex; gap: 6px; }
.inv-slot {
  position: relative; width: 52px; height: 52px; display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.6); border: 1px solid var(--line); font-size: 26px;
}
.inv-n { position: absolute; right: 4px; bottom: 2px; font-size: 13px; font-weight: 700; color: #fff; }
.inv-key { position: absolute; left: 4px; top: 2px; font-size: 10px; color: #f2c218; font-weight: 700; }
#controls-hint { line-height: 1.7; text-align: center; white-space: normal; max-width: 92vw; }
.hp-row.downed { color: #ff6a55; }

#revive { position: absolute; left: 50%; top: 60%; transform: translateX(-50%); width: 260px; text-align: center; font-size: 14px; }
#revive .track { margin-top: 6px; height: 8px; }

#hide-overlay {
  position: fixed; inset: 0; z-index: 4; pointer-events: none;
  background:
    linear-gradient(90deg, #000 0%, #000 18%, rgba(0,0,0,0) 30%, rgba(0,0,0,0) 70%, #000 82%, #000 100%),
    repeating-linear-gradient(180deg, rgba(0,0,0,0.92) 0 26px, rgba(0,0,0,0) 26px 44px);
}

#chapter-card { position: fixed; inset: 0; z-index: 11; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; background: radial-gradient(ellipse at center, rgba(0,0,0,0.75), rgba(0,0,0,0.2)); animation: fade-in 1s ease; }
#chapter-card p { font-family: Georgia, serif; font-style: italic; font-size: 19px; color: #b9a99a; }
.overlay.soft { background: rgba(40, 0, 0, 0.35); pointer-events: none; }
#downed-overlay p { max-width: 520px; font-family: Georgia, serif; font-size: 18px; color: #e8d8c8; }
#death p, #ending p { max-width: 620px; font-family: Georgia, serif; font-size: 19px; line-height: 1.6; color: #c9b9a8; }
.pause-buttons.center { align-items: center; }
.overlay.dawn { background: linear-gradient(180deg, #0b0f1a 0%, #2a2436 55%, #6b4a3a 100%); }
#ending-final { display: flex; flex-direction: column; align-items: center; margin-top: 18px; }

.note-title { font-family: Georgia, serif; font-weight: 700; font-size: 20px; margin-bottom: 14px; color: #3a1e10; }
#note-img { display: block; width: 100%; margin-bottom: 14px; border: 1px solid rgba(0,0,0,0.3); }

.journal-box { width: min(900px, 94vw); height: min(620px, 86vh); display: flex; flex-direction: column; gap: 14px; padding: 24px; background: rgba(12, 9, 8, 0.92); border: 1px solid var(--line); text-align: left; }
.journal-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.screen-title.small { font-size: 24px; }
.journal-obj { font-family: Georgia, serif; font-style: italic; color: #d9c9b8; font-size: 15px; }
.journal-body { flex: 1; display: grid; grid-template-columns: 240px 1fr; gap: 16px; min-height: 0; }
#journal-list { display: flex; flex-direction: column; gap: 4px; overflow-y: auto; }
.j-item { text-align: left; padding: 9px 12px; background: rgba(255,255,255,0.04); border: 1px solid var(--line); color: var(--bone); font-family: inherit; font-size: 14px; cursor: pointer; }
.j-item:hover { background: rgba(150, 10, 5, 0.35); }
#journal-read { overflow-y: auto; padding: 16px 20px; background: #d7ccb2; color: #2a1e16; }
#journal-read pre { white-space: pre-wrap; font-family: 'Bradley Hand', 'Segoe Print', cursive; font-size: 17px; line-height: 1.5; margin: 0; }
#journal-read img { width: 100%; margin-bottom: 10px; }
.j-empty { color: #8c857a; font-style: italic; }
#journal-read .j-empty { color: #5a4a3a; }
#journal-close { align-self: flex-end; }

#settings { z-index: 30; }
.settings-box { width: min(520px, 92vw); text-align: left; display: flex; flex-direction: column; gap: 14px; }
.set-row { display: grid; grid-template-columns: 200px 1fr 44px; align-items: center; gap: 12px; font-size: 14px; color: #c9c0b2; }
.set-row.check { grid-template-columns: 1fr 20px; }
.set-row input[type=range] { accent-color: #b3120c; }
.set-row input[type=checkbox] { accent-color: #b3120c; width: 18px; height: 18px; }
.set-row b { color: #fff; font-weight: 600; text-align: right; }
.seg { display: flex; grid-column: span 2; }
.seg button { flex: 1; padding: 7px 8px; background: rgba(0,0,0,0.5); border: 1px solid var(--line); color: #c9c0b2; font-family: inherit; font-size: 13px; cursor: pointer; }
.seg button.on { background: #6d0a06; border-color: #a3160e; color: #fff; }
#set-close { align-self: flex-end; }

#chapters { z-index: 25; gap: 18px; }
.chapter-list { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.chapter-btn { width: 190px; padding: 18px 16px; background: rgba(12, 8, 8, 0.85); border: 1px solid var(--line); border-bottom: 3px solid #b3120c; color: var(--bone); font-family: inherit; text-align: left; cursor: pointer; transition: transform 0.15s, background 0.15s; }
.chapter-btn:hover { transform: translateY(-4px); background: rgba(60, 8, 6, 0.85); }
.chapter-btn .cb-n { font-size: 12px; letter-spacing: 0.3em; color: #ff2a1a; }
.chapter-btn .cb-t { font-family: 'Didot', 'Times New Roman', serif; font-size: 24px; font-weight: 900; margin: 4px 0; }
.chapter-btn .cb-s { font-size: 12.5px; color: #8c857a; line-height: 1.4; }
.chapter-btn.locked { opacity: 0.35; pointer-events: none; border-bottom-color: #444; }

/* разные скримеры */
#scream.style-lunge img { animation: scream-lunge 0.7s cubic-bezier(.2,1.4,.3,1) forwards, scream-jitter 0.05s infinite; }
@keyframes scream-lunge { 0% { transform: scale(0.2) translateY(30%); } 60% { transform: scale(1.25); } 100% { transform: scale(1.15); } }
#scream.style-glitch img { animation: scream-glitch 0.12s steps(2) infinite; filter: contrast(1.6) grayscale(0.6); }
@keyframes scream-glitch { 0% { transform: scale(1.1) translateX(-6%); clip-path: inset(0 0 40% 0); } 50% { transform: scale(1.15) translateX(5%); clip-path: inset(30% 0 0 0); } 100% { transform: scale(1.1); clip-path: none; } }
#scream.style-drop img { animation: scream-drop 0.45s cubic-bezier(.2,1.6,.4,1) forwards, scream-jitter 0.06s infinite; }
@keyframes scream-drop { 0% { transform: translateY(-120%) scale(1.2); } 100% { transform: translateY(0) scale(1.1); } }
#scream.style-flicker img { animation: scream-flicker 0.5s steps(1) forwards; }
@keyframes scream-flicker { 0% { opacity: 1; transform: scale(1.05); } 20% { opacity: 0; } 35% { opacity: 1; transform: scale(1.15); } 55% { opacity: 0; } 70% { opacity: 1; transform: scale(1.3); } 100% { opacity: 1; transform: scale(1.3); } }
.chapter-list { flex-direction: column; align-items: center; }
.chapter-btn.main { width: min(560px, 90vw); padding: 24px 26px; border-bottom-width: 4px; text-align: center; }
.chapter-btn.main .cb-t { font-size: 34px; }
.chapter-btn.main .cb-s { font-size: 15px; color: #c9b9a8; }
.chapter-sub { margin-top: 10px; color: #8c857a; font-size: 14px; }
.chapter-row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.chapter-btn.small { width: 170px; padding: 12px 14px; }
.chapter-btn.small .cb-t { font-size: 20px; }
