:root {
  color-scheme: dark;
  font-family: Georgia, "Times New Roman", serif;
  background: #050304;
  color: #f0e8df;
  --blood: #d71920;
  --blood-dark: #6d090d;
  --bone: #f0e8df;
  --ash: #a99d95;
}

* { box-sizing: border-box; }

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  overflow: hidden;
  background: #050304;
  touch-action: manipulation;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
}

button { font: inherit; }

.app {
  position: fixed;
  inset: 0;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(circle at 50% 42%, rgba(105, 8, 12, 0.18), transparent 33%),
    linear-gradient(160deg, #0e0708 0%, #030203 62%, #090405 100%);
}

.scare-video {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
  opacity: 0;
  transition: opacity 180ms linear;
}

.app[data-state="playing"] .scare-video { opacity: 1; }

.atmosphere {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.scanline {
  position: absolute;
  inset: -50%;
  opacity: 0.055;
  background: repeating-linear-gradient(0deg, transparent 0 3px, #fff 3px 4px);
  animation: drift 9s linear infinite;
}

.vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, transparent 30%, rgba(0, 0, 0, 0.58) 75%, #000 110%);
}

.app[data-state="playing"] .atmosphere { display: none; }

.screen {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: max(24px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) max(28px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
  text-align: center;
}

.app[data-state="loading"] .gate,
.app[data-state="ready"] .gate,
.app[data-state="activating"] .loading,
.app[data-state="ended"] .ending,
.app[data-state="error"] .error { display: flex; }

.sigil {
  margin: 0 0 30px;
  color: var(--blood);
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: clamp(2.7rem, 16vw, 5rem);
  line-height: 1;
  text-shadow: 0 0 26px rgba(215, 25, 32, 0.55);
  animation: breathe 2.6s ease-in-out infinite;
}

.eyebrow {
  margin: 0 0 18px;
  color: var(--blood);
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.26em;
  text-transform: uppercase;
}

h1,
h2 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(2.9rem, 13vw, 7.5rem);
  font-weight: 500;
  letter-spacing: -0.055em;
  line-height: 0.88;
  text-wrap: balance;
  text-shadow: 0 5px 35px #000;
}

h2 { font-size: clamp(2.6rem, 11vw, 6rem); }

.copy {
  max-width: 28rem;
  margin: 26px auto 0;
  color: var(--ash);
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 1rem;
  line-height: 1.55;
}

.action {
  width: min(100%, 22rem);
  min-height: 62px;
  margin-top: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border: 1px solid #f53a40;
  border-radius: 2px;
  padding: 0 21px 0 24px;
  color: #fff;
  background: linear-gradient(180deg, #b10e14, #76080c);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.8) inset, 0 12px 50px rgba(139, 5, 11, 0.24);
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.025em;
  cursor: pointer;
  transition: transform 120ms ease, filter 120ms ease, opacity 120ms ease;
}

.action:active { transform: scale(0.985); }
.action:focus-visible { outline: 3px solid #fff; outline-offset: 4px; }
.action:disabled { cursor: wait; filter: grayscale(0.65); opacity: 0.42; }
.button-mark { font-size: 1.5rem; font-weight: 400; }

.sound-note {
  margin: 18px 0 0;
  color: #706764;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 0.77rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.loading p {
  margin: 28px 0 0;
  color: #c9bdb6;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 0.88rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.loader { display: flex; gap: 7px; align-items: flex-end; height: 38px; }
.loader span { width: 5px; height: 10px; background: var(--blood); box-shadow: 0 0 16px rgba(215, 25, 32, 0.75); animation: pulse 850ms ease-in-out infinite; }
.loader span:nth-child(2) { animation-delay: 120ms; }
.loader span:nth-child(3) { animation-delay: 240ms; }

.ending::before {
  content: "";
  position: absolute;
  width: min(72vw, 420px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgba(165, 6, 12, 0.14);
  filter: blur(60px);
  z-index: -1;
}

noscript {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 2rem;
  color: var(--bone);
  background: #050304;
  text-align: center;
}

@keyframes pulse {
  0%, 100% { height: 9px; opacity: 0.35; }
  50% { height: 36px; opacity: 1; }
}

@keyframes breathe {
  0%, 100% { transform: scale(0.97); opacity: 0.72; }
  50% { transform: scale(1.04); opacity: 1; }
}

@keyframes drift { to { transform: translateY(25%); } }

@media (min-width: 720px) {
  .screen { padding-inline: 48px; }
  .action:hover:not(:disabled) { filter: brightness(1.14); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
}
