/* ДОМ ОЗЁРОВЫХ — оформление страницы: меню, игровой интерфейс, окна улик, пауза, итоги */
:root {
  --bg: #050608;
  --ink: #dde1e8;
  --dim: #8a92a2;
  --faint: #5c6370;
  --line: rgba(255, 255, 255, 0.12);
  --line2: rgba(255, 255, 255, 0.22);
  --panel: rgba(10, 12, 16, 0.94);
  --red: #c8372b;
  --red2: #7d1810;
  --gold: #ffd76a;
  --paper: #e7ddc4;
  --paper2: #d8ccae;
  --paper-ink: #2b241a;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "Courier New", Courier, monospace;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #000;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
input[type="text"] { user-select: text; -webkit-user-select: text; }
.hidden { display: none !important; }

#game {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  outline: none;
}
body.st-play #game { cursor: crosshair; }

/* ================= кнопки и поля ================= */
.btn {
  appearance: none;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line2);
  color: var(--ink);
  padding: 10px 18px;
  border-radius: 3px;
  letter-spacing: 0.04em;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
}
.btn:hover { background: rgba(255, 255, 255, 0.12); border-color: rgba(255, 255, 255, 0.4); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, .x:focus-visible, #menu-items button:focus-visible, .seg button:focus-visible, .look:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}
.btn.primary { background: var(--red2); border-color: var(--red); color: #fff; }
.btn.primary:hover { background: var(--red); }
.btn.danger { border-color: rgba(200, 55, 43, 0.6); color: #f0a49c; }
.btn.danger:hover { background: rgba(200, 55, 43, 0.25); }
.btn.big { padding: 14px 34px; font-size: 18px; letter-spacing: 0.12em; text-transform: uppercase; }
.btn.small { padding: 6px 12px; font-size: 13px; }
.btn[disabled] { opacity: 0.4; cursor: default; pointer-events: none; }

.field { display: block; margin: 0 0 16px; }
.field > span { display: block; font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--dim); margin-bottom: 6px; }
input[type="text"] {
  width: 100%;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--line2);
  border-radius: 3px;
  padding: 10px 12px;
  outline: none;
}
input[type="text"]:focus { border-color: var(--gold); }
.code-input { font-family: var(--mono); font-size: 30px; letter-spacing: 0.5em; text-align: center; text-transform: uppercase; padding-left: 0.5em !important; }
.form-msg { min-height: 22px; color: #f0a49c; font-size: 14px; }
.form-msg.ok { color: #a8d8a0; }

.check { display: flex; align-items: center; gap: 10px; margin: 4px 0 12px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--red); }

.seg { display: inline-flex; border: 1px solid var(--line2); border-radius: 3px; overflow: hidden; }
.seg button { background: transparent; border: 0; border-right: 1px solid var(--line); padding: 8px 14px; color: var(--dim); font-size: 14px; }
.seg button:last-child { border-right: 0; }
.seg button:hover { color: var(--ink); background: rgba(255, 255, 255, 0.06); }
.seg button.on { background: rgba(200, 55, 43, 0.35); color: #fff; }
.seg.locked { opacity: 0.55; pointer-events: none; }
.diff-note { font-size: 13px; color: var(--dim); margin-top: 8px; min-height: 38px; }

.switch { position: relative; display: inline-block; width: 46px; height: 24px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.switch i { position: absolute; inset: 0; border-radius: 12px; background: rgba(255, 255, 255, 0.12); border: 1px solid var(--line2); transition: background 0.15s; }
.switch i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #aab1bd; transition: transform 0.15s, background 0.15s; }
.switch input:checked + i { background: rgba(200, 55, 43, 0.55); }
.switch input:checked + i::after { transform: translateX(22px); background: #fff; }
.switch input:focus-visible + i { outline: 2px solid var(--gold); outline-offset: 2px; }

input[type="range"] { appearance: none; -webkit-appearance: none; width: 220px; height: 22px; background: transparent; }
input[type="range"]::-webkit-slider-runnable-track { height: 4px; background: rgba(255, 255, 255, 0.2); border-radius: 2px; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; margin-top: -6px; border-radius: 50%; background: var(--ink); border: 2px solid var(--red); }
input[type="range"]::-moz-range-track { height: 4px; background: rgba(255, 255, 255, 0.2); border-radius: 2px; }
input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--ink); border: 2px solid var(--red); }
output { display: inline-block; min-width: 46px; text-align: right; font-variant-numeric: tabular-nums; color: var(--dim); font-size: 14px; }

/* ================= экраны ================= */
.screen { position: fixed; inset: 0; z-index: 70; display: none; }
.screen.on { display: block; }

.logo { font-family: var(--serif); line-height: 0.95; text-transform: uppercase; }
.logo .l1 { display: block; font-size: 30px; letter-spacing: 0.72em; color: #b9c0cc; margin-left: 4px; }
.logo .l2 { display: block; font-size: 76px; letter-spacing: 0.1em; color: #f1ede4; text-shadow: 0 0 34px rgba(200, 55, 43, 0.35), 0 2px 0 #000; animation: lamp 9s infinite; }
@keyframes lamp {
  0%, 41%, 43%, 45%, 78%, 79.5%, 100% { opacity: 1; }
  42%, 44%, 79% { opacity: 0.45; }
}

/* заставка */
#splash { background: radial-gradient(ellipse at 50% 38%, rgba(26, 30, 40, 0.86) 0%, rgba(3, 4, 6, 0.97) 62%, #000 100%); }
.splash-box { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(620px, 92vw); text-align: center; }
.splash-box .logo .l1 { margin-left: 0.72em; }
.tagline { margin: 18px 0 26px; color: var(--dim); font-family: var(--serif); font-style: italic; font-size: 18px; }
.lang-pick { display: inline-flex; gap: 10px; margin-bottom: 26px; }
.lang-pick button { background: transparent; border: 1px solid var(--line2); border-radius: 3px; padding: 8px 22px; color: var(--dim); letter-spacing: 0.06em; }
.lang-pick button:hover { color: var(--ink); }
.lang-pick button.on { color: #fff; border-color: var(--red); background: rgba(200, 55, 43, 0.25); }
.warn { list-style: none; margin: 0 auto 28px; padding: 14px 20px; width: fit-content; max-width: 100%; text-align: left; border-left: 2px solid var(--red2); color: #b4bbc8; font-size: 15px; }
.warn li { margin: 4px 0; }
.boot-note { margin-top: 16px; min-height: 20px; color: var(--faint); font-size: 13px; letter-spacing: 0.08em; }
.boot-note.err { color: #f0a49c; }

/* главное меню */
#menu { background: linear-gradient(90deg, rgba(2, 3, 5, 0.94) 0%, rgba(2, 3, 5, 0.78) 26%, rgba(2, 3, 5, 0.25) 50%, rgba(2, 3, 5, 0) 70%), linear-gradient(0deg, rgba(0, 0, 0, 0.6) 0%, rgba(0, 0, 0, 0) 22%); }
.menu-left { position: absolute; left: clamp(28px, 6vw, 96px); top: 50%; transform: translateY(-54%); width: min(520px, 90vw); }
.menu-sub { margin: 14px 0 34px 4px; font-size: 13px; letter-spacing: 0.34em; text-transform: uppercase; color: var(--red); }
#menu-items { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
#menu-items button {
  position: relative;
  background: none;
  border: 0;
  padding: 9px 0 9px 4px;
  font-family: var(--serif);
  font-size: 25px;
  letter-spacing: 0.04em;
  color: #aeb5c1;
  transition: color 0.15s, padding-left 0.18s, text-shadow 0.15s;
}
#menu-items button::before { content: ""; position: absolute; left: 0; top: 50%; width: 0; height: 2px; background: var(--red); transition: width 0.18s; }
#menu-items button:hover, #menu-items button:focus-visible { color: #fff; padding-left: 30px; text-shadow: 0 0 18px rgba(255, 255, 255, 0.28); }
#menu-items button:hover::before, #menu-items button:focus-visible::before { width: 20px; }
#menu-items button:nth-child(-n+3) { font-size: 29px; color: #d6dae2; }
#menu-items button:nth-child(4) { margin-top: 14px; }

.casefile {
  position: absolute;
  right: clamp(24px, 5vw, 84px);
  bottom: clamp(64px, 12vh, 130px);
  width: 320px;
  padding: 26px 24px 20px;
  background: linear-gradient(170deg, var(--paper) 0%, var(--paper2) 100%);
  color: var(--paper-ink);
  font-family: var(--mono);
  font-size: 13.5px;
  line-height: 1.5;
  transform: rotate(1.6deg);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.7), inset 0 0 40px rgba(90, 60, 20, 0.25);
  opacity: 0.9;
  transition: transform 0.25s, opacity 0.25s;
}
.casefile:hover { transform: rotate(0deg) scale(1.03); opacity: 1; }
.cf-pin { position: absolute; top: -7px; left: 50%; width: 15px; height: 15px; margin-left: -7px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #ff8a7a, #8a1810 70%); box-shadow: 0 3px 4px rgba(0, 0, 0, 0.5); }
.cf-stamp { position: absolute; right: 14px; top: 16px; padding: 2px 8px; border: 2px solid rgba(160, 30, 20, 0.75); color: rgba(160, 30, 20, 0.8); font-weight: bold; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; transform: rotate(-9deg); }
.cf-head { font-weight: bold; font-size: 17px; letter-spacing: 0.08em; margin-bottom: 10px; }
.cf-line { margin: 0 0 8px; }
.cf-sign { text-align: right; font-style: italic; margin-top: 10px; }

.menu-foot { position: absolute; left: clamp(28px, 6vw, 96px); bottom: 26px; display: flex; align-items: center; gap: 18px; color: var(--faint); font-size: 13px; }
.lang-switch { display: inline-flex; border: 1px solid var(--line2); border-radius: 3px; overflow: hidden; }
.lang-switch button { background: none; border: 0; padding: 5px 11px; color: var(--dim); font-size: 12px; letter-spacing: 0.1em; }
.lang-switch button.on { background: rgba(200, 55, 43, 0.35); color: #fff; }
.foot-btn { background: none; border: 0; border-bottom: 1px dotted var(--faint); color: var(--dim); padding: 2px 0; font-size: 13px; }
.foot-btn:hover { color: var(--ink); }
.clock317 { font-family: var(--mono); letter-spacing: 0.12em; color: #7a2018; }
.clock317 i { font-style: normal; animation: blink 1.2s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.foot-note { color: var(--faint); }

#whisper { position: fixed; left: 50%; bottom: 13vh; transform: translateX(-50%); z-index: 71; font-family: var(--serif); font-style: italic; font-size: 20px; color: var(--gold); opacity: 0; pointer-events: none; text-shadow: 0 0 14px rgba(255, 215, 106, 0.5); transition: opacity 1.6s; }
#whisper.on { opacity: 0.85; }

#menu-toast { position: fixed; left: 50%; top: 26px; transform: translate(-50%, -20px); z-index: 90; padding: 10px 18px; background: rgba(20, 8, 6, 0.95); border: 1px solid var(--red); border-radius: 3px; color: #ffd9d4; opacity: 0; pointer-events: none; transition: opacity 0.25s, transform 0.25s; max-width: 90vw; text-align: center; }
#menu-toast.on { opacity: 1; transform: translate(-50%, 0); }
#menu-toast.ok { border-color: #5a9a52; color: #d6f0d0; background: rgba(8, 18, 8, 0.95); }

/* ================= панели ================= */
#panels { position: fixed; inset: 0; z-index: 80; display: none; align-items: center; justify-content: center; background: rgba(0, 0, 0, 0.62); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
#panels.open { display: flex; }
#panels.see-through { background: rgba(0, 0, 0, 0); backdrop-filter: none; -webkit-backdrop-filter: none; align-items: flex-end; padding-bottom: 4vh; }
.panel { display: none; flex-direction: column; width: min(560px, 94vw); max-height: 92vh; background: var(--panel); border: 1px solid var(--line2); border-top: 2px solid var(--red2); box-shadow: 0 30px 90px rgba(0, 0, 0, 0.8); }
.panel.on { display: flex; animation: panel-in 0.18s ease-out; }
@keyframes panel-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.panel.narrow { width: min(460px, 94vw); }
.panel.wide { width: min(900px, 95vw); }
.panel header { display: flex; align-items: center; justify-content: space-between; padding: 16px 22px 12px; border-bottom: 1px solid var(--line); }
.panel h2 { margin: 0; font-family: var(--serif); font-weight: normal; font-size: 26px; letter-spacing: 0.05em; }
.x { background: none; border: 0; font-size: 28px; line-height: 1; color: var(--dim); padding: 0 4px; }
.x:hover { color: #fff; }
.panel-body { padding: 20px 22px; overflow-y: auto; }
.panel footer { display: flex; justify-content: space-between; gap: 12px; padding: 14px 22px 18px; border-top: 1px solid var(--line); }
.panel footer .btn:only-child { margin-left: auto; }
.panel p { margin: 0 0 12px; }

/* выбор полицейского */
.looks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.look { background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line2); border-radius: 4px; padding: 8px 6px 9px; text-align: center; transition: border-color 0.15s, background 0.15s; }
.look canvas { display: block; width: 84px; height: 84px; margin: 0 auto 6px; border-radius: 50%; background: #0c1016; }
.look span { display: block; font-size: 12.5px; color: var(--dim); line-height: 1.25; }
.look:hover { border-color: rgba(255, 255, 255, 0.45); }
.look.sel { border-color: var(--red); background: rgba(200, 55, 43, 0.18); }
.look.sel span { color: #fff; }
.look.taken { opacity: 0.35; pointer-events: none; }

/* комната */
.lobby { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; }
.invite { text-align: center; padding: 14px 14px 12px; border: 1px dashed var(--line2); background: rgba(0, 0, 0, 0.35); }
.invite-label, .pl-label { font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--dim); }
.invite-code { font-family: var(--mono); font-size: 58px; line-height: 1.1; letter-spacing: 0.22em; padding-left: 0.22em; color: var(--gold); text-shadow: 0 0 22px rgba(255, 215, 106, 0.3); user-select: text; -webkit-user-select: text; }
.invite-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 8px 0; }
.invite-link { font-family: var(--mono); font-size: 12px; color: var(--dim); word-break: break-all; user-select: text; -webkit-user-select: text; }
.invite-help { margin-top: 8px; font-size: 13px; color: var(--faint); }
.players { margin-top: 18px; }
.pl { display: flex; align-items: center; gap: 12px; padding: 9px 10px; margin-top: 8px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.03); }
.pl canvas { width: 44px; height: 44px; border-radius: 50%; background: #0c1016; flex: none; }
.pl .pl-name { font-size: 17px; }
.pl .pl-role { font-size: 12.5px; color: var(--dim); }
.pl .pl-tag { margin-left: auto; font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold); }
.pl.empty { border-style: dashed; color: var(--faint); justify-content: center; min-height: 64px; font-style: italic; }
.pl.empty i { display: inline-block; width: 8px; height: 8px; margin-right: 10px; border-radius: 50%; background: var(--red); animation: pulse 1.4s infinite; }
@keyframes pulse { 0%, 100% { opacity: 0.25; } 50% { opacity: 1; } }

/* настройки */
.tabs { display: flex; gap: 2px; padding: 0 22px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button { background: none; border: 0; border-bottom: 2px solid transparent; padding: 12px 14px 10px; color: var(--dim); font-size: 14px; letter-spacing: 0.06em; white-space: nowrap; }
.tabs button:hover { color: var(--ink); }
.tabs button.on { color: #fff; border-bottom-color: var(--red); }
.tab { display: none; }
.tab.on { display: block; }
#p-settings .panel-body { min-height: 380px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 11px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
.row:last-child { border-bottom: 0; }
.row-label small { display: block; color: var(--faint); font-size: 12.5px; margin-top: 2px; max-width: 380px; }
.row-ctl { display: flex; align-items: center; gap: 10px; flex: none; }
.row-ctl.wide { justify-content: center; }
.row-ctl.wide input[type="range"] { width: 300px; }
.keys { display: grid; grid-template-columns: 1fr 1fr; gap: 7px 22px; margin-top: 18px; font-size: 14px; }
.keys > div { display: flex; align-items: center; gap: 10px; }
.keys span { color: var(--dim); }
kbd { display: inline-block; min-width: 68px; padding: 3px 8px; border: 1px solid var(--line2); border-bottom-width: 2px; border-radius: 4px; background: rgba(255, 255, 255, 0.05); font-family: var(--mono); font-size: 13px; text-align: center; color: #fff; }

.calib-row { display: flex; justify-content: center; gap: 26px; margin-bottom: 14px; }
.calib-sq { text-align: center; font-size: 12.5px; color: var(--dim); }
.calib-sq canvas { display: block; width: 150px; height: 150px; background: #000; border: 1px solid #111; margin-bottom: 6px; }
.calib-text { text-align: center; color: var(--dim); font-size: 14px; }

.howto { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; font-size: 15px; }
.howto h3, .j-col h3 { margin: 0 0 8px; font-family: var(--serif); font-weight: normal; font-size: 19px; color: var(--gold); letter-spacing: 0.03em; }
.howto h3:not(:first-child) { margin-top: 18px; }
.howto ul { margin: 0; padding-left: 18px; }
.howto li { margin: 5px 0; color: #c3c9d3; }
.howto p { color: #c3c9d3; }

.credits dl { margin: 0 0 14px; display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 14.5px; }
.credits dt { color: var(--dim); }
.credits dd { margin: 0; }
.cr-lead { font-family: var(--serif); font-size: 17px; }
.cr-note { color: var(--faint); font-size: 13px; }

/* ================= игровой интерфейс ================= */
#hud { position: fixed; inset: 0; z-index: 10; pointer-events: none; }
#crosshair { position: absolute; left: 50%; top: 50%; width: 5px; height: 5px; margin: -2.5px 0 0 -2.5px; border-radius: 50%; background: rgba(255, 255, 255, 0.75); box-shadow: 0 0 3px rgba(0, 0, 0, 0.9); }
#hold-ring { --k: 0; position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px 0 0 -23px; border-radius: 50%; background: conic-gradient(var(--gold) calc(var(--k) * 360deg), rgba(255, 255, 255, 0.14) 0); -webkit-mask: radial-gradient(circle, transparent 18px, #000 19px); mask: radial-gradient(circle, transparent 18px, #000 19px); opacity: 0; transition: opacity 0.12s; }
#hold-ring.on { opacity: 1; }

#prompt { position: absolute; left: 50%; top: calc(50% + 44px); transform: translateX(-50%); display: flex; align-items: center; gap: 10px; padding: 6px 12px 6px 6px; background: rgba(4, 5, 8, 0.72); border: 1px solid var(--line); border-radius: 4px; white-space: nowrap; opacity: 0; transition: opacity 0.12s; }
#prompt.on { opacity: 1; }
#prompt .key { display: inline-block; min-width: 26px; padding: 2px 7px; border: 1px solid rgba(255, 255, 255, 0.55); border-radius: 3px; font-family: var(--mono); font-weight: bold; font-size: 14px; text-align: center; color: #fff; }
#prompt .txt { font-size: 15px; }
#prompt.locked { border-color: rgba(200, 55, 43, 0.5); }
#prompt.locked .txt { color: #e8aaa2; }
#prompt.locked .key { border-color: rgba(200, 55, 43, 0.7); color: #e8aaa2; }

#objective { position: absolute; left: 24px; top: 20px; max-width: 360px; padding: 10px 14px 11px; background: linear-gradient(90deg, rgba(4, 5, 8, 0.72), rgba(4, 5, 8, 0.2)); border-left: 2px solid var(--red2); }
#obj-floor { font-size: 11px; letter-spacing: 0.24em; text-transform: uppercase; color: var(--red); }
#obj-text { font-family: var(--serif); font-size: 17px; line-height: 1.3; margin: 2px 0 4px; text-shadow: 0 1px 2px #000; }
#obj-count { font-size: 12.5px; color: var(--dim); letter-spacing: 0.06em; }

#partner { position: absolute; right: 24px; top: 20px; min-width: 170px; padding: 9px 14px 10px; text-align: right; background: linear-gradient(270deg, rgba(4, 5, 8, 0.72), rgba(4, 5, 8, 0.2)); border-right: 2px solid #4d6a8a; }
.partner-label { font-size: 11px; letter-spacing: 0.24em; text-transform: uppercase; color: #7d9ab8; }
#partner-name { font-size: 16px; }
#partner-state { font-size: 12.5px; color: var(--dim); }
#partner.danger { border-right-color: var(--red); animation: danger-bg 0.8s infinite; }
#partner.danger #partner-state { color: #ff9a8e; font-weight: bold; }
@keyframes danger-bg { 50% { background: linear-gradient(270deg, rgba(120, 20, 12, 0.75), rgba(4, 5, 8, 0.2)); } }

#status { position: absolute; left: 24px; bottom: 22px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.st-row { display: flex; align-items: center; gap: 9px; }
#battery { --k: 1; position: relative; width: 58px; height: 22px; border: 2px solid rgba(255, 255, 255, 0.75); border-radius: 3px; }
#battery::after { content: ""; position: absolute; right: -6px; top: 5px; width: 4px; height: 8px; background: rgba(255, 255, 255, 0.75); border-radius: 0 2px 2px 0; }
#battery i { position: absolute; left: 2px; top: 2px; bottom: 2px; width: calc((100% - 4px) * var(--k)); background: #e8e2c8; transition: width 0.3s; }
#battery.low i { background: var(--red); animation: blink 0.9s steps(1) infinite; }
#battery.off { opacity: 0.45; }
#battery-spares { font-family: var(--mono); font-size: 15px; color: #d0d5dd; text-shadow: 0 1px 2px #000; }
#stamina { --k: 1; width: 120px; height: 3px; background: rgba(255, 255, 255, 0.16); transition: opacity 0.4s; }
#stamina i { display: block; height: 100%; width: calc(100% * var(--k)); background: #cfd6e2; }
#stamina.full { opacity: 0; }
#stamina.lock i { background: var(--red); }
#hint-key { --k: 1; position: relative; display: flex; align-items: center; gap: 7px; padding: 2px 8px 2px 3px; font-size: 12.5px; color: var(--gold); overflow: hidden; }
#hint-key b { display: inline-block; min-width: 20px; padding: 0 5px; border: 1px solid rgba(255, 215, 106, 0.7); border-radius: 3px; font-family: var(--mono); text-align: center; }
#hint-key.cool { color: #7c7355; }
#hint-key.cool b { border-color: #7c7355; }
#hint-key::after { content: ""; position: absolute; left: 0; bottom: 0; height: 1px; width: calc(100% * var(--k)); background: var(--gold); opacity: 0; }
#hint-key.cool::after { opacity: 0.8; }
body.no-hints #hint-key { display: none; }

#toasts { position: absolute; left: 24px; bottom: 124px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; max-width: min(460px, 60vw); }
.toast { padding: 7px 12px; background: rgba(4, 5, 8, 0.8); border-left: 2px solid #5d6674; font-size: 14.5px; line-height: 1.35; animation: toast-in 0.25s ease-out; transition: opacity 0.7s; text-shadow: 0 1px 2px #000; }
.toast.out { opacity: 0; }
.toast.tip { border-left-color: #6f93c0; color: #cfe0f4; }
.toast.warn { border-left-color: var(--red); color: #ffcfc8; }
.toast.good { border-left-color: var(--gold); color: #fff0c0; }
.toast.say { border-left-color: #7fc08a; color: #d6f0da; font-style: italic; }
@keyframes toast-in { from { opacity: 0; transform: translateX(-12px); } to { opacity: 1; transform: none; } }

#banner { position: absolute; left: 0; right: 0; top: 23%; text-align: center; opacity: 0; pointer-events: none; }
#banner.on { animation: banner 4.5s ease forwards; }
#banner .b1 { font-family: var(--serif); font-size: clamp(34px, 5vw, 60px); letter-spacing: 0.22em; padding-left: 0.22em; text-transform: uppercase; color: #f1ede4; text-shadow: 0 0 30px rgba(0, 0, 0, 0.9), 0 2px 0 #000; }
#banner .b2 { margin-top: 6px; font-size: 16px; letter-spacing: 0.16em; color: #b9c0cc; text-shadow: 0 1px 3px #000; }
@keyframes banner { 0% { opacity: 0; transform: scale(1.06); } 12% { opacity: 1; transform: none; } 78% { opacity: 1; } 100% { opacity: 0; } }

#subtitle { position: fixed; left: 50%; bottom: 9vh; transform: translateX(-50%); z-index: 30; width: max-content; max-width: min(860px, 86vw); padding: 8px 16px 10px; background: rgba(0, 0, 0, 0.62); border-radius: 3px; text-align: center; font-size: 19px; line-height: 1.4; opacity: 0; pointer-events: none; transition: opacity 0.25s; text-shadow: 0 1px 2px #000; }
#subtitle.on { opacity: 1; }
#subtitle b { display: block; font-size: 12px; letter-spacing: 0.2em; text-transform: uppercase; margin-bottom: 2px; }
body.sub-large #subtitle { font-size: 26px; }
body.sub-large #subtitle b { font-size: 15px; }
body.no-subs #subtitle { display: none; }

/* прячемся в шкафу */
#hide-ui { position: absolute; inset: 0; opacity: 0; transition: opacity 0.35s; --k: 1; }
#hide-ui.on { opacity: 1; }
.hide-slit { position: absolute; inset: 0; background: linear-gradient(90deg, #000 0%, #000 31%, rgba(0, 0, 0, 0.82) 37%, rgba(0, 0, 0, 0) 44%, rgba(0, 0, 0, 0) 56%, rgba(0, 0, 0, 0.82) 63%, #000 69%, #000 100%); }
.hide-box { position: absolute; left: 50%; bottom: 17vh; transform: translateX(-50%); text-align: center; }
.hide-title { font-size: 12px; letter-spacing: 0.3em; text-transform: uppercase; color: var(--dim); }
.breath { width: 220px; height: 5px; margin: 8px auto; background: rgba(255, 255, 255, 0.14); }
.breath i { display: block; height: 100%; width: calc(100% * var(--k)); background: #cfd6e2; }
#hide-ui.holding .breath i { background: #7fc6ff; box-shadow: 0 0 10px rgba(127, 198, 255, 0.7); }
.hide-keys { font-size: 13.5px; color: #b9c0cc; }
#hide-ui.danger .hide-title { color: #ff9a8e; animation: blink 0.7s steps(1) infinite; }
#hide-ui.danger .hide-slit { animation: slit-fear 1.1s infinite; }
@keyframes slit-fear { 50% { box-shadow: inset 0 0 180px rgba(140, 10, 0, 0.5); } }

/* схватили */
#down-ui { position: absolute; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center; background: radial-gradient(ellipse at center, rgba(60, 0, 0, 0.15) 0%, rgba(40, 0, 0, 0.75) 100%); }
#down-ui.on { display: flex; animation: down-pulse 1.3s infinite; }
.down-title { font-family: var(--serif); font-size: 44px; letter-spacing: 0.2em; text-transform: uppercase; color: #ffb4aa; text-shadow: 0 0 24px #600; }
#down-text { margin-top: 8px; font-size: 18px; color: #f1d6d2; }
@keyframes down-pulse { 50% { background-color: rgba(70, 0, 0, 0.28); } }

/* метки напарника */
#ping-layer { position: absolute; inset: 0; }
.ping { position: absolute; left: 0; top: 0; display: flex; flex-direction: column; align-items: center; margin: -13px 0 0 -40px; width: 80px; will-change: transform; }
.ping i { width: 18px; height: 18px; border: 2px solid #9fd0ff; transform: rotate(45deg); box-shadow: 0 0 10px rgba(0, 0, 0, 0.8); animation: ping 1s infinite; }
.ping span { margin-top: 8px; font-size: 12px; letter-spacing: 0.06em; text-shadow: 0 1px 3px #000; white-space: nowrap; }
.ping.edge i { border-style: dashed; }
@keyframes ping { 50% { transform: rotate(45deg) scale(1.25); } }

/* ================= ролики ================= */
#cinema { position: fixed; inset: 0; z-index: 20; pointer-events: none; display: none; }
#cinema.on { display: block; }
#cinema.black { background: #000; }
#cinema .bar { position: absolute; left: 0; right: 0; height: 11vh; background: #000; }
#cinema .bar.top { top: 0; animation: bar-top 1.2s ease-out; }
#cinema .bar.bottom { bottom: 0; animation: bar-bottom 1.2s ease-out; }
@keyframes bar-top { from { transform: translateY(-100%); } }
@keyframes bar-bottom { from { transform: translateY(100%); } }
#cine-caption { position: absolute; opacity: 0; transition: opacity 1.1s; text-shadow: 0 2px 10px #000; }
#cine-caption.on { opacity: 1; }
#cine-caption.center { left: 0; right: 0; top: 50%; transform: translateY(-50%); text-align: center; }
#cine-caption.title { left: 0; right: 0; top: 38%; text-align: center; }
#cine-caption.roles { left: 8vw; bottom: 20vh; text-align: left; }
#cine-caption.bottom { left: 0; right: 0; bottom: 13vh; text-align: center; }
#cine-caption .place { font-family: var(--serif); font-size: clamp(22px, 2.6vw, 34px); letter-spacing: 0.2em; color: #e6e2d8; }
#cine-caption .place2 { margin-top: 8px; font-size: clamp(14px, 1.4vw, 18px); letter-spacing: 0.26em; text-transform: uppercase; color: #9aa2b0; }
#cine-caption .title { font-family: var(--serif); font-size: clamp(46px, 8vw, 112px); letter-spacing: 0.16em; padding-left: 0.16em; color: #f4f0e6; text-shadow: 0 0 50px rgba(200, 55, 43, 0.45), 0 3px 0 #000; }
#cine-caption .title.small { font-size: clamp(34px, 5vw, 70px); }
#cine-caption .kicker { font-size: 13px; letter-spacing: 0.4em; text-transform: uppercase; color: var(--red); margin-bottom: 10px; }
#cine-caption .role { margin: 8px 0; }
#cine-caption .role span { display: block; font-size: 13px; letter-spacing: 0.16em; text-transform: uppercase; color: #9aa2b0; }
#cine-caption .role b { display: block; font-family: var(--serif); font-weight: normal; font-size: clamp(26px, 3vw, 40px); color: #f1ede4; }
#cine-skip { --k: 0; position: absolute; right: 30px; bottom: 3.6vh; padding-bottom: 5px; font-size: 12.5px; letter-spacing: 0.12em; color: rgba(255, 255, 255, 0.5); }
#cine-skip::after { content: ""; position: absolute; left: 0; bottom: 0; height: 2px; width: calc(100% * var(--k)); background: var(--gold); }

/* ================= окна в игре ================= */
.modal { position: fixed; inset: 0; z-index: 40; display: none; align-items: center; justify-content: center; background: rgba(0, 0, 0, 0.74); }
.modal.on { display: flex; }
.modal-hint { margin-top: 14px; font-family: var(--sans); font-size: 12px; letter-spacing: 0.12em; color: rgba(60, 50, 34, 0.7); text-transform: uppercase; }

.card-paper { display: flex; width: min(860px, 92vw); max-height: 86vh; background: linear-gradient(172deg, var(--paper) 0%, var(--paper2) 100%); color: var(--paper-ink); box-shadow: 0 30px 90px #000, inset 0 0 70px rgba(90, 60, 20, 0.28); transform: rotate(-0.6deg); animation: card-in 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.1); }
@keyframes card-in { from { opacity: 0; transform: rotate(-4deg) translateY(30px) scale(0.94); } }
#card-img { flex: none; width: 44%; padding: 22px 0 22px 22px; display: flex; align-items: center; justify-content: center; }
#card-img canvas { max-width: 100%; max-height: 62vh; border: 8px solid #f6f1e2; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45); transform: rotate(1.5deg); background: #111; }
#card-img.empty { display: none; }
.card-body { flex: 1; padding: 30px 30px 22px; overflow-y: auto; }
#card-kicker { display: inline-block; padding: 2px 9px; border: 2px solid rgba(160, 30, 20, 0.8); color: rgba(160, 30, 20, 0.9); font-family: var(--mono); font-weight: bold; font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase; transform: rotate(-2deg); }
#card-title { margin: 12px 0 10px; font-family: var(--serif); font-size: 34px; line-height: 1.1; }
#card-text { font-family: var(--mono); font-size: 15.5px; line-height: 1.55; }
#card-fact { margin-top: 16px; padding: 10px 12px; border-left: 3px solid rgba(160, 30, 20, 0.75); background: rgba(160, 30, 20, 0.08); font-family: var(--serif); font-style: italic; font-size: 17px; }
#card-fact:empty { display: none; }

.note-paper { width: min(560px, 90vw); max-height: 84vh; overflow-y: auto; padding: 34px 38px 26px; color: #25303f; background: repeating-linear-gradient(#f1ecdc 0, #f1ecdc 29px, #b9c7d8 30px), #f1ecdc; box-shadow: 0 30px 90px #000, inset 0 0 60px rgba(90, 60, 20, 0.2); transform: rotate(0.8deg); animation: card-in 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.1); }
#note-title { font-family: var(--serif); font-weight: bold; font-size: 22px; line-height: 30px; margin-bottom: 30px; }
#note-text { font-family: var(--mono); font-size: 16px; line-height: 30px; white-space: pre-wrap; }

.code-box { width: min(480px, 92vw); padding: 26px 26px 20px; background: #14110d; border: 1px solid #4a3c22; box-shadow: 0 30px 90px #000, inset 0 0 50px rgba(0, 0, 0, 0.8); text-align: center; }
#code-title { font-family: var(--serif); font-size: 22px; color: #e8dcc0; margin-bottom: 18px; }
#code-dials { display: flex; justify-content: center; gap: 12px; }
#code-dials.shake { animation: shake 0.35s; }
@keyframes shake { 20% { transform: translateX(-9px); } 40% { transform: translateX(8px); } 60% { transform: translateX(-6px); } 80% { transform: translateX(4px); } }
.dial { display: flex; flex-direction: column; align-items: center; padding: 4px; border: 1px solid #3a2f1c; border-radius: 5px; background: linear-gradient(#211b12, #0e0b07); cursor: pointer; }
.dial.sel { border-color: var(--gold); box-shadow: 0 0 14px rgba(255, 215, 106, 0.3); }
.dial button { background: none; border: 0; color: #8a7a56; font-size: 13px; padding: 5px 16px; }
.dial button:hover { color: var(--gold); }
.dial .num { width: 58px; height: 70px; line-height: 70px; font-family: var(--mono); font-size: 46px; font-weight: bold; color: #f0e4c4; background: linear-gradient(#0a0805, #2a2216 50%, #0a0805); border-top: 1px solid #000; border-bottom: 1px solid #000; }
#code-msg { min-height: 24px; margin-top: 12px; color: #f0a49c; }
.code-actions { display: flex; justify-content: center; gap: 12px; margin-top: 6px; }
.code-box .modal-hint { color: #6a5f48; text-transform: none; letter-spacing: 0.04em; }

.journal-box { display: flex; flex-direction: column; width: min(1120px, 95vw); height: min(780px, 90vh); background: linear-gradient(172deg, var(--paper) 0%, var(--paper2) 100%); color: var(--paper-ink); box-shadow: 0 30px 90px #000, inset 0 0 90px rgba(90, 60, 20, 0.28); }
.journal-head { display: flex; justify-content: space-between; align-items: flex-end; padding: 20px 28px 14px; border-bottom: 2px solid rgba(60, 46, 26, 0.45); }
.j-kicker { font-family: var(--mono); font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase; color: rgba(160, 30, 20, 0.9); }
.j-title { font-family: var(--serif); font-size: 32px; line-height: 1.1; }
.j-right { display: flex; align-items: center; gap: 16px; }
#journal-count { font-family: var(--mono); font-weight: bold; }
.journal-box .btn { background: rgba(60, 46, 26, 0.12); border-color: rgba(60, 46, 26, 0.5); color: var(--paper-ink); }
.journal-box .btn:hover { background: rgba(60, 46, 26, 0.25); }
.journal-cols { flex: 1; display: grid; grid-template-columns: 1.25fr 1fr; gap: 0; min-height: 0; }
.j-col { padding: 18px 28px 24px; overflow-y: auto; }
.j-col + .j-col { border-left: 1px dashed rgba(60, 46, 26, 0.4); }
.j-col h3 { color: rgba(140, 26, 16, 0.95); font-size: 20px; border-bottom: 1px solid rgba(60, 46, 26, 0.3); padding-bottom: 4px; }
.j-col h3:not(:first-child) { margin-top: 20px; }
.j-col h4 { margin: 14px 0 6px; font-family: var(--mono); font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase; color: rgba(60, 46, 26, 0.75); }
.ev-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ev { padding: 8px 10px; border: 1px dashed rgba(60, 46, 26, 0.35); color: rgba(60, 46, 26, 0.5); font-size: 13px; }
.ev b { display: block; font-family: var(--serif); font-size: 16px; }
.ev p { margin: 3px 0 0; font-family: var(--mono); font-size: 12px; line-height: 1.4; }
.ev.found { border: 1px solid rgba(60, 46, 26, 0.55); background: rgba(255, 255, 255, 0.28); color: var(--paper-ink); }
.ev.found.key { border-color: rgba(160, 30, 20, 0.75); box-shadow: inset 3px 0 0 rgba(160, 30, 20, 0.75); }
#journal-objective { font-family: var(--serif); font-size: 18px; font-style: italic; }
#journal-facts ul { margin: 0; padding-left: 18px; font-family: var(--mono); font-size: 13.5px; }
#journal-facts li { margin: 5px 0; }
.suspect { margin-top: 12px; padding: 9px 12px; border: 2px solid rgba(160, 30, 20, 0.75); color: rgba(140, 20, 12, 1); font-family: var(--serif); font-weight: bold; font-size: 16px; transform: rotate(-0.5deg); }
.jn { margin: 0 0 12px; padding: 8px 10px; background: rgba(255, 255, 255, 0.3); border-left: 3px solid rgba(60, 46, 26, 0.45); }
.jn b { display: block; font-family: var(--serif); font-size: 15px; }
.jn p { margin: 4px 0 0; font-family: var(--mono); font-size: 12.5px; line-height: 1.45; white-space: pre-wrap; }
.muted { color: rgba(60, 46, 26, 0.6); font-style: italic; font-size: 14px; }

/* ================= пауза ================= */
#pause { position: fixed; inset: 0; z-index: 50; display: none; align-items: center; justify-content: center; background: radial-gradient(ellipse at center, rgba(4, 5, 8, 0.74) 0%, rgba(0, 0, 0, 0.92) 100%); }
#pause.on { display: flex; }
.pause-box { width: min(380px, 90vw); text-align: center; }
.pause-title { font-family: var(--serif); font-size: 46px; letter-spacing: 0.24em; padding-left: 0.24em; text-transform: uppercase; color: #f1ede4; }
.pt-first { display: none; }
#pause.first .pt-first { display: block; }
#pause.first .pt-pause { display: none; }
#pause.first span.pt-first { display: inline; }
#pause-note { margin: 6px 0 18px; color: var(--dim); font-size: 14.5px; }
#pause.first #pause-note { visibility: hidden; height: 0; margin: 6px 0; }
#pause-room { margin: -6px 0 18px; font-size: 13px; color: var(--dim); }
#pause-room b { margin-left: 8px; font-family: var(--mono); font-size: 18px; letter-spacing: 0.2em; color: var(--gold); user-select: text; -webkit-user-select: text; }
.pause-menu { display: flex; flex-direction: column; gap: 10px; }
#pause.first .pause-menu .btn:not(#pause-resume) { display: none; }
.pause-hint { margin-top: 14px; font-size: 12px; letter-spacing: 0.14em; color: var(--faint); text-transform: uppercase; }

#screamer { position: fixed; inset: 0; z-index: 100; display: none; background: #000; pointer-events: none; }
#screamer.on { display: block; }
#screamer-canvas { width: 100%; height: 100%; display: block; }
#fade { position: fixed; inset: 0; z-index: 35; background: #000; opacity: 0; pointer-events: none; }

/* ================= итоги ================= */
#results { background: radial-gradient(ellipse at 50% 40%, rgba(10, 12, 16, 0.78) 0%, rgba(0, 0, 0, 0.95) 75%); overflow-y: auto; }
.res-box { position: relative; width: min(700px, 92vw); margin: 6vh auto 6vh; padding: 34px 40px 30px; background: linear-gradient(172deg, var(--paper) 0%, var(--paper2) 100%); color: var(--paper-ink); box-shadow: 0 30px 90px #000, inset 0 0 90px rgba(90, 60, 20, 0.28); animation: card-in 0.5s ease-out; }
.res-kicker { font-family: var(--mono); font-size: 12px; letter-spacing: 0.2em; text-transform: uppercase; color: rgba(160, 30, 20, 0.9); }
.res-title { font-family: var(--serif); font-size: 44px; line-height: 1.1; margin: 4px 0 16px; }
.res-rank { display: flex; align-items: baseline; gap: 14px; padding: 10px 14px; border: 2px solid rgba(160, 30, 20, 0.75); transform: rotate(-0.7deg); width: fit-content; }
.res-rank span { font-family: var(--mono); font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase; color: rgba(160, 30, 20, 0.9); }
.res-rank b { font-family: var(--serif); font-size: 26px; color: rgba(140, 20, 12, 1); }
.res-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px 18px; margin: 22px 0 16px; }
.res-grid span { display: block; font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.12em; text-transform: uppercase; color: rgba(60, 46, 26, 0.7); }
.res-grid b { display: block; font-family: var(--serif); font-size: 26px; }
.res-missed { font-family: var(--mono); font-size: 13.5px; margin-bottom: 14px; }
.res-missed b { color: rgba(140, 20, 12, 1); }
.res-tease { padding: 10px 14px; border-left: 3px solid rgba(160, 30, 20, 0.75); background: rgba(160, 30, 20, 0.08); font-family: var(--serif); font-style: italic; font-size: 17px; }
.res-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 22px; }
.res-box .btn { background: rgba(60, 46, 26, 0.12); border-color: rgba(60, 46, 26, 0.5); color: var(--paper-ink); }
.res-box .btn:hover { background: rgba(60, 46, 26, 0.25); }
.res-box .btn.primary { background: var(--red2); border-color: var(--red); color: #fff; }
.res-box .btn.primary:hover { background: var(--red); }
.res-wait { margin-top: 10px; text-align: right; font-size: 13px; color: rgba(60, 46, 26, 0.7); min-height: 18px; }

/* ================= состояния страницы ================= */
body.cinema #hud, body.st-menu #hud, body.st-boot #hud, body.st-results #hud { display: none; }
body.modal-open #crosshair, body.modal-open #prompt { display: none; }

/* ================= узкие экраны ================= */
@media (max-width: 900px) {
  .casefile { display: none; }
  .lobby, .howto { grid-template-columns: 1fr; }
  .journal-cols { grid-template-columns: 1fr; overflow-y: auto; }
  .j-col { overflow: visible; }
  .j-col + .j-col { border-left: 0; border-top: 1px dashed rgba(60, 46, 26, 0.4); }
  .logo .l2 { font-size: 52px; }
  .card-paper { flex-direction: column; overflow-y: auto; }
  #card-img { width: 100%; padding: 18px 18px 0; }
  .res-grid { grid-template-columns: repeat(2, 1fr); }
  .keys { grid-template-columns: 1fr; }
}
@media (max-height: 720px) {
  .logo .l2 { font-size: 58px; }
  #menu-items button { font-size: 21px; padding: 6px 0 6px 4px; }
  #menu-items button:nth-child(-n+3) { font-size: 24px; }
  .menu-sub { margin-bottom: 20px; }
  .casefile { bottom: 56px; font-size: 12.5px; }
}
@media (prefers-reduced-motion: reduce) {
  .logo .l2, .clock317 i { animation: none; }
}
