* { box-sizing: border-box; }

:root {
  --charcoal: #232323;
  --white: #fff;
  --blue: #2f7cff;
  --deep-blue: #0b3cff;
  --hue: 0deg;
}

html, body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
  color: white;
  font-family: Arial, Helvetica, sans-serif;
}

button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.hero {
  position: fixed;
  inset: 0;
  background: linear-gradient(90deg, var(--charcoal) 0 56.35%, #000 56.35% 100%);
  overflow: hidden;
  z-index: 30;
}

.brand-block {
  position: absolute;
  left: 16.9vw;
  top: 27.4vh;
  font-weight: 900;
  letter-spacing: -0.045em;
  line-height: .76;
  font-size: clamp(78px, 8.95vw, 176px);
  animation: arrive 1.8s cubic-bezier(.16,1,.3,1) both;
}

.enter-button {
  position: absolute;
  left: 17.15vw;
  top: calc(27.4vh + clamp(250px, 31.2vw, 560px));
  border: 1px solid rgba(255,255,255,.35);
  color: rgba(255,255,255,.9);
  background: rgba(255,255,255,.02);
  padding: 13px 26px;
  letter-spacing: .34em;
  font-size: 11px;
  cursor: pointer;
  opacity: 0;
  animation: fadeIn 1.2s ease 1.4s forwards;
}

.micro-copy {
  position: absolute;
  left: 17.1vw;
  bottom: 5.4vh;
  color: rgba(255,255,255,.32);
  font-size: 10px;
  letter-spacing: .38em;
  opacity: 0;
  animation: fadeIn 1.2s ease 1.75s forwards;
}

body.entered .hero {
  animation: heroLeave 1.1s cubic-bezier(.83,0,.17,1) forwards;
  pointer-events: none;
}

body.home .hero {
  animation: none;
  opacity: 1;
  filter: none;
  transform: none;
  pointer-events: auto;
}

.experience {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 50% 66%, rgba(47,124,255,.10), transparent 19%),
    radial-gradient(circle at 46% 45%, rgba(255,255,255,.10), transparent 18%),
    linear-gradient(125deg, #020202, #101214 46%, #000);
  filter: hue-rotate(var(--hue));
  overflow: hidden;
  transform: translateY(100%);
  transition: transform 1.2s cubic-bezier(.83,0,.17,1);
}

body.entered .experience { transform: translateY(0); }
body.home .experience { transform: translateY(100%); }

.door {
  position: absolute;
  top: 0;
  width: 50%;
  height: 100%;
  z-index: 20;
  transition: transform 1.8s cubic-bezier(.76,0,.24,1) .45s;
}

.left-door { left: 0; background: #232323; }
.right-door { right: 0; background: #000; }

body.entered .left-door { transform: translateX(-94%); }
body.entered .right-door { transform: translateX(94%); }
body.home .door { transform: none; }

.topbar {
  position: absolute;
  z-index: 16;
  top: 34px;
  left: 38px;
  display: flex;
  align-items: center;
  gap: 28px;
}

.mini-logo {
  border: 0;
  background: transparent;
  color: white;
  padding: 0;
  cursor: pointer;
  font-size: 24px;
  letter-spacing: .08em;
}

.mini-logo:hover {
  color: var(--blue);
  text-shadow: 0 0 20px rgba(47,124,255,.65);
}

.top-note {
  font-size: 10px;
  letter-spacing: .22em;
  color: rgba(255,255,255,.48);
  pointer-events: none;
}

.top-note span {
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-left: 8px;
  border-radius: 50%;
  background: white;
}

.nav-controls {
  position: fixed;
  top: 24px;
  right: 18px;
  z-index: 60;
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-end;
  align-items: center;
  gap: 7px;
  max-width: calc(100vw - 36px);
}

.nav-controls button {
  border: 1px solid rgba(255,255,255,.24);
  border-radius: 999px;
  background: rgba(0,0,0,.22);
  color: rgba(255,255,255,.78);
  padding: 9px 10px;
  font-size: clamp(7px, .72vw, 9px);
  letter-spacing: .10em;
  cursor: pointer;
  backdrop-filter: blur(16px);
  white-space: nowrap;
  max-width: 138px;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color .25s ease, border .25s ease, transform .25s ease;
}

.nav-controls button:hover {
  color: var(--blue);
  border-color: rgba(47,124,255,.75);
  transform: translateY(-2px);
}

.space {
  position: absolute;
  inset: 0;
  perspective: 900px;
  transform-style: preserve-3d;
  cursor: grab;
}

.space.dragging { cursor: grabbing; }
.space.can-pick { cursor: pointer; }

#linkCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: .72;
}

.wordField {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  pointer-events: none;
}

.word {
  position: absolute;
  left: 50%;
  top: 50%;
  border: 0;
  background: transparent;
  color: white;
  padding: 0;
  cursor: pointer;
  text-transform: lowercase;
  transform-style: preserve-3d;
  text-shadow: 0 0 18px rgba(255,255,255,.18);
  transition: transform .58s cubic-bezier(.16,1,.3,1), opacity .25s ease, filter .25s ease, color .12s ease, text-shadow .12s ease;
  will-change: transform, opacity, filter;
  line-height: .95;
  pointer-events: none;
}

.word.cursor-picked,
.word:hover,
.word:focus-visible {
  color: var(--blue) !important;
  opacity: 1 !important;
  filter: blur(0px) !important;
  text-shadow:
    0 0 9px rgba(47,124,255,.95),
    0 0 30px rgba(47,124,255,.65),
    0 0 86px rgba(47,124,255,.35) !important;
  z-index: 999 !important;
}

.word.anchor {
  color: white !important;
  opacity: 1 !important;
  font-weight: 700;
  text-shadow:
    0 0 14px rgba(255,255,255,.78),
    0 0 54px rgba(47,124,255,.35) !important;
  z-index: 1000 !important;
}

.word.near { font-size: clamp(32px, 3.2vw, 68px); opacity: .68; }
.word.mid { font-size: clamp(22px, 2.15vw, 42px); opacity: .80; }
.word.far { font-size: clamp(16px, 1.38vw, 25px); opacity: .40; filter: blur(.2px); }
.word.deep { font-size: clamp(12px, 1vw, 18px); opacity: .18; filter: blur(.8px); }

.start-panel {
  position: absolute;
  right: clamp(26px, 6vw, 110px);
  bottom: clamp(28px, 7vh, 88px);
  z-index: 12;
  width: min(520px, calc(100vw - 52px));
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 1s ease 2s, transform 1s ease 2s;
}

body.entered .start-panel { opacity: 1; transform: translateY(0); }
body.generated .start-panel { opacity: 0; pointer-events: none; transition-delay: 0s; }

body.input-mode .start-panel {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
  transition-delay: 0s;
}

body.input-mode .prompt-panel,
body.input-mode .reset-button {
  opacity: 0;
  pointer-events: none;
}

body.input-mode .word,
body.input-mode #linkCanvas { opacity: .10 !important; }

.panel-title {
  font-weight: 900;
  font-size: clamp(32px, 4.2vw, 72px);
  letter-spacing: -.055em;
  line-height: .86;
  margin-bottom: 28px;
}

.panel-title::after {
  content: "PLACE / THING / FEELING";
  display: block;
  margin-top: 18px;
  color: rgba(255,255,255,.42);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: .28em;
  line-height: 1.4;
}

.fields { display: grid; gap: 12px; }

label {
  display: grid;
  grid-template-columns: 92px 1fr;
  align-items: center;
  border-bottom: 1px solid rgba(255,255,255,.22);
  padding: 12px 0;
}

label span, .small-label {
  font-size: 10px;
  letter-spacing: .25em;
  color: rgba(255,255,255,.44);
}

input {
  border: 0;
  outline: 0;
  background: transparent;
  color: white;
  font-weight: 900;
  font-size: clamp(22px, 3vw, 42px);
  letter-spacing: -.04em;
  text-transform: uppercase;
}

input::placeholder { color: rgba(255,255,255,.17); }

.main-button,
.copy-button,
.reset-button,
.close-contact {
  border: 1px solid rgba(255,255,255,.32);
  background: rgba(255,255,255,.035);
  color: white;
  cursor: pointer;
  transition: border .3s ease, color .3s ease, transform .3s ease, opacity .4s ease;
}

.main-button {
  margin-top: 22px;
  padding: 14px 18px;
  font-size: 11px;
  letter-spacing: .28em;
}

.main-button:hover,
.copy-button:hover,
.reset-button:hover,
.close-contact:hover {
  color: var(--blue);
  border-color: rgba(47,124,255,.75);
  transform: translateY(-2px);
}

.prompt-panel {
  position: absolute;
  left: 38px;
  bottom: 112px;
  z-index: 14;
  width: min(486px, calc(100vw - 76px));
  padding: 26px;
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(0,0,0,.26);
  backdrop-filter: blur(18px);
  border-radius: 18px;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity .8s ease, transform .8s ease;
  pointer-events: none;
}

body.generated .prompt-panel {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.prompt-text {
  margin-top: 18px;
  padding-right: 90px;
  font-size: clamp(22px, 2vw, 34px);
  line-height: 1.2;
  letter-spacing: -.04em;
  min-height: 44px;
}

.copy-button {
  position: absolute;
  right: 24px;
  top: 54px;
  padding: 10px 13px;
  border-radius: 7px;
  font-size: 10px;
  letter-spacing: .13em;
}

.suggestion-rule {
  height: 1px;
  background: rgba(255,255,255,.33);
  margin: 18px 0 14px;
}

.suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-top: 16px;
}

.suggestion {
  border: 0;
  background: transparent;
  color: rgba(255,255,255,.82);
  padding: 0;
  cursor: pointer;
  font-size: 14px;
}

.suggestion:hover { color: var(--blue); }

.reset-button {
  position: absolute;
  left: 38px;
  bottom: 40px;
  z-index: 14;
  padding: 13px 24px;
  border-radius: 999px;
  font-size: 10px;
  letter-spacing: .22em;
  opacity: 0;
  pointer-events: none;
}

body.generated .reset-button {
  opacity: 1;
  pointer-events: auto;
}

.contact-page {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at center, rgba(47,124,255,.11), transparent 28%),
    rgba(0,0,0,.86);
  backdrop-filter: blur(24px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .45s ease;
}

body.contact-mode .contact-page {
  opacity: 1;
  pointer-events: auto;
}

.close-contact {
  position: absolute;
  top: 34px;
  right: 34px;
  padding: 11px 18px;
  border-radius: 999px;
  font-size: 10px;
  letter-spacing: .2em;
}

.contact-title {
  position: absolute;
  top: 30vh;
  font-size: clamp(48px, 8vw, 150px);
  font-weight: 900;
  letter-spacing: -.065em;
}

.email-address {
  color: white;
  text-decoration: none;
  font-size: clamp(24px, 3.2vw, 62px);
  letter-spacing: -.035em;
  text-shadow: 0 0 22px rgba(255,255,255,.2);
}

.email-address:hover {
  color: var(--blue);
  text-shadow: 0 0 30px rgba(47,124,255,.65);
}

.contact-note {
  position: absolute;
  bottom: 12vh;
  color: rgba(255,255,255,.42);
  font-size: 10px;
  letter-spacing: .3em;
}

.navigation-hint {
  position: absolute;
  right: 42px;
  bottom: 34px;
  z-index: 12;
  color: rgba(255,255,255,.34);
  font-size: 10px;
  letter-spacing: .18em;
  pointer-events: none;
  opacity: 0;
  transition: opacity .8s ease;
}

body.generated .navigation-hint { opacity: 1; }

.api-status {
  position: absolute;
  right: 42px;
  bottom: 56px;
  z-index: 12;
  color: rgba(255,255,255,.28);
  font-size: 9px;
  letter-spacing: .18em;
  pointer-events: none;
  opacity: 0;
  transition: opacity .8s ease;
}

body.generated .api-status { opacity: 1; }

.sound-note {
  position: absolute;
  left: 50%;
  bottom: 34px;
  transform: translateX(-50%);
  z-index: 12;
  color: rgba(255,255,255,.48);
  font-size: 10px;
  letter-spacing: .18em;
  display: flex;
  align-items: center;
  gap: 15px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1s ease;
}

body.entered .sound-note { opacity: 1; }

.wave {
  width: 45px;
  height: 18px;
  background:
    linear-gradient(90deg, transparent 0 8%, white 8% 10%, transparent 10% 20%, white 20% 23%, transparent 23% 35%, white 35% 38%, transparent 38% 48%, white 48% 51%, transparent 51% 62%, white 62% 65%, transparent 65% 75%, white 75% 78%, transparent 78%);
  opacity: .72;
  animation: wave 1.2s ease-in-out infinite;
}

body.sound-off .wave { animation: none; opacity: .18; }

.loading-words .wordField::after {
  content: "SEARCHING WORDSPACE";
  position: absolute;
  left: 50%;
  top: 14%;
  transform: translateX(-50%);
  color: rgba(255,255,255,.32);
  font-size: 10px;
  letter-spacing: .28em;
}

.grain {
  position: fixed;
  inset: -80px;
  pointer-events: none;
  z-index: 50;
  opacity: .105;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(255,255,255,.22) 0 1px, transparent 1px),
    radial-gradient(circle at 80% 70%, rgba(255,255,255,.18) 0 1px, transparent 1px);
  background-size: 42px 42px, 29px 29px;
  animation: grainMove .22s steps(2) infinite;
}

.scanline {
  position: fixed;
  inset: 0;
  z-index: 51;
  pointer-events: none;
  opacity: .035;
  background: repeating-linear-gradient(to bottom, rgba(255,255,255,.12) 0, rgba(255,255,255,.12) 1px, transparent 1px, transparent 5px);
}

.cursor-light {
  position: fixed;
  left: 0;
  top: 0;
  width: 420px;
  height: 420px;
  margin-left: -210px;
  margin-top: -210px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 3;
  opacity: 0;
  background: radial-gradient(circle, rgba(47,124,255,.07), transparent 62%);
  transition: opacity .5s ease;
}

body.entered .cursor-light { opacity: 1; }

@keyframes arrive {
  from { opacity: 0; transform: translateY(28px) scale(.985); filter: blur(8px); }
  to { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}

@keyframes fadeIn { to { opacity: 1; } }

@keyframes heroLeave {
  to { filter: blur(18px); opacity: 0; transform: scale(1.08); }
}

@keyframes grainMove {
  from { transform: translate3d(0,0,0); }
  to { transform: translate3d(22px,-18px,0); }
}

@keyframes wave {
  0%, 100% { transform: scaleY(.75); opacity: .38; }
  50% { transform: scaleY(1.3); opacity: .9; }
}

@media (max-width: 900px) {
  .hero { background: linear-gradient(90deg, var(--charcoal) 0 72%, #000 72% 100%); }
  .brand-block { left: 9vw; top: 25vh; font-size: clamp(72px, 18vw, 130px); }
  .enter-button { left: 9.4vw; top: 63vh; }
  .micro-copy { left: 9.4vw; right: 9vw; line-height: 1.8; }

  .topbar { left: 20px; top: 22px; }
  .mini-logo { font-size: 18px; }
  .top-note { display: none; }

  .nav-controls {
    top: 12px;
    right: 10px;
    gap: 4px;
    max-width: calc(100vw - 20px);
  }

  .nav-controls button {
    max-width: 90px;
    padding: 7px 7px;
    font-size: 7px;
    letter-spacing: .06em;
  }

  label { grid-template-columns: 1fr; gap: 8px; }

  .prompt-panel {
    left: 20px;
    bottom: 96px;
    width: calc(100vw - 40px);
  }

  .reset-button { left: 20px; bottom: 28px; }

  .navigation-hint,
  .api-status,
  .sound-note { display: none; }

  .email-address { font-size: clamp(22px, 6vw, 44px); }
}
