:root {
  color-scheme: dark;
  --ink: #030405;
  --silver: #edf2f3;
  --quiet: rgba(231, 239, 240, 0.56);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

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

body {
  color: var(--silver);
  font-family: "Helvetica Neue", "Segoe UI", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

.experience {
  position: relative;
  isolation: isolate;
  width: 100vw;
  height: 100svh;
  overflow: hidden;
  background: #030405;
}

.source-video {
  position: fixed;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.mirror-canvas,
.inactive-glass,
.glass-sheen,
.grain {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.mirror-canvas {
  z-index: 0;
  opacity: 0;
  transition: opacity 1.8s ease;
}

.mirror-canvas.is-visible {
  opacity: 1;
}

.inactive-glass {
  z-index: -2;
  background:
    radial-gradient(circle at 48% 41%, rgba(82, 90, 96, 0.19), transparent 24%),
    radial-gradient(circle at 50% 65%, rgba(23, 27, 30, 0.75), transparent 48%),
    linear-gradient(128deg, #020304 7%, #111519 43%, #050607 74%, #0e1215 100%);
}

.inactive-glass::before {
  content: "";
  position: absolute;
  inset: -20%;
  background: conic-gradient(
    from 160deg at 50% 50%,
    transparent,
    rgba(139, 210, 242, 0.035),
    transparent 24%,
    rgba(215, 171, 255, 0.025),
    transparent 54%,
    rgba(255, 183, 122, 0.025),
    transparent
  );
  filter: blur(60px);
  animation: drift 18s ease-in-out infinite alternate;
}

.glass-sheen {
  z-index: 2;
  pointer-events: none;
  background:
    linear-gradient(112deg, transparent 0 31%, rgba(255, 255, 255, 0.025) 38%, transparent 47%),
    radial-gradient(circle at 50% 50%, transparent 35%, rgba(0, 0, 0, 0.56) 108%);
  mix-blend-mode: screen;
}

.grain {
  z-index: 3;
  opacity: 0.075;
  pointer-events: none;
  background-image:
    repeating-radial-gradient(circle at 17% 32%, transparent 0 1px, rgba(255,255,255,.17) 1.5px 2px, transparent 2.5px 4px),
    repeating-linear-gradient(93deg, transparent 0 3px, rgba(255,255,255,.035) 4px, transparent 5px 8px);
  background-size: 13px 11px, 17px 19px;
  mix-blend-mode: soft-light;
}

.quiet-header,
.quiet-footer {
  position: absolute;
  z-index: 20;
  left: clamp(20px, 3vw, 48px);
  right: clamp(20px, 3vw, 48px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: rgba(232, 239, 241, 0.44);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.quiet-header {
  top: clamp(20px, 3vw, 42px);
}

.quiet-footer {
  bottom: clamp(18px, 2.5vw, 36px);
}

.sound-toggle {
  border: 0;
  padding: 8px 0 8px 16px;
  background: transparent;
  color: inherit;
  font-size: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  cursor: pointer;
}

.sound-toggle::before {
  content: "";
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-right: 8px;
  border-radius: 50%;
  background: currentColor;
  vertical-align: 1px;
}

.arrival-panel,
.center-message,
.revelation-panel,
.farewell-panel {
  position: absolute;
  z-index: 10;
  top: 50%;
  left: 50%;
  width: min(760px, calc(100vw - 44px));
  transform: translate(-50%, -50%);
  text-align: center;
}

.arrival-panel {
  animation: arrive 1.6s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.eyebrow {
  margin: 0 0 30px;
  color: rgba(225, 235, 237, 0.47);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.34em;
}

.arrival-panel h1,
.denied-message h1 {
  margin: 0;
  font-family: Iowan Old Style, Baskerville, "Times New Roman", serif;
  font-size: clamp(37px, 6vw, 82px);
  font-weight: 400;
  line-height: 0.98;
  letter-spacing: -0.045em;
  text-wrap: balance;
  text-shadow: 0 4px 40px rgba(0, 0, 0, 0.72);
}

.invitation {
  margin: 18px 0 42px;
  color: rgba(236, 241, 242, 0.67);
  font-family: Iowan Old Style, Baskerville, "Times New Roman", serif;
  font-size: clamp(21px, 2.4vw, 30px);
  font-style: italic;
}

.touch-glass {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
  border: 0;
  padding: 8px 24px;
  background: transparent;
  color: rgba(237, 244, 245, 0.7);
  font-size: 10px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  cursor: pointer;
}

.touch-mark {
  position: relative;
  display: block;
  width: 58px;
  height: 58px;
  border: 1px solid rgba(230, 243, 246, 0.22);
  border-radius: 50%;
  transition: transform 500ms ease, border-color 500ms ease;
}

.touch-mark::before,
.touch-mark::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  border: 1px solid rgba(163, 221, 241, 0.14);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.touch-mark::before {
  width: 6px;
  height: 6px;
  background: rgba(244, 248, 249, 0.72);
  box-shadow: 0 0 18px rgba(140, 211, 242, 0.65);
}

.touch-mark::after {
  width: 82px;
  height: 82px;
  opacity: 0;
  transition: opacity 500ms ease, transform 500ms ease;
}

.touch-glass:hover .touch-mark,
.touch-glass:focus-visible .touch-mark {
  transform: scale(1.08);
  border-color: rgba(230, 243, 246, 0.45);
}

.touch-glass:hover .touch-mark::after,
.touch-glass:focus-visible .touch-mark::after {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1.14);
}

.privacy-note {
  max-width: 390px;
  margin: 38px auto 0;
  color: rgba(226, 235, 237, 0.34);
  font-size: 11px;
  line-height: 1.6;
}

.center-message p {
  color: rgba(236, 242, 243, 0.65);
  font-family: Iowan Old Style, Baskerville, "Times New Roman", serif;
  font-size: clamp(20px, 2vw, 27px);
  font-style: italic;
}

.opening-ring {
  width: 86px;
  height: 86px;
  margin: 0 auto 26px;
  border: 1px solid rgba(225, 241, 244, 0.17);
  border-top-color: rgba(225, 241, 244, 0.78);
  border-radius: 50%;
  box-shadow: inset 0 0 24px rgba(150, 216, 244, 0.08), 0 0 24px rgba(150, 216, 244, 0.05);
  animation: turn 2.4s linear infinite;
}

.denied-message h1 {
  font-size: clamp(32px, 5vw, 60px);
}

.denied-message > p:not(.eyebrow) {
  max-width: 550px;
  margin: 28px auto 36px;
  color: rgba(233, 240, 241, 0.56);
  font-family: inherit;
  font-size: 14px;
  font-style: normal;
  line-height: 1.7;
}

.mirror-line,
.still-hint {
  position: absolute;
  z-index: 12;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  color: rgba(248, 250, 250, 0.77);
  text-align: center;
  text-shadow: 0 2px 22px rgba(0, 0, 0, 0.9);
  pointer-events: none;
}

.mirror-line {
  top: 50%;
  width: min(760px, calc(100vw - 40px));
  transform: translate(-50%, -50%);
  font-family: Iowan Old Style, Baskerville, "Times New Roman", serif;
  font-size: clamp(28px, 4vw, 56px);
  font-style: italic;
  animation: breathe 4s ease-in-out infinite;
}

.still-hint {
  bottom: clamp(58px, 8vh, 92px);
  color: rgba(240, 246, 247, 0.43);
  font-size: 10px;
  letter-spacing: 0.17em;
  text-transform: uppercase;
}

.revelation-panel,
.farewell-panel {
  padding: clamp(28px, 5vw, 64px);
  border: 1px solid rgba(227, 240, 242, 0.13);
  background: rgba(4, 6, 7, 0.46);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.45), inset 0 1px rgba(255, 255, 255, 0.035);
  backdrop-filter: blur(18px) saturate(0.7);
  animation: reveal 1.8s ease both;
}

.revelation-panel h2,
.farewell-panel h2 {
  max-width: 640px;
  margin: 0 auto 38px;
  font-family: Iowan Old Style, Baskerville, "Times New Roman", serif;
  font-size: clamp(31px, 5vw, 64px);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.text-action,
.seal-memory {
  border: 0;
  border-bottom: 1px solid rgba(231, 241, 243, 0.34);
  padding: 10px 2px;
  background: transparent;
  color: rgba(239, 245, 246, 0.72);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 250ms ease, border-color 250ms ease;
}

.text-action:hover,
.text-action:focus-visible,
.seal-memory:hover,
.seal-memory:focus-visible {
  border-color: rgba(240, 248, 249, 0.78);
  color: #fff;
}

.writing-layer {
  position: absolute;
  z-index: 11;
  inset: 0;
}

.fog {
  position: absolute;
  inset: -10%;
  background:
    radial-gradient(ellipse at 48% 48%, rgba(221, 229, 230, 0.29), rgba(144, 154, 158, 0.19) 36%, rgba(44, 48, 50, 0.57) 78%),
    linear-gradient(rgba(173, 184, 187, 0.2), rgba(53, 58, 60, 0.46));
  filter: blur(15px);
  backdrop-filter: blur(19px) saturate(0.2);
  animation: fog-in 2s ease both;
}

.writing-instruction {
  position: absolute;
  z-index: 13;
  top: clamp(72px, 10vh, 110px);
  left: 50%;
  width: min(620px, calc(100vw - 40px));
  transform: translateX(-50%);
  text-align: center;
  pointer-events: none;
}

.writing-instruction h2 {
  margin: 0;
  font-family: Iowan Old Style, Baskerville, "Times New Roman", serif;
  font-size: clamp(28px, 4vw, 48px);
  font-weight: 400;
}

.writing-instruction p {
  margin: 11px 0 0;
  color: rgba(235, 242, 243, 0.55);
  font-size: 11px;
  letter-spacing: 0.08em;
}

.writing-canvas {
  position: absolute;
  z-index: 12;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: crosshair;
}

.keyboard-word {
  position: absolute;
  z-index: 14;
  bottom: clamp(84px, 13vh, 132px);
  left: 50%;
  display: flex;
  align-items: center;
  gap: 12px;
  transform: translateX(-50%);
  color: rgba(236, 243, 244, 0.44);
  font-size: 10px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.keyboard-word input {
  width: 150px;
  border: 0;
  border-bottom: 1px solid rgba(233, 243, 245, 0.32);
  border-radius: 0;
  outline: 0;
  background: transparent;
  color: #f4f7f7;
  font-family: Iowan Old Style, Baskerville, "Times New Roman", serif;
  font-size: 19px;
  font-style: italic;
  text-transform: none;
}

.keyboard-word input:focus {
  border-color: rgba(236, 247, 249, 0.82);
}

.seal-memory {
  position: absolute;
  z-index: 15;
  right: clamp(22px, 4vw, 56px);
  bottom: clamp(76px, 8vh, 96px);
}

.farewell-panel p {
  margin: 0 0 12px;
  color: rgba(235, 243, 244, 0.52);
  font-family: Iowan Old Style, Baskerville, "Times New Roman", serif;
  font-size: clamp(18px, 2vw, 25px);
  font-style: italic;
}

.memory-ghost {
  position: absolute;
  z-index: 4;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  opacity: 0.14;
  filter: blur(0.6px) drop-shadow(0 0 9px rgba(159, 218, 243, 0.38));
  mix-blend-mode: screen;
  pointer-events: none;
  animation: memory-breathe 9s ease-in-out infinite;
}

.stage-mirror,
.stage-revelation,
.stage-writing,
.stage-farewell {
  cursor: crosshair;
}

button:focus-visible,
input:focus-visible {
  outline: 1px solid rgba(215, 241, 246, 0.8);
  outline-offset: 5px;
}

@keyframes arrive {
  from { opacity: 0; transform: translate(-50%, calc(-50% + 18px)); }
  to { opacity: 1; transform: translate(-50%, -50%); }
}

@keyframes turn {
  to { transform: rotate(360deg); }
}

@keyframes breathe {
  0%, 100% { opacity: 0.46; }
  50% { opacity: 0.96; }
}

@keyframes reveal {
  from { opacity: 0; transform: translate(-50%, calc(-50% + 10px)) scale(0.985); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

@keyframes fog-in {
  from { opacity: 0; transform: scale(1.08); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes memory-breathe {
  0%, 100% { opacity: 0.08; }
  50% { opacity: 0.18; }
}

@keyframes drift {
  from { transform: translate3d(-2%, -1%, 0) rotate(-2deg); }
  to { transform: translate3d(3%, 2%, 0) rotate(3deg); }
}

@media (max-width: 640px) {
  .quiet-footer span:first-child {
    display: none;
  }

  .quiet-footer {
    justify-content: center;
    font-size: 8px;
  }

  .arrival-panel {
    top: 48%;
  }

  .revelation-panel,
  .farewell-panel {
    width: calc(100vw - 30px);
    padding: 34px 22px;
  }

  .keyboard-word {
    bottom: 104px;
    flex-direction: column;
    gap: 5px;
  }

  .keyboard-word input {
    width: 180px;
    text-align: center;
  }

  .seal-memory {
    right: 50%;
    bottom: 57px;
    transform: translateX(50%);
  }

  .still-hint {
    bottom: 64px;
    width: calc(100vw - 40px);
  }
}

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