:root {
  --accent: #c8ff3d;
  --brand-bg: #0c0c0c;
  --bg: #0e0f12;
  --panel: #17181c;
  --panel2: #1f2026;
  --line: #2a2c33;
  --text: #f2f2f2;
  --muted: #9a9ca5;
  --danger: #ff4d4d;
  --radius: 14px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", "Heebo", Arial, sans-serif; }
body { overflow: hidden; }
#app { height: 100%; }
button { font: inherit; color: inherit; cursor: pointer; }
.muted { color: var(--muted); }
.center { display: grid; place-items: center; height: 100%; text-align: center; padding: 24px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ic { display: inline-flex; width: 20px; height: 20px; flex: none; }
.ic svg { width: 100%; height: 100%; }

/* buttons + inputs */
.btn { border: 1px solid var(--line); background: var(--panel2); border-radius: 10px; padding: 9px 16px; display: inline-flex; align-items: center; gap: 8px; justify-content: center; font-weight: 500; }
.btn:hover { border-color: #444; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.accent { background: var(--accent); color: #0c0c0c; border-color: transparent; font-weight: 600; }
.btn.big { padding: 14px 22px; font-size: 17px; width: 100%; }
.btn.small { padding: 6px 12px; font-size: 13px; }
.btn.tiny { padding: 3px 8px; font-size: 12px; border-radius: 7px; }
.btn.tiny .ic { width: 15px; height: 15px; }
.btn.ghost { background: transparent; }
.btn.danger { background: var(--danger); border-color: transparent; color: #fff; }
.btn.ghost-danger { background: transparent; border-color: #5a2a2a; color: #ff8a8a; }
.danger-text { color: #ff8a8a; }
.input { width: 100%; background: var(--panel2); border: 1px solid var(--line); color: var(--text); border-radius: 10px; padding: 11px 13px; font: inherit; }
.input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.field { display: grid; gap: 6px; text-align: start; }
.field > span { font-size: 13px; color: var(--muted); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }

/* join + messages */
.join-wrap { min-height: 100%; display: grid; place-items: center; padding: 24px; overflow: auto; height: 100%;
  background: radial-gradient(1200px 600px at 50% -10%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 60%), var(--brand-bg); }
.topbar-lite { position: fixed; top: 14px; inset-inline-end: 14px; }
.join { width: min(460px, 100%); display: grid; gap: 16px; text-align: center; }
.join h1 { margin: 0; font-size: 24px; line-height: 1.25; text-wrap: balance; }
.join p { margin: 0; text-wrap: pretty; }
.note { background: var(--panel2); border-radius: 10px; padding: 12px; color: var(--muted); }
.brand { display: flex; justify-content: center; align-items: center; }
.brand .logo { height: 44px; max-width: 200px; object-fit: contain; }
.preview { position: relative; aspect-ratio: 16/9; border-radius: 12px; overflow: hidden; background: #000; }
.preview-video { width: 100%; height: 100%; object-fit: cover; }
.preview.empty .preview-video { visibility: hidden; }
.preview.empty::before { content: ''; position: absolute; inset: 0; background: var(--panel2); }
.preview-controls { position: absolute; bottom: 10px; inset-inline: 0; display: flex; justify-content: center; gap: 10px; }
.round { width: 46px; height: 46px; border-radius: 50%; border: 0; background: rgba(255,255,255,.14); display: grid; place-items: center; backdrop-filter: blur(6px); }
.round.off { background: var(--danger); color: #fff; }
.mirror video, video.mirror { transform: scaleX(-1); }
.dots { display: flex; justify-content: center; gap: 6px; }
.dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: dot 1.2s infinite ease-in-out; }
.dots i:nth-child(2) { animation-delay: .15s; } .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%, 80%, 100% { opacity: .25; transform: scale(.8); } 40% { opacity: 1; transform: scale(1); } }

/* room layout */
.room { display: grid; grid-template-rows: auto 1fr auto; height: 100%; }
.room-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 14px; border-bottom: 1px solid var(--line); background: var(--panel); }
.room-top .logo { height: 28px; }
.room-top .title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40vw; }
.live-pill, .rec-pill { font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 99px; letter-spacing: .02em; }
.live-pill { background: color-mix(in srgb, var(--accent) 20%, transparent); color: var(--accent); }
.rec-pill { background: #3a1515; color: #ff6b6b; display: inline-flex; align-items: center; gap: 6px; }
.rec-pill i { width: 8px; height: 8px; border-radius: 50%; background: #ff4d4d; animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: .3; } }
.clock { font-variant-numeric: tabular-nums; color: var(--muted); }

.room-body { display: grid; grid-template-columns: 1fr; min-height: 0; }
.room-body.with-side { grid-template-columns: 1fr 340px; }
.stage { min-height: 0; display: grid; gap: 8px; padding: 8px; }
.stage.speaker { grid-template-rows: 1fr auto; }
.stage.gallery { grid-template-rows: 1fr; }
.stage.gallery .strip { display: none !important; }
.main-area { min-height: 0; display: grid; gap: 8px; grid-template-columns: repeat(var(--cols, 1), 1fr); grid-auto-rows: 1fr; }
.strip { display: flex; gap: 8px; overflow-x: auto; height: 132px; }
.strip .tile { flex: 0 0 216px; height: 100%; }

.tile { position: relative; background: var(--panel2); border-radius: 12px; overflow: hidden; min-height: 0; border: 2px solid transparent; transition: border-color .15s; }
.tile.speaking { border-color: var(--accent); }
.tile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #000; }
.tile.contain video { object-fit: contain; }
.tile.no-video video { visibility: hidden; }
.tile .avatar { display: none; }
.tile.no-video .avatar { position: absolute; inset: 0; margin: auto; display: grid; place-items: center; width: min(30%, 110px); aspect-ratio: 1; border-radius: 50%; background: var(--accent); color: #0c0c0c; font-weight: 700; font-size: clamp(18px, 4vw, 42px); }
.tile .label { position: absolute; bottom: 8px; inset-inline-start: 8px; background: rgba(0,0,0,.6); padding: 3px 9px; border-radius: 7px; font-size: 13px; display: flex; gap: 5px; align-items: center; max-width: calc(100% - 16px); white-space: nowrap; overflow: hidden; }
.tile .label .ic { width: 15px; height: 15px; color: #ff8a8a; }
.tile .label em { color: var(--accent); font-style: normal; }
.tile .badges { position: absolute; top: 8px; inset-inline-end: 8px; font-size: 22px; }
.strip .tile .label { font-size: 12px; bottom: 5px; inset-inline-start: 5px; }

.controls { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 14px; border-top: 1px solid var(--line); background: var(--panel); flex-wrap: wrap; }
.controls .group { display: flex; gap: 4px; align-items: center; }
.ctl { position: relative; background: transparent; border: 0; border-radius: 10px; padding: 6px 10px; display: grid; justify-items: center; gap: 2px; min-width: 64px; font-size: 11px; color: var(--muted); }
.ctl .ic { width: 22px; height: 22px; color: var(--text); }
.ctl:hover { background: var(--panel2); }
.ctl.off .ic { color: var(--danger); }
.ctl.active { background: var(--panel2); }
.ctl.active .ic { color: var(--accent); }
.ctl.recording .ic { color: #ff4d4d; }
.ctl .badge { position: absolute; top: 2px; inset-inline-end: 12px; background: var(--danger); color: #fff; border-radius: 99px; font-size: 10px; min-width: 16px; padding: 0 4px; line-height: 16px; }

.side { border-inline-start: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; min-height: 0; }
.side:empty { display: none; }
.side-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.chat-list { flex: 1; overflow-y: auto; padding: 12px 14px; display: grid; gap: 10px; align-content: start; }
.msg .who { font-size: 12px; font-weight: 600; }
.msg.host .who { color: var(--accent); }
.msg .text { white-space: pre-wrap; word-wrap: break-word; }
.chat-input { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); }
.chat-input textarea { resize: none; }
.host-tools { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 14px; border-bottom: 1px solid var(--line); align-items: center; }
.switch { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; }
.waiting { padding: 10px 14px; border-bottom: 1px solid var(--line); display: grid; gap: 8px; background: color-mix(in srgb, var(--accent) 6%, transparent); }
.people { overflow-y: auto; padding: 6px 14px; display: grid; gap: 2px; align-content: start; }
.person { display: flex; align-items: center; gap: 8px; padding: 6px 0; flex-wrap: wrap; }
.person > .ic { width: 16px; height: 16px; color: var(--muted); }
.person .acts { display: flex; gap: 4px; flex-wrap: wrap; width: 100%; padding-inline-start: 36px; }
.avatar.sm { width: 28px; height: 28px; border-radius: 50%; background: var(--panel2); display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }

.toasts { position: fixed; top: 64px; inset-inline-start: 50%; transform: translateX(-50%); display: grid; gap: 8px; z-index: 50; width: min(420px, 92vw); }
[dir=rtl] .toasts { transform: translateX(50%); }
.toast { background: #24262d; border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; box-shadow: 0 10px 30px rgba(0,0,0,.4); display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.saving { position: fixed; inset: 0; background: rgba(0,0,0,.7); display: grid; place-items: center; font-size: 20px; z-index: 60; }
.dialog { color: var(--text); width: min(420px, 92vw); display: grid; gap: 14px; }
.dialog::backdrop { background: rgba(0,0,0,.6); }
.dialog h3 { margin: 0; }

@media (max-width: 760px) {
  .room-body.with-side { grid-template-columns: 1fr; }
  .room-body.with-side .stage { display: none; }
  .ctl span { display: none; }
  .ctl { min-width: 44px; }
  .room-top .title { max-width: 30vw; }
  .strip { height: 96px; }
  .strip .tile { flex-basis: 150px; }
  .main-area { grid-template-columns: repeat(min(var(--cols, 1), 2), 1fr); }
}
