@font-face {
  font-family: "Handelson Six_CYR Six";
  src:
    url("../Web Fonts/65f0a0e0ded7c1646e4e581194398b4c.woff2") format("woff2"),
    url("../Web Fonts/65f0a0e0ded7c1646e4e581194398b4c.woff") format("woff"),
    url("../Web Fonts/65f0a0e0ded7c1646e4e581194398b4c.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

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

html,
body {
  height: 100%;
  margin: 0;
  font-family: "Handelson Six_CYR Six", system-ui, sans-serif;
  background: #0f1218;
  color: #e8eaef;
}

button,
input,
textarea,
select {
  font-family: inherit;
}

.start-screen {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.2rem;
  background:
    linear-gradient(rgba(8, 10, 14, 0.58), rgba(8, 10, 14, 0.58)),
    url("../assets/ui/menu-bg.png") center / cover no-repeat;
}

.start-screen[hidden] {
  display: none !important;
  pointer-events: none;
}

.start-panel {
  position: relative;
  width: min(100%, 860px);
  min-height: min(86vh, 500px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 3rem 1rem 1.5rem;
  text-align: center;
  background: rgba(12, 16, 23, 0.42);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.menu-title {
  margin: 0 0 2.2rem;
  font-size: clamp(2.2rem, 7vw, 3.3rem);
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1;
  color: #f3f3f3;
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.16),
    0 2px 0 rgba(0, 0, 0, 0.35),
    0 8px 22px rgba(0, 0, 0, 0.45);
}

.start-menu {
  width: min(100%, 380px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.9rem;
}

.start-menu-item {
  font: inherit;
  font-weight: 800;
  font-size: clamp(1.35rem, 3vw, 2rem);
  letter-spacing: 0.04em;
  line-height: 1.1;
  color: #f0f0f0;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.7);
}

.start-menu-item.is-primary {
  color: #ffffff;
}

.start-menu-item.is-primary:hover {
  color: #dbe9ff;
}

.start-menu-item:not(.is-disabled):hover {
  color: #dbe9ff;
}

.start-menu-item.is-primary:focus-visible {
  outline: 2px solid rgba(180, 210, 255, 0.72);
  outline-offset: 6px;
  border-radius: 2px;
}

.start-menu-item.is-disabled {
  cursor: default;
  opacity: 0.92;
}

.app {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.75rem 1rem 1.25rem;
}

body.level-map-open #app {
  display: none !important;
}

.level1-intro-screen {
  position: absolute;
  inset: 0;
  z-index: 4;
  border-radius: 10px;
  overflow: hidden;
  background: #080a0e;
}

.level1-intro-screen[hidden] {
  display: none !important;
  pointer-events: none;
}

.level1-intro-stage {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.level1-intro-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  user-select: none;
  pointer-events: none;
}

/* Стартовый кадр уровня вместо рамки level1-intro-bg */
.level1-intro-screen.is-scene-bg .level1-intro-bg {
  object-fit: contain;
  background: #1a1f2e;
}

.level1-intro-screen.is-scene-bg .level1-intro-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: rgba(8, 10, 14, 0.42);
  pointer-events: none;
}

.level1-intro-screen.is-scene-bg .level1-intro-safe {
  /* как у обычного интро — не на весь экран, чтобы совпадать с рамкой на картинке */
  inset: 3.2% 4.2% 5.5% 3.2%;
  padding: 0;
}

.level1-intro-screen.is-scene-bg .level1-intro-copy {
  padding: 0.65rem 0.85rem;
  background: rgba(8, 10, 14, 0.62);
  border-radius: 8px;
}

/* Отступы под белую рамку на фоне level1-intro-bg */
.level1-intro-safe {
  position: absolute;
  inset: 3.2% 4.2% 4.8% 3.2%;
  z-index: 2;
  pointer-events: none;
}

.level1-intro-frame {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: clamp(0.75rem, 2.2vmin, 1.25rem);
  padding: 0 clamp(0.5rem, 2vw, 2rem) clamp(0.35rem, 1.2vmin, 0.65rem);
  pointer-events: none;
}

.level1-intro-copy {
  max-width: 62rem;
  width: 100%;
  margin: 0 auto;
  color: #f5f5f5;
  letter-spacing: 0.02em;
  line-height: 1.36;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
}

.level1-intro-head {
  margin: 0 0 1.25em;
  font-size: clamp(1.35rem, 3.4vmin, 2.35rem);
  font-weight: normal;
}

.level1-intro-p {
  margin: 0 0 1.25em;
  font-size: clamp(1rem, 2.35vmin, 1.65rem);
  font-weight: normal;
}

.level1-intro-p:last-child {
  margin-bottom: 0;
}

.level1-intro-continue {
  position: static;
  align-self: flex-end;
  flex-shrink: 0;
  max-width: min(100%, 18rem);
  font-size: clamp(1rem, 2.2vmin, 1.35rem);
  pointer-events: auto;
  transition: opacity 0.35s ease;
}

.level1-intro-continue[hidden] {
  display: none !important;
}

.level1-intro-head.is-typing::after,
.level1-intro-p.is-typing::after {
  content: "▌";
  margin-left: 0.08em;
  opacity: 0.85;
  animation: level1-intro-cursor 0.85s step-end infinite;
}

@keyframes level1-intro-cursor {
  50% {
    opacity: 0;
  }
}

.level-map-screen {
  position: fixed;
  inset: 0;
  z-index: 250;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: #0f1218;
}

.level-map-screen[hidden] {
  display: none !important;
  pointer-events: none;
}

.level-map-panel {
  position: relative;
  width: min(92vw, 980px);
  aspect-ratio: 860 / 691;
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.48);
  overflow: hidden;
}

.level-map-back-btn {
  position: absolute;
  top: 0.6rem;
  left: 0.6rem;
  z-index: 6;
}

.level-map-floor-row {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  z-index: 6;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: flex-end;
  max-width: min(52%, 22rem);
}

.level-map-floor-tab {
  font-size: 0.78rem;
  padding: 0.35rem 0.65rem;
  border-radius: 8px;
}

.level-map-floor-tab.is-active {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.35);
}

.level-map-floor-tab:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.level-map-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  user-select: none;
  pointer-events: none;
}

.level-map-nodes {
  position: absolute;
  inset: 0;
}

.level-node {
  position: absolute;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 999px;
  transform: translate(-50%, -50%);
  border: 2px solid rgba(10, 10, 10, 0.62);
  cursor: pointer;
}

.level-node::after {
  content: "";
  position: absolute;
  inset: -8px;
}

.level-node--locked {
  background: #cf3f3f;
  cursor: default;
  opacity: 0.88;
}

.level-node--available {
  background: #9da4ad;
}

.level-node--available:hover,
.level-node--available:focus-visible {
  box-shadow: 0 0 0 3px rgba(157, 164, 173, 0.35);
}

.level-node--completed {
  background: #4fb06d;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.title {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0;
  letter-spacing: 0.04em;
}

.stage-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
}

.stage {
  position: relative;
  z-index: 0;
  width: 100%;
  border-radius: 10px;
  overflow: hidden;
  background: #1a1f2e;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  aspect-ratio: 16 / 9;
  touch-action: manipulation;
}

.stage.stage--death-flash::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  background: rgba(190, 28, 28, 0.92);
  animation: stage-death-flash 0.48s ease-out forwards;
}

@keyframes stage-death-flash {
  0% {
    opacity: 0;
  }
  35% {
    opacity: 1;
  }
  100% {
    opacity: 0.55;
  }
}

.stage:fullscreen,
.stage:-webkit-full-screen {
  width: 100%;
  height: 100%;
  max-height: 100%;
  aspect-ratio: unset;
  border-radius: 0;
  box-shadow: none;
}

.btn-fs {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 3;
  margin: 0;
  padding: 0.4rem 0.65rem;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  cursor: pointer;
  color: #e8eaef;
  background: rgba(15, 18, 24, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  backdrop-filter: blur(4px);
}

.btn-fs:hover {
  background: rgba(30, 36, 51, 0.9);
  border-color: rgba(255, 255, 255, 0.35);
}

.scene-timer {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 55;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  padding: 0.35rem 0.55rem;
  font-size: 0.78rem;
  line-height: 1.2;
  color: #e8eaef;
  background: rgba(15, 18, 24, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  backdrop-filter: blur(4px);
  pointer-events: none;
  user-select: none;
}

.scene-timer-label {
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.82;
}

.scene-timer-value {
  font-size: 1.15rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.06em;
}

.scene-timer--safe {
  border-color: rgba(100, 200, 140, 0.45);
  background: rgba(18, 32, 24, 0.85);
}

.scene-timer--safe .scene-timer-label {
  opacity: 0.9;
}

.scene-timer--safe .scene-timer-value {
  color: #8fdfac;
  font-size: 1rem;
}

.scene-image {
  position: relative;
  z-index: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  vertical-align: middle;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

.scene-image.is-sit-quiet-fading {
  transition: opacity 0.38s ease-in-out;
}

.scene-image.is-sit-quiet-dim {
  opacity: 0;
}

.hit-layer {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: auto;
  background: transparent;
  cursor: default;
}

.overlay {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(8, 10, 14, 0.72);
  backdrop-filter: blur(4px);
  border-radius: 10px;
}

/* Иначе `display: flex` перебивает атрибут hidden — оверлей остаётся на экране */
.overlay[hidden] {
  display: none !important;
  pointer-events: none;
}

.overlay-text .text-body,
.game-modal .text-body {
  white-space: pre-wrap;
  line-height: 1.45;
  margin: 0 0 1.5rem;
  font-size: clamp(1.05rem, 2.2vw, 1.2rem);
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #f3f3f3;
}

.outcome-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.overlay-text.overlay-text--step #btnMainMenu {
  display: none !important;
}

.lock-door-game {
  position: absolute;
  inset: 0;
  z-index: 5;
  cursor: none;
  overflow: hidden;
  pointer-events: none;
}

.lock-door-game[hidden] {
  display: none !important;
  pointer-events: none;
}

.lock-door-hud {
  position: absolute;
  top: 0.55rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  width: min(440px, 94%);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.5rem;
  pointer-events: none;
}

.lock-door-hint {
  margin: 0;
  padding: 0.4rem 0.85rem;
  font-size: clamp(0.78rem, 1.6vw, 0.95rem);
  font-weight: 800;
  letter-spacing: 0.04em;
  text-align: center;
  color: #f0f0f0;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.8);
  background: rgba(8, 10, 14, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 6px;
}

.lock-keyhole {
  position: absolute;
  border: 2px solid rgba(255, 210, 90, 0.45);
  border-radius: 50%;
  aspect-ratio: 1;
  background: rgba(255, 210, 90, 0.08);
  box-shadow: inset 0 0 18px rgba(255, 210, 90, 0.06);
  pointer-events: none;
  z-index: 1;
  transition:
    border-color 0.15s,
    background 0.15s,
    box-shadow 0.15s;
}

.lock-keyhole.is-near {
  border-color: rgba(255, 210, 90, 0.85);
  background: rgba(255, 210, 90, 0.2);
  box-shadow: 0 0 12px rgba(255, 210, 90, 0.35);
}

.lock-keyhole.is-holding {
  border-color: rgba(120, 220, 150, 0.95);
  background: rgba(120, 220, 150, 0.22);
  box-shadow: 0 0 14px rgba(120, 220, 150, 0.45);
}

.lock-hand {
  position: absolute;
  z-index: 3;
  pointer-events: none;
  transform: translate(-90%, -45%);
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.5));
  will-change: left, top;
}

.lock-hand img {
  display: block;
  width: 100%;
  height: auto;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
  background: transparent;
}

.lock-hold-progress {
  width: 100%;
  height: 10px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(0, 0, 0, 0.55);
  border-radius: 4px;
  overflow: hidden;
}

.lock-hold-progress[hidden] {
  visibility: hidden;
}

.lock-hold-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #5cb87a, #8fdfac);
  transition: width 0.05s linear;
}

body.lock-door-active .hit-layer {
  z-index: 6;
  cursor: none !important;
}

body.dust-game-active .hit-layer {
  pointer-events: none !important;
  cursor: default !important;
}

.desk-block-scale {
  position: absolute;
  left: clamp(0.35rem, 2.5%, 1.25rem);
  top: 50%;
  z-index: 3;
  transform: translateY(-50%);
  width: clamp(1.4rem, 4.2vw, 2.35rem);
  height: min(72%, 26rem);
  pointer-events: none;
}

.desk-block-scale[hidden] {
  display: none !important;
}

.desk-block-scale-track {
  position: relative;
  width: 100%;
  height: 100%;
  border: 2px solid #0a0a0a;
  background: #3a3f47;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35);
}

.desk-block-scale-fill {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 0%;
  background: #f5f5f5;
  transition: height 0.12s ease-out;
}

.overlay-scene-choice {
  z-index: 3;
  align-items: stretch;
  justify-content: center;
  padding: 0;
  background: transparent;
  backdrop-filter: none;
  pointer-events: none;
}

.scene-choice-wrap {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: clamp(0.35rem, 1.2vw, 0.75rem);
  width: 100%;
  padding: 0 clamp(0.5rem, 2vw, 1.25rem);
  pointer-events: auto;
}

.scene-choice-prompt {
  margin: 0;
  padding: clamp(0.75rem, 2vw, 1.1rem) clamp(0.85rem, 2.2vw, 1.35rem);
  border: 2px solid rgba(0, 0, 0, 0.92);
  border-radius: 0;
  background: rgba(0, 0, 0, 0.52);
  color: #f0f0f0;
  font: inherit;
  font-size: clamp(1rem, 2.2vw, 1.45rem);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: 0.04em;
  text-align: center;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.7);
  pointer-events: none;
}

.scene-choice-list {
  position: static;
  transform: none;
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: clamp(0.35rem, 1.2vw, 0.75rem);
  width: 100%;
  padding: 0;
  pointer-events: auto;
}

.scene-choice-btn {
  flex: 1 1 0;
  max-width: 49%;
  min-height: clamp(3.5rem, 12vh, 5.5rem);
  margin: 0;
  padding: clamp(0.75rem, 2vw, 1.1rem) clamp(0.85rem, 2.2vw, 1.35rem);
  border: 2px solid rgba(0, 0, 0, 0.92);
  border-radius: 0;
  background: rgba(0, 0, 0, 0.52);
  color: #f0f0f0;
  font: inherit;
  font-size: clamp(1rem, 2.2vw, 1.45rem);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: 0.04em;
  text-align: center;
  cursor: pointer;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.7);
}

.scene-choice-btn:hover {
  background: rgba(0, 0, 0, 0.68);
  color: #dbe9ff;
}

.scene-choice-btn:focus,
.scene-choice-btn:focus-visible {
  outline: none;
  background: rgba(0, 0, 0, 0.68);
}

.overlay-hide-calm {
  z-index: 5;
}

.overlay-typing {
  z-index: 5;
}

.typing-time {
  font-weight: 600;
  color: #a8d4ff;
  margin-top: 0.35rem !important;
}

.overlay-typing .typing-panel {
  max-width: 24rem;
}

.typing-letter {
  margin: 0.35rem 0 0.75rem;
  font-size: clamp(2.5rem, 8vw, 3.75rem);
  font-weight: 800;
  letter-spacing: 0.12em;
  line-height: 1.1;
}

.typing-meta {
  margin: 0.25rem 0 0;
  font-size: 0.88rem;
  opacity: 0.88;
}

.typing-mistakes {
  color: #f0a8a8;
}

.overlay-death {
  flex-direction: column;
  gap: 1.25rem;
  background: rgba(0, 0, 0, 0.88);
}

.overlay-death-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}

.overlay-death.overlay-death--caught {
  background: radial-gradient(ellipse 100% 80% at 50% 40%, #5c1010 0%, #1a0303 75%);
  border: 1px solid rgba(255, 80, 80, 0.35);
}

.overlay-death.overlay-death--caught .death-msg {
  color: #ffc9c9;
}

.overlay-death.overlay-death--caught .death-sub {
  font-size: clamp(0.68rem, 1.65vw, 0.82rem);
  opacity: 0.82;
}

.overlay-death.overlay-death--ghost {
  justify-content: center;
  gap: 2rem;
  padding: 0;
  background: #140808;
  backdrop-filter: none;
}

.overlay-death.overlay-death--ghost .overlay-death-inner {
  width: 100%;
  padding: clamp(2rem, 6vh, 3rem) 1.5rem;
  background: #a82828;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
}

.overlay-death.overlay-death--ghost .death-msg {
  max-width: none;
  font-size: clamp(1.85rem, 5vw, 2.75rem);
  font-weight: 800;
  color: #ffffff;
  white-space: normal;
}

.overlay-death.overlay-death--ghost .death-sub {
  margin: 0.15rem 0 0;
  font-size: clamp(0.95rem, 2.4vw, 1.12rem);
  font-weight: 500;
  color: rgba(255, 255, 255, 0.92);
  letter-spacing: 0.02em;
}

.overlay-death.overlay-death--ghost .btn {
  margin-top: 0.25rem;
}

.death-msg {
  font-size: 1.5rem;
  font-weight: 800;
  margin: 0;
  letter-spacing: 0.04em;
  white-space: pre-wrap;
  text-align: center;
  max-width: 22rem;
}

.death-sub {
  margin: 0;
  text-align: center;
  white-space: pre-wrap;
  font-size: clamp(0.8rem, 2vw, 0.95rem);
  font-weight: 500;
  opacity: 0.88;
  letter-spacing: 0.02em;
}

.ghost-door-banner {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: translateY(-50%);
  padding: clamp(1.1rem, 3.2vh, 1.85rem) 1.5rem;
  background: rgba(118, 118, 118, 0.58);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.85s ease-out;
}

.ghost-door-banner.is-visible {
  opacity: 1;
}

.ghost-door-banner[hidden] {
  display: none !important;
  opacity: 0;
}

.ghost-door-banner-text {
  margin: 0;
  font-size: clamp(1.4rem, 3.6vw, 2.05rem);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: 0.02em;
  color: #0c0c0c;
  text-align: center;
}

.sit-quiet-hud {
  position: absolute;
  top: 0.55rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  width: min(480px, 94%);
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  pointer-events: none;
}

.sit-quiet-hud[hidden] {
  display: none !important;
}

.sit-quiet-hud.is-miss {
  animation: sit-quiet-hud-miss 0.38s ease;
}

.sit-quiet-hud-hint {
  margin: 0;
  padding: 0.4rem 0.85rem;
  font-size: clamp(0.78rem, 1.6vw, 0.95rem);
  font-weight: 800;
  letter-spacing: 0.04em;
  text-align: center;
  color: #f0f0f0;
  background: rgba(8, 10, 14, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 6px;
}

.sit-quiet-hud-meta {
  display: flex;
  align-items: stretch;
  gap: 0.65rem;
}

.sit-quiet-clicks {
  flex: 0 0 auto;
  min-width: 3.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.55rem;
  font-size: 1.05rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #dbe9ff;
  background: rgba(8, 10, 14, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 6px;
}

.sit-quiet-clicks.is-step {
  animation: sit-quiet-click-step 0.28s ease;
}

.sit-quiet-urgency {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.sit-quiet-urgency-label {
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.85;
  color: #f0f0f0;
}

.sit-quiet-urgency-track {
  height: 0.65rem;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(20, 24, 32, 0.85);
  border-radius: 4px;
  overflow: hidden;
}

.sit-quiet-urgency-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #8ea4c4 0%, #f0c878 45%, #e85a5a 100%);
  transition: width 0.08s linear;
}

.sit-quiet-urgency-fill.is-critical {
  background: linear-gradient(90deg, #f0c878 0%, #ff5a4a 55%, #ff1f1f 100%);
}

@keyframes sit-quiet-hud-miss {
  0%,
  100% {
    filter: none;
  }
  35% {
    filter: drop-shadow(0 0 10px rgba(255, 50, 50, 0.85));
  }
}

@keyframes sit-quiet-click-step {
  0% {
    transform: scale(1);
  }
  45% {
    transform: scale(1.12);
    color: #fff;
  }
  100% {
    transform: scale(1);
  }
}

.scene-image.is-sit-quiet-tap {
  filter: brightness(1.12);
}

.sit-quiet-hint {
  position: absolute;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.42s ease-out;
}

.sit-quiet-hint.is-visible {
  opacity: 1;
}

.sit-quiet-hint.is-visible .sit-quiet-hint-text {
  animation: sit-quiet-hint-blink
    calc(0.95s - var(--sit-quiet-urgency, 0) * 0.58s) ease-in-out 0.2s infinite;
}

.sit-quiet-hint[hidden] {
  display: none !important;
}

.sit-quiet-hint-text {
  display: block;
  margin: 0;
  font-weight: 900;
  line-height: 1;
  color: #ff2424;
  text-shadow:
    0 0 10px rgba(255, 40, 40, 0.95),
    0 0 22px rgba(255, 40, 40, 0.55);
  user-select: none;
}

@keyframes sit-quiet-hint-blink {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.2;
    transform: scale(0.86);
  }
}

.panel {
  max-width: min(36rem, 92vw);
  padding: clamp(1.35rem, 3vh, 1.85rem) clamp(1.5rem, 4vw, 2rem);
  background: rgba(12, 16, 23, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 4px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.55);
  text-align: center;
}

.panel.game-modal,
.game-modal.panel {
  text-align: left;
}

.text-panel {
  text-align: left;
  max-width: 36rem;
}

.panel-hint {
  margin: 0 0 1rem;
  font-size: 0.95rem;
  opacity: 0.92;
}

.sequence {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.35em;
  margin: 0.5rem 0;
  font-variant-numeric: tabular-nums;
}

.panel-sub {
  margin: 0.75rem 0 0;
  font-size: 0.85rem;
  opacity: 0.75;
}

.btn {
  font: inherit;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 4px;
  padding: 0.65rem 1.35rem;
  background: rgba(255, 255, 255, 0.1);
  color: #f0f0f0;
}

.btn:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.btn.btn-primary {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.42);
  color: #fff;
}

.btn.btn-primary:hover {
  background: rgba(255, 255, 255, 0.24);
  color: #dbe9ff;
}

.btn.ghost {
  background: transparent;
  color: #c8d0de;
  border: 1px solid rgba(255, 255, 255, 0.22);
}

.btn.ghost:hover {
  color: #f3f3f3;
  border-color: rgba(255, 255, 255, 0.38);
  background: rgba(255, 255, 255, 0.06);
}

.level-map-overlay {
  position: absolute;
  inset: 0;
  z-index: 12;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(8, 10, 14, 0.72);
  backdrop-filter: blur(4px);
}

.level-map-overlay[hidden] {
  display: none !important;
  pointer-events: none;
}

.level-map-overlay .game-modal {
  width: min(100%, 28rem);
}

.level-map-overlay .text-body {
  margin-bottom: 1.25rem;
}

.level-node--dev {
  cursor: pointer;
}

.dust-game-hud {
  position: absolute;
  top: 0.55rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  width: min(480px, 94%);
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  pointer-events: none;
}

.dust-game-hud[hidden] {
  display: none !important;
}

.dust-game-hint {
  margin: 0;
  padding: 0.4rem 0.85rem;
  font-size: clamp(0.78rem, 1.6vw, 0.95rem);
  font-weight: 800;
  letter-spacing: 0.04em;
  text-align: center;
  color: #f0f0f0;
  background: rgba(8, 10, 14, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 6px;
}

.dust-game-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.dust-game-time {
  flex: 0 0 auto;
  min-width: 3.2rem;
  font-size: 1.1rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #dbe9ff;
  text-align: center;
}

.dust-game-scale {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.dust-game-scale-label {
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.85;
}

.dust-game-scale-track {
  height: 0.65rem;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(20, 24, 32, 0.85);
  border-radius: 4px;
  overflow: hidden;
}

.dust-game-scale-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #c8d0de 0%, #f0c878 55%, #e85a5a 100%);
  transition: width 0.15s ease-out;
}

.dust-sprites {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  overflow: hidden;
}

.dust-sprites[hidden] {
  display: none !important;
}

.dust-sprites.is-active {
  pointer-events: auto;
  touch-action: none;
}

.dust-sprite {
  position: absolute;
  margin: 0;
  padding: 10px;
  border: none;
  background: transparent;
  cursor: pointer;
  transform: translate(-50%, -50%);
  touch-action: none;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: content-box;
  transition: opacity 0.18s ease;
}

.dust-sprite-visual {
  display: block;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.55));
  animation: dust-float var(--dust-float-dur, 1.8s) ease-in-out infinite alternate;
  transition: transform 0.18s ease;
}

.dust-sprite.is-pop {
  opacity: 0;
  pointer-events: none;
}

.dust-sprite.is-pop .dust-sprite-visual {
  transform: scale(1.35);
}

.dust-sprite img {
  display: block;
  width: 100%;
  height: auto;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

@keyframes dust-float {
  from {
    transform: translate(0, 0) rotate(-4deg);
  }
  to {
    transform: translate(var(--dust-dx, 14px), var(--dust-dy, -18px)) rotate(5deg);
  }
}

.ghost-sprites {
  position: absolute;
  inset: 0;
  z-index: 7;
  pointer-events: none;
}

.ghost-sprites[hidden] {
  display: none !important;
}

.ghost-sprites.is-active {
  pointer-events: auto;
}

.ghost-sprite {
  position: absolute;
  width: min(24vw, 200px);
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  transform: scale(1);
  transform-origin: center center;
  transition: transform 2.8s ease-out;
  filter: drop-shadow(0 0 12px rgba(255, 255, 255, 0.35));
}

.ghost-sprite.is-grown {
  transform: scale(var(--ghost-end-scale, 1.5));
}

.ghost-sprite--hits-1 {
  opacity: 0.78;
}

.ghost-sprite--hits-2 {
  opacity: 0.52;
}

.ghost-sprite.is-hit {
  filter: drop-shadow(0 0 16px rgba(180, 220, 255, 0.9));
}

.ghost-sprite--tl {
  left: 2%;
  top: 5%;
}

.ghost-sprite--tr {
  right: 2%;
  top: 5%;
}

.ghost-sprite--bl {
  left: 2%;
  bottom: 8%;
}

.ghost-sprite--br {
  right: 2%;
  bottom: 8%;
}

.ghost-sprite img {
  display: block;
  width: 100%;
  height: auto;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

.ghost-jumpscare {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  pointer-events: none;
}

.ghost-jumpscare[hidden] {
  display: none !important;
}

.ghost-jumpscare img {
  display: block;
  max-width: 78%;
  max-height: 88%;
  transform: scale(0.35);
  transform-origin: center center;
  transition: transform 1.4s cubic-bezier(0.15, 0.85, 0.25, 1);
  filter: drop-shadow(0 0 20px rgba(255, 255, 255, 0.25));
}

.ghost-jumpscare.is-zoom img {
  transform: scale(1.2);
}

body.ghost-door-active .hit-layer {
  pointer-events: none !important;
  cursor: default !important;
}

body.ghost-door-knocking .scene-image {
  animation: ghost-door-shake 0.09s ease-in-out infinite;
}

@keyframes ghost-door-shake {
  0% {
    transform: translate(0, 0);
  }
  25% {
    transform: translate(-3px, 2px);
  }
  50% {
    transform: translate(3px, -2px);
  }
  75% {
    transform: translate(-2px, -2px);
  }
  100% {
    transform: translate(0, 0);
  }
}

@media (max-width: 600px) {
  .sequence {
    font-size: 1.35rem;
    letter-spacing: 0.2em;
  }
}

/* --- Стрелки: ритм-мини-игра (2 этаж, пульт) --- */
.arrow-rhythm-game {
  position: absolute;
  inset: 0;
  z-index: 45;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #0f1218;
  /* Вертикальный центр дорожки: стрелки и рамка совпадают по середине */
  --arrow-rhythm-lane-y: 51%;
  --arrow-rhythm-zone-h: 22%;
}

.arrow-rhythm-game[hidden] {
  display: none !important;
  pointer-events: none;
}

.arrow-rhythm-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  user-select: none;
  pointer-events: none;
}

.arrow-rhythm-lanes {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.arrow-rhythm-hit-zone {
  position: absolute;
  left: 44%;
  top: calc(var(--arrow-rhythm-lane-y) - var(--arrow-rhythm-zone-h) / 2);
  width: 12%;
  height: var(--arrow-rhythm-zone-h);
  border: 2px solid rgba(255, 210, 90, 0.55);
  border-radius: 8px;
  box-shadow:
    0 0 14px rgba(255, 210, 90, 0.22),
    inset 0 0 18px rgba(255, 210, 90, 0.08);
  background: rgba(8, 10, 14, 0.42);
}

.arrow-rhythm-notes {
  position: absolute;
  inset: 0;
}

.arrow-rhythm-note {
  position: absolute;
  top: var(--arrow-rhythm-lane-y);
  width: 3.2rem;
  height: 3.2rem;
  margin-left: -1.6rem;
  margin-top: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(1.6rem, 5.5vw, 2.4rem);
  line-height: 1;
  font-weight: 800;
  color: #e8eaef;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.75);
  background: rgba(15, 18, 24, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
  transform: translateY(-50%);
  transition: transform 0.08s ease, opacity 0.12s ease;
}

.arrow-rhythm-note--hit {
  opacity: 0;
  transform: translateY(-50%) scale(1.2);
  border-color: rgba(120, 220, 150, 0.75);
  box-shadow: 0 0 12px rgba(120, 220, 150, 0.35);
}

.arrow-rhythm-note--miss {
  opacity: 0.4;
  filter: saturate(0.35);
  border-color: rgba(207, 63, 63, 0.65);
  color: #c9a0a0;
}

.arrow-rhythm-hud {
  position: relative;
  z-index: 2;
  margin-top: auto;
  padding: 0.55rem 0.75rem 0.65rem;
  background: linear-gradient(
    180deg,
    transparent,
    rgba(8, 10, 14, 0.72) 28%,
    rgba(15, 18, 24, 0.94)
  );
  pointer-events: none;
}

.arrow-rhythm-hud-hint {
  margin: 0 0 0.35rem;
  padding: 0.4rem 0.85rem;
  font-size: clamp(0.78rem, 2.1vw, 0.95rem);
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1.35;
  color: #f0f0f0;
  text-align: center;
  max-width: 42rem;
  margin-left: auto;
  margin-right: auto;
  background: rgba(8, 10, 14, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 6px;
}

.arrow-rhythm-hud-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
  max-width: 42rem;
  margin: 0 auto;
  padding: 0 0.15rem;
  font-size: clamp(0.85rem, 2.4vw, 1rem);
  letter-spacing: 0.04em;
}

.arrow-rhythm-timer {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: #8fdfac;
}

.arrow-rhythm-misses {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: #e8c4a0;
}

body.arrow-rhythm-active .hit-layer {
  pointer-events: none !important;
  cursor: default !important;
}

/* --- Телефон: дрожащий прицел (5 уровень) --- */
.phone-dial-game {
  position: absolute;
  inset: 0;
  z-index: 44;
  pointer-events: none;
}

.phone-dial-game[hidden] {
  display: none !important;
}

.phone-dial-target {
  position: absolute;
  pointer-events: none;
  opacity: 0;
}

.phone-dial-reticle {
  position: absolute;
  width: 30px;
  height: 30px;
  margin: -15px 0 0 -15px;
  pointer-events: none;
  border: 2px solid rgba(255, 255, 255, 0.92);
  border-radius: 50%;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.55),
    0 0 10px rgba(0, 0, 0, 0.35);
  transition: border-color 0.12s ease;
}

.phone-dial-reticle::before,
.phone-dial-reticle::after {
  content: "";
  position: absolute;
  background: rgba(255, 255, 255, 0.9);
}

.phone-dial-reticle::before {
  left: 50%;
  top: 4px;
  width: 2px;
  height: 22px;
  transform: translateX(-50%);
}

.phone-dial-reticle::after {
  top: 50%;
  left: 4px;
  width: 22px;
  height: 2px;
  transform: translateY(-50%);
}

.phone-dial-reticle.is-miss {
  border-color: rgba(230, 70, 70, 0.95);
}

.phone-dial-reticle.is-miss::before,
.phone-dial-reticle.is-miss::after {
  background: rgba(255, 120, 120, 0.95);
}

.phone-dial-hud-hint {
  position: absolute;
  left: 50%;
  bottom: 0.55rem;
  transform: translateX(-50%);
  z-index: 2;
  margin: 0;
  padding: 0.4rem 0.85rem;
  max-width: min(94%, 28rem);
  font-size: clamp(0.78rem, 2vw, 0.92rem);
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1.35;
  text-align: center;
  color: #f0f0f0;
  background: rgba(8, 10, 14, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 6px;
}

body.phone-dial-active .hit-layer {
  cursor: none !important;
}
