/* 一起看 — Apple Style 设计系统 (StyleKit) */
/* 极致简约 · 大量留白 · 精致圆角 · 微妙阴影 · 克制配色 */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* 色彩 — 黑白灰为主，蓝色点缀 */
  --bg: #f5f5f7;              /* Apple 灰 — 页面底色 */
  --bg-card: #ffffff;          /* 纯白 — 卡片/面板 */
  --bg-elevated: #ffffff;      /* 纯白 — 浮层 */
  --bg-hover: #f0f0f2;         /* 浅灰 — hover 态 */
  --bg-active: #e8e8ed;        /* 灰 — active 态 */

  /* 边框 — Apple 浅灰 */
  --border: #d2d2d7;
  --border-light: rgba(0,0,0,.06);

  /* 文字层级 */
  --text: #1d1d1f;             /* Apple 近黑 */
  --text2: #6e6e73;            /* 次要文字 */
  --text3: #86868b;            /* 辅助文字 */

  /* 强调色 — Apple 蓝 */
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --accent-light: rgba(0,113,227,.08);

  /* 系统色 */
  --success: #34c759;
  --danger: #ff3b30;
  --warn: #ff9500;

  /* 圆角 — 精致 */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;
  --r-pill: 980px;

  /* 阴影 — 微妙 */
  --shadow-xs: 0 1px 2px rgba(0,0,0,.04);
  --shadow-sm: 0 1px 4px rgba(0,0,0,.06);
  --shadow-md: 0 2px 8px rgba(0,0,0,.08);
  --shadow-lg: 0 4px 16px rgba(0,0,0,.10);
  --shadow-xl: 0 8px 28px rgba(0,0,0,.12);

  /* 字体 — SF Pro 风格 */
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  --font-mono: "SF Mono", "JetBrains Mono", ui-monospace, "Cascadia Code", monospace;

  /* 过渡 */
  --ease: cubic-bezier(.25,.1,.25,1);
  --ease-spring: cubic-bezier(.34,1.56,.64,1);
}

html { background: var(--bg); }
html, body { height: 100%; min-height: 100vh; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px; line-height: 1.47;
  letter-spacing: -.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- 滚动条 ---------- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,.15); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,.25); }

/* ---------- 按钮 ---------- */
button {
  font: inherit; color: var(--text); background: var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--r-pill);
  padding: 8px 20px; cursor: pointer; font-size: 14px;
  transition: background-color .2s var(--ease), border-color .2s var(--ease), transform .1s;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  white-space: nowrap;
}
button:hover { background: var(--bg-hover); }
button:active { transform: scale(.97); }
button.primary {
  background: var(--accent); border: 1px solid var(--accent); color: #fff; font-weight: 400;
}
button.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
button:disabled { opacity: .35; cursor: not-allowed; }

input[type="text"] {
  font: inherit; color: var(--text); background: var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--r-pill);
  padding: 10px 18px; outline: none; font-size: 15px;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
input[type="text"]::placeholder { color: var(--text3); }
input[type="text"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.container { max-width: 1080px; margin: 0 auto; padding: 0 24px 140px; }

/* ---------- 动画 ---------- */
@keyframes fadeInUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideInRight { from { opacity: 0; transform: translateX(8px); } to { opacity: 1; transform: translateX(0); } }
@keyframes spin { to { transform: rotate(360deg); } }

/* 统一加载 spinner — Apple 风格旋转圆环 */
.spinner {
  width: 28px; height: 28px; border-radius: 50%;
  border: 2.5px solid transparent;
  animation: spin .7s linear infinite;
}
.spinner-light { border-color: rgba(255,255,255,.2); border-top-color: rgba(255,255,255,.8); }
.spinner-dark { border-color: var(--bg-hover); border-top-color: var(--text3); }

/* ==================== 首页 ==================== */
.site-header {
  text-align: center; max-width: 1080px; margin: 0 auto;
  padding: calc(env(safe-area-inset-top, 0px) + 64px) 24px 32px;
  animation: fadeInUp .5s var(--ease);
}
.site-header h1 {
  font-size: 40px; font-weight: 600; letter-spacing: -.02em; line-height: 1.1;
}
.site-header h1 .accent { color: var(--accent); }
.site-header p { color: var(--text2); margin-top: 10px; font-size: 15px; }

/* ---------- 页面切换 ---------- */
.page { display: none; padding: 0 24px 120px; max-width: 1080px; margin: 0 auto; }
.page.active { display: block; }

/* ---------- 搜索页 ---------- */
.search-bar {
  display: flex; gap: 10px; max-width: 600px; margin: 28px auto 8px;
  animation: fadeInUp .5s .06s both var(--ease);
}
.search-input-wrap { flex: 1; position: relative; display: flex; align-items: center; }
.search-input-wrap .icon {
  position: absolute; left: 16px; width: 18px; height: 18px; color: var(--text3);
  pointer-events: none; transition: color .2s;
}
.search-input-wrap:focus-within .icon { color: var(--accent); }
.search-bar input {
  flex: 1; font-size: 16px; padding-left: 46px;
  box-shadow: var(--shadow-sm);
}
.search-bar input:focus { box-shadow: 0 0 0 3px var(--accent-light), var(--shadow-sm); }

/* 热门标签栏 */
.tag-bar {
  display: flex; flex-wrap: nowrap; gap: 8px;
  max-width: 600px; margin: 20px auto 0;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  scrollbar-width: none; padding-bottom: 4px;
  animation: fadeInUp .5s .18s both var(--ease);
}
.tag-bar::-webkit-scrollbar { display: none; }
.tag-chip {
  flex-shrink: 0; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--r-pill);
  padding: 6px 16px; font-size: 13px; color: var(--text2); cursor: pointer;
  transition: all .2s var(--ease); user-select: none;
  box-shadow: var(--shadow-xs); -webkit-tap-highlight-color: transparent;
}
.tag-chip:hover { border-color: var(--text3); color: var(--text); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.tag-chip.active { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }

/* ---------- 加入页 ---------- */
.join-box {
  max-width: 400px; margin: 60px auto 0; text-align: center;
  background: var(--bg-card); border: 1px solid var(--border-light);
  border-radius: var(--r-xl); box-shadow: var(--shadow-lg);
  padding: 48px 32px;
  animation: fadeInUp .5s var(--ease);
}
.join-icon { width: 48px; height: 48px; color: var(--text3); margin-bottom: 16px; }
.join-box h2 { font-size: 22px; margin-bottom: 8px; }
.join-box p { color: var(--text3); font-size: 14px; margin-bottom: 28px; }
.join-input-row { display: flex; gap: 10px; justify-content: center; }
.join-input-row input {
  width: 180px; text-align: center; letter-spacing: 4px; font-size: 18px;
  font-family: var(--font-mono); font-weight: 500;
}
.join-input-row input::placeholder { letter-spacing: 0; font-weight: 400; font-family: var(--font); font-size: 15px; }
.join-input-row button { padding: 10px 24px; font-size: 15px; }

/* ---------- 底部导航 ---------- */
:root {
  --nav-h: 44px;
  --nav-bg: rgba(255,255,255,.78);
  --nav-sheen: linear-gradient(135deg, rgba(255,255,255,.6), rgba(255,255,255,.2) 45%, rgba(255,255,255,.4));
  --nav-border: rgba(0,0,0,.08);
  --nav-blur: blur(40px) saturate(1.8) brightness(1.02);
  --nav-shadow: inset 0 1px 0 rgba(255,255,255,.9), inset 0 -1px 0 rgba(0,0,0,.03), 0 8px 24px rgba(0,0,0,.10), 0 2px 6px rgba(0,0,0,.06);
  --accent-soft: rgba(0,113,227,.10);
}

#bottomnav {
  position: fixed; z-index: 50;
  left: 10px; right: 10px; bottom: calc(env(safe-area-inset-bottom, 0px) + 8px);
  height: var(--nav-h); max-width: 260px; margin: 0 auto;
  background: var(--nav-sheen), var(--nav-bg);
  backdrop-filter: var(--nav-blur);
  -webkit-backdrop-filter: var(--nav-blur);
  border: 1px solid var(--nav-border);
  border-radius: 999px;
  box-shadow: var(--nav-shadow);
  display: flex; padding: 3px;
  transition: border-color .35s, box-shadow .35s;
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}

.nav-indicator {
  position: absolute; top: 3px; bottom: 3px; left: 3px; width: 33.33%;
  border-radius: 999px;
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px rgba(0,113,227,.22);
  transform: translateX(0);
  transition: transform .38s cubic-bezier(.3,1.35,.4,1), width .38s cubic-bezier(.3,1.35,.4,1);
  pointer-events: none; z-index: 0; will-change: transform;
}
#bottomnav.dragging .nav-indicator { transition: none; }

.nav-item {
  flex: 1; border: none; background: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text3);
  border-radius: 999px; transition: color .25s; position: relative; z-index: 1;
  -webkit-tap-highlight-color: transparent;
}
.nav-item:hover { background: none; }
.nav-item:active { background: none; color: var(--accent); }
.nav-item:focus { outline: none; }
.nav-item svg { width: 18px; height: 18px; transition: all .2s; }
.nav-item.active { color: var(--accent); }
.nav-item.active:active { color: var(--accent); }
.nav-item.active svg { filter: drop-shadow(0 0 5px rgba(0,113,227,.40)); }

/* 区块标题 */
.section-title {
  display: flex; align-items: center; gap: 12px;
  font-size: 17px; font-weight: 600; color: var(--text);
  margin: 40px 0 18px; letter-spacing: -.01em;
  animation: fadeInUp .4s var(--ease);
}
.section-title::after {
  content: ''; flex: 1; height: 1px;
  background: var(--border-light); margin-left: 12px; order: 2;
}
/* 右侧操作按钮（如「换一批」），排在横线之后 */
.section-title .more-btn {
  order: 3; margin-left: 0;
  padding: 5px 14px; font-size: 13px; font-weight: 500;
  background: var(--bg-card); color: var(--text2);
  border: 1px solid var(--border); border-radius: var(--r-pill);
  cursor: pointer; transition: all .2s var(--ease);
  -webkit-tap-highlight-color: transparent; white-space: nowrap;
}
.section-title .more-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.section-title .more-btn:active:not(:disabled) { transform: scale(.96); }
.section-title .more-btn:disabled { opacity: .55; cursor: default; }

.load-more-btn {
  display: block; margin: 28px auto 0; padding: 10px 32px;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--r-pill);
  font-size: 14px; color: var(--text2); cursor: pointer;
  transition: all .2s var(--ease); -webkit-tap-highlight-color: transparent;
}
.load-more-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.load-more-btn:active:not(:disabled) { transform: scale(.97); }
.load-more-btn:disabled { opacity: .5; cursor: default; }

.results {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 20px; margin-top: 18px;
}

/* 搜索结果卡片 */
.card {
  background: var(--bg-card); border-radius: var(--r-md); overflow: hidden;
  cursor: pointer; position: relative;
  box-shadow: var(--shadow-sm);
  transition: transform .2s var(--ease), box-shadow .2s var(--ease);
  animation: fadeInUp .4s both var(--ease);
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.card:active { transform: translateY(-2px); }
.card .cover-wrap { position: relative; width: 100%; aspect-ratio: 3/4; background: var(--bg); overflow: hidden; }
.card .cover { width: 100%; height: 100%; object-fit: cover; display: block; }
.card .cover-fallback {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 28px; color: var(--text3); background: var(--bg);
}
.card .cover-badge {
  position: absolute; top: 8px; right: 8px; background: rgba(0,0,0,.6);
  color: var(--warn); font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: var(--r-pill);
  font-family: var(--font-mono); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.card .source-badge {
  position: absolute; bottom: 8px; left: 8px; font-size: 10px; font-weight: 600;
  padding: 2px 6px; border-radius: var(--r-pill); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  letter-spacing: .5px;
}
.card .source-badge.source-xf { background: rgba(0,113,227,.85); color: #fff; }
.card .source-badge.source-lm { background: rgba(52,199,89,.85); color: #fff; }
.card .source-badge.source-tf { background: rgba(175,82,222,.85); color: #fff; }
.card .info { padding: 12px 14px; }
.card .title { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .meta { font-size: 11px; color: var(--text2); margin-top: 4px; display: flex; gap: 8px; align-items: center; font-family: var(--font-mono); }
.card .score { color: var(--warn); font-weight: 600; }

/* 骨架屏 — 统一 spinner */
.skeleton-card {
  background: var(--bg-card); border-radius: var(--r-md); overflow: hidden;
  box-shadow: var(--shadow-xs); display: flex; align-items: center; justify-content: center;
  min-height: 200px;
}
.skeleton-card .spinner { width: 24px; height: 24px; }

.status-msg { text-align: center; color: var(--text2); padding: 56px 0; animation: fadeIn .3s; font-size: 15px; }
.error-msg { color: var(--danger); }

/* ==================== 房间页 ==================== */
.room-page { display: flex; flex-direction: column; height: 100vh; background: var(--bg); }

/* 头部 */
.room-header {
  display: flex; align-items: center; gap: 14px; padding: 12px 24px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0; z-index: 10;
}
.room-header .rtitle {
  font-weight: 500; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  flex: 1; min-width: 0;
}
.room-header .rcode {
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--r-sm);
  padding: 5px 14px; font-size: 14px; letter-spacing: 2px; font-weight: 500; cursor: pointer;
  user-select: all; transition: border-color .2s, background-color .2s; font-family: var(--font-mono);
}
.room-header .rcode:hover { border-color: var(--text3); background: var(--bg-hover); }
.room-header .online { color: var(--text2); font-size: 13px; display: flex; align-items: center; gap: 6px; }
.room-header .online::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--success); }
.room-header .online b { color: var(--text); font-family: var(--font-mono); font-weight: 500; }

/* 侧边栏房间信息卡片 */
.sidebar .room-info {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--r-md);
  padding: 8px 12px;
  margin: 10px 12px 6px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background-color .2s;
}
.sidebar .room-info:hover { border-color: var(--text3); background: var(--bg-hover); }
.sidebar .room-info-label {
  font-size: 10px; color: var(--text2); letter-spacing: 1px; text-transform: uppercase;
  margin-bottom: 3px;
}
.sidebar .room-info-code {
  font-size: 16px; font-weight: 600; letter-spacing: 3px; font-family: var(--font-mono);
  color: var(--text); user-select: all; line-height: 1.2;
}
.sidebar .room-info-hint {
  font-size: 10px; color: var(--text3); margin-top: 3px;
}

.room-main { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.player-col {
  display: flex; flex-direction: column; min-width: 0;
  background: var(--bg); position: relative; padding: 16px;
}
.video-wrap {
  position: relative; background: #000; margin: auto;
  width: 100%; aspect-ratio: var(--video-aspect, 16/9);
  max-height: 100%; max-width: 100%;
  border-radius: var(--r-lg); overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.video-wrap.hide-cursor { cursor: none; }
video { width: 100%; height: 100%; object-fit: fill; background: #000; }

/* 全屏 — 去除留白、圆角、阴影，黑色铺满 */
.player-col:fullscreen,
.player-col:-webkit-full-screen {
  padding: 0; background: #000; display: flex; align-items: center; justify-content: center;
}
.player-col:fullscreen .video-wrap,
.player-col:-webkit-full-screen .video-wrap {
  border-radius: 0; box-shadow: none; width: 100%; height: 100%;
  max-width: 100%; max-height: 100%; aspect-ratio: auto;
}
.player-col:fullscreen video,
.player-col:-webkit-full-screen video {
  object-fit: contain; width: 100%; height: 100%;
}

/* 缓冲加载 — 统一 spinner */
.buffering {
  position: absolute; inset: 0; display: none; align-items: center; justify-content: center;
  z-index: 4; pointer-events: none;
}
.buffering.show { display: flex; animation: fadeIn .2s; }

/* overlay */
.overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column; gap: 14px;
  align-items: center; justify-content: center;
  background: rgba(0,0,0,.72); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  color: rgba(255,255,255,.6); text-align: center; padding: 24px; z-index: 6;
  animation: fadeIn .3s;
}
.overlay.hidden { display: none; }
.overlay .big { font-size: 18px; color: #fff; font-weight: 500; }
.overlay #overlayBtn { margin-top: 4px; font-size: 15px; padding: 10px 28px; }

/* 居中播放按钮 */
.center-play {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  width: 72px; height: 72px; border-radius: 50%; border: none;
  background: rgba(0,0,0,.5); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  display: flex; align-items: center; justify-content: center; z-index: 5;
  cursor: pointer; transition: transform .2s var(--ease-spring), background-color .2s; animation: fadeIn .2s;
}
.center-play:hover { transform: translate(-50%,-50%) scale(1.1); background: rgba(0,0,0,.65); }
.center-play:active { transform: translate(-50%,-50%) scale(.95); }
.center-play svg { width: 32px; height: 32px; fill: #fff; margin-left: 4px; }

/* 浮动控制层 */
/* 控制层：覆盖在视频上方 */
.player-controls {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 5;
  padding: 20px 16px 12px;
  background: linear-gradient(to top, rgba(0,0,0,.6) 0%, rgba(0,0,0,.3) 50%, transparent 100%);
  opacity: 1; transition: opacity .25s ease, visibility .25s;
  visibility: visible;
}
.player-controls.hidden { opacity: 0; visibility: hidden; pointer-events: none; }

/* 进度条 */
.progress-bar {
  height: 4px; background: rgba(255,255,255,.15); border-radius: 2px;
  position: relative; cursor: pointer; margin-bottom: 10px;
  transition: height .15s;
}
.progress-bar:hover { height: 6px; }
.progress-bar .buffered {
  position: absolute; left: 0; top: 0; bottom: 0; border-radius: 2px; width: 0;
  background: rgba(255,255,255,.2);
}
.progress-bar .played {
  position: absolute; left: 0; top: 0; bottom: 0; border-radius: 2px; width: 0;
  background: #fff; transition: width .1s linear;
}
.progress-bar .knob {
  position: absolute; top: 50%; width: 13px; height: 13px; border-radius: 50%;
  background: #fff; transform: translate(-50%,-50%) scale(0); left: 0;
  transition: transform .15s; box-shadow: 0 1px 4px rgba(0,0,0,.3);
}
.progress-bar:hover .knob { transform: translate(-50%,-50%) scale(1); }
.progress-bar.disabled { cursor: default; }
.progress-bar.disabled:hover { height: 4px; }
.progress-bar.disabled .knob { transform: translate(-50%,-50%) scale(0); }

/* 控制行 */
.controls-row { display: flex; align-items: center; gap: 8px; }

.ctrl-btn {
  width: 36px; height: 36px; padding: 0; border: none; border-radius: 50%;
  background: transparent; flex-shrink: 0; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background-color .15s;
}
.ctrl-btn:hover { background: rgba(255,255,255,.12); }
.ctrl-btn:active { background: rgba(255,255,255,.2); }
.ctrl-btn svg { width: 22px; height: 22px; fill: rgba(255,255,255,.85); }

/* 缩小版控制按钮（前进/后退/播放暂停） */
.ctrl-btn-sm { width: 30px; height: 30px; }
.ctrl-btn-sm svg { width: 18px; height: 18px; }

/* 音量组 */
.volume-group { display: flex; align-items: center; gap: 2px; }
.volume-bar {
  width: 0; height: 4px; background: rgba(255,255,255,.2); border-radius: 2px;
  position: relative; overflow: hidden; cursor: pointer;
  transition: width .2s;
}
.volume-group:hover .volume-bar { width: 64px; }
.volume-fill {
  position: absolute; left: 0; top: 0; bottom: 0; border-radius: 2px;
  background: rgba(255,255,255,.85); width: 100%;
}

.time-label { font-size: 12px; color: rgba(255,255,255,.7); font-family: var(--font-mono); flex-shrink: 0; user-select: none; }
.ctrl-spacer { flex: 1; }
.host-badge { font-size: 11px; color: rgba(255,255,255,.4); flex-shrink: 0; user-select: none; }
.host-badge b { color: var(--accent); font-weight: 500; }

/* 侧栏 */
.sidebar {
  flex: 1; display: flex; flex-direction: column; min-height: 0;
  background: var(--bg-card);
  border-top: 1px solid var(--border-light);
}
.tabs { display: flex; border-bottom: 1px solid var(--border-light); flex-shrink: 0; padding: 0 16px; }
.tabs button {
  flex: 1; border: none; background: none; border-radius: 0; padding: 14px;
  color: var(--text2); border-bottom: 2px solid transparent; transition: color .2s, border-color .2s;
  font-size: 14px; font-weight: 400;
}
.tabs button:hover { color: var(--text); background: transparent; }
.tabs button.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 500; }

.tab-panel { flex: 1; min-height: 0; display: none; flex-direction: column; }
.tab-panel.active { display: flex; animation: fadeIn .2s; }

/* 聊天 */
.chat-list { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.chat-msg { font-size: 14px; word-break: break-word; animation: slideInRight .2s var(--ease); line-height: 1.4; }
.chat-msg .name { color: var(--accent); font-weight: 500; margin-right: 6px; }
.chat-msg.system { color: var(--text3); font-size: 12px; text-align: center; padding: 4px 0; }
.chat-input { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border-light); flex-shrink: 0; }
.chat-input input { flex: 1; }

/* 用户列表 */
.user-list { padding: 10px 16px; border-bottom: 1px solid var(--border-light); display: flex; flex-wrap: wrap; gap: 6px; flex-shrink: 0; }
.user-chip {
  background: var(--bg); border-radius: var(--r-pill); padding: 4px 12px; font-size: 12px;
  display: flex; align-items: center; gap: 5px; border: 1px solid var(--border-light);
}
.user-chip::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--success); }
.user-chip.host { border-color: var(--accent); color: var(--accent); }
.user-chip.host::before { background: var(--accent); }

/* 剧集 */
.ep-panel { flex: 1; overflow-y: auto; padding: 16px; }
.ep-panel #epTitle { font-size: 14px; color: var(--text2); margin-bottom: 12px; }

/* 动漫信息卡片 */
.anime-info { display: flex; gap: 14px; margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--border-light); }
.anime-cover { width: 80px; height: 106px; object-fit: cover; border-radius: var(--r-sm); flex-shrink: 0; background: var(--bg); box-shadow: var(--shadow-sm); }
.anime-meta { flex: 1; min-width: 0; }
.anime-title { font-size: 16px; font-weight: 600; line-height: 1.3; letter-spacing: -.01em; }
.anime-sub { font-size: 11px; color: var(--text3); margin-top: 4px; font-family: var(--font-mono); }
.anime-desc { font-size: 12px; color: var(--text2); margin-top: 8px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.line-selector { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.line-selector button { padding: 5px 14px; font-size: 12px; }

/* 播放源徽章 */
.play-source-badge {
  font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 6px;
  white-space: nowrap; line-height: 1.4;
}
.play-source-badge.src-xf { background: rgba(0,113,227,.12); color: #0071E3; }
.play-source-badge.src-lm { background: rgba(52,199,89,.12); color: #1a8c3a; }
.play-source-badge.src-tf { background: rgba(175,82,222,.12); color: #af52de; }

/* 换源按钮 */
.switch-source-btn {
  font-size: 12px; padding: 3px 10px; border-radius: var(--r-pill);
  background: var(--bg); border: 1px solid var(--border); color: var(--text2);
  cursor: pointer; transition: all .2s; font-weight: 500;
}
.switch-source-btn:hover { background: var(--bg-hover); color: var(--text); border-color: var(--text3); }

/* 换源下拉 */
.source-dropdown {
  position: absolute; z-index: 20; margin-top: 4px;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--r-md); box-shadow: var(--shadow-lg);
  min-width: 140px; overflow: hidden;
}
.source-dropdown-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 14px; cursor: pointer; transition: background .15s;
  font-size: 13px;
}
.source-dropdown-item:hover { background: var(--bg-hover); }
.source-dropdown-item.current { color: var(--text3); cursor: default; }
.source-dropdown-item.current:hover { background: transparent; }
.source-dropdown-item .src-current { font-size: 11px; color: var(--text3); }
.line-selector button.active { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }
.ep-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(54px, 1fr)); gap: 8px; }
.ep-grid button {
  padding: 10px 4px; font-size: 12px; text-align: center;
  transition: background-color .15s, border-color .15s, transform .1s;
  font-family: var(--font-mono); border-radius: var(--r-sm);
}
.ep-grid button:hover:not(.active):not(:disabled) { border-color: var(--text3); transform: translateY(-1px); }
.ep-grid button.active { background: var(--accent); border: 1px solid var(--accent); color: #fff; }
.ep-grid button.unavailable { opacity: .25; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h, 44px) + env(safe-area-inset-bottom, 0px) + 28px);
  transform: translateX(-50%);
  background: var(--bg-card); border: 1px solid var(--border);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  color: var(--text); padding: 11px 20px; border-radius: var(--r-pill);
  font-size: 13px; font-weight: 600; z-index: 999; opacity: 0; pointer-events: none; max-width: 80vw;
  box-shadow: var(--shadow-lg);
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; }

/* 移动端 */
@media (max-width: 760px) {
  .room-header { padding: 10px 14px; gap: 10px; }
  .room-header .rtitle { font-size: 13px; }
  .player-col { padding: 10px; }
  .video-wrap { border-radius: var(--r-md); }
  .results { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; }
  .site-header { padding: 40px 16px 20px; }
  .site-header h1 { font-size: 30px; }
  .page { padding: 0 16px 100px; }
  .host-badge { display: none; }
  .tabs { padding: 0 12px; }
  .chat-list { padding: 12px; }
  .chat-input { padding: 10px 12px; }
  .ep-panel { padding: 12px; }
  /* 底部导航移动端 */
  #bottomnav { max-width: 220px; }
  /* 加入页移动端 */
  .join-box { margin: 30px auto 0; padding: 32px 20px; }
  .join-input-row { flex-direction: column; align-items: center; }
  .join-input-row input { width: 100%; }
  .join-input-row button { width: 100%; }
}

/* iOS 兜底原生控件临时样式 */
video.temp-native-controls {
  position: relative;
  z-index: 10;
}

/* CSS 伪全屏 — 当 Fullscreen API 全部失败时的终极兜底 */
.player-col.fake-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 99999;
  padding: 0;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.player-col.fake-fullscreen .video-wrap {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: auto;
  border-radius: 0;
  box-shadow: none;
}
.player-col.fake-fullscreen video {
  object-fit: contain;
  width: 100%;
  height: 100%;
}
.player-col.fake-fullscreen .player-controls {
  z-index: 100000;
}
/* 伪全屏退出提示 */
.player-col.fake-fullscreen::after {
  content: '点击全屏按钮退出';
  position: fixed;
  top: env(safe-area-inset-top, 10px);
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,.7);
  font-size: 13px;
  background: rgba(0,0,0,.5);
  padding: 6px 16px;
  border-radius: 20px;
  z-index: 100001;
  pointer-events: none;
  animation: fadeIn .3s;
}

/* 倍速选择器 */
.speed-group { position: relative; }
#speedBtn { font-size: 12px; font-family: var(--font-mono); color: rgba(255,255,255,.85); user-select: none; }
#speedBtn:hover { background: rgba(255,255,255,.12); }
#speedBtn:active { background: rgba(255,255,255,.2); }
.speed-menu {
  position: absolute;
  bottom: calc(100% + 6px);
  right: 0;
  min-width: 72px;
  background: rgba(20,20,28,.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 10px;
  padding: 4px;
  display: none;
  z-index: 10000;
  box-shadow: 0 4px 20px rgba(0,0,0,.4);
}
.speed-menu.show { display: block; }
.speed-menu button {
  display: block;
  width: 100%;
  padding: 7px 16px;
  background: none;
  border: none;
  color: rgba(255,255,255,.85);
  font-size: 13px;
  cursor: pointer;
  border-radius: 6px;
  transition: background .15s, color .15s;
  text-align: center;
}
.speed-menu button:hover { background: rgba(255,255,255,.12); }
.speed-menu button:active { background: rgba(255,255,255,.2); }
.speed-menu button.active { color: rgba(255,255,255,.85); font-weight: 600; background: rgba(255,255,255,.1); }
