@font-face { font-family: "QXPixel"; src: url(assets/fonts/pixel.woff) format("woff"); font-display: swap; }
@font-face { font-family: "QXTitle"; src: url(assets/fonts/title.woff) format("woff"); font-display: swap; }
:root {
  --gold: #f3d27a; --ink: #f0e6d2; --dim: #a89878; --line: rgba(214,170,96,.45);
  --panel: #120e0b; --red: #e84a4a;
  --font: "QXPixel", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  --title: "QXTitle", "QXPixel", "STKaiti", "KaiTi", serif;
}
* { box-sizing: border-box; }
#simulate-entry { position: fixed; right: 8px; top: calc(50% + 24px); z-index: 20; padding: 8px 6px; writing-mode: vertical-rl; color: var(--gold); background: #20180f; border: 1px solid var(--line); border-radius: 6px; font: 13px system-ui, sans-serif; text-decoration: none; }
#debug-units-entry { position: fixed; right: 8px; top: calc(50% + 112px); z-index: 20; padding: 8px 6px; writing-mode: vertical-rl; color: #9ed5ff; background: #101f2b; border: 1px solid #31536b; border-radius: 6px; font: 13px system-ui, sans-serif; text-decoration: none; }
#simulate-entry[hidden], #gear[hidden], #mobile-panel-toggle[hidden] { display: none; }
html, body { margin: 0; height: 100%; background: #000; overflow: hidden; font-family: var(--font); color: var(--ink); }
#stage { position: absolute; left: 50%; top: 50%; width: 720px; height: 1280px; transform-origin: center; transform: translate(-50%, -50%); }
#view { position: absolute; inset: 0; width: 720px; height: 1280px; display: block; }
.overlay { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; pointer-events: none; }
.overlay[hidden] { display: none; }

#loading { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; background: radial-gradient(ellipse at center, #2a1a10, #070504 70%); }
#loading b { font-family: var(--title); font-size: 72px; color: var(--gold); letter-spacing: 8px; text-shadow: 0 0 30px rgba(243,210,122,.4); }
#loading small { color: var(--dim); font-size: 20px; font-variant-numeric: tabular-nums; }
#loading .bar { width: 460px; height: 14px; border-radius: 8px; background: rgba(255,255,255,.08); border: 1px solid rgba(243,210,122,.35); overflow: hidden; box-shadow: 0 0 18px rgba(0,0,0,.6) inset; }
#loading .bar i { display: block; height: 100%; border-radius: 8px; background: linear-gradient(90deg, #8a5a1e, #f3d27a 70%, #fff3cf); box-shadow: 0 0 12px rgba(243,210,122,.6); transition: width .25s ease-out; }

/* 开场页：让出顶栏和底部两块面板 */
#lobby { top: 112px; bottom: 290px; padding: 40px 34px 0; gap: 12px;
  background: linear-gradient(180deg, rgba(8,5,3,.15) 0%, rgba(8,5,3,.82) 10%, rgba(8,5,3,.86) 90%, rgba(8,5,3,.2) 100%); }
#lobby .title { text-align: center; }
#lobby .title span { display: block; font-family: var(--title); font-size: 78px; letter-spacing: 10px; line-height: 1.1;
  background: linear-gradient(180deg, #fff3cf, #f3d27a 55%, #b8822e); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 4px 0 rgba(60,20,0,.8)) drop-shadow(0 0 24px rgba(243,210,122,.35)); }
#lobby .title small { color: #d8c8a8; font-size: 18px; letter-spacing: 2px; }
#lobby .count { font-size: 64px; font-weight: 800; color: #fff; line-height: 1; text-shadow: 0 0 22px rgba(255,220,160,.45); }
#lobby .count small { font-size: 20px; color: var(--dim); margin-left: 8px; font-weight: 400; }
#lobby .chapter { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 26px; border: 2px solid var(--c); border-radius: 14px; background: rgba(0,0,0,.35); }
#lobby .chapter b { font-family: var(--title); font-size: 34px; color: var(--c); }
#lobby .chapter span { font-size: 17px; color: var(--ink); }
#lobby .failnote { color: #ff9a8a; font-size: 17px; }
#lobby .join { font-size: 18px; color: var(--gold); }
#lobby .sects { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; width: 100%; margin-top: 4px; }
#lobby .sects span { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; border-radius: 10px; background: rgba(255,255,255,.04); border-top: 3px solid var(--c); }
#lobby .sects b { font-size: 16px; color: var(--c); font-weight: 400; }
#lobby .sects small { font-size: 12px; color: var(--dim); }
#lobby .hint { margin-top: 6px; font-size: 16px; color: #d8c8a8; background: rgba(0,0,0,.4); border: 1px solid var(--line); border-radius: 999px; padding: 7px 18px; }

/* 结算页 */
#result { justify-content: center; background: radial-gradient(ellipse at center, rgba(8,5,3,.92) 35%, rgba(8,5,3,.6) 75%, rgba(8,5,3,.25)); }
#result .win { font-family: var(--title); font-size: 64px; letter-spacing: 6px; }
#result .win.ok { color: #ffe9b8; text-shadow: 0 0 30px #d8902e; }
#result .win.fail { color: #ffc0b8; text-shadow: 0 0 30px #b0302a; }
#result .reason { color: #d8c8a8; font-size: 19px; margin: 6px 0 18px; }
#result .next { margin-top: 18px; color: var(--dim); font-size: 17px; }
.restable { width: 680px; border-collapse: collapse; background: rgba(18,12,8,.92); border-radius: 14px; overflow: hidden; border-top: 4px solid var(--gold); }
.restable th { font-size: 13px; color: var(--dim); font-weight: 400; text-align: left; padding: 8px 8px 6px; border-bottom: 1px solid rgba(255,255,255,.1); }
.restable td { padding: 5px 8px; border-bottom: 1px solid rgba(255,255,255,.05); vertical-align: middle; }
.restable tr:nth-child(even) td { background: rgba(255,255,255,.025); }
.restable .rkc { width: 36px; text-align: center; }
.restable .rk { display: inline-flex; width: 24px; height: 24px; border-radius: 50%; align-items: center; justify-content: center; color: var(--dim); font-size: 15px; }
.restable .rk.r0 { background: #ffd23a; color: #2a1a00; } .restable .rk.r1 { background: #d8dde6; color: #222; } .restable .rk.r2 { background: #d58a4a; color: #2a1000; }
.restable .who { width: 200px; }
.restable .whoin { display: flex; align-items: center; gap: 8px; }
.restable .av { width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--gold); object-fit: cover; flex: none; background: #1a120c; display: inline-flex; align-items: center; justify-content: center; overflow: hidden; }
.restable .nm { display: flex; flex-direction: column; max-width: 150px; font-size: 15px; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #fff; }
.restable .nm small { font-size: 12px; color: var(--dim); }
.restable .mer { width: 56px; color: var(--gold); font-size: 17px; text-align: right; }
.restable .dmg { width: 64px; color: #ff9a6b; font-size: 15px; text-align: right; white-space: nowrap; }
.restable .lootc { padding-left: 14px; }
.restable .drop { display: flex; align-items: center; gap: 6px; }
.restable .drop + .drop { margin-top: 3px; }
.restable .dn { display: flex; flex-direction: column; line-height: 1.25; white-space: nowrap; }
.restable .dn b { font-size: 14px; font-weight: 400; }
.restable .dn small { font-size: 12px; color: var(--dim); }
.restable .dn em { font-style: normal; } .restable .dn em.on { color: #7dffb0; }
.restable .tag { font-style: normal; font-size: 11px; color: #1a1200; background: #ffd86b; border-radius: 6px; padding: 0 4px; margin-left: 5px; }
.restable .tag.gift { background: #ff7aa8; color: #2a0012; }
.restable .nodrop { color: rgba(255,255,255,.25); }
.restable .empty { color: var(--dim); padding: 12px; text-align: center; }

/* 主播设置 */
#gear { position: fixed; right: 8px; top: calc(50% - 15px); z-index: 10; width: 30px; height: 30px; border-radius: 50%; border: 1px solid rgba(255,255,255,.15);
  background: rgba(20,14,10,.5); color: #d8c8a8; cursor: pointer; padding: 0; opacity: .45; font-size: 16px; transition: opacity .2s, transform .4s; }
#gear:hover { opacity: 1; transform: rotate(60deg); }
#panel { position: fixed; right: 0; top: 0; bottom: 0; width: min(430px, 100vw); z-index: 20; overflow: auto; background: var(--panel);
  border-left: 1px solid var(--line); padding: 0 16px 24px; font-size: 14px; box-shadow: -10px 0 40px rgba(0,0,0,.5); font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif; }
#panel[hidden] { display: none; }
#panel [hidden] { display: none !important; }
#panel header { position: sticky; top: 0; background: var(--panel); display: flex; justify-content: space-between; align-items: center; padding: 14px 0 10px; border-bottom: 1px solid var(--line); }
#panel header span { display: flex; gap: 6px; }
#panel h3 { font-size: 14px; color: var(--gold); margin: 16px 0 8px; }
#panel .row { display: flex; align-items: center; gap: 8px; margin: 6px 0; }
#panel .row.wrap { flex-wrap: wrap; }
#panel input[type=number] { width: 78px; background: #080605; color: var(--ink); border: 1px solid #3a2e22; border-radius: 6px; padding: 5px 6px; }
#panel textarea { width: 100%; background: #080605; color: var(--ink); border: 1px solid #3a2e22; border-radius: 6px; padding: 6px; font-family: inherit; }
#panel button { background: #2a1e14; color: var(--ink); border: 1px solid #5a4430; border-radius: 6px; padding: 6px 10px; cursor: pointer; font-family: inherit; }
#panel button:hover { background: #3a2a1a; }
#panel button.primary { background: #9a5a1a; border-color: #d8902e; color: #fff; font-weight: 700; }
#panel button.danger { border-color: #7a2b36; color: #ffb3bd; }
#panel .note { color: var(--dim); font-size: 12px; }
#panel .autosave { margin: 8px 0 0; } #panel .autosave #save-note { color: var(--gold); margin-left: 6px; }
#panel .status { padding: 8px 10px; background: #080605; border-radius: 6px; }
#panel .status .err { color: #ffb3bd; margin-top: 4px; }
#panel .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: #666; }
#panel .dot.connected { background: #3ee08f; } #panel .dot.connecting, #panel .dot.reconnecting { background: #ffc94d; } #panel .dot.error { background: #ff5d6c; }
#panel .audio label { white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; }
#panel .audio input[type=range] { width: 100px; }
#save-text { font-family: ui-monospace, Consolas, monospace; font-size: 11px; }
#blocked { position: fixed; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.92); font-size: 22px; text-align: center; line-height: 1.7; }
#blocked[hidden] { display: none; }

/* 结算页：本局送礼榜 */
.giftres { width: 680px; margin-bottom: 12px; background: linear-gradient(180deg, rgba(70,18,36,.92), rgba(30,10,18,.92)); border-radius: 14px; border-top: 4px solid #ff7aa8; padding: 6px 10px 6px; }
.giftres .gh { color: #ffc0d6; font-size: 17px; padding: 2px 2px 6px; display: flex; align-items: baseline; gap: 10px; border-bottom: 1px solid rgba(255,255,255,.08); }
.giftres .gh small { color: #c99aab; font-size: 12px; }
.giftres .grow { display: flex; align-items: center; gap: 8px; padding: 4px 2px; }
.giftres .grow + .grow { border-top: 1px solid rgba(255,255,255,.05); }
.giftres .rk { display: inline-flex; width: 22px; height: 22px; border-radius: 50%; align-items: center; justify-content: center; color: #e8c8d4; font-size: 14px; flex: none; }
.giftres .rk.r0 { background: #ffd23a; color: #2a1a00; } .giftres .rk.r1 { background: #d8dde6; color: #222; } .giftres .rk.r2 { background: #d58a4a; color: #2a1000; }
.giftres .av { width: 32px; height: 32px; border-radius: 50%; border: 2px solid #ff7aa8; object-fit: cover; flex: none; background: #1a120c; display: inline-flex; align-items: center; justify-content: center; overflow: hidden; }
.giftres .gnm { display: flex; flex-direction: column; width: 190px; font-size: 15px; line-height: 1.2; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.giftres .gnm small { font-size: 12px; color: #d9a9bb; overflow: hidden; text-overflow: ellipsis; }
.giftres .gco { width: 70px; text-align: right; color: #ffd86b; font-size: 18px; line-height: 1; }
.giftres .gco small { font-size: 11px; color: #c9a86a; margin-left: 2px; }
.giftres .pks { flex: 1; display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }
.giftres .pk { font-style: normal; font-size: 12px; padding: 1px 6px; border-radius: 7px; background: rgba(255,122,168,.18); color: #ffc0d6; white-space: nowrap; }
.giftres .pk.got { background: #7dffb0; color: #06281a; }
.giftres .pk.dbl { background: #ffd23a; color: #2a1a00; }
.giftres .pk.fl { background: rgba(255,255,255,.08); color: var(--c); border: 1px solid var(--c); }

/* 大哥入场动画：盖在游戏画面最上层（透明 WebM 透出游戏画面） */
#entrance { position: absolute; inset: 0; z-index: 30; pointer-events: none; display: flex; align-items: center; justify-content: center; background: transparent; }
#entrance[hidden] { display: none; }
#entrance video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: transparent; }
#entrance .ent-cap { position: absolute; left: 0; right: 0; top: 30%; display: flex; flex-direction: column; align-items: center; gap: 4px; opacity: 0; }
#entrance .ent-cap.show { animation: entCap 4.5s ease-out forwards; }
#entrance .ent-title { font-family: var(--title); font-size: 34px; letter-spacing: 6px; color: #ffe9b8; text-shadow: 0 0 18px #d8902e, 0 2px 0 #3a1a00; }
#entrance .ent-name { font-size: 46px; color: #fff; letter-spacing: 2px; text-shadow: 0 0 22px rgba(255,200,90,.9), 0 3px 0 #000; max-width: 640px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@keyframes entCap { 0% { opacity: 0; transform: translateY(30px) scale(.9); } 12% { opacity: 1; transform: none; } 82% { opacity: 1; } 100% { opacity: 0; } }
#panel select { background: #080605; color: var(--ink); border: 1px solid #3a2e22; border-radius: 6px; padding: 4px 6px; font-family: inherit; }
#panel input[type=text] { background: #080605; color: var(--ink); border: 1px solid #3a2e22; border-radius: 6px; padding: 5px 6px; }
#panel .gifttab { width: 100%; border-collapse: collapse; margin: 6px 0; font-size: 13px; }
#panel .gifttab th { text-align: left; color: var(--dim); font-weight: 400; font-size: 12px; padding: 2px 4px; }
#panel .gifttab th small { display: block; font-size: 11px; }
#panel .gifttab td { padding: 3px 4px; }
#panel .gifttab td:first-child { white-space: nowrap; color: var(--gold); }
#panel .gifttab .gname { width: 100%; box-sizing: border-box; }
#panel .gifttab .gprice { width: 64px; }
#panel .grec { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 3px 0; border-bottom: 1px solid #1e1812; font-size: 12px; }
#panel .grec b { color: var(--ink); min-width: 70px; } #panel .grec span { color: var(--dim); } #panel .grec i { color: #ffc94d; font-style: normal; }
#panel .dim { color: var(--dim); font-size: 12px; }
#panel .gifttab .gicon { white-space: nowrap; }
#panel .gifttab .gicon button[data-act="gift-icon"] { width: 34px; height: 34px; padding: 0; font-size: 11px; display: inline-flex; align-items: center; justify-content: center; vertical-align: middle; overflow: hidden;
  background: repeating-conic-gradient(#1a140f 0 25%, #241b14 0 50%) 50% / 10px 10px; }
#panel .gifttab .gicon button img { max-width: 30px; max-height: 30px; }
#panel .gifttab .gidel { padding: 2px 6px; margin-left: 2px; font-size: 12px; vertical-align: middle; }
.giftres .gnm small .gic { width: 15px; height: 15px; object-fit: contain; vertical-align: -3px; margin-right: 2px; }

/* 手机：游戏画面在上，原F2面板在下；所有规则由手机模式类限定。 */
html.mobile-controls { height: auto; min-height: 100%; overflow-x: hidden; overflow-y: auto; }
body.mobile-controls { display: flow-root; position: relative; height: auto; min-height: 100dvh; overflow: visible; }
body.mobile-controls #stage { top: 0; left: 50%; transform-origin: center top; }
body.mobile-controls #gear, body.mobile-controls #simulate-entry, body.mobile-controls #debug-units-entry { display: none; }
body.mobile-controls #mobile-panel-toggle {
  display: block; position: sticky; top: 0; z-index: 21; width: 100%; min-height: 48px;
  margin: var(--mobile-game-height, 100dvh) 0 0; padding: 12px;
  border: 1px solid var(--line); background: #22190f; color: var(--gold);
  font: 16px "Microsoft YaHei", system-ui, sans-serif; cursor: pointer;
}
body.mobile-controls #panel {
  position: relative; top: auto; right: auto; bottom: auto; width: 100%; max-width: none;
  overflow: visible; padding: 0 14px calc(20px + env(safe-area-inset-bottom));
  border-left: 0; font: 14px/1.6 "Microsoft YaHei", system-ui, sans-serif;
}
body.mobile-controls #panel header { top: 48px; z-index: 1; gap: 8px; flex-wrap: wrap; }
body.mobile-controls #panel .row { flex-wrap: wrap; }
body.mobile-controls #panel input, body.mobile-controls #panel select, body.mobile-controls #panel textarea { max-width: 100%; font-size: 16px; }
body.mobile-controls #panel button { min-height: 42px; font-size: 14px; }
body.mobile-controls #panel .gifttab { font-size: 12px; }
