/* =========================================================
   OSE Medical H5 · 医学直播与学术会议
   移动端优先，适配微信公众号内置浏览器
   ========================================================= */

:root {
  --blue: #0b57d0;
  --blue-2: #1b7cf5;
  --blue-3: #57a5ff;
  --blue-soft: #e8f1ff;
  --cyan: #10c2b4;
  --gold: #f3b23c;
  --bg: #f2f5fa;
  --card: #ffffff;
  --text: #101828;
  --text-2: #475467;
  --sub: #7b8798;
  --line: #edf0f5;
  --danger: #e5484d;
  --warn: #f79009;
  --radius: 16px;
  --shadow: 0 6px 20px rgba(16, 42, 92, 0.06);
  --tabbar-h: 62px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

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

html, body {
  margin: 0;
  padding: 0;
  background: #e8edf6;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body { overscroll-behavior-y: none; }

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { font-family: inherit; border: 0; background: none; padding: 0; color: inherit; cursor: pointer; }
input, textarea { font-family: inherit; font-size: 15px; outline: none; }
h1, h2, h3, h4, p { margin: 0; }

.app {
  position: relative;
  max-width: 520px;
  min-height: 100vh;
  margin: 0 auto;
  background: var(--bg);
  overflow-x: hidden;
  box-shadow: 0 0 60px rgba(10, 30, 70, 0.18);
}

.boot { padding: 120px 0; text-align: center; color: var(--sub); font-size: 14px; }

@media (min-width: 560px) {
  body { background: radial-gradient(1200px 600px at 50% -10%, #17365f 0%, #0b1729 60%, #070f1c 100%); }
}

/* ---------------- 通用布局 ---------------- */
.page { padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 14px); animation: fadeUp 0.28s ease both; }
.page.no-tab { padding-bottom: calc(88px + var(--safe-b)); }
.section { padding: 18px 16px 0; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.section-title { display: flex; align-items: center; gap: 8px; font-size: 17px; font-weight: 700; letter-spacing: 0.2px; }
.section-title::before {
  content: ""; width: 4px; height: 16px; border-radius: 4px;
  background: linear-gradient(180deg, var(--blue-2), var(--cyan));
}
.section-more { display: flex; align-items: center; gap: 2px; font-size: 12.5px; color: var(--sub); }
.section-more svg { width: 14px; height: 14px; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* ---------------- 顶部栏 ---------------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 10px;
  padding: calc(10px + var(--safe-t)) 16px 10px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar .tb-title { flex: 1; min-width: 0; font-size: 16px; font-weight: 700; }
.topbar .tb-title small { display: block; font-size: 11.5px; font-weight: 400; color: var(--sub); margin-top: 2px; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 50%; color: var(--text-2);
  background: #f3f6fb;
}
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn.ghost { background: transparent; }

/* 首页渐变头 */
.home-head {
  position: relative;
  padding: calc(16px + var(--safe-t)) 18px 46px;
  color: #fff;
  background: linear-gradient(150deg, #073f9e 0%, #0b57d0 45%, #2b8cf7 100%);
  border-radius: 0 0 26px 26px;
  overflow: hidden;
}
.home-head::before,
.home-head::after {
  content: ""; position: absolute; border-radius: 50%;
  background: radial-gradient(circle, rgba(120, 203, 255, 0.5), rgba(120, 203, 255, 0) 70%);
}
.home-head::before { width: 220px; height: 220px; right: -70px; top: -110px; }
.home-head::after { width: 150px; height: 150px; left: -80px; bottom: -80px; opacity: 0.7; }

.brand { position: relative; z-index: 1; display: flex; align-items: center; gap: 11px; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 13px;
  background: #fff; color: var(--blue);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 15px; letter-spacing: 0.5px;
  box-shadow: 0 6px 14px rgba(2, 24, 66, 0.25);
}
.brand-text h1 { font-size: 16.5px; font-weight: 800; letter-spacing: 1.6px; }
.brand-text p { font-size: 11.5px; opacity: 0.8; margin-top: 3px; letter-spacing: 0.6px; }
.brand-actions { margin-left: auto; display: flex; gap: 8px; }
.brand-actions .icon-btn { color: #fff; background: rgba(255, 255, 255, 0.18); }

.searchbar {
  position: relative; z-index: 1;
  display: flex; align-items: center; gap: 8px;
  margin-top: 18px; padding: 11px 14px;
  border-radius: 999px; background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: rgba(255, 255, 255, 0.82); font-size: 13px;
}
.searchbar svg { width: 16px; height: 16px; }

/* ---------------- 首页横幅 ---------------- */
.hero { margin: -34px 16px 0; position: relative; z-index: 2; }
.hero-track {
  display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.hero-track::-webkit-scrollbar { display: none; }
.hero-slide {
  position: relative; flex: 0 0 100%; scroll-snap-align: center;
  aspect-ratio: 16 / 8.4; border-radius: 18px; overflow: hidden;
  background: linear-gradient(135deg, #12325e, #0b57d0);
  box-shadow: 0 12px 24px rgba(9, 38, 88, 0.18);
}
.hero-slide img { width: 100%; height: 100%; object-fit: cover; }
.hero-slide .mask {
  position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(4, 22, 51, 0.82) 0%, rgba(4, 22, 51, 0.35) 55%, rgba(4, 22, 51, 0.05) 100%);
}
.hero-slide .txt { position: absolute; left: 16px; right: 90px; bottom: 14px; color: #fff; }
.hero-slide .tagline {
  display: inline-block; padding: 2px 8px; margin-bottom: 6px;
  font-size: 10px; letter-spacing: 0.6px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.2); border: 1px solid rgba(255, 255, 255, 0.3);
}
.hero-slide h2 { font-size: 15.5px; line-height: 1.35; font-weight: 700; }
.hero-slide p { font-size: 11.5px; opacity: 0.78; margin-top: 4px; }
.hero-dots { display: flex; justify-content: center; gap: 5px; margin-top: 9px; }
.hero-dots i { width: 5px; height: 5px; border-radius: 5px; background: #c6d3e6; transition: all 0.25s; }
.hero-dots i.on { width: 16px; background: linear-gradient(90deg, var(--blue-2), var(--cyan)); }

/* ---------------- 快捷入口 ---------------- */
.quick {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px;
  margin: 14px 16px 0; padding: 16px 6px;
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
}
.quick-item { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.quick-ico {
  width: 44px; height: 44px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center; color: #fff;
}
.quick-ico svg { width: 22px; height: 22px; }
.quick-item span { font-size: 12px; color: var(--text-2); }
.q1 { background: linear-gradient(135deg, #ff6b6b, #e5484d); }
.q2 { background: linear-gradient(135deg, #4b8cf9, #0b57d0); }
.q3 { background: linear-gradient(135deg, #2fd0c4, #0aa39a); }
.q4 { background: linear-gradient(135deg, #ffd066, #f0a020); }
.quick-item:active .quick-ico { transform: scale(0.94); }
.quick-ico { transition: transform 0.15s; }

/* ---------------- 直播卡片 ---------------- */
.live-scroll {
  display: flex; gap: 12px; overflow-x: auto; padding: 2px 16px 4px;
  scroll-snap-type: x proximity; scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.live-scroll::-webkit-scrollbar { display: none; }
.live-scroll .live-card { flex: 0 0 82%; scroll-snap-align: start; }

.live-card {
  display: block; background: var(--card); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); transition: transform 0.16s;
}
.live-card:active { transform: scale(0.985); }

.cover { position: relative; aspect-ratio: 16 / 9; background: linear-gradient(135deg, #17365f, #0b57d0); overflow: hidden; }
.cover img { width: 100%; height: 100%; object-fit: cover; }
.cover .shade { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(3, 18, 42, 0.28), rgba(3, 18, 42, 0) 45%, rgba(3, 18, 42, 0.35)); }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; border-radius: 999px;
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.3px; color: #fff;
}
.badge.living { background: linear-gradient(90deg, #ff5a5f, #e5484d); }
.badge.living i {
  width: 5px; height: 5px; border-radius: 50%; background: #fff;
  animation: pulse 1.4s infinite;
}
.badge.upcoming { background: linear-gradient(90deg, #ffb020, #f79009); }
.badge.replay { background: rgba(20, 33, 55, 0.62); }
.badge.on-cover { position: absolute; left: 10px; top: 10px; }
.badge.academic { background: linear-gradient(90deg, #7b61ff, #5b46d9); }

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.7); }
  70% { box-shadow: 0 0 0 6px rgba(255, 255, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
}

.cover .viewers {
  position: absolute; right: 10px; bottom: 8px;
  display: flex; align-items: center; gap: 4px;
  font-size: 10.5px; color: #fff; padding: 2px 7px;
  background: rgba(8, 18, 36, 0.45); border-radius: 999px;
  backdrop-filter: blur(4px);
}
.cover .viewers svg { width: 12px; height: 12px; }

.live-body { padding: 11px 12px 12px; }
.live-body h3 {
  font-size: 14.5px; line-height: 1.42; font-weight: 600;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.speaker-row { display: flex; align-items: center; gap: 7px; margin-top: 9px; }
.avatar {
  flex: 0 0 auto; width: 28px; height: 28px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-size: 10.5px; font-weight: 600; letter-spacing: 0.3px;
  background: linear-gradient(135deg, #4b8cf9, #0b57d0);
}
.speaker-row .sp-name { font-size: 12px; font-weight: 600; color: var(--text-2); }
.speaker-row .sp-org { font-size: 11px; color: var(--sub); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.speaker-row .sp-main { min-width: 0; }
.sp-badge {
  margin-left: auto; flex: 0 0 auto; font-size: 10px; color: var(--blue);
  background: var(--blue-soft); border-radius: 6px; padding: 2px 6px;
}

.live-meta {
  display: flex; align-items: center; gap: 10px;
  margin-top: 10px; padding-top: 9px; border-top: 1px dashed var(--line);
  font-size: 11.5px; color: var(--sub);
}
.live-meta span { display: inline-flex; align-items: center; gap: 4px; }
.live-meta svg { width: 13px; height: 13px; }
.live-meta .price { margin-left: auto; color: var(--danger); font-weight: 700; font-size: 13px; }
.live-meta .price.free { color: var(--cyan); }

/* 首页预告列表 */
.up-row {
  display: flex; gap: 12px; padding: 10px; margin-bottom: 10px;
  background: var(--card); border-radius: 14px; box-shadow: var(--shadow);
}
.up-row .thumb {
  position: relative; flex: 0 0 112px; height: 70px; border-radius: 10px; overflow: hidden;
  background: linear-gradient(135deg, #1c3f73, #0b57d0);
}
.up-row .thumb img { width: 100%; height: 100%; object-fit: cover; }
.up-row .thumb .badge { position: absolute; left: 6px; top: 6px; transform: scale(0.9); transform-origin: left top; }
.up-row .info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.up-row .info h3 {
  font-size: 13.5px; line-height: 1.4; font-weight: 600;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.up-row .info .sub { margin-top: auto; display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--sub); }
.up-row .info .sub svg { width: 12px; height: 12px; }
.up-row .info .sub b { color: var(--text-2); font-weight: 500; }

/* ---------------- 资讯 ---------------- */
.news-feature {
  position: relative; display: block; border-radius: var(--radius); overflow: hidden;
  aspect-ratio: 16 / 8.6; background: linear-gradient(135deg, #17365f, #0b57d0); box-shadow: var(--shadow);
}
.news-feature img { width: 100%; height: 100%; object-fit: cover; }
.news-feature .shade { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(4, 20, 46, 0.05) 30%, rgba(4, 20, 46, 0.86) 100%); }
.news-feature .txt { position: absolute; left: 14px; right: 14px; bottom: 12px; color: #fff; }
.news-feature .kicker { font-size: 10.5px; opacity: 0.8; margin-bottom: 5px; }
.news-feature h3 { font-size: 15px; line-height: 1.4; font-weight: 700; }

.news-row { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.news-row:last-child { border-bottom: 0; }
.news-row .txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.news-row h3 {
  font-size: 14px; line-height: 1.45; font-weight: 600;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.news-row .meta { margin-top: auto; padding-top: 8px; font-size: 11px; color: var(--sub); display: flex; align-items: center; gap: 8px; }
.news-row .thumb {
  flex: 0 0 100px; height: 74px; border-radius: 10px; overflow: hidden;
  background: linear-gradient(135deg, #1c3f73, #0b57d0);
}
.news-row .thumb img { width: 100%; height: 100%; object-fit: cover; }

.case-tag {
  display: inline-block; padding: 1px 6px; border-radius: 5px;
  font-size: 10px; color: #7a4bd0; background: #f1ebff; margin-right: 4px;
}

/* ---------------- 筛选 ---------------- */
.filter-bar {
  position: sticky; top: calc(54px + var(--safe-t)); z-index: 30;
  background: rgba(242, 245, 250, 0.96);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  padding: 8px 0 6px;
}
.chip-scroll {
  display: flex; gap: 8px; padding: 0 16px; overflow-x: auto;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.chip-scroll::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; padding: 6px 13px; border-radius: 999px;
  font-size: 12.5px; color: var(--text-2); background: #fff;
  border: 1px solid var(--line); transition: all 0.18s;
}
.chip.on {
  color: #fff; border-color: transparent;
  background: linear-gradient(120deg, var(--blue), var(--blue-2));
  box-shadow: 0 4px 10px rgba(11, 87, 208, 0.24);
}
.status-row { display: flex; gap: 16px; padding: 10px 16px 2px; font-size: 12.5px; color: var(--sub); }
.status-row .st { position: relative; padding-bottom: 6px; }
.status-row .st.on { color: var(--blue); font-weight: 600; }
.status-row .st.on::after {
  content: ""; position: absolute; left: 50%; bottom: 0; transform: translateX(-50%);
  width: 16px; height: 3px; border-radius: 3px; background: var(--blue);
}

.empty { padding: 70px 20px; text-align: center; color: var(--sub); font-size: 13px; }
.empty .ico {
  width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 20px;
  background: #fff; display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow); color: #b7c4d6;
}
.empty .ico svg { width: 28px; height: 28px; }

/* ---------------- 直播间 ---------------- */
.room-top { background: #0b1220; }
.room-nav {
  position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 10px;
  padding: calc(9px + var(--safe-t)) 14px 9px;
  background: rgba(255, 255, 255, 0.95); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.room-nav .t { flex: 1; min-width: 0; font-size: 15px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.video-stage {
  position: relative; aspect-ratio: 16 / 9; overflow: hidden;
  background: #060c16; color: #fff;
}
.video-stage img { width: 100%; height: 100%; object-fit: cover; opacity: 0.55; filter: saturate(0.9); }
.video-stage .live-video { width: 100%; height: 100%; display: block; object-fit: contain; background: #000; }
.video-stage .veil { position: absolute; inset: 0; background: radial-gradient(circle at 50% 45%, rgba(6, 12, 22, 0.2), rgba(6, 12, 22, 0.82)); }
.play-btn {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 62px; height: 62px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, 0.16); border: 1px solid rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(6px); color: #fff;
}
.play-btn svg { width: 24px; height: 24px; margin-left: 3px; }
.stage-top { position: absolute; left: 12px; top: 12px; display: flex; gap: 6px; align-items: center; }
.stage-bottom { position: absolute; left: 12px; right: 12px; bottom: 10px; display: flex; align-items: center; gap: 8px; font-size: 11px; color: rgba(255, 255, 255, 0.85); }
.stage-bottom .dot { width: 4px; height: 4px; border-radius: 50%; background: rgba(255, 255, 255, 0.5); }

.room-info { background: #fff; padding: 14px 16px 16px; border-radius: 0 0 18px 18px; }
.room-info h1 { font-size: 17px; line-height: 1.42; font-weight: 700; }
.room-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.tag {
  font-size: 10.5px; color: var(--blue); background: var(--blue-soft);
  padding: 3px 8px; border-radius: 6px;
}
.tag.grey { color: var(--sub); background: #f4f6fa; }
.tag.red { color: var(--danger); background: #fdecec; }

.speaker-card {
  display: flex; align-items: center; gap: 11px;
  margin: 14px 16px 0; padding: 13px 14px;
  background: #fff; border-radius: 14px; box-shadow: var(--shadow);
}
.speaker-card .avatar { width: 46px; height: 46px; font-size: 14px; }
.speaker-card .sc-main { flex: 1; min-width: 0; }
.speaker-card .sc-name { font-size: 14.5px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.speaker-card .sc-name .v {
  font-size: 9.5px; font-weight: 500; color: #b07800; background: #fff5dd;
  padding: 1px 5px; border-radius: 4px;
}
.speaker-card .sc-org { font-size: 11.5px; color: var(--sub); margin-top: 3px; }
.speaker-card .sc-role { font-size: 11px; color: var(--text-2); margin-top: 2px; }
.speaker-card .follow {
  flex: 0 0 auto; font-size: 12px; color: var(--blue); padding: 6px 12px;
  border: 1px solid #c9dcfb; border-radius: 999px;
}
.speaker-card .follow.on { color: var(--sub); border-color: var(--line); background: #f7f9fc; }

.panel-tabs {
  display: flex; gap: 22px; padding: 0 16px; margin-top: 16px;
  background: #fff; border-bottom: 1px solid var(--line);
}
.panel-tab {
  position: relative; padding: 12px 2px 11px; font-size: 14px; color: var(--sub);
}
.panel-tab.on { color: var(--text); font-weight: 700; }
.panel-tab.on::after {
  content: ""; position: absolute; left: 50%; transform: translateX(-50%);
  bottom: 0; width: 22px; height: 3px; border-radius: 3px;
  background: linear-gradient(90deg, var(--blue), var(--cyan));
}
.panel { background: #fff; padding: 16px; min-height: 220px; }
.panel p { font-size: 14px; line-height: 1.78; color: var(--text-2); margin-bottom: 10px; }

.agenda-item { display: flex; gap: 12px; padding: 11px 0; border-bottom: 1px dashed var(--line); }
.agenda-item:last-child { border-bottom: 0; }
.agenda-time { flex: 0 0 46px; font-size: 12px; color: var(--blue); font-weight: 600; padding-top: 1px; }
.agenda-main { flex: 1; }
.agenda-main h4 { font-size: 13.5px; font-weight: 600; line-height: 1.5; }
.agenda-main p { font-size: 11.5px; color: var(--sub); margin: 3px 0 0; }

.chat-list { display: flex; flex-direction: column; gap: 10px; max-height: 320px; overflow-y: auto; padding-right: 2px; }
.chat-sys { text-align: center; font-size: 11px; color: #a0aec0; padding: 4px 0; }
.chat-item { display: flex; gap: 8px; }
.chat-item .avatar { width: 30px; height: 30px; font-size: 10px; }
.chat-main { max-width: 78%; }
.chat-name { font-size: 10.5px; color: var(--sub); margin-bottom: 3px; }
.chat-bubble {
  display: inline-block; padding: 8px 11px; border-radius: 12px;
  background: #f4f7fb; font-size: 13px; line-height: 1.55; color: var(--text-2);
  border-top-left-radius: 4px; word-break: break-word;
}
.chat-item.mine { flex-direction: row-reverse; }
.chat-item.mine .chat-name { text-align: right; }
.chat-item.mine .chat-bubble { background: linear-gradient(120deg, var(--blue), var(--blue-2)); color: #fff; border-top-left-radius: 12px; border-top-right-radius: 4px; }
.chat-item.mine .avatar { background: linear-gradient(135deg, #2fd0c4, #0aa39a); }

.chat-inputbar { display: flex; gap: 8px; margin-top: 12px; }
.chat-inputbar input {
  flex: 1; min-width: 0; background: #f4f7fb; border: 1px solid var(--line);
  border-radius: 999px; padding: 9px 14px; font-size: 13px;
}
.chat-inputbar button {
  flex: 0 0 auto; padding: 0 16px; border-radius: 999px; color: #fff;
  background: linear-gradient(120deg, var(--blue), var(--blue-2)); font-size: 13px;
}

.room-actions {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; z-index: 45;
  width: 100%; max-width: 520px;
  display: flex; align-items: center; gap: 10px;
  padding: 9px 16px calc(9px + var(--safe-b));
  background: rgba(255, 255, 255, 0.97); border-top: 1px solid var(--line);
  backdrop-filter: blur(12px);
}
.room-actions .act {
  flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 10px; color: var(--sub); width: 44px;
}
.room-actions .act svg { width: 20px; height: 20px; }
.room-actions .act.on { color: var(--blue); }
.btn-primary {
  flex: 1; height: 44px; border-radius: 999px; color: #fff; font-size: 14.5px; font-weight: 600;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  background: linear-gradient(120deg, #0b57d0, #2b8cf7);
  box-shadow: 0 6px 16px rgba(11, 87, 208, 0.28);
}
.btn-primary.grey { background: #eef2f8; color: var(--sub); box-shadow: none; }
.btn-primary.done { background: #edf7f4; color: #0aa39a; box-shadow: none; }

.countdown {
  display: flex; align-items: center; gap: 6px; margin-top: 12px;
  padding: 9px 12px; border-radius: 10px; background: #fff8e9;
  font-size: 12px; color: #a86a00;
}
.countdown b { font-size: 15px; letter-spacing: 0.5px; color: #e07800; font-variant-numeric: tabular-nums; }

/* ---------------- 资讯详情 ---------------- */
.article-hero { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: linear-gradient(135deg, #17365f, #0b57d0); }
.article-hero img { width: 100%; height: 100%; object-fit: cover; }
.article-hero .shade { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(4, 18, 40, 0) 45%, rgba(4, 18, 40, 0.55)); }
.article-head { padding: 16px 16px 0; background: #fff; }
.article-head h1 { font-size: 20px; line-height: 1.42; font-weight: 700; letter-spacing: 0.2px; }
.article-meta { display: flex; align-items: center; gap: 10px; margin-top: 10px; font-size: 11.5px; color: var(--sub); }
.article-meta .avatar { width: 24px; height: 24px; font-size: 9.5px; }
.article-body { padding: 14px 16px 24px; background: #fff; }
.article-body p { font-size: 15px; line-height: 1.85; color: #2b3444; margin-bottom: 16px; text-align: justify; }
.article-body .lead { font-size: 14px; color: var(--text-2); background: #f5f8fd; border-left: 3px solid var(--blue-2); padding: 10px 12px; border-radius: 0 8px 8px 0; }
.article-body h3 { font-size: 16px; margin: 4px 0 12px; }
.article-tags { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 18px; background: #fff; }
.article-note { margin: 0 16px 16px; padding: 12px 14px; border-radius: 12px; background: #fff; font-size: 11.5px; color: var(--sub); line-height: 1.7; box-shadow: var(--shadow); }

.article-bar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; z-index: 45;
  width: 100%; max-width: 520px; display: flex; align-items: center; gap: 8px;
  padding: 8px 16px calc(8px + var(--safe-b));
  background: rgba(255, 255, 255, 0.97); border-top: 1px solid var(--line);
  backdrop-filter: blur(12px);
}
.article-bar .act { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 2px; width: 46px; font-size: 10px; color: var(--sub); }
.article-bar .act svg { width: 20px; height: 20px; }
.article-bar .act.on { color: var(--blue); }
.article-bar .act.on.liked { color: var(--danger); }

/* ---------------- 我的 ---------------- */
.me-head {
  position: relative; padding: calc(26px + var(--safe-t)) 18px 60px; color: #fff;
  background: linear-gradient(150deg, #073f9e, #0b57d0 55%, #2b8cf7);
  border-radius: 0 0 26px 26px; overflow: hidden;
}
.me-head::after {
  content: ""; position: absolute; width: 240px; height: 240px; right: -90px; top: -120px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(140, 210, 255, 0.45), rgba(140, 210, 255, 0) 70%);
}
.me-profile { position: relative; z-index: 1; display: flex; align-items: center; gap: 13px; }
.me-avatar {
  width: 62px; height: 62px; border-radius: 50%; background: rgba(255, 255, 255, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.55); display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 700; color: #fff; overflow: hidden;
}
.me-avatar img { width: 100%; height: 100%; object-fit: cover; }
.me-profile .name { font-size: 18px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.me-profile .name .vip {
  font-size: 9.5px; font-weight: 600; color: #6b4400;
  background: linear-gradient(120deg, #ffe08a, #f3b23c);
  border-radius: 4px; padding: 2px 6px; letter-spacing: 0.3px;
}
.me-profile .desc { font-size: 11.5px; opacity: 0.82; margin-top: 4px; }
.me-profile .login-btn {
  margin-left: auto; font-size: 12.5px; color: #0b57d0; background: #fff;
  padding: 7px 16px; border-radius: 999px; font-weight: 600;
}

.vip-card {
  position: relative; z-index: 1; margin: -40px 16px 0;
  border-radius: 16px; padding: 15px 16px; color: #ffe9b8;
  background: linear-gradient(120deg, #1d2739, #2c3550 60%, #3a4566);
  box-shadow: 0 12px 24px rgba(15, 25, 48, 0.22);
  display: flex; align-items: center; gap: 12px;
}
.vip-card .crown {
  width: 40px; height: 40px; border-radius: 12px; flex: 0 0 auto;
  background: linear-gradient(135deg, #ffe08a, #e8a41c); color: #6b4400;
  display: flex; align-items: center; justify-content: center;
}
.vip-card .crown svg { width: 20px; height: 20px; }
.vip-card h3 { font-size: 14px; color: #fff; font-weight: 600; }
.vip-card p { font-size: 11px; color: rgba(255, 233, 184, 0.72); margin-top: 3px; }
.vip-card button {
  margin-left: auto; flex: 0 0 auto; font-size: 12px; font-weight: 600; color: #6b4400;
  background: linear-gradient(120deg, #ffe08a, #f3b23c); padding: 7px 14px; border-radius: 999px;
}

.me-stats {
  display: grid; grid-template-columns: repeat(3, 1fr);
  margin: 12px 16px 0; padding: 16px 0; background: #fff;
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.me-stats .st { text-align: center; position: relative; }
.me-stats .st + .st::before {
  content: ""; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 1px; height: 24px; background: var(--line);
}
.me-stats b { display: block; font-size: 19px; font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; }
.me-stats span { font-size: 11.5px; color: var(--sub); }

.menu-card { margin: 12px 16px 0; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.menu-item {
  display: flex; align-items: center; gap: 11px; padding: 14px 15px;
  border-bottom: 1px solid var(--line); font-size: 14px; color: var(--text-2); text-align: left; width: 100%;
}
.menu-item:last-child { border-bottom: 0; }
.menu-item .mi-ico {
  width: 32px; height: 32px; border-radius: 10px; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center; color: #fff;
}
.menu-item .mi-ico svg { width: 17px; height: 17px; }
.menu-item .mi-ico.blue { background: linear-gradient(135deg, #5a9bfb, #0b57d0); }
.menu-item .mi-ico.green { background: linear-gradient(135deg, #3ed9c8, #0aa39a); }
.menu-item .mi-ico.orange { background: linear-gradient(135deg, #ffc258, #f79009); }
.menu-item .mi-ico.purple { background: linear-gradient(135deg, #a78bfa, #6d4de0); }
.menu-item .mi-ico.grey { background: linear-gradient(135deg, #b8c4d6, #8b99ad); }
.menu-item .mi-main { flex: 1; min-width: 0; }
.menu-item .mi-main b { display: block; font-weight: 500; font-size: 14px; color: var(--text); }
.menu-item .mi-main small { display: block; font-size: 11px; color: var(--sub); margin-top: 2px; }
.menu-item .chev { color: #c3ccda; display: flex; }
.menu-item .chev svg { width: 16px; height: 16px; }
.menu-item:active { background: #f8fafd; }

.me-foot { padding: 26px 16px 10px; text-align: center; color: #a5b1c2; font-size: 11px; line-height: 1.8; }

/* ---------------- 搜索 ---------------- */
.search-page { padding: 0 16px 24px; }
.search-box {
  display: flex; align-items: center; gap: 8px; margin: 10px 0 16px;
  background: #fff; border-radius: 999px; padding: 10px 14px;
  border: 1px solid var(--line); box-shadow: var(--shadow);
}
.search-box svg { width: 17px; height: 17px; color: var(--sub); flex: 0 0 auto; }
.search-box input { flex: 1; border: 0; background: transparent; font-size: 14px; }
.search-box .clear { font-size: 12px; color: var(--sub); }
.search-tip { font-size: 12.5px; color: var(--sub); margin: 6px 0 14px; }
.result-group-title { font-size: 13px; font-weight: 700; color: var(--text-2); margin: 16px 0 6px; }
.result-row { display: block; padding: 11px 0; border-bottom: 1px solid var(--line); }
.result-row h4 { font-size: 14px; font-weight: 600; line-height: 1.45; }
.result-row p { font-size: 11.5px; color: var(--sub); margin-top: 4px; }

/* ---------------- 底部导航 ---------------- */
.tabbar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; z-index: 50;
  width: 100%; max-width: 520px;
  display: grid; grid-template-columns: repeat(4, 1fr);
  padding: 6px 4px calc(6px + var(--safe-b));
  background: rgba(255, 255, 255, 0.97);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
}
.tab {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 3px 0; font-size: 10.5px; color: #93a0b3;
}
.tab svg { width: 22px; height: 22px; }
.tab.on { color: var(--blue); font-weight: 600; }
.tab.on svg { transform: translateY(-1px); }

/* ---------------- 弹层 ---------------- */
.mask {
  position: fixed; inset: 0; z-index: 90; display: flex; align-items: flex-end; justify-content: center;
  background: rgba(9, 18, 34, 0); transition: background 0.22s;
}
.mask.show { background: rgba(9, 18, 34, 0.5); }
.sheet {
  width: 100%; max-width: 520px; background: #fff;
  border-radius: 20px 20px 0 0; padding: 0 18px calc(18px + var(--safe-b));
  transform: translateY(100%); transition: transform 0.26s cubic-bezier(0.2, 0.8, 0.2, 1);
  max-height: 86vh; overflow-y: auto;
}
.mask.show .sheet { transform: none; }
.sheet-head { position: sticky; top: 0; background: #fff; display: flex; align-items: center; padding: 16px 0 12px; }
.sheet-head h3 { font-size: 16px; font-weight: 700; }
.sheet-head .close { margin-left: auto; color: var(--sub); display: flex; }
.sheet-head .close svg { width: 20px; height: 20px; }
.sheet-body { padding-bottom: 4px; }
.form-field { margin-bottom: 12px; }
.form-field label { display: block; font-size: 12px; color: var(--sub); margin-bottom: 6px; }
.form-field input {
  width: 100%; border: 1px solid var(--line); background: #f7f9fc;
  border-radius: 10px; padding: 11px 12px;
}
.form-field input:focus { border-color: #a9c8f7; background: #fff; }
.sheet-note { font-size: 11px; color: var(--sub); line-height: 1.7; margin: 4px 0 12px; }
.sheet .btn-primary { width: 100%; }
.list-row { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: 0; }
.list-row .lr-main { flex: 1; min-width: 0; }
.list-row .lr-main h4 { font-size: 13.5px; font-weight: 600; line-height: 1.45; }
.list-row .lr-main p { font-size: 11px; color: var(--sub); margin-top: 3px; }
.list-row .thumb { flex: 0 0 76px; height: 50px; border-radius: 8px; overflow: hidden; background: #dfe8f6; }
.list-row .thumb img { width: 100%; height: 100%; object-fit: cover; }

/* toast */
.toast {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%) scale(0.96);
  z-index: 120; max-width: 76vw; padding: 11px 18px;
  background: rgba(16, 24, 40, 0.88); color: #fff; border-radius: 10px;
  font-size: 13px; line-height: 1.5; text-align: center;
  opacity: 0; pointer-events: none; transition: all 0.2s;
}
.toast.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }

/* 桌面端窄屏适配 */
@media (min-width: 560px) {
  .app { border-radius: 0; }
}

/* ---------------- 补充组件 ---------------- */
.avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }

.news-card {
  margin-top: 12px; background: #fff; border-radius: 16px;
  padding: 0 14px; box-shadow: var(--shadow);
}

.live-list { padding: 4px 16px 0; }
.list-count { padding: 8px 16px 0; font-size: 12px; color: var(--sub); }

.me-stats .st { border: 0; background: transparent; width: 100%; }
.status-row .st { border: 0; background: transparent; }
.article-bar .btn-primary { flex: 1; height: 42px; max-width: 200px; margin-left: 4px; }

.filter-bar { top: calc(58px + var(--safe-t)); }

/* =========================================================
   视觉升级层
   ---------------------------------------------------------
   在不改动页面结构的前提下提升层次感、留白与可读性
   ========================================================= */

:root {
  --shadow-soft: 0 2px 6px rgba(16, 42, 92, 0.04), 0 10px 26px rgba(16, 42, 92, 0.07);
  --shadow-card: 0 1px 2px rgba(16, 42, 92, 0.05), 0 12px 30px rgba(16, 42, 92, 0.1);
  --border-soft: 1px solid rgba(15, 50, 120, 0.06);
}

/* 首屏骨架屏 */
.skel { padding-bottom: 20px; }
.skel > div,
.skel-card {
  background: linear-gradient(100deg, #e9eef7 20%, #f5f8fd 40%, #e9eef7 60%);
  background-size: 240% 100%;
  animation: shimmer 1.3s ease-in-out infinite;
}
.skel-head { height: calc(168px + var(--safe-t)); border-radius: 0 0 26px 26px; }
.skel-hero { height: 178px; margin: 14px 16px 0; border-radius: 20px; }
.skel-quick { height: 92px; margin: 14px 16px 0; border-radius: 16px; }
.skel-line { height: 18px; width: 42%; margin: 22px 16px 0; border-radius: 6px; }
.skel-card { height: 210px; margin: 12px 16px 0; border-radius: 16px; }
@keyframes shimmer {
  0% { background-position: 130% 0; }
  100% { background-position: -30% 0; }
}

/* 首页头部与轮播 */
.home-head { box-shadow: 0 18px 40px rgba(7, 45, 110, 0.18); }
.searchbar { background: rgba(255, 255, 255, 0.2); border-color: rgba(255, 255, 255, 0.3); }
.hero { margin-top: -40px; }
.hero-slide {
  aspect-ratio: 16 / 9.1;
  border-radius: 20px;
  box-shadow: 0 18px 38px rgba(7, 32, 74, 0.24), inset 0 0 0 1px rgba(255, 255, 255, 0.12);
  transition: transform 0.18s;
}
.hero-slide:active { transform: scale(0.992); }
.hero-slide .mask {
  background:
    linear-gradient(180deg, rgba(4, 20, 46, 0.1) 0%, rgba(4, 20, 46, 0) 34%, rgba(4, 20, 46, 0.86) 100%),
    linear-gradient(90deg, rgba(4, 22, 51, 0.62) 0%, rgba(4, 22, 51, 0.18) 62%, rgba(4, 22, 51, 0) 100%);
}
.hero-slide .txt { left: 17px; right: 17px; bottom: 15px; }
.hero-slide .tagline {
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  background: rgba(255, 255, 255, 0.18); font-weight: 600;
}
.hero-slide h2 { font-size: 17px; line-height: 1.38; text-shadow: 0 2px 12px rgba(0, 0, 0, 0.32); }
.hero-slide p { font-size: 12px; opacity: 0.92; }
.hero-dots i { width: 6px; height: 6px; }
.hero-dots i.on { width: 18px; }

/* 快捷入口 */
.quick { margin-top: 16px; padding: 18px 6px 16px; border: var(--border-soft); box-shadow: var(--shadow-card); }
.quick-ico { width: 46px; height: 46px; border-radius: 16px; }
.quick-item span { font-weight: 500; }
.quick-item:active { transform: scale(0.97); }
.q1 { box-shadow: 0 8px 16px rgba(229, 72, 77, 0.24); }
.q2 { box-shadow: 0 8px 16px rgba(11, 87, 208, 0.24); }
.q3 { box-shadow: 0 8px 16px rgba(10, 163, 154, 0.24); }
.q4 { box-shadow: 0 8px 16px rgba(240, 160, 32, 0.26); }

/* 内容卡片 */
.live-card { border: var(--border-soft); box-shadow: var(--shadow-card); }
.live-body { padding: 12px 13px 13px; }
.live-body h3 { font-size: 15px; }
.live-scroll { padding-bottom: 8px; }
.up-row { padding: 11px; border: var(--border-soft); box-shadow: var(--shadow-soft); }
.up-row .thumb { flex-basis: 118px; height: 75px; border-radius: 12px; }
.up-row .info h3 { font-size: 14px; }
.news-feature { border-radius: 18px; box-shadow: var(--shadow-card); }
.news-feature h3 { font-size: 16px; }
.news-card { border: var(--border-soft); box-shadow: var(--shadow-soft); }
.news-row .thumb { border-radius: 12px; }

/* 直播间 */
.room-info h1 { font-size: 18px; }
.speaker-card { border: var(--border-soft); box-shadow: var(--shadow-soft); }
.panel p { font-size: 14.5px; line-height: 1.85; }

/* 资讯详情排版 */
.article-head h1 { font-size: 21px; line-height: 1.45; }
.article-body { padding: 16px 18px 26px; }
.article-body p { font-size: 16px; line-height: 1.95; color: #28303f; margin-bottom: 18px; }
.article-body .lead {
  font-size: 15px; line-height: 1.9; color: var(--text-2);
  background: linear-gradient(120deg, #f2f7ff, #f8fbff);
  border-left: 3px solid var(--blue-2);
  padding: 12px 14px; border-radius: 0 10px 10px 0; margin-bottom: 20px;
}
.article-body h3 {
  position: relative; font-size: 17px; line-height: 1.5;
  margin: 24px 0 12px; padding-left: 11px;
}
.article-body h3::before {
  content: ""; position: absolute; left: 0; top: 4px; bottom: 4px; width: 4px;
  border-radius: 4px; background: linear-gradient(180deg, var(--blue-2), var(--cyan));
}

/* 底部导航 */
.tabbar { box-shadow: 0 -8px 26px rgba(16, 42, 92, 0.07); }
.tab.on { color: var(--blue); }
.tab.on svg { filter: drop-shadow(0 4px 8px rgba(11, 87, 208, 0.3)); }

/* 交互反馈 */
.btn-primary:active { transform: translateY(1px); box-shadow: 0 3px 10px rgba(11, 87, 208, 0.24); }
.chip:active { transform: scale(0.96); }


/* ===== 微信公众号引导遮罩 ===== */
.wx-guide { position: fixed; inset: 0; z-index: 99999; display: flex; align-items: center; justify-content: center; padding: 20px; }
.wx-guide-mask { position: absolute; inset: 0; background: rgba(10, 30, 60, 0.72); backdrop-filter: blur(4px); }
.wx-guide-body { position: relative; width: 100%; max-width: 360px; background: #fff; border-radius: 18px; padding: 32px 22px 20px; box-shadow: 0 20px 60px rgba(0,0,0,0.25); }
.wx-icon { width: 72px; height: 72px; margin: 0 auto 12px; border-radius: 50%; background: linear-gradient(135deg, #07c160, #06ad56); display: flex; align-items: center; justify-content: center; color: #fff; }
.wx-icon svg { width: 36px; height: 36px; }
.wx-guide h3 { text-align: center; font-size: 18px; font-weight: 600; color: #1a2b42; margin: 0 0 6px; }
.wx-tip { text-align: center; font-size: 12.5px; color: #8a9cb3; margin: 0 0 20px; line-height: 1.5; }
.wx-steps { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.wx-steps .step { display: flex; gap: 10px; align-items: flex-start; }
.wx-steps .num { flex: 0 0 22px; width: 22px; height: 22px; border-radius: 50%; background: #07c160; color: #fff; font-size: 12px; font-weight: 600; display: flex; align-items: center; justify-content: center; }
.wx-steps b { display: block; font-size: 13px; color: #1a2b42; font-weight: 600; margin-bottom: 2px; }
.wx-steps .sub { font-size: 11.5px; color: #8a9cb3; }
.wx-copy { margin-top: 6px; display: inline-block; padding: 4px 12px; background: #e8f5ed; color: #07c160; font-size: 12px; border-radius: 12px; border: none; cursor: pointer; }
.wx-copy:active { background: #d4ecd9; }
.wx-link { background: #f4f7fb; border-radius: 8px; padding: 10px 12px; font-size: 12px; color: #5a6c84; word-break: break-all; line-height: 1.5; margin-bottom: 16px; border: 1px dashed #c8d4e3; }
.wx-skip { width: 100%; padding: 10px; background: transparent; color: #8a9cb3; font-size: 13px; border: none; cursor: pointer; border-top: 1px solid #f0f3f8; padding-top: 14px; }
.wx-skip:active { color: #1a2b42; }

/* =========================================================
   直播间全屏布局（room.ejs）
   抖音风格：视频全屏 + 弹幕飘 + 底部固定输入框
   ========================================================= */

.room-page {
  position: fixed;
  inset: 0;
  background: #000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: #fff;
}

/* ---- 视频区：全屏 ---- */
.room-video {
  position: absolute;
  inset: 0;
  z-index: 0;
}
.room-video video,
.room-video img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}
.room-video .veil {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.3), transparent 20%, transparent 60%, rgba(0,0,0,0.55));
}
.room-video .no-stream {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 15px; opacity: 0.7;
}

/* ---- 顶部栏 ---- */
.room-header {
  position: relative;
  z-index: 10;
  display: flex; align-items: center; gap: 10px;
  padding: 14px 14px 0;
  padding-top: calc(env(safe-area-inset-top, 0) + 14px);
}
.room-header .icon-btn {
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(0,0,0,0.45);
  color: #fff; display: flex; align-items: center; justify-content: center;
  border: none; cursor: pointer; flex-shrink: 0;
  backdrop-filter: blur(6px);
}
.room-header .icon-btn svg { width: 18px; height: 18px; }
.room-host { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.room-host .avatar {
  width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 13px; font-weight: 600;
  border: 2px solid rgba(255,255,255,0.6); flex-shrink: 0;
}
.host-main { min-width: 0; }
.host-name { font-size: 14px; font-weight: 600; color: #fff; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.host-sub { font-size: 11px; color: rgba(255,255,255,0.75); display: flex; align-items: center; gap: 4px; }
.room-count {
  display: flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: 14px;
  background: rgba(0,0,0,0.45); font-size: 12px;
  color: #fff; flex-shrink: 0;
  backdrop-filter: blur(6px);
}
.room-count svg { width: 14px; height: 14px; }

/* ---- 弹幕层 ---- */
.danmaku-layer {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0) + 70px);
  right: 14px;
  bottom: calc(env(safe-area-inset-bottom, 0) + 140px);
  left: 14px;
  pointer-events: none;
  z-index: 2;
  overflow: hidden;
}

/* ---- 聊天堆叠（靠近底部） ---- */
.chat-rail {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: calc(env(safe-area-inset-bottom, 0) + 70px);
  max-height: 190px;
  z-index: 5;
  display: flex;
  flex-direction: column-reverse;
  pointer-events: none;
}
.chat-rail .chat-list {
  display: flex; flex-direction: column; gap: 6px;
  max-height: 190px; overflow-y: auto;
  padding: 2px 0;
  pointer-events: auto;
}
.chat-rail .chat-list::-webkit-scrollbar { display: none; }

.chat-rail .chat-item {
  display: inline-flex; flex-wrap: wrap; align-items: baseline;
  gap: 6px; padding: 4px 10px;
  background: rgba(0,0,0,0.42);
  border-radius: 0 14px 14px 14px;
  font-size: 13px; line-height: 1.45;
  color: #fff;
  backdrop-filter: blur(4px);
  animation: fadeSlideUp 0.35s ease-out;
  width: fit-content;
  max-width: 100%;
}
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.chat-rail .chat-item .avatar { display: none; }
.chat-rail .chat-item .chat-bubble {
  background: transparent;
  padding: 0; border-radius: 0;
  color: #fff; font-size: 13px;
  line-height: 1.45; max-width: 240px;
  word-break: break-word;
}
.chat-rail .chat-item.mine {
  background: rgba(11, 87, 208, 0.55);
  border-radius: 14px 0 14px 14px;
  margin-left: auto;
  flex-direction: row-reverse;
}
.chat-rail .chat-item.mine .chat-bubble { color: #fff; }
.chat-rail .chat-item .chat-name {
  font-size: 12px; color: #ffe082;
  font-weight: 500;
  margin-right: 4px;
}
.chat-rail .chat-item.mine .chat-name { color: #ffd700; }
.chat-sys {
  text-align: center; font-size: 11px; color: rgba(255,255,255,0.65);
  padding: 2px 8px; margin: 2px auto;
  background: rgba(0,0,0,0.25); border-radius: 10px;
  pointer-events: auto;
  width: fit-content;
}

/* ---- 底部输入栏 ---- */
.room-inputbar {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 10px 14px;
  padding-bottom: calc(env(safe-area-inset-bottom, 0) + 10px);
  background: linear-gradient(0deg, rgba(0,0,0,0.7), rgba(0,0,0,0));
  z-index: 10;
}
.room-inputbar .chat-form {
  display: flex; gap: 8px; align-items: center;
}
.room-inputbar input {
  flex: 1; height: 40px;
  background: rgba(255,255,255,0.18);
  border: 1px solid rgba(255,255,255,0.28);
  border-radius: 20px;
  padding: 0 16px; color: #fff; font-size: 14px;
  outline: none;
  backdrop-filter: blur(8px);
}
.room-inputbar input::placeholder { color: rgba(255,255,255,0.55); }
.room-inputbar input:focus { background: rgba(255,255,255,0.24); border-color: rgba(255,255,255,0.5); }
.send-btn {
  height: 40px; padding: 0 18px;
  border-radius: 20px; border: none;
  background: linear-gradient(120deg, #0b57d0, #2b6cb0);
  color: #fff; font-size: 14px; font-weight: 600;
  cursor: pointer; flex-shrink: 0;
}
.send-btn:active { transform: scale(0.96); }

/* =========================================================
   直播详情页（live-detail.ejs）扩展样式
   ========================================================= */
.detail-cover {
  position: relative;
  width: 100%; aspect-ratio: 16 / 9;
  overflow: hidden; background: #f0f3f8;
}
.detail-cover img { width: 100%; height: 100%; object-fit: cover; }
.cover-badges {
  position: absolute; bottom: 12px; left: 14px;
  display: flex; gap: 6px;
}
.room-meta {
  display: flex; gap: 14px; margin-top: 8px;
  font-size: 12.5px; color: var(--sub);
}
.room-meta span { display: inline-flex; align-items: center; gap: 4px; }
.room-meta svg { width: 14px; height: 14px; }

.detail-section {
  padding: 18px 16px;
}
.section-title {
  display: flex; align-items: center; gap: 10px;
  font-size: 15px; font-weight: 600; color: var(--text);
  margin: 0 0 12px;
}
.section-title::before {
  content: ''; width: 3px; height: 14px;
  background: linear-gradient(180deg, #0b57d0, #2b6cb0);
  border-radius: 2px;
}
.intro-body p {
  font-size: 14px; line-height: 1.7; color: var(--text-2);
  margin: 0 0 10px;
}
.agenda-list { display: flex; flex-direction: column; gap: 10px; }

.bottom-space { height: 120px; }

/* 详情页底部按钮：进入直播间 */
.room-entry {
  background: linear-gradient(120deg, #ff3b6b, #ff5722) !important;
  box-shadow: 0 6px 16px rgba(255, 59, 107, 0.35) !important;
}
.room-entry::after {
  content: '›'; margin-left: 4px; font-size: 18px; font-weight: 700;
}

/* speaker-card 里的灰色 icon 头像 */
.avatar.gray {
  background: linear-gradient(135deg, #e2e8f0, #cbd5e1) !important;
  color: #64748b;
  display: flex; align-items: center; justify-content: center;
}
.avatar.gray svg { width: 16px; height: 16px; }

/* =========================================================
   详情页 Tab 切换
   ========================================================= */
.detail-tabs {
  display: flex;
  padding: 0 16px;
  margin-bottom: 4px;
  gap: 4px;
  border-bottom: 1px solid #eef1f6;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 2;
}
.detail-tabs .tab {
  position: relative;
  flex: 1;
  padding: 14px 0;
  background: none;
  border: none;
  font-size: 14.5px;
  color: var(--sub);
  font-weight: 500;
  cursor: pointer;
  transition: color 0.2s;
}
.detail-tabs .tab.on {
  color: var(--text);
  font-weight: 600;
}
.detail-tabs .tab.on::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: 28px;
  height: 3px;
  border-radius: 2px;
  background: linear-gradient(90deg, #0b57d0, #2b6cb0);
}
.detail-tabs .tab:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.detail-section[data-panel] {
  padding-top: 14px;
}

/* === 修复 chat-rail 聊天宽度 + 方向 === */
.chat-rail {
  position: absolute;
  left: 0; right: 0;
  bottom: calc(env(safe-area-inset-bottom, 0) + 80px);
  padding: 0 14px;
  z-index: 5;
  pointer-events: none;
}
.chat-rail .chat-list {
  display: flex; flex-direction: column; gap: 6px;
  max-height: 190px; overflow-y: auto;
  padding: 2px 0;
  pointer-events: auto;
}
.chat-rail .chat-list::-webkit-scrollbar { display: none; }

.chat-rail .chat-item {
  display: flex; flex-wrap: wrap; align-items: baseline;
  gap: 4px; padding: 5px 12px;
  background: rgba(0,0,0,0.42);
  border-radius: 0 16px 16px 16px;
  font-size: 13px; line-height: 1.5;
  color: #fff;
  backdrop-filter: blur(4px);
  animation: fadeSlideUp 0.3s ease-out;
  width: auto;
  max-width: 78%;
}
.chat-rail .chat-item.mine {
  background: rgba(11, 87, 208, 0.6);
  border-radius: 16px 0 16px 16px;
  margin-left: auto;
  max-width: 78%;
}
.chat-rail .chat-item .avatar { display: none; }
.chat-rail .chat-item .chat-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.chat-rail .chat-item .chat-name {
  font-size: 11px; color: #ffe082;
  font-weight: 500;
}
.chat-rail .chat-item.mine .chat-name { color: #ffd700; text-align: right; }
.chat-rail .chat-item .chat-bubble {
  color: #fff; font-size: 13px;
  line-height: 1.5;
  word-break: break-word;
  max-width: 100%;
}

/* ====== 覆盖：气泡根据文字自适应宽度 ====== */
.chat-rail .chat-list { align-items: flex-start; }
.chat-rail .chat-item {
  display: inline-flex !important;
  align-items: flex-start !important;
  flex-wrap: nowrap !important;
  gap: 4px;
  padding: 5px 12px;
  background: rgba(0,0,0,0.42);
  border-radius: 0 16px 16px 16px;
  font-size: 13px; line-height: 1.5;
  color: #fff;
  backdrop-filter: blur(4px);
  animation: fadeSlideUp 0.3s ease-out;
  width: auto !important;
  max-width: 75%;
}
.chat-rail .chat-item.mine {
  background: rgba(11, 87, 208, 0.65);
  border-radius: 16px 0 16px 16px;
  margin-left: auto;
  margin-right: 0;
  max-width: 75%;
  align-self: flex-end;
}
.chat-rail .chat-item .chat-main {
  display: flex; flex-direction: column; gap: 2px;
  width: auto !important;
  min-width: 0;
  max-width: none !important;
}
.chat-rail .chat-item .chat-bubble {
  width: auto !important;
  max-width: 100%;
  white-space: pre-wrap;
  word-break: break-word;
}
.chat-rail .chat-item .chat-name {
  font-size: 11px; color: #ffe082; font-weight: 500;
}
.chat-rail .chat-item.mine .chat-name { color: #ffd700; text-align: right; }

/* ====== 人名移到气泡外面 ====== */
.chat-rail .chat-list {
  display: flex; flex-direction: column; gap: 10px;
}
.chat-rail .chat-item {
  position: relative;
  padding: 4px 12px 5px;
  border-radius: 14px 16px 16px 14px;
}
.chat-rail .chat-item.mine {
  border-radius: 16px 14px 14px 16px;
}
.chat-rail .chat-item .chat-main {
  display: flex; flex-direction: column; gap: 1px;
}
.chat-rail .chat-item .chat-name {
  position: absolute;
  top: -14px;
  left: 0;
  font-size: 10.5px;
  color: rgba(255,255,255,0.7);
  font-weight: 500;
  background: none;
  white-space: nowrap;
}
.chat-rail .chat-item.mine .chat-name {
  left: auto;
  right: 0;
  color: rgba(255,215,0,0.85);
  text-align: right;
}
.chat-rail .chat-item .chat-bubble {
  font-size: 13px; line-height: 1.5;
  color: #fff;
}

/* ====== 视频：纯播流，无原生控件 ====== */
.room-video video::-webkit-media-controls { display: none !important; }
.room-video video::-webkit-media-controls-panel { display: none !important; }
.room-video video::-webkit-media-controls-overlay-play-button { display: none !important; }
.room-video video::-webkit-media-controls-enclosure { display: none !important; }
.room-video video::-webkit-media-controls-current-time-display { display: none !important; }
.room-video video::-webkit-media-controls-time-remaining-display { display: none !important; }
.room-video video::-webkit-media-controls-timeline { display: none !important; }
.room-video video::-webkit-media-controls-volume-slider { display: none !important; }
.room-video video::-webkit-media-controls-mute-button { display: none !important; }
.room-video video::-webkit-media-controls-fullscreen-button { display: none !important; }
.room-video video::-webkit-media-controls-play-button { display: none !important; }
.room-video video::-webkit-media-controls-pause-button { display: none !important; }
.room-video video::-webkit-media-controls-toggle-closed-captions-button { display: none !important; }
.room-video video { pointer-events: none; }

/* =========================================================
   直播间：抖音风格分屏布局（覆盖之前的全屏 absolute 定位）
   header → video(16:9) → chat-area(滚动) → inputbar(固定)
   ========================================================= */

.room-page {
  display: flex !important;
  flex-direction: column !important;
  height: 100vh !important;
  position: static !important;
  inset: auto !important;
  background: #111318 !important;
  color: #e6e8ec;
  overflow: hidden !important;
}

/* ---- 顶部主播栏 ---- */
.room-header {
  position: static !important;
  flex-shrink: 0 !important;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(env(safe-area-inset-top, 0) + 10px) 14px 10px;
  background: #0b0d12;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  z-index: 10 !important;
}
.room-header .icon-btn {
  width: 32px; height: 32px;
  background: rgba(255,255,255,0.08);
  color: #e6e8ec;
  backdrop-filter: none !important;
}
.room-count {
  color: #e6e8ec;
  background: rgba(255,255,255,0.08);
  backdrop-filter: none !important;
}

/* ---- 视频区：固定 16:9 比例 ---- */
.room-video {
  position: static !important;
  inset: auto !important;
  flex-shrink: 0 !important;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  overflow: hidden;
}
.room-video video,
.room-video img {
  width: 100%;
  height: 100%;
  object-fit: contain !important;
  background: #000;
  pointer-events: auto !important;
}
.room-video .no-stream {
  position: absolute;
  inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,0.5); font-size: 14px;
}

/* ---- 聊天区：flex 1 自动占剩余空间 ---- */
.chat-area {
  flex: 1 !important;
  min-height: 0 !important;
  position: static !important;
  left: auto !important;
  right: auto !important;
  bottom: auto !important;
  max-height: none !important;
  padding: 10px 14px 4px;
  background: #111318;
  overflow: hidden;
}
.chat-area .chat-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: 100%;
  max-height: none !important;
  overflow-y: auto !important;
  padding-bottom: 4px;
}
.chat-area .chat-list::-webkit-scrollbar { display: none; }

/* ---- 聊天气泡样式（在 chat-area 内） ---- */
.chat-area .chat-item {
  position: relative;
  display: inline-flex !important;
  align-items: flex-start !important;
  padding: 4px 12px 5px;
  background: rgba(255,255,255,0.08);
  border-radius: 4px 14px 14px 14px;
  font-size: 13px;
  line-height: 1.5;
  color: #e6e8ec;
  width: auto !important;
  max-width: 75%;
  animation: none !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  gap: 0 !important;
  margin: 0 !important;
  box-sizing: border-box;
}
.chat-area .chat-item.mine {
  background: linear-gradient(120deg, #0b57d0, #2b6cb0);
  border-radius: 14px 4px 14px 14px;
  align-self: flex-end;
}
.chat-area .chat-item .chat-main {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.chat-area .chat-item .chat-bubble {
  font-size: 13px;
  line-height: 1.5;
  color: #e6e8ec;
  word-break: break-word;
  white-space: pre-wrap;
}
.chat-area .chat-item.mine .chat-bubble { color: #fff; }
.chat-area .chat-item .chat-name {
  position: absolute;
  top: -13px;
  left: 4px;
  font-size: 10.5px;
  color: rgba(255,255,255,0.55);
  font-weight: 500;
  background: none;
}
.chat-area .chat-item.mine .chat-name {
  left: auto;
  right: 4px;
  color: rgba(255,215,0,0.8);
}

/* ---- 系统消息 ---- */
.chat-sys {
  text-align: center;
  font-size: 11px;
  color: rgba(255,255,255,0.4);
  padding: 3px 10px;
  margin: 4px auto !important;
  background: rgba(255,255,255,0.04);
  border-radius: 10px;
  width: fit-content;
}

/* ---- 底部输入栏：固定 flex-shrink 0 ---- */
.room-inputbar {
  position: static !important;
  flex-shrink: 0 !important;
  left: auto !important;
  right: auto !important;
  bottom: auto !important;
  padding: 10px 14px;
  padding-bottom: calc(env(safe-area-inset-bottom, 0) + 10px);
  background: #0b0d12;
  border-top: 1px solid rgba(255,255,255,0.06);
  z-index: 10 !important;
}
.room-inputbar .chat-form { gap: 8px !important; }
.room-inputbar input {
  background: rgba(255,255,255,0.08) !important;
  border: 1px solid rgba(255,255,255,0.1) !important;
  color: #e6e8ec !important;
  backdrop-filter: none !important;
}
.room-inputbar input::placeholder { color: rgba(255,255,255,0.35) !important; }

/* ---- 弹幕层废弃（用不到了） ---- */
.danmaku-layer { display: none !important; }

/* =========================================================
   最终版：全屏播流 + 聊天浮层（名字独立于气泡，消息间有间距）
   ========================================================= */

.room-page {
  position: fixed !important;
  inset: 0 !important;
  display: block !important;
  height: auto !important;
  background: #000 !important;
  overflow: hidden !important;
}

/* 顶部栏浮在视频上 */
.room-header {
  position: absolute !important;
  top: 0; left: 0; right: 0;
  padding: calc(env(safe-area-inset-top, 0) + 12px) 14px 12px !important;
  background: linear-gradient(180deg, rgba(0,0,0,0.55), rgba(0,0,0,0)) !important;
  border-bottom: none !important;
  z-index: 20 !important;
}
.room-header .icon-btn {
  width: 34px !important; height: 34px !important;
  background: rgba(0,0,0,0.42) !important;
  color: #fff !important;
  backdrop-filter: blur(6px) !important;
}
.room-count {
  background: rgba(0,0,0,0.42) !important;
  color: #fff !important;
  backdrop-filter: blur(6px) !important;
}
.host-name { color: #fff !important; text-shadow: 0 1px 2px rgba(0,0,0,0.5); }
.host-sub { color: rgba(255,255,255,0.8) !important; }

/* 视频全屏铺满 */
.room-video {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  aspect-ratio: auto !important;
  flex-shrink: 1 !important;
  background: #000;
  z-index: 0 !important;
}
.room-video video,
.room-video img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  pointer-events: none !important;
}

/* 聊天区：浮在底部，半透明，占屏幕下半部分 */
.chat-area {
  position: absolute !important;
  left: 0 !important;
  right: 0 !important;
  bottom: calc(env(safe-area-inset-bottom, 0) + 68px) !important;
  top: auto !important;
  max-height: 46vh !important;
  flex: none !important;
  min-height: 0 !important;
  padding: 0 14px !important;
  background: transparent !important;
  overflow: hidden !important;
  z-index: 10 !important;
  pointer-events: none !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: flex-end !important;
}
.chat-area .chat-list {
  display: flex !important;
  flex-direction: column !important;
  justify-content: flex-end !important;
  gap: 20px !important;              /* 消息之间的间距 */
  max-height: 46vh !important;
  height: auto !important;
  overflow-y: auto !important;
  padding: 6px 2px !important;
  pointer-events: auto !important;
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 24px, #000 100%);
          mask-image: linear-gradient(180deg, transparent 0, #000 24px, #000 100%);
}
.chat-area .chat-list::-webkit-scrollbar { display: none; }

/* 单条消息：名字在气泡上方独立显示，气泡只包文字 */
.chat-area .chat-item {
  position: relative !important;
  display: inline-flex !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  align-self: flex-start !important;
  flex-wrap: nowrap !important;
  gap: 0 !important;
  padding: 7px 13px !important;
  margin: 14px 0 0 0 !important;      /* 给外置名字留出空间 */
  background: rgba(0,0,0,0.5) !important;
  border-radius: 4px 14px 14px 14px !important;
  width: auto !important;
  max-width: 78% !important;
  backdrop-filter: blur(8px) !important;
  box-sizing: border-box !important;
  animation: none !important;
}
.chat-area .chat-item.mine {
  align-self: flex-end !important;
  background: rgba(11, 87, 208, 0.72) !important;
  border-radius: 14px 4px 14px 14px !important;
}
.chat-area .chat-item .chat-main {
  display: flex !important;
  flex-direction: column !important;
  gap: 0 !important;
  min-width: 0 !important;
  width: auto !important;
}
.chat-area .chat-item .chat-bubble {
  color: #fff !important;
  font-size: 13.5px !important;
  line-height: 1.45 !important;
  word-break: break-word !important;
  white-space: pre-wrap !important;
}
/* 名字：在气泡外面上方，不属于背景 */
.chat-area .chat-item .chat-name {
  position: absolute !important;
  top: -17px !important;
  left: 2px !important;
  font-size: 11px !important;
  font-weight: 500 !important;
  color: rgba(255,255,255,0.78) !important;
  text-shadow: 0 1px 2px rgba(0,0,0,0.6) !important;
  background: none !important;
  white-space: nowrap !important;
  max-width: 100% !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}
.chat-area .chat-item.mine .chat-name {
  left: auto !important;
  right: 2px !important;
  color: rgba(255, 215, 0, 0.9) !important;
}

/* 系统消息 */
.chat-area .chat-sys {
  align-self: center !important;
  font-size: 11px !important;
  color: rgba(255,255,255,0.6) !important;
  background: rgba(0,0,0,0.4) !important;
  border-radius: 10px !important;
  padding: 3px 10px !important;
  margin: 10px auto !important;
  width: fit-content !important;
  text-align: center !important;
}

/* 底部输入栏：浮在视频最下方 */
.room-inputbar {
  position: absolute !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  flex-shrink: 1 !important;
  padding: 10px 14px !important;
  padding-bottom: calc(env(safe-area-inset-bottom, 0) + 10px) !important;
  background: linear-gradient(0deg, rgba(0,0,0,0.72), rgba(0,0,0,0)) !important;
  border-top: none !important;
  z-index: 30 !important;
}
.room-inputbar .chat-form { gap: 8px !important; }
.room-inputbar input {
  background: rgba(255,255,255,0.2) !important;
  border: 1px solid rgba(255,255,255,0.3) !important;
  color: #fff !important;
  backdrop-filter: blur(8px) !important;
}
.room-inputbar input::placeholder { color: rgba(255,255,255,0.55) !important; }

/* 隐藏气泡内的头像圆，只保留文字 */
.chat-area .chat-item .avatar { display: none !important; }

/* ====== 抖音风：纯文字无气泡底，白字 + 粉色名字 ====== */
.chat-area .chat-item,
.chat-area .chat-item.mine {
  background: transparent !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  box-shadow: none !important;
  border: none !important;
  border-radius: 0 !important;
  padding: 0 !important;
  margin: 16px 0 0 0 !important;
}
.chat-area .chat-item .chat-bubble {
  color: #ffffff !important;
  font-size: 14px !important;
  line-height: 1.45 !important;
  text-shadow: 0 1px 3px rgba(0,0,0,0.85), 0 0 6px rgba(0,0,0,0.45) !important;
  white-space: pre-wrap !important;
  word-break: break-word !important;
}
.chat-area .chat-item .chat-name {
  color: #FF6B9D !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  text-shadow: 0 1px 3px rgba(0,0,0,0.85) !important;
  top: -18px !important;
  left: 0 !important;
}
.chat-area .chat-item.mine .chat-name {
  left: auto !important;
  right: 0 !important;
  color: #FFB74D !important;
}

/* 彻底清除气泡背景（旧全局 .chat-bubble 残留的浅灰底） */
.chat-area .chat-item .chat-bubble,
.chat-area .chat-item.mine .chat-bubble {
  background: transparent !important;
  background-color: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
  max-width: 100% !important;
}
/* 全局兜底：聊天区内的任何气泡都不显示底色 */
.chat-area .chat-bubble { background: none !important; }

/* ====== 修正：名字被 mask 裁掉 + 抖音式底部黑色渐变遮罩 ====== */
.chat-area {
  max-height: 52vh !important;
}
/* 去掉会淡掉名字的 mask */
.chat-area .chat-list {
  -webkit-mask-image: none !important;
          mask-image: none !important;
  padding-top: 28px !important;
  padding-bottom: 8px !important;
  gap: 24px !important;
}
/* 抖音式渐变遮罩：底部深黑 → 上方透明，增强文字可读性 */
.chat-area::before {
  content: '' !important;
  position: absolute !important;
  left: -14px !important;
  right: -14px !important;
  bottom: -8px !important;
  top: -24px !important;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.78) 0%,
    rgba(0, 0, 0, 0.55) 35%,
    rgba(0, 0, 0, 0.22) 70%,
    rgba(0, 0, 0, 0) 100%
  ) !important;
  pointer-events: none !important;
  z-index: -1 !important;
  border-radius: 18px !important;
}
/* 每条消息留够名字空间，避免名字压到上一条 */
.chat-area .chat-item,
.chat-area .chat-item.mine {
  margin: 24px 0 0 0 !important;
}
.chat-area .chat-item .chat-name,
.chat-area .chat-item.mine .chat-name {
  top: -18px !important;
  display: block !important;
  opacity: 1 !important;
  visibility: visible !important;
  z-index: 2 !important;
}
/* 文字阴影加强（遮罩之上再兜一层） */
.chat-area .chat-item .chat-bubble {
  text-shadow: 0 1px 4px rgba(0,0,0,0.9), 0 0 8px rgba(0,0,0,0.6) !important;
}
.chat-area .chat-item .chat-name {
  text-shadow: 0 1px 4px rgba(0,0,0,0.95), 0 0 6px rgba(0,0,0,0.7) !important;
}

/* =========================================================
   最终定稿：抖音公屏样式
   昵称浅蓝加粗 / 消息白色 / 单条黑底圆角半透明
   换行规则统一：block + fit-content，超出容器才换行
   ========================================================= */

/* 聊天区：底部对齐向上滚动，去掉整块遮罩避免与单条黑底叠加 */
.chat-area {
  max-height: 55vh !important;
  padding: 0 12px !important;
  justify-content: flex-end !important;
}
.chat-area::before { display: none !important; }

.chat-area .chat-list {
  display: flex !important;
  flex-direction: column !important;
  justify-content: flex-end !important;
  align-items: flex-start !important;
  gap: 10px !important;
  max-height: 55vh !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  padding: 6px 2px 6px !important;
  scroll-behavior: auto !important;
}
.chat-area .chat-list::-webkit-scrollbar { width: 0 !important; display: none !important; }

/* 单条消息：稳定宽度计算，杜绝随机断行 */
.chat-area .chat-item {
  display: block !important;
  flex: 0 0 auto !important;
  position: relative !important;
  width: fit-content !important;
  max-width: min(74vw, 400px) !important;
  min-width: 0 !important;
  margin: 18px 0 0 0 !important;
  padding: 7px 12px !important;
  background: rgba(0, 0, 0, 0.55) !important;
  background-color: rgba(0, 0, 0, 0.55) !important;
  border-radius: 10px !important;
  border: none !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  box-sizing: border-box !important;
  align-self: flex-start !important;
}
.chat-area .chat-item.mine {
  background: rgba(0, 0, 0, 0.55) !important;
  background-color: rgba(0, 0, 0, 0.55) !important;
  border-radius: 10px !important;
  align-self: flex-end !important;
  margin-left: auto !important;
  margin-right: 0 !important;
}

/* 内容容器改为块级，保证宽度只由文本决定 */
.chat-area .chat-item .chat-main {
  display: block !important;
  width: auto !important;
  min-width: 0 !important;
  max-width: none !important;
}

/* 消息文字：纯白，统一换行规则 */
.chat-area .chat-item .chat-bubble,
.chat-area .chat-item.mine .chat-bubble {
  display: block !important;
  width: auto !important;
  max-width: 100% !important;
  padding: 0 !important;
  background: none !important;
  background-color: transparent !important;
  color: #ffffff !important;
  font-size: 14px !important;
  line-height: 1.5 !important;
  font-weight: 400 !important;
  letter-spacing: 0 !important;
  text-align: left !important;
  text-shadow: none !important;
  white-space: normal !important;      /* 合并空白，按容器宽度自然换行 */
  word-break: normal !important;       /* 不做强制断词，避免中途乱断 */
  overflow-wrap: break-word !important;/* 仅超长连续串（URL）才断 */
  word-wrap: break-word !important;
}

/* 昵称：浅蓝加粗，位于气泡上方 */
.chat-area .chat-item .chat-name,
.chat-area .chat-item.mine .chat-name {
  display: block !important;
  position: absolute !important;
  top: -17px !important;
  left: 2px !important;
  right: auto !important;
  width: auto !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  color: #7FD1FF !important;
  background: none !important;
  text-shadow: 0 1px 3px rgba(0,0,0,0.9) !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  max-width: min(74vw, 400px) !important;
  z-index: 2 !important;
}
.chat-area .chat-item.mine .chat-name {
  left: auto !important;
  right: 2px !important;
  color: #7FD1FF !important;
}

/* =========================================================
   抖音公屏 · 终版
   一条消息 = [蓝色昵称 空格 白色正文] 整体半透黑圆角
   字号 13px 贴近抖音原版；宽度 fit-content + 固定上限
   ========================================================= */

/* 聊天区容器 */
.chat-area {
  left: 0 !important;
  right: 0 !important;
  bottom: calc(env(safe-area-inset-bottom, 0) + 64px) !important;
  max-height: 58vh !important;
  padding: 0 12px !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: flex-end !important;
  overflow: hidden !important;
  pointer-events: none !important;
  z-index: 10 !important;
}
.chat-area::before { display: none !important; }

.chat-area .chat-list {
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  justify-content: flex-end !important;
  gap: 8px !important;
  max-height: 58vh !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  padding: 4px 0 !important;
  pointer-events: auto !important;
  scrollbar-width: none !important;
}
.chat-area .chat-list::-webkit-scrollbar { width: 0 !important; height: 0 !important; display: none !important; }

/* 单条气泡：宽度由内容决定，最大宽度固定 */
.chat-area .chat-item,
.chat-area .chat-item.mine {
  display: block !important;
  flex: 0 0 auto !important;
  position: relative !important;
  width: fit-content !important;
  max-width: min(72vw, 340px) !important;
  min-width: 0 !important;
  margin: 0 !important;
  padding: 5px 9px !important;
  background: rgba(0, 0, 0, 0.42) !important;
  background-color: rgba(0, 0, 0, 0.42) !important;
  border: none !important;
  border-radius: 8px !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  box-sizing: border-box !important;
  align-self: flex-start !important;   /* 公屏统一左对齐 */
  animation: none !important;
}

/* 内容块：让昵称与正文同一行流动 */
.chat-area .chat-item .chat-main {
  display: block !important;
  width: auto !important;
  min-width: 0 !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* 昵称：蓝色加粗、行内、右侧留一个空格 */
.chat-area .chat-item .chat-name,
.chat-area .chat-item.mine .chat-name {
  display: inline !important;
  position: static !important;
  top: auto !important;
  left: auto !important;
  right: auto !important;
  width: auto !important;
  max-width: none !important;
  margin: 0 5px 0 0 !important;      /* 昵称与正文之间的空格 */
  padding: 0 !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  line-height: 1.4 !important;
  color: #56B6FF !important;         /* 蓝色 */
  background: none !important;
  text-shadow: none !important;
  white-space: nowrap !important;
  overflow: visible !important;
  text-overflow: clip !important;
  vertical-align: baseline !important;
}

/* 正文：白色、行内、按容器宽度自然换行 */
.chat-area .chat-item .chat-bubble,
.chat-area .chat-item.mine .chat-bubble {
  display: inline !important;
  width: auto !important;
  max-width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  background: none !important;
  background-color: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  color: #ffffff !important;
  font-size: 13px !important;
  font-weight: 400 !important;
  line-height: 1.4 !important;
  letter-spacing: 0 !important;
  text-align: left !important;
  text-shadow: none !important;
  white-space: normal !important;
  word-break: normal !important;
  overflow-wrap: break-word !important;
  word-wrap: break-word !important;
  vertical-align: baseline !important;
}

/* 系统消息 */
.chat-area .chat-sys {
  align-self: flex-start !important;
  font-size: 11px !important;
  color: rgba(255,255,255,0.55) !important;
  background: rgba(0,0,0,0.3) !important;
  border-radius: 8px !important;
  padding: 2px 8px !important;
  margin: 0 !important;
  width: fit-content !important;
  text-align: left !important;
}

/* 底部输入栏：抖音粉发送按钮 */
.room-inputbar {
  padding: 8px 12px !important;
  padding-bottom: calc(env(safe-area-inset-bottom, 0) + 8px) !important;
  background: linear-gradient(0deg, rgba(0,0,0,0.82), rgba(0,0,0,0)) !important;
  z-index: 30 !important;
}
.room-inputbar .chat-form {
  gap: 8px !important;
  align-items: center !important;
}
.room-inputbar input {
  height: 36px !important;
  background: rgba(255,255,255,0.14) !important;
  border: 1px solid rgba(254, 44, 85, 0.35) !important;
  border-radius: 18px !important;
  padding: 0 14px !important;
  color: #fff !important;
  font-size: 13px !important;
  backdrop-filter: blur(6px) !important;
}
.room-inputbar input::placeholder { color: rgba(255,255,255,0.5) !important; }
.room-inputbar input:focus {
  background: rgba(255,255,255,0.2) !important;
  border-color: #FE2C55 !important;
  outline: none !important;
}
.send-btn {
  height: 36px !important;
  padding: 0 16px !important;
  border-radius: 18px !important;
  border: none !important;
  background: linear-gradient(120deg, #FE2C55, #FF6B81) !important;
  color: #fff !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  box-shadow: 0 2px 10px rgba(254, 44, 85, 0.35) !important;
}
.send-btn:active { transform: scale(0.96); }

/* ====== 自己的消息与他人消息区分 ====== */
.chat-area .chat-item.mine {
  background: rgba(254, 44, 85, 0.38) !important;
  background-color: rgba(254, 44, 85, 0.38) !important;
  border: 1px solid rgba(255, 107, 129, 0.55) !important;
  border-radius: 8px !important;
}
.chat-area .chat-item.mine .chat-name {
  color: #FFD166 !important;   /* 自己昵称金色 */
}
.chat-area .chat-item.mine .chat-name::after {
  content: '我';
  display: inline-block;
  margin-left: 4px;
  padding: 0 4px;
  font-size: 10px;
  font-weight: 500;
  line-height: 14px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.28);
  color: #fff;
  vertical-align: 1px;
}
.chat-area .chat-item.mine .chat-bubble {
  color: #FFFFFF !important;
}

/* ====== 公屏清屏手势：右滑隐藏 / 左滑恢复 ====== */
.chat-area,
.room-inputbar {
  transition: transform 0.28s ease, opacity 0.28s ease !important;
  will-change: transform, opacity;
}
.room-page.chat-hidden .chat-area {
  transform: translateX(112%) !important;
  opacity: 0 !important;
  pointer-events: none !important;
}
.room-page.chat-hidden .room-inputbar {
  transform: translateY(120%) !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* 恢复入口：平时隐藏，清屏后出现在右侧中部 */
.chat-toggle {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 52px;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  border-radius: 10px 0 0 10px;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  backdrop-filter: blur(6px);
  z-index: 25;
  cursor: pointer;
  transition: opacity 0.2s ease, background 0.2s ease;
}
.chat-toggle svg { width: 17px; height: 17px; }
.chat-toggle:active { background: rgba(254, 44, 85, 0.55); }
.room-page.chat-hidden .chat-toggle { display: flex; }

/* ====== 聊天浮层高度限制：整体（消息区+输入栏）最多占屏幕 60% ====== */
.chat-area {
  max-height: calc(60vh - 64px) !important;
}
.chat-area .chat-list {
  max-height: calc(60vh - 64px) !important;
}

/* ====== 修复：内容超出时正常内部滚动（flex-end 会破坏滚动） ====== */
.chat-area .chat-list {
  justify-content: flex-start !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
}
.chat-area .chat-list::before {
  content: '' !important;
  display: block !important;
  flex: 0 0 auto !important;
  height: 0 !important;
  margin-top: auto !important;   /* 内容少时把消息推到底部 */
}

/* ====== 直播画面比例修正：完整显示不裁剪不变形 ======
   竖屏流 + 竖屏屏 → 自动铺满
   横屏流 + 竖屏屏 → 完整显示，上下留黑边（不裁两侧）
   竖屏流 + 横屏屏 → 完整显示，左右留黑边 */
.room-video,
.room-video video,
.room-video img {
  background: #000 !important;
}
.room-video video,
.room-video img {
  object-fit: contain !important;
  object-position: center center !important;
}

/* ====== 智能比例：竖屏流铺满（cover），横屏流完整显示（contain） ====== */
.room-video video.fit-cover,
.room-video img.fit-cover {
  object-fit: cover !important;
}

/* 画面统一完整显示：竖屏 1080x1920 也不裁剪 */
.room-video video,
.room-video img {
  object-fit: contain !important;
  object-position: center center !important;
}

/* ================= 直播加载状态 ================= */
.live-loading {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 13px;
  letter-spacing: 0.5px;
}
.live-loading.hide { display: none; }
.live-loading .spin {
  width: 26px;
  height: 26px;
  border: 2px solid rgba(255, 255, 255, 0.28);
  border-top-color: #fff;
  border-radius: 50%;
  animation: liveSpin 0.8s linear infinite;
}
@keyframes liveSpin { to { transform: rotate(360deg); } }

/* ================= 直播播放按钮 ================= */
.live-play-btn {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 3;
  width: 62px;
  height: 62px;
  padding: 0 0 0 4px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.45);
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.live-play-btn.hide { display: none; }

/* 加载遮罩不拦截点击，同时避免完全遮死画面 */
.live-loading {
  pointer-events: none;
  background: rgba(0, 0, 0, 0.35) !important;
}

/* 播放按钮独立图层：避开聊天区遮挡，可点击 */
.live-play-btn {
  position: absolute !important;
  left: 50% !important;
  top: 30% !important;
  transform: translate(-50%, -50%) !important;
  z-index: 30 !important;
  width: 62px !important;
  height: 62px !important;
  padding: 0 0 0 4px !important;
  border-radius: 50% !important;
  border: 1px solid rgba(255, 255, 255, 0.45) !important;
  background: rgba(0, 0, 0, 0.5) !important;
  color: #fff !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  pointer-events: auto !important;
}
.live-play-btn.hide { display: none !important; }
