/* Оформление публичных страниц: главная (scene--home) и страница ошибки (scene--404). */

:root {
  --ink: #0e1020;
  --glass: rgba(255, 255, 255, 0.06);
  --hairline: rgba(255, 255, 255, 0.17);
  --text: #eceef9;
  --muted: #b4bbdf;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Акцентные переменные по сценам: холодная (главная) vs тёплая (404) */
body.scene--home {
  --accent: #8deed0;
  --accent-soft: #b6f7e5;
  --glow-a: #4a5bb8;
  --glow-b: #2e9c86;
  --glow-c: #7c5bb8;
  background: linear-gradient(180deg, #1e274b 0%, #151b38 100%);
}
body.scene--404 {
  --accent: #ffd99b;
  --accent-soft: #ffedc9;
  --glow-a: #a05a2a;
  --glow-b: #c09a4f;
  --glow-c: #a25a3e;
  background: linear-gradient(180deg, #2b1b0c 0%, #22140a 100%);
}

/* Аврора: мягкие сияющие пятна на заднем плане */
.aurora {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.aurora__blob {
  position: absolute;
  width: 56vmax;
  height: 56vmax;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.6;
  will-change: transform;
}

.aurora__blob--a {
  top: -22vmax;
  left: -14vmax;
  background: radial-gradient(circle at 30% 30%, var(--glow-a) 0%, transparent 70%);
  animation: drift-a 26s ease-in-out infinite alternate;
}

.aurora__blob--b {
  bottom: -24vmax;
  right: -16vmax;
  background: radial-gradient(circle at 60% 60%, var(--glow-b) 0%, transparent 70%);
  animation: drift-b 32s ease-in-out infinite alternate;
}

.aurora__blob--c {
  top: 12vmax;
  right: 6vmax;
  width: 34vmax;
  height: 34vmax;
  background: radial-gradient(circle at 50% 50%, var(--glow-c) 0%, transparent 70%);
  opacity: 0.4;
  animation: drift-c 38s ease-in-out infinite alternate;
}

@keyframes drift-a {
  to {
    transform: translate3d(9vmax, 7vmax, 0) scale(1.15);
  }
}

@keyframes drift-b {
  to {
    transform: translate3d(-8vmax, -6vmax, 0) scale(1.2);
  }
}

@keyframes drift-c {
  to {
    transform: translate3d(6vmax, -5vmax, 0) scale(0.85);
  }
}

/* Сетка точек — лёгкая фактура поверх авроры */
.aurora__grid {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.09) 1px, transparent 1.5px);
  background-size: 26px 26px;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 78%);
}

/* Сцена-подложка для 404: призрачная цифра на фоне */
.ghost-404 {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -54%);
  z-index: 0;
  font-family: Georgia, "Times New Roman", "Noto Serif", serif;
  font-size: clamp(180px, 42vw, 460px);
  font-weight: 700;
  line-height: 1;
  color: rgba(255, 236, 200, 0.12);
  text-shadow: 0 0 80px rgba(255, 210, 138, 0.14);
  pointer-events: none;
  user-select: none;
  animation: ghost-breathe 7s ease-in-out infinite alternate;
}

@keyframes ghost-breathe {
  from {
    opacity: 0.9;
    transform: translate(-50%, -54%) scale(1);
  }
  to {
    opacity: 0.55;
    transform: translate(-50%, -54%) scale(1.02);
  }
}

/* ---------- главная: созвездие-мерцание ---------- */
.stars {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.star {
  position: absolute;
  border-radius: 50%;
  background: #eef6ff;
  box-shadow:
    0 0 6px rgba(210, 235, 255, 0.9),
    0 0 16px rgba(150, 195, 255, 0.55);
  animation: twinkle 4s ease-in-out infinite alternate;
  will-change: opacity, transform;
}

.star--1 {
  left: 18%;
  top: 20%;
  width: 4px;
  height: 4px;
  animation-duration: 3.6s;
}
.star--2 {
  left: 42%;
  top: 13%;
  width: 3px;
  height: 3px;
  animation-duration: 5s;
  animation-delay: 0.8s;
}
.star--3 {
  left: 63%;
  top: 21%;
  width: 5px;
  height: 5px;
  animation-duration: 4.4s;
  animation-delay: 1.6s;
}
.star--4 {
  left: 82%;
  top: 32%;
  width: 3px;
  height: 3px;
  animation-duration: 6s;
  animation-delay: 0.4s;
}
.star--5 {
  left: 12%;
  top: 52%;
  width: 3px;
  height: 3px;
  animation-duration: 5.2s;
  animation-delay: 2s;
}
.star--6 {
  left: 86%;
  top: 60%;
  width: 4px;
  height: 4px;
  animation-duration: 4.8s;
  animation-delay: 1.2s;
}

@keyframes twinkle {
  from {
    opacity: 0.28;
    transform: scale(0.75);
  }
  to {
    opacity: 0.95;
    transform: scale(1.15);
  }
}

/* ---------- 404: открытая дверь, за ней дорога света ---------- */
.door {
  position: relative;
  width: 170px;
  height: 196px;
  margin: 0 auto 46px;
}

/* Коридор: тёмная глубина, уходящая к яркому проёму вдалеке */
.door__corridor {
  position: absolute;
  left: 34px;
  right: 34px;
  top: 24px;
  bottom: 10px;
  background: linear-gradient(180deg, #2b1a0d 0%, #171009 100%);
  box-shadow:
    inset 0 0 46px rgba(0, 0, 0, 0.6),
    inset 0 6px 18px rgba(255, 210, 138, 0.06);
  clip-path: polygon(calc(50% - 41px) 0, calc(50% + 41px) 0, 100% 100%, 0 100%);
  overflow: hidden;
  border-radius: 6px;
}

.door__corridor::after {
  content: "";
  position: absolute;
  left: 50%;
  top: -30px;
  width: 46px;
  height: calc(100% + 30px);
  transform: translateX(-50%);
  background: linear-gradient(
    180deg,
    rgba(255, 227, 184, 0.5) 0%,
    rgba(255, 210, 138, 0.12) 42%,
    rgba(255, 210, 138, 0) 100%
  );
  filter: blur(4px);
}

/* Яркий маленький проём в конце дороги */
.door__exit {
  position: absolute;
  left: 50%;
  top: 30px;
  width: 22px;
  height: 15px;
  transform: translateX(-50%);
  border-radius: 4px;
  background: radial-gradient(circle at 50% 40%, #fff6e4 0%, #ffd28a 55%, rgba(255, 210, 138, 0) 78%);
  box-shadow: 0 0 18px rgba(255, 227, 184, 0.95);
  animation: door-flicker 5s ease-in-out infinite;
}

.door__exit::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 64px;
  height: 44px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 210, 138, 0.4) 0%, transparent 70%);
  filter: blur(6px);
}

/* Полосы пола — нарастающая ширина даёт перспективу */
.door__floor {
  position: absolute;
  left: 50%;
  height: 1.5px;
  transform: translateX(-50%);
  background: linear-gradient(90deg, transparent, rgba(255, 210, 138, 0.5), transparent);
  filter: blur(0.5px);
}

.door__floor--1 {
  width: 34%;
  top: 47%;
}

.door__floor--2 {
  width: 64%;
  top: 70%;
}

.door__floor--3 {
  width: 94%;
  top: 93%;
}

/* Рама: две стойки + притолока */
.door__post {
  position: absolute;
  top: 16px;
  bottom: 10px;
  width: 8px;
  border-radius: 3px;
  background: linear-gradient(180deg, #5a3a1e 0%, #3a2412 100%);
  box-shadow:
    0 0 8px rgba(0, 0, 0, 0.45),
    inset 0 0 6px rgba(255, 210, 138, 0.16);
}

.door__post--left {
  left: 24px;
}

.door__post--right {
  right: 24px;
}

.door__lintel {
  position: absolute;
  left: 22px;
  right: 22px;
  top: 8px;
  height: 9px;
  border-radius: 3px;
  background: linear-gradient(180deg, #6a4522 0%, #402713 100%);
  box-shadow:
    0 3px 10px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 210, 138, 0.28);
}

/* Свет, пролившийся на пол комнаты перед дверью */
.door__glow {
  position: absolute;
  left: 50%;
  bottom: -18px;
  width: 230px;
  height: 34px;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at center, rgba(255, 210, 138, 0.34) 0%, transparent 70%);
  filter: blur(4px);
  animation: door-flicker 5s ease-in-out infinite;
}

.door__label {
  position: absolute;
  left: 50%;
  bottom: -30px;
  transform: translateX(-50%);
  width: max-content;
  font-size: 12.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}

@keyframes door-flicker {
  0%,
  100% {
    opacity: 0.9;
  }
  42% {
    opacity: 0.55;
  }
  61% {
    opacity: 0.95;
  }
  74% {
    opacity: 0.7;
  }
}

/* ---------- карточка и типографика ---------- */
.stage {
  position: relative;
  z-index: 1;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px 20px;
  text-align: center;
}

.glass {
  max-width: 520px;
  width: 100%;
  padding: 40px 38px;
  border: 1px solid var(--hairline);
  border-radius: 22px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.025));
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  box-shadow:
    0 30px 80px -30px rgba(0, 0, 0, 0.7),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

body.scene--404 .glass {
  max-width: 470px;
}

.motif {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin: 0 0 18px;
  color: var(--accent);
  letter-spacing: 0.3em;
  font-size: 14px;
  user-select: none;
}

.motif::before,
.motif::after {
  content: "";
  width: 34px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--hairline));
}

.motif::after {
  background: linear-gradient(90deg, var(--hairline), transparent);
}

.glass h1 {
  margin: 0 0 14px;
  font-family: Georgia, "Times New Roman", "Noto Serif", serif;
  font-weight: 500;
  font-size: 34px;
  line-height: 1.2;
  letter-spacing: 0.01em;
}

.lede {
  margin: 0 0 26px;
  font-size: 15.5px;
  line-height: 1.65;
  color: var(--muted);
}

.rule {
  width: 56px;
  height: 1px;
  margin: 0 auto 18px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
}

.glass .hint {
  margin: 0;
  font-size: 14px;
}

.error-code {
  display: inline-block;
  margin-bottom: 14px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  padding: 5px 14px;
  border: 1px solid rgba(255, 210, 138, 0.4);
  border-radius: 999px;
  color: var(--accent);
}

.glass a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s, color 0.2s;
}

.glass a:hover {
  color: var(--accent-soft);
  border-bottom-color: var(--accent);
}

/* Подвал */
.foot {
  position: relative;
  z-index: 1;
  margin-top: 34px;
  font-size: 12.5px;
  letter-spacing: 0.08em;
  color: rgba(236, 238, 249, 0.45);
}

/* Мобильные */
@media (max-width: 480px) {
  .glass {
    padding: 30px 22px;
    border-radius: 18px;
  }
  .glass h1 {
    font-size: 27px;
  }
  .star--5,
  .star--6 {
    display: none;
  }
  .door {
    transform: scale(0.86);
    margin-bottom: 36px;
  }
}