:root {
  color-scheme: dark;
  --ink: #f7f0de;
  --muted: rgba(239, 235, 225, 0.58);
  --hairline: rgba(244, 236, 215, 0.26);
  --blue: #7bd6ff;
  --gold: #ffc28e;
  --night: #06112c;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--night);
}

body {
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, serif;
  color: var(--ink);
}

button,
input {
  font: inherit;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.experience {
  position: relative;
  width: 100%;
  height: 100%;
  isolation: isolate;
  background: #071532;
}

#backdrop,
#backdropVideo,
#camera {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

#stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.grain,
.vignette,
.snap-flash {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.grain {
  z-index: 2;
  opacity: 0.18;
  mix-blend-mode: soft-light;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.48'/%3E%3C/svg%3E");
}

.vignette {
  z-index: 3;
  background:
    linear-gradient(180deg, rgba(3, 9, 26, 0.16), transparent 24%, transparent 68%, rgba(2, 8, 22, 0.42)),
    radial-gradient(ellipse at center, transparent 42%, rgba(1, 6, 20, 0.38) 100%);
}

.snap-flash {
  z-index: 4;
  opacity: 0;
  background:
    radial-gradient(circle at 52% 46%, rgba(210, 243, 255, 0.48), transparent 24%),
    linear-gradient(120deg, transparent 34%, rgba(255, 220, 178, 0.22), transparent 62%);
}

.snap-flash.is-visible {
  animation: snap-flash 620ms cubic-bezier(0.16, 1, 0.3, 1);
}

.masthead,
.live-state,
.music-control,
.meter,
.entry,
.privacy {
  position: absolute;
  z-index: 5;
}

.masthead {
  top: clamp(26px, 5.2vw, 72px);
  left: clamp(24px, 5vw, 76px);
  max-width: 420px;
  text-shadow: 0 2px 18px rgba(0, 5, 20, 0.28);
}

.eyebrow,
.live-state,
.meter,
.privacy,
.button-index {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.eyebrow {
  margin: 0 0 13px;
  font-size: 10px;
  color: rgba(255, 245, 221, 0.66);
}

h1 {
  margin: 0;
  font-size: clamp(58px, 8.2vw, 126px);
  font-weight: 400;
  font-style: italic;
  line-height: 0.79;
  letter-spacing: -0.065em;
}

.subtitle {
  margin: 25px 0 0 5px;
  font-size: clamp(13px, 1.2vw, 17px);
  letter-spacing: 0.08em;
  color: rgba(251, 239, 215, 0.68);
}

.live-state {
  top: clamp(28px, 4.4vw, 60px);
  right: clamp(24px, 4.6vw, 70px);
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 154px;
  padding: 9px 12px;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: rgba(4, 13, 36, 0.18);
  backdrop-filter: blur(14px);
  font-size: 9px;
  color: rgba(255, 244, 221, 0.74);
}

.state-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 12px var(--gold);
}

.live-state[data-state="live"] .state-dot {
  background: #b9f4ff;
  box-shadow: 0 0 13px #72dcff;
  animation: pulse 1.8s ease-in-out infinite;
}

.live-state[data-state="human"] .state-dot {
  background: #ffd3a5;
  box-shadow: 0 0 13px #ffb77e;
}

.live-state[data-state="glass"] .state-dot {
  background: #b9f4ff;
  box-shadow: 0 0 13px #72dcff;
  animation: pulse 1.8s ease-in-out infinite;
}

.live-state[data-state="error"] .state-dot {
  background: #ff8f91;
  box-shadow: 0 0 13px #ff6b6e;
}

.music-control {
  top: clamp(28px, 4.2vw, 58px);
  right: clamp(24px, 4.6vw, 70px);
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0;
  border: 0;
  color: rgba(255, 244, 221, 0.62);
  background: transparent;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 8px;
  letter-spacing: 0.13em;
  cursor: pointer;
  transition: color 180ms ease;
}

.music-control:hover,
.music-control[data-playing="true"] {
  color: #fff6e6;
}

.music-icon {
  width: 21px;
  height: 21px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 242, 218, 0.3);
  border-radius: 50%;
  font-family: Georgia, serif;
  font-size: 12px;
}

.music-control[data-playing="true"] .music-icon {
  border-color: rgba(179, 230, 255, 0.7);
  box-shadow: 0 0 13px rgba(105, 205, 255, 0.3);
  animation: pulse 2.4s ease-in-out infinite;
}

.meter {
  right: clamp(24px, 4.6vw, 70px);
  bottom: clamp(84px, 11vw, 150px);
  width: min(220px, 24vw);
  display: grid;
  gap: 19px;
  color: rgba(247, 239, 218, 0.7);
  font-size: 8px;
}

.meter label {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 12px;
  align-items: center;
}

.meter output {
  color: var(--ink);
}

.meter input {
  grid-column: 1 / -1;
  width: 100%;
  height: 1px;
  margin: 0;
  appearance: none;
  background: rgba(255, 244, 218, 0.3);
  cursor: ew-resize;
}

.meter input::-webkit-slider-thumb {
  width: 7px;
  height: 7px;
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 50%;
  background: rgba(201, 230, 255, 0.8);
  box-shadow: 0 0 10px rgba(93, 196, 255, 0.7);
}

.entry {
  left: 50%;
  bottom: clamp(34px, 5.3vw, 76px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 13px;
  transform: translateX(-50%);
}

.entry p {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.06em;
  color: rgba(255, 242, 216, 0.67);
  text-shadow: 0 1px 12px rgba(0, 3, 18, 0.5);
}

#cameraButton {
  width: clamp(245px, 25vw, 360px);
  height: 53px;
  display: grid;
  grid-template-columns: 32px 1fr 32px;
  align-items: center;
  padding: 0 12px;
  border: 1px solid rgba(255, 242, 217, 0.5);
  border-radius: 2px;
  color: #fff7e8;
  background: rgba(4, 14, 39, 0.24);
  backdrop-filter: blur(16px) saturate(130%);
  cursor: pointer;
  transition: background 180ms ease, border-color 180ms ease, transform 180ms ease;
}

#cameraButton:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 244, 221, 0.88);
  background: rgba(25, 50, 88, 0.42);
}

#cameraButton:disabled {
  cursor: wait;
  opacity: 0.7;
}

.button-index,
.button-arrow {
  font-size: 9px;
  color: rgba(255, 244, 221, 0.62);
}

.button-arrow {
  justify-self: end;
  font-size: 17px;
}

#buttonLabel {
  font-size: 13px;
  letter-spacing: 0.12em;
}

.privacy {
  left: clamp(24px, 5vw, 76px);
  bottom: clamp(27px, 4.1vw, 57px);
  margin: 0;
  font-size: 7px;
  color: rgba(244, 235, 216, 0.42);
}

@keyframes pulse {
  0%, 100% { opacity: 0.45; transform: scale(0.82); }
  50% { opacity: 1; transform: scale(1.1); }
}

@keyframes snap-flash {
  0% { opacity: 0; transform: scale(0.99); }
  14% { opacity: 1; }
  100% { opacity: 0; transform: scale(1.025); }
}

@media (max-width: 720px) {
  .masthead { top: 54px; }
  h1 { font-size: 62px; }
  .subtitle { max-width: 240px; line-height: 1.55; }
  .meter { right: 20px; bottom: 150px; width: 130px; }
  .music-control { top: 28px; right: 22px; }
  .entry { bottom: 54px; width: calc(100% - 40px); }
  .entry p { max-width: 300px; text-align: center; line-height: 1.45; }
  .privacy { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; }
}
