:root {
  --bg: #070b18;
  --bg2: #0d1428;
  --glass: rgba(18, 26, 52, .62);
  --glass-b: rgba(160, 180, 255, .14);
  --text: #eaf0ff;
  --muted: #8d9bc4;
  --violet: #6d5efc;
  --teal: #19d3c5;
  --ok: #34e0a1;
  --warn: #ffb547;
  --danger: #ff5d73;
  --grad: linear-gradient(135deg, var(--violet), var(--teal));
  --radius: 18px;
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); font-family: var(--font);
  font-size: 15px; line-height: 1.5; overflow-x: hidden; -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
.sprite { position: absolute; }
.ic { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
button, input { font: inherit; color: inherit; }
h1, h2, h3, h4, p { margin: 0; }

/* ---------- aurora background ---------- */
.aurora { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: radial-gradient(1200px 700px at 50% -10%, var(--bg2), var(--bg)); }
.aurora i { position: absolute; width: 46vmax; height: 46vmax; border-radius: 50%; filter: blur(90px); opacity: .32; animation: drift 24s ease-in-out infinite alternate; }
.aurora i:nth-child(1) { background: var(--violet); left: -12vmax; top: -14vmax; }
.aurora i:nth-child(2) { background: var(--teal); right: -16vmax; top: 10vmax; opacity: .2; animation-duration: 30s; }
.aurora i:nth-child(3) { background: #2a5bff; left: 25vw; bottom: -26vmax; opacity: .22; animation-duration: 36s; }
@keyframes drift { to { transform: translate(6vmax, 4vmax) scale(1.12); } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

.glass { background: var(--glass); border: 1px solid var(--glass-b); backdrop-filter: blur(18px) saturate(140%); -webkit-backdrop-filter: blur(18px) saturate(140%); box-shadow: 0 20px 60px rgba(0, 0, 0, .35); }

/* ---------- layout ---------- */
.view { max-width: 1080px; margin: 0 auto; padding: 28px 20px 48px; min-height: 100%; }
.view.center { display: grid; place-items: center; }
.brand { display: flex; align-items: center; gap: 12px; }
.wordmark { font-size: 22px; font-weight: 600; letter-spacing: -.02em; }
.wordmark b { font-weight: 800; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

.hero { margin: 7vh 0 34px; max-width: 720px; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; color: var(--teal); font-size: 13px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.eyebrow .ic { width: 16px; height: 16px; }
.hero h1 { font-size: clamp(34px, 6vw, 60px); line-height: 1.05; letter-spacing: -.035em; margin: 14px 0 16px; font-weight: 750; }
.grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lede { color: var(--muted); font-size: 17px; max-width: 580px; }

.cards { display: grid; grid-template-columns: 1.2fr 1fr; gap: 18px; }
@media (max-width: 820px) { .cards { grid-template-columns: 1fr; } }
.card { border-radius: var(--radius); padding: 24px; display: flex; flex-direction: column; gap: 14px; }
.card h2 { font-size: 20px; letter-spacing: -.01em; }
.card.narrow { max-width: 420px; width: 100%; align-items: center; text-align: center; padding: 36px 28px; }
.muted { color: var(--muted); }
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 600; }
label em { font-style: normal; font-weight: 400; opacity: .7; }
input:not([type=checkbox]) {
  background: rgba(8, 12, 28, .7); border: 1px solid var(--glass-b); border-radius: 12px; padding: 12px 14px; color: var(--text); outline: none; transition: border-color .15s, box-shadow .15s;
}
input:not([type=checkbox]):focus { border-color: var(--violet); box-shadow: 0 0 0 3px rgba(109, 94, 252, .25); }
.check { flex-direction: row; align-items: center; gap: 10px; font-weight: 500; color: var(--text); cursor: pointer; }
.check input { accent-color: var(--violet); width: 18px; height: 18px; }
.err { color: var(--danger); font-size: 13px; min-height: 0; }
.err:empty { display: none; }
.trust { list-style: none; padding: 0; margin: 4px 0 0; display: grid; gap: 8px; color: var(--muted); font-size: 13px; }
.trust li { display: flex; gap: 10px; align-items: center; }
.trust .ic { color: var(--teal); width: 16px; height: 16px; }

.btn { border: 1px solid var(--glass-b); background: rgba(255, 255, 255, .06); border-radius: 12px; padding: 12px 18px; font-weight: 600; cursor: pointer; transition: transform .1s, background .15s, box-shadow .15s; }
.btn:hover { background: rgba(255, 255, 255, .11); }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--grad); border-color: transparent; color: #04101a; box-shadow: 0 8px 28px rgba(109, 94, 252, .35); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.danger { background: rgba(255, 93, 115, .15); border-color: rgba(255, 93, 115, .4); color: #ffb3bd; }
.btn.small { padding: 8px 12px; font-size: 13px; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

/* ---------- lobby ---------- */
.lobby { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; margin-top: 5vh; align-items: start; }
@media (max-width: 820px) { .lobby { grid-template-columns: 1fr; } }
.preview { position: relative; border-radius: 22px; overflow: hidden; aspect-ratio: 16/10; background: #05080f; }
.preview video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.avatar-fill { position: absolute; inset: 0; display: grid; place-items: center; background: radial-gradient(circle at 50% 40%, #1b2550, #0a1022); }
.avatar-fill span, .avatar span { display: grid; place-items: center; width: 92px; height: 92px; border-radius: 50%; background: var(--grad); color: #04101a; font-weight: 800; font-size: 34px; }
.preview-ctl { position: absolute; bottom: 14px; left: 0; right: 0; display: flex; justify-content: center; gap: 12px; }
.preview-msg { position: absolute; top: 14px; left: 14px; right: 14px; background: rgba(255, 181, 71, .15); border: 1px solid rgba(255, 181, 71, .4); border-radius: 10px; padding: 8px 12px; font-size: 13px; color: #ffd9a0; }
.code { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 26px; letter-spacing: .06em; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.round { width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--glass-b); background: rgba(10, 16, 36, .75); display: grid; place-items: center; cursor: pointer; backdrop-filter: blur(8px); }
.round.off { background: var(--danger); border-color: transparent; color: #fff; }

.pulse { position: relative; display: grid; place-items: center; width: 110px; height: 110px; }
.pulse::before, .pulse::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--teal); opacity: 0; animation: ring 2.4s ease-out infinite; }
.pulse::after { animation-delay: 1.2s; border-color: var(--violet); }
@keyframes ring { 0% { transform: scale(.6); opacity: .8; } 100% { transform: scale(1.3); opacity: 0; } }

/* ---------- room ---------- */
.room { position: fixed; inset: 0; display: flex; flex-direction: column; padding: 12px 14px 0; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 4px 4px 10px; }
.top-left, .top-right { display: flex; align-items: center; gap: 10px; }
.chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; background: rgba(255, 255, 255, .06); border: 1px solid var(--glass-b); cursor: default; }
button.chip { cursor: pointer; }
.chip .ic { width: 15px; height: 15px; }
.chip.ok { color: var(--ok); border-color: rgba(52, 224, 161, .35); background: rgba(52, 224, 161, .08); }
.chip.warn { color: var(--warn); border-color: rgba(255, 181, 71, .4); background: rgba(255, 181, 71, .08); }
.chip.muted { color: var(--muted); font-variant-numeric: tabular-nums; }
#room-code { font-family: ui-monospace, Consolas, monospace; letter-spacing: .04em; }

.stage { flex: 1; min-height: 0; display: flex; gap: 12px; padding-bottom: 104px; }
.grid { flex: 1; min-width: 0; display: grid; gap: 12px; grid-auto-rows: 1fr; grid-template-columns: 1fr; }
.grid[data-count="2"] { grid-template-columns: repeat(2, 1fr); }
.grid[data-count="3"], .grid[data-count="4"] { grid-template-columns: repeat(2, 1fr); }
.grid[data-count="5"], .grid[data-count="6"] { grid-template-columns: repeat(3, 1fr); }
.grid[data-count="7"], .grid[data-count="8"], .grid[data-count="9"] { grid-template-columns: repeat(3, 1fr); }
.grid[data-count="10"], .grid[data-count="11"], .grid[data-count="12"] { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 720px) {
  .grid, .grid[data-count] { grid-template-columns: 1fr; overflow-y: auto; grid-auto-rows: minmax(180px, 1fr); }
  .grid[data-count="1"] { grid-auto-rows: 1fr; }
  .grid[data-count="2"], .grid[data-count="3"], .grid[data-count="4"] { grid-template-columns: repeat(2, 1fr); }
  .stage.panel-open .panel { position: fixed; inset: 58px 10px 100px; width: auto; z-index: 20; }
}

.tile { position: relative; border-radius: 20px; overflow: hidden; background: #0a1022; border: 1px solid var(--glass-b); min-height: 0; transition: box-shadow .2s, border-color .2s; }
.tile video { width: 100%; height: 100%; object-fit: cover; display: block; background: #05080f; }
.tile.local video:not(.screen) { transform: scaleX(-1); }
.tile.screen-share video { object-fit: contain; }
.tile.speaking { border-color: var(--teal); box-shadow: 0 0 0 2px var(--teal), 0 0 32px rgba(25, 211, 197, .35); }
.tile .avatar { position: absolute; inset: 0; display: grid; place-items: center; background: radial-gradient(circle at 50% 40%, #1b2550, #0a1022); }
.tile .avatar span { width: clamp(64px, 12vmin, 110px); height: clamp(64px, 12vmin, 110px); font-size: clamp(24px, 5vmin, 40px); }
.tile .label { position: absolute; left: 10px; bottom: 10px; display: flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; background: rgba(5, 8, 20, .7); backdrop-filter: blur(8px); font-size: 13px; font-weight: 600; max-width: calc(100% - 20px); }
.tile .label span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .label .ic { width: 14px; height: 14px; color: var(--danger); }
.tile .host-tag { color: var(--teal); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.tile .hand { position: absolute; top: 10px; right: 10px; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: var(--warn); color: #281a00; box-shadow: 0 6px 18px rgba(255, 181, 71, .45); }
.tile .conn { position: absolute; top: 10px; left: 10px; font-size: 12px; padding: 3px 9px; border-radius: 999px; background: rgba(255, 181, 71, .2); color: #ffd9a0; }

/* side panel */
.panel { width: 340px; flex: none; border-radius: 20px; display: flex; flex-direction: column; overflow: hidden; }
.panel > header { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--glass-b); }
.panel h3 { font-size: 16px; }
.panel h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 14px 0 8px; }
.pane { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 0 16px 14px; overflow-y: auto; }
.icon { width: 36px; height: 36px; border-radius: 10px; border: 0; background: transparent; display: grid; place-items: center; cursor: pointer; color: var(--muted); }
.icon:hover { background: rgba(255, 255, 255, .08); color: var(--text); }
.chat-log { list-style: none; margin: 0; padding: 14px 0; flex: 1; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; }
.msg { max-width: 92%; padding: 8px 12px; border-radius: 14px; background: rgba(255, 255, 255, .07); font-size: 14px; word-break: break-word; }
.msg.me { align-self: flex-end; background: rgba(109, 94, 252, .35); }
.msg .who { display: block; font-size: 11px; color: var(--teal); font-weight: 700; margin-bottom: 2px; }
.msg.sys { align-self: center; background: none; color: var(--muted); font-size: 12px; }
.chat-form { display: flex; gap: 8px; padding-top: 10px; border-top: 1px solid var(--glass-b); }
.chat-form input { flex: 1; min-width: 0; }
.icon.send { background: var(--grad); color: #04101a; }
.people { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.people li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; background: rgba(255, 255, 255, .05); }
.people .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.people .mini { padding: 5px 10px; font-size: 12px; border-radius: 8px; border: 1px solid var(--glass-b); background: rgba(255, 255, 255, .06); cursor: pointer; }
.people .mini.yes { background: rgba(52, 224, 161, .18); border-color: rgba(52, 224, 161, .4); color: var(--ok); }
.people .mini.no { color: #ffb3bd; }
.waiting-box { border: 1px solid rgba(255, 181, 71, .35); background: rgba(255, 181, 71, .06); border-radius: 14px; padding: 0 12px 12px; margin-top: 12px; }
.host-tools { margin-top: auto; padding-top: 16px; display: grid; gap: 8px; }
.sec-list { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 16px; }
.sec-list li { display: flex; gap: 12px; }
.sec-list .ic { color: var(--teal); margin-top: 2px; }
.sec-list b { display: block; font-size: 14px; }
.sec-list span { color: var(--muted); font-size: 13px; }

/* floating dock */
.dock { position: fixed; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; align-items: center; gap: 6px; padding: 8px; border-radius: 26px; z-index: 10; max-width: calc(100vw - 20px); overflow-x: auto; }
.ctl { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-width: 62px; height: 60px; padding: 0 10px; border: 0; border-radius: 18px; background: transparent; color: var(--text); font-size: 11px; font-weight: 600; cursor: pointer; transition: background .15s, transform .1s; }
.ctl:hover { background: rgba(255, 255, 255, .09); }
.ctl:active { transform: scale(.95); }
.ctl.off { background: rgba(255, 93, 115, .2); color: #ffb3bd; }
.ctl.on { background: rgba(25, 211, 197, .18); color: var(--teal); }
.ctl.leave { background: var(--danger); color: #fff; }
.ctl.leave:hover { filter: brightness(1.1); }
.sep { width: 1px; height: 34px; background: var(--glass-b); margin: 0 4px; flex: none; }
.dot { position: absolute; top: 8px; right: 14px; width: 9px; height: 9px; border-radius: 50%; background: var(--warn); box-shadow: 0 0 0 3px rgba(255, 181, 71, .25); }
@media (max-width: 560px) { .ctl { min-width: 50px; } .ctl span { display: none; } .ctl #people-count { display: inline; } }

.toast { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); background: rgba(14, 20, 42, .95); border: 1px solid var(--glass-b); border-radius: 12px; padding: 10px 16px; font-size: 14px; z-index: 50; box-shadow: 0 12px 40px rgba(0, 0, 0, .4); max-width: 90vw; }

/* ================= v2: visual identity, minimal copy ================= */
.view.home { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; min-height: 100%; padding-top: 6vh; text-align: center; }

.orbit { position: relative; width: 260px; height: 260px; display: grid; place-items: center; }
.orbit img { position: relative; filter: drop-shadow(0 12px 40px rgba(109, 94, 252, .55)); animation: float 6s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-8px); } }
.ring { position: absolute; border-radius: 50%; border: 1px solid rgba(160, 180, 255, .18); animation: spin 22s linear infinite; }
.ring i { position: absolute; top: -5px; left: 50%; width: 10px; height: 10px; margin-left: -5px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 16px var(--teal); }
.ring.r1 { inset: 28px; }
.ring.r2 { inset: 4px; animation-duration: 34s; animation-direction: reverse; }
.ring.r2 i { background: var(--violet); box-shadow: 0 0 16px var(--violet); top: auto; bottom: -5px; }
.ring.r3 { inset: -34px; border-style: dashed; border-color: rgba(160, 180, 255, .1); animation-duration: 60s; }
.ring.r3 i { background: #fff; box-shadow: 0 0 14px #fff; width: 6px; height: 6px; margin-left: -3px; top: -3px; }
@keyframes spin { to { transform: rotate(360deg); } }
.wordmark.xl { font-size: clamp(40px, 8vw, 72px); letter-spacing: -.045em; font-weight: 700; line-height: 1; }
.seals { display: flex; gap: 18px; color: var(--teal); margin: -6px 0 6px; opacity: .85; }
.seals .ic { width: 20px; height: 20px; }

.cards { display: flex; flex-direction: column; align-items: center; gap: 14px; width: 100%; }
.pill { position: relative; display: flex; align-items: center; gap: 8px; padding: 8px; border-radius: 999px; width: min(560px, 100%); }
.pill .field { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 0 14px; height: 48px; border-radius: 999px; background: rgba(8, 12, 28, .6); border: 1px solid transparent; transition: border-color .15s, box-shadow .15s; }
.pill .field:focus-within { border-color: var(--violet); box-shadow: 0 0 0 3px rgba(109, 94, 252, .25); }
.pill .field .ic { color: var(--muted); }
.pill .field input { flex: 1; min-width: 0; width: 100%; background: transparent !important; border: 0 !important; box-shadow: none !important; padding: 0 !important; outline: none; }
#form-join .field input { font-family: ui-monospace, Consolas, monospace; letter-spacing: .06em; }
.go { height: 48px; padding: 0 20px; border: 1px solid var(--glass-b); border-radius: 999px; display: inline-flex; align-items: center; gap: 8px; font-weight: 700; cursor: pointer; background: rgba(255, 255, 255, .08); transition: transform .1s, filter .15s; }
.go:hover { filter: brightness(1.2); } .go:active { transform: scale(.97); }
.go.primary { background: var(--grad); color: #04101a; border-color: transparent; box-shadow: 0 8px 28px rgba(109, 94, 252, .4); }
.pill .err { position: absolute; left: 22px; top: calc(100% + 6px); }

.switch { position: relative; display: flex; align-items: center; gap: 6px; padding: 0 10px; height: 48px; cursor: pointer; color: var(--muted); flex-direction: row; }
.switch input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; cursor: pointer; }
.switch .knob { width: 34px; height: 20px; border-radius: 999px; background: rgba(255, 255, 255, .15); position: relative; transition: background .2s; }
.switch .knob::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch input:checked ~ .knob { background: var(--teal); }
.switch input:checked ~ .knob::after { transform: translateX(14px); }
.switch input:checked ~ .ic { color: var(--teal); }
.switch input:focus-visible ~ .knob { outline: 2px solid var(--teal); outline-offset: 2px; }
@media (max-width: 560px) { .go span { display: none; } .go { padding: 0 16px; } .pill { flex-wrap: wrap; border-radius: 28px; } .pill .field { flex-basis: 40%; } }

/* lobby: compact */
.lobby { margin-top: 3vh; }
.lobby .card { gap: 12px; }
.lobby .btn { display: flex; justify-content: center; align-items: center; height: 46px; }
.lobby .btn.ghost { height: 40px; color: var(--muted); }

/* dock: icon-only, tooltips via aria-label */
.ctl span:not(#people-count) { display: none; }
.ctl { min-width: 54px; height: 54px; border-radius: 50%; padding: 0; }
.ctl.leave { width: 64px; border-radius: 27px; }
.ctl .ic { width: 22px; height: 22px; }
#people-count { font-size: 11px; position: absolute; bottom: 6px; right: 8px; min-width: 16px; padding: 0 4px; border-radius: 8px; background: rgba(255, 255, 255, .14); line-height: 16px; }
.dock { gap: 8px; border-radius: 999px; padding: 8px 12px; }
.sep { height: 28px; }
.eyebrow { display: none; }

/* ---- mobile fit ---- */
@media (max-width: 560px) {
  .room { padding: 8px 8px 0; }
  .topbar { padding-bottom: 8px; }
  #clock, #badge-sec, #badge-lock { font-size: 0; gap: 0; padding: 7px; }       /* icon-only chips */
  #badge-lock .ic, #badge-sec .ic { width: 16px; height: 16px; }
  #clock { display: none; }
  #room-code { font-size: 12px; }
  .dock { left: 8px; right: 8px; transform: none; justify-content: space-between; gap: 2px; padding: 6px 8px; max-width: none; }
  .ctl { min-width: 0; width: 44px; height: 46px; flex: none; }
  .ctl.leave { width: 52px; }
  .sep { margin: 0; }
  .stage { padding-bottom: 88px; }
  .stage.panel-open .panel { inset: 52px 8px 84px; }
  .home .orbit { transform: scale(.8); margin: -20px 0; }
}
@media (max-width: 560px) {
  .ctl, .ctl.leave { flex: 1 1 0; width: auto; min-width: 0; max-width: 52px; }
  .dock { overflow: hidden; }
  .pill .go.primary { flex: 1; justify-content: center; }
  .pill .go.primary span { display: inline; }
}

/* ================= v3: profile, anti-noise, chat ================= */
.av { display: inline-grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 50%; overflow: hidden; color: #fff; font-weight: 800; font-size: 13px; background: var(--violet); user-select: none; }
.av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.av.xs { width: 24px; height: 24px; font-size: 10px; }
.av.sm { width: 22px; height: 22px; font-size: 9px; }
.av.xl { width: 84px; height: 84px; font-size: 30px; }
.avatar span.av { color: #fff; }
.me-btn { position: absolute; top: 18px; right: 18px; padding: 3px; border-radius: 50%; border: 1px solid var(--glass-b); background: var(--glass); cursor: pointer; display: grid; transition: transform .15s, box-shadow .15s; }
.me-btn:hover { transform: scale(1.06); box-shadow: 0 0 0 3px rgba(109, 94, 252, .35); }
.me-btn.sm .av { width: 30px; height: 30px; font-size: 11px; }
.me-btn.sm { position: static; }
.view.home { position: relative; }
.ghost-go { background: transparent; color: var(--muted); }
.ghost-go:hover { color: var(--text); }

/* mic meter + anti-noise state */
.meter { position: absolute; left: 14px; right: 14px; bottom: 70px; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .12); overflow: hidden; }
.meter i { display: block; height: 100%; width: 100%; transform-origin: left; transform: scaleX(0); background: var(--grad); transition: transform .05s linear; }
.round.on, .ctl.on { color: var(--teal); }
.round.on { border-color: rgba(25, 211, 197, .5); background: rgba(25, 211, 197, .15); }
.ctl.on { background: rgba(25, 211, 197, .14); }

/* profile modal */
.modal { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 16px; background: rgba(4, 7, 16, .6); backdrop-filter: blur(6px); }
.sheet { width: min(400px, 100%); border-radius: 22px; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.sheet > header { display: flex; justify-content: space-between; align-items: center; }
.pf-top { display: flex; align-items: center; gap: 16px; }
.pf-actions { display: flex; gap: 8px; }
.btn.file { cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { width: 26px; height: 26px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0; }
.swatch.sel { border-color: #fff; box-shadow: 0 0 0 2px rgba(255, 255, 255, .25); }
.tests { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; color: var(--muted); }
.tests .chip { cursor: pointer; }
.tests .chip:hover { background: rgba(255, 255, 255, .12); }
.sheet .btn.primary { display: flex; justify-content: center; align-items: center; height: 46px; }

/* chat */
.chat-form { align-items: center; }
.chat-form select { max-width: 92px; background: rgba(8, 12, 28, .7); color: var(--text); border: 1px solid var(--glass-b); border-radius: 12px; padding: 10px 6px; font-size: 13px; }
.msg { display: flex; flex-direction: column; gap: 3px; }
.msg .mh { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); }
.msg .mh .who { display: inline; margin: 0; color: var(--teal); }
.msg .mh .t { margin-left: auto; opacity: .7; }
.msg.me .mh .who { color: #cfc8ff; }
.msg.dm { border: 1px dashed rgba(255, 181, 71, .55); }
.msg.dm .priv { color: var(--warn); font-weight: 700; }
.msg.sys { display: block; }

/* people list */
.people li { flex-wrap: wrap; }
.people li .who-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.people li .nm { flex: none; }
.people li .sub { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.people li .bio { flex-basis: 100%; font-size: 13px; color: var(--muted); padding-left: 46px; }
.people li.clickable { cursor: pointer; }
@media (max-width: 560px) { .me-btn:not(.sm) { top: 12px; right: 12px; } }

/* ================= v4: refined visual identity + accounts ================= */
@font-face { font-family: "Plus Jakarta Sans"; font-weight: 400; font-display: swap; src: url("../fonts/plus-jakarta-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Plus Jakarta Sans"; font-weight: 500; font-display: swap; src: url("../fonts/plus-jakarta-sans-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Plus Jakarta Sans"; font-weight: 600; font-display: swap; src: url("../fonts/plus-jakarta-sans-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Plus Jakarta Sans"; font-weight: 700; font-display: swap; src: url("../fonts/plus-jakarta-sans-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Plus Jakarta Sans"; font-weight: 800; font-display: swap; src: url("../fonts/plus-jakarta-sans-latin-800-normal.woff2") format("woff2"); }
:root { --font: "Plus Jakarta Sans", "Segoe UI", system-ui, sans-serif; --ease: cubic-bezier(.2, .8, .2, 1); --card: rgba(13, 20, 42, .66); }
::selection { background: rgba(109, 94, 252, .5); }
* { scrollbar-width: thin; scrollbar-color: rgba(160, 180, 255, .25) transparent; }

/* atmosphere: soft dot grid + film grain over the aurora */
.aurora::before { content: ""; position: absolute; inset: 0; opacity: .5; background-image: radial-gradient(rgba(190, 205, 255, .16) 1px, transparent 1.2px); background-size: 30px 30px; -webkit-mask-image: radial-gradient(ellipse 70% 55% at 50% 32%, #000, transparent 75%); mask-image: radial-gradient(ellipse 70% 55% at 50% 32%, #000, transparent 75%); }
.aurora::after { content: ""; position: absolute; inset: 0; opacity: .07; mix-blend-mode: overlay; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .6 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>"); }

/* glass v2: hairline gradient border + inner highlight */
.glass { background: var(--card); border: 0; box-shadow: 0 1px 0 rgba(255, 255, 255, .07) inset, 0 30px 70px -24px rgba(0, 0, 0, .7), 0 6px 20px -8px rgba(0, 0, 0, .4); }
.card, .auth, .panel, .sheet { position: relative; }
.glass::before { content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none; z-index: 1;
  background: linear-gradient(150deg, rgba(255, 255, 255, .3), rgba(255, 255, 255, .05) 38%, rgba(109, 94, 252, .38) 78%, rgba(25, 211, 197, .34));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0); }

/* entrance */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.view:not(.hidden) { animation: fade .5s var(--ease) both; }
.room:not(.hidden) { animation: fade .5s var(--ease) both; }
.home > * { animation: rise .8s var(--ease) both; }
.home > :nth-child(2) { animation-delay: .05s; } .home > :nth-child(3) { animation-delay: .12s; } .home > :nth-child(4) { animation-delay: .2s; }
.home > :nth-child(5) { animation-delay: .28s; } .home > :nth-child(6) { animation-delay: .36s; } .home > :nth-child(7) { animation-delay: .44s; }

/* hero */
.orbit::before { content: ""; position: absolute; width: 190px; height: 190px; border-radius: 50%; background: radial-gradient(circle, rgba(109, 94, 252, .45), rgba(25, 211, 197, .18) 55%, transparent 70%); filter: blur(22px); animation: breathe 5s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(1.18); opacity: .8; } }
.wordmark.xl b { background: linear-gradient(100deg, #6d5efc, #19d3c5, #6d5efc); background-size: 220% 100%; -webkit-background-clip: text; background-clip: text; animation: shimmer 7s linear infinite; }
@keyframes shimmer { to { background-position: 220% 0; } }
.seals { gap: 22px; } .seals .ic { filter: drop-shadow(0 0 8px rgba(25, 211, 197, .5)); }

/* shared field */
.field { display: flex; align-items: center; gap: 10px; padding: 0 16px; height: 52px; border-radius: 16px; background: rgba(6, 10, 24, .6); border: 1px solid rgba(160, 180, 255, .1); transition: border-color .2s, box-shadow .2s, background .2s; }
.field:focus-within { border-color: rgba(109, 94, 252, .8); box-shadow: 0 0 0 4px rgba(109, 94, 252, .18); background: rgba(6, 10, 24, .85); }
.field .ic { color: var(--muted); transition: color .2s; }
.field:focus-within .ic { color: var(--teal); }
.field input { flex: 1; min-width: 0; width: 100%; background: transparent !important; border: 0 !important; box-shadow: none !important; padding: 0 !important; outline: none; font-weight: 500; }
.field input::placeholder { color: rgba(141, 155, 196, .7); }
.pill .field { border-radius: 999px; height: 48px; }

/* auth card */
.auth { width: min(440px, 100%); border-radius: 28px; padding: 8px; text-align: left; }
.home:not(.authed) #form-create, .home:not(.authed) #quick-test, .home.authed .auth { display: none; }
.seg { position: relative; display: grid; grid-template-columns: 1fr 1fr; padding: 4px; border-radius: 999px; background: rgba(4, 7, 18, .6); }
.seg::before { content: ""; position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px); border-radius: 999px; background: linear-gradient(135deg, rgba(109, 94, 252, .6), rgba(25, 211, 197, .4)); box-shadow: 0 6px 22px rgba(109, 94, 252, .35), 0 1px 0 rgba(255, 255, 255, .25) inset; transition: transform .45s var(--ease); }
.auth[data-mode="register"] .seg::before { transform: translateX(100%); }
.seg button { position: relative; z-index: 1; height: 42px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font-weight: 700; font-size: 14px; cursor: pointer; transition: color .25s; }
.seg button.on { color: #fff; }
#form-auth { display: flex; flex-direction: column; gap: 10px; padding: 14px 6px 6px; }
.reg-only { overflow: hidden; max-height: 52px; transition: max-height .4s var(--ease), opacity .3s, margin .4s var(--ease); }
.auth[data-mode="login"] .reg-only { max-height: 0; opacity: 0; margin-top: -10px; visibility: hidden; border-width: 0; transition: max-height .4s var(--ease), opacity .3s, margin .4s var(--ease), visibility 0s .4s; }
.go.wide { width: 100%; justify-content: center; height: 52px; border-radius: 16px; }
#form-auth .err { text-align: center; position: static; }

/* buttons */
.go.primary, .btn.primary { background: linear-gradient(135deg, #7b6cff, #19d3c5); box-shadow: 0 1px 0 rgba(255, 255, 255, .45) inset, 0 10px 30px -6px rgba(109, 94, 252, .6); transition: transform .2s var(--ease), box-shadow .2s, filter .2s; }
.go.primary:hover, .btn.primary:hover { transform: translateY(-1px); filter: brightness(1.07); box-shadow: 0 1px 0 rgba(255, 255, 255, .5) inset, 0 16px 40px -8px rgba(109, 94, 252, .75); }
.go:disabled { opacity: .6; cursor: progress; }
.go { transition: transform .2s var(--ease), filter .2s, background .2s; }
.go:not(.primary):hover { background: rgba(255, 255, 255, .13); }

/* account row in profile */
.account { display: flex; align-items: center; gap: 8px; padding: 4px 4px 4px 12px; border-radius: 14px; background: rgba(255, 255, 255, .05); color: var(--muted); font-size: 13px; }
.account #pf-email { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account .icon:hover { color: var(--danger); }

/* room polish */
.tile { border-radius: 24px; border-color: rgba(160, 180, 255, .1); box-shadow: 0 20px 50px -20px rgba(0, 0, 0, .7); }
.tile::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 90px; background: linear-gradient(transparent, rgba(3, 6, 16, .7)); pointer-events: none; }
.tile .label { z-index: 2; background: rgba(8, 12, 30, .55); border: 1px solid rgba(255, 255, 255, .08); }
.tile .hand, .tile .conn { z-index: 2; }
.tile.speaking { border-color: transparent; box-shadow: 0 0 0 2px var(--teal), 0 0 40px rgba(25, 211, 197, .4); animation: speak 1.4s ease-in-out infinite; }
@keyframes speak { 50% { box-shadow: 0 0 0 3px var(--teal), 0 0 56px rgba(25, 211, 197, .55); } }
.tile .avatar span.av { box-shadow: 0 0 0 6px rgba(255, 255, 255, .06), 0 20px 50px rgba(0, 0, 0, .5); }
.chip { backdrop-filter: blur(10px); background: rgba(14, 22, 46, .55); }
.dock { padding: 9px 12px; gap: 8px; box-shadow: 0 1px 0 rgba(255, 255, 255, .07) inset, 0 30px 70px -10px rgba(0, 0, 0, .8); }
.ctl { transition: background .2s, transform .2s var(--ease), color .2s; }
.ctl:hover { transform: translateY(-2px); }
.ctl.on { box-shadow: 0 0 0 1px rgba(25, 211, 197, .3) inset, 0 6px 20px rgba(25, 211, 197, .18); }
.ctl.off { box-shadow: 0 0 0 1px rgba(255, 93, 115, .3) inset; }
.ctl.leave { box-shadow: 0 8px 28px rgba(255, 93, 115, .45); }
.msg { border: 1px solid rgba(255, 255, 255, .05); }
.msg.me { background: linear-gradient(135deg, rgba(109, 94, 252, .5), rgba(70, 90, 230, .35)); border-color: rgba(160, 150, 255, .3); }
.modal { animation: fade .25s var(--ease) both; }
.sheet { animation: rise .45s var(--ease) both; }
.toast { backdrop-filter: blur(14px); border-radius: 14px; }
@media (max-width: 560px) { .auth { border-radius: 24px; } }

/* fit shorter screens + roomier name field */
#form-create .field:first-of-type { flex: 1.5; }
@media (max-height: 880px) {
  .view.home { padding-top: 2vh; gap: 14px; }
  .home .orbit { transform: scale(.82); margin: -26px 0; }
  .wordmark.xl { font-size: clamp(36px, 6vw, 58px); }
}
