/* Aspekta Variable — mesma fonte do luby.com.br (OFL 1.1) */
@font-face {
  font-family: 'Aspekta'; font-weight: 100 900; font-display: swap; font-style: normal;
  src: url('https://cdn.jsdelivr.net/gh/ivodolenc/aspekta@main/packages/fonts/variable/AspektaVF.woff2') format('woff2');
}

/* Tokens do design system Luby */
:root {
  --bg: hsl(220 20% 7%);
  --card: hsl(220 18% 11%);
  --panel: hsl(220 18% 11% / .88);
  --secondary: hsl(217 33% 17%);
  --line: hsl(217 25% 22%);
  --text: hsl(210 40% 98%);
  --muted: hsl(215 20% 78%);
  --electric: hsl(199 89% 48%);
  --electric-soft: hsl(199 89% 48% / .15);
  --builder: linear-gradient(135deg, hsl(262 100% 59%), hsl(285 100% 71%));
  --evolution: linear-gradient(135deg, hsl(216 100% 52%), hsl(191 100% 50%));
  --firepower: linear-gradient(135deg, hsl(0 100% 62%), hsl(16 100% 64%));
  --shadow-electric: 0 10px 40px -10px hsl(199 89% 48% / .4);
  --shadow-glow: 0 0 60px hsl(199 89% 48% / .3);
  --radius: .75rem;
  --ease: cubic-bezier(.4, 0, .2, 1);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--text);
  font: 14px/1.5 'Aspekta', ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji';
  -webkit-font-smoothing: antialiased; }
::selection { background: hsl(199 89% 48% / .3); }
:focus-visible { outline: 2px solid hsl(199 89% 48% / .7); outline-offset: 2px; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: hsl(217 25% 25%); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: hsl(199 89% 48% / .5); }
#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
button, select, input { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.grad { background: var(--evolution); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- Entrada ---------- */
#login { position: fixed; inset: 0; display: grid; place-items: center; padding: 16px; z-index: 20; overflow-y: auto;
  background:
    radial-gradient(ellipse 60% 50% at 20% 10%, hsl(199 89% 48% / .22), transparent 70%),
    radial-gradient(ellipse 50% 50% at 90% 90%, hsl(262 100% 59% / .18), transparent 70%),
    hsl(220 20% 7% / .82);
  backdrop-filter: blur(8px); }
.card { width: min(760px, 100%); background: var(--card); border: 1px solid var(--line); border-radius: calc(var(--radius) * 1.5);
  box-shadow: var(--shadow-electric); display: grid; grid-template-columns: 240px 1fr; overflow: hidden; }
.card .stage { position: relative; background: radial-gradient(circle at 50% 70%, hsl(199 89% 48% / .25), transparent 65%), hsl(220 20% 9%);
  border-right: 1px solid var(--line); display: grid; place-items: center; min-height: 360px; }
#preview { width: 240px; height: 340px; display: block; }
.stage .badge { position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); font-size: 12px; color: var(--muted);
  border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; background: hsl(220 18% 11% / .8); white-space: nowrap; }
.form { padding: 26px; display: grid; gap: 14px; align-content: start; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand img { height: 34px; width: auto; }
.brand span { color: var(--muted); font-size: 13px; border-left: 1px solid var(--line); padding-left: 10px; }
.form h1 { margin: 2px 0 0; font-size: 26px; line-height: 1.15; font-weight: 700; letter-spacing: -.02em; }
.sub { margin: -4px 0 2px; color: var(--muted); }
.form label.field { display: grid; gap: 6px; color: var(--muted); font-size: 13px; }
.form input { padding: 11px 14px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--secondary); outline: none; transition: var(--ease) .2s; }
.form input:focus { border-color: var(--electric); box-shadow: 0 0 0 3px var(--electric-soft); }
.pick { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; }
.pick > span { width: 62px; flex: none; }
.sw { display: flex; gap: 7px; flex-wrap: wrap; }
.sw button { width: 26px; height: 26px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0;
  box-shadow: inset 0 0 0 2px rgba(0,0,0,.25); transition: transform .15s var(--ease); }
.sw button.on { border-color: var(--electric); transform: scale(1.12); box-shadow: 0 0 0 3px var(--electric-soft); }
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg button { border: 1px solid var(--line); background: var(--secondary); border-radius: 999px; padding: 5px 12px; cursor: pointer; font-size: 13px; transition: var(--ease) .2s; }
.seg button:hover { border-color: hsl(199 89% 48% / .6); }
.seg button.on { background: var(--electric-soft); border-color: var(--electric); color: #fff; }
.primary { padding: 13px; border: 0; border-radius: var(--radius); cursor: pointer; font-weight: 600; color: #fff;
  background: var(--electric); box-shadow: var(--shadow-electric); transition: var(--ease) .25s; }
.primary:hover { filter: brightness(1.1); box-shadow: var(--shadow-glow); transform: translateY(-1px); }
.hint { margin: 0; color: var(--muted); font-size: 12px; }
.hint b { color: var(--text); }

/* ---------- HUD ---------- */
.glass { background: var(--panel); border: 1px solid var(--line); backdrop-filter: blur(10px); }
#topbar { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); display: flex; gap: 8px; align-items: center;
  border-radius: calc(var(--radius) * 1.2); padding: 6px 6px 6px 12px; z-index: 5; max-width: calc(100% - 24px); flex-wrap: wrap; justify-content: center; }
#topbar img { height: 20px; width: auto; }
#topbar button, #topbar select { background: var(--secondary); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 11px; cursor: pointer; transition: var(--ease) .2s; }
#topbar button:hover, #topbar select:hover { border-color: hsl(199 89% 48% / .6); }
#topbar button.live { background: var(--electric); border-color: var(--electric); box-shadow: var(--shadow-electric); }
#topbar option, #chatForm option { background: var(--card); }
#zoneName { font-weight: 600; padding: 0 10px; min-width: 130px; text-align: center; border-left: 1px solid var(--line); }

#minimap { position: fixed; top: 12px; right: 12px; width: 200px; height: 150px; border-radius: var(--radius); z-index: 4; }
#people { position: fixed; top: 172px; right: 12px; width: 270px; max-height: 50vh; overflow: auto; z-index: 6; border-radius: var(--radius); padding: 12px; }
#people h3 { margin: 0 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
#peopleList { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
#peopleList li { display: flex; align-items: center; gap: 8px; }
#peopleList .who { flex: 1; min-width: 0; }
#peopleList .who b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
#peopleList .who small { color: var(--muted); }
#peopleList button { background: var(--secondary); border: 1px solid var(--line); border-radius: 8px; padding: 3px 8px; cursor: pointer; }
#peopleList button:hover { border-color: var(--electric); }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.st-disponivel { background: #22c55e; box-shadow: 0 0 8px #22c55e; } .st-ocupado { background: #ef4444; box-shadow: 0 0 8px #ef4444; }
.st-reuniao { background: #a855f7; box-shadow: 0 0 8px #a855f7; } .st-ausente { background: #f59e0b; box-shadow: 0 0 8px #f59e0b; }

#emotes { position: fixed; bottom: 12px; left: 50%; transform: translateX(-50%); display: flex; gap: 4px; z-index: 5; border-radius: calc(var(--radius) * 1.2); padding: 5px; }
#emotes button { width: 38px; height: 38px; font-size: 20px; border: 0; border-radius: 10px; background: transparent; cursor: pointer; transition: var(--ease) .15s; }
#emotes button:hover { background: var(--electric-soft); transform: translateY(-2px); }

#chat { position: fixed; left: 12px; bottom: 12px; width: min(380px, calc(100% - 24px)); z-index: 5; display: grid; gap: 6px; }
#chatLog { max-height: 34vh; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border-radius: var(--radius); font-size: 13px; }
#chatLog:empty { display: none; }
#chatLog .m b { font-weight: 600; }
#chatLog .m.hl { background: var(--electric-soft); border-left: 2px solid var(--electric); margin: 0 -6px; padding: 2px 6px; border-radius: 4px; }
#chatLog .tag { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; padding: 1px 6px; border-radius: 5px; background: var(--secondary); margin-right: 5px; color: var(--muted); }
#chatLog .tag.dm { background: hsl(262 100% 59% / .3); color: #e9d5ff; }
#chatLog .sys { color: var(--muted); font-style: italic; }
#chatForm { display: flex; gap: 6px; }
#chatForm select, #chatForm input { border-radius: var(--radius); padding: 9px 11px; outline: none; background: var(--panel); border: 1px solid var(--line); }
#chatForm select { max-width: 130px; }
#chatForm input { flex: 1; min-width: 0; }
#chatForm input:focus { border-color: var(--electric); box-shadow: 0 0 0 3px var(--electric-soft); }
#nearby { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; font-size: 12px; color: var(--muted); }
#nearby:empty { display: none; }
#nearby button { background: var(--panel); border: 1px solid; border-radius: 999px; padding: 2px 10px; cursor: pointer; font-size: 12px; }

#card { position: fixed; z-index: 9; width: 240px; border-radius: var(--radius); padding: 12px; display: grid; gap: 8px; box-shadow: var(--shadow-electric); }
#card .head { display: flex; align-items: center; gap: 8px; }
#card .head b { flex: 1; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#card small { color: var(--muted); margin-top: -4px; }
#card .x { background: none; border: 0; cursor: pointer; color: var(--muted); }
#card .acts { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
#card .acts button { background: var(--secondary); border: 1px solid var(--line); border-radius: 9px; padding: 7px 4px; cursor: pointer; font-size: 13px; transition: var(--ease) .15s; }
#card .acts button:hover { border-color: var(--electric); background: var(--electric-soft); }

#interact { position: fixed; left: 50%; bottom: 72px; transform: translateX(-50%); z-index: 5; border-radius: var(--radius); padding: 7px 14px; pointer-events: none; }
#interact kbd { background: var(--electric); color: #fff; border-radius: 6px; padding: 1px 7px; font-weight: 700; margin-right: 8px; font-family: inherit; }

#toasts { position: fixed; top: 66px; left: 50%; transform: translateX(-50%); display: grid; gap: 6px; z-index: 8; pointer-events: none; justify-items: center; }
.toast { background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--electric); border-radius: var(--radius); padding: 8px 14px; animation: toast 4s forwards; backdrop-filter: blur(10px); }
@keyframes toast { 0% { opacity: 0; transform: translateY(-8px); } 8%, 85% { opacity: 1; transform: none; } 100% { opacity: 0; } }

/* ---------- Rótulos 3D ---------- */
#labels { position: fixed; inset: 0; pointer-events: none; z-index: 2; overflow: hidden; }
.tag3d { position: absolute; left: 0; top: 0; will-change: transform; display: flex; flex-direction: column; align-items: center; }
.name { display: flex; align-items: center; gap: 5px; background: hsl(220 20% 7% / .8); border: 1px solid var(--line); padding: 2px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap; }
.name.me { border-color: var(--electric); box-shadow: 0 0 12px hsl(199 89% 48% / .45); }
.clickable .name { pointer-events: auto; cursor: pointer; }
.clickable .name:hover { border-color: var(--electric); }
.bubble { max-width: 230px; background: #fff; color: hsl(220 20% 7%); padding: 6px 11px; border-radius: 12px; margin-bottom: 6px; font-size: 13px;
  box-shadow: 0 6px 20px rgba(0,0,0,.35); position: relative; word-wrap: break-word; animation: pop .2s; }
.bubble::after { content: ""; position: absolute; left: 50%; bottom: -6px; margin-left: -6px; border: 6px solid transparent; border-bottom: 0; border-top-color: #fff; }
.emote { font-size: 34px; animation: rise 2.2s forwards; position: absolute; bottom: 30px; }
@keyframes rise { 0% { transform: translateY(10px) scale(.4); opacity: 0; } 15% { transform: none; opacity: 1; } 80% { opacity: 1; } 100% { transform: translateY(-40px); opacity: 0; } }
@keyframes pop { from { transform: scale(.6); opacity: 0; } }

@media (max-width: 720px) {
  .card { grid-template-columns: 1fr; }
  .card .stage { border-right: 0; border-bottom: 1px solid var(--line); min-height: 220px; }
  #preview { height: 220px; }
  #minimap { width: 140px; height: 105px; top: auto; bottom: 64px; right: 8px; }
  #people { top: 110px; right: 8px; }
  #chatLog { max-height: 22vh; }
  #chat { bottom: 64px; width: calc(100% - 164px); }
  #emotes { bottom: 8px; }
  #zoneName { min-width: 0; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
