/* Huddle — video call UI. Made by Vortaxis Studio. */
:root {
  --bg: #0c0b14; --bg2: #13121f; --panel: #181727; --panel2: #201e33; --line: #2c2a44;
  --ink: #f1effa; --mute: #a6a2c0; --dim: #77738f;
  --a: #7c6cff; --b: #2fd4c4; --red: #ff5b6e; --ok: #3ddc97; --warn: #ffbf5b;
  --r: 18px; --tile-r: 16px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }
a { color: var(--b); }
svg { width: 20px; height: 20px; flex: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--b); outline-offset: 2px; }

/* ---------- buttons ---------- */
button { cursor: pointer; border: 0; background: none; }
.primary, .ghost, .btnlike { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 46px; padding: 0 20px; border-radius: 14px; font-weight: 650; text-decoration: none; transition: transform .15s, background .15s, border-color .15s; }
.primary { background: linear-gradient(100deg, var(--a), color-mix(in srgb, var(--a) 55%, var(--b))); color: #fff; box-shadow: 0 10px 30px -12px var(--a); }
.primary:hover { transform: translateY(-1px); }
.ghost, .btnlike { border: 1px solid var(--line); background: rgba(255,255,255,.03); color: var(--ink); }
.ghost:hover { border-color: color-mix(in srgb, var(--a) 60%, var(--line)); background: rgba(124,108,255,.08); }
.sm { height: 36px; padding: 0 12px; border-radius: 11px; font-size: 14px; }
.wide { width: 100%; }
.icon { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; }
.icon.primary { padding: 0; height: 42px; width: 46px; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 4px 10px; border-radius: 999px; color: #1a1300; background: var(--warn); }
.badge { font-size: 13px; color: var(--mute); border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; }

/* ---------- brand ---------- */
.logo { width: 34px; height: 34px; border-radius: 11px; background: url(icon.svg) center/cover; display: inline-block; flex: none; }
.logo.big { width: 64px; height: 64px; border-radius: 20px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 19px; letter-spacing: -.02em; color: var(--ink); text-decoration: none; }
.grad { background: linear-gradient(100deg, var(--a), var(--b)); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- lobby ---------- */
.lobby { min-height: 100%; display: flex; flex-direction: column; padding: 22px clamp(16px, 4vw, 48px) 32px; background:
  radial-gradient(ellipse 900px 600px at 0% 0%, rgba(124,108,255,.22), transparent 60%),
  radial-gradient(ellipse 800px 600px at 100% 100%, rgba(47,212,196,.14), transparent 60%), var(--bg); }
.topbar { display: flex; align-items: center; justify-content: space-between; width: 100%; max-width: 1180px; margin: 0 auto; }
.lobby-grid { width: 100%; max-width: 1180px; margin: auto; padding: clamp(20px, 5vh, 56px) 0; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: clamp(20px, 4vw, 56px); align-items: center; }
.preview-card { min-width: 0; }
.preview { position: relative; aspect-ratio: 16 / 10; border-radius: 24px; overflow: hidden; background: linear-gradient(160deg, #1d1b30, #121120); border: 1px solid var(--line); box-shadow: 0 40px 80px -40px rgba(0,0,0,.9); }
.preview video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); display: block; }
.preview .avatar { position: absolute; inset: 0; margin: auto; }
.preview-note { position: absolute; left: 16px; right: 16px; top: 16px; background: rgba(12,11,20,.82); border: 1px solid var(--line); backdrop-filter: blur(8px); border-radius: 14px; padding: 10px 14px; font-size: 14px; color: var(--mute); display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.preview-note b { color: var(--ink); }
.preview-bar { position: absolute; left: 0; right: 0; bottom: 18px; display: flex; justify-content: center; gap: 12px; }
.round { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: rgba(20,19,32,.72); border: 1px solid rgba(255,255,255,.14); backdrop-filter: blur(8px); transition: background .15s; }
.round:hover { background: rgba(40,38,60,.85); }
.round[aria-pressed="false"] { background: var(--red); border-color: transparent; }
.meter { position: absolute; left: 18px; bottom: 30px; width: 6px; height: 56px; border-radius: 4px; background: rgba(255,255,255,.12); overflow: hidden; }
.meter i { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: linear-gradient(0deg, var(--ok), var(--b)); transition: height .08s; }
.devices { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-top: 16px; }
label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--mute); }
select, input { width: 100%; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg2); padding: 0 12px; color: var(--ink); font-weight: 500; font-size: 15px; min-width: 0; }
select:focus, input:focus { border-color: var(--a); outline: none; box-shadow: 0 0 0 3px rgba(124,108,255,.25); }
.join-card h1 { font-size: clamp(34px, 4.6vw, 54px); line-height: 1.02; letter-spacing: -.04em; margin: 0 0 12px; }
.sub { color: var(--mute); font-size: 17px; margin: 0 0 26px; max-width: 460px; }
#joinForm { display: grid; gap: 16px; }
.field { font-size: 14px; }
.room-row { display: flex; gap: 8px; }
.room-row .ghost { height: 44px; }
.hint { font-weight: 400; color: var(--dim); font-size: 12.5px; }
.err { margin: 0; color: #ffb3bd; background: rgba(255,91,110,.1); border: 1px solid rgba(255,91,110,.35); padding: 10px 12px; border-radius: 12px; font-size: 14px; }
.demo-choices { display: grid; gap: 10px; }
.demo-head { font-size: 14px; color: var(--mute); display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.choice { display: flex; align-items: center; gap: 14px; text-align: left; padding: 16px 18px; border-radius: 16px; border: 1px solid var(--line); background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.01)); transition: border-color .15s, transform .15s; }
.choice:hover { border-color: var(--a); transform: translateY(-1px); }
.choice > svg { width: 42px; height: 42px; padding: 10px; border-radius: 12px; background: linear-gradient(100deg, var(--a), var(--b)); color: #0c0b14; }
.choice b { display: block; font-size: 16px; }
.choice small { display: block; color: var(--mute); font-size: 13.5px; }
.foot { margin: 26px 0 0; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; color: var(--dim); font-size: 13px; }
.state { display: inline-flex; align-items: center; gap: 6px; }
.state svg { width: 16px; height: 16px; }
.state.on { color: var(--ok); }

/* ---------- avatar ---------- */
.avatar { width: 96px; height: 96px; border-radius: 50%; display: grid; place-items: center; font-weight: 750; font-size: 34px; color: #fff; background: linear-gradient(135deg, var(--c1, #7c6cff), var(--c2, #2fd4c4)); box-shadow: 0 0 0 6px rgba(255,255,255,.04); letter-spacing: -.02em; user-select: none; }
.avatar.big { width: 132px; height: 132px; font-size: 48px; }
.avatar.sm { width: 34px; height: 34px; font-size: 13px; box-shadow: none; }

/* ---------- room ---------- */
.room { position: fixed; inset: 0; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; grid-template-columns: minmax(0, 1fr); background: var(--bg); }
.room-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px clamp(12px, 2vw, 22px); padding-top: max(12px, env(safe-area-inset-top)); }
.rt-left, .rt-right { display: flex; align-items: center; gap: 12px; min-width: 0; }
.rt-title { display: grid; line-height: 1.25; min-width: 0; }
.rt-title b { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rt-title small { color: var(--mute); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.room-body { position: relative; display: flex; min-height: 0; min-width: 0; gap: 12px; padding: 0 clamp(8px, 1.5vw, 22px); }
.stage { flex: 1 1 0; min-width: 0; min-height: 0; overflow: hidden; display: grid; gap: 10px; place-content: center; grid-template-columns: repeat(var(--cols, 1), var(--tw, 1fr)); grid-auto-rows: var(--th, auto); }
.stage.spot { grid-template-columns: 1fr; grid-template-rows: 1fr auto; place-content: stretch; }

.tile { position: relative; border-radius: var(--tile-r); overflow: hidden; background: radial-gradient(ellipse at 50% 40%, #24223a, #15141f); border: 1px solid rgba(255,255,255,.06); min-width: 0; min-height: 0; transition: box-shadow .2s; }
.tile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #0b0a12; }
.tile.me video { transform: scaleX(-1); }
.tile.me.screen video, .tile.screen video { transform: none; object-fit: contain; }
.tile .avatar { position: absolute; inset: 0; margin: auto; z-index: 1; }
.tile.novideo video { visibility: hidden; }
.tile:not(.novideo) .avatar { display: none; }
.tile.speaking { box-shadow: 0 0 0 3px var(--ok), 0 0 30px -6px var(--ok); }
.tile.speaking.novideo .avatar { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 14px rgba(61,220,151,.16); } }
.tag { position: absolute; left: 10px; bottom: 10px; z-index: 2; display: inline-flex; align-items: center; gap: 6px; max-width: calc(100% - 20px); padding: 5px 10px; border-radius: 10px; background: rgba(10,9,16,.66); backdrop-filter: blur(6px); font-size: 13px; font-weight: 600; }
.tag span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tag svg { width: 15px; height: 15px; color: var(--red); }
.tile .flag { position: absolute; right: 10px; top: 10px; z-index: 2; font-size: 11.5px; font-weight: 700; padding: 3px 8px; border-radius: 8px; background: rgba(10,9,16,.66); color: var(--mute); }
.tile .flag.sim { color: #1a1300; background: var(--warn); }
.tile .pinbtn { position: absolute; right: 10px; bottom: 10px; z-index: 3; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: rgba(10,9,16,.66); opacity: 0; transition: opacity .15s; }
.tile:hover .pinbtn, .tile .pinbtn:focus-visible, .tile.pinned .pinbtn { opacity: 1; }
.tile .pinbtn svg { width: 16px; height: 16px; }
.tile .conn { position: absolute; inset: 0; z-index: 2; display: grid; place-items: center; background: rgba(12,11,20,.5); font-size: 13px; color: var(--mute); }
.strip { display: flex; gap: 10px; overflow-x: auto; height: 130px; }
.strip .tile { flex: 0 0 auto; width: 210px; height: 100%; }
.strip .tile .avatar { width: 56px; height: 56px; font-size: 20px; }
.spot > .tile { min-height: 0; }

/* ---------- side panel ---------- */
.side { width: 340px; flex: none; display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); min-height: 0; overflow: hidden; }
.side-tabs { display: flex; align-items: center; gap: 4px; padding: 8px; border-bottom: 1px solid var(--line); }
.side-tabs [role=tab] { flex: 1; height: 38px; border-radius: 10px; font-weight: 650; color: var(--mute); font-size: 14px; }
.side-tabs [role=tab][aria-selected=true] { background: var(--panel2); color: var(--ink); }
.side-tabs [role=tab] span { font-size: 12px; color: var(--dim); }
.pane { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.msgs { list-style: none; margin: 0; padding: 14px; flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.msg { display: grid; gap: 2px; max-width: 88%; }
.msg .who { font-size: 12px; color: var(--mute); font-weight: 600; }
.msg .who time { color: var(--dim); font-weight: 400; margin-left: 4px; }
.msg p { margin: 0; padding: 9px 13px; border-radius: 14px 14px 14px 4px; background: var(--panel2); word-wrap: break-word; overflow-wrap: anywhere; }
.msg.mine { align-self: flex-end; text-align: right; }
.msg.mine p { background: linear-gradient(100deg, var(--a), color-mix(in srgb, var(--a) 60%, var(--b))); color: #fff; border-radius: 14px 14px 4px 14px; text-align: left; }
.msg.sys { align-self: center; max-width: 100%; text-align: center; font-size: 12.5px; color: var(--dim); }
.chat-form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); }
.chat-form input { height: 42px; }
.people { list-style: none; margin: 0; padding: 10px; overflow-y: auto; }
.people li { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 12px; }
.people li:hover { background: var(--panel2); }
.people .pn { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.people .pn small { color: var(--dim); font-weight: 500; }
.people svg { width: 17px; height: 17px; color: var(--mute); }
.people svg.off { color: var(--red); }

/* ---------- controls ---------- */
.controls { display: flex; justify-content: center; gap: 8px; padding: 12px; padding-bottom: max(12px, env(safe-area-inset-bottom)); flex-wrap: nowrap; }
.ctl { position: relative; display: grid; justify-items: center; gap: 4px; min-width: 76px; padding: 9px 10px 7px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); color: var(--ink); font-size: 12px; font-weight: 600; transition: background .15s, border-color .15s; }
.ctl svg { width: 22px; height: 22px; }
.ctl:hover { background: var(--panel2); }
#cMic[aria-pressed=false], #cCam[aria-pressed=false] { background: var(--red); border-color: transparent; color: #fff; }
#cScreen[aria-pressed=true], #cChat[aria-pressed=true], #cPeople[aria-pressed=true] { border-color: var(--a); background: rgba(124,108,255,.16); }
.ctl.leave { background: var(--red); border-color: transparent; color: #fff; min-width: 84px; }
.ctl.leave:hover { background: #ff4058; }
.dot { position: absolute; top: 4px; right: 12px; min-width: 18px; height: 18px; border-radius: 9px; background: var(--b); color: #06201d; font: 700 11px/18px var(--font); padding: 0 5px; }

/* ---------- dialog, toasts, left ---------- */
.dlg { border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 20px; padding: 24px; width: min(440px, calc(100vw - 32px)); }
.dlg::backdrop { background: rgba(5,4,10,.6); backdrop-filter: blur(3px); }
.dlg h2 { margin: 0 0 16px; font-size: 20px; }
.dlg form { display: grid; gap: 14px; }
.dlg-row { display: flex; justify-content: flex-end; }
.toasts { position: fixed; left: 50%; top: 18px; transform: translateX(-50%); display: grid; gap: 8px; z-index: 50; pointer-events: none; width: max-content; max-width: calc(100vw - 24px); }
.toast { padding: 10px 16px; border-radius: 12px; background: rgba(32,30,51,.95); border: 1px solid var(--line); font-size: 14px; box-shadow: 0 20px 40px -20px #000; animation: tin .25s ease-out; }
@keyframes tin { from { opacity: 0; transform: translateY(-8px); } }
.left-screen { min-height: 100%; display: grid; place-items: center; padding: 24px; background: radial-gradient(ellipse 700px 500px at 50% 0%, rgba(124,108,255,.2), transparent 70%), var(--bg); }
.left-card { text-align: center; display: grid; justify-items: center; gap: 6px; }
.left-card h1 { margin: 14px 0 0; font-size: 32px; letter-spacing: -.03em; }
.left-card p { color: var(--mute); margin: 0 0 18px; }
.left-card .row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .lobby-grid { grid-template-columns: 1fr; margin: 0 auto; padding-top: 18px; }
  .join-card h1 { font-size: 36px; }
  .side { position: absolute; inset: 0 8px; width: auto; z-index: 10; box-shadow: 0 30px 60px -20px #000; }
}
@media (max-width: 600px) {
  .lobby { padding: 14px 14px 24px; }
  .preview { aspect-ratio: 4 / 3.4; border-radius: 20px; }
  .devices { grid-template-columns: 1fr 1fr; }
  .devices label:nth-child(3) { grid-column: 1 / -1; }
  .ctl { min-width: 0; flex: 1; padding: 9px 2px 7px; font-size: 10.5px; }
  .ctl span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .ctl.leave { min-width: 0; }
  .hide-xs { display: none; }
  .controls { gap: 6px; padding-left: 8px; padding-right: 8px; }
  .rt-right .sm span { display: none; }
  .rt-right .sm { width: 40px; padding: 0; }
  .room-top .pill { font-size: 10.5px; padding: 3px 8px; }
  .strip { height: 96px; }
  .strip .tile { width: 130px; }
  .tile .avatar { width: 72px; height: 72px; font-size: 26px; }
  .foot { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
