/* 传奇·贪玩蓝月风 UI：暗底 + 金色描边 + 红色按钮 + 古风衬线 */
:root {
  --gold: #e6b84a;
  --gold2: #ffe08a;
  --gold-dark: #8a5a12;
  --red: #b3261e;
  --red2: #e04a3a;
  --bg: #120c08;
  --panel: rgba(18, 12, 8, 0.94);
  --font: "Noto Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --ok: #57e389;
  --danger: #ff5a5f;
  --dur-fast: 90ms;
  --dur-base: 180ms;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --tap: 48px;
}
@media (prefers-reduced-motion: reduce) {
  :root { --dur-fast: 0ms; --dur-base: 0ms; }
}
html[data-reduce-motion="1"] {
  --dur-fast: 0ms;
  --dur-base: 0ms;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; height: 100%; height: 100dvh; background: #000; overflow: hidden; font-family: var(--font); color: #f2e6c9; user-select: none; -webkit-user-select: none; touch-action: none; overscroll-behavior: none; }
#errlog { position: fixed; left: 0; top: 0; z-index: 9999; color: #f55; font: 11px monospace; white-space: pre; background: rgba(0,0,0,.8); max-width: 100%; max-height: 40%; overflow: auto; }
#app { position: fixed; inset: 0; display: flex; align-items: stretch; justify-content: stretch; background: radial-gradient(ellipse at center, #1a120a 0%, #000 80%); }
#stage { position: relative; width: 100%; height: 100%; overflow: clip; background: #000; transform: none !important; left: 0 !important; top: 0 !important; }
#game { position: absolute; left: 0; top: 0; width: 100%; height: 100%; display: block; cursor: crosshair; }

/* 通用 */
.screen { position: absolute; inset: 0; z-index: 20; }
.title-bg { position: absolute; inset: 0; background:
  radial-gradient(ellipse at 50% 30%, rgba(200,120,30,0.35) 0%, rgba(0,0,0,0) 55%),
  radial-gradient(ellipse at 20% 90%, rgba(180,30,20,0.35) 0%, rgba(0,0,0,0) 45%),
  radial-gradient(ellipse at 85% 80%, rgba(220,150,40,0.25) 0%, rgba(0,0,0,0) 45%),
  linear-gradient(#0a0704, #1a0f08 60%, #05030200);
}
.title-bg::before { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(115deg, rgba(255,200,100,0.04) 0 2px, transparent 2px 22px); }
.title-bg::after { content: ""; position: absolute; inset: 14px; border: 2px solid rgba(230,184,74,0.55); box-shadow: inset 0 0 0 4px rgba(0,0,0,0.6), inset 0 0 0 6px rgba(230,184,74,0.25), 0 0 40px rgba(230,184,74,0.15); pointer-events: none; }
.title-inner, .cs-inner { position: relative; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 24px; }
.logo-wrap { text-align: center; }
.logo { font-family: "Ma Shan Zheng", var(--font); font-size: 190px; line-height: 1; margin: 0; font-weight: 900; letter-spacing: 12px;
  background: linear-gradient(#fff6c8 0%, #ffd766 35%, #c98a1a 60%, #ffe9a8 75%, #8a5a12 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 4px 0 #5a2a00) drop-shadow(0 0 24px rgba(255,190,60,0.55)); }
.logo-sub { font-size: 22px; letter-spacing: 10px; color: var(--gold2); text-shadow: 0 0 12px rgba(255,200,80,0.6); }
.logo-sub2 { font-size: 20px; letter-spacing: 6px; color: #f7d98a; margin-top: 6px; }
.logo-line { width: 520px; height: 3px; margin: 6px auto; background: linear-gradient(90deg, transparent, var(--gold), transparent); }
.title-btns { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.hint { font-size: 14px; color: #b8a27a; letter-spacing: 2px; margin-top: 8px; }

.btn { font-family: var(--font); cursor: pointer; border: 2px solid var(--gold); color: #fff3d0; padding: 8px 22px; font-size: 18px; letter-spacing: 3px; border-radius: 6px; position: relative;
  background: linear-gradient(#5a1a12, #8a2418 45%, #6a160f 55%, #3a0c08); box-shadow: 0 0 0 2px #2a1206, 0 4px 0 #3a1a0a, 0 0 18px rgba(255,120,40,0.25), inset 0 1px 0 rgba(255,255,255,0.25); text-shadow: 0 2px 2px #000; transition: transform .08s, filter .15s; }
.btn:hover { filter: brightness(1.2); }
.btn:active { transform: translateY(2px); box-shadow: 0 0 0 2px #2a1206, 0 2px 0 #3a1a0a; }
.btn.big { font-size: 26px; padding: 12px 54px; letter-spacing: 6px; }
.btn.sm { font-size: 14px; padding: 5px 12px; letter-spacing: 1px; }
.btn-gold { background: linear-gradient(#f5d778, #d9a63a 45%, #b7801e 55%, #8a5a12); color: #3a1a00; text-shadow: 0 1px 0 rgba(255,255,255,0.5); border-color: #fff0b0; }
.btn-dark { background: linear-gradient(#3a2e1e, #24180c 50%, #150d05); }
.btn:disabled { filter: grayscale(0.8) brightness(0.6); cursor: default; }
.input { font-family: var(--font); font-size: 18px; padding: 8px 14px; background: #1a120a; border: 2px solid var(--gold-dark); color: var(--gold2); border-radius: 4px; text-align: center; width: 180px; letter-spacing: 2px; }

/* 金框面板 */
.panel-gold { position: relative; background: var(--panel); border: 2px solid var(--gold); box-shadow: inset 0 0 0 2px #2a1a08, inset 0 0 0 3px rgba(230,184,74,0.35), 0 0 14px rgba(0,0,0,0.7); border-radius: 4px; }
.panel-gold::before, .panel-gold::after, .panel::before, .panel::after { content: ""; position: absolute; width: 14px; height: 14px; border: 3px solid var(--gold2); pointer-events: none; }
.panel-gold::before, .panel::before { left: -3px; top: -3px; border-right: 0; border-bottom: 0; }
.panel-gold::after, .panel::after { right: -3px; bottom: -3px; border-left: 0; border-top: 0; }

/* 选职业 */
.cs-title { font-size: 48px; margin: 0; letter-spacing: 14px; color: var(--gold2); text-shadow: 0 0 20px rgba(255,200,80,0.5), 0 3px 0 #5a2a00; }
.cs-cards { display: flex; gap: 32px; }
.cs-card { width: 300px; height: 420px; cursor: pointer; padding: 14px; display: flex; flex-direction: column; align-items: center; gap: 6px; transition: transform .15s, box-shadow .15s; background: linear-gradient(rgba(30,20,10,0.95), rgba(10,6,3,0.95)); border: 2px solid #6a4a1a; border-radius: 6px; position: relative; }
.cs-card canvas { width: 240px; height: 240px; }
.cs-card .cname { font-size: 34px; letter-spacing: 8px; color: var(--gold2); text-shadow: 0 2px 0 #5a2a00; }
.cs-card .ctitle { font-size: 15px; color: #f0c070; letter-spacing: 2px; }
.cs-card .cdesc { font-size: 13px; color: #c9b58a; line-height: 1.5; text-align: center; }
.cs-card.sel { border-color: var(--gold2); transform: translateY(-8px) scale(1.03); box-shadow: 0 0 30px rgba(255,200,80,0.45), inset 0 0 0 2px rgba(255,220,120,0.3); }
.cs-card.sel::after { content: "已选择"; position: absolute; top: 8px; right: 8px; background: var(--red); color: #ffe; font-size: 12px; padding: 2px 8px; border: 1px solid var(--gold); }
.cs-bottom { display: flex; gap: 16px; align-items: center; }

/* HUD */
#hud { position: absolute; inset: 0; z-index: 10; pointer-events: none; }
#hud > * { pointer-events: auto; }
#hud-top-left { position: absolute; left: 12px; top: 12px; display: flex; gap: 10px; padding: 8px; width: 330px; }
#portrait { width: 72px; height: 72px; border: 2px solid var(--gold); border-radius: 4px; background: #000; }
.hud-stats { flex: 1; display: flex; flex-direction: column; gap: 4px; justify-content: center; }
.hud-name { font-size: 15px; color: var(--gold2); display: flex; justify-content: space-between; }
.hud-name .lv { color: #fff; background: var(--red); padding: 0 6px; font-size: 12px; border-radius: 3px; border: 1px solid var(--gold); }
.bar { position: relative; height: 14px; background: #1a0f08; border: 1px solid #5a3a12; border-radius: 3px; overflow: hidden; }
.bar .fill { position: absolute; left: 0; top: 0; bottom: 0; width: 100%; transform: scaleX(1); transform-origin: left center; transition: transform var(--dur-fast) linear; }
.bar.hp .fill { background: linear-gradient(#ff7a6a, #c0261a 50%, #7a1008); }
.bar.mp .fill { background: linear-gradient(#7ab8ff, #2a5fc0 50%, #123a80); }
.bar.xp { height: 8px; }
.bar.xp .fill { background: linear-gradient(#ffe08a, #d9a63a); }
.bar-txt { position: absolute; inset: 0; font-size: 10px; line-height: 12px; text-align: center; color: #fff; text-shadow: 0 1px 1px #000; }
.bar.xp .bar-txt { line-height: 6px; font-size: 8px; }
#hud-top-right { position: absolute; right: 12px; top: 12px; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.mini-wrap { padding: 4px; }
#minimap { display: block; width: 180px; height: 120px; }
.map-name { position: absolute; left: 0; right: 0; bottom: 4px; text-align: center; font-size: 13px; color: var(--gold2); text-shadow: 0 0 6px #000, 0 0 6px #000; letter-spacing: 2px; }
.gold-wrap { display: inline-flex; align-items: center; gap: 6px; background: rgba(0,0,0,0.7); border: 1px solid var(--gold-dark); border-radius: 12px; padding: 2px 12px 2px 6px; font-size: 16px; color: #ffe08a; }
.gold-wrap.small { font-size: 14px; }
.coin { width: 16px; height: 16px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff6b0, #e6b84a 50%, #8a5a12); box-shadow: 0 0 6px rgba(255,220,100,0.6); display: inline-block; }

#boss-bar { position: absolute; left: 50%; top: 14px; transform: translateX(-50%); width: 560px; text-align: center; }
.boss-name { font-size: 20px; color: #ff6a4a; letter-spacing: 4px; text-shadow: 0 0 10px #000, 0 2px 0 #000; margin-bottom: 4px; }
.bar.boss { height: 18px; border: 2px solid var(--gold); background: #2a0a08; }
.bar.boss .fill { background: linear-gradient(#ff6a4a, #d0201a 50%, #6a0808); }
.bar.boss .bar-txt { font-size: 12px; line-height: 14px; }

#announce { position: absolute; left: 50%; top: 132px; transform: translateX(-50%); font-size: 32px; letter-spacing: 4px; color: var(--gold2); text-shadow: 0 0 20px rgba(255,180,50,0.8), 0 3px 0 #5a2a00, 0 0 4px #000; white-space: nowrap; animation: ann 2.6s ease-out forwards; pointer-events: none; }
#loot-card { position: absolute; right: 88px; top: 230px; width: 242px; padding: 16px; background: linear-gradient(130deg,#192328f5,#101013f5); border: 1px solid #bb9760; box-shadow: 0 8px 35px #0008; pointer-events: auto; }
#loot-card .loot-kicker { color: #b7a783; font-size: 12px; letter-spacing: 2px; margin-bottom: 10px; }
.loot-row { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; }
#loot-name { display: block; font-size: 17px; }
#loot-stats { display: block; font-size: 12px; color: #a1d6af; margin-top: 5px; }
#loot-equip { width: 100%; }
#loot-dismiss { position: absolute; top: 4px; right: 7px; border: 0; background: transparent; color: #b7a783; font-size: 23px; cursor: pointer; }
#announce.red { color: #ff6a4a; text-shadow: 0 0 20px rgba(255,60,30,0.8), 0 3px 0 #3a0000, 0 0 4px #000; }
@keyframes ann { 0% { opacity: 0; transform: translateX(-50%) scale(1.8); } 12% { opacity: 1; transform: translateX(-50%) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translateX(-50%) translateY(-30px); } }

#sidebtns { position: absolute; right: 12px; top: 240px; display: flex; flex-direction: column; gap: 8px; }
.sbtn { width: 56px; height: 56px; cursor: pointer; border: 2px solid var(--gold); border-radius: 6px; background: radial-gradient(circle at 50% 30%, #4a2a10, #1a0e06); color: var(--gold2); font-family: var(--font); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 0; box-shadow: 0 2px 6px #000, inset 0 0 8px rgba(255,200,100,0.15); }
.sbtn i { font-style: normal; font-size: 22px; font-weight: 700; line-height: 1; text-shadow: 0 1px 0 #000; }
.sbtn span { font-size: 10px; letter-spacing: 1px; }
.sbtn:hover { filter: brightness(1.3); }

#chatlog { position: absolute; left: 12px; bottom: 120px; width: 380px; max-height: 190px; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; font-size: 13px; pointer-events: none; }
#chatlog div { background: rgba(0,0,0,0.55); padding: 2px 8px; border-left: 2px solid var(--gold-dark); text-shadow: 0 1px 1px #000; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; animation: chatin .3s ease-out; }
@keyframes chatin { from { opacity: 0; transform: translateX(-10px); } }
#chatlog .sys { color: #ffe08a; }
#chatlog .get { color: #7ae0ff; }
#chatlog .rare { color: #ff9ad5; font-weight: 700; }
#chatlog .warn { color: #ff6a4a; }

#skillbar { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); display: flex; gap: 10px; align-items: flex-end; padding: 8px 14px; background: linear-gradient(rgba(20,12,6,0.9), rgba(8,4,2,0.95)); border: 2px solid var(--gold); border-radius: 8px; box-shadow: 0 0 20px #000, inset 0 0 0 2px #2a1a08; }
.skill, .autobtn { position: relative; width: 64px; height: 64px; border: 2px solid #8a6a2a; border-radius: 6px; background: #000; padding: 0; cursor: pointer; overflow: hidden; box-shadow: 0 0 0 1px #000, inset 0 0 6px rgba(255,200,100,0.2); }
.skill canvas, .autobtn canvas { width: 60px; height: 60px; display: block; }
.skill .cd { position: absolute; left: 0; right: 0; bottom: 0; height: 0%; background: rgba(0,0,0,0.75); pointer-events: none; }
.skill .cdt { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 20px; color: #fff; text-shadow: 0 0 4px #000, 0 0 4px #000; pointer-events: none; }
.skill .key, .autobtn .key { position: absolute; left: 2px; top: 1px; font-size: 11px; color: var(--gold2); text-shadow: 0 0 3px #000, 0 0 3px #000; pointer-events: none; }
.skill .lv { position: absolute; right: 2px; top: 1px; font-size: 10px; color: #7ae0ff; text-shadow: 0 0 3px #000; pointer-events: none; }
.skill .lbl, .autobtn .lbl { position: absolute; left: 0; right: 0; bottom: 1px; font-size: 10px; color: #fff; text-align: center; text-shadow: 0 0 3px #000, 0 0 3px #000; pointer-events: none; }
.skill.locked { filter: grayscale(1) brightness(0.45); }
.skill.locked::after { content: attr(data-unlock); position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 12px; text-shadow: 0 0 3px #000; }
.skill.ready { border-color: var(--gold2); box-shadow: 0 0 10px rgba(255,220,120,0.5); }
.skill.nomp { border-color: #3a5fc0; }
.autobtn { border-color: var(--gold); }
.autobtn.on { border-color: #57e389; box-shadow: 0 0 14px rgba(87,227,137,0.7); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 22px rgba(87,227,137,1); } }
#skill-slots { display: flex; gap: 10px; }

#joystick { position: absolute; left: 40px; bottom: 40px; width: 160px; height: 160px; }
.stick-base { position: absolute; inset: 0; border-radius: 50%; background: rgba(0,0,0,0.35); border: 2px solid rgba(230,184,74,0.6); }
.stick-knob { position: absolute; left: 50px; top: 50px; width: 56px; height: 56px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #f5d778, #8a5a12); border: 2px solid #fff0b0; box-shadow: 0 0 10px #000; }
body.touch #skillbar { left: auto; right: 10px; transform: none; bottom: 24px; }
body.touch #chatlog { bottom: 220px; }
body.touch #hud-top-right { top: 8px; }
body.touch .skill, body.touch .autobtn { width: 72px; height: 72px; }
body.touch .skill canvas, body.touch .autobtn canvas { width: 68px; height: 68px; }

/* 面板 */
#panels { position: absolute; inset: 0; z-index: 15; background: rgba(0,0,0,0.35); }
.panel { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 640px; background: var(--panel); border: 3px solid var(--gold); box-shadow: inset 0 0 0 3px #2a1a08, inset 0 0 0 4px rgba(230,184,74,0.35), 0 0 40px #000, 0 0 30px rgba(230,184,74,0.15); border-radius: 6px; }
.panel::before, .panel::after { width: 20px; height: 20px; }
.ptitle { text-align: center; font-size: 26px; letter-spacing: 8px; color: var(--gold2); padding: 10px; background: linear-gradient(90deg, transparent, rgba(180,40,20,0.7), transparent); border-bottom: 1px solid var(--gold-dark); text-shadow: 0 2px 0 #3a0000, 0 0 10px rgba(255,200,80,0.3); position: relative; }
.pclose { position: absolute; right: 8px; top: 6px; width: 34px; height: 34px; border: 2px solid var(--gold); background: var(--red); color: #fff; font-size: 22px; line-height: 1; border-radius: 4px; cursor: pointer; font-family: var(--font); }
.pbody { padding: 14px 18px; }
.bag-grid { display: grid; grid-template-columns: repeat(10, 54px); gap: 6px; justify-content: center; }
.slot { width: 54px; height: 54px; border: 2px solid #5a3a12; background: radial-gradient(circle at 50% 40%, #2a1c0e, #0d0805); border-radius: 4px; position: relative; cursor: pointer; }
.slot canvas { width: 50px; height: 50px; display: block; }
.slot .n { position: absolute; right: 2px; bottom: 0; font-size: 11px; color: #fff; text-shadow: 0 0 3px #000, 0 0 3px #000; }
.slot .enh { position: absolute; left: 2px; top: 0; font-size: 11px; color: #ffe08a; text-shadow: 0 0 3px #000, 0 0 3px #000; }
.slot .sn { position: absolute; left: 0; right: 0; top: 0; font-size: 10px; color: #a08a5a; text-align: center; pointer-events: none; }
.slot.q1 { border-color: #57e389; } .slot.q2 { border-color: #4fa8ff; } .slot.q3 { border-color: #c86bff; box-shadow: 0 0 8px rgba(200,107,255,0.6); } .slot.q4 { border-color: #ffb02e; box-shadow: 0 0 12px rgba(255,176,46,0.8); animation: glow 1.5s infinite; }
@keyframes glow { 50% { box-shadow: 0 0 20px rgba(255,176,46,1); } }
.slot:hover { filter: brightness(1.3); }
.bag-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; gap: 10px; }
.tip { font-size: 12px; color: #b8a27a; }
.equip-body { display: flex; gap: 18px; }
.equip-left { position: relative; width: 330px; height: 300px; }
#equip-fig { position: absolute; left: 55px; top: 10px; width: 220px; height: 260px; }
.equip-slots .slot { position: absolute; }
.equip-right { flex: 1; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; font-size: 15px; }
.stats div { background: rgba(0,0,0,0.4); padding: 4px 8px; border: 1px solid #3a2a12; display: flex; justify-content: space-between; white-space: nowrap; gap: 8px; }
.stats small { font-size: 11px; color: #b8a27a; }
.stats b { color: var(--gold2); font-weight: 400; }
.stat-tip { margin-top: 14px; font-size: 12px; color: #b8a27a; }
.shop-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.shop-item { display: flex; align-items: center; gap: 10px; background: rgba(0,0,0,0.4); border: 1px solid #3a2a12; padding: 6px 10px; }
.shop-item canvas { width: 40px; height: 40px; }
.shop-item .info { flex: 1; font-size: 14px; white-space: nowrap; }
.shop-item .info small { display: block; color: #b8a27a; font-size: 12px; }
.shop-item .price { color: #ffe08a; font-size: 13px; margin-right: 6px; }
.skill-row { display: flex; align-items: center; gap: 12px; background: rgba(0,0,0,0.4); border: 1px solid #3a2a12; padding: 6px 10px; margin-bottom: 6px; }
.skill-row canvas { width: 48px; height: 48px; border: 1px solid var(--gold-dark); }
.skill-row .info { flex: 1; font-size: 14px; }
.skill-row .info b { color: var(--gold2); font-size: 16px; }
.skill-row .info small { display: block; color: #b8a27a; font-size: 12px; }
.settings { display: flex; flex-wrap: wrap; gap: 10px; }
.keys { width: 100%; font-size: 14px; line-height: 1.7; color: #d9c9a0; background: rgba(0,0,0,0.4); padding: 10px 14px; border: 1px solid #3a2a12; margin-top: 6px; }
#panel-item { width: 360px; }
#panel-shop { width: 720px; }
#item-detail { font-size: 14px; line-height: 1.7; }
#item-detail .iname { font-size: 20px; margin-bottom: 4px; }
#item-detail .aff { color: #7ae0ff; }
#item-detail .spec { color: #ff9ad5; }
#item-detail .req { color: #ff6a4a; }
.item-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

#dead { background: rgba(60,0,0,0.6); display: flex; align-items: center; justify-content: center; }
.dead-inner { text-align: center; }
.dead-title { font-size: 72px; color: #ff4a3a; letter-spacing: 16px; text-shadow: 0 0 30px #f00, 0 4px 0 #300; }
.dead-sub { font-size: 20px; color: #f2d0c0; margin: 10px 0 24px; }
#tooltip { position: absolute; z-index: 30; background: rgba(10,6,3,0.95); border: 1px solid var(--gold); padding: 6px 10px; font-size: 13px; pointer-events: none; max-width: 260px; line-height: 1.5; }

:where(button, a, input, [tabindex]):focus-visible { outline: 2px solid var(--gold2); outline-offset: 2px; }
.bar .fill { transform-origin: left center; will-change: transform; }
#coach { position: absolute; inset: 0; z-index: 28; display: flex; align-items: flex-end; justify-content: center; padding: 16px 16px calc(24px + var(--safe-b)); background: rgba(6,3,1,0.55); pointer-events: auto; }
.coach-card { width: min(420px, 100%); background: var(--panel); border: 2px solid var(--gold); border-radius: 10px; padding: 18px 18px 16px; box-shadow: 0 0 0 3px #2a1a08, 0 16px 40px #000; }
.coach-kicker { color: var(--gold2); letter-spacing: 4px; font-size: 12px; }
.coach-card h3 { margin: 6px 0 10px; font-size: 26px; letter-spacing: 4px; color: var(--gold2); }
.coach-card ol { margin: 0 0 10px; padding-left: 22px; color: #f2e6c9; line-height: 1.7; font-size: 15px; }
.coach-tip { font-size: 13px; color: #b8a27a; margin: 0 0 14px; }
#coach .btn { width: 100%; }
@media (prefers-reduced-motion: reduce) {
  #announce, #chatlog div, .autobtn.on, .slot.q4 { animation: none !important; }
}
html[data-reduce-motion="1"] #announce,
html[data-reduce-motion="1"] #chatlog div,
html[data-reduce-motion="1"] .autobtn.on,
html[data-reduce-motion="1"] .slot.q4 { animation: none !important; }

/* 竖屏：铺满视口，HUD 用真实像素，不再跟着 16:9 缩成 220px */
body.portrait .logo { font-size: clamp(64px, 22vw, 120px); letter-spacing: 6px; }
body.portrait .logo-sub { font-size: 14px; letter-spacing: 4px; }
body.portrait .logo-sub2 { font-size: 13px; letter-spacing: 2px; }
body.portrait .logo-line { width: min(280px, 80vw); }
body.portrait .title-inner, body.portrait .cs-inner { gap: 14px; padding: 12px 12px calc(12px + var(--safe-b)); justify-content: flex-start; padding-top: 8vh; overflow: auto; }
body.portrait .btn.big { font-size: 20px; padding: 12px 28px; min-height: var(--tap); }
body.portrait .hint { font-size: 12px; letter-spacing: 0; text-align: center; max-width: 90vw; }
body.portrait .cs-title { font-size: 28px; letter-spacing: 8px; }
body.portrait .cs-cards { flex-direction: column; gap: 10px; width: min(360px, 94vw); }
body.portrait .cs-card { width: 100%; height: auto; min-height: var(--tap); flex-direction: row; flex-wrap: wrap; justify-content: flex-start; padding: 8px 10px; gap: 8px; }
body.portrait .cs-card canvas { width: 72px; height: 72px; }
body.portrait .cs-card .cname { font-size: 22px; letter-spacing: 4px; }
body.portrait .cs-card .ctitle { font-size: 12px; }
body.portrait .cs-card .cdesc { font-size: 12px; text-align: left; flex: 1 1 100%; }
body.portrait .cs-bottom { flex-direction: column; width: min(360px, 94vw); }
body.portrait .cs-bottom .input, body.portrait .cs-bottom .btn { width: 100%; }
body.portrait #hud-top-left { left: max(8px, var(--safe-l)); top: max(8px, var(--safe-t)); width: min(260px, calc(100% - 118px)); padding: 6px; gap: 6px; }
body.portrait #portrait { width: 48px; height: 48px; }
body.portrait .hud-name { font-size: 13px; }
body.portrait .bar { height: 12px; }
body.portrait #hud-top-right { right: max(8px, var(--safe-r)); top: max(8px, var(--safe-t)); }
body.portrait #minimap { width: 96px; height: 64px; }
body.portrait .map-name { font-size: 10px; }
body.portrait #boss-bar { top: 78px; width: min(340px, calc(100% - 24px)); }
body.portrait #announce { top: 118px; font-size: 18px; letter-spacing: 1px; max-width: 92%; white-space: normal; text-align: center; }
body.portrait #loot-card { right: max(8px, var(--safe-r)); top: auto; bottom: 168px; width: min(220px, calc(100% - 24px)); }
body.portrait #sidebtns { top: auto; right: max(8px, var(--safe-r)); bottom: 96px; flex-direction: column; gap: 6px; }
body.portrait .sbtn { width: 52px; height: 52px; min-width: var(--tap); min-height: var(--tap); }
body.portrait .sbtn i { font-size: 18px; }
body.portrait #chatlog { left: max(8px, var(--safe-l)); bottom: 210px; width: min(200px, 52%); max-height: 110px; font-size: 12px; }
body.portrait #skillbar { left: 50%; right: auto; transform: translateX(-50%); bottom: max(8px, var(--safe-b)); gap: 6px; padding: 6px 8px; max-width: calc(100% - 16px); }
body.portrait #skill-slots { gap: 4px; }
body.portrait .skill, body.portrait .autobtn { width: 54px; height: 56px; min-width: 48px; min-height: 52px; flex-shrink: 0; }
body.portrait .skill canvas, body.portrait .autobtn canvas { width: 52px; height: 52px; }
body.portrait .skill .lbl, body.portrait .autobtn .lbl { font-size: 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 2px; }
body.portrait #joystick { left: max(12px, var(--safe-l)); bottom: max(96px, calc(88px + var(--safe-b))); width: 128px; height: 128px; }
body.portrait #panels { padding: 8px; }
body.portrait .panel { width: min(640px, calc(100% - 12px)) !important; max-height: min(86dvh, 720px); overflow: auto; }
body.portrait .bag-grid { grid-template-columns: repeat(5, minmax(48px, 1fr)); }
body.portrait .slot { width: 100%; height: auto; aspect-ratio: 1; }
body.portrait .equip-body { flex-direction: column; }
body.portrait .equip-left { width: 100%; height: 240px; }
body.portrait .shop-list { grid-template-columns: 1fr; }
body.portrait .dead-title { font-size: 40px; letter-spacing: 6px; }
body.touch #skillbar { left: 50%; right: auto; transform: translateX(-50%); bottom: max(8px, var(--safe-b)); }
body.touch.portrait #chatlog { bottom: 210px; }
body.touch .skill, body.touch .autobtn { width: 54px; height: 56px; }
/* Short landscape: keep selection inside its own scroller, never scroll the playfield. */
@media (max-height: 500px) and (min-aspect-ratio: 1/1) {
  .title-inner { gap: 12px; flex-direction: row; padding: 24px; }
  .logo { font-size: 110px; }
  .logo-sub, .logo-sub2 { font-size: 13px; letter-spacing: 2px; }
  .logo-line { width: 280px; }
  .title-btns .hint { max-width: 260px; text-align: center; font-size: 12px; }
  .cs-inner { justify-content: flex-start; gap: 8px; padding: 12px; overflow-y: auto; touch-action: pan-y; }
  .cs-title { font-size: 24px; }
  .cs-cards { gap: 14px; }
  .cs-card { width: 220px; height: 235px; padding: 8px; gap: 3px; flex-shrink: 0; }
  .cs-card canvas { width: 100px; height: 100px; }
  .cs-card .cname { font-size: 23px; }
  .cs-card .ctitle, .cs-card .cdesc { font-size: 11px; }
  .cs-bottom { flex-shrink: 0; gap: 10px; }
  .cs-bottom .btn.big { font-size: 18px; padding: 10px 22px; }
  #hud-top-left { transform: scale(.78); transform-origin: top left; }
  #hud-top-right { transform: scale(.72); transform-origin: top right; }
  #sidebtns { top: 95px; right: 8px; gap: 4px; }
  .sbtn { width: 48px; height: 48px; }
  .sbtn i { font-size: 18px; }
  #announce { top: 88px; font-size: 22px; }
  #chatlog { display: none; }
  #joystick { width: 128px; height: 128px; left: 14px; bottom: 14px; }
  #skillbar { bottom: 8px; }
  .panel { max-height: calc(100dvh - 16px); overflow-y: auto; }
}
body.touch .skill canvas, body.touch .autobtn canvas { width: 52px; height: 52px; }
body.touch .skill .key, body.touch .autobtn .key, body.touch .skill .lv { display: none; }
body.touch .skill.locked::after { inset: 2px 2px auto auto; padding: 1px 2px; background: #161616; font-size: 9px; }
body.touch .skill .lbl { font-size: 10px; }

@media (max-width: 700px) {
  .logo { font-size: clamp(64px, 22vw, 120px); letter-spacing: 6px; }
  .cs-cards { flex-wrap: wrap; justify-content: center; }
  .panel { width: min(640px, calc(100% - 16px)); max-height: 86dvh; overflow: auto; }
  .bag-grid { grid-template-columns: repeat(5, minmax(48px, 1fr)); }
  .sbtn, .skill, .autobtn, .btn.big, .pclose { min-width: 44px; min-height: 44px; }
}
