/* ============================================================
   互动直播间 · 统一设计系统（暗色 / 现代 / 极简）
   - 所有 JS 依赖的 class / id 均保留，仅重做视觉
   - --card / --border 供 broadcaster.html 等子页面使用
   ============================================================ */
:root {
  --bg: #0b0d12;
  --bg-2: #0f131b;
  --panel: #151a24;
  --panel-2: #1d2430;
  --card: #161b25;          /* broadcaster 等页面使用 */
  --border: rgba(255, 255, 255, 0.08);
  --line: rgba(255, 255, 255, 0.09);
  --text: #e9ecf3;
  --muted: #98a2b6;
  --accent: #7c6cff;
  --accent-2: #ff5c8a;
  --accent-grad: linear-gradient(135deg, #7c6cff 0%, #b15cff 50%, #ff5c8a 100%);
  --ok: #2dd4a7;
  --warn: #fbbf24;
  --danger: #ff5c6c;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 4px 14px rgba(0, 0, 0, 0.25);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; min-height: 100%;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(124, 108, 255, 0.10), transparent 60%),
    radial-gradient(900px 500px at -10% 10%, rgba(255, 92, 138, 0.08), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", system-ui, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* 内容保护模式（仅 secure 房间）：禁用选择 / 右键菜单 / 长按（防截屏辅助） */
body.secure {
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
  overscroll-behavior: none;
}

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

/* ---------------- 顶部导航 ---------------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 22px; background: rgba(15, 19, 27, 0.72);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 30;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.brand { font-size: 18px; font-weight: 800; letter-spacing: .3px; display: flex; align-items: center; gap: 8px; }
.brand .logo {
  width: 26px; height: 26px; border-radius: 8px; background: var(--accent-grad);
  display: grid; place-items: center; font-size: 15px; box-shadow: var(--shadow-sm);
}
.hint { font-size: 13px; color: var(--muted); }
.hint:hover { color: var(--text); }

/* ---------------- 通用控件 ---------------- */
.input {
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  border-radius: var(--radius-sm); padding: 11px 13px; font-size: 14px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(124, 108, 255, .18); }
.btn {
  background: var(--accent-grad); color: #fff; border: none; border-radius: var(--radius-sm);
  padding: 11px 16px; font-size: 14px; font-weight: 600; cursor: pointer;
  transition: transform .12s, filter .15s, opacity .15s; box-shadow: var(--shadow-sm);
}
.btn:hover { filter: brightness(1.07); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.ghost { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); box-shadow: none; }
.btn.ghost:hover { border-color: var(--accent); }
.btn.like { background: var(--accent-2); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.loading, .empty { color: var(--muted); padding: 30px; text-align: center; }

/* ---------------- 首页 / 落地页 ---------------- */
.nav-cta { display: flex; align-items: center; gap: 10px; }
.nav-links { display: flex; gap: 18px; align-items: center; }
.nav-links a { font-size: 14px; color: var(--muted); transition: color .15s; }
.nav-links a:hover { color: var(--text); }

.hero {
  max-width: 1040px; margin: 0 auto; padding: 64px 22px 40px; text-align: center;
}
.hero .eyebrow {
  display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted);
  border: 1px solid var(--border); padding: 6px 14px; border-radius: 999px; margin-bottom: 20px;
  background: rgba(255,255,255,.03);
}
.hero .eyebrow .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.hero h1 {
  font-size: clamp(30px, 5vw, 52px); line-height: 1.15; margin: 0 0 16px; font-weight: 900; letter-spacing: -.5px;
}
.hero h1 .grad { background: var(--accent-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { font-size: 17px; color: var(--muted); max-width: 640px; margin: 0 auto 28px; line-height: 1.7; }
.hero .cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.hero .btn { padding: 13px 26px; font-size: 15px; }
.btn.lg { padding: 14px 30px; font-size: 16px; }
.btn.outline { background: transparent; border: 1px solid var(--line); color: var(--text); box-shadow: none; }
.btn.outline:hover { border-color: var(--accent); }

.features { max-width: 1040px; margin: 10px auto 50px; padding: 0 22px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 760px) { .features { grid-template-columns: 1fr; } }
.feature {
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.015));
  border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow-sm);
}
.feature .ico { font-size: 26px; margin-bottom: 12px; }
.feature h3 { margin: 0 0 8px; font-size: 16px; }
.feature p { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.6; }

.section { max-width: 1040px; margin: 0 auto 46px; padding: 0 22px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 16px; }
.section-head h2 { font-size: 22px; margin: 0; font-weight: 800; }
.section-head .sub { color: var(--muted); font-size: 13px; }

.room-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.room-card {
  position: relative; display: flex; flex-direction: column; gap: 12px; padding: 18px;
  background: linear-gradient(180deg, var(--panel), var(--bg-2));
  border: 1px solid var(--border); border-radius: var(--radius);
  transition: transform .15s, border-color .15s, box-shadow .15s; overflow: hidden;
}
.room-card:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: var(--shadow); }
.room-card::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 76px;
  background: var(--accent-grad); opacity: .14;
}
.room-thumb {
  width: 54px; height: 54px; border-radius: 14px; background: rgba(255,255,255,.06);
  display: grid; place-items: center; font-size: 26px; position: relative; z-index: 1;
}
.room-meta { display: flex; flex-direction: column; gap: 4px; position: relative; z-index: 1; }
.room-name { font-size: 16px; font-weight: 700; }
.room-sub { font-size: 12px; color: var(--muted); }
.room-go {
  margin-top: auto; align-self: flex-start; color: #fff; background: var(--accent-grad);
  font-size: 13px; font-weight: 700; padding: 8px 16px; border-radius: 999px;
}
.live-pill {
  position: absolute; top: 14px; right: 14px; z-index: 2; font-size: 11px; font-weight: 700;
  padding: 3px 9px; border-radius: 999px; background: var(--accent-2); color: #fff;
  display: flex; align-items: center; gap: 5px;
}
.live-pill.off { background: rgba(255,255,255,.1); color: var(--muted); }
.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 30px 16px 50px; border-top: 1px solid var(--border); margin-top: 20px; }

/* ---------------- 直播间布局 ---------------- */
.live { display: grid; grid-template-columns: 1fr 360px; gap: 0; height: calc(100vh - 57px); }
@media (max-width: 900px) {
  .live { grid-template-columns: 1fr; grid-template-rows: 42vh 1fr; }
  body.show-chat .live { grid-template-rows: 0 1fr; }
  body.show-chat .stage { display: none; }
  .mobile-toggle { display: inline-flex; }
}
.mobile-toggle {
  display: none; background: rgba(255,255,255,.1); border: 1px solid var(--line); color: var(--text);
  border-radius: 8px; padding: 5px 12px; font-size: 12px; cursor: pointer; align-items: center;
}

.stage { position: relative; background: #000; overflow: hidden; }
.video-wrap { position: absolute; inset: 0; display: grid; place-items: center; background: #000; }
#video { width: 100%; height: 100%; object-fit: contain; background: #000; }

.stage-overlay {
  position: absolute; inset: 0; display: grid; place-items: center; text-align: center;
  color: var(--muted); background: radial-gradient(circle at 50% 40%, #161a24, #05070b); z-index: 5;
}
.stage-overlay .big { font-size: 19px; color: var(--text); font-weight: 700; }
.stage-overlay .small { font-size: 13px; margin-top: 10px; }
.stage-overlay .pulse {
  width: 64px; height: 64px; margin: 0 auto 18px; border-radius: 50%;
  background: var(--accent-grad); display: grid; place-items: center; font-size: 30px;
  animation: pulse 2s ease-in-out infinite; box-shadow: 0 0 30px rgba(124,108,255,.5);
}
@keyframes pulse { 0%,100% { transform: scale(1); opacity: .9; } 50% { transform: scale(1.08); opacity: 1; } }

.stage-loading {
  position: absolute; top: 14px; left: 14px; z-index: 6; font-size: 12px; color: var(--warn);
  background: rgba(0,0,0,.55); padding: 5px 11px; border-radius: 8px; backdrop-filter: blur(4px);
}

.room-head {
  position: absolute; top: 0; left: 0; right: 0; z-index: 6; display: flex; align-items: center; gap: 10px;
  padding: 14px 16px; background: linear-gradient(180deg, rgba(0,0,0,.6), transparent);
}
.room-head .title { font-weight: 800; font-size: 15px; text-shadow: 0 1px 4px rgba(0,0,0,.6); }
.room-head .anchor { font-size: 12px; color: rgba(255,255,255,.75); }
.live-badge { background: var(--accent-2); color: #fff; font-size: 11px; padding: 3px 9px; border-radius: 6px; font-weight: 700; }
.online-badge { margin-left: auto; font-size: 12px; color: var(--ok); background: rgba(0,0,0,.4); padding: 4px 10px; border-radius: 999px; }

/* 防截屏遮罩（仅 secure 房间启用） */
.secure-veil {
  position: fixed; inset: 0; z-index: 1000; display: none; background: rgba(6,8,12,.985); color: var(--text);
  flex-direction: column; align-items: center; justify-content: center; gap: 12px; text-align: center; padding: 24px;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.secure-veil.show { display: flex; }
.secure-veil .ico { font-size: 44px; }
.secure-veil .reason { font-size: 17px; font-weight: 700; }
.secure-veil .tip { color: var(--muted); font-size: 13px; }
.secure-veil.locked { cursor: pointer; }
.secure-veil .click-tip { color: var(--accent); font-size: 13px; margin-top: 6px; }

/* 视频防录屏动态图层（仅 secure 房间显示） */
.rec-shield { position: absolute; inset: 0; z-index: 24; pointer-events: none; overflow: hidden; opacity: .55; display: none; }
body.secure .rec-shield { display: block; }
.rec-shield::before {
  content: ""; position: absolute; inset: -60%;
  background-image: repeating-linear-gradient(45deg, rgba(255,255,255,.10) 0 10px, transparent 10px 26px);
  animation: recSlide 5s linear infinite;
}
.rec-shield::after {
  content: "禁止录制 · 禁止截屏"; position: absolute; inset: 0; display: grid; place-items: center;
  color: rgba(255,255,255,.20); font-size: 26px; font-weight: 800; letter-spacing: 8px; text-shadow: 0 2px 8px rgba(0,0,0,.5);
  background: repeating-linear-gradient(45deg, rgba(0,0,0,0) 0 60px, rgba(255,255,255,.05) 60px 120px);
  background-size: 240px 240px; animation: recText 7s linear infinite;
}
@keyframes recSlide { from { transform: translate(0,0); } to { transform: translate(26px,26px); } }
@keyframes recText { from { background-position: 0 0; } to { background-position: 240px 0; } }

/* 动态水印层（仅 secure 房间加载 watermark.js 后才有内容） */
#wmLayer { position: fixed; inset: 0; z-index: 26; pointer-events: none; overflow: hidden; }
.watermark {
  position: absolute; z-index: 1; pointer-events: none; color: rgba(255,255,255,.34);
  font-size: 13px; white-space: nowrap; text-shadow: 0 1px 2px rgba(0,0,0,.6); transform: rotate(-20deg);
}

/* ---------------- 聊天面板 ---------------- */
.chat { display: flex; flex-direction: column; background: var(--panel); border-left: 1px solid var(--border); min-height: 0; }
@media (max-width: 900px) { .chat { border-left: none; } }
.chat-head {
  padding: 13px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,.02);
}
.chat-head .t { font-weight: 700; }
.chat-head .online { margin-left: auto; font-size: 12px; color: var(--ok); }

.messages { flex: 1; overflow-y: auto; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.msg { font-size: 14px; line-height: 1.55; word-break: break-word; }
.msg .name { color: #b3a8ff; font-weight: 600; margin-right: 6px; }
.msg .text { color: var(--text); }
.msg.system { color: var(--muted); font-size: 12px; text-align: center; }
.msg.private { background: rgba(255,92,138,.12); border-left: 3px solid var(--accent-2); padding: 6px 10px; border-radius: 8px; }
.msg.private .tag { color: var(--accent-2); font-size: 11px; }
.msg.gift { color: var(--warn); font-size: 13px; }

.composer { border-top: 1px solid var(--border); padding: 12px 14px; display: flex; flex-direction: column; gap: 9px; background: rgba(255,255,255,.015); }
.mute-banner { background: rgba(251,191,36,.15); border: 1px solid rgba(251,191,36,.4); color: var(--warn); font-size: 12px; padding: 7px 11px; border-radius: 9px; text-align: center; }
.gifts { display: flex; gap: 8px; flex-wrap: wrap; }
.gift-btn { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 7px 11px; cursor: pointer; font-size: 13px; transition: border-color .15s, transform .12s; }
.gift-btn:hover { border-color: var(--warn); transform: translateY(-1px); }
.btn.gift.draw { background: linear-gradient(135deg, #ff9966, #ff5c8a); border: none; }
.btn.gift.draw.shaking { animation: shake .4s; }
@keyframes shake { 0%,100%{transform:rotate(0)} 25%{transform:rotate(-8deg)} 75%{transform:rotate(8deg)} }

.lottery-bar { margin-top: 2px; }
.btn.warn { background: linear-gradient(135deg, #ffd93d, #ff9f45); color: #3a2a00; border: none; }
.btn.prize { background: linear-gradient(135deg, #ff6b6b, #ff5c8a); color: #fff; border: none; }
.btn.prize.block { width: 100%; margin-top: 12px; }
#chancesBadge { background: rgba(255,255,255,.32); border-radius: 10px; padding: 0 7px; margin-left: 5px; font-size: 12px; }

/* 幸运转盘弹层 */
.lottery-modal { width: 320px; max-width: 92vw; }
.lottery-modal h3 { display: flex; align-items: center; justify-content: space-between; }
.mini-x { background: none; border: none; color: var(--muted); font-size: 16px; cursor: pointer; line-height: 1; }
.wheel-wrap { position: relative; width: 232px; height: 232px; margin: 12px auto; }
.wheel { position: absolute; inset: 0; border-radius: 50%; border: 6px solid rgba(255,255,255,.25); box-shadow: 0 8px 24px rgba(0,0,0,.45); transition: transform 3.2s cubic-bezier(.17,.67,.3,1); }
.wheel-label { position: absolute; inset: 0; display: flex; justify-content: center; pointer-events: none; }
.wheel-label span { margin-top: 14px; font-size: 12px; font-weight: 700; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.55); }
.wheel-pointer { position: absolute; top: -10px; left: 50%; transform: translateX(-50%); z-index: 3; color: #fff; font-size: 26px; text-shadow: 0 1px 3px #000; }
.wheel-center { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); z-index: 2; width: 54px; height: 54px; border-radius: 50%; background: #fff; color: var(--accent-2); display: grid; place-items: center; font-weight: 800; box-shadow: 0 2px 8px rgba(0,0,0,.4); cursor: default; }
.lottery-info { font-size: 13px; line-height: 1.9; }
.lt-progress { color: var(--muted); font-size: 12px; }
.lt-progress b { color: var(--text); }
.lt-tip { color: var(--warn); font-size: 12px; min-height: 16px; margin-top: 6px; }

.redpacket { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.6); display: none; place-items: center; }
.redpacket.show { display: grid; }
.rp-inner { width: 260px; background: linear-gradient(160deg, #ff5c5c, #ff2d55); border-radius: 18px; padding: 28px 22px; text-align: center; color: #fff; box-shadow: 0 12px 40px rgba(255,45,85,.5); animation: rpPop .35s ease; }
@keyframes rpPop { from { transform: scale(.7); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.rp-title { font-size: 14px; opacity: .92; }
.rp-amt { font-size: 40px; font-weight: 800; margin: 10px 0 18px; }

/* 礼物飘屏 */
.float-gift { position: absolute; z-index: 28; pointer-events: none; font-size: 22px; animation: floatUp 2.2s ease-out forwards; }
@keyframes floatUp { from { opacity: 1; transform: translateY(0) scale(1); } to { opacity: 0; transform: translateY(-160px) scale(1.4); } }
.float-combo { position: absolute; z-index: 29; pointer-events: none; font-weight: 800; font-size: 20px; color: var(--warn); text-shadow: 0 2px 6px rgba(0,0,0,.6); animation: comboPop 1.5s ease-out forwards; }
@keyframes comboPop { 0% { opacity: 0; transform: scale(.6) rotate(-6deg); } 30% { opacity: 1; transform: scale(1.2) rotate(-6deg); } 100% { opacity: 0; transform: scale(1) translateY(-40px); } }

/* 私聊 / 通用弹层 */
.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 40; display: none; place-items: center; }
.modal-mask.show { display: grid; }
.modal { width: 320px; background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 18px; box-shadow: var(--shadow); }
.modal h3 { margin: 0 0 12px; font-size: 15px; display: flex; align-items: center; justify-content: space-between; }
.modal .input { width: 100%; margin-bottom: 10px; }
.modal .row { justify-content: flex-end; }
