:root {
  --yellow: #ffd400;
  --yellow-dark: #c9a700;
  --black: #0a0a0a;
  --black-soft: #161616;
  --text: #f2f2f2;
  --stripe: repeating-linear-gradient(-45deg, var(--yellow) 0 22px, var(--black) 22px 44px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--black);
  color: var(--text);
  font-family: 'Russo One', 'Arial Black', sans-serif;
  user-select: none;
}

/* ---------- Фон ---------- */
#bg { position: fixed; inset: 0; z-index: 0; }
#bg-image, #bg-video, #bg-canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}
#bg-image, #bg-video { filter: grayscale(.6) contrast(1.15) brightness(.45); }

.bg-vignette {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse at 30% 50%, transparent 20%, rgba(0,0,0,.85) 80%),
    linear-gradient(90deg, rgba(0,0,0,.9) 0%, rgba(0,0,0,.4) 55%, rgba(0,0,0,.75) 100%);
}
/* Зернистость статичная: анимация огромного слоя сильно грузила видеокарту */
.bg-noise {
  position: absolute; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.5'/%3E%3C/svg%3E");
  opacity: .12;
  pointer-events: none;
}

/* ---------- Ленты «осторожно» ---------- */
/* Полосы двигаются через transform — это делает видеокарта без перерисовки страницы */
.hazard {
  position: fixed; left: -5%; width: 110%; height: 26px;
  overflow: hidden;
  z-index: 6;
  box-shadow: 0 0 25px rgba(0,0,0,.8);
}
.hazard::before {
  content: '';
  position: absolute; top: 0; bottom: 0; left: -62px; right: 0;
  background: var(--stripe);
  background-size: 62px 62px;
  will-change: transform;
  animation: stripes 2s linear infinite;
}
.hazard-top { top: 18px; transform: rotate(-1.2deg); }
.hazard-bottom { bottom: 18px; transform: rotate(1deg); }
.hazard-bottom::before { animation-direction: reverse; }
@keyframes stripes { to { transform: translateX(62px); } }

/* ---------- Меню ---------- */
#menu {
  position: relative; z-index: 3;
  height: 100%;
  display: flex; flex-direction: column; justify-content: center;
  padding: 0 8vw;
  gap: 6vh;
  animation: menuIn .9s cubic-bezier(.2,.8,.2,1) both;
}
@keyframes menuIn { from { opacity: 0; transform: translateX(-40px); } }

.logo { line-height: 1; }
.logo-small {
  display: inline-block;
  font-family: 'Black Ops One', 'Russo One', sans-serif;
  font-size: clamp(18px, 2.4vw, 34px);
  background: var(--yellow); color: var(--black);
  padding: 4px 14px;
  transform: skew(-12deg) rotate(-3deg);
  text-transform: uppercase;
  letter-spacing: 3px;
}
.logo-main {
  position: relative;
  font-family: 'Black Ops One', 'Russo One', sans-serif;
  font-size: clamp(56px, 10vw, 150px);
  font-weight: normal;
  color: var(--yellow);
  letter-spacing: 2px;
  text-shadow: 5px 5px 0 var(--black), 8px 8px 0 rgba(255,212,0,.25);
  margin-top: 6px;
}
.logo-main::before, .logo-main::after {
  content: attr(data-text);
  position: absolute; left: 0; top: 0;
  width: 100%; overflow: hidden;
  color: var(--yellow);
  text-shadow: none;
  opacity: 0;
}
.logo-main::before { animation: glitch 4s infinite steps(1); color: #fff; }
.logo-main::after  { animation: glitch 4s infinite steps(1) .1s; color: var(--yellow-dark); }
@keyframes glitch {
  0%, 91%, 100% { opacity: 0; clip-path: none; transform: none; }
  92% { opacity: .8; clip-path: inset(10% 0 60% 0); transform: translate(-6px, 0); }
  94% { opacity: .8; clip-path: inset(55% 0 15% 0); transform: translate(6px, 0); }
  96% { opacity: .8; clip-path: inset(30% 0 40% 0); transform: translate(-3px, 0); }
}
.logo-tag {
  display: block;
  margin-top: 10px;
  font-size: clamp(12px, 1.2vw, 16px);
  color: rgba(255,212,0,.6);
  letter-spacing: 4px;
  text-transform: uppercase;
}

/* ---------- Кнопки ---------- */
.buttons { display: flex; flex-direction: column; gap: 14px; width: min(420px, 100%); }

.btn {
  --shift: 0px;
  position: relative;
  display: flex; align-items: center; gap: 18px;
  padding: 14px 26px;
  font: inherit;
  font-size: clamp(20px, 2vw, 28px);
  text-transform: uppercase;
  letter-spacing: 3px;
  color: var(--yellow);
  background: rgba(10,10,10,.75);
  border: 2px solid var(--yellow);
  clip-path: polygon(0 0, 100% 0, calc(100% - 18px) 100%, 0 100%);
  cursor: pointer;
  overflow: hidden;
  isolation: isolate;
  transform: translateX(var(--shift));
  transition: transform .2s ease, color .2s ease;
  animation: btnIn .5s cubic-bezier(.2,.8,.2,1) both;
}
.btn:nth-child(1) { animation-delay: .25s; }
.btn:nth-child(2) { animation-delay: .35s; }
.btn:nth-child(3) { animation-delay: .45s; }
.btn:nth-child(4) { animation-delay: .55s; }
@keyframes btnIn { from { opacity: 0; transform: translateX(-60px); } }

.btn::before {
  content: '';
  position: absolute; inset: 0;
  background: var(--yellow);
  transform: translateX(-101%);
  transition: transform .25s cubic-bezier(.6,0,.2,1);
  z-index: -1;
}
.btn > span { position: relative; z-index: 1; }
.btn-num { font-size: .55em; opacity: .6; }

.btn:hover, .btn:focus-visible, .btn.active {
  --shift: 18px;
  color: var(--black);
  outline: none;
  isolation: isolate;
}
.btn:hover::before, .btn:focus-visible::before, .btn.active::before { transform: translateX(0); }
.btn:active { transform: translateX(var(--shift)) scale(.97); }

.btn-patreon { border-style: dashed; }
.btn-patreon .btn-label::after { content: ' ↗'; font-size: .7em; }

.version {
  position: fixed; right: 30px; bottom: 58px; z-index: 3;
  font-size: 12px; letter-spacing: 3px; text-transform: uppercase;
  color: rgba(255,212,0,.45);
}

/* ---------- Модальные окна ---------- */
.modal {
  position: fixed; inset: 0; z-index: 10;
  display: grid; place-items: center;
  background: rgba(0,0,0,.8);
  animation: fadeIn .2s ease both;
}
.modal[hidden] { display: none; }
@keyframes fadeIn { from { opacity: 0; } }

.panel {
  width: min(520px, calc(100% - 32px));
  background: var(--black-soft);
  border: 3px solid var(--yellow);
  box-shadow: 10px 10px 0 var(--yellow);
  padding: 0 28px 28px;
  animation: panelIn .3s cubic-bezier(.2,.8,.2,1) both;
}
@keyframes panelIn { from { opacity: 0; transform: translateY(30px) rotate(-1deg); } }

.panel-head {
  display: flex; justify-content: space-between; align-items: center;
  margin: 0 -28px 24px;
  padding: 14px 28px;
  background: var(--stripe);
  background-size: 62px 62px;
  border-bottom: 3px solid var(--yellow);
}
.panel-head h2 {
  font-family: 'Black Ops One', 'Russo One', sans-serif;
  font-weight: normal;
  text-transform: uppercase;
  letter-spacing: 3px;
  background: var(--black); color: var(--yellow);
  padding: 4px 14px;
}
.close {
  width: 40px; height: 40px;
  font-size: 28px; line-height: 1;
  background: var(--black); color: var(--yellow);
  border: 2px solid var(--yellow);
  cursor: pointer;
}
.close:hover { background: var(--yellow); color: var(--black); }

/* Слоты сохранений */
.slots { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.slot {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px;
  border: 2px solid rgba(255,212,0,.35);
  background: var(--black);
  cursor: pointer;
  transition: border-color .15s, transform .15s;
}
.slot:hover { border-color: var(--yellow); transform: translateX(6px); }
.slot.empty { opacity: .45; cursor: default; }
.slot.empty:hover { border-color: rgba(255,212,0,.35); transform: none; }
.slot-name { color: var(--yellow); letter-spacing: 2px; }
.slot-meta { font-size: 12px; opacity: .6; }

/* Настройки */
.setting {
  display: grid; grid-template-columns: 130px 1fr 44px; align-items: center; gap: 14px;
  padding: 12px 0;
  border-bottom: 1px dashed rgba(255,212,0,.2);
  text-transform: uppercase; letter-spacing: 2px; font-size: 14px;
}
.setting:last-child { border-bottom: none; }
.setting output { color: var(--yellow); text-align: right; }

input[type=range] { -webkit-appearance: none; appearance: none; height: 8px; background: var(--black); border: 1px solid var(--yellow); cursor: pointer; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 22px; background: var(--yellow); border: 2px solid var(--black); }
input[type=range]::-moz-range-thumb { width: 16px; height: 22px; background: var(--yellow); border: 2px solid var(--black); border-radius: 0; }

select {
  grid-column: span 2;
  font: inherit; font-size: 14px;
  padding: 8px 10px;
  background: var(--black); color: var(--yellow);
  border: 2px solid var(--yellow);
  cursor: pointer;
}
.toggle {
  width: 64px; height: 30px;
  background: var(--black);
  border: 2px solid var(--yellow);
  cursor: pointer;
  position: relative;
}
.toggle span {
  position: absolute; top: 3px; left: 3px;
  width: 20px; height: 20px;
  background: rgba(255,212,0,.4);
  transition: transform .2s, background .2s;
}
.toggle[aria-pressed=true] span { transform: translateX(34px); background: var(--yellow); }

/* ---------- Экран истории ---------- */
#menu[hidden], #intro[hidden] { display: none; }

#intro {
  position: fixed; inset: 0; z-index: 5;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 28px;
  padding: 70px 16px;
  background: rgba(10,10,10,.92);
}
#intro.slide-in .intro-frame { animation: panelIn .6s cubic-bezier(.2,.8,.2,1) both; }

.intro-frame {
  position: relative;
  width: min(760px, 100%);
  aspect-ratio: 16 / 9;
  max-height: 50vh;
  border: 3px solid var(--yellow);
  box-shadow: 10px 10px 0 var(--yellow);
  background: var(--black);
  overflow: hidden;
}
.intro-frame img, .intro-frame video { width: 100%; height: 100%; object-fit: cover; display: block; }
.intro-frame img[hidden], .intro-frame video[hidden] { display: none; }
.intro-placeholder {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  background: repeating-linear-gradient(-45deg, rgba(255,212,0,.08) 0 22px, transparent 22px 44px);
  color: rgba(255,212,0,.5);
  letter-spacing: 3px;
  font-size: 14px;
}
.intro-placeholder[hidden] { display: none; }

.intro-text {
  width: min(760px, 100%);
  min-height: 5.5em;
  font-family: 'Russo One', sans-serif;
  font-size: clamp(16px, 1.6vw, 21px);
  line-height: 1.6;
  color: var(--text);
  border-left: 4px solid var(--yellow);
  padding-left: 18px;
}

.btn-continue {
  width: auto;
  animation: none;
  font-size: clamp(16px, 1.6vw, 22px);
  padding: 12px 40px 12px 28px;
}
.btn-continue.waiting { opacity: .35; }
.btn-continue[hidden] { display: none; }

/* Выбор ответа в диалоге */
.intro-choices { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; }
.intro-choices[hidden] { display: none; }

/* ---------- Ввод имени ---------- */
#menu[hidden] ~ .version { display: none; }
#name-screen[hidden], #game[hidden] { display: none; }

#name-screen {
  position: fixed; inset: 0; z-index: 5;
  display: grid; place-items: center;
  background: rgba(10,10,10,.92);
}
.name-panel { display: flex; flex-direction: column; gap: 12px; }
.name-label { text-transform: uppercase; letter-spacing: 3px; font-size: 13px; color: rgba(255,212,0,.7); }
#name-input {
  font: inherit; font-size: 26px; letter-spacing: 2px;
  padding: 12px 16px;
  background: var(--black); color: var(--yellow);
  border: 2px solid var(--yellow);
  outline: none;
}
#name-input:focus { box-shadow: 0 0 0 3px rgba(255,212,0,.25); }
#name-input::placeholder { color: rgba(255,212,0,.3); }
.name-error { min-height: 1.2em; font-size: 13px; color: #ff6b4a; }
.name-panel .btn-continue { align-self: flex-start; }

/* ---------- Игровой экран ---------- */
#game {
  position: fixed; inset: 0; z-index: 5;
  display: grid; grid-template-columns: 280px 1fr;
  padding: 60px 0 60px;
  background: rgba(10,10,10,.88);
}

.sidebar {
  display: flex; flex-direction: column; gap: 22px;
  padding: 10px 22px;
  border-right: 3px solid var(--yellow);
  overflow-y: auto;
}
.player-name {
  font-family: 'Black Ops One', 'Russo One', sans-serif;
  font-size: 26px;
  background: var(--yellow); color: var(--black);
  padding: 6px 14px;
  transform: skew(-8deg);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.side-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.side-btn {
  font: inherit; font-size: 14px; letter-spacing: 2px; text-transform: uppercase;
  padding: 10px 0;
  background: var(--black); color: var(--yellow);
  border: 2px solid var(--yellow);
  cursor: pointer;
  transition: background .15s, color .15s;
}
.side-btn:hover, .side-btn:focus-visible { background: var(--yellow); color: var(--black); outline: none; }

.stats { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.stats li {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 10px 12px;
  background: var(--black);
  border-left: 4px solid var(--yellow);
  font-size: 12px; text-transform: uppercase; letter-spacing: 1px;
}
.stats span { color: rgba(242,242,242,.7); }
.stats b { color: var(--yellow); font-weight: normal; font-size: 15px; white-space: nowrap; }

/* Подсказка в сайдбаре */
.hint {
  position: relative;
  padding: 26px 12px 12px;
  border: 2px dashed var(--yellow);
  background: var(--black);
  font-size: 13px; line-height: 1.45;
}
.hint[hidden] { display: none; }
.hint-label {
  position: absolute; top: -11px; left: 10px;
  padding: 2px 10px;
  background: var(--yellow); color: var(--black);
  font-size: 11px; letter-spacing: 2px; text-transform: uppercase;
  transform: skew(-8deg);
}
.quest-text {
  margin-top: 10px; padding-top: 8px;
  border-top: 1px solid rgba(255,212,0,.3);
  color: var(--yellow); font-size: 12px;
}
.quest-text[hidden] { display: none; }
.hint.new { animation: hintIn .5s cubic-bezier(.2,.8,.2,1); }
@keyframes hintIn { from { transform: translateX(-30px); opacity: 0; } }

.phone-btn {
  position: relative;
  margin-top: auto;
  font: inherit; font-size: 18px; letter-spacing: 3px; text-transform: uppercase;
  padding: 14px;
  background: var(--yellow);
  color: var(--black);
  border: 3px solid var(--black);
  outline: 3px solid var(--yellow);
  cursor: pointer;
}
.phone-btn:hover { filter: brightness(1.15); }

.badge {
  display: inline-grid; place-items: center;
  min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: 11px;
  background: #ff3b30; color: #fff;
  font-size: 12px; text-shadow: none; letter-spacing: 0;
}
.badge[hidden] { display: none; }
.phone-btn .badge { position: absolute; top: -10px; right: -10px; }

/* Свободный мир */
.world {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 20px;
  padding: 10px 32px;
  overflow-y: auto;
}
.loc-title {
  font-family: 'Black Ops One', 'Russo One', sans-serif; font-weight: normal;
  font-size: clamp(26px, 3vw, 40px);
  color: var(--yellow);
  letter-spacing: 3px; text-transform: uppercase;
}
.loc-frame { max-height: 48vh; }
.loc-text { width: min(760px, 100%); color: rgba(242,242,242,.8); line-height: 1.5; text-align: center; }
.loc-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.loc-btn { font-size: clamp(15px, 1.4vw, 20px); padding: 12px 34px 12px 22px; animation: none; }
.loc-btn:hover, .loc-btn:focus-visible { --shift: 0px; transform: translateY(-3px); }

/* Закрытая локация: лента «В разработке» поверх кнопки */
.loc-btn.wip { color: rgba(255,212,0,.45); border-color: rgba(255,212,0,.35); cursor: not-allowed; padding-bottom: 26px; }
.loc-btn.wip::before { display: none; }
.loc-btn.wip:hover, .loc-btn.wip:focus-visible { transform: none; color: rgba(255,212,0,.35); }
.wip-ribbon {
  position: absolute !important; left: -10%; right: -10%; bottom: 0;
  transform: rotate(-3deg);
  padding: 3px 0;
  background: var(--yellow);
  border-block: 4px solid transparent;
  border-image: repeating-linear-gradient(-45deg, var(--black) 0 6px, var(--yellow) 6px 12px) 4;
  color: var(--black);
  font-size: 11px; letter-spacing: 3px; text-align: center;
  pointer-events: none;
}

/* Всплывашка */
.toast {
  position: fixed; left: 50%; top: 70px; z-index: 8;
  transform: translate(-50%, -20px);
  padding: 10px 22px;
  background: var(--yellow); color: var(--black);
  letter-spacing: 2px; text-transform: uppercase; font-size: 14px;
  opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Телефон ---------- */
.phone[hidden] { display: none; }
.phone {
  position: fixed; right: 40px; bottom: 60px; z-index: 7;
  width: 300px; height: min(560px, calc(100vh - 140px));
  padding: 12px;
  background: #050505;
  border: 3px solid var(--yellow);
  border-radius: 38px;
  box-shadow: 0 20px 60px rgba(0,0,0,.8), 8px 8px 0 rgba(255,212,0,.35);
  animation: phoneIn .35s cubic-bezier(.2,.8,.2,1) both;
}
@keyframes phoneIn { from { transform: translateY(110%); } }
.phone-notch {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  width: 90px; height: 18px;
  background: #050505; border-radius: 0 0 12px 12px; z-index: 1;
}
.phone-screen {
  height: 100%;
  display: flex; flex-direction: column;
  background: var(--black-soft);
  border-radius: 28px;
  overflow: hidden;
}
.phone-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 28px 14px 12px;
  background: var(--yellow); color: var(--black);
  letter-spacing: 2px; text-transform: uppercase; font-size: 14px;
}
.phone-head span { flex: 1; }
.phone-icon {
  width: 28px; height: 28px;
  font: inherit; font-size: 22px; line-height: 1;
  background: var(--black); color: var(--yellow);
  border: none; border-radius: 50%;
  cursor: pointer;
}
.phone-icon[hidden] { display: none; }

.contacts { list-style: none; overflow-y: auto; }
.contacts[hidden], .chat[hidden] { display: none; }
.contact {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255,212,0,.12);
  cursor: pointer;
}
.contact:hover { background: rgba(255,212,0,.08); }
.avatar {
  flex: none; display: grid; place-items: center;
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--yellow); color: var(--black);
  font-size: 18px;
}
.contact-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.contact-info b { font-weight: normal; color: var(--yellow); }
.contact-info small { font-family: Arial, sans-serif; font-size: 12px; opacity: .6; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.chat { flex: 1; display: flex; flex-direction: column; gap: 8px; padding: 14px; overflow-y: auto; }
.bubble {
  max-width: 80%;
  padding: 9px 12px;
  font-family: Arial, sans-serif; font-size: 14px; line-height: 1.4;
  border-radius: 14px;
}
.bubble.theirs { align-self: flex-start; background: #262626; border-bottom-left-radius: 4px; }
.bubble.mine { align-self: flex-end; background: var(--yellow); color: var(--black); border-bottom-right-radius: 4px; }

@media (max-width: 800px) {
  #game { grid-template-columns: 1fr; overflow-y: auto; }
  .sidebar { border-right: none; border-bottom: 3px solid var(--yellow); }
  .phone { right: 50%; transform: translateX(50%); }
}

/* Имя говорящего в диалоге */
.intro-speaker {
  width: min(760px, 100%);
  margin-bottom: -16px;
  font-family: 'Black Ops One', 'Russo One', sans-serif;
  font-size: 18px; letter-spacing: 2px; text-transform: uppercase;
  color: var(--yellow);
}
.intro-speaker[hidden] { display: none; }

/* ---------- События и проигрыш ---------- */
.stats li[hidden] { display: none; }

.overlay {
  position: fixed; inset: 0; z-index: 9;
  display: grid; place-items: center;
  background: rgba(0,0,0,.8);
  animation: fadeIn .2s ease both;
}
.overlay[hidden] { display: none; }

.event-panel {
  width: min(640px, calc(100% - 32px));
  max-height: calc(100vh - 130px);
  overflow-y: auto;
}
.event-frame { height: 26vh; margin: 0 auto; aspect-ratio: auto; box-shadow: 6px 6px 0 var(--yellow); }
.event-text { margin: 16px 0; line-height: 1.5; }
.event-choices { display: flex; flex-wrap: wrap; gap: 12px; }
.event-choices[hidden] { display: none; }
#gameover .panel { box-shadow: 10px 10px 0 #ff3b30; border-color: #ff3b30; }
#gameover .panel-head h2 { color: #ff3b30; }

/* Мини-игра «Весы» */
.minigame[hidden] { display: none; }
.minigame { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.scale-readout {
  font-family: 'Black Ops One', 'Russo One', sans-serif;
  font-size: 36px; line-height: 1; color: var(--yellow);
  font-variant-numeric: tabular-nums;
}
.scale-bar {
  position: relative; width: 100%; height: 28px;
  background: var(--black);
  border: 2px solid var(--yellow);
}
.scale-zone { position: absolute; top: 0; bottom: 0; }
.scale-zone.good { left: 42.5%; width: 15%; background: rgba(255,212,0,.25); }
.scale-zone.perfect { left: 47.5%; width: 5%; background: var(--yellow); }
.scale-marker {
  position: absolute; top: -8px; bottom: -8px; width: 4px;
  margin-left: -2px;
  background: #fff;
  box-shadow: 0 0 8px #fff;
}
.minigame-hint { font-size: 12px; letter-spacing: 1px; opacity: .6; text-align: center; }
.scale-result { min-height: 1.3em; color: var(--yellow); letter-spacing: 2px; text-transform: uppercase; }
#minigame-stop:disabled { opacity: .4; pointer-events: none; }

/* Конец версии — STOP */
.ending { background: rgba(0,0,0,.92); }
.ending-box {
  width: min(680px, calc(100% - 32px));
  display: flex; flex-direction: column; align-items: center; gap: 26px;
  text-align: center;
  animation: panelIn .6s cubic-bezier(.2,.8,.2,1) both;
}
.ending-stop {
  font-family: 'Black Ops One', 'Russo One', sans-serif; font-weight: normal;
  font-size: clamp(72px, 14vw, 160px); line-height: 1;
  color: var(--black);
  background: var(--yellow);
  padding: 6px 40px;
  border: 6px solid var(--black);
  outline: 6px solid var(--yellow);
  transform: rotate(-4deg);
  letter-spacing: 8px;
}
.ending-text { font-size: clamp(15px, 1.4vw, 19px); line-height: 1.6; opacity: .9; }
.ending-buttons { justify-content: center; }

/* Мини-игра «Взлом замка» */
.lock-pins { display: flex; gap: 10px; }
.lock-pin {
  width: 22px; height: 34px;
  border: 2px solid var(--yellow);
  background: var(--black);
  transform: skew(-8deg);
}
.lock-pin.done { background: var(--yellow); }
.lock-bar.shake { animation: lockShake .3s; }
@keyframes lockShake { 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
#lock-turn:disabled { opacity: .4; pointer-events: none; }

/* ---------- Экономия видеокарты ---------- */
/* Вне меню фон не нужен, а полосы стоят — на экране ничего не двигается,
   и видеокарта не пересобирает кадр на каждой частоте экрана */
body.in-game #bg { display: none; }
body.in-game .hazard::before,
body.no-fx .hazard::before { animation: none; }
body.no-fx #bg-canvas { display: none; }
body.no-fx .logo-main::before,
body.no-fx .logo-main::after { animation: none; }

/* Затемнение при переходе */
#fade {
  position: fixed; inset: 0; z-index: 20;
  background: var(--black);
  pointer-events: none;
  opacity: 0;
  transition: opacity .6s ease;
}
#fade.on { opacity: 1; pointer-events: all; }

@media (max-width: 600px) {
  #menu { padding: 0 16px; }
  .setting { grid-template-columns: 1fr 1fr 40px; }
}
