html, body {
  margin: 0; padding: 0; overflow: hidden; height: 100%;
  background: #14101f;
  font-family: "Trebuchet MS", "Segoe UI", Verdana, sans-serif;
  color: #f3eefc;
  -webkit-user-select: none; user-select: none;
  touch-action: none;
}
#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
#hud > * { pointer-events: auto; }

/* ---------- boot overlay ---------- */
#boot-overlay {
  position: fixed; inset: 0; z-index: 40;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 50% 40%, rgba(64,40,110,.92), rgba(16,10,28,.97));
  transition: opacity .8s ease;
}
#boot-overlay.gone { opacity: 0; pointer-events: none; }
.boot-inner { text-align: center; max-width: 560px; padding: 24px; }
.boot-inner h1 { font-size: clamp(26px, 5vw, 44px); margin: 18px 0 6px; letter-spacing: .5px;
  background: linear-gradient(90deg, #ffd77a, #ff8fb7, #9e8bff, #6fe3ff);
  -webkit-background-clip: text; background-clip: text; color: transparent; }
.boot-sub { color: #cfc4ee; margin: 0 0 14px; font-size: clamp(14px, 2.4vw, 18px); }
.boot-controls { color: #9c90c4; font-size: 13px; margin-bottom: 22px; }
#boot-enter {
  font: inherit; font-size: 19px; font-weight: bold; cursor: pointer;
  background: linear-gradient(135deg, #ff9d5c, #ff5f8f);
  border: none; color: #fff; padding: 14px 34px; border-radius: 999px;
  box-shadow: 0 6px 24px rgba(255,95,143,.45), inset 0 1px 0 rgba(255,255,255,.35);
  transition: transform .15s ease;
}
#boot-enter:hover { transform: scale(1.06); }
.boot-spark {
  width: 64px; height: 64px; margin: 0 auto; border-radius: 42% 58% 55% 45%/48% 44% 56% 52%;
  background: radial-gradient(circle at 35% 30%, #ffe9a8, #ff8fb7 55%, #7a4fd6);
  box-shadow: 0 0 34px 8px rgba(255,143,183,.5);
  animation: bootbob 2.4s ease-in-out infinite;
}
@keyframes bootbob { 0%,100%{transform:translateY(0) rotate(-3deg)} 50%{transform:translateY(-10px) rotate(3deg)} }

/* ---------- zone banner ---------- */
#zone-banner {
  position: absolute; top: 18px; left: 50%; transform: translateX(-50%);
  text-align: center; pointer-events: none !important;
  text-shadow: 0 2px 10px rgba(0,0,0,.8);
  transition: opacity .5s ease;
}
#zone-number { font-size: 13px; letter-spacing: 3px; text-transform: uppercase; color: #ffd77a; }
#zone-name { font-size: clamp(20px, 3.6vw, 32px); font-weight: bold; }
#zone-child { font-size: clamp(13px, 2.2vw, 17px); color: #d8cdf5; font-style: italic; max-width: 74vw; }
#zone-banner.hidden { opacity: 0; }

/* ---------- nav dots ---------- */
#nav-dots {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 9px;
}
.nav-dot {
  width: 14px; height: 14px; border-radius: 50%; border: 2px solid rgba(255,255,255,.55);
  background: rgba(30,20,50,.6); cursor: pointer; position: relative;
  transition: transform .15s ease, background .2s ease;
}
.nav-dot:hover { transform: scale(1.35); background: #ffd77a; }
.nav-dot.current { background: #ffd77a; border-color: #ffd77a; box-shadow: 0 0 10px #ffd77a; }
.nav-dot .dot-tip {
  display: none; position: absolute; left: 22px; top: -4px; white-space: nowrap;
  background: rgba(20,12,36,.92); padding: 3px 10px; border-radius: 8px; font-size: 12px;
}
.nav-dot:hover .dot-tip { display: block; }

/* ---------- hint bar ---------- */
#hint-bar {
  position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%);
  font-size: 12.5px; color: #cfc4ee; background: rgba(22,14,40,.72);
  padding: 6px 16px; border-radius: 999px; white-space: nowrap;
  max-width: 70vw; overflow: hidden; text-overflow: ellipsis;
  pointer-events: none !important;
}
#hint-bar b { color: #ffd77a; }
.hint-touch { display: none; }

/* ---------- toast ---------- */
#toast {
  position: absolute; bottom: 96px; left: 50%; transform: translateX(-50%);
  background: rgba(28,18,52,.92); border: 1px solid rgba(255,215,122,.5);
  padding: 9px 18px; border-radius: 12px; font-size: 15px;
  transition: opacity .3s ease; pointer-events: none !important; text-align: center; max-width: 80vw;
}
#toast.hidden { opacity: 0; }

/* ---------- tech card ---------- */
#tech-card {
  position: absolute; right: 14px; top: 70px; width: min(340px, 80vw);
  background: rgba(20,13,38,.95); border: 1px solid rgba(158,139,255,.5);
  border-radius: 14px; padding: 14px 16px; font-size: 13.5px; line-height: 1.55;
  box-shadow: 0 8px 32px rgba(0,0,0,.5); z-index: 12;
  max-height: 62vh; overflow-y: auto; pointer-events: auto;
}
#tech-card.hidden { display: none; }
#tech-title { font-weight: bold; color: #ffd77a; margin-bottom: 7px; font-size: 15px; padding-right: 22px; }
#tech-body { color: #ddd4f5; }
#tech-body b { color: #9fe8ff; }
#tech-close {
  position: absolute; top: 8px; right: 8px; background: none; border: none;
  color: #9c90c4; font-size: 16px; cursor: pointer;
}

/* ---------- sound toggle ---------- */
#sound-toggle {
  position: absolute; top: 14px; right: 14px; font-size: 20px; cursor: pointer;
  background: rgba(22,14,40,.72); border-radius: 50%; width: 42px; height: 42px;
  display: flex; align-items: center; justify-content: center;
}
#sound-toggle:hover { background: rgba(60,40,100,.85); }

/* ---------- touch ---------- */
#touch-ui.hidden { display: none; }
#stick-zone { position: absolute; left: 0; bottom: 0; width: 45vw; height: 45vh; pointer-events: none !important; }
#stick-base {
  position: absolute; left: 60px; bottom: 90px; width: 110px; height: 110px;
  border-radius: 50%; background: rgba(255,255,255,.08); border: 2px solid rgba(255,255,255,.25);
  pointer-events: none !important; display: none;
}
#stick-base.on { display: block; }
#stick-nub {
  position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; border-radius: 50%;
  background: rgba(255,215,122,.75); transform: translate(-50%, -50%);
}
#touch-actions { position: absolute; right: 18px; bottom: 110px; display: flex; flex-direction: column; gap: 14px; }
.touch-btn {
  width: 58px; height: 58px; border-radius: 50%; background: rgba(255,255,255,.12);
  border: 2px solid rgba(255,255,255,.3); font-size: 24px;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.touch-btn:active { background: rgba(255,215,122,.4); }

@media (pointer: coarse) {
  .hint-desktop { display: none; }
  .hint-touch { display: inline; }
}
@media (max-width: 700px) {
  #hint-bar { font-size: 11px; max-width: 60vw; bottom: 6px; }
  #tech-card { top: auto; bottom: 12px; right: 8px; left: 8px; width: auto; max-height: 45vh; }
  #nav-dots { gap: 7px; left: 8px; }
  #nav-dots .nav-dot { width: 12px; height: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .boot-spark { animation: none; }
}
