:root {
  --bg-0: #070806;
  --bg-1: #10140e;
  --paper: #e8e0cc;
  --muted: #8a8474;
  --amber: #e6b325;
  --amber-hot: #ffd15a;
  --amber-dim: rgba(230, 179, 37, 0.14);
  --red: #c4452d;
  --green: #8fbf4a;
  --hazard-y: #e6b325;
  --hazard-k: #12110c;
  --metal: #22251c;
  --line: rgba(230, 179, 37, 0.28);
  --font-display: "Unbounded", "Arial Black", sans-serif;
  --font-mono: "Share Tech Mono", "Consolas", monospace;
  --hud-h: 64px;
  --status-h: 72px;
  --hazard-h: 14px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html,
body {
  min-height: 100%;
}

body {
  font-family: var(--font-mono);
  color: var(--paper);
  background: var(--bg-0);
  overflow: hidden;
  min-height: 100dvh;
}

body.is-ready .hero {
  animation: rise 0.9s ease both;
}

body.is-ready .vault {
  animation: unlock 1.4s ease both;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  border: 0;
  background: none;
}

.atmosphere {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background: #070806;
}

.atmosphere__photo {
  position: absolute;
  inset: 0;
  background: url("../assets/bunker-corridor.png") center 40% / cover no-repeat;
  filter: brightness(0.7) contrast(1.12) saturate(0.82);
  transform: scale(1.03);
}

.atmosphere__dim {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(
      180deg,
      rgba(5, 6, 4, 0.58) 0%,
      rgba(5, 6, 4, 0.18) 30%,
      rgba(5, 6, 4, 0.14) 52%,
      rgba(5, 6, 4, 0.64) 100%
    ),
    radial-gradient(ellipse 72% 58% at 50% 46%, rgba(5, 6, 4, 0.04), rgba(5, 6, 4, 0.48) 82%);
}

.atmosphere__glow {
  position: absolute;
  inset: 18% 20% auto;
  height: 38%;
  background: radial-gradient(circle, rgba(230, 179, 37, 0.07), transparent 68%);
  filter: blur(8px);
  animation: breathe 6.5s ease-in-out infinite;
}

.atmosphere__noise {
  position: absolute;
  inset: -20%;
  opacity: 0.045;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 0.42s steps(5) infinite;
}

.atmosphere__scanlines {
  position: absolute;
  inset: 0;
  opacity: 0.045;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0 2px,
    rgba(0, 0, 0, 0.45) 2px 3px
  );
}

.atmosphere__vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 48%, rgba(0, 0, 0, 0.58) 100%);
}

.hazard {
  position: fixed;
  left: 0;
  right: 0;
  height: var(--hazard-h);
  z-index: 40;
  background: repeating-linear-gradient(
    -45deg,
    var(--hazard-y) 0 12px,
    var(--hazard-k) 12px 24px
  );
  box-shadow: 0 0 18px rgba(230, 179, 37, 0.28);
}

.hazard--top {
  top: var(--safe-top);
}

.hazard--bottom {
  bottom: var(--safe-bottom);
}

.hud,
.status {
  position: fixed;
  left: 0;
  right: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 clamp(16px, 4vw, 40px);
  pointer-events: none;
}

.hud {
  top: calc(var(--safe-top) + var(--hazard-h));
  height: var(--hud-h);
  padding-left: max(16px, var(--safe-left));
  padding-right: max(16px, var(--safe-right));
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(7, 8, 6, 0.88), rgba(7, 8, 6, 0.35));
}

.status {
  bottom: calc(var(--safe-bottom) + var(--hazard-h));
  height: var(--status-h);
  padding-left: max(16px, var(--safe-left));
  padding-right: max(16px, var(--safe-right));
  border-top: 1px solid var(--line);
  background: linear-gradient(0deg, rgba(7, 8, 6, 0.92), rgba(7, 8, 6, 0.35));
}

.hud__cell,
.status__item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.hud__cell--center {
  align-items: center;
}

.hud__cell--right {
  align-items: flex-end;
}

.hud__key,
.status__key,
.boot__label,
.kicker,
.btn__code,
.specs {
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}

.hud__val,
.status__val {
  font-size: 14px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--paper);
}

.hud__val--live {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--amber);
}

.pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 10px var(--amber);
  animation: pulse 1.6s ease-in-out infinite;
}

.status__item {
  flex: 1;
}

.status__bar {
  display: block;
  width: min(140px, 18vw);
  height: 6px;
  background: rgba(232, 224, 204, 0.12);
  overflow: hidden;
}

.status__bar i {
  display: block;
  height: 100%;
  width: 87%;
  background: linear-gradient(90deg, var(--green), var(--amber));
  box-shadow: 0 0 8px rgba(143, 191, 74, 0.5);
}

.status__val--danger {
  color: var(--red);
  text-shadow: 0 0 10px rgba(196, 69, 45, 0.55);
}

.status__val--ok {
  color: var(--green);
}

.stage {
  position: relative;
  z-index: 10;
  min-height: 100dvh;
  min-width: 0;
  width: 100%;
  display: grid;
  place-items: center;
  padding:
    calc(var(--safe-top) + var(--hazard-h) + var(--hud-h) + 16px)
    max(16px, var(--safe-right))
    calc(var(--safe-bottom) + var(--hazard-h) + var(--status-h) + 16px)
    max(16px, var(--safe-left));
  overflow-x: hidden;
}

.vault {
  position: absolute;
  width: min(920px, 96vw);
  aspect-ratio: 1;
  pointer-events: none;
  opacity: 0;
}

.vault__ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(230, 179, 37, 0.22);
}

.vault__ring--outer {
  box-shadow:
    inset 0 0 40px rgba(230, 179, 37, 0.08),
    0 0 50px rgba(230, 179, 37, 0.08);
}

.vault__ring--mid {
  inset: 9%;
  border-style: dashed;
  border-width: 3px;
  animation: spin 48s linear infinite;
}

.vault__ring--inner {
  inset: 22%;
  border-width: 10px;
  border-color: rgba(230, 179, 37, 0.12);
}

.vault__bolts {
  position: absolute;
  inset: 4%;
}

.vault__bolts span {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #d8c27a, #6d5a1e 55%, #2a2614);
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.35);
}

.vault__bolts span:nth-child(1) { transform: rotate(0deg) translateY(-46%); }
.vault__bolts span:nth-child(2) { transform: rotate(45deg) translateY(-46%); }
.vault__bolts span:nth-child(3) { transform: rotate(90deg) translateY(-46%); }
.vault__bolts span:nth-child(4) { transform: rotate(135deg) translateY(-46%); }
.vault__bolts span:nth-child(5) { transform: rotate(180deg) translateY(-46%); }
.vault__bolts span:nth-child(6) { transform: rotate(225deg) translateY(-46%); }
.vault__bolts span:nth-child(7) { transform: rotate(270deg) translateY(-46%); }
.vault__bolts span:nth-child(8) { transform: rotate(315deg) translateY(-46%); }

.vault__core {
  position: absolute;
  inset: 34%;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(230, 179, 37, 0.16);
  background: radial-gradient(circle, rgba(230, 179, 37, 0.08), transparent 70%);
}

.radiation {
  width: 46%;
  color: rgba(230, 179, 37, 0.22);
}

.hero {
  position: relative;
  width: min(640px, 100%);
  max-width: 100%;
  min-width: 0;
  text-align: center;
  opacity: 0;
}

.frame {
  position: relative;
  container-type: inline-size;
  min-width: 0;
  max-width: 100%;
  padding: clamp(28px, 5vw, 48px) clamp(28px, 5vw, 48px);
  background: linear-gradient(180deg, rgba(10, 12, 8, 0.42), rgba(5, 6, 4, 0.58));
  border: 1px solid rgba(230, 179, 37, 0.16);
  backdrop-filter: blur(8px);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

.frame__corner {
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid var(--amber);
}

.frame__corner--tl {
  top: -1px;
  left: -1px;
  border-right: 0;
  border-bottom: 0;
}

.frame__corner--tr {
  top: -1px;
  right: -1px;
  border-left: 0;
  border-bottom: 0;
}

.frame__corner--bl {
  bottom: -1px;
  left: -1px;
  border-right: 0;
  border-top: 0;
}

.frame__corner--br {
  bottom: -1px;
  right: -1px;
  border-left: 0;
  border-top: 0;
}

.kicker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  max-width: 100%;
  margin-bottom: 18px;
  color: var(--amber);
}

.kicker__dot {
  width: 5px;
  height: 5px;
  background: var(--amber);
  border-radius: 50%;
}

.title {
  position: relative;
  display: block;
  width: 100%;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: min(56px, 7vw);
  font-size: min(56px, 8.4cqw);
  letter-spacing: 0.02em;
  line-height: 1;
  color: var(--paper);
  text-shadow: 0 0 28px rgba(230, 179, 37, 0.28);
  animation: glitch 7s steps(1) infinite;
  text-align: center;
}

.title::before {
  content: "БУНКЕР";
  position: absolute;
  inset: 0;
  color: var(--amber);
  opacity: 0.18;
  transform: translateY(-1px);
  pointer-events: none;
}

.tagline {
  margin: 18px 0 16px;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(15px, 2.4vw, 22px);
  line-height: 1.35;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--amber);
}

.lead {
  max-width: 42ch;
  margin: 0 auto 32px;
  font-size: 15px;
  line-height: 1.7;
  letter-spacing: 0.03em;
  color: var(--muted);
}

.actions {
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  width: 100%;
}

.btn {
  position: relative;
  min-width: min(220px, 100%);
  max-width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 22px;
  clip-path: polygon(14px 0, 100% 0, 100% calc(100% - 14px), calc(100% - 14px) 100%, 0 100%, 0 14px);
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.btn__code {
  color: inherit;
  opacity: 0.55;
}

.btn__label {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.btn--ghost {
  background: rgba(230, 179, 37, 0.06);
  color: var(--amber);
  box-shadow: inset 0 0 0 1px rgba(230, 179, 37, 0.55);
}

.btn--primary {
  background: linear-gradient(180deg, var(--amber-hot), var(--amber));
  color: #16140c;
  box-shadow:
    0 0 0 1px rgba(255, 209, 90, 0.35),
    0 10px 30px rgba(230, 179, 37, 0.22);
}

.btn:hover {
  transform: translateY(-2px);
}

.btn--ghost:hover {
  background: rgba(230, 179, 37, 0.16);
  box-shadow:
    inset 0 0 0 1px var(--amber),
    0 0 22px rgba(230, 179, 37, 0.2);
}

.btn--primary:hover {
  box-shadow:
    0 0 0 1px #fff3c4,
    0 12px 34px rgba(230, 179, 37, 0.38);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.btn:focus-visible {
  outline: 2px solid var(--amber-hot);
  outline-offset: 4px;
}

.specs {
  margin-top: 22px;
}

.boot {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  background: #050604;
  cursor: pointer;
  transition: opacity 0.7s ease, visibility 0.7s ease;
}

.boot.is-done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.boot__panel {
  width: min(560px, calc(100% - 40px));
}

.boot__label {
  margin-bottom: 14px;
  color: var(--amber);
}

.boot__log {
  min-height: 140px;
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.8;
  color: var(--paper);
  white-space: pre-wrap;
}

.boot__log::after {
  content: "█";
  color: var(--amber);
  animation: blink 0.9s steps(1) infinite;
}

.boot__skip {
  margin-top: 22px;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.35;
    transform: scale(0.75);
  }
}

@keyframes breathe {
  0%,
  100% {
    opacity: 0.55;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.06);
  }
}

@keyframes grain {
  0% {
    transform: translate(0, 0);
  }
  20% {
    transform: translate(-3%, 2%);
  }
  40% {
    transform: translate(2%, -4%);
  }
  60% {
    transform: translate(-1%, 3%);
  }
  80% {
    transform: translate(3%, 1%);
  }
  100% {
    transform: translate(0, 0);
  }
}

@keyframes blink {
  0%,
  45% {
    opacity: 1;
  }
  50%,
  100% {
    opacity: 0;
  }
}

@keyframes glitch {
  0%,
  88%,
  100% {
    transform: none;
    text-shadow: 0 0 28px rgba(230, 179, 37, 0.28);
  }
  90% {
    text-shadow: -2px 0 var(--red), 2px 0 var(--green);
  }
  93% {
    text-shadow: 2px 0 var(--red), -2px 0 var(--green);
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes unlock {
  from {
    opacity: 0;
    transform: scale(0.92) rotate(-8deg);
  }
  to {
    opacity: 0.2;
    transform: none;
  }
}

@media (max-width: 760px) {
  html,
  body.is-app,
  body.is-player {
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .hud__cell--center {
    display: none;
  }

  .hud {
    gap: 12px;
  }

  .hud__val {
    font-size: 12px;
  }

  .status {
    display: none !important;
  }

  body.is-player,
  body.is-play {
    --status-h: 0px;
  }

  :root {
    --status-h: 0px;
  }

  .btn {
    min-width: 0;
    width: 100%;
  }

  .title {
    letter-spacing: 0.01em;
    font-size: min(44px, 8.2vw);
    font-size: min(44px, 9cqw);
  }
}

@media (max-height: 760px) {
  body {
    overflow-y: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

  .boot {
    display: none;
  }

  .hero,
  .vault,
  body.is-ready .hero,
  body.is-ready .vault {
    opacity: 1;
    transform: none;
  }

  body.is-ready .vault,
  .vault {
    opacity: 0.2;
  }
}
