:root {
  --bg: #0b0e11;
  --panel: #181a20;
  --card: #1e2329;
  --hover: #2b3139;
  --line: #2b3139;
  --text: #eaecef;
  --dim: #848e9c;
  --dim2: #5e6673;
  --yellow: #fcd535;
  --yellow-d: #f0b90b;
  --green: #2ebd85;
  --red: #f6465d;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font-family: "BinancePlex", "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", Arial, sans-serif; -webkit-font-smoothing: antialiased; font-size: 14px; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; cursor: pointer; }
.hidden { display: none !important; }

/* 导航 */
#nav { position: sticky; top: 0; z-index: 50; height: 64px; display: flex; align-items: center; justify-content: space-between; padding: 0 24px; background: var(--panel); border-bottom: 1px solid var(--line); }
.nav-left, .nav-right { display: flex; align-items: center; gap: 28px; }
.nav-right { gap: 14px; }
.logo { display: flex; align-items: center; gap: 8px; font-size: 18px; }
.logo .wordmark { color: var(--yellow-d); font-weight: 700; font-size: 19px; letter-spacing: 1.2px; }
.logo-sep { width: 1px; height: 18px; background: var(--line); margin: 0 2px; }
.logo-square { color: var(--text); font-weight: 600; font-size: 16px; }
.logo-live { font-size: 10px; font-weight: 700; color: #000; background: var(--yellow); padding: 1px 5px; border-radius: 3px; }
.nav-links { display: flex; gap: 24px; font-size: 14px; font-weight: 500; }
.nav-links a { color: var(--text); padding: 22px 0; border-bottom: 2px solid transparent; }
.nav-links a:hover { color: var(--yellow); }
.nav-links a.on { color: var(--yellow); border-color: var(--yellow); }
.search { display: flex; align-items: center; gap: 8px; width: 260px; height: 36px; padding: 0 12px; border-radius: 8px; background: var(--card); color: var(--dim); border: 1px solid transparent; }
.search:focus-within { border-color: var(--yellow); }
.search input { flex: 1; min-width: 0; background: none; border: 0; outline: none; font-size: 13px; color: var(--text); }
.btn-ghost { height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line); background: none; font-weight: 600; font-size: 13px; }
.btn-ghost:hover { border-color: var(--yellow); color: var(--yellow); }
.me { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, #3a4250, #1e2329); border: 1px solid var(--line); }

/* 页面布局 */
#page { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; max-width: 1680px; margin: 0 auto; padding: 16px 24px 32px; align-items: start; }
#main-col { min-width: 0; display: flex; flex-direction: column; gap: 16px; }

/* 播放器 */
#player { position: relative; aspect-ratio: 16 / 9; background: #000; border-radius: 12px; overflow: hidden; }
#player video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; opacity: 0; transition: opacity .3s; }
#player video.on { opacity: 1; }
#player #vid-la { object-fit: cover; }
#player #ambient { object-fit: cover; filter: blur(40px) brightness(.45) saturate(1.3); transform: scale(1.2); }
#player video.still { animation: breathe 3.6s ease-in-out infinite; transform-origin: 50% 85%; }
@keyframes breathe { 50% { transform: scale(1.01) translateY(-2px); } }
#player.drag { outline: 2px dashed var(--yellow); outline-offset: -8px; }
.shade { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(to bottom, rgba(0,0,0,.5) 0, transparent 16%, transparent 62%, rgba(0,0,0,.7) 100%); }
#empty-media { position: absolute; inset: 0; display: grid; place-items: center; color: var(--dim); }
#empty-media.gone { display: none; }
#empty-media p { margin: 0; }
#la-loading { position: absolute; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 14px; z-index: 4; color: var(--text); background: rgba(11,14,17,.55); backdrop-filter: blur(4px); }
#la-loading.on { display: flex; }
.spinner { width: 36px; height: 36px; border-radius: 50%; border: 3px solid rgba(255,255,255,.15); border-top-color: var(--yellow); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.p-top { position: absolute; top: 14px; left: 14px; display: flex; gap: 8px; z-index: 3; }
.live-tag { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 8px; border-radius: 4px; background: var(--red); font-size: 12px; font-weight: 700; letter-spacing: .5px; }
.live-tag i { width: 6px; height: 6px; border-radius: 50%; background: #fff; animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: .3; } }
.p-chip { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 8px; border-radius: 4px; background: rgba(0,0,0,.5); font-size: 12px; font-variant-numeric: tabular-nums; }

#answering { position: absolute; top: 14px; right: 14px; max-width: 42%; z-index: 3; padding: 10px 14px; border-radius: 8px; background: rgba(24,26,32,.82); backdrop-filter: blur(10px); border-left: 3px solid var(--yellow); opacity: 0; transform: translateY(-6px); transition: .25s; }
#answering.on { opacity: 1; transform: none; }
.ans-label { font-size: 11px; color: var(--yellow); font-weight: 600; margin-bottom: 4px; }
#ans-text { font-size: 13px; line-height: 1.5; }
#ans-text b { color: var(--dim); font-weight: 500; margin-right: 4px; }

#subtitle { position: absolute; left: 10%; right: 10%; bottom: 64px; z-index: 3; text-align: center; pointer-events: none; }
#sub-text { font-size: clamp(16px, 1.6vw, 24px); font-weight: 600; line-height: 1.6; padding: 4px 12px; border-radius: 6px; background: rgba(0,0,0,.6); -webkit-box-decoration-break: clone; box-decoration-break: clone; }
#sub-text:empty { display: none; }
body.no-sub #subtitle { display: none; }

#screen-chat { position: absolute; left: 14px; bottom: 60px; width: 32%; max-height: 42%; margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; justify-content: flex-end; gap: 4px; overflow: hidden; z-index: 3;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 36px); mask-image: linear-gradient(to bottom, transparent 0, #000 36px); }
#screen-chat li { align-self: flex-start; max-width: 100%; font-size: 13px; line-height: 1.45; padding: 4px 10px; border-radius: 6px; background: rgba(0,0,0,.45); animation: chatIn .3s ease-out; word-break: break-all; }
#screen-chat .u { color: var(--yellow); margin-right: 4px; }
#screen-chat li.host { background: rgba(252,213,53,.18); }
#screen-chat li.sys { color: var(--dim); }
body.no-screen-chat #screen-chat { display: none; }
@keyframes chatIn { from { transform: translateY(8px); opacity: 0; } }

#thinking { position: absolute; left: 50%; bottom: 64px; transform: translateX(-50%); display: flex; align-items: center; gap: 4px; padding: 6px 12px; border-radius: 99px; background: rgba(0,0,0,.6); font-size: 12px; z-index: 3; opacity: 0; transition: .2s; }
#thinking.on { opacity: 1; }
#thinking i { width: 5px; height: 5px; border-radius: 50%; background: var(--yellow); animation: dots 1s infinite; }
#thinking i:nth-child(2) { animation-delay: .15s; } #thinking i:nth-child(3) { animation-delay: .3s; }
#thinking span { margin-left: 4px; }
@keyframes dots { 50% { transform: translateY(-3px); opacity: .4; } }

.p-bottom { position: absolute; left: 0; right: 0; bottom: 0; height: 52px; display: flex; align-items: center; gap: 8px; padding: 0 14px; z-index: 3; }
.grow { flex: 1; }
#btn-like { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border: 0; border-radius: 99px; background: rgba(0,0,0,.5); color: var(--red); font-size: 12px; font-weight: 600; }
#btn-like span { color: var(--text); }
#btn-like:active { transform: scale(.94); }
.p-icon { height: 32px; min-width: 32px; padding: 0 10px; border: 0; border-radius: 6px; background: rgba(0,0,0,.5); font-size: 12px; display: grid; place-items: center; }
.p-icon:hover { background: rgba(0,0,0,.75); }
#hearts { position: absolute; left: 22px; bottom: 44px; width: 60px; height: 260px; pointer-events: none; z-index: 3; }
.heart { position: absolute; bottom: 0; left: 10px; font-size: 22px; animation: rise 2.4s ease-out forwards; }
@keyframes rise { 0% { transform: scale(.4); opacity: 0; } 15% { opacity: 1; transform: translateY(-20px) scale(1); } 100% { transform: translate(var(--dx), -240px) scale(.8); opacity: 0; } }

#start-cover { position: absolute; inset: 0; z-index: 10; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; background: rgba(11,14,17,.5); transition: opacity .3s; }
#start-cover.gone { opacity: 0; pointer-events: none; }
#btn-start-big { display: flex; align-items: center; gap: 8px; height: 48px; padding: 0 28px; border: 0; border-radius: 8px; background: var(--yellow); color: #181a20; font-size: 16px; font-weight: 700; box-shadow: 0 8px 30px rgba(252,213,53,.25); }
#btn-start-big:hover { background: var(--yellow-d); }
#start-cover p { margin: 0; font-size: 13px; color: var(--dim); }

/* 主播信息 */
#info { display: flex; flex-direction: column; gap: 12px; }
#live-title { margin: 0; font-size: 20px; font-weight: 600; line-height: 1.4; }
.info-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.host-box { display: flex; align-items: center; gap: 12px; }
.host-ava { position: relative; width: 48px; height: 48px; border-radius: 50%; background: var(--card) center 20% / cover; }
.host-ava .ring { position: absolute; inset: -3px; border-radius: 50%; border: 2px solid var(--red); }
.host-ava::after { content: "LIVE"; position: absolute; left: 50%; bottom: -6px; transform: translateX(-50%); font-size: 9px; font-weight: 700; background: var(--red); padding: 0 4px; border-radius: 3px; }
.host-line { display: flex; align-items: center; gap: 5px; font-size: 16px; }
.host-sub { font-size: 12px; color: var(--dim); }
.host-sub em { font-style: normal; color: var(--text); }
#btn-follow { height: 32px; padding: 0 16px; margin-left: 8px; border: 0; border-radius: 6px; background: var(--yellow); color: #181a20; font-weight: 600; font-size: 13px; }
#btn-follow.followed { background: var(--card); color: var(--dim); }
.info-actions { display: flex; gap: 8px; }
.chip-btn { height: 32px; padding: 0 14px; border-radius: 6px; border: 0; background: var(--card); font-size: 13px; }
.chip-btn:hover { background: var(--hover); }
.tickers { display: flex; gap: 8px; flex-wrap: wrap; }
.tk { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 6px; background: var(--card); font-size: 12px; font-variant-numeric: tabular-nums; }
.tk b { font-weight: 600; }
.tk .up { color: var(--green); } .tk .dn { color: var(--red); }

/* 主播后台 */
#studio { background: var(--panel); border-radius: 12px; border: 1px solid var(--line); }
.studio-tabs { display: flex; gap: 24px; padding: 0 20px; border-bottom: 1px solid var(--line); }
.st-tab { height: 48px; border: 0; background: none; color: var(--dim); font-weight: 600; border-bottom: 2px solid transparent; }
.st-tab:hover { color: var(--text); }
.st-tab.active { color: var(--text); border-color: var(--yellow); }
.st-pane { padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.ctrl-grid { display: grid; grid-template-columns: 1.3fr 1fr 1fr 1.6fr; gap: 12px; }
.stat { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 8px; background: var(--card); }
.stat b { display: block; font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat small { color: var(--dim); font-size: 12px; }
.state { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--dim2); }
.state.idle { background: var(--green); } .state.think { background: var(--yellow); animation: blink 1s infinite; } .state.talk { background: var(--red); animation: blink .7s infinite; }
.ctrl-btns { display: flex; gap: 8px; }
.btn-yellow { height: 40px; padding: 0 18px; border: 0; border-radius: 8px; background: var(--yellow); color: #181a20; font-weight: 600; }
.btn-yellow:hover { background: var(--yellow-d); }
.btn-dark { height: 40px; padding: 0 16px; border: 0; border-radius: 8px; background: var(--hover); font-weight: 600; }
.btn-dark:hover { background: #3a414b; }
.ctrl-btns .btn-yellow, .ctrl-btns .btn-dark { flex: 1; height: auto; }
.switches { display: flex; gap: 24px; flex-wrap: wrap; font-size: 13px; color: var(--dim); }
.sw { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.sw input { display: none; }
.sw span { flex: none; width: 32px; height: 18px; border-radius: 99px; background: var(--hover); position: relative; transition: .2s; }
.sw span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--dim); transition: .2s; }
.sw input:checked + span { background: var(--yellow); }
.sw input:checked + span::after { left: 16px; background: #181a20; }

.setup-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--dim); }
.field input, .field textarea, .field select, .search-in { background: var(--card); border: 1px solid transparent; border-radius: 8px; padding: 10px 12px; outline: none; color: var(--text); font-size: 13px; }
.field input:focus, .field textarea:focus, .search-in:focus { border-color: var(--yellow); }
.field textarea { resize: vertical; line-height: 1.6; }
.field select option { background: var(--card); }
.field output { color: var(--text); }
.field input[type=range] { padding: 0; background: none; accent-color: var(--yellow); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.seg { display: flex; padding: 3px; border-radius: 8px; background: var(--card); }
.seg-btn { flex: 1; height: 32px; border: 0; border-radius: 6px; background: none; color: var(--dim); font-size: 13px; font-weight: 600; }
.seg-btn.active { background: var(--hover); color: var(--text); }
#la-settings, #local-settings { display: flex; flex-direction: column; gap: 12px; }
body.engine-local #la-settings, body.engine-liveavatar #local-settings { display: none; }
#av-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; max-height: 280px; overflow-y: auto; padding-right: 4px; }
.av-item { position: relative; padding: 0; border: 2px solid transparent; border-radius: 8px; overflow: hidden; background: var(--card); aspect-ratio: 16 / 10; }
.av-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.av-item span { position: absolute; left: 0; right: 0; bottom: 0; padding: 12px 6px 4px; font-size: 11px; text-align: left; background: linear-gradient(transparent, rgba(0,0,0,.85)); }
.av-item.sel { border-color: var(--yellow); }
.file { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; }
.file input { font-size: 11px; color: var(--dim); max-width: 220px; }
.card { padding: 16px; border-radius: 8px; background: var(--card); display: flex; flex-direction: column; gap: 10px; }
.card h4 { margin: 0; font-size: 14px; font-weight: 600; }
.hint { margin: 0; font-size: 12px; line-height: 1.7; color: var(--dim); }
.hint b { color: var(--text); }
.steps { margin: 0; padding-left: 18px; font-size: 13px; line-height: 2; color: var(--dim); }
.steps b { color: var(--text); font-weight: 600; }
code, pre, kbd { font-family: "SF Mono", Menlo, monospace; font-size: 12px; background: var(--bg); border-radius: 4px; color: var(--yellow); }
code, kbd { padding: 1px 6px; word-break: break-all; }
pre { margin: 0; padding: 10px 12px; white-space: pre-wrap; }

/* 更多直播 */
#more h3 { margin: 4px 0 12px; font-size: 16px; font-weight: 600; }
#more-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.live-card { display: flex; flex-direction: column; gap: 8px; cursor: pointer; }
.lc-thumb { position: relative; aspect-ratio: 16 / 9; border-radius: 8px; overflow: hidden; background: var(--card) center / cover; transition: transform .2s; }
.live-card:hover .lc-thumb { transform: translateY(-2px); }
.lc-thumb .live-tag { position: absolute; top: 8px; left: 8px; height: 20px; font-size: 10px; }
.lc-thumb .p-chip { position: absolute; bottom: 8px; left: 8px; height: 20px; font-size: 11px; }
.lc-title { font-size: 13px; font-weight: 500; line-height: 1.4; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.lc-host { font-size: 12px; color: var(--dim); }

/* 聊天 */
#chat { position: sticky; top: 80px; height: calc(100vh - 96px); min-height: 520px; display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.chat-head { display: flex; align-items: center; justify-content: space-between; height: 52px; padding: 0 16px; border-bottom: 1px solid var(--line); }
.chat-head b { font-size: 15px; font-weight: 600; }
.online { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--dim); }
.online i { width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
.online em { font-style: normal; color: var(--text); font-variant-numeric: tabular-nums; }
.pinned { margin: 12px 12px 0; padding: 10px 12px; border-radius: 8px; background: rgba(252,213,53,.08); font-size: 12px; line-height: 1.6; color: var(--dim); }
.pin-tag { display: inline-block; margin-right: 6px; padding: 0 5px; border-radius: 3px; background: var(--yellow); color: #181a20; font-size: 11px; font-weight: 600; }
#chat-list { flex: 1; min-height: 0; margin: 0; padding: 12px 16px; list-style: none; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
#chat-list li { display: flex; gap: 10px; font-size: 13px; line-height: 1.55; animation: chatIn .25s ease-out; }
#chat-list .av { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 600; color: #181a20; background-size: cover; background-position: center 20%; }
#chat-list .bd { min-width: 0; }
#chat-list .u { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--dim); }
#chat-list .t { word-break: break-word; }
#chat-list li.host .u::after { content: "主播"; order: -1; padding: 0 4px; border-radius: 3px; background: var(--yellow); color: #181a20; font-size: 10px; font-weight: 600; line-height: 16px; }
#chat-list li.host .t { color: #fff; }
#chat-list li.queued .u::before { content: "待回答"; order: 9; padding: 0 4px; border-radius: 3px; border: 1px solid var(--dim2); color: var(--dim); font-size: 10px; line-height: 14px; }
#chat-list li.err .t { color: var(--red); }
.chat-foot { padding: 12px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
#send-form { display: flex; gap: 6px; }
#send-form input { min-width: 0; height: 40px; padding: 0 12px; border-radius: 8px; border: 1px solid transparent; background: var(--card); outline: none; font-size: 13px; }
#send-form input:focus { border-color: var(--yellow); }
#nick { width: 76px; }
#msg { flex: 1; }
#send-form .btn-yellow { padding: 0 14px; }
.quick { display: flex; gap: 6px; flex-wrap: wrap; }
.quick button { height: 26px; padding: 0 10px; border: 0; border-radius: 99px; background: var(--card); color: var(--dim); font-size: 12px; }
.quick button:hover { color: var(--yellow); background: var(--hover); }

::-webkit-scrollbar { width: 6px; } ::-webkit-scrollbar-thumb { background: var(--hover); border-radius: 3px; }

/* 纯净画面（OBS） */
body.obs #nav, body.obs #info, body.obs #studio, body.obs #more, body.obs #chat { display: none; }
body.obs #page { display: block; padding: 0; max-width: none; }
body.obs #player { border-radius: 0; width: 100vw; max-height: 100vh; margin: 0 auto; }

@media (max-width: 1100px) {
  #page { grid-template-columns: 1fr; }
  #chat { position: static; height: 560px; }
  .ctrl-grid { grid-template-columns: 1fr 1fr; }
  .setup-grid { grid-template-columns: 1fr; }
  #more-grid { grid-template-columns: repeat(2, 1fr); }
  .nav-links, .search { display: none; }
}
