/* =====================================================================
   Truth Meet · 网页端超低延时会议
   设计 token 与 App 端 AppColors 对齐：
   panelBg #232426 / sheetBg #1A1A1A / brandBlue #0E72ED / videoBlue #2D9BF0
   ===================================================================== */
:root {
  --panel: #232426;
  --panel-2: #1a1b1d;
  --sheet: #1a1a1a;
  --line: rgba(255, 255, 255, .09);
  --line-strong: rgba(255, 255, 255, .16);
  --fg: #f4f4f5;
  --fg-2: #aaaeb5;
  --fg-3: #7b8087;
  --brand: #0e72ed;
  --brand-2: #2d9bf0;
  --danger: #ff3b30;
  --ok: #34c759;
  --gold: #ffd54f;
  --rec: #ff453a;
  --radius: 12px;
  --radius-lg: 18px;
  --shadow: 0 12px 40px rgba(0, 0, 0, .45);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0; height: 100%;
  background: #0b0c0e;
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
  font-size: 14px;
  overflow: hidden;
}

button, input, select { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
[hidden] { display: none !important; }

/* ---------------- 通用控件 ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px; height: 40px; padding: 0 18px;
  border-radius: 10px; font-weight: 600; font-size: 14px;
  transition: transform .12s ease, background .16s ease, opacity .16s ease;
  white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--brand); color: #fff; }
.btn.primary:hover { background: #1a7ff5; }
.btn.ghost { background: rgba(255,255,255,.08); color: var(--fg); }
.btn.ghost:hover { background: rgba(255,255,255,.14); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.small { height: 34px; padding: 0 14px; font-size: 13px; border-radius: 9px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.icon-btn {
  width: 38px; height: 38px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.06); font-size: 16px; color: var(--fg);
  transition: background .16s ease;
  position: relative;
}
.icon-btn:hover { background: rgba(255,255,255,.14); }
.icon-btn.sm { width: 32px; height: 32px; font-size: 14px; border-radius: 8px; }
.icon-btn.on { background: var(--brand); }

.badge-dot {
  position: absolute; top: 2px; right: 2px;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 9px; background: var(--danger); color: #fff;
  font-size: 10px; line-height: 16px; text-align: center; font-weight: 700;
}

.field { display: block; margin: 14px 0; }
.field > span { display: block; font-size: 12px; color: var(--fg-2); margin-bottom: 6px; }
.field input, input[type=text], input[type=password] {
  width: 100%; height: 44px; padding: 0 14px;
  background: rgba(255,255,255,.06); border: 1px solid var(--line);
  border-radius: 10px; outline: none; transition: border .16s ease;
}
.field input:focus, input[type=text]:focus, input[type=password]:focus {
  border-color: var(--brand-2); background: rgba(45,155,240,.08);
}

.hint { min-height: 18px; font-size: 12px; color: var(--fg-2); margin-top: 8px; }
.hint.error { color: #ff6b60; }

.badge {
  display: inline-flex; align-items: center; height: 24px; padding: 0 10px;
  border-radius: 8px; font-size: 12px; background: rgba(255,255,255,.08); color: var(--fg-2);
}
.badge.ok { background: rgba(52,199,89,.16); color: #4ade80; }
.badge.warn { background: rgba(255,159,10,.16); color: #ffb340; }
.ghost-badge { background: transparent; border: 1px solid var(--line); }

.dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--brand-2); display: inline-block;
  box-shadow: 0 0 0 4px rgba(45,155,240,.16);
}

/* ---------------- 屏幕切换 ---------------- */
.screen { display: none; width: 100vw; height: 100vh; }
.screen.active { display: flex; }

/* ---------------- 入口页 ---------------- */
#screenEntry { align-items: center; justify-content: center; padding: 24px; }
.entry-wrap { width: 100%; max-width: 420px; }
.entry-card {
  background: linear-gradient(180deg, #24262a 0%, #1b1c1f 100%);
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 28px 24px; box-shadow: var(--shadow);
}
.brand-lg { display: flex; align-items: center; gap: 10px; font-size: 22px; font-weight: 700; letter-spacing: .4px; }
.brand-lg em { font-style: normal; color: var(--brand-2); }
.entry-card .sub { color: var(--fg-2); font-size: 13px; margin: 10px 0 20px; line-height: 1.6; }

.profile-row { display: flex; align-items: center; gap: 14px; margin: 6px 0 4px; }
.avatar-big {
  width: 58px; height: 58px; border-radius: 50%; flex: 0 0 58px;
  background: #3a3f47; display: flex; align-items: center; justify-content: center;
  overflow: hidden; border: 2px solid rgba(255,255,255,.12); font-size: 22px; color: var(--fg-2);
}
.avatar-big img { width: 100%; height: 100%; object-fit: cover; }
.profile-meta { flex: 1; min-width: 0; }
.profile-meta input { height: 42px; }
.profile-meta small { display: block; margin-top: 6px; font-size: 11px; color: var(--fg-3); }

.entry-actions { display: flex; gap: 10px; margin-top: 20px; }
.entry-actions .btn { flex: 1; height: 46px; }
.status-line { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }

/* ---------------- 等候室 ---------------- */
#screenGate { align-items: center; justify-content: center; padding: 24px; }
.gate-card {
  text-align: center; max-width: 380px; padding: 36px 28px;
  background: #1b1c1f; border: 1px solid var(--line); border-radius: var(--radius-lg);
}
.gate-card h2 { font-size: 18px; margin: 18px 0 8px; }
.gate-card .sub { color: var(--fg-2); font-size: 13px; line-height: 1.7; }
.gate-spinner {
  width: 44px; height: 44px; margin: 0 auto; border-radius: 50%;
  border: 3px solid rgba(45,155,240,.22); border-top-color: var(--brand-2);
  animation: spin 1s linear infinite;
}
.gate-spinner.error { animation: none; border-color: rgba(255,59,48,.4); border-top-color: var(--danger); }
@keyframes spin { to { transform: rotate(360deg); } }
.gate-actions { margin-top: 22px; }

/* ---------------- 会议页骨架 ---------------- */
#screenMeeting { flex-direction: column; background: var(--panel); }

.mtop {
  flex: 0 0 52px; height: 52px; display: flex; align-items: center;
  justify-content: space-between; padding: 0 12px; gap: 12px;
  background: var(--panel); border-bottom: 1px solid var(--line);
}
.mtop-left, .mtop-right { display: flex; align-items: center; gap: 8px; min-width: 0; }
.brand-sm { display: flex; align-items: center; gap: 7px; font-weight: 600; font-size: 14px; color: var(--fg); }
.room-chip {
  display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 12px;
  border-radius: 8px; background: rgba(255,255,255,.07); font-size: 13px; color: var(--fg-2);
  max-width: 240px; overflow: hidden;
}
.room-chip b { color: var(--fg); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 130px; }
.elapsed { font-variant-numeric: tabular-nums; color: var(--fg-3); font-size: 12px; }
.rec-btn.on { background: rgba(255,69,58,.2); color: var(--rec); animation: recPulse 1.6s infinite; }
@keyframes recPulse { 50% { opacity: .55; } }

/* 舞台：左 PPT（0.618）右视频 */
.stage { flex: 1; display: flex; min-height: 0; position: relative; }
.ppt-pane {
  flex: 1.618 1 0; min-width: 0; display: flex; flex-direction: column;
  background: #17181a; border-right: 1px solid var(--line);
}
.video-pane { flex: 1 1 0; min-width: 260px; display: flex; flex-direction: column; background: #0f1012; }

/* 幻灯片 */
.slide-stage { position: relative; flex: 1; min-height: 0; overflow: hidden; }
.slide-viewport {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  overflow: hidden; touch-action: none;
}
.slide-canvas-wrap {
  position: relative; transform-origin: center center;
  transition: transform .12s ease-out;
  will-change: transform;
}
.slide-canvas-wrap img {
  display: block; max-width: 100%; max-height: 100%;
  user-select: none; -webkit-user-drag: none;
}
#slideInk { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
.laser-dot {
  position: absolute; width: 18px; height: 18px; margin: -9px 0 0 -9px;
  border-radius: 50%; background: radial-gradient(circle, #ff453a 0%, rgba(255,69,58,.35) 60%, transparent 72%);
  box-shadow: 0 0 18px 6px rgba(255,69,58,.45); pointer-events: none; z-index: 5;
}
.slide-empty {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  text-align: center; padding: 20px;
}
.empty-inner { max-width: 320px; }
.empty-ico { font-size: 36px; opacity: .5; margin-bottom: 8px; }
.slide-empty h3 { margin: 0 0 6px; font-size: 15px; }
.slide-empty p { margin: 0 0 14px; font-size: 12px; color: var(--fg-3); line-height: 1.6; }
.slide-loading {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  gap: 10px; background: rgba(0,0,0,.55); font-size: 13px; color: var(--fg-2); z-index: 6;
}
.spin {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.2); border-top-color: var(--brand-2);
  animation: spin .9s linear infinite;
}

/* 工具条 */
.deck-bar {
  flex: 0 0 auto; display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; background: var(--panel-2); border-top: 1px solid var(--line);
  flex-wrap: wrap;
}
.pager-group, .tools-group, .zoom-group { display: flex; align-items: center; gap: 6px; }
.page-input {
  width: 46px; height: 30px; text-align: center; border-radius: 8px;
  background: rgba(255,255,255,.08); border: 1px solid var(--line); outline: none;
}
.page-total { font-size: 12px; color: var(--fg-3); }
.zoom-label { font-size: 12px; color: var(--fg-3); min-width: 42px; text-align: center; font-variant-numeric: tabular-nums; }
.tool {
  width: 34px; height: 32px; border-radius: 8px; font-size: 15px;
  background: rgba(255,255,255,.06); display: inline-flex; align-items: center; justify-content: center;
}
.tool.active { background: var(--brand); }
.color-group, .width-group { display: inline-flex; gap: 4px; margin: 0 4px; }
.swatch {
  width: 20px; height: 20px; border-radius: 50%; background: var(--c);
  border: 2px solid transparent;
}
.swatch.active { border-color: #fff; box-shadow: 0 0 0 2px rgba(255,255,255,.25); }
.wbtn { height: 26px; padding: 0 8px; border-radius: 7px; font-size: 11px; background: rgba(255,255,255,.06); color: var(--fg-2); }
.wbtn.active { background: var(--brand); color: #fff; }
.viewer-bar { justify-content: space-between; }

/* 视频区 */
.video-box { position: relative; flex: 1; min-height: 0; background: #000; overflow: hidden; }
.player-host { position: absolute; inset: 0; }
.player-host video, .player-host canvas { width: 100%; height: 100%; object-fit: contain; }
.local-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.video-placeholder {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 8px; text-align: center;
  color: var(--fg-2); padding: 20px; background: radial-gradient(circle at 50% 45%, #1c1e21, #0d0e10);
}
.video-placeholder.hide { display: none; }
.video-placeholder p { margin: 0; font-size: 13px; }
.video-placeholder small { color: var(--fg-3); font-size: 11px; max-width: 90%; }
.pulse {
  width: 46px; height: 46px; border-radius: 50%;
  background: rgba(45,155,240,.16); border: 1px solid rgba(45,155,240,.4);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse { 50% { transform: scale(1.12); opacity: .6; } }

.video-flags { position: absolute; left: 10px; top: 10px; display: flex; gap: 6px; flex-wrap: wrap; z-index: 3; }
.flag {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px;
  border-radius: 6px; font-size: 11px; background: rgba(0,0,0,.55); color: #fff;
}
.flag.live i { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }
.flag.rec { background: rgba(255,69,58,.85); }
.flag.rec i { width: 7px; height: 7px; border-radius: 50%; background: #fff; animation: recPulse 1.4s infinite; }
.flag.share { background: rgba(52,199,89,.85); }
.flag.muted { background: rgba(120,120,120,.75); }

.video-overlay { position: absolute; right: 10px; bottom: 10px; display: flex; gap: 6px; z-index: 3; }
.video-overlay .icon-btn { background: rgba(0,0,0,.5); }

.self-preview {
  position: absolute; right: 10px; top: 10px; width: 132px; border-radius: 10px;
  overflow: hidden; background: #000; border: 1px solid var(--line-strong); z-index: 4;
  box-shadow: var(--shadow);
}
.self-preview video { width: 100%; height: 84px; object-fit: cover; display: block; }
.self-preview span {
  display: block; padding: 3px 6px; font-size: 10px; color: var(--fg-2);
  background: rgba(0,0,0,.6); text-align: center;
}

/* 侧栏 */
.side-panel {
  position: absolute; right: 0; top: 0; bottom: 0; width: 340px; max-width: 88vw;
  background: #1d1e21; border-left: 1px solid var(--line);
  display: flex; flex-direction: column; z-index: 20;
  box-shadow: -10px 0 30px rgba(0,0,0,.4);
}
.side-tabs {
  flex: 0 0 46px; display: flex; align-items: center; gap: 4px;
  padding: 0 8px; border-bottom: 1px solid var(--line);
}
.side-tab {
  height: 32px; padding: 0 14px; border-radius: 8px; font-size: 13px; color: var(--fg-2);
}
.side-tab.active { background: rgba(255,255,255,.1); color: var(--fg); font-weight: 600; }
.side-tab b { font-weight: 600; color: var(--brand-2); }
.side-close { margin-left: auto; width: 30px; height: 30px; border-radius: 8px; color: var(--fg-2); }
.side-close:hover { background: rgba(255,255,255,.1); }
.side-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }

/* 聊天 */
.chat-list { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.chat-row { display: flex; gap: 8px; align-items: flex-start; }
.chat-row.mine { flex-direction: row-reverse; }
.chat-avatar {
  width: 28px; height: 28px; border-radius: 50%; flex: 0 0 28px; overflow: hidden;
  background: #3a3f47; display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: var(--fg-2);
}
.chat-avatar img { width: 100%; height: 100%; object-fit: cover; }
.chat-main { max-width: 74%; }
.chat-meta { font-size: 11px; color: var(--fg-3); margin-bottom: 3px; display: flex; gap: 6px; align-items: center; }
.chat-meta .host-tag { color: var(--gold); }
.chat-bubble {
  padding: 8px 11px; border-radius: 10px; background: rgba(255,255,255,.08);
  font-size: 13px; line-height: 1.55; word-break: break-word; white-space: pre-wrap;
}
.chat-row.mine .chat-bubble { background: var(--brand); color: #fff; }
.chat-bubble img { max-width: 100%; border-radius: 8px; display: block; }
.chat-compose {
  flex: 0 0 auto; display: flex; align-items: center; gap: 6px;
  padding: 8px; border-top: 1px solid var(--line);
}
.chat-compose input { flex: 1; height: 36px; }
.emoji-panel {
  display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px;
  padding: 8px; border-top: 1px solid var(--line); max-height: 130px; overflow-y: auto;
}
.emoji-panel button { height: 30px; font-size: 17px; border-radius: 6px; }
.emoji-panel button:hover { background: rgba(255,255,255,.1); }

/* 成员 */
.member-list { flex: 1; overflow-y: auto; padding: 8px; }
.member-row {
  display: flex; align-items: center; gap: 10px; padding: 8px;
  border-radius: 10px;
}
.member-row:hover { background: rgba(255,255,255,.05); }
.member-avatar {
  width: 34px; height: 34px; border-radius: 50%; overflow: hidden; flex: 0 0 34px;
  background: #3a3f47; display: flex; align-items: center; justify-content: center; font-size: 13px;
}
.member-avatar img { width: 100%; height: 100%; object-fit: cover; }
.member-name { flex: 1; min-width: 0; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-tags { display: flex; gap: 4px; font-size: 12px; }
.tag-host { color: var(--gold); }
.tag-hand { color: var(--gold); }

/* 底部控制条 */
.controlbar {
  flex: 0 0 62px; height: 62px; display: flex; align-items: center;
  justify-content: space-between; padding: 0 12px; gap: 10px;
  background: var(--panel); border-top: 1px solid var(--line);
  overflow-x: auto;
}
.cb-left, .cb-right { display: flex; align-items: center; gap: 6px; }
.cb-btn {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; min-width: 58px; height: 46px; border-radius: 10px;
  color: var(--fg-2); transition: background .16s ease, color .16s ease;
  position: relative;
}
.cb-btn .ico { font-size: 17px; line-height: 1; }
.cb-btn .lbl { font-size: 10px; white-space: nowrap; }
.cb-btn:hover { background: rgba(255,255,255,.08); color: var(--fg); }
.cb-btn.off { color: var(--danger); }
.cb-btn.on { background: rgba(14,114,237,.18); color: var(--brand-2); }
.cb-btn.rec-on { color: var(--rec); }

/* ---------------- 弹层 ---------------- */
.modal {
  position: fixed; inset: 0; display: none; align-items: center; justify-content: center;
  background: rgba(0,0,0,.6); backdrop-filter: blur(3px); z-index: 60; padding: 20px;
}
.modal.show { display: flex; }
.modal-card {
  width: 100%; max-width: 400px; background: #1f2023; border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 22px; box-shadow: var(--shadow);
  max-height: 86vh; overflow-y: auto;
}
.modal-card.wide { max-width: 520px; }
.modal-card.sheet { max-width: 340px; padding: 8px; }
.modal-card h3 { margin: 0 0 6px; font-size: 16px; }
.modal-card .sub { color: var(--fg-2); font-size: 12px; margin: 0 0 12px; line-height: 1.6; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.modal-actions.spread { justify-content: space-between; }
.modal-actions.spread > div { display: flex; gap: 8px; }

.avatar-editor { display: flex; align-items: center; gap: 14px; margin: 6px 0 4px; }
.avatar-preview {
  width: 64px; height: 64px; border-radius: 50%; overflow: hidden; flex: 0 0 64px;
  background: #3a3f47; display: flex; align-items: center; justify-content: center;
  font-size: 22px; color: var(--fg-2); border: 2px solid rgba(255,255,255,.12);
}
.avatar-preview img { width: 100%; height: 100%; object-fit: cover; }
.avatar-actions { display: flex; flex-direction: column; gap: 8px; }
.file-label { position: relative; overflow: hidden; }

.switch-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13px;
}
.switch { position: relative; width: 44px; height: 24px; flex: 0 0 44px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span {
  position: absolute; inset: 0; border-radius: 12px; background: rgba(255,255,255,.16);
  transition: background .18s ease; cursor: pointer;
}
.switch span::after {
  content: ''; position: absolute; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; top: 3px; left: 3px; transition: transform .18s ease;
}
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::after { transform: translateX(20px); }

.pending-list, .prelude-list, .replay-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.pending-row, .prelude-row, .replay-row {
  display: flex; align-items: center; gap: 10px; padding: 10px;
  background: rgba(255,255,255,.05); border-radius: 10px; font-size: 13px;
}
.pending-row .name, .prelude-row .name, .replay-row .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pending-row button, .prelude-row button, .replay-row button { height: 28px; padding: 0 10px; border-radius: 7px; font-size: 12px; background: rgba(255,255,255,.1); }
.pending-row button.primary, .prelude-row button.primary { background: var(--brand); color: #fff; }
.pending-row button.reject { background: rgba(255,59,48,.18); color: #ff6b60; }
.prelude-row.playing { background: rgba(14,114,237,.18); }
.replay-row .meta { font-size: 11px; color: var(--fg-3); }
.empty-tip { padding: 18px; text-align: center; color: var(--fg-3); font-size: 12px; }

.sheet-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 14px 12px;
  border-radius: 10px; font-size: 14px; text-align: left;
}
.sheet-item:hover { background: rgba(255,255,255,.08); }
.sheet-item + .sheet-item { border-top: 1px solid var(--line); }

/* 回放播放器 */
.player-modal {
  width: 100%; max-width: 940px; background: #101113; border: 1px solid var(--line);
  border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow);
}
.player-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border-bottom: 1px solid var(--line); font-size: 14px;
}
.player-modal video { width: 100%; max-height: 72vh; background: #000; display: block; }
.player-foot { padding: 10px 14px; font-size: 12px; color: var(--fg-3); }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%) translateY(12px);
  background: rgba(33,33,33,.94); color: #fff; padding: 10px 16px; border-radius: 10px;
  font-size: 13px; opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease;
  z-index: 100; max-width: 80vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------------- 响应式 ---------------- */
@media (max-width: 860px) {
  .stage { flex-direction: column; }
  .ppt-pane { flex: 1 1 55%; border-right: none; border-bottom: 1px solid var(--line); }
  .video-pane { flex: 1 1 45%; min-width: 0; min-height: 140px; }
  .side-panel { width: 100%; max-width: none; }
  .mtop { flex-wrap: nowrap; overflow-x: auto; }
  .brand-sm { display: none; }
  .controlbar { gap: 2px; padding: 0 6px; }
  .cb-btn { min-width: 50px; }
  .cb-btn .lbl { font-size: 9px; }
  .deck-bar { padding: 6px 8px; gap: 6px; }
  .tools-group { order: 3; width: 100%; justify-content: space-between; }
  .self-preview { width: 96px; }
  .self-preview video { height: 62px; }
}
