/*
 * TV 直播平台 - 观众端样式
 * 布局：左侧播放器 + 右侧互动聊天栏（实时评论，无弹幕），暗色专业风格
 * 设计规范：全站禁止使用 emoji
 */

:root {
  --bg: #0b0d12;
  --bg-soft: #10131a;
  --card: #151923;
  --card-hover: #1a1f2b;
  --border: #232a38;
  --border-soft: #1c222e;
  --text: #e8ebf0;
  --text-2: #a6adba;
  --text-3: #6b7280;
  --brand: #e5484d;
  --brand-2: #ff6b4a;
  --live: #f0434a;
  --ok: #30a46c;
  --warn: #f5a524;
  --radius: 14px;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
  --font: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

/* hidden 兜底：SVG 元素的 hidden 属性在部分浏览器不生效，必须显式声明 */
[hidden] { display: none !important; }

.app { min-height: 100vh; display: flex; flex-direction: column; }

/* ---------- 顶部导航 ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(11, 13, 18, 0.86);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-soft);
}

.topbar-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--brand); min-width: 0; }

.brand-mark { display: inline-flex; align-items: center; flex-shrink: 0; }

.brand-mark img {
  width: 30px;
  height: 30px;
  object-fit: contain;
  border-radius: 6px;
  display: block;
}

.brand-name {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.6px;
  color: var(--text);
}

.brand-name em {
  font-style: normal;
  color: var(--brand);
  margin-left: 3px;
}

.topbar-right { display: flex; align-items: center; gap: 14px; }

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 13px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.3px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-2);
}

.live-pill .live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-3);
}

.live-pill[data-status="live"] {
  color: #ffb3b5;
  border-color: rgba(240, 67, 74, 0.45);
  background: rgba(240, 67, 74, 0.12);
}

.live-pill[data-status="live"] .live-dot {
  background: var(--live);
  box-shadow: 0 0 0 0 rgba(240, 67, 74, 0.6);
  animation: pulse 1.8s infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(240, 67, 74, 0.55); }
  70% { box-shadow: 0 0 0 7px rgba(240, 67, 74, 0); }
  100% { box-shadow: 0 0 0 0 rgba(240, 67, 74, 0); }
}

.admin-entry {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 13px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
  border: 1px solid var(--border);
  background: var(--card);
  transition: color 0.18s, border-color 0.18s, background 0.18s;
}

.admin-entry:hover {
  color: var(--text);
  border-color: #33405a;
  background: var(--card-hover);
}

/* ---------- 布局 ---------- */

.layout {
  flex: 1;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 22px 24px 34px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 350px;
  gap: 22px;
  align-items: start;
}

/* ---------- 播放器 ---------- */

.stage { min-width: 0; }

.player-shell {
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow);
}

.player-box {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  overflow: hidden;
}

.video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  display: block;
}

/* ---------- 遮罩层 ---------- */

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(8, 10, 14, 0.92);
  text-align: center;
  padding: 24px;
  z-index: 5;
}

.overlay[hidden] { display: none; }

.overlay-text { color: var(--text-2); font-size: 14px; }

.spinner { display: inline-flex; gap: 7px; margin-bottom: 4px; }

.spinner span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--brand);
  animation: bounce 1.2s infinite ease-in-out;
}

.spinner span:nth-child(2) { animation-delay: 0.15s; }
.spinner span:nth-child(3) { animation-delay: 0.3s; }

@keyframes bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.45; }
  40% { transform: translateY(-12px); opacity: 1; }
}

.offline-icon { color: #3a4356; margin-bottom: 2px; }

.offline-title { font-size: 20px; font-weight: 700; letter-spacing: 0.5px; }

.offline-desc { color: var(--text-3); font-size: 13.5px; max-width: 380px; }

.error-icon { color: var(--warn); margin-bottom: 2px; }

.error-title { font-size: 19px; font-weight: 700; }

.error-desc { color: var(--text-2); font-size: 13.5px; max-width: 400px; }

/* ---------- 控制栏 ---------- */

.controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 46px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  background: linear-gradient(to top, rgba(6, 8, 11, 0.92), rgba(6, 8, 11, 0));
  opacity: 0;
  transition: opacity 0.25s;
  z-index: 8;
}

.player-box:hover .controls,
.player-box:focus-within .controls { opacity: 1; }

.controls[hidden] { display: none; }

.ctrl-btn {
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #dfe3ea;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.16s, color 0.16s;
}

.ctrl-btn:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }

.ctrl-btn.active { color: var(--brand-2); }

.volume-wrap { display: flex; align-items: center; gap: 4px; }

.volume {
  -webkit-appearance: none;
  appearance: none;
  width: 0;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.28);
  outline: none;
  cursor: pointer;
  transition: width 0.25s;
}

.volume-wrap:hover .volume,
.volume:focus { width: 78px; }

.volume::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #fff;
}

.volume::-moz-range-thumb {
  width: 11px;
  height: 11px;
  border: none;
  border-radius: 50%;
  background: #fff;
}

.ctrl-label {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.75);
  margin-left: 6px;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.controls-spacer { flex: 1; }

/* ---------- 画质徽标（按直播源实际分辨率动态显示） ---------- */

.quality-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 9px;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.4px;
  color: #1a1206;
  background: linear-gradient(135deg, #ffd98a, #f5a524);
  border-radius: 5px;
  flex-shrink: 0;
  user-select: none;
}

.quality-badge::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #1a1206;
}

/* ---------- 房间信息 ---------- */

.room-meta {
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.room-title-wrap { display: flex; align-items: center; gap: 10px; min-width: 0; }

.room-title {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
  padding: 2.5px 8px;
  border-radius: 5px;
  flex-shrink: 0;
}

.badge-live {
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: 0 2px 10px rgba(229, 72, 77, 0.4);
}

.badge-live[hidden] { display: none; }

.room-stats { display: flex; align-items: center; gap: 16px; }

.stat {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  color: var(--text-3);
}

.stat b { color: var(--text-2); font-weight: 600; font-variant-numeric: tabular-nums; }

.stat[hidden] { display: none; }

/* ---------- 主播留言（醒目展示） ---------- */

.notice-banner {
  margin-top: 16px;
  position: relative;
  background: linear-gradient(135deg, rgba(245, 165, 36, 0.14), rgba(229, 72, 77, 0.1)) , var(--card);
  border: 1px solid rgba(245, 165, 36, 0.4);
  border-radius: var(--radius);
  padding: 14px 18px;
  overflow: hidden;
}

.notice-banner::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: linear-gradient(to bottom, #ffd98a, #f5a524);
}

.notice-banner-head {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: 1px;
  color: #ffc978;
  margin-bottom: 7px;
}

.notice-banner-text {
  font-size: 15.5px;
  font-weight: 600;
  line-height: 1.6;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}

/* ---------- 直播信息卡 ---------- */

.info-card {
  margin-top: 16px;
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  overflow: hidden;
}

.info-card-head {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--text-2);
  padding: 11px 18px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--bg-soft);
}

.status-list { list-style: none; padding: 8px 18px 12px; }

.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  font-size: 13px;
  border-bottom: 1px dashed var(--border-soft);
}

.status-row:last-child { border-bottom: none; }

.status-key { color: var(--text-3); flex-shrink: 0; }

.status-val {
  color: var(--text);
  font-weight: 500;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 260px;
}

/* ---------- 右侧聊天栏 ---------- */

.chat-panel {
  position: sticky;
  top: 82px;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 104px);
  min-height: 520px;
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  overflow: hidden;
}

.chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--bg-soft);
}

.chat-title {
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 7px;
}

.nickname-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.16s, border-color 0.16s;
  max-width: 130px;
}

.nickname-btn:hover { color: var(--text); border-color: #33405a; }

.nickname-btn span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

.chat-list::-webkit-scrollbar { width: 6px; }

.chat-list::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.chat-empty {
  margin: auto;
  color: var(--text-3);
  font-size: 12.5px;
  text-align: center;
  padding: 30px 0;
}

.chat-msg {
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-2);
  word-break: break-word;
  animation: msg-in 0.22s ease-out;
}

@keyframes msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.chat-msg .msg-name { font-weight: 700; margin-right: 5px; }

.chat-msg .msg-name.role-viewer { color: #8fb8dd; }
.chat-msg .msg-name.role-admin { color: #ffc978; }
.chat-msg .msg-name.role-system { color: var(--text-3); font-weight: 600; }

.chat-msg .msg-text { color: var(--text); }

.chat-msg.msg-admin .msg-text { color: #ffe1b0; }

.chat-msg.msg-system {
  text-align: center;
  font-size: 12px;
  color: var(--text-3);
  background: var(--bg-soft);
  border-radius: 6px;
  padding: 5px 10px;
}

.chat-msg.msg-system .msg-text { color: var(--text-3); }

.chat-msg .admin-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #1a1206;
  background: linear-gradient(135deg, #ffc978, #f5a524);
  border-radius: 4px;
  padding: 1px 5px;
  margin-right: 5px;
  vertical-align: 1px;
}

.chat-input-bar {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--border-soft);
  background: var(--bg-soft);
}

.chat-input {
  flex: 1;
  height: 38px;
  padding: 0 13px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.16s, box-shadow 0.16s;
  min-width: 0;
}

.chat-input:focus {
  border-color: rgba(229, 72, 77, 0.55);
  box-shadow: 0 0 0 3px rgba(229, 72, 77, 0.14);
}

.chat-input::placeholder { color: var(--text-3); }

.chat-send {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 38px;
  padding: 0 14px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
  transition: filter 0.16s, transform 0.12s;
}

.chat-send:hover { filter: brightness(1.1); }
.chat-send:active { transform: translateY(1px); }

.chat-send:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- 页脚 ---------- */

.footer {
  border-top: 1px solid var(--border-soft);
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 12px;
  color: var(--text-3);
}

.footer-sep {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--text-3);
}

/* ---------- 响应式 ---------- */

@media (max-width: 1080px) {
  .layout { grid-template-columns: 1fr; }
  .chat-panel {
    position: static;
    height: 480px;
    min-height: 0;
  }
}

@media (max-width: 560px) {
  .topbar-inner { padding: 0 14px; }
  .layout { padding: 14px 14px 26px; }
  .brand-name { font-size: 17px; }
  .room-title { font-size: 16px; }
  .ctrl-label { display: none; }
  .room-stats { gap: 10px; }
  .notice-banner { padding: 12px 14px; }
  .notice-banner-text { font-size: 14px; }
  .info-card .status-list { padding: 6px 14px 10px; }
  .quality-badge { display: none; }
}
