/* 匯議 VastMeet — design tokens: dark canvas (video pops), four surface steps, one accent (穩重藍), one live color (清新綠). */
:root {
  --bg: #0b0c0e; --sur1: #141618; --sur2: #1b1e21; --sur3: #22262a; --sur4: #2a2f34;
  --line: #2a2f35; --line2: #3a4149;
  --text: #f3f5f7; --muted: #8b939c; --dim: #5e6670;
  --accent: #4a8bdb; --accent-h: #5e9ae3; --accent-deep: #2b6cb0;
  --live: #38a89d; --warn: #f6ad55; --danger: #e5484d; --danger-h: #ef5a5f;
  --r: 10px; --r-sm: 6px;
  --shadow: 0 8px 28px rgba(0,0,0,.45);
  --font: 'Outfit', 'Noto Sans TC', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', 'Noto Sans TC', monospace;
  --bar-h: 72px; --top-h: 52px; --panel-w: 360px; --strip-w: 220px; --strip-h: 96px;
  --sa-b: env(safe-area-inset-bottom, 0px); --sa-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font-family: var(--font); font-size: 15px; line-height: 1.5; overflow: hidden; -webkit-font-smoothing: antialiased; overscroll-behavior: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
button:disabled { opacity: .45; cursor: not-allowed; }
svg { width: 22px; height: 22px; fill: currentColor; flex: none; }
a { color: var(--accent); }
code { font-family: var(--mono); font-size: .92em; }
[hidden] { display: none !important; }
.muted { color: var(--muted); } .dim { color: var(--dim); }
.row { display: flex; align-items: center; } .gap { gap: 10px; }
#app { height: 100%; }
.view { height: 100%; }
.view.center { display: grid; place-items: center; padding: 20px; }
.card { background: var(--sur1); border: 1px solid var(--line); border-radius: var(--r); padding: 28px; }
.center-card { text-align: center; max-width: 440px; width: 100%; }
.center-card h2 { margin: 12px 0 6px; font-weight: 600; font-size: 20px; }
.center-card .btn { margin-top: 18px; }

/* ---- buttons ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 999px; background: var(--sur3); color: var(--text); font-weight: 500; transition: background .15s, transform .1s; white-space: nowrap; }
.btn:hover { background: var(--sur4); } .btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent-deep); } .btn.primary:hover { background: var(--accent); }
.btn.danger { background: var(--danger); } .btn.danger:hover { background: var(--danger-h); }
.btn.ghost { background: transparent; border: 1px solid var(--line2); } .btn.ghost:hover { background: var(--sur2); }
.btn.lg { height: 48px; padding: 0 22px; font-size: 16px; }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn.wide { width: 100%; }
.icon-btn { position: relative; width: 40px; height: 40px; border-radius: 50%; display: inline-grid; place-items: center; color: var(--text); transition: background .15s; }
.icon-btn:hover { background: var(--sur3); } .icon-btn.on { background: var(--sur4); color: var(--accent); }
.badge { position: absolute; top: 2px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 600; font-style: normal; display: grid; place-items: center; }
.count { position: absolute; bottom: 0; right: -2px; background: var(--sur4); border-radius: 9px; font-size: 11px; font-style: normal; padding: 0 5px; line-height: 16px; }
.pill { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 9px; border-radius: 12px; background: var(--sur3); font-size: 12px; color: var(--muted); }
.pill svg { width: 14px; height: 14px; } .pill.rec { color: var(--danger); } .pill.rec svg { animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: .25; } }
input[type=text], input[type=password], input[type=search], select, textarea { width: 100%; height: 42px; padding: 0 12px; border-radius: var(--r-sm); border: 1px solid var(--line2); background: var(--sur1); color: var(--text); outline: none; transition: border-color .15s; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%238b939c'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 8px center; background-size: 20px; padding-right: 32px; }
label.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.field-row { display: flex; gap: 10px; align-items: center; margin-top: 14px; } .field-row label { color: var(--muted); font-size: 13px; white-space: nowrap; }
.eyebrow { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); }
.hint { font-size: 12.5px; color: var(--muted); margin: 6px 0 0; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.switch:last-child { border-bottom: 0; }
.switch small { display: block; color: var(--muted); font-size: 12px; }
.toggle { position: relative; width: 42px; height: 24px; border-radius: 12px; background: var(--sur4); transition: background .15s; flex: none; }
.toggle::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .15s; }
.toggle.on { background: var(--live); } .toggle.on::after { transform: translateX(18px); }
.seg { display: inline-flex; background: var(--sur2); border-radius: 999px; padding: 3px; gap: 2px; }
.seg button { height: 30px; padding: 0 12px; border-radius: 999px; font-size: 13px; color: var(--muted); }
.seg button.on { background: var(--sur4); color: var(--text); }

/* ---- logo & brand ---- */
.logo { width: 34px; height: 34px; border-radius: 9px; background: var(--accent-deep); position: relative; flex: none; }
.logo::before { content: ''; position: absolute; left: 7px; top: 9px; width: 13px; height: 14px; border-radius: 3px; background: #fff; }
.logo::after { content: ''; position: absolute; right: 6px; top: 11px; border-style: solid; border-width: 5px 0 5px 7px; border-color: transparent transparent transparent #fff; }
.logo.sm { width: 26px; height: 26px; border-radius: 7px; } .logo.sm::before { left: 5px; top: 7px; width: 10px; height: 11px; } .logo.sm::after { right: 4px; top: 8px; border-width: 4px 0 4px 6px; }
.brand { display: flex; align-items: baseline; gap: 8px; } .brand b { font-size: 20px; font-weight: 600; } .brand span { color: var(--muted); font-size: 13px; letter-spacing: .04em; }

/* ---- landing ---- */
.landing { overflow: auto; }
.landing-wrap { max-width: 760px; margin: 0 auto; padding: clamp(32px, 8vh, 90px) 20px 40px; }
.brand-row { display: flex; align-items: center; gap: 12px; margin-bottom: clamp(28px, 6vh, 56px); }
.landing-title { font-size: clamp(28px, 4.6vw, 44px); line-height: 1.2; font-weight: 600; margin: 0 0 14px; letter-spacing: -0.01em; }
.landing-sub { color: var(--muted); font-size: 16px; margin: 0 0 32px; max-width: 540px; }
.landing-actions { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.join-form { display: flex; gap: 8px; flex: 1; min-width: 280px; } .join-form input { height: 48px; }
.fixed-room { margin-top: 36px; border-top: 1px solid var(--line); padding-top: 18px; }
.fixed-room summary { cursor: pointer; color: var(--muted); font-size: 14px; list-style: none; } .fixed-room summary::before { content: '▸ '; } .fixed-room[open] summary::before { content: '▾ '; }
.fixed-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.fixed-grid label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.fixed-btns { grid-column: 1 / -1; display: flex; gap: 10px; flex-wrap: wrap; } .fixed-grid .hint { grid-column: 1 / -1; }
.recent { list-style: none; padding: 0; margin: 28px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.recent li a { display: inline-flex; gap: 8px; align-items: center; padding: 8px 12px; border-radius: 999px; background: var(--sur2); color: var(--text); text-decoration: none; font-size: 13px; } .recent li a:hover { background: var(--sur3); }
.landing-foot { margin-top: 48px; color: var(--dim); font-size: 12px; }

/* ---- prejoin ---- */
.prejoin { overflow: auto; display: grid; place-items: center; padding: 20px; }
.prejoin-wrap { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(300px, 380px); gap: 32px; width: min(1040px, 100%); align-items: center; }
.preview { position: relative; aspect-ratio: 16/9; background: var(--sur1); border-radius: 14px; overflow: hidden; border: 1px solid var(--line); }
.preview video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); background: #000; }
.preview video.off { visibility: hidden; }
.pre-avatar { position: absolute; inset: 0; display: grid; place-items: center; font-size: 56px; font-weight: 600; color: var(--muted); background: var(--sur2); }
.pre-overlay { position: absolute; left: 0; right: 0; bottom: 16px; display: flex; justify-content: center; gap: 14px; }
.meter { position: absolute; left: 16px; bottom: 22px; width: 90px; height: 6px; border-radius: 3px; background: rgba(255,255,255,.15); overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; background: var(--live); transition: width .08s; }
.pre-perm { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; background: rgba(11,12,14,.9); text-align: center; font-size: 14px; color: var(--muted); }
.prejoin-side { display: flex; flex-direction: column; gap: 14px; }
.pre-room h2 { margin: 2px 0 2px; font-size: 22px; font-weight: 600; overflow-wrap: anywhere; }
.field-grid { display: grid; gap: 10px; }
.host-row { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-height: 20px; }
.host-row .pill { color: var(--live); } .host-row a { cursor: pointer; }

/* ---- room shell ---- */
.room { display: grid; grid-template-rows: var(--top-h) 1fr var(--bar-h); grid-template-columns: 1fr auto; height: 100%; padding-top: var(--sa-t); }
.room-top { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; padding: 0 12px 0 14px; border-bottom: 1px solid var(--line); background: var(--bg); min-width: 0; }
.rt-left { display: flex; align-items: center; gap: 10px; min-width: 0; } .rt-left b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 32vw; }
.code { font-family: var(--mono); font-size: 13px; color: var(--muted); cursor: pointer; padding: 3px 8px; border-radius: 6px; background: var(--sur2); } .code:hover { color: var(--text); }
.rt-right { display: flex; align-items: center; gap: 6px; }
.timer { font-family: var(--mono); font-size: 13px; color: var(--muted); margin: 0 6px; }
.net { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); margin-right: 4px; } .net svg { width: 14px; height: 14px; }
.net.good { color: var(--live); } .net.fair { color: var(--warn); } .net.poor { color: var(--danger); }
.room-main { position: relative; grid-row: 2; grid-column: 1; min-width: 0; min-height: 0; display: flex; padding: 10px; gap: 10px; }
.room-main.strip-right { flex-direction: row; } .room-main.strip-bottom { flex-direction: column; }
.stage { position: relative; flex: 1; min-width: 0; min-height: 0; display: grid; place-items: center; }
.tiles { position: relative; display: grid; gap: 8px; min-width: 0; min-height: 0; }
.room-main.grid .tiles { flex: 1; align-content: center; justify-content: center; }
.room-main.strip-right .tiles { width: var(--strip-w); grid-auto-rows: calc(var(--strip-w) * 9 / 16); grid-auto-flow: row; overflow-y: auto; align-content: start; }
.room-main.strip-bottom .tiles { height: var(--strip-h); grid-auto-columns: calc(var(--strip-h) * 16 / 9); grid-auto-flow: column; overflow-x: auto; overflow-y: hidden; }
.tiles::-webkit-scrollbar { width: 6px; height: 6px; } .tiles::-webkit-scrollbar-thumb { background: var(--sur4); border-radius: 3px; }
.stage-note { position: absolute; left: 50%; top: 14px; transform: translateX(-50%); background: rgba(27,30,33,.9); border: 1px solid var(--line2); padding: 6px 12px; border-radius: 999px; font-size: 13px; display: flex; gap: 10px; align-items: center; z-index: 5; }
.stage-note .btn { height: 28px; padding: 0 10px; font-size: 12px; }

/* ---- tiles ---- */
.tile { position: relative; background: var(--sur2); border-radius: 12px; overflow: hidden; aspect-ratio: 16/9; min-width: 0; min-height: 0; outline: 2px solid transparent; outline-offset: -2px; transition: outline-color .15s; }
.tile.speaking { outline-color: var(--live); }
.tile.on-stage { aspect-ratio: auto; width: 100%; height: 100%; background: #000; border-radius: 14px; }
.tile.on-stage.screen, .tile.on-stage.doc { background: #0f1113; }
.tile video { width: 100%; height: 100%; object-fit: cover; background: #000; display: block; }
.tile.screen video, .tile.on-stage video { object-fit: contain; }
.tile.self video.mirror { transform: scaleX(-1); }
.tile video.hide { visibility: hidden; }
.tile .avatar { position: absolute; inset: 0; display: grid; place-items: center; }
.tile .avatar b { width: clamp(40px, 22%, 96px); aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; background: var(--sur4); color: var(--text); font-size: clamp(16px, 2.6vw, 34px); font-weight: 600; }
.tile .tile-name { position: absolute; left: 8px; bottom: 8px; display: flex; align-items: center; gap: 6px; max-width: calc(100% - 16px); padding: 4px 8px; border-radius: 6px; background: rgba(0,0,0,.55); font-size: 13px; backdrop-filter: blur(6px); }
.tile .tile-name span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.tile .tile-name svg { width: 14px; height: 14px; } .tile .tile-name .mic-off { color: var(--danger); } .tile .tile-name .hand { color: var(--warn); }
.tile .tile-top { position: absolute; right: 6px; top: 6px; display: flex; gap: 4px; opacity: 0; transition: opacity .15s; }
.tile:hover .tile-top, .tile.touch .tile-top { opacity: 1; }
.tile .tile-top button { width: 30px; height: 30px; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff; display: grid; place-items: center; } .tile .tile-top button svg { width: 16px; height: 16px; }
.tile .tile-top button.on { color: var(--accent); }
.tile .quality { position: absolute; left: 8px; top: 8px; font-family: var(--mono); font-size: 10px; color: rgba(255,255,255,.7); background: rgba(0,0,0,.45); padding: 2px 5px; border-radius: 4px; display: none; }
.tile.show-q .quality { display: block; }
.tile .paused { position: absolute; inset: 0; display: grid; place-items: center; font-size: 13px; color: var(--muted); background: var(--sur2); }
.tiles .tile.more-tile { display: grid; place-items: center; font-size: 15px; color: var(--muted); background: var(--sur1); }
.tile .hand-big { position: absolute; left: 8px; top: 8px; width: 28px; height: 28px; border-radius: 50%; background: var(--warn); color: #1a1a1a; display: grid; place-items: center; } .tile .hand-big svg { width: 16px; height: 16px; }
.tile .net-dot { position: absolute; right: 8px; bottom: 10px; width: 8px; height: 8px; border-radius: 50%; background: var(--live); display: none; } .tile.net-fair .net-dot { display: block; background: var(--warn); } .tile.net-poor .net-dot { display: block; background: var(--danger); }

/* ---- doc stage ---- */
.doc-stage { position: relative; width: 100%; height: 100%; display: grid; place-items: center; overflow: hidden; touch-action: none; }
.doc-page { position: relative; }
.doc-page canvas { display: block; border-radius: 4px; background: #fff; box-shadow: 0 10px 40px rgba(0,0,0,.5); }
.doc-page canvas.ink { position: absolute; inset: 0; background: transparent; box-shadow: none; }
.doc-pointer { position: absolute; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; background: #ff3b30; box-shadow: 0 0 0 4px rgba(255,59,48,.3), 0 0 14px rgba(255,59,48,.8); pointer-events: none; display: none; }
.doc-pointer.on { display: block; }
.doc-page.pen { cursor: crosshair; }
.doc-hud { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); display: flex; align-items: center; gap: 4px; background: rgba(20,22,24,.92); border: 1px solid var(--line2); border-radius: 999px; padding: 4px 6px; z-index: 4; }
.doc-hud button { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: var(--text); } .doc-hud button:hover { background: var(--sur3); } .doc-hud button.on { background: var(--accent-deep); }
.doc-hud .pg { font-family: var(--mono); font-size: 13px; padding: 0 8px; color: var(--muted); min-width: 70px; text-align: center; }
.doc-hud .pg input { width: 44px; height: 26px; padding: 0 4px; text-align: center; }
.doc-hud .sep { width: 1px; height: 22px; background: var(--line2); margin: 0 4px; }
.doc-loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 14px; }

/* ---- captions & reactions ---- */
.captions { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); max-width: min(860px, 92%); display: flex; flex-direction: column; gap: 4px; z-index: 6; pointer-events: none; }
.room-main.strip-bottom .captions { bottom: calc(var(--strip-h) + 24px); }
.captions div { background: rgba(0,0,0,.75); padding: 6px 12px; border-radius: 8px; font-size: 16px; line-height: 1.4; } .captions div b { color: var(--accent); font-weight: 500; margin-right: 6px; }
.reactions-layer { position: absolute; left: 24px; bottom: 20px; width: 160px; height: 60%; pointer-events: none; z-index: 6; overflow: hidden; }
.reaction { position: absolute; bottom: 0; left: 0; font-size: 40px; animation: float 3.2s ease-out forwards; display: flex; flex-direction: column; align-items: center; }
.reaction small { font-size: 11px; color: var(--muted); background: rgba(0,0,0,.55); padding: 1px 6px; border-radius: 6px; margin-top: 2px; white-space: nowrap; }
@keyframes float { 0% { transform: translate(0, 0) scale(.6); opacity: 0; } 10% { opacity: 1; transform: translate(0, -20px) scale(1); } 100% { transform: translate(var(--dx, 20px), -420px) scale(.9); opacity: 0; } }

/* ---- bottom bar ---- */
.bar { grid-row: 3; grid-column: 1 / -1; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 0 16px calc(var(--sa-b)); border-top: 1px solid var(--line); background: var(--bg); }
.bar-left { display: flex; gap: 10px; align-items: center; font-size: 13px; font-family: var(--mono); color: var(--muted); }
.bar-center { display: flex; gap: 10px; align-items: center; justify-content: center; }
.bar-right { display: flex; gap: 4px; justify-content: flex-end; }
.ctl { position: relative; width: 48px; height: 48px; border-radius: 50%; background: var(--sur3); color: var(--text); display: grid; place-items: center; transition: background .15s, transform .1s; }
.ctl:hover { background: var(--sur4); } .ctl:active { transform: scale(.94); }
.ctl.off { background: var(--danger); color: #fff; } .ctl.off:hover { background: var(--danger-h); }
.ctl.active { background: var(--accent-deep); color: #fff; } .ctl.active:hover { background: var(--accent); }
.ctl.live { background: var(--live); color: #0b0c0e; }
.ctl.danger { background: var(--danger); color: #fff; width: 64px; border-radius: 24px; } .ctl.danger:hover { background: var(--danger-h); }
.ctl[data-tip]:hover::after { content: attr(data-tip); position: absolute; bottom: 56px; left: 50%; transform: translateX(-50%); background: var(--sur4); color: var(--text); font-size: 12px; padding: 4px 8px; border-radius: 6px; white-space: nowrap; pointer-events: none; z-index: 20; }
.ctl-group { display: inline-flex; border-radius: 24px; background: var(--sur3); } .ctl-group .ctl { background: transparent; } .ctl-group .ctl.caret { width: 28px; margin-left: -8px; } .ctl-group .ctl.caret svg { width: 18px; }
.ctl-group.active { background: var(--accent-deep); } .ctl-group.active .ctl { color: #fff; }
.ctl .dot { position: absolute; top: 6px; right: 6px; width: 9px; height: 9px; border-radius: 50%; background: var(--warn); border: 2px solid var(--bg); }

/* ---- popover (share menu, reactions, more menu, tile menu) ---- */
.popover { position: fixed; z-index: 40; background: var(--sur2); border: 1px solid var(--line2); border-radius: var(--r); box-shadow: var(--shadow); min-width: 220px; max-width: min(360px, 94vw); padding: 6px; }
.popover .item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border-radius: 8px; text-align: left; font-size: 14px; color: var(--text); }
.popover .item:hover { background: var(--sur3); } .popover .item.on { color: var(--accent); } .popover .item.danger { color: var(--danger); }
.popover .item small { display: block; color: var(--muted); font-size: 12px; } .popover .item svg { width: 20px; height: 20px; color: var(--muted); } .popover .item.on svg { color: var(--accent); }
.popover .title { font-size: 12px; color: var(--dim); padding: 8px 12px 4px; letter-spacing: .06em; }
.popover .emojis { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.popover .emojis button { font-size: 26px; height: 46px; border-radius: 8px; } .popover .emojis button:hover { background: var(--sur3); transform: scale(1.15); }
.popover hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }

/* ---- side panel ---- */
.panel { grid-row: 2; grid-column: 2; width: var(--panel-w); display: flex; flex-direction: column; background: var(--sur1); border-left: 1px solid var(--line); min-height: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 10px 10px 16px; border-bottom: 1px solid var(--line); font-weight: 600; }
.panel-body { flex: 1; min-height: 0; overflow: auto; padding: 14px 16px; }
.panel-body::-webkit-scrollbar { width: 8px; } .panel-body::-webkit-scrollbar-thumb { background: var(--sur4); border-radius: 4px; }
.panel h4 { margin: 14px 0 8px; font-size: 12px; color: var(--dim); letter-spacing: .06em; text-transform: uppercase; font-weight: 600; } .panel h4:first-child { margin-top: 0; }
/* chat */
.chat-wrap { display: flex; flex-direction: column; height: 100%; }
.chat-list { flex: 1; overflow: auto; display: flex; flex-direction: column; gap: 10px; padding-bottom: 8px; }
.msg { display: flex; flex-direction: column; gap: 2px; max-width: 92%; } .msg.me { align-self: flex-end; align-items: flex-end; }
.msg .who { font-size: 12px; color: var(--muted); } .msg .who time { margin-left: 6px; color: var(--dim); font-family: var(--mono); font-size: 11px; }
.msg .txt { background: var(--sur3); padding: 8px 11px; border-radius: 12px; border-top-left-radius: 4px; font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.me .txt { background: var(--accent-deep); border-radius: 12px; border-top-right-radius: 4px; }
.msg.sys { align-self: center; } .msg.sys .txt { background: transparent; color: var(--dim); font-size: 12px; }
.chat-input { display: flex; gap: 8px; align-items: flex-end; padding-top: 10px; border-top: 1px solid var(--line); }
.chat-input textarea { height: 42px; max-height: 120px; resize: none; padding: 10px 12px; line-height: 1.4; }
.chat-input button { width: 42px; height: 42px; border-radius: 50%; background: var(--accent-deep); color: #fff; display: grid; place-items: center; flex: none; }
/* people */
.invite { background: var(--sur2); border-radius: var(--r); padding: 12px; margin-bottom: 14px; }
.invite .link { display: flex; gap: 6px; align-items: center; margin-top: 8px; } .invite .link input { font-family: var(--mono); font-size: 12px; height: 36px; }
.invite .link button { height: 36px; width: 36px; border-radius: 8px; background: var(--sur3); display: grid; place-items: center; flex: none; }
.person { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.person .av { width: 34px; height: 34px; border-radius: 50%; background: var(--sur4); display: grid; place-items: center; font-weight: 600; font-size: 14px; flex: none; }
.person .nm { flex: 1; min-width: 0; } .person .nm b { font-weight: 500; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .person .nm small { color: var(--muted); font-size: 12px; }
.person .ic { display: flex; gap: 6px; color: var(--muted); } .person .ic svg { width: 18px; height: 18px; } .person .ic .off { color: var(--danger); } .person .ic .hand { color: var(--warn); }
.person .menu { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); } .person .menu:hover { background: var(--sur3); color: var(--text); }
.lobby-row { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: var(--sur2); border-radius: 8px; margin-bottom: 6px; } .lobby-row b { flex: 1; font-weight: 500; }
.host-tools { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
/* stats */
.stat-sum { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px; }
.stat-sum div { background: var(--sur2); border-radius: 8px; padding: 10px; } .stat-sum b { display: block; font-family: var(--mono); font-size: 18px; font-weight: 500; } .stat-sum small { color: var(--muted); font-size: 11px; }
.stat-sum .good b { color: var(--live); } .stat-sum .fair b { color: var(--warn); } .stat-sum .poor b { color: var(--danger); }
.stat-note { font-size: 13px; color: var(--muted); background: var(--sur2); border-radius: 8px; padding: 10px 12px; margin-bottom: 12px; line-height: 1.5; }
table.stats { width: 100%; border-collapse: collapse; font-size: 12px; font-family: var(--mono); }
table.stats th, table.stats td { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--line); white-space: nowrap; } table.stats th { color: var(--dim); font-weight: 500; }
table.stats td.name { font-family: var(--font); max-width: 90px; overflow: hidden; text-overflow: ellipsis; }
/* doc panel */
.doc-thumbs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.doc-thumbs .th { position: relative; border-radius: 6px; overflow: hidden; border: 2px solid transparent; background: var(--sur2); cursor: pointer; aspect-ratio: 16/10; display: grid; place-items: center; }
.doc-thumbs .th canvas { max-width: 100%; max-height: 100%; } .doc-thumbs .th.on { border-color: var(--accent); }
.doc-thumbs .th i { position: absolute; left: 4px; bottom: 4px; font-style: normal; font-size: 11px; background: rgba(0,0,0,.6); padding: 1px 5px; border-radius: 4px; }
.upload-box { border: 1px dashed var(--line2); border-radius: var(--r); padding: 22px 14px; text-align: center; color: var(--muted); font-size: 14px; cursor: pointer; } .upload-box:hover { border-color: var(--accent); color: var(--text); }
.upload-box svg { width: 28px; height: 28px; display: block; margin: 0 auto 8px; }
.progress { height: 6px; background: var(--sur3); border-radius: 3px; overflow: hidden; margin-top: 10px; } .progress i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }

/* ---- toasts & modal ---- */
.toasts { position: fixed; left: 50%; top: calc(var(--sa-t) + 64px); transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 60; pointer-events: none; width: min(460px, 92vw); }
.toast { background: var(--sur3); border: 1px solid var(--line2); padding: 10px 14px; border-radius: 10px; font-size: 14px; box-shadow: var(--shadow); animation: fadeUp .25s ease-out; pointer-events: auto; display: flex; gap: 10px; align-items: center; }
.toast.err { border-color: var(--danger); } .toast.ok { border-color: var(--live); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: grid; place-items: center; z-index: 70; padding: 20px; }
.modal-card { background: var(--sur2); border: 1px solid var(--line2); border-radius: 14px; padding: 22px; width: min(440px, 100%); box-shadow: var(--shadow); animation: fadeUp .2s ease-out; }
.modal-card h3 { margin: 0 0 8px; font-size: 18px; font-weight: 600; } .modal-card p { margin: 0 0 14px; color: var(--muted); font-size: 14px; }
.modal-card .acts { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.spinner { width: 32px; height: 32px; border-radius: 50%; border: 3px solid var(--sur4); border-top-color: var(--accent); animation: spin .8s linear infinite; margin: 0 auto; } @keyframes spin { to { transform: rotate(360deg); } }
.kbd { font-family: var(--mono); font-size: 11px; background: var(--sur4); padding: 1px 5px; border-radius: 4px; color: var(--muted); }

/* ---- mobile ---- */
@media (max-width: 767px) {
  :root { --bar-h: 76px; --top-h: 48px; --strip-h: 84px; }
  .prejoin-wrap { grid-template-columns: 1fr; gap: 18px; } .preview { aspect-ratio: 4/3; }
  .landing-wrap { padding-top: 40px; } .fixed-grid { grid-template-columns: 1fr; }
  .room { grid-template-columns: 1fr; }
  .room-main { padding: 6px; gap: 6px; }
  .room-main.grid .tiles { align-content: stretch; }
  .tile { border-radius: 10px; } .tile.on-stage { border-radius: 10px; }
  .rt-left b { max-width: 30vw; } .timer { display: none; } .code { display: none; }
  .bar { grid-template-columns: 1fr; padding: 0 8px calc(var(--sa-b)); }
  .bar-left, .bar-right { display: none; }
  .bar-center { gap: 8px; } .ctl { width: 46px; height: 46px; } .ctl.danger { width: 56px; }
  #c-react { display: none; } #c-share-opt { display: none; }
  .ctl[data-tip]:hover::after { display: none; }
  .panel { position: fixed; left: 0; right: 0; bottom: 0; top: auto; width: 100%; height: min(72vh, 560px); border-left: 0; border-top: 1px solid var(--line2); border-radius: 16px 16px 0 0; z-index: 30; padding-bottom: var(--sa-b); box-shadow: 0 -10px 40px rgba(0,0,0,.5); animation: sheet .22s ease-out; }
  @keyframes sheet { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
  .panel-head::before { content: ''; position: absolute; left: 50%; top: 6px; width: 36px; height: 4px; border-radius: 2px; background: var(--line2); transform: translateX(-50%); }
  .panel-head { position: relative; padding-top: 14px; }
  .captions div { font-size: 14px; }
  .doc-hud { bottom: 8px; padding: 3px 4px; } .doc-hud button { width: 32px; height: 32px; } .doc-hud .pg { min-width: 56px; font-size: 12px; }
  .stat-sum { grid-template-columns: repeat(3, 1fr); }
  .toasts { top: calc(var(--sa-t) + 56px); }
}
@media (max-width: 1024px) and (min-width: 768px) { :root { --panel-w: 320px; --strip-w: 180px; } }
@media (orientation: landscape) and (max-height: 500px) { :root { --top-h: 40px; --bar-h: 60px; --strip-h: 70px; } .ctl { width: 42px; height: 42px; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
