:root {
  --bg: #0d0b12;
  --panel: #17141f;
  --panel-2: #211d2c;
  --line: rgba(255, 255, 255, .08);
  --text: #f4f1f8;
  --muted: #a39db0;
  --accent: #ff4d6d;
  --accent-2: #ff9a3c;
  --grad: linear-gradient(135deg, var(--accent), var(--accent-2));
  --gold: #ffd257;
  --blue: #46b4ff;
  --ok: #3ddc97;
  --radius: 14px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", "Segoe UI", sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
body { overscroll-behavior: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.view { display: none; min-height: 100dvh; }
.view.active { display: block; }

/* ---------- 通用元件 ---------- */
.brand { font-weight: 800; letter-spacing: .02em; font-size: 20px; display: flex; align-items: center; gap: 8px; }
.brand.big { font-size: 30px; justify-content: center; }
.brand-mark { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 18px; border-radius: 999px; font-weight: 700; background: var(--panel-2); transition: transform .1s, filter .15s; white-space: nowrap; }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--grad); color: #fff; box-shadow: 0 6px 20px rgba(255, 77, 109, .35); }
.btn.ghost { background: rgba(255,255,255,.08); border: 1px solid var(--line); }
.btn.sm { padding: 6px 12px; font-size: 13px; }
.btn.lg { padding: 14px 18px; font-size: 17px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .45; pointer-events: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; background: rgba(0,0,0,.38); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); font-size: 13px; white-space: nowrap; }
.chip.coin { color: var(--gold); background: rgba(255, 210, 87, .12); }
.icon-btn { width: 34px; height: 34px; border-radius: 50%; background: rgba(0,0,0,.38); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); display: grid; place-items: center; font-size: 15px; flex: none; }
.avatar, .avatar-btn { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #1a1020; flex: none; font-size: 15px; }
.form-error { color: #ff7a8a; min-height: 1.2em; font-size: 14px; margin: 8px 0 0; }
input { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; outline: none; width: 100%; }
input:focus { border-color: var(--accent); }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }

/* ---------- 登入 ---------- */
#view-auth.active { display: grid; place-items: center; padding: 24px; background:
  radial-gradient(60% 50% at 20% 10%, rgba(255,77,109,.25), transparent 60%),
  radial-gradient(50% 50% at 90% 90%, rgba(255,154,60,.18), transparent 60%), var(--bg); }
.auth-card { width: min(380px, 100%); background: rgba(23,20,31,.85); border: 1px solid var(--line); border-radius: 22px; padding: 28px 24px; text-align: center; backdrop-filter: blur(12px); }
.auth-card p { margin: 6px 0 18px; }
.tabs { display: flex; background: var(--panel-2); border-radius: 999px; padding: 4px; margin-bottom: 18px; }
.tab { flex: 1; padding: 8px; border-radius: 999px; color: var(--muted); font-weight: 700; }
.tab.active { background: var(--panel); color: var(--text); box-shadow: 0 2px 8px rgba(0,0,0,.3); }
#auth-form { text-align: left; display: grid; gap: 12px; }
#auth-form label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
#auth-form .btn { margin-top: 6px; }

/* ---------- 大廳 ---------- */
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; padding: calc(10px + var(--safe-t)) 16px 10px; background: rgba(13,11,18,.85); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.lobby { max-width: 1200px; margin: 0 auto; padding: 16px 16px calc(24px + var(--safe-b)); }
.lobby-head { display: flex; align-items: center; justify-content: space-between; margin: 6px 0 16px; }
.lobby-head h1 { font-size: 22px; margin: 0; }
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; } }
.card { position: relative; aspect-ratio: 3 / 4; border-radius: var(--radius); overflow: hidden; background: var(--panel); text-align: left; padding: 0; display: block; width: 100%; isolation: isolate; }
.card img, .card .ph { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.card .ph { display: grid; place-items: center; font-size: 48px; font-weight: 800; color: rgba(255,255,255,.85); }
.card::after { content: ""; position: absolute; inset: 0; background: linear-gradient(transparent 55%, rgba(0,0,0,.75)); z-index: 1; }
.card .badges { position: absolute; top: 8px; left: 8px; right: 8px; display: flex; gap: 6px; z-index: 2; }
.card .badges .viewers { margin-left: auto; }
.badge-live { background: var(--grad); color: #fff; font-weight: 800; font-size: 11px; padding: 3px 8px; border-radius: 6px; }
.badge-pk { background: #7b5cff; color: #fff; font-weight: 800; font-size: 11px; padding: 3px 8px; border-radius: 6px; }
.card .meta { position: absolute; left: 10px; right: 10px; bottom: 10px; z-index: 2; }
.card .meta b { display: block; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .meta span { font-size: 12px; color: #ddd; }
.card:hover { filter: brightness(1.08); }
.empty { text-align: center; padding: 70px 0; }
.empty-icon { font-size: 54px; }
.empty p { margin: 6px 0; }

/* ---------- 開播預覽 ---------- */
#view-golive.active { position: fixed; inset: 0; background: #000; }
.fill { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.mirror { transform: scaleX(-1); }
.golive-panel { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: flex-end; padding: 16px 16px calc(20px + var(--safe-b)); background: linear-gradient(transparent 50%, rgba(0,0,0,.7)); }
.golive-panel .back { position: absolute; top: calc(14px + var(--safe-t)); left: 14px; }
.golive-card { width: min(420px, 100%); margin: 0 auto; display: grid; gap: 12px; background: rgba(13,11,18,.7); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); padding: 18px; border-radius: 20px; border: 1px solid var(--line); }
.golive-card h2 { margin: 0; font-size: 18px; }

/* ---------- 直播間 ---------- */
#view-room.active { position: fixed; inset: 0; background: #000; overflow: hidden; }
.room-layout { position: absolute; inset: 0; }
.stage-wrap { position: absolute; inset: 0; overflow: hidden; --pk-top: calc(64px + var(--safe-t)); --pk-h: 46vh; }
.stage { position: absolute; inset: 0; }
.mains { position: absolute; inset: 0; display: flex; }
.tile { position: relative; flex: 1; background: radial-gradient(circle at 50% 40%, #2a2336, #110e17); overflow: hidden; }
.tile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: transparent; }
.tile .tile-ph { position: absolute; inset: 0; display: grid; place-items: center; }
.tile .tile-ph .avatar { width: 72px; height: 72px; font-size: 30px; box-shadow: 0 0 0 6px rgba(255,255,255,.06); }
.tile .tile-ph .spin { position: absolute; bottom: 30%; font-size: 13px; color: var(--muted); }
.tile .label { position: absolute; left: 8px; bottom: 8px; font-size: 12px; padding: 3px 8px; border-radius: 999px; background: rgba(0,0,0,.45); display: flex; gap: 5px; align-items: center; max-width: calc(100% - 16px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; z-index: 2; }
.tile .label .role { font-size: 10px; font-weight: 800; padding: 1px 6px; border-radius: 4px; background: var(--grad); }
.tile .label .role.guest { background: var(--blue); }
.tile .label .role.pk { background: #7b5cff; }
.tile .muted-ic { position: absolute; right: 8px; bottom: 8px; font-size: 13px; z-index: 2; }
.stage.single .tile .label { display: none; }

/* PK 版面：兩位主播左右並排 */
.stage.pk .mains { top: var(--pk-top); bottom: auto; height: var(--pk-h); gap: 2px; }
.stage.pk .tile.main .label { bottom: auto; top: 8px; }

/* 嘉賓小窗 */
.guests { position: absolute; right: 10px; top: calc(110px + var(--safe-t)); display: flex; flex-direction: column; gap: 8px; z-index: 2; }
.guests .tile { width: 92px; height: 124px; flex: none; border-radius: 12px; border: 2px solid rgba(255,255,255,.18); }
.stage.pk .guests { top: calc(var(--pk-top) + var(--pk-h) + 50px); flex-direction: row; }
.guests .tile .label { left: 4px; bottom: 4px; font-size: 10px; padding: 2px 6px; }
.guests .tile .label .role { display: none; }
.guests .tile .tile-ph .avatar { width: 40px; height: 40px; font-size: 18px; }

.room-top { position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: calc(10px + var(--safe-t)) 10px 10px; z-index: 6; background: linear-gradient(rgba(0,0,0,.45), transparent); }
.host-pill { display: flex; align-items: center; gap: 8px; padding: 3px 12px 3px 3px; border-radius: 999px; background: rgba(0,0,0,.38); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); min-width: 0; }
.host-pill .avatar { width: 32px; height: 32px; font-size: 14px; }
.host-meta { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.host-meta b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 32vw; }
.host-meta span { font-size: 11px; color: #ddd; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 32vw; }
.room-top-right { display: flex; align-items: center; gap: 6px; flex: none; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 0 rgba(255,77,109,.7); animation: pulse 1.6s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 7px rgba(255,77,109,0); } 100% { box-shadow: 0 0 0 0 rgba(255,77,109,0); } }

/* PK 分數條 */
.pk-bar { position: absolute; left: 0; right: 0; top: calc(var(--pk-top) + var(--pk-h)); z-index: 4; display: flex; align-items: center; gap: 0; height: 40px; padding: 0; }
.pk-side { display: flex; align-items: center; gap: 6px; padding: 0 10px; font-size: 12px; height: 100%; min-width: 0; }
.pk-side b { font-size: 15px; font-variant-numeric: tabular-nums; }
.pk-side.me { background: var(--accent); }
.pk-side.other { background: var(--blue); justify-content: flex-end; }
.pk-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 22vw; opacity: .9; }
.pk-meter { position: relative; flex: 1; height: 100%; background: var(--blue); }
.pk-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 50%; background: var(--accent); transition: width .5s cubic-bezier(.2,.8,.2,1); }
.pk-fill::after { content: "⚡"; position: absolute; right: -10px; top: 50%; transform: translateY(-50%); font-size: 18px; filter: drop-shadow(0 0 6px #fff); }
.pk-timer { position: absolute; left: 50%; top: -24px; transform: translateX(-50%); background: rgba(0,0,0,.6); padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.pk-result { position: absolute; top: calc(var(--pk-top) + var(--pk-h) / 2); left: 50%; transform: translate(-50%, -50%); z-index: 7; font-size: 34px; font-weight: 900; text-shadow: 0 4px 24px rgba(0,0,0,.6); animation: pop .6s cubic-bezier(.2,1.6,.4,1); white-space: nowrap; }
@keyframes pop { from { transform: translate(-50%, -50%) scale(.3); opacity: 0; } }

.sound-pill { position: absolute; left: 50%; top: 45%; transform: translateX(-50%); z-index: 8; padding: 10px 18px; border-radius: 999px; background: rgba(0,0,0,.65); font-weight: 700; backdrop-filter: blur(8px); }

/* 側邊：聊天 + 操作列（手機為浮層） */
.side { position: absolute; left: 0; right: 0; bottom: 0; z-index: 5; display: flex; flex-direction: column; padding: 0 10px calc(10px + var(--safe-b)); pointer-events: none; }
.side > * { pointer-events: auto; }
.chat { width: min(78%, 420px); max-height: 34vh; overflow-y: auto; display: flex; flex-direction: column; gap: 5px; padding: 6px 0; mask-image: linear-gradient(transparent, #000 22%); -webkit-mask-image: linear-gradient(transparent, #000 22%); scrollbar-width: none; overscroll-behavior: contain; }
.chat::-webkit-scrollbar { display: none; }
.msg { align-self: flex-start; max-width: 100%; padding: 5px 10px; border-radius: 13px; background: rgba(0,0,0,.4); font-size: 14px; line-height: 1.4; word-break: break-word; }
.msg .n { font-weight: 700; margin-right: 6px; }
.msg .host-tag { font-size: 10px; background: var(--grad); padding: 1px 5px; border-radius: 4px; margin-right: 5px; font-weight: 800; vertical-align: 1px; }
.msg.system { color: #ffe08a; background: rgba(255, 210, 87, .12); }
.msg.join { color: #cfc7da; background: transparent; font-size: 13px; padding: 2px 10px; }
.msg.gift { background: rgba(255, 77, 109, .22); }
.msg.gift .g { color: var(--gold); font-weight: 700; }
.bottom-bar { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.chat-form { flex: 1; display: flex; align-items: center; background: rgba(0,0,0,.42); border-radius: 999px; padding: 3px 3px 3px 14px; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); min-width: 0; }
.chat-form input { background: none; border: 0; padding: 8px 0; border-radius: 0; font-size: 16px; min-width: 0; }
.chat-form .send { width: 34px; height: 34px; border-radius: 50%; background: var(--grad); flex: none; font-size: 14px; }
.round { position: relative; width: 42px; height: 42px; border-radius: 50%; background: rgba(0,0,0,.42); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); font-size: 19px; flex: none; display: grid; place-items: center; }
.round.gift { background: var(--grad); }
.round.on { background: var(--ok); }
.round:active { transform: scale(.9); }
.badge { position: absolute; top: -2px; right: -2px; min-width: 18px; height: 18px; border-radius: 9px; background: var(--accent); font-size: 11px; font-style: normal; font-weight: 800; display: grid; place-items: center; padding: 0 4px; border: 2px solid #000; }

/* 禮物飄條 */
.gift-lanes { position: absolute; left: 10px; bottom: calc(34vh + 80px + var(--safe-b)); z-index: 6; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.gift-banner { display: flex; align-items: center; gap: 8px; padding: 4px 14px 4px 4px; border-radius: 999px; background: linear-gradient(90deg, rgba(255,77,109,.9), rgba(255,154,60,.3)); animation: slideIn .35s cubic-bezier(.2,1,.3,1); min-width: 180px; }
.gift-banner .avatar { width: 32px; height: 32px; font-size: 13px; }
.gift-banner .t { line-height: 1.15; font-size: 12px; }
.gift-banner .t b { display: block; font-size: 13px; }
.gift-banner .ic { font-size: 30px; margin-left: 2px; }
.gift-banner .x { font-size: 24px; font-weight: 900; font-style: italic; color: var(--gold); text-shadow: 0 2px 0 #b5470f; }
.gift-banner .x.bump { animation: bump .25s; }
.gift-banner.out { animation: slideOut .3s forwards; }
.stage-wrap.pk .gift-lanes { bottom: auto; top: calc(var(--pk-top) + var(--pk-h) + 50px); }
@keyframes slideIn { from { transform: translateX(-110%); opacity: 0; } }
@keyframes slideOut { to { transform: translateX(-110%); opacity: 0; } }
@keyframes bump { 50% { transform: scale(1.5); } }

/* 大禮物全螢幕動畫 */
.big-gift { position: absolute; inset: 0; z-index: 9; pointer-events: none; display: grid; place-items: center; }
.big-gift .fx { text-align: center; animation: bigIn 3.2s ease forwards; }
.big-gift .fx .ic { font-size: min(42vw, 220px); line-height: 1; filter: drop-shadow(0 10px 40px rgba(255,154,60,.6)); }
.big-gift .fx .who { margin-top: 10px; font-size: 18px; font-weight: 800; background: rgba(0,0,0,.5); padding: 6px 16px; border-radius: 999px; display: inline-block; }
.big-gift .fx.fly .ic { animation: fly 3.2s ease-in forwards; }
@keyframes bigIn { 0% { opacity: 0; transform: scale(.2) rotate(-12deg); } 15% { opacity: 1; transform: scale(1.1) rotate(4deg); } 25% { transform: scale(1) rotate(0); } 85% { opacity: 1; } 100% { opacity: 0; transform: scale(1.15); } }
@keyframes fly { 0%, 30% { transform: translateY(0); } 100% { transform: translateY(-120vh); } }
.big-gift .burst { position: absolute; font-size: 26px; animation: burst 1.6s ease-out forwards; }
@keyframes burst { from { transform: translate(0, 0) scale(.4); opacity: 1; } to { transform: translate(var(--dx), var(--dy)) scale(1); opacity: 0; } }

/* 愛心 */
.hearts { position: absolute; right: 18px; bottom: calc(70px + var(--safe-b)); width: 60px; height: 50vh; pointer-events: none; z-index: 4; }
.heart { position: absolute; bottom: 0; left: 50%; font-size: 26px; animation: rise 2.4s ease-out forwards; }
@keyframes rise { 0% { transform: translate(-50%, 0) scale(.4); opacity: 0; } 12% { opacity: 1; transform: translate(-50%, -20px) scale(1); } 100% { transform: translate(calc(-50% + var(--dx)), -46vh) scale(.8); opacity: 0; } }

.toast { position: absolute; left: 50%; top: calc(80px + var(--safe-t)); transform: translate(-50%, -20px); background: rgba(20,17,27,.92); border: 1px solid var(--line); padding: 10px 16px; border-radius: 12px; font-size: 14px; z-index: 30; opacity: 0; pointer-events: none; transition: .25s; max-width: 86vw; text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
body > .toast { position: fixed; }

/* 底部面板 */
.sheet-backdrop { position: absolute; inset: 0; z-index: 20; background: rgba(0,0,0,.35); }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; z-index: 21; background: var(--panel); border-radius: 20px 20px 0 0; padding: 16px 16px calc(16px + var(--safe-b)); max-height: 72vh; overflow-y: auto; animation: up .25s cubic-bezier(.2,1,.3,1); border-top: 1px solid var(--line); }
@keyframes up { from { transform: translateY(100%); } }
.sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; font-size: 16px; }
.sheet h4 { margin: 18px 0 8px; font-size: 14px; color: var(--muted); font-weight: 600; }
.gift-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.gift-item { padding: 10px 4px 8px; border-radius: 12px; display: grid; justify-items: center; gap: 2px; border: 2px solid transparent; background: var(--panel-2); }
.gift-item .ic { font-size: 32px; line-height: 1.1; }
.gift-item .nm { font-size: 13px; }
.gift-item .pr { font-size: 11px; color: var(--gold); }
.gift-item.sel { border-color: var(--accent); background: rgba(255, 77, 109, .12); }
.gift-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 14px 0 10px; }
.counts { display: flex; gap: 6px; }
.counts button { padding: 6px 12px; border-radius: 999px; background: var(--panel-2); font-size: 13px; font-weight: 700; }
.counts button.sel { background: var(--accent); }
.tool-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.tool { display: grid; justify-items: center; gap: 4px; padding: 10px 4px; border-radius: 12px; background: var(--panel-2); font-size: 12px; }
.tool span { font-size: 22px; }
.tool.off { opacity: .5; text-decoration: line-through; }
.tool.danger em { color: #ff7a8a; font-style: normal; }
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.list li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; background: var(--panel-2); }
.list li .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list li .avatar { width: 30px; height: 30px; font-size: 13px; }
.list .empty-li { color: var(--muted); font-size: 13px; background: none; padding: 4px 2px; }
.rank li .no { width: 22px; text-align: center; font-weight: 900; color: var(--muted); }
.rank li:nth-child(1) .no { color: var(--gold); }
.rank li:nth-child(2) .no { color: #d6dbe5; }
.rank li:nth-child(3) .no { color: #e79a5c; }
.rank li .coins { color: var(--gold); font-size: 13px; }

.modal { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; background: rgba(0,0,0,.6); padding: 20px; }
.modal-card { width: min(360px, 100%); background: var(--panel); border-radius: 20px; padding: 22px; text-align: center; border: 1px solid var(--line); animation: pop2 .25s cubic-bezier(.2,1.4,.4,1); }
@keyframes pop2 { from { transform: scale(.85); opacity: 0; } }
.modal-body h3 { margin: 4px 0 8px; }
.modal-body p { margin: 6px 0; color: var(--muted); }
.modal-body .big { font-size: 46px; }
.modal-actions { display: flex; gap: 10px; margin-top: 18px; }
.modal-actions .btn { flex: 1; }

/* ---------- 桌機版：聊天固定在右側 ---------- */
@media (min-width: 900px) {
  .room-layout { display: grid; grid-template-columns: 1fr 380px; grid-template-rows: minmax(0, 1fr); }
  .stage-wrap { position: relative; }
  .tile video { object-fit: contain; }
  .stage.pk .tile video, .guests .tile video { object-fit: cover; }
  .stage-wrap { --pk-top: 72px; --pk-h: calc(100vh - 210px); }
  .stage.pk .mains { left: 24px; right: 24px; }
  .stage.pk .guests { top: auto; bottom: 20px; right: 24px; left: auto; }
  .pk-bar { left: 24px; right: 24px; }
  .guests .tile { width: 150px; height: 112px; }
  .host-meta b, .host-meta span { max-width: 300px; }
  .pk-name { max-width: 180px; }
  .side { position: relative; min-height: 0; overflow: hidden; background: var(--panel); border-left: 1px solid var(--line); padding: 0 14px calc(14px + var(--safe-b)); pointer-events: auto; }
  .chat { flex: 1; min-height: 0; width: 100%; max-height: none; mask-image: none; -webkit-mask-image: none; padding-top: 16px; scrollbar-width: thin; }
  .msg { background: var(--panel-2); }
  .msg.join { background: none; }
  .gift-lanes, .stage-wrap.pk .gift-lanes { top: auto; bottom: 30px; }
  .hearts { right: 24px; bottom: 20px; }
  .sheet { left: auto; right: 0; width: 380px; bottom: 0; top: auto; border-radius: 20px 0 0 0; }
  .sheet-backdrop { background: rgba(0,0,0,.2); }
}

/* ---------- 直播工作室 ---------- */
.studio-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.studio-btn { display: grid; justify-items: center; gap: 2px; padding: 9px 4px; border-radius: 12px; background: rgba(255,255,255,.08); border: 1px solid var(--line); font-size: 13px; }
.studio-btn span { font-size: 20px; }
.studio-backdrop { position: fixed; inset: 0; z-index: 34; background: transparent; }
.sheet.studio { position: fixed; z-index: 35; max-height: 50vh; padding-top: 10px; background: #17141f; display: flex; flex-direction: column; overflow: hidden; }
.sheet.studio[hidden] { display: none !important; }
.studio-tabs { display: flex; gap: 4px; padding: 4px 0 10px; flex: none; border-bottom: 1px solid var(--line); margin-bottom: 4px; overflow-x: auto; scrollbar-width: none; }
.studio-pane { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding-bottom: 6px; }
.studio-tabs button { padding: 7px 12px; border-radius: 999px; font-size: 13px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.studio-tabs button.sel { background: var(--panel-2); color: var(--text); }
.studio-tabs .studio-x { margin-left: auto; color: var(--muted); }
.studio-pane h5 { margin: 12px 0 8px; font-size: 13px; font-weight: 600; }
.studio-pane h5 .muted { font-weight: 400; font-size: 12px; margin-left: 6px; }
.fx-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; }
.fx-row::-webkit-scrollbar { display: none; }
.fx-chip { flex: none; display: grid; justify-items: center; gap: 5px; width: 64px; padding: 2px 0; font-size: 12px; color: var(--muted); }
.fx-chip .ic { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; font-size: 26px; background: var(--panel-2); border: 2px solid transparent; }
.fx-chip.sel { color: var(--text); }
.fx-chip.sel .ic { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255,77,109,.25); }
.fx-chip:active .ic { transform: scale(.92); }
.slider { display: grid; grid-template-columns: 76px 1fr 34px; align-items: center; gap: 10px; margin-top: 14px; font-size: 13px; color: var(--muted); }
.slider b { font-weight: 600; color: var(--text); text-align: right; font-variant-numeric: tabular-nums; }
.slider input[type=range] { width: 100%; padding: 0; background: none; border: 0; accent-color: var(--accent); }
.marquee-row { display: flex; gap: 8px; }
.marquee-row input { padding: 9px 12px; }
.now-playing { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 14px; background: var(--grad); margin-bottom: 10px; }
.now-playing span { flex: 1; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.round.sm { width: 34px; height: 34px; font-size: 14px; background: rgba(0,0,0,.25); }
.list.music li { cursor: pointer; }
.list.music li.playing { background: rgba(255,77,109,.18); }
.list.music .mic { width: 24px; text-align: center; }
.file-btn { margin: 10px 0 4px; cursor: pointer; }
.switch { display: flex; align-items: center; gap: 10px; margin-top: 14px; font-size: 14px; }
.switch input { width: 18px; height: 18px; accent-color: var(--accent); }
.music-chip { position: absolute; left: 10px; top: calc(60px + var(--safe-t)); z-index: 6; max-width: 55vw; padding: 4px 12px; border-radius: 999px; font-size: 12px; background: rgba(0,0,0,.4); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; animation: glowPulse 2s infinite; }
@keyframes glowPulse { 50% { box-shadow: 0 0 0 3px rgba(255,77,109,.35); } }
@media (min-width: 900px) { .sheet.studio { max-height: 70vh; } }
