:root {
  --void: #05060a;
  --bone: #f4f1ea;
  --gold: #ffb24d;
  --ember: #ff7a18;
  --mute: #9a9286;
  --danger: #ffb4a2;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--void);
  color: var(--bone);
  font-family: Fraunces, "Times New Roman", serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior: none;
  user-select: none;
  touch-action: manipulation;
}

body {
  min-height: 100dvh;
  overflow: hidden;
}

#stage {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: #000;
}

#camera {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}

#overlays {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  pointer-events: none;
}

.ar-plane {
  position: fixed;
  top: 0;
  left: 0;
  overflow: hidden;
  padding: 0;
  transform-origin: 0 0;
  pointer-events: none;
  backface-visibility: hidden;
  background: var(--bone);
  outline: 1px solid rgba(255, 178, 77, 0.2);
  outline-offset: 2px;
  box-shadow:
    0 24px 54px rgba(0, 0, 0, 0.5),
    0 0 28px rgba(255, 178, 77, 0.12);
}

.ar-plane.is-hidden {
  opacity: 0;
}

.ar-plane.is-live {
  pointer-events: auto;
}

.ar-media {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #090a0e;
}

.ar-photo {
  background-color: #090a0e;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}

.ar-play {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  margin: auto;
  width: 54px;
  height: 54px;
  border: 0;
  border-radius: 999px;
  background: rgba(5, 6, 10, 0.68);
  box-shadow:
    inset 0 0 0 1px rgba(255, 178, 77, 0.8),
    0 8px 24px rgba(0, 0, 0, 0.35);
  cursor: pointer;
}

.ar-play::before {
  content: "";
  position: absolute;
  top: 50%;
  left: calc(50% + 2px);
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 8px 0 8px 14px;
  border-color: transparent transparent transparent var(--gold);
  transform: translate(-50%, -50%);
}


#bloom {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(circle at 50% 42%, #ffffff 0%, var(--gold) 24%, transparent 62%);
  mix-blend-mode: screen;
}

#bloom.is-on {
  animation: bloom 700ms ease-out;
}

@keyframes bloom {
  0% { opacity: 0; }
  14% { opacity: 1; }
  100% { opacity: 0; }
}

#hint {
  position: absolute;
  left: 50%;
  bottom: calc(28px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  margin: 0;
  padding: 10px 16px;
  border: 1px solid rgba(255, 178, 77, 0.45);
  background: rgba(5, 6, 10, 0.48);
  color: var(--bone);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  pointer-events: none;
  transition-property: opacity, transform;
  transition-duration: 500ms;
  transition-timing-function: ease-out;
}

#hint.is-faded {
  opacity: 0;
  transform: translateX(-50%) translateY(8px);
}

#torch-button {
  position: absolute;
  top: calc(16px + env(safe-area-inset-top));
  right: calc(16px + env(safe-area-inset-right));
  z-index: 4;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 14px 0 12px;
  border: 1px solid rgba(255, 178, 77, 0.45);
  border-radius: 999px;
  background: rgba(5, 6, 10, 0.55);
  color: var(--bone);
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition-property: background-color, border-color, transform;
  transition-duration: 160ms;
  transition-timing-function: ease-out;
}

#torch-button[hidden] {
  display: none;
}

#torch-button.is-on {
  background: rgba(255, 178, 77, 0.22);
  border-color: var(--gold);
  color: var(--gold);
}

#torch-button:active {
  transform: scale(0.96);
}

#torch-button:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

.torch-icon {
  position: relative;
  width: 14px;
  height: 18px;
}

.torch-icon::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 8px;
  height: 10px;
  border-radius: 1px 1px 3px 3px;
  background: currentColor;
  transform: translateX(-50%);
}

.torch-icon::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 5px 9px 5px;
  border-color: transparent transparent currentColor transparent;
  transform: translateX(-50%);
}

#torch-button.is-on .torch-icon::after {
  filter: drop-shadow(0 0 6px rgba(255, 178, 77, 0.9));
}

#cinema {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 8;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px 18px calc(24px + env(safe-area-inset-bottom));
  background: rgba(5, 6, 10, 0.94);
}

#cinema[hidden] {
  display: none;
}

#cinema-video {
  width: min(100%, 920px);
  height: auto;
  max-height: calc(100dvh - 120px);
  background: #000;
  outline: 1px solid rgba(255, 255, 255, 0.1);
  outline-offset: -1px;
}

#cinema-close {
  min-height: 48px;
  min-width: 120px;
  padding: 0 22px;
  border: 0;
  border-radius: 999px;
  background: var(--bone);
  color: #14110f;
  font: 500 16px/1 Fraunces, "Times New Roman", serif;
  cursor: pointer;
}

#cinema-close:active {
  transform: scale(0.96);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.noscript {
  position: fixed;
  right: 20px;
  bottom: 20px;
  left: 20px;
  color: var(--bone);
}

@media (min-width: 768px) {
  #cinema-video {
    max-height: calc(100dvh - 140px);
  }
}
