:root {
  --bg: #080808; --surface: #0d0d0d; --surface-2: #151515; --surface-3: #1e1e1e; --tile: #141414;
  --line: #1b1b1b; --line-strong: #2a2a2a; --text: #f4f4f2; --text-2: #a2a29d; --text-3: #6c6c67;
  --accent: #d6fb00; --accent-soft: rgba(214, 251, 0, .12); --danger: #ff7a45;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.45 var(--font); -webkit-font-smoothing: antialiased; overflow: hidden; }
button, input { font: inherit; color: inherit; }
[hidden] { display: none !important; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }

.brand { font-weight: 600; font-size: 15px; letter-spacing: -.01em; white-space: nowrap; }
.brand b { color: var(--accent); font-weight: 600; }
.btn { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 18px; border-radius: 99px; border: 1px solid var(--line-strong); background: var(--surface-2); font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--surface-3); }
.btn-main { background: var(--accent); color: #0a0a0a; border-color: var(--accent); }
.btn-main:hover { background: var(--accent); filter: brightness(.95); }
.btn-danger { background: var(--danger); color: #0a0a0a; border-color: var(--danger); }
.btn-danger:hover { background: var(--danger); filter: brightness(.95); }
.btn:disabled { opacity: .45; cursor: default; }
.input { height: 44px; width: 100%; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--surface-2); outline: none; }
.input:focus { border-color: var(--accent); }
.muted { color: var(--text-2); }

/* full-screen cards: before joining, waiting room, ended */
.screen { position: fixed; inset: 0; display: grid; place-items: center; padding: 16px; overflow: auto; }
.card { width: min(560px, 100%); padding: 22px; border: 1px solid var(--line-strong); border-radius: 18px; background: var(--surface); display: grid; gap: 16px; }
.card h1 { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: -.01em; }
.card p { margin: 0; }
.preview { position: relative; aspect-ratio: 16 / 9; border-radius: 14px; overflow: hidden; background: #000; }
.preview video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.preview .off { position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-3); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row .grow { flex: 1; min-width: 160px; }
.round { width: 44px; height: 44px; padding: 0; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--line-strong); background: var(--surface-2); cursor: pointer; }
.round:hover { background: var(--surface-3); }
.round.is-off { background: var(--danger); border-color: var(--danger); color: #0a0a0a; }
.round.is-on { background: var(--accent); border-color: var(--accent); color: #0a0a0a; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line-strong); border-top-color: var(--accent); animation: spin 1s linear infinite; margin: 4px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* the room */
.room { position: fixed; inset: 0; display: grid; grid-template-rows: auto 1fr auto; }
.top { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); min-width: 0; }
.top .title { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.top .spacer { flex: 1; }
.top .count { color: var(--text-2); font-size: 13px; white-space: nowrap; }
.main { display: flex; min-height: 0; }
.area { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 10px; padding: 10px; }
.stage { flex: 1; min-height: 0; border-radius: 14px; overflow: hidden; background: #000; position: relative; }
.stage iframe { width: 100%; height: 100%; border: 0; display: block; background: var(--bg); }
.stage .stage-tile { width: 100%; height: 100%; }
.grid { flex: 1; min-height: 0; display: grid; gap: 10px; grid-template-columns: repeat(var(--cols, 1), minmax(0, 1fr)); grid-auto-rows: minmax(0, 1fr); }
.area.has-stage .grid { flex: none; height: 118px; display: flex; overflow-x: auto; }
.area.has-stage .grid .tile { width: 180px; flex: none; }
.tile { position: relative; border-radius: 14px; overflow: hidden; background: var(--tile); min-height: 0; border: 2px solid transparent; transition: border-color .15s; }
.tile.speaking { border-color: var(--accent); }
.tile video { width: 100%; height: 100%; object-fit: cover; display: block; background: #000; }
.tile.screen video, .stage-tile video { object-fit: contain; }
.tile.me video { transform: scaleX(-1); }
.tile.me.screen video { transform: none; }
.tile .avatar { position: absolute; inset: 0; display: grid; place-items: center; }
.tile .avatar span { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); font-weight: 600; font-size: 22px; }
.tile .label { position: absolute; left: 8px; bottom: 8px; max-width: calc(100% - 16px); display: flex; align-items: center; gap: 6px; padding: 4px 9px; border-radius: 8px; background: rgba(12, 12, 14, .72); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); font-size: 12.5px; font-weight: 600; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.tile .label svg { width: 14px; height: 14px; color: var(--danger); }
.tile .bubble { position: absolute; left: 50%; top: 50%; z-index: 2; font-size: clamp(56px, 22%, 120px); line-height: 1; transform: translate(-50%, -50%); animation: pop 2.6s ease forwards; pointer-events: none; filter: drop-shadow(0 6px 18px rgba(0,0,0,.45)); }
@keyframes pop { 0% { transform: translate(-50%, -30%) scale(.4); opacity: 0; } 14% { transform: translate(-50%, -50%) scale(1.12); opacity: 1; } 24% { transform: translate(-50%, -50%) scale(1); } 78% { opacity: 1; } 100% { transform: translate(-50%, -90%) scale(1); opacity: 0; } }

.side { width: 340px; flex: none; border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; background: var(--surface); }
.side-head { display: flex; gap: 4px; padding: 10px; border-bottom: 1px solid var(--line); }
.tab { flex: 1; height: 34px; border: 0; border-radius: 9px; background: none; color: var(--text-2); font-weight: 600; cursor: pointer; position: relative; }
.tab.is-on { background: var(--surface-2); color: var(--text); }
.tab .dot { position: absolute; top: 6px; right: 10px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.side-body { flex: 1; min-height: 0; overflow: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.side-foot { padding: 10px; border-top: 1px solid var(--line); display: flex; gap: 8px; }
.msg { display: grid; gap: 2px; }
.msg b { font-size: 12.5px; }
.msg b small { color: var(--text-3); font-weight: 500; margin-left: 6px; }
.msg p { margin: 0; white-space: pre-wrap; word-wrap: break-word; color: var(--text); }
.person { display: flex; align-items: center; gap: 10px; min-height: 40px; }
.person .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.person .tag { font-size: 11.5px; color: var(--text-3); font-weight: 500; }
.small { height: 32px; padding: 0 12px; font-size: 13px; }
.box { border: 1px solid var(--line-strong); border-radius: 12px; padding: 12px; display: grid; gap: 10px; }
.box h3 { margin: 0; font-size: 13px; font-weight: 600; color: var(--text-2); }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 10px; cursor: pointer; }
.switch input { appearance: none; -webkit-appearance: none; width: 40px; height: 24px; border-radius: 99px; background: var(--surface-3); position: relative; cursor: pointer; flex: none; transition: background .15s; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(16px); background: #0a0a0a; }

.bar { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 12px 16px max(12px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); flex-wrap: wrap; }
.bar .sep { width: 1px; height: 28px; background: var(--line-strong); margin: 0 4px; }
.reacts { position: relative; }
.react-pop { position: absolute; bottom: calc(100% + 10px); left: 50%; transform: translateX(-50%); display: flex; gap: 4px; padding: 6px; border-radius: 14px; border: 1px solid var(--line-strong); background: var(--surface); box-shadow: 0 14px 40px rgba(0,0,0,.45); }
.react-pop button { width: 40px; height: 40px; border: 0; border-radius: 10px; background: none; font-size: 22px; cursor: pointer; }
.react-pop button:hover { background: var(--surface-2); }

.toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); z-index: 50; padding: 10px 16px; border-radius: 12px; background: #141414; border: 1px solid var(--line-strong); font-weight: 600; font-size: 13px; box-shadow: 0 10px 30px rgba(0,0,0,.5); max-width: calc(100% - 32px); text-align: center; }
.knock { position: fixed; right: 16px; top: 64px; z-index: 40; width: min(320px, calc(100% - 32px)); padding: 14px; border-radius: 14px; border: 1px solid var(--accent); background: var(--surface); box-shadow: 0 14px 40px rgba(0,0,0,.5); display: grid; gap: 10px; }

/* start page */
.start { position: fixed; inset: 0; overflow: auto; }
.start-in { width: min(720px, 100%); margin: 0 auto; padding: 28px 16px 60px; display: grid; gap: 22px; }
.start-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.calls { display: grid; gap: 8px; }
.call-row { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.call-row .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.call-row small { color: var(--text-3); font-weight: 500; display: block; }

@media (max-width: 860px) {
  .side { position: fixed; right: 0; top: 0; bottom: 0; width: min(380px, 100%); z-index: 30; box-shadow: -20px 0 60px rgba(0,0,0,.5); }
  .grid { grid-template-columns: repeat(var(--cols-m, 1), minmax(0, 1fr)); }
  .bar { gap: 8px; }
  .bar .label-txt { display: none; }
  .top .brand { display: none; }
}

.side-head { align-items: center; }
.side-x { flex: none; width: 34px; height: 34px; display: grid; place-items: center; border: 0; border-radius: 9px; background: none; color: var(--text-2); cursor: pointer; }
.side-x:hover { background: var(--surface-2); color: var(--text); }
.scrim { display: none; }
.chat-media { display: block; max-width: 100%; max-height: 260px; border-radius: 10px; margin-top: 4px; background: #000; cursor: zoom-in; }
video.chat-media { cursor: default; width: 100%; }
.side-foot .round { width: 44px; height: 44px; flex: none; }
.up-progress { padding: 8px 12px; border-top: 1px solid var(--line); color: var(--accent); font-size: 12.5px; font-weight: 600; }
.lightbox { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; background: rgba(0,0,0,.88); cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 10px; }
@media (max-width: 860px) {
  .scrim { display: block; position: fixed; inset: 0; z-index: 29; background: rgba(0,0,0,.5); }
  .scrim[hidden] { display: none; }
  .side { padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
}
