* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; background: #14100b; font-family: "Microsoft YaHei", system-ui, sans-serif; color: #e8d9b0; }
#stage { position: relative; width: 960px; height: 600px; margin: 16px auto; box-shadow: 0 0 50px #000; border: 1px solid #3a2f1e; }
#game { display: block; background: #2b2118; }
.hidden { display: none !important; }

/* HUD */
#hud { position: absolute; top: 0; left: 0; right: 0; padding: 10px 14px; display: flex; justify-content: space-between; pointer-events: none; text-shadow: 0 1px 2px #000; }
.bar { position: relative; width: 220px; height: 18px; background: #00000099; border: 1px solid #00000066; border-radius: 9px; overflow: hidden; margin-bottom: 4px; }
.bar.slim { height: 8px; width: 160px; }
.fill { height: 100%; border-radius: 9px; }
.fill.hp { background: linear-gradient(#e05548, #a02c22); width: 100%; }
.fill.st { background: linear-gradient(#e8c35a, #b98a2a); width: 100%; }
.bar span { position: absolute; width: 100%; text-align: center; font-size: 12px; line-height: 17px; color: #fff; }
#lvlbox { font-size: 13px; }
#xpwrap { display: inline-block; width: 120px; height: 6px; background: #00000099; border-radius: 3px; vertical-align: middle; margin-left: 6px; }
#xpbar { display: block; height: 100%; background: #7ec7ff; border-radius: 3px; width: 0%; }
#hud-right span { display: inline-block; margin-left: 10px; font-size: 14px; background: #000000aa; padding: 3px 12px; border-radius: 12px; }

#bufficon { position: absolute; top: 56px; right: 14px; background: #4a2c6e; padding: 4px 12px; border-radius: 12px; font-size: 12px; }

#hint { position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%); font-size: 12px; color: #fffa; background: #000a; padding: 3px 14px; border-radius: 10px; white-space: nowrap; }

/* 对话 */
#dialogue { position: absolute; left: 50%; bottom: 22px; transform: translateX(-50%); width: 640px; background: #120e0aee; border: 2px solid #8a6a35; border-radius: 10px; padding: 12px 18px 26px; }
#dlg-name { color: #f0c060; font-size: 14px; margin-bottom: 6px; }
#dlg-text { font-size: 15px; line-height: 1.7; min-height: 48px; }
#dlg-next { position: absolute; right: 14px; bottom: 6px; font-size: 12px; color: #999; animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .3; } }

/* 面板 */
#panel { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 540px; max-height: 530px; background: #16100a; border: 2px solid #8a6a35; border-radius: 12px; display: flex; flex-direction: column; }
#panel-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; border-bottom: 1px solid #8a6a3566; }
#panel-title { color: #f0c060; font-size: 16px; letter-spacing: 2px; }
#panel-close { background: none; border: none; color: #c96; font-size: 16px; cursor: pointer; }
#panel-body { padding: 12px 16px; overflow-y: auto; font-size: 14px; }
.phead { margin-bottom: 10px; font-size: 14px; }
.phead b { color: #f0c060; font-weight: normal; font-size: 18px; padding: 0 2px; }
.task { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px; border-bottom: 1px dashed #8a6a3544; gap: 8px; }
.task .pts { color: #9fd48a; font-size: 12px; white-space: nowrap; }
.done { color: #9fd48a; font-size: 12px; white-space: nowrap; }
.addform { margin-top: 14px; display: flex; gap: 8px; align-items: center; }
.addform input { flex: 1; }
.small { margin-top: 12px; font-size: 12px; color: #8a7a5c; line-height: 1.8; }
.invrow { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; border-bottom: 1px dashed #8a6a3544; gap: 8px; }
.statline { margin: 5px 0; }
.statline b { color: #f0c060; font-weight: normal; }
.gachaout { margin-top: 14px; text-align: center; font-size: 17px; padding: 14px; background: #241a10; border-radius: 8px; color: #e8d9b0; }
.gachaout.rare { color: #ffd700; text-shadow: 0 0 12px #ffd70055; }
.danger { border-color: #a03a2a; color: #e08a7a; margin-top: 16px; }
.smallbtn { background: none; border: 1px solid #5a4a30; color: #a08860; padding: 4px 14px; margin-top: 14px; font-size: 12px; }
button { background: #5a3a1a; color: #f4e3c0; border: 1px solid #8a6a35; border-radius: 6px; padding: 4px 14px; cursor: pointer; font-size: 13px; }
button:hover { background: #7a4e22; }
button:disabled { opacity: .4; cursor: default; }
input, select { background: #241a10; color: #e8d9b0; border: 1px solid #8a6a35; border-radius: 6px; padding: 5px 8px; font-size: 13px; }

/* 提示 */
#toasts { position: absolute; right: 14px; bottom: 60px; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; pointer-events: none; }
.toast { background: #000d; border-left: 3px solid #f0c060; padding: 6px 12px; border-radius: 4px; font-size: 13px; animation: tin .3s, tout .5s 2.6s forwards; max-width: 420px; }
@keyframes tin { from { transform: translateX(30px); opacity: 0; } }
@keyframes tout { to { transform: translateX(30px); opacity: 0; } }

/* 开场 */
#intro { position: absolute; inset: 0; background: #0b0805f5; display: flex; align-items: center; justify-content: center; }
#intro-box { width: 660px; text-align: center; }
#intro-box h1 { font-size: 58px; letter-spacing: 20px; color: #f0c060; margin-bottom: 6px; text-shadow: 0 0 26px #f0c06044; text-indent: 20px; }
#intro-box .sub { color: #a08860; margin-bottom: 30px; letter-spacing: 6px; }
#intro-box p { line-height: 2; color: #d8c9a0; margin-bottom: 16px; text-align: left; }
#intro-box .center { text-align: center; }
#intro-box .big { font-size: 20px; padding: 10px 44px; margin-top: 8px; letter-spacing: 4px; }
.fate { display: flex; justify-content: center; gap: 14px; margin: 20px 0; }
.fate div { background: #241a10; border: 1px solid #8a6a35; border-radius: 8px; padding: 12px 18px; min-width: 120px; }
.fate b { color: #f0c060; display: block; margin-bottom: 6px; font-weight: normal; font-size: 12px; letter-spacing: 2px; }
.fate span { font-size: 17px; }

/* BOSS 血条 */
#bossbar { position: absolute; top: 66px; left: 50%; transform: translateX(-50%); text-align: center; }
#bossbar span { font-size: 13px; color: #ffb0a0; text-shadow: 0 1px 2px #000; letter-spacing: 2px; }
.bar.boss { width: 320px; height: 12px; margin-top: 3px; }
.fill.bhp { background: linear-gradient(#8ec95e, #3f7a2a); width: 100%; }

/* 触屏 UI */
#touchui { position: absolute; inset: 0; pointer-events: none; }
#joy { position: absolute; left: 24px; bottom: 24px; width: 120px; height: 120px; border-radius: 50%; background: #00000066; border: 2px solid #ffffff33; pointer-events: auto; touch-action: none; }
#joyknob { position: absolute; left: 38px; top: 38px; width: 44px; height: 44px; border-radius: 50%; background: #f0c06088; }
#tbtns { position: absolute; right: 16px; bottom: 16px; display: grid; grid-template-columns: repeat(2, 64px); gap: 10px; pointer-events: auto; }
.tbtn { width: 64px; height: 64px; border-radius: 50%; background: #00000099; border: 2px solid #f0c06066; color: #f0c060; font-size: 20px; display: flex; align-items: center; justify-content: center; user-select: none; touch-action: none; }
.tbtn.big { width: 76px; height: 76px; background: #5a3a1acc; font-size: 24px; }
#tmenu { position: absolute; right: 16px; top: 96px; display: flex; flex-direction: column; gap: 8px; pointer-events: auto; }
.tbtn.small { width: 56px; height: 32px; border-radius: 8px; font-size: 13px; }

/* 手机端自适应 */
@media (max-width: 1000px) {
  #stage { width: 100vw; height: 62.5vw; max-height: 100vh; margin: 0; border: none; }
  #game { width: 100%; height: 100%; }
}
