:root {
  --glass-tint: rgba(12, 22, 26, .34);
  --glass-hi: rgba(255, 255, 255, .26);
  --glass-lo: rgba(255, 255, 255, .06);
  --glass-edge: rgba(255, 255, 255, .38);
  --text: #F4FEFF;
  --text-dim: rgba(244, 254, 255, .72);
  --accent: #1DC9D4;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s6: 24px;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; background: #000; overflow: hidden; }
body { font-family: 'Dosis', sans-serif; color: var(--text); -webkit-font-smoothing: antialiased; }
#scene { position: fixed; inset: 0; width: 100%; height: 100%; border: 0; display: block; }
#ui { position: fixed; inset: 0; pointer-events: none; opacity: 0; transition: opacity 600ms var(--ease); }
#ui.on { opacity: 1; }
#ui > * { pointer-events: auto; }

.glass {
  background:
    linear-gradient(180deg, var(--glass-hi), var(--glass-lo) 55%, rgba(255,255,255,.12)),
    var(--glass-tint);
  -webkit-backdrop-filter: blur(22px) saturate(190%) brightness(1.06);
  backdrop-filter: blur(22px) saturate(190%) brightness(1.06);
  border: 1px solid var(--glass-edge);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.55),
    inset 0 -1px 0 rgba(255,255,255,.12),
    inset 0 0 18px rgba(255,255,255,.06),
    0 12px 36px rgba(0,0,0,.28);
}

/* Barra de ambientes */
#dock {
  position: absolute; left: 50%; bottom: max(var(--s4), env(safe-area-inset-bottom));
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  display: flex; align-items: center; gap: var(--s1);
  padding: var(--s2); border-radius: 28px;
}
#rooms {
  display: flex; gap: var(--s1); overflow-x: auto; scroll-behavior: smooth;
  scrollbar-width: none; border-radius: 20px;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 16px, #000 calc(100% - 16px), transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0, #000 16px, #000 calc(100% - 16px), transparent 100%);
  padding: 0 var(--s2);
}
#rooms::-webkit-scrollbar { display: none; }
.pill, .round {
  font: inherit; color: var(--text-dim); cursor: pointer;
  background: transparent; border: 1px solid transparent;
  transition: background 280ms var(--ease), color 280ms var(--ease), border-color 280ms var(--ease), box-shadow 280ms var(--ease);
}
.pill {
  flex: 0 0 auto; min-height: 40px; padding: 0 var(--s4); border-radius: 20px;
  font-size: 16px; font-weight: 600; letter-spacing: .06em; white-space: nowrap;
}
.pill:hover, .round:hover { color: var(--text); background: rgba(255,255,255,.12); }
.pill:focus-visible, .round:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pill[aria-current="true"] {
  color: #06282C;
  background: linear-gradient(180deg, rgba(255,255,255,.96), rgba(255,255,255,.72));
  border-color: rgba(255,255,255,.9);
  box-shadow: inset 0 1px 0 #fff, 0 4px 14px rgba(0,0,0,.22);
}
.round {
  flex: 0 0 auto; width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
}
.round svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sep { flex: 0 0 auto; width: 1px; height: 24px; background: rgba(255,255,255,.28); margin: 0 var(--s1); }

/* Mapa */
#map {
  position: absolute; top: var(--s4); right: var(--s4);
  width: min(340px, calc(100% - 32px)); padding: var(--s3); border-radius: 24px;
}
#map header { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s2); margin-bottom: var(--s2); }
#map h2 { margin: 0; font-size: 14px; font-weight: 700; letter-spacing: .14em; color: var(--text-dim); }
#here { font-size: 16px; font-weight: 600; letter-spacing: .04em; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#plan { display: block; width: 100%; height: auto; overflow: visible; }
#plan .link { stroke: rgba(255,255,255,.26); stroke-width: 1; fill: none; }
#plan .room { fill: rgba(255,255,255,.55); stroke: rgba(255,255,255,.9); stroke-width: 1; cursor: pointer; transition: r 200ms var(--ease), fill 200ms var(--ease); }
#plan .room:hover, #plan .room.near { fill: #fff; }
#plan .hit { fill: transparent; cursor: pointer; }
#plan .trail { fill: none; stroke: var(--accent); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; opacity: .55; }
#plan .cone { fill: url(#coneGrad); }
#plan .me { fill: var(--accent); stroke: #fff; stroke-width: 1.5; }
#plan .dest { fill: none; stroke: #fff; stroke-width: 1.5; }
#plan .destline { stroke: #fff; stroke-width: 1; stroke-dasharray: 3 3; opacity: .8; }
#plan .pulse { fill: none; stroke: #fff; stroke-width: 1; transform-box: fill-box; transform-origin: center; animation: pulse 1.4s var(--ease) infinite; }
@keyframes pulse { from { transform: scale(.6); opacity: .9; } to { transform: scale(2.2); opacity: 0; } }

/* Bolinha de destino */
#ball {
  position: absolute; left: 0; top: 0; width: 72px; height: 72px; margin: -36px 0 0 -36px;
  border-radius: 50%; pointer-events: none; opacity: 0;
  transition: opacity 320ms var(--ease);
  background:
    radial-gradient(circle at 32% 26%, rgba(255,255,255,.95) 0, rgba(255,255,255,.35) 14%, rgba(255,255,255,0) 34%),
    radial-gradient(circle at 68% 78%, rgba(255,255,255,.34) 0, rgba(255,255,255,0) 42%),
    radial-gradient(circle at 50% 50%, rgba(255,255,255,.05) 40%, rgba(255,255,255,.26) 100%);
  -webkit-backdrop-filter: blur(4px) saturate(135%) brightness(1.22);
  backdrop-filter: blur(4px) saturate(135%) brightness(1.22);
  border: 1px solid rgba(255,255,255,.62);
  box-shadow: inset 0 -6px 12px rgba(255,255,255,.2), inset 0 2px 3px rgba(255,255,255,.7), 0 10px 22px rgba(0,0,0,.3);
}
#ball.on { opacity: 1; }
#ball::after {
  content: ''; position: absolute; inset: -1px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,.8); animation: ring 1.6s var(--ease) infinite;
}
@keyframes ring { from { transform: scale(1); opacity: .8; } to { transform: scale(1.9); opacity: 0; } }

@media (max-width: 640px) {
  #map { width: 200px; padding: var(--s2); border-radius: 20px; }
  #map h2 { display: none; }
  .pill { font-size: 16px; padding: 0 var(--s3); }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
