* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
:root {
  color-scheme: dark;
  --ink: #e2e9ed;
  --muted: #94a4b2;
  --line: #889fa438;
  --accent: #a5becd;
}
body {
  margin: 0;
  background: #030609;
  color: var(--ink);
  font:
    15px/1.6 system-ui,
    sans-serif;
}
button,
input {
  font: inherit;
}
button {
  color: var(--ink);
  border: 1px solid var(--line);
  background: #0a1522bd;
  padding: 11px 18px;
  cursor: pointer;
  border-radius: 3px;
  transition:
    border-color 0.2s,
    background 0.2s;
}
button:hover {
  border-color: #abc9d6;
  background: #162838;
}
button:disabled {
  opacity: 0.45;
  cursor: wait;
}
button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 2px solid #b6dfff;
  outline-offset: 5px;
}
a {
  color: #c6dceb;
  text-underline-offset: 4px;
}
#world {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
}
#hud {
  position: fixed;
  z-index: 6;
  top: 0;
  left: 0;
  right: 0;
  padding: 25px 32px;
  display: flex;
  justify-content: space-between;
  gap: 15px;
  pointer-events: none;
  background: linear-gradient(#020508a6, transparent);
}
#hud nav {
  display: flex;
  gap: 7px;
  align-items: start;
}
#hud button {
  pointer-events: auto;
  font-size: 12px;
  padding: 8px 12px;
}
#stage,
#connection {
  display: block;
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--muted);
}
.eyebrow {
  font-size: 11px;
  letter-spacing: 0.23em;
  text-transform: uppercase;
  color: #9db0bc;
}
.small {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.7;
}
.panel {
  width: min(920px, 100%);
  margin: auto;
  text-align: center;
}
.panel.narrow {
  max-width: 570px;
}
#overlay {
  position: fixed;
  inset: 0;
  z-index: 4;
  background: #02050b91;
  backdrop-filter: blur(4px);
  overflow: auto;
  padding: 110px 26px 60px;
  display: flex;
  align-items: center;
}
h1 {
  font:
    400 clamp(38px, 8vw, 78px)/1.15 Georgia,
    serif;
  letter-spacing: 0.11em;
  margin: 15px 0 25px;
}
h2 {
  font:
    400 clamp(23px, 3.7vw, 36px)/1.45 Georgia,
    serif;
  margin: 19px auto 28px;
  max-width: 820px;
}
h3 {
  font:
    400 23px/1.5 Georgia,
    serif;
}
.intro {
  font:
    italic 20px/1.75 Georgia,
    serif;
  color: #b0c0ca;
  margin-bottom: 35px;
}
.primary {
  background: #cbdce4;
  color: #12212a;
  border-color: #cbdce4;
  min-width: 180px;
}
.primary:hover {
  background: #e2edf2;
}
.row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  margin: 25px 0;
}
.quiet {
  background: transparent;
  border: 0;
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 5px;
  font-size: 13px;
}
.doors {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin: 35px 0;
}
.door {
  display: flex;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  border-radius: 46% 46% 3px 3px;
  padding: 45px 22px 27px;
  min-height: 230px;
  font:
    17px/1.7 Georgia,
    serif;
  background: linear-gradient(#101c2780, #070b11dd);
  box-shadow: inset 0 0 35px #030509;
}
.door span {
  font: 11px/2 system-ui;
  letter-spacing: 0.22em;
  color: #8eabbc;
  margin-bottom: 20px;
}
.door:hover {
  box-shadow:
    inset 0 0 55px #3c718521,
    0 0 25px #5995b61c;
}
.memory {
  font:
    italic 16px/1.7 Georgia,
    serif;
  color: #a9c1ca;
  border-left: 1px solid #7895a8;
  padding: 10px 20px;
  text-align: left;
  max-width: 640px;
  margin: 20px auto;
}
.price {
  font:
    36px Georgia,
    serif;
}
.price small {
  font: 14px system-ui;
  color: var(--muted);
}
#caption {
  position: fixed;
  z-index: 3;
  top: 18%;
  left: 12%;
  right: 12%;
  text-align: center;
  pointer-events: none;
  font:
    italic 20px/1.7 Georgia,
    serif;
  color: #c1d0d6;
  transition: opacity 1s;
  text-shadow: 0 2px 10px black;
}
#controls {
  position: fixed;
  bottom: max(18px, env(safe-area-inset-bottom));
  left: 0;
  right: 0;
  z-index: 3;
  display: flex;
  justify-content: space-between;
  align-items: end;
  padding: 0 30px;
  pointer-events: none;
}
#controls p {
  text-align: center;
}
#joystick {
  width: 112px;
  height: 112px;
  border: 1px solid #b1c5df3a;
  border-radius: 50%;
  position: relative;
  background: #12203638;
  pointer-events: auto;
  touch-action: none;
}
#knob {
  position: absolute;
  width: 36px;
  height: 36px;
  left: 37px;
  top: 37px;
  border: 1px solid #cddcec66;
  border-radius: 50%;
  background: #c7dbef1a;
}
#call {
  width: 82px;
  height: 82px;
  border-radius: 50%;
  font-size: 12px;
  letter-spacing: 0.13em;
  pointer-events: auto;
}
dialog {
  width: min(580px, calc(100% - 28px));
  max-height: 85dvh;
  overflow: auto;
  border: 1px solid #53697866;
  background: #061019;
  color: var(--ink);
  padding: 32px;
  border-radius: 5px;
  text-align: center;
}
dialog::backdrop {
  background: #010307c9;
  backdrop-filter: blur(10px);
}
dialog input {
  display: block;
  width: 100%;
  background: #0a1620;
  border: 1px solid #617a8977;
  padding: 12px;
  color: var(--ink);
  margin: 10px 0;
}
dialog form {
  text-align: left;
}
dialog label {
  font-size: 12px;
  color: var(--muted);
}
dialog .row {
  margin: 16px 0;
}
#closeDialog {
  display: block;
  min-height: 44px;
  margin: 24px auto 0;
}
#toast {
  position: fixed;
  z-index: 20;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100% - 32px);
  background: #142631;
  border: 1px solid #557787;
  border-radius: 4px;
  padding: 10px 18px;
  font-size: 13px;
  display: none;
}
#securityCheck {
  position: fixed;
  z-index: 30;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: #0b1822;
  padding: 22px;
}
.tree-scroll {
  position: relative;
  overflow: visible;
  margin: 4px -4% 22px;
  width: 108%;
  text-align: center;
  background: radial-gradient(ellipse at 50% 46%, #ffffff04, transparent 65%);
}
.tree-svg {
  display: block;
  width: 100%;
  height: auto;
  margin: auto;
  overflow: visible;
}
.tree-event {
  cursor: pointer;
}

.list {
  display: grid;
  gap: 9px;
  text-align: left;
}
.list button {
  text-align: left;
}
.badge {
  display: inline-block;
  padding: 3px 9px;
  border: 1px solid #698da955;
  border-radius: 20px;
  font-size: 10px;
  letter-spacing: 0.1em;
}
.error {
  color: #e4b0aa;
}
#endingScene {
  min-height: 180px;
  display: grid;
  place-items: center;
}
.ritual {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  font-size: 27px;
  background: radial-gradient(#83c8ec38, transparent);
  box-shadow: 0 0 90px #77c8ff22;
}
.friend {
  color: #dd858c;
}
footer {
  margin-top: 35px;
  color: var(--muted);
  font-size: 11px;
}
audio {
  max-width: 100%;
  margin: 10px 0;
}
@media (max-width: 600px) {
  #hud {
    padding: 16px;
    gap: 8px;
  }
  #hud nav {
    gap: 4px;
  }
  #hud button {
    padding: 7px;
    font-size: 11px;
  }
  .doors {
    gap: 10px;
    grid-template-columns: 1fr;
  }
  .door {
    min-height: 82px;
    border-radius: 8px;
    padding: 18px 20px;
    flex-direction: row;
    gap: 15px;
    text-align: left;
    justify-content: start;
    font-size: 16px;
  }
  .door span {
    margin: 0;
    min-width: 24px;
  }
  #overlay {
    padding: 100px 20px 35px;
  }
  h2 {
    font-size: 25px;
  }
  .intro {
    font-size: 18px;
  }
  #caption {
    font-size: 17px;
    left: 8%;
    right: 8%;
  }
  #controls {
    padding: 0 20px;
  }
  dialog {
    padding: 24px;
  }
  .row {
    gap: 8px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}

body:has(#overlay:not([hidden])) #caption {
  visibility: hidden;
}

.entry-form { text-align: left; max-width: 400px; margin: 28px auto; }
.entry-form label { display:block; color:#b6c8d0; font-size:13px; }
.entry-form input:not([type="checkbox"]) { width:100%; padding:15px 16px; margin:9px 0; border:1px solid #617a8966; border-radius:4px; background:#08151dbb; color:var(--ink); font-size:17px; }
.entry-form .primary { display:block; width:100%; margin-top:24px; }
.check-label { display:flex !important; gap:12px; align-items:flex-start; text-align:left; margin:22px 0 12px; font-size:13px; color:#a7bdc7; }
.check-label input[type="checkbox"] { width:17px; height:17px; flex:none; margin:3px 0 0; accent-color:#b8919b; }
.friend-list { display:grid; gap:12px; margin:24px 0; }
.friend-card { display:grid; grid-template-columns:38px 1fr; gap:12px; align-items:center; text-align:left; padding:16px; border:1px solid #69899536; background:#0c1a2480; border-radius:8px; }
.friend-card p { margin:3px 0; }
.friend-card .row { grid-column:1/-1; justify-content:flex-start; margin:0; gap:8px; }
.friend-avatar { display:grid; place-items:center; width:36px; height:36px; border:1px solid #b28b9866; border-radius:50%; color:#c4a0a9; background:#b28b9812; font-family:Georgia,serif; }
.invite-card { margin:22px 0; padding:18px; background:#10212c7a; border:1px solid #5374824d; border-radius:7px; }
.invite-card input { text-align:center; letter-spacing:.15em; }
.friend-chip { border-color:#b8919b55; color:#cfb2ba; font-size:12px; border-radius:20px; padding:6px 12px; }
.friends-panel form button { width:100%; }

#hud nav { flex-wrap:wrap; justify-content:flex-end; }
@media(max-width:600px) { #hud { padding:12px; } #hud nav { max-width:210px; } .entry-form { margin-top:20px; } .friend-card {padding:12px;} }

/* White light, fine engraved details and a full-height tree. */
.panel:has(.tree-scroll) { width:min(1100px,100%); }
.panel:has(.tree-scroll) > .eyebrow { color:#e9e8e3; letter-spacing:.38em; }
.panel:has(.tree-scroll) > h2 { font-size:clamp(30px,4.1vw,48px); color:#f4f3ed; font-weight:400; letter-spacing:.02em; margin-bottom:16px; }
#overlay:has(.tree-scroll) { background:#020407f5; align-items:flex-start; padding-top:104px; }
.tree-legend { gap:14px; align-items:center; margin:20px auto 0; }
.tree-legend .badge, .tree-legend .friend-chip { color:#e9e9e6; border-color:#ffffff26; border-radius:2px; background:#ffffff03; font-size:11px; letter-spacing:.04em; padding:7px 13px; }
.tree-own-key::before, .tree-friend-key::before { content:""; display:inline-block; width:18px; margin-right:9px; vertical-align:middle; border-top:1px solid #fff; filter:drop-shadow(0 0 3px #ffffffb3); }
.tree-friend-key::before { border-top-style:dashed; }
.tree-legend button:hover, .tree-legend button:focus-visible { color:white; background:#ffffff0b; border-color:#ffffff80; }
.tree-location-label { font:11px Georgia,serif; letter-spacing:1.8px; paint-order:stroke; stroke:#020407; stroke-width:4px; stroke-linejoin:round; }
.tree-root-label { font:10px Georgia,serif; letter-spacing:4px; opacity:.5; }
.tree-focus-ring { opacity:0; transition:opacity .2s; }
.tree-event:hover .tree-focus-ring, .tree-event:focus-visible .tree-focus-ring { opacity:1; }
.tree-event .tree-hit, .tree-event:hover .tree-hit { fill:transparent; }
.tree-event:focus-visible { outline:none; }
.panel:has(.tree-scroll) > .small { max-width:580px; margin:10px auto; color:#b6b8b8; }
@media(max-width:600px) {
  #overlay:has(.tree-scroll) {padding:115px 18px 40px;}
  .tree-scroll {width:114%;margin-left:-7%;margin-right:-7%;}
  .tree-legend {gap:7px;}
  .tree-legend .badge,.tree-legend .friend-chip {font-size:10px;padding:7px 9px;}
  .tree-location-label {font-size:17px;letter-spacing:1px;}
  .tree-root-label {font-size:14px;letter-spacing:3px;}
}

.tree-svg { max-width:min(100%,max(620px,calc((100svh - 320px) * 1.122))); }
.panel:has(.tree-scroll) > h2:focus { outline:none; }
.tree-location-label { font-size:16px; }
.tree-root-label { font-size:14px; }
@media(max-width:600px) { .tree-location-label {font-size:28px;} .tree-root-label {font-size:22px;} }
