/* ===========================================================
   Wivo by tarmacq. Sober, flat, professional UI.
   No gradients. Light + dark mode. Intel Bold display font.
   =========================================================== */

@font-face {
  font-family: "Intel";
  src: url("../fonts/intelbold.ttf") format("truetype");
  font-weight: 400 900;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Display font (brand, headings, UI labels) = the bundled Intel Bold.
     Body/long text uses a neutral system stack for readability. */
  --font-display: "Intel", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-ui: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;

  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-full: 999px;

  --maxw: 1120px;
  --speed: .15s;
}

/* ---------- Light theme (default) ---------- */
:root, [data-theme="light"] {
  --bg: #ffffff;
  --bg-subtle: #f7f7f8;
  --bg-inset: #f0f0f1;
  --panel: #ffffff;
  --panel-2: #fafafa;
  --border: #e6e6e8;
  --border-strong: #d4d4d6;
  --text: #08090a;
  --text-2: #5c5f66;
  --text-3: #8b8e95;
  --primary: #08090a;        /* near-black action (Vercel-style) */
  --primary-text: #ffffff;
  --primary-hover: #2a2b2d;
  --accent: #2b50ed;         /* brand blue, used sparingly */
  --accent-soft: #eef1fe;
  --danger: #d6313b;
  --danger-soft: #fdeced;
  --success: #1a7f4b;
  --warn: #b7791f;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 16px rgba(0,0,0,.08);
  --shadow-lg: 0 12px 40px rgba(0,0,0,.12);
  --stage-bg: #f0f0f1;
  --tile-bg: #e7e7e9;
}

/* ---------- Dark theme ---------- */
[data-theme="dark"] {
  --bg: #0a0a0b;
  --bg-subtle: #111113;
  --bg-inset: #18181b;
  --panel: #131316;
  --panel-2: #18181b;
  --border: #262629;
  --border-strong: #34343a;
  --text: #ededee;
  --text-2: #a0a0a8;
  --text-3: #6e6e76;
  --primary: #ededee;        /* white action in dark */
  --primary-text: #08090a;
  --primary-hover: #cfcfd2;
  --accent: #5b7bff;
  --accent-soft: #1a2142;
  --danger: #f2545b;
  --danger-soft: #2a1416;
  --success: #3ecf8e;
  --warn: #e0a548;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow-md: 0 4px 16px rgba(0,0,0,.5);
  --shadow-lg: 0 12px 40px rgba(0,0,0,.6);
  --stage-bg: #050506;
  --tile-bg: #1a1a1d;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-size: 15px;
  line-height: 1.5;
}
h1, h2, h3, h4, .display { font-family: var(--font-display); font-weight: 700; letter-spacing: -.01em; }
.hidden { display: none !important; }
a { color: inherit; }
button { font-family: inherit; cursor: pointer; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: var(--accent); color: #fff; }

/* icon sizing */
.ic { width: 20px; height: 20px; display: inline-block; vertical-align: middle; flex: none; }
.ic.sm { width: 16px; height: 16px; }
.ic.lg { width: 24px; height: 24px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  border: 1px solid var(--border-strong); background: var(--panel); color: var(--text);
  padding: 9px 15px; border-radius: var(--r-md); font-size: 14px; font-weight: 500;
  transition: background var(--speed), border-color var(--speed), opacity var(--speed);
  white-space: nowrap; text-decoration: none; line-height: 1;
}
.btn:hover { background: var(--bg-inset); }
.btn:active { transform: translateY(.5px); }
.btn.primary { background: var(--primary); color: var(--primary-text); border-color: var(--primary); }
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.accent { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.accent:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--bg-inset); }
.btn.danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn.big { padding: 12px 20px; font-size: 15px; }
.btn.block { width: 100%; }
.btn.sm { padding: 7px 11px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.icon-btn {
  display: inline-grid; place-items: center; width: 38px; height: 38px;
  border-radius: var(--r-md); border: 1px solid transparent; background: transparent; color: var(--text-2);
  transition: background var(--speed), color var(--speed);
}
.icon-btn:hover { background: var(--bg-inset); color: var(--text); }

/* ---------- Inputs ---------- */
.input, .select {
  width: 100%; background: var(--panel); border: 1px solid var(--border-strong); color: var(--text);
  padding: 10px 12px; border-radius: var(--r-md); font-size: 14px; outline: none;
  transition: border-color var(--speed), box-shadow var(--speed); font-family: var(--font-ui);
}
.input::placeholder { color: var(--text-3); }
.input:focus, .select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input.shake { animation: shake .35s; border-color: var(--danger); }
@keyframes shake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-5px)} 75%{transform:translateX(5px)} }
.field-label { font-size: 13px; color: var(--text-2); font-weight: 500; margin-bottom: 6px; display: block; }

/* ---------- Brand ---------- */
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.brand img, .brand svg.logo { width: 30px; height: 30px; border-radius: 8px; display: block; }
.brand .name { font-family: var(--font-display); font-weight: 700; font-size: 19px; letter-spacing: -.02em; }
.brand .name .by { font-family: var(--font-ui); font-weight: 400; font-size: 12px; color: var(--text-3); margin-left: 6px; letter-spacing: 0; }

.badge-pill {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500;
  padding: 4px 10px; border-radius: var(--r-full); border: 1px solid var(--border); background: var(--bg-subtle); color: var(--text-2);
}

/* ===========================================================
   HOME
   =========================================================== */
.nav {
  display: flex; align-items: center; justify-content: space-between;
  max-width: var(--maxw); margin: 0 auto; padding: 18px 24px;
}
.nav-right { display: flex; align-items: center; gap: 8px; }
.user-chip { display: flex; align-items: center; gap: 9px; font-size: 14px; font-weight: 500; padding: 4px 8px 4px 4px; border: 1px solid var(--border); border-radius: var(--r-full); }
.avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; background: var(--bg-inset); display: grid; place-items: center; font-size: 12px; font-weight: 600; color: #fff; }

.hero { max-width: var(--maxw); margin: 0 auto; padding: 56px 24px 32px; }
.hero-badge { margin-bottom: 22px; }
.hero h1 {
  font-size: clamp(34px, 6vw, 58px); line-height: 1.04; letter-spacing: -.03em; margin: 0 0 18px; max-width: 16ch;
}
.hero .lead { font-size: 18px; color: var(--text-2); max-width: 52ch; margin: 0 0 30px; line-height: 1.55; }

.start-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 20px; box-shadow: var(--shadow-sm); max-width: 560px;
}
.start-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.start-actions .btn { flex: 1; min-width: 150px; }
.join-row { display: flex; gap: 8px; }
.join-row .input { flex: 1; }
.start-hint { font-size: 13px; color: var(--text-3); margin: 14px 0 0; }

/* feature strip */
.features { max-width: var(--maxw); margin: 40px auto 0; padding: 0 24px 64px; }
.features h2 { font-size: 14px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); margin: 0 0 18px; font-family: var(--font-ui); font-weight: 600; }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.feature-card { border: 1px solid var(--border); border-radius: var(--r-md); padding: 16px; background: var(--panel); }
.feature-card .ic { color: var(--accent); margin-bottom: 10px; }
.feature-card h3 { font-size: 15px; margin: 0 0 4px; }
.feature-card p { font-size: 13px; color: var(--text-2); margin: 0; line-height: 1.5; }

.footer { border-top: 1px solid var(--border); }
.footer-in { max-width: var(--maxw); margin: 0 auto; padding: 24px; display: flex; justify-content: space-between; align-items: center; color: var(--text-3); font-size: 13px; flex-wrap: wrap; gap: 10px; }

/* ===========================================================
   LOBBY
   =========================================================== */
.lobby { min-height: 100vh; display: grid; grid-template-columns: 1.1fr .9fr; }
.lobby-left { display: grid; place-items: center; padding: 32px; background: var(--bg-subtle); }
.lobby-right { display: grid; place-items: center; padding: 32px; }
.lobby-preview-wrap { width: 100%; max-width: 560px; }
.lobby-brand { margin-bottom: 20px; }
.preview {
  position: relative; aspect-ratio: 16/9; background: var(--tile-bg); border: 1px solid var(--border);
  border-radius: var(--r-lg); overflow: hidden;
}
.preview video { width: 100%; height: 100%; object-fit: cover; }
.preview.mirror video { transform: scaleX(-1); }
.preview-avatar { position: absolute; inset: 0; display: grid; place-items: center; }
.preview-avatar .av-circle { width: 96px; height: 96px; border-radius: 50%; display: grid; place-items: center; font-size: 36px; font-weight: 700; color: #fff; font-family: var(--font-display); }
.preview-off-label { position: absolute; bottom: 14px; left: 0; right: 0; text-align: center; color: var(--text-2); font-size: 13px; }
.preview-bar { position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); display: flex; gap: 10px; }
.level-meter { position: absolute; top: 12px; left: 12px; display: flex; gap: 2px; align-items: flex-end; height: 18px; }
.level-meter span { width: 3px; background: var(--text-3); border-radius: 2px; height: 4px; transition: height .08s, background .08s; }

.round-btn {
  width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--border-strong); background: var(--panel);
  color: var(--text); display: grid; place-items: center; box-shadow: var(--shadow-sm); transition: var(--speed);
}
.round-btn:hover { background: var(--bg-inset); }
.round-btn.off { background: var(--danger); border-color: var(--danger); color: #fff; }

.lobby-form { width: 100%; max-width: 380px; }
.lobby-form h2 { font-size: 24px; margin: 0 0 4px; }
.lobby-form .sub { color: var(--text-2); font-size: 14px; margin: 0 0 22px; }
.lobby-form .field { margin-bottom: 14px; }
.lobby-status { font-size: 13px; color: var(--text-2); min-height: 18px; margin-top: 10px; }
.lobby-meta { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--border); font-size: 13px; color: var(--text-3); display: flex; gap: 16px; flex-wrap: wrap; }
.lobby-meta b { color: var(--text-2); font-weight: 600; }

/* ===========================================================
   CALL
   =========================================================== */
.call { height: 100vh; display: flex; flex-direction: column; background: var(--stage-bg); overflow: hidden; }
.call-top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; background: var(--bg); border-bottom: 1px solid var(--border); flex: none;
}
.call-top .left, .call-top .right { display: flex; align-items: center; gap: 10px; }
.meeting-name { font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.meeting-meta { font-size: 12px; color: var(--text-3); display: flex; gap: 10px; align-items: center; }
.rec-dot { color: var(--danger); display: inline-flex; align-items: center; gap: 5px; font-weight: 600; }
.rec-dot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); animation: pulse 1.4s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.3} }

.call-body { flex: 1; display: flex; min-height: 0; }
.stage-wrap { flex: 1; min-width: 0; position: relative; display: flex; flex-direction: column; }

.stage {
  flex: 1; display: grid; gap: 10px; padding: 14px; align-content: center; justify-content: center;
  grid-template-columns: repeat(var(--cols, 1), minmax(0, 1fr)); overflow: auto;
}
.stage[data-layout="speaker"] { grid-template-columns: 1fr; grid-template-rows: 1fr; padding-bottom: 14px; }
.stage[data-layout="speaker"] .filmstrip { display: flex; }

/* tile */
.tile {
  position: relative; background: var(--tile-bg); border: 1px solid var(--border); border-radius: var(--r-lg);
  overflow: hidden; aspect-ratio: 16/9; min-height: 120px; transition: box-shadow var(--speed);
}
.tile video { width: 100%; height: 100%; object-fit: cover; display: none; background: #000; }
.tile.has-video video { display: block; }
.tile.mirror video { transform: scaleX(-1); }
.tile.speaking { box-shadow: inset 0 0 0 2px var(--accent); border-color: var(--accent); }
.tile.pinned { box-shadow: inset 0 0 0 2px var(--warn); }
.tile-avatar { position: absolute; inset: 0; display: grid; place-items: center; }
.tile-avatar .av-circle { width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center; font-size: 28px; font-weight: 700; color: #fff; font-family: var(--font-display); background-size: cover; background-position: center; }
.tile.has-video .tile-avatar { display: none; }
.tile-foot {
  position: absolute; left: 8px; bottom: 8px; right: 8px; display: flex; align-items: center; gap: 6px;
  pointer-events: none;
}
.tile-name {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
  background: rgba(0,0,0,.55); color: #fff; padding: 4px 9px; border-radius: var(--r-sm);
  font-size: 12.5px; font-weight: 500; backdrop-filter: blur(6px);
}
.tile-name .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-name .ic { width: 14px; height: 14px; }
.tile-badges { position: absolute; top: 8px; right: 8px; display: flex; gap: 6px; }
.tile-chip { background: rgba(0,0,0,.55); color: #fff; border-radius: var(--r-sm); padding: 4px; display: grid; place-items: center; backdrop-filter: blur(6px); }
.tile-chip.warn { background: var(--warn); }
.tile-chip.hand { background: var(--accent); }
.tile-hover { position: absolute; top: 8px; left: 8px; display: flex; gap: 6px; opacity: 0; transition: opacity var(--speed); }
.tile:hover .tile-hover { opacity: 1; }
.tile-hover button { width: 30px; height: 30px; border-radius: var(--r-sm); border: none; background: rgba(0,0,0,.55); color: #fff; display: grid; place-items: center; backdrop-filter: blur(6px); }
.tile-hover button:hover { background: rgba(0,0,0,.8); }
.tile.screen { background: #000; }
.tile.screen video { object-fit: contain; }

/* connection quality dots */
.qual { display: inline-flex; gap: 1.5px; align-items: flex-end; height: 12px; }
.qual i { width: 3px; background: currentColor; border-radius: 1px; opacity: .35; }
.qual i:nth-child(1){height:4px} .qual i:nth-child(2){height:8px} .qual i:nth-child(3){height:12px}
.qual.q1 i:nth-child(1){opacity:1} .qual.q2 i:nth-child(-n+2){opacity:1} .qual.q3 i{opacity:1}
.qual.q1 { color: var(--danger); } .qual.q2 { color: var(--warn); } .qual.q3 { color: var(--success); }

/* filmstrip in speaker view */
.filmstrip { display: none; gap: 8px; padding: 8px 14px; overflow-x: auto; background: var(--bg); border-top: 1px solid var(--border); flex: none; }
.filmstrip .tile { aspect-ratio: 16/9; width: 180px; min-height: 0; flex: none; }

/* floating reactions */
.reactions-layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 6; }
.float-react { position: absolute; bottom: 0; font-size: 38px; animation: floatUp 3.2s ease-out forwards; }
@keyframes floatUp { 0%{ transform: translateY(0) scale(.6); opacity: 0 } 12%{opacity:1; transform: translateY(-30px) scale(1)} 100%{ transform: translateY(-72vh) scale(1.1); opacity: 0 } }

/* captions overlay */
.captions { position: absolute; left: 50%; transform: translateX(-50%); bottom: 18px; max-width: 80%; z-index: 7;
  background: rgba(0,0,0,.78); color: #fff; padding: 10px 16px; border-radius: var(--r-md); font-size: 16px; text-align: center; line-height: 1.4; }
.captions b { color: var(--accent); font-weight: 600; margin-right: 6px; }

/* ---------- Control bar ---------- */
.controls {
  display: flex; align-items: center; justify-content: center; gap: 8px; position: relative;
  padding: 12px 16px; background: var(--bg); border-top: 1px solid var(--border); flex: none;
}
.controls .left, .controls .right { position: absolute; display: flex; gap: 8px; align-items: center; }
.controls .left { left: 16px; } .controls .right { right: 16px; }
.ctrl {
  position: relative; display: grid; place-items: center; gap: 0;
  min-width: 48px; height: 48px; padding: 0 12px; border-radius: var(--r-md);
  border: 1px solid var(--border-strong); background: var(--panel); color: var(--text); transition: var(--speed);
}
.ctrl:hover { background: var(--bg-inset); }
.ctrl.off { background: var(--danger); border-color: var(--danger); color: #fff; }
.ctrl.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.ctrl.leave { background: var(--danger); border-color: var(--danger); color: #fff; min-width: 56px; }
.ctrl .split { display: flex; flex-direction: column; align-items: center; line-height: 1; }
.ctrl .lbl { font-size: 10px; margin-top: 3px; font-weight: 500; }
.ctrl .ic { width: 22px; height: 22px; }
.ctrl .caret { position: absolute; top: 2px; right: 3px; width: 12px; height: 12px; opacity: .5; }
.ctrl .dot-badge { position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--r-full); background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--bg); }

/* control popover menu */
.menu {
  position: absolute; bottom: 60px; min-width: 220px; background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--r-md); box-shadow: var(--shadow-lg); padding: 6px; z-index: 30;
}
.menu-title { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); padding: 8px 10px 4px; font-weight: 600; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: none; border: none; padding: 9px 10px; border-radius: var(--r-sm); font-size: 13.5px; color: var(--text); }
.menu-item:hover { background: var(--bg-inset); }
.menu-item .ic { color: var(--text-2); }
.menu-item.active { color: var(--accent); }
.menu-item.active .ic { color: var(--accent); }
.menu-sep { height: 1px; background: var(--border); margin: 5px 0; }
.menu-item.danger { color: var(--danger); }

/* reaction picker */
.react-pick { display: flex; gap: 4px; padding: 6px; }
.react-pick button { font-size: 24px; background: none; border: none; padding: 6px; border-radius: var(--r-sm); }
.react-pick button:hover { background: var(--bg-inset); transform: scale(1.15); }

/* ---------- Side panel ---------- */
.side { width: 340px; max-width: 86vw; flex: none; background: var(--bg); border-left: 1px solid var(--border); display: flex; flex-direction: column; }
.side.hidden { display: none; }
.side-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.side-head h3 { font-size: 15px; margin: 0; }
.side-tabs { display: flex; gap: 4px; padding: 8px 10px 0; border-bottom: 1px solid var(--border); }
.side-tab { background: none; border: none; padding: 8px 12px; font-size: 13px; font-weight: 500; color: var(--text-2); border-bottom: 2px solid transparent; }
.side-tab.active { color: var(--text); border-bottom-color: var(--primary); }
.side-content { flex: 1; overflow: auto; }

/* people list */
.people-search { padding: 10px 12px; border-bottom: 1px solid var(--border); }
.people-section { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); padding: 12px 14px 4px; font-weight: 600; }
.person { display: flex; align-items: center; gap: 10px; padding: 8px 12px; }
.person:hover { background: var(--bg-subtle); }
.person .avatar { width: 34px; height: 34px; }
.person .pn { flex: 1; min-width: 0; }
.person .pn .nm { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person .pn .role { font-size: 12px; color: var(--text-3); }
.person .pstatus { display: flex; gap: 6px; color: var(--text-3); align-items: center; }
.person .pstatus .ic { width: 16px; height: 16px; }
.person .pstatus .danger { color: var(--danger); }
.person-actions { display: flex; gap: 2px; opacity: 0; transition: var(--speed); }
.person:hover .person-actions { opacity: 1; }

/* chat */
.chat { display: flex; flex-direction: column; height: 100%; }
.chat-log { flex: 1; overflow: auto; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.chat-empty { color: var(--text-3); font-size: 13px; text-align: center; margin: auto; }
.msg { max-width: 92%; }
.msg.mine { align-self: flex-end; }
.msg .who { font-size: 12px; color: var(--text-3); margin-bottom: 3px; }
.msg.mine .who { text-align: right; }
.msg .bubble { background: var(--bg-inset); padding: 8px 12px; border-radius: var(--r-md); font-size: 14px; word-break: break-word; line-height: 1.45; }
.msg.mine .bubble { background: var(--accent); color: #fff; }
.msg .bubble a { text-decoration: underline; }
.msg.system { align-self: center; max-width: 100%; }
.msg.system .bubble { background: transparent; color: var(--text-3); font-size: 12.5px; padding: 2px; }
.chat-compose { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--border); align-items: flex-end; }
.chat-compose .input { flex: 1; resize: none; max-height: 120px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 86px; left: 50%; transform: translateX(-50%) translateY(12px);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: var(--r-md); font-size: 14px;
  box-shadow: var(--shadow-lg); z-index: 100; opacity: 0; pointer-events: none; transition: opacity var(--speed), transform var(--speed); font-weight: 500;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Modal ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: grid; place-items: center; z-index: 200; padding: 20px; }
.modal { background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); width: 100%; max-width: 460px; max-height: 88vh; display: flex; flex-direction: column; overflow: hidden; }
.modal.wide { max-width: 720px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; font-size: 17px; }
.modal-body { padding: 18px; overflow: auto; }
.modal-foot { padding: 14px 18px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }
.qr-box { display: grid; place-items: center; padding: 14px; background: #fff; border-radius: var(--r-md); }
.qr-loading { color: #444; font-size: 12px; word-break: break-all; }

/* settings rows */
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.set-row:last-child { border-bottom: none; }
.set-row .lbl { font-size: 14px; font-weight: 500; }
.set-row .desc { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }
.shortcut-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 24px; }
.shortcut-list .row { display: flex; justify-content: space-between; align-items: center; padding: 5px 0; font-size: 13.5px; }
kbd { font-family: var(--font-ui); background: var(--bg-inset); border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: var(--r-sm); padding: 2px 7px; font-size: 12px; font-weight: 600; }

/* toggle switch */
.switch { position: relative; width: 42px; height: 24px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track { position: absolute; inset: 0; background: var(--border-strong); border-radius: var(--r-full); transition: var(--speed); }
.switch .track::before { content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: var(--speed); box-shadow: var(--shadow-sm); }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::before { transform: translateX(18px); }

/* segmented control */
.seg { display: inline-flex; background: var(--bg-inset); border-radius: var(--r-md); padding: 3px; }
.seg button { border: none; background: none; padding: 6px 12px; font-size: 13px; font-weight: 500; color: var(--text-2); border-radius: var(--r-sm); }
.seg button.active { background: var(--panel); color: var(--text); box-shadow: var(--shadow-sm); }

/* whiteboard */
.wb-wrap { position: absolute; inset: 0; background: var(--bg); z-index: 8; display: flex; flex-direction: column; }
.wb-bar { display: flex; gap: 8px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--border); }
.wb-bar .color { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--border); cursor: pointer; }
.wb-bar .color.active { border-color: var(--text); }
#whiteboard { flex: 1; width: 100%; touch-action: none; cursor: crosshair; background: #fff; }

/* connection banner */
.conn-banner { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 40; background: var(--warn); color: #fff; padding: 8px 16px; border-radius: var(--r-full); font-size: 13px; font-weight: 500; box-shadow: var(--shadow-md); }

/* ---------- Responsive ---------- */
@media (max-width: 880px) {
  .lobby { grid-template-columns: 1fr; }
  .lobby-left { padding: 20px; }
  .side { position: absolute; top: 0; right: 0; bottom: 0; z-index: 50; box-shadow: var(--shadow-lg); }
  .controls .left { display: none; }
  .ctrl .lbl { display: none; }
  .ctrl { min-width: 44px; height: 44px; padding: 0 8px; }
}
@media (max-width: 560px) {
  .controls .right { display: none; }
  .hero { padding-top: 32px; }
}
