@font-face { font-family: 'GlorySerif'; src: url('assets/fonts/glory-serif.woff2') format('woff2'); font-weight: 600 900; font-display: swap; }
:root {
  --ink: #0b0f14; --panel: rgba(14, 19, 26, 0.88); --panel2: rgba(22, 29, 38, 0.92);
  --line: rgba(195, 167, 117, 0.38); --gold: #c3a775; --gold2: #e6cf9a; --teal: #4d9d9a; --teal2: #7fd6cd;
  --red: #cf624b; --red2: #ff8a6a; --text: #ece6da; --muted: #9aa3ad; --hp: #d5493a; --mp: #3f86d6;
  --serif: 'GlorySerif', 'Songti SC', 'STZhongsong', 'SimSun', serif; --sans: 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Noto Sans SC', sans-serif;
  --safe-top: env(safe-area-inset-top, 0px); --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px); --safe-left: env(safe-area-inset-left, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0b0f14; color: var(--text); font-family: var(--sans); user-select: none; -webkit-user-select: none; }
#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
button { font-family: var(--sans); }
button, input, select, summary { touch-action: manipulation; }
.graphics-recovery { position: fixed; inset: 0; z-index: 19; display: grid; place-items: center; padding: 24px; background: rgba(11,15,20,.88); color: var(--gold2); font-size: 16px; text-align: center; pointer-events: none; }
.graphics-recovery[hidden] { display: none; }
.screen, .panel, .setup-body, .wardrobe { overscroll-behavior: contain; }
kbd { display: inline-block; min-width: 1.6em; padding: 0 .35em; margin: 0 .1em; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; background: rgba(255,255,255,.06); font: 600 12px/1.6 var(--sans); color: var(--gold2); text-align: center; }

/* ---------- 菜单通用 ---------- */
#menu { position: fixed; inset: 0; z-index: 20; }
#menu.side { inset: 0 auto 0 0; width: 380px; }
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; overflow: auto; }
.bg { position: absolute; inset: 0; background-size: cover; background-position: center; z-index: -1; }
body.attract .main-screen .bg { background-image: none !important; background: transparent; }
body.attract .main-screen .bg::after { background: linear-gradient(90deg, rgba(8,11,16,.78) 0%, rgba(8,11,16,.25) 55%, rgba(8,11,16,.55) 100%); }
body.attract .setup-screen .bg { opacity: .9; }
.bg.dim::after, .bg.dim2::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(8,11,16,.92) 0%, rgba(8,11,16,.55) 55%, rgba(8,11,16,.75) 100%); }
.bg.dim2::after { background: linear-gradient(180deg, rgba(8,11,16,.75), rgba(8,11,16,.93) 60%); }
.btn { font: 500 15px var(--sans); color: var(--text); background: rgba(255,255,255,.06); border: 1px solid var(--line); padding: 9px 18px; border-radius: 3px; cursor: pointer; transition: all .15s; letter-spacing: .05em; }
.btn:hover { background: rgba(195,167,117,.16); border-color: var(--gold); color: #fff; }
.btn.primary { background: linear-gradient(180deg, #5bb3ad, #33716e); border-color: #8fe0d8; color: #fff; font-weight: 700; }
.btn.primary:hover { filter: brightness(1.15); }
.btn.danger { border-color: rgba(207,98,75,.6); color: #ffb5a5; }
.btn.big { font-size: 20px; padding: 14px 44px; }
.btn.ghost { background: transparent; }
.btn.wide { display: block; width: 100%; margin: 8px 0; text-align: left; padding: 12px 18px; }
.btn.chip { padding: 5px 12px; font-size: 13px; margin: 2px; }
.btn.chip.on { background: var(--teal); border-color: var(--teal2); color: #fff; }
.panel { background: var(--panel); border: 1px solid var(--line); box-shadow: 0 20px 60px rgba(0,0,0,.5); border-radius: 4px; padding: 24px 28px; backdrop-filter: blur(8px); }
.panel h2 { font: 900 26px var(--serif); margin: 0 0 16px; color: var(--gold2); letter-spacing: .1em; }
.panel h3 { font: 700 15px var(--sans); color: var(--gold); margin: 18px 0 8px; }

/* 标题 */
.title-screen { justify-content: center; align-items: flex-start; padding-left: 7vw; }
.title-block { max-width: 520px; }
.logo { font: 900 132px/1 var(--serif); letter-spacing: .12em; background: linear-gradient(180deg, #fff6df, #c3a775 60%, #8a6a44); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 6px 24px rgba(0,0,0,.6)); }
.logo.small { font-size: 42px; }
.logo-en { font: 500 16px var(--sans); letter-spacing: .5em; color: var(--teal2); margin: 10px 0 26px; }
.tagline { font: 600 20px var(--serif); color: #e8e2d4; margin-bottom: 34px; opacity: .9; }
.fine { margin-top: 28px; font-size: 12px; color: var(--muted); }

/* 主菜单 */
.main-screen { padding: 28px 5vw 4vh; }
body.attract .main-screen .mode-grid { margin-top: auto; }
body.attract .mode-card { min-height: 0; } body.attract .mc-img { height: 120px; }
.main-head { display: flex; justify-content: space-between; align-items: center; }
.head-right { display: flex; gap: 10px; align-items: center; }
.mats { color: var(--teal2); font-size: 14px; margin-right: 8px; }
.mode-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 16px; margin-top: 6vh; }
.mode-card { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: 4px; overflow: hidden; cursor: pointer; transition: transform .2s, border-color .2s; min-height: 360px; display: flex; flex-direction: column; }
.mode-card:hover { transform: translateY(-6px); border-color: var(--gold2); }
.mc-img { height: 200px; background-size: cover; background-position: center; filter: saturate(.9); }
.mode-card:hover .mc-img { filter: saturate(1.15) brightness(1.08); }
.mc-body { padding: 16px 18px 18px; }
.mc-en { font: 700 11px var(--sans); letter-spacing: .35em; color: var(--teal2); }
.mc-name { font: 900 30px var(--serif); color: var(--gold2); margin: 4px 0 8px; }
.mc-desc { font-size: 13px; line-height: 1.65; color: #c9cfd6; }
.mc-best { position: absolute; top: 10px; right: 10px; background: rgba(0,0,0,.6); padding: 3px 8px; font-size: 12px; color: var(--teal2); border-radius: 2px; }

/* 模式设置 */
.setup-screen { padding: 22px 4vw 0; overflow: hidden; }
.setup-head { display: flex; justify-content: space-between; align-items: center; }
.setup-title { font: 900 34px var(--serif); color: var(--gold2); }
.setup-title span { font: 700 12px var(--sans); letter-spacing: .4em; color: var(--teal2); display: block; text-align: center; }
.setup-body { display: flex; gap: 28px; margin-top: 14px; flex: 1; min-height: 0; overflow-y: auto; padding-right: 6px; }
.setup-body::-webkit-scrollbar { width: 6px; } .setup-body::-webkit-scrollbar-thumb { background: var(--line); }
.setup-col { flex: 1; min-width: 0; }
.setup-col h3 { font: 700 14px var(--sans); color: var(--gold); margin: 6px 0 10px; letter-spacing: .08em; }
.setup-foot { flex: none; display: flex; justify-content: space-between; align-items: center; padding: 14px 0 18px; border-top: 1px solid rgba(195,167,117,.18); }
.diff { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.diff span { color: var(--muted); margin-right: 6px; font-size: 14px; }
.acc-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.acc-card { position: relative; display: flex; background: var(--panel2); border: 1px solid rgba(255,255,255,.08); border-left: 3px solid var(--acc, var(--teal)); cursor: pointer; border-radius: 3px; overflow: hidden; transition: all .15s; height: 76px; }
.acc-card:hover { border-color: var(--gold); }
.acc-card.sel { border-color: var(--teal2); box-shadow: 0 0 0 1px var(--teal2), 0 0 24px rgba(79,208,200,.25); background: rgba(40,70,72,.6); }
.acc-card.enemy.sel { border-color: var(--red2); box-shadow: 0 0 0 1px var(--red2), 0 0 24px rgba(255,120,90,.25); background: rgba(80,40,36,.6); }
.ac-portrait { width: 64px; flex: none; background-size: 300% auto; background-position: 0% 18%; background-repeat: no-repeat; background-color: #555b63; }
.ac-info { padding: 9px 10px; min-width: 0; }
.ac-name { font: 900 18px var(--serif); color: #fff; white-space: nowrap; }
.ac-cls { font-size: 13px; color: var(--gold2); margin-top: 2px; }
.ac-cls span { color: var(--muted); margin-left: 6px; font-size: 12px; }
.ac-player { font-size: 12px; color: var(--muted); margin-top: 3px; }
.acc-card .order { position: absolute; right: 6px; top: 6px; width: 22px; height: 22px; border-radius: 50%; background: var(--teal); color: #fff; font: 700 13px/22px var(--sans); text-align: center; }
.acc-card.enemy .order { background: var(--red); }
.class-detail { margin-top: 14px; background: var(--panel); border: 1px solid var(--line); padding: 14px 16px; border-radius: 3px; font-size: 13px; line-height: 1.6; }
.cd-head b { font: 900 20px var(--serif); color: var(--gold2); margin-right: 10px; }
.cd-head span { color: var(--teal2); }
.passive { color: var(--teal2); }
.skill-table { width: 100%; border-collapse: collapse; margin-top: 6px; }
.skill-table td { padding: 4px 6px; border-top: 1px solid rgba(255,255,255,.06); vertical-align: top; }
.skill-table td:nth-child(2) { color: #fff; white-space: nowrap; font-weight: 600; }
.skill-table td:nth-child(3) { color: #b9c1c9; }
.toggle { display: flex; gap: 8px; align-items: center; margin: 8px 0 16px; cursor: pointer; }
.boss-preview { display: flex; gap: 14px; background: var(--panel); border: 1px solid var(--line); padding: 12px; border-radius: 3px; }
.boss-preview img { width: 180px; height: 120px; object-fit: cover; object-position: 0 20%; }
.boss-preview b { font: 900 20px var(--serif); color: var(--red2); }
.boss-preview p { font-size: 13px; line-height: 1.6; color: #c9cfd6; margin: 6px 0 0; }

/* 联机 */
.net-col input { background: #1a222c; color: var(--text); border: 1px solid var(--line); padding: 7px 10px; font: 14px var(--sans); }
.net-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; align-items: center; } .net-actions .code-in { width: 120px; letter-spacing: .12em; } .net-actions input { flex: 1; min-width: 110px; }
.net-block { margin-top: 12px; } .net-block > b { color: var(--gold2); font-weight: 600; }
.net-manual { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 8px; } .net-manual summary { cursor: pointer; color: var(--gold2); padding: 6px 0; }
.net-manual textarea { width: 100%; height: 62px; margin-top: 8px; background: #1a222c; color: var(--text); border: 1px solid var(--line); padding: 6px 8px; font: 12px/1.4 ui-monospace, Menlo, monospace; resize: vertical; word-break: break-all; }
.room-card b.big-code { font-size: 30px; letter-spacing: .14em; } .net-tip { font-size: 12px; margin-top: 12px; }
.room-card { background: var(--panel); border: 1px solid var(--teal); padding: 14px 16px; margin-top: 8px; line-height: 1.8; }
.room-card b { color: var(--gold2); font-size: 18px; } .room-card.err { border-color: var(--red); color: var(--red2); }
.room-row { display: flex; gap: 12px; align-items: center; padding: 6px 10px; background: var(--panel2); margin-bottom: 4px; } .room-row b { color: var(--gold2); }
.muted { color: var(--muted); font-size: 13px; } .net-rtt { color: var(--teal2); font-size: 13px; }
/* 角色展示 */
.cd-flex { display: flex; gap: 16px; }
.viewer { position: relative; flex: none; width: 250px; height: 330px; background: radial-gradient(ellipse at 50% 70%, rgba(77,157,154,.22), rgba(10,14,20,0) 65%); border: 1px solid rgba(195,167,117,.25); }
.viewer-canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: grab; }
.viewer-tag { position: absolute; left: 10px; top: 8px; z-index: 1; font: 900 20px var(--serif); color: var(--gold2); text-shadow: 0 2px 6px #000; pointer-events: none; }
.viewer-tag small { display: block; font: 12px var(--sans); color: var(--teal2); }
.cd-text { min-width: 0; flex: 1; }
/* 加载 */
.loading-screen { justify-content: flex-end; }
.load-box { background: linear-gradient(0deg, rgba(8,11,16,.95), rgba(8,11,16,0)); padding: 80px 6vw 50px; }
.load-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.load-cancel { min-height: 44px; flex-shrink: 0; }
.load-state { font-size: 12px; color: var(--gold); letter-spacing: .08em; margin: -6px 0 12px; }
.load-title { font: 900 48px var(--serif); color: var(--gold2); }
.load-bar { height: 4px; background: rgba(255,255,255,.12); margin: 16px 0; }
.load-bar i { display: block; height: 100%; width: 12%; background: linear-gradient(90deg, var(--teal), var(--gold2)); transition: width .3s; }
.load-tip { color: #d3d8de; font-size: 15px; }

/* 暂停 / 设置 */
.pause-screen { background: rgba(6,9,13,.72); align-items: center; justify-content: center; padding: 30px; }
.pause-box { width: 360px; }
.wide-box { width: min(900px, 94vw); }
.settings-box { width: min(760px, 94vw); max-height: 90vh; overflow: auto; }
.help-box { width: min(980px, 94vw); max-height: 90vh; overflow: auto; font-size: 14px; line-height: 1.75; }
.help-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.help-box p { margin: 6px 0; color: #d6dbe0; }
.help-box b { color: var(--gold2); }
.set-row { display: flex; align-items: center; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid rgba(255,255,255,.05); gap: 12px; }
.set-row label { color: #d6dbe0; font-size: 14px; }
.set-row .set-toggle { display: flex; align-items: center; justify-content: center; cursor: pointer; }
.set-row .ctl { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.set-row input[type=range] { width: 200px; accent-color: var(--teal); }
.set-row span { min-width: 48px; text-align: right; color: var(--gold2); font-size: 13px; }
.set-row select { background: #1a222c; color: var(--text); border: 1px solid var(--line); padding: 5px 8px; }
.set-row input[type=color] { width: 54px; height: 28px; border: 1px solid var(--line); background: none; padding: 0; cursor: pointer; }
.set-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.bind-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px 16px; }
.bind { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: #cfd5db; }

/* 换装 */
.wardrobe { position: absolute; inset: 0; background: var(--panel); border-right: 1px solid var(--line); padding: 22px 22px; overflow: auto; }
.wardrobe h2 { font: 900 24px var(--serif); color: var(--gold2); margin: 0 0 4px; }
.wd-note { color: var(--muted); font-size: 12px; margin: 0 0 12px; }

/* 结算 */
.results-screen { background: rgba(6,9,13,.78); align-items: center; justify-content: center; }
.results-box { width: min(820px, 94vw); text-align: center; position: relative; }
.res-grid { display: flex; gap: 20px; align-items: stretch; } .res-main { flex: 1; min-width: 0; }
.res-viewer { width: 210px; height: 280px; flex: none; }
.res-title { font: 900 48px var(--serif); color: var(--gold2); letter-spacing: .1em; }
.results-box.lose .res-title { color: #d9a39a; }
.res-sub { color: var(--teal2); font-size: 16px; margin: 6px 0 18px; }
.res-table, .stats-panel table { width: 100%; border-collapse: collapse; font-size: 14px; }
.res-table th, .stats-panel th { color: var(--muted); font-weight: 500; padding: 6px; border-bottom: 1px solid var(--line); }
.res-table td, .stats-panel td { padding: 7px 6px; border-bottom: 1px solid rgba(255,255,255,.05); }
tr.ally td:first-child { color: var(--teal2); font-weight: 700; }
tr.enemy td:first-child { color: var(--red2); font-weight: 700; }
.res-apm { margin-top: 14px; color: var(--muted); }
.res-apm b { color: var(--gold2); font-size: 20px; }

/* ---------- HUD ---------- */
.plate-layer { position: absolute; inset: 0; overflow: hidden; }
.plate { position: absolute; left: 0; top: 0; text-align: center; white-space: nowrap; transform-origin: 50% 100%; }
.plate .pn { font: 700 13px var(--serif); text-shadow: 0 1px 3px #000, 0 0 2px #000; }
.plate .pn small { font: 400 10px var(--sans); color: #cfd5db; margin-left: 4px; }
.plate.ally .pn { color: var(--teal2); } .plate.enemy .pn { color: var(--red2); }
.plate .pb { width: 70px; height: 5px; margin: 2px auto 0; background: rgba(0,0,0,.6); border: 1px solid rgba(255,255,255,.2); }
.plate .pb i { display: block; height: 100%; background: var(--red2); } .plate.ally .pb i { background: var(--teal2); }
.plate.boss .pb { display: none; } .plate.dead { opacity: .35 !important; }
.goal-box { position: absolute; right: 22px; top: 176px; width: 250px; background: rgba(10,14,20,.7); border-left: 3px solid var(--gold); padding: 10px 14px; font-size: 13px; display: none; }
.goal-box .gb-title { font: 700 14px var(--serif); color: var(--gold2); margin-bottom: 6px; }
.goal-box .g { color: #cfd5db; margin: 4px 0; display: flex; align-items: center; gap: 8px; }
.goal-box .g i { width: 12px; height: 12px; border: 1px solid var(--gold); flex: none; }
.goal-box .g.done { color: var(--teal2); text-decoration: line-through; opacity: .8; } .goal-box .g.done i { background: var(--teal2); border-color: var(--teal2); }
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; font-family: var(--sans); }
.crosshair { position: absolute; left: 50%; top: 50%; width: 30px; height: 30px; transform: translate(-50%,-50%); }
.crosshair i { position: absolute; background: rgba(255,255,255,.85); box-shadow: 0 0 2px rgba(0,0,0,.8); }
.crosshair i:nth-child(1) { left: 14px; top: 0; width: 2px; height: 9px; }
.crosshair i:nth-child(2) { left: 14px; bottom: 0; width: 2px; height: 9px; }
.crosshair i:nth-child(3) { top: 14px; left: 0; height: 2px; width: 9px; }
.crosshair i:nth-child(4) { top: 14px; right: 0; height: 2px; width: 9px; }
.crosshair b { position: absolute; left: 13px; top: 13px; width: 4px; height: 4px; border-radius: 50%; background: var(--teal2); }
.crosshair.aim { transform: translate(-50%,-50%) scale(.6); }
.hitmarker { position: absolute; left: 50%; top: 50%; width: 36px; height: 36px; transform: translate(-50%,-50%) rotate(45deg); opacity: 0; }
.hitmarker i { position: absolute; background: #fff; }
.hitmarker i:nth-child(1) { left: 17px; top: 0; width: 2px; height: 10px; } .hitmarker i:nth-child(2) { left: 17px; bottom: 0; width: 2px; height: 10px; }
.hitmarker i:nth-child(3) { top: 17px; left: 0; height: 2px; width: 10px; } .hitmarker i:nth-child(4) { top: 17px; right: 0; height: 2px; width: 10px; }
.hitmarker.on { animation: hm .22s ease-out; }
.hitmarker.heavy i { background: var(--gold2); }
@keyframes hm { 0% { opacity: 1; transform: translate(-50%,-50%) rotate(45deg) scale(.7); } 100% { opacity: 0; transform: translate(-50%,-50%) rotate(45deg) scale(1.25); } }

.hud-top { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 18px; }
.hud-timer { font: 700 30px var(--serif); color: #fff; text-shadow: 0 2px 8px rgba(0,0,0,.8); min-width: 90px; text-align: center; }
.hud-timer .dps { font-size: 30px; color: var(--gold2); } .hud-timer small { font-size: 12px; color: var(--muted); margin-left: 4px; }
.hud-top-side { display: flex; align-items: center; gap: 10px; font-size: 15px; text-shadow: 0 1px 4px #000; min-width: 220px; }
.hud-top-side.left { justify-content: flex-end; } .hud-top-side b { color: var(--gold2); }
.hud-sub { position: absolute; top: 56px; left: 50%; transform: translateX(-50%); color: var(--muted); font-size: 12px; text-shadow: 0 1px 3px #000; letter-spacing: .08em; }
.acc { font: 900 18px var(--serif); } .acc.ally { color: var(--teal2); } .acc.enemy { color: var(--red2); }
.pips { display: inline-flex; gap: 4px; } .pips i { width: 12px; height: 12px; border: 1px solid var(--gold); transform: rotate(45deg); } .pips i.on { background: var(--gold2); }
.rel { font-size: 13px; padding: 2px 6px; color: #cfd5db; } .rel.cur { color: #fff; font-weight: 700; border-bottom: 2px solid var(--gold2); } .rel.out { opacity: .35; text-decoration: line-through; }

.bar { position: relative; height: 12px; background: rgba(0,0,0,.55); border: 1px solid rgba(255,255,255,.18); overflow: hidden; }
.bar i, .bar em { position: absolute; left: 0; top: 0; bottom: 0; }
.bar em { background: rgba(255,230,190,.55); z-index: 0; }
.bar i { z-index: 1; transition: width .08s; }
.bar span { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); font-size: 11px; z-index: 2; text-shadow: 0 1px 2px #000; }
.bar.hp i { background: linear-gradient(180deg, #ef6a55, #b2322a); }
.bar.hp.low i { animation: lowhp .6s infinite alternate; }
@keyframes lowhp { to { filter: brightness(1.5); } }
.bar.mp i { background: linear-gradient(180deg, #5aa2ff, #2a5fb0); }
.bar.boss i { background: linear-gradient(180deg, #8fd6ff, #3f7fa8); }
.bar.big { height: 18px; } .bar.big span { font-size: 12px; font-weight: 700; }
.bar.mini { height: 5px; margin-top: 3px; } .bar.mini i { background: var(--teal2); }

.self-frame { position: absolute; left: 50%; bottom: 94px; transform: translateX(-50%); width: 560px; padding: 0; }
.sf-head { position: absolute; right: calc(100% + 12px); bottom: 0; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.sf-portrait { width: 44px; height: 44px; object-fit: cover; object-position: 3% 18%; border: 1px solid var(--line); background: #333; }
.sf-name { font: 900 18px var(--serif); color: #fff; text-shadow: 0 1px 4px #000; } .sf-cls { font-size: 12px; color: var(--gold2); text-shadow: 0 1px 3px #000; }
.self-frame .bar { margin-top: 3px; }
.self-frame .bar.mp { height: 8px; } .self-frame .bar.mp span { font-size: 10px; }
.sf-effects { position: absolute; left: 0; bottom: calc(100% + 4px); display: flex; gap: 6px; flex-wrap: wrap; }
.sf-effects b { font-size: 11px; padding: 1px 6px; border-radius: 2px; }
.sf-effects .buff { background: rgba(79,208,200,.25); color: var(--teal2); } .sf-effects .debuff { background: rgba(207,98,75,.3); color: var(--red2); }

.skill-bar { position: absolute; bottom: 22px; left: 50%; transform: translateX(-50%); display: flex; gap: 6px; align-items: flex-end; }
.slot { position: relative; width: 58px; height: 58px; padding: 0; color: var(--text); background: rgba(12,16,22,.82); border: 1px solid rgba(195,167,117,.5); border-radius: 4px; overflow: hidden; }
.slot.basic { width: 48px; height: 48px; opacity: .92; }
.slot.ult { width: 66px; height: 66px; border-color: var(--gold2); box-shadow: 0 0 16px rgba(230,207,154,.25); }
.slot img { position: absolute; inset: 9px; width: calc(100% - 18px); height: calc(100% - 18px); opacity: .95; }
.slot .cd { position: absolute; inset: 0; }
.slot .cdn { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font: 700 18px var(--sans); color: #fff; text-shadow: 0 1px 3px #000; }
.slot .key { position: absolute; left: 3px; top: 1px; font: 700 11px var(--sans); color: var(--gold2); text-shadow: 0 1px 2px #000; }
.slot .nm { position: absolute; left: 0; right: 0; bottom: 1px; font-size: 10px; text-align: center; color: #e6e1d6; text-shadow: 0 1px 2px #000; white-space: nowrap; overflow: hidden; }
.slot.glyphed { background: radial-gradient(circle at 50% 35%, color-mix(in srgb, var(--accent) 55%, #0c1016) 0%, #0c1016 80%); }
.slot.glyphed img { inset: auto 3px 12px auto; width: 14px; height: 14px; opacity: .7; }
.slot .glyph { position: absolute; inset: 0 0 8px 0; display: flex; align-items: center; justify-content: center; font: 900 28px var(--serif); color: #fff6df; text-shadow: 0 0 10px color-mix(in srgb, var(--accent) 80%, transparent), 0 2px 3px #000; }
.slot.ult .glyph { font-size: 34px; color: #ffe6a8; }
.slot.nomp .glyph { color: #7d8793; text-shadow: none; }
.slot .form-tag { position: absolute; right: 2px; top: 1px; font-size: 10px; color: var(--teal2); }
.slot.nomp img { filter: grayscale(1) brightness(.6); } .slot.nomp { border-color: rgba(63,134,214,.8); }
.slot.active { border-color: #fff; box-shadow: 0 0 14px rgba(255,255,255,.35); }
.slot.flash { animation: sflash .25s; } @keyframes sflash { 0% { background: rgba(255,255,255,.5); } }
.slot.ready { animation: sready .5s; } @keyframes sready { 0% { box-shadow: 0 0 0 0 rgba(127,214,205,.9); } 100% { box-shadow: 0 0 0 14px rgba(127,214,205,0); } }
.form-bar { position: absolute; bottom: 150px; left: 50%; transform: translateX(-50%); display: flex; gap: 6px; }
.form { display: flex; align-items: center; gap: 4px; padding: 3px 9px 3px 5px; background: rgba(12,16,22,.7); border: 1px solid rgba(255,255,255,.12); font-size: 13px; color: #aab; border-radius: 3px; }
.form img { width: 18px; height: 18px; } .form kbd { font-size: 10px; min-width: 1.3em; }
.form.on { border-color: var(--teal2); color: #fff; background: rgba(40,90,88,.7); }

.target-frame { position: absolute; top: 76px; left: 50%; transform: translateX(-50%); width: 360px; text-align: center; display: none; }
.tf-name { font: 700 15px var(--serif); color: var(--red2); text-shadow: 0 1px 3px #000; margin-bottom: 3px; } .tf-name small { color: var(--muted); font: 12px var(--sans); }
.tf-state { font-size: 12px; color: var(--gold2); height: 16px; margin-top: 2px; text-shadow: 0 1px 2px #000; }
.boss-frame { position: absolute; top: 72px; left: 50%; transform: translateX(-50%); width: min(640px, 70vw); text-align: center; display: none; }
.bf-name { font: 900 22px var(--serif); color: #bfe6ff; text-shadow: 0 2px 6px #000; letter-spacing: .2em; }
.boss-frame .bar { height: 16px; border-color: rgba(143,224,255,.5); }
.bf-phase { font-size: 12px; color: #bfe6ff; margin-top: 3px; text-shadow: 0 1px 2px #000; }
.team-frame { position: absolute; left: 22px; top: 120px; width: 200px; }
.tm { background: rgba(10,14,20,.6); padding: 5px 8px; margin-bottom: 4px; border-left: 3px solid var(--teal); font-size: 13px; }
.tm.enemy { border-left-color: var(--red); } .tm.dead { opacity: .4; } .tm.me { background: rgba(40,90,88,.55); }
.tm .n { font-weight: 700; } .tm .c { color: var(--muted); font-size: 11px; margin-left: 6px; }
.tm.enemy .bar.mini i { background: var(--red2); }
.tm-sep { font-size: 11px; color: var(--muted); margin: 8px 0 4px; }

.combo-box { position: absolute; right: 7vw; top: 38%; text-align: right; opacity: 0; transition: opacity .2s; }
.combo-box.show { opacity: 1; }
.combo-n { font: 900 64px/1 var(--serif); color: var(--gold2); text-shadow: 0 3px 12px rgba(0,0,0,.7), 0 0 20px rgba(230,207,154,.3); }
.combo-box.pop .combo-n { animation: cpop .18s ease-out; } @keyframes cpop { 0% { transform: scale(1.35); } }
.combo-l { font: 700 16px var(--serif); color: #fff; letter-spacing: .3em; }
.combo-d { font-size: 13px; color: var(--muted); }
.apm-box { position: absolute; right: 22px; bottom: 26px; text-align: right; }
.apm-n { font: 700 28px var(--serif); color: #fff; } .apm-l { font-size: 12px; color: var(--muted); margin-left: 4px; } .fps { display: block; font-size: 11px; color: var(--muted); }

.float-layer { position: absolute; inset: 0; overflow: hidden; }
.ft { position: absolute; left: 0; top: 0; font: 900 20px var(--serif); color: #fff; text-shadow: 0 2px 4px #000, 0 0 2px #000; white-space: nowrap; will-change: transform; }
.ft.dmg.dealt { color: #fff3c9; } .ft.dmg.crit { color: #ffae3a; font-size: 30px; } .ft.dmg.taken { color: #ff7462; } .ft.dmg.blocked { color: #9fc8e8; font-size: 15px; } .ft.dmg.other { color: #d4d4d4; font-size: 15px; }
.ft.tech { color: var(--teal2); font-size: 18px; } .ft.parry { color: #fff6c9; font-size: 26px; } .ft.armor { color: #ffd27a; font-size: 15px; } .ft.crit { color: #ffae3a; } .ft.enemy { color: var(--red2); }

.announce { position: absolute; top: 24%; left: 0; right: 0; text-align: center; opacity: 0; }
.announce.show { animation: ann 1.8s ease-out forwards; }
.announce .a { display: inline-block; font: 900 30px var(--serif); padding: 8px 40px; background: linear-gradient(90deg, transparent, rgba(8,11,16,.75), transparent); color: var(--gold2); letter-spacing: .12em; }
.announce .a.enemy { color: var(--red2); } .announce .a.ally { color: var(--teal2); }
@keyframes ann { 0% { opacity: 0; transform: translateY(10px); } 12% { opacity: 1; transform: none; } 80% { opacity: 1; } 100% { opacity: 0; } }
.center-msg { position: absolute; top: 38%; left: 0; right: 0; text-align: center; opacity: 0; }
.center-msg.show { animation: cm 1.2s ease-out forwards; }
.center-msg .big { font: 900 84px var(--serif); color: #fff; text-shadow: 0 6px 30px rgba(0,0,0,.8); letter-spacing: .1em; }
.center-msg .big.go { color: var(--gold2); } .center-msg .big.lose { color: #e89a8c; } .center-msg .big.count { font-size: 120px; }
.center-msg .small { font-size: 18px; color: #e6e1d6; margin-top: 6px; text-shadow: 0 2px 6px #000; }
@keyframes cm { 0% { opacity: 0; transform: scale(1.3); } 15% { opacity: 1; transform: scale(1); } 80% { opacity: 1; } 100% { opacity: 0; } }
.toast { position: absolute; bottom: 150px; left: 50%; transform: translateX(-50%); background: rgba(10,14,20,.8); padding: 6px 16px; font-size: 14px; border: 1px solid var(--line); opacity: 0; transition: opacity .2s; }
.toast.show { opacity: 1; }
.prompt { position: absolute; top: 60%; left: 50%; transform: translateX(-50%); background: rgba(10,14,20,.75); padding: 8px 18px; border: 1px solid var(--teal); font-size: 15px; display: none; }
.hud-hint { position: absolute; top: 96px; right: 22px; max-width: 380px; text-align: right; font-size: 12px; color: #d6dbe0; text-shadow: 0 1px 3px #000; line-height: 1.8; }
.blind { position: absolute; inset: 0; background: #090909; opacity: 0; pointer-events: none; z-index: 3; transition: opacity .08s; }
.self-frame, .skill-bar, .form-bar { z-index: 4; }
.self-frame .bar.stamina { height: 8px; }
.bar.stamina i { background: linear-gradient(180deg, #c0ba6d, #7d874a); }
.bar.stamina.low i { background: #cc8154; }
.bar.stamina span { font-size: 10px; }
.skill-choices { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 14px; font-size: 12px; }
.skill-choice { display: flex; gap: 6px; align-items: center; }
.skill-choice select { background: #152026; color: #eee7d6; border: 1px solid #596264; padding: 5px 8px; border-radius: 3px; }
.story-dialogue { position: absolute; z-index: 8; width: min(720px, calc(100% - 32px)); bottom: max(28px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); border: 1px solid #a99269; padding: 22px 26px; background: rgba(15,23,28,.96); box-shadow: 0 12px 48px #0006; pointer-events: auto; }
.story-speaker { color: #d8c49a; font: 700 19px var(--serif); margin-bottom: 10px; }
.story-line { font-size: 16px; line-height: 1.8; color: #eee8dd; margin-bottom: 16px; }
.story-dialogue .btn { float: right; }
.story-dialogue::after { content: ''; display: block; clear: both; }
.story-speaking .skill-bar, .story-speaking .form-bar, .story-speaking .touch-stick, .story-speaking .touch-movement, .story-speaking .touch-interact, .story-speaking .touch-look-hint { visibility: hidden; }
.story-chapter { display: block; width: 100%; text-align: left; border: 1px solid #596264; background: #172329e6; color: #eee7d6; padding: 20px; margin-bottom: 14px; cursor: pointer; }
.story-chapter.on { border-color: #d8c49a; background: #263536; }
.story-chapter p { margin: 10px 0; line-height: 1.6; }
.story-chapter span { color: #b6af98; font-size: 12px; }
.story-chapter:disabled { opacity: .42; cursor: default; }
.map-choices { width: 100%; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
@media(max-width:700px) { .story-dialogue { padding: 14px 18px; } .story-line { font-size: 14px; } }
.ft.heal { color: #8dff9a; font-size: 20px; }
.hurt { position: absolute; inset: 0; background: radial-gradient(ellipse at center, transparent 55%, rgba(170,20,10,.55) 100%); opacity: 0; }
.hurt-dir { position: absolute; left: 50%; top: 50%; width: 220px; height: 220px; opacity: 0; }
.hurt-dir::before { content: ''; position: absolute; left: 50%; top: 0; transform: translateX(-50%); border: 12px solid transparent; border-bottom: 22px solid rgba(255,70,50,.85); border-top: 0; }
.lock-mark { position: absolute; left: 0; top: 0; width: 34px; height: 34px; margin: -17px 0 0 -17px; border: 2px solid var(--red2); transform-origin: center; display: none; border-radius: 50%; box-shadow: 0 0 10px rgba(255,120,90,.6); }
.stats-panel { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); width: min(760px, 90vw); background: var(--panel); border: 1px solid var(--line); padding: 18px 22px; display: none; }
.apm-big { text-align: right; margin-top: 10px; color: var(--gold2); font: 700 18px var(--serif); }

@media (max-width: 1250px) { .sf-head { display: none; } }
@media (max-width: 1100px) { .mode-grid { grid-template-columns: repeat(3, 1fr); } .acc-grid { grid-template-columns: repeat(2, 1fr); } .setup-body { flex-direction: column; } .logo { font-size: 90px; } }
@media (max-width: 700px) { .mode-grid { grid-template-columns: 1fr 1fr; } .help-cols { grid-template-columns: 1fr; } .bind-grid { grid-template-columns: 1fr 1fr; } .skill-bar { transform: translateX(-50%) scale(.75); transform-origin: bottom center; } .self-frame { width: 300px; bottom: 76px; } }
.slot .glyph { z-index: 1; } .slot .cd { z-index: 2; } .slot .cdn, .slot .key, .slot .nm, .slot .form-tag { z-index: 3; }

.quick-help { position: fixed; left: 50%; top: 22%; transform: translateX(-50%); z-index: 15; background: var(--panel); border: 1px solid var(--line); border-top: 3px solid var(--gold); padding: 16px 26px; font-size: 14px; line-height: 2; color: #dfe4e9; pointer-events: none; animation: qh .35s ease-out; transition: opacity .35s; }
.quick-help h3 { margin: 0 0 4px; font: 900 18px var(--serif); color: var(--gold2); }
.quick-help small { color: var(--teal2); }
.quick-help.out { opacity: 0; }
@keyframes qh { from { opacity: 0; transform: translate(-50%, 10px); } }

#clickplay { position: fixed; inset: 0; z-index: 30; display: none; align-items: center; justify-content: center; background: rgba(6,9,13,.45); cursor: pointer; }
#clickplay div { text-align: center; background: var(--panel); border: 1px solid var(--gold); padding: 18px 40px; }
#clickplay b { display: block; font: 900 26px var(--serif); color: var(--gold2); }
#clickplay small { color: var(--muted); }

/* 触屏战斗：技能沿用职业图标、冷却与法力提示，所有操作都在安全区域内。 */
#touch-controls { position: fixed; inset: 0; z-index: 12; pointer-events: none; --touch-size: 54px; --touch-gap: 7px; }
#touch-controls[hidden] { display: none; }
#touch-controls button { width: 48px; min-height: 44px; padding: 0 3px; background: rgba(12,20,27,.78); color: var(--text); border: 1px solid var(--line); border-radius: 9px; font: 600 12px var(--sans); pointer-events: auto; touch-action: none; -webkit-tap-highlight-color: transparent; }
#touch-controls button[hidden] { display: none; }
#touch-controls button:active, #touch-controls button.touch-held, .touch-playing .slot.touch-held, .touch-playing .form.touch-held { border-color: var(--teal2); background-color: rgba(44,105,101,.85); box-shadow: 0 0 14px rgba(127,214,205,.3); }
.touch-toolbar { position: absolute; top: calc(var(--safe-top) + 12px); right: calc(var(--safe-right) + 12px); display: flex; gap: 6px; }
.touch-toolbar [data-command=pause] { border-color: var(--gold); color: var(--gold2); }
.touch-toolbar [aria-pressed=true] { border-color: var(--teal2); color: var(--teal2); }
.touch-stick { position: absolute; left: calc(var(--safe-left) + 22px); bottom: calc(var(--safe-bottom) + 20px); width: 116px; height: 116px; border-radius: 50%; border: 1px solid rgba(195,167,117,.5); background: radial-gradient(circle, rgba(24,39,46,.28), rgba(12,20,27,.65)); pointer-events: auto; touch-action: none; }
.stick-ring { position: absolute; inset: 20px; border: 1px solid rgba(195,167,117,.2); border-radius: 50%; }
.stick-knob { position: absolute; width: 46px; height: 46px; left: calc(50% - 23px); top: calc(50% - 23px); border-radius: 50%; background: radial-gradient(circle at 35% 25%, #6b9a97, #274e50); border: 1px solid var(--teal2); box-shadow: 0 3px 12px rgba(0,0,0,.4); pointer-events: none; }
.stick-label { position: absolute; bottom: 8px; left: 0; right: 0; text-align: center; font-size: 10px; color: #c7d4d6; pointer-events: none; }
.touch-stick.touch-held { border-color: var(--teal2); }
.touch-stick.touch-held .stick-label { opacity: 0; }
.touch-movement { position: absolute; right: calc(var(--safe-right) + 3 * var(--touch-size) + 2 * var(--touch-gap) + 24px); bottom: calc(var(--safe-bottom) + 16px); display: flex; flex-direction: column; gap: 8px; }
#touch-controls .touch-movement button { width: 48px; height: 48px; border-radius: 50%; }
#touch-controls .touch-interact { position: absolute; left: calc(var(--safe-left) + 22px); bottom: calc(var(--safe-bottom) + 148px); width: 74px; color: var(--gold2); }
.touch-look-hint { position: absolute; top: 49%; right: 14%; font-size: 11px; color: rgba(236,230,218,.6); text-shadow: 0 1px 3px #000; transition: opacity .3s; }
.look-used .touch-look-hint { opacity: 0; }
.touch-mode #hud { --touch-size: 54px; --touch-gap: 7px; }
.touch-mode .skill-bar { left: auto; right: calc(var(--safe-right) + 12px); bottom: calc(var(--safe-bottom) + 16px); transform: none; display: grid; grid-template-columns: repeat(3, var(--touch-size)); gap: var(--touch-gap); z-index: 4; }
.touch-mode .slot, .touch-mode .slot.basic, .touch-mode .slot.ult { width: var(--touch-size); height: var(--touch-size); border-radius: 10px; opacity: 1; }
.touch-playing .slot, .touch-playing .form { pointer-events: auto; touch-action: none; -webkit-tap-highlight-color: transparent; cursor: pointer; }
.touch-playing { -webkit-touch-callout: none; }
.touch-mode .slot .key, .touch-mode .form kbd { display: none; }
.touch-mode .slot .nm { font-size: 10px; bottom: 3px; }
.touch-mode .slot .glyph, .touch-mode .slot.ult .glyph { font-size: 25px; }
.touch-mode .slot.basic { border-color: var(--teal); }
.touch-mode .slot.ult { border-color: var(--gold2); }
.touch-mode .form-bar { left: calc(var(--safe-left) + 16px); bottom: calc(var(--safe-bottom) + 204px); transform: none; gap: 4px; z-index: 4; }
.touch-mode .form { min-width: 44px; min-height: 44px; padding: 4px; justify-content: center; font-family: var(--sans); }
.touch-mode .form img { width: 15px; height: 15px; }
.touch-mode .self-frame { left: calc(var(--safe-left) + 12px); top: calc(var(--safe-top) + 12px); bottom: auto; width: 158px; transform: none; }
.touch-mode .sf-head { position: static; display: flex; gap: 6px; margin-bottom: 4px; }
.touch-mode .sf-portrait { width: 28px; height: 28px; }
.touch-mode .sf-name { font-size: 13px; }
.touch-mode .sf-cls { max-width: 122px; overflow: hidden; text-overflow: ellipsis; font-size: 10px; }
.touch-mode .self-frame .bar.big { height: 12px; }
.touch-mode .self-frame .bar.big span { font-size: 10px; }
.touch-mode .sf-effects { bottom: auto; top: calc(100% + 4px); gap: 3px; }
.touch-mode .hud-top { top: calc(var(--safe-top) + 10px); width: min(44vw, 540px); gap: 8px; justify-content: center; }
.touch-mode .hud-top-side { min-width: 0; flex: 1; flex-wrap: wrap; gap: 4px; font-size: 11px; }
.touch-mode .hud-top-side.right { justify-content: flex-start; }
.touch-mode .hud-timer { min-width: 62px; font-size: 22px; }
.touch-mode .hud-timer .dps { font-size: 22px; }
.touch-mode .acc { font-size: 13px; }
.touch-mode .pips i { width: 7px; height: 7px; }
.touch-mode .hud-sub { top: calc(var(--safe-top) + 43px); max-width: 44vw; text-align: center; font-size: 10px; letter-spacing: 0; }
.touch-mode .target-frame { top: calc(var(--safe-top) + 78px); width: min(220px, 38vw); }
.touch-mode .boss-frame { top: calc(var(--safe-top) + 73px); width: min(380px, 46vw); }
.touch-mode .bf-name { font-size: 17px; }
.touch-mode .team-frame { left: calc(var(--safe-left) + 12px); top: calc(var(--safe-top) + 105px); width: 142px; }
.touch-mode .tm { font-size: 11px; padding: 3px 5px; margin-bottom: 2px; }
.touch-mode .tm .c, .touch-mode .tm.enemy, .touch-mode .tm-sep { display: none; }
.touch-mode .goal-box, .touch-mode .hud-hint, .touch-mode .apm-n, .touch-mode .apm-l { display: none !important; }
.touch-mode .apm-box { right: calc(var(--safe-right) + 12px); bottom: auto; top: calc(var(--safe-top) + 64px); }
.touch-mode .combo-box { right: calc(var(--safe-right) + 20px); top: 29%; }
.touch-mode .combo-n { font-size: 38px; }
.touch-mode .combo-l, .touch-mode .combo-d { font-size: 11px; }
.touch-mode .prompt { top: 56%; max-width: 65vw; font-size: 12px; text-align: center; padding: 6px 10px; }
.touch-mode .toast { bottom: auto; top: 26%; max-width: 70vw; font-size: 12px; text-align: center; }
.touch-mode .announce .a { font-size: 22px; padding: 6px 14px; }
.touch-mode .center-msg .big { font-size: 46px; }
.touch-mode .center-msg .big.count { font-size: 70px; }
.touch-mode .center-msg .small { font-size: 13px; }
.touch-mode .stats-panel { max-height: 55%; overflow: auto; padding: 12px; z-index: 5; }
.touch-playing .stats-panel { pointer-events: auto; touch-action: pan-x pan-y; }
.touch-mode .stats-panel table { font-size: 11px; }
.touch-mode .stats-panel th, .touch-mode .stats-panel td { padding: 5px 3px; }
.touch-mode .quick-help { top: 22%; width: min(420px, 86vw); padding: 12px 18px; font-size: 13px; line-height: 1.7; pointer-events: auto; touch-action: manipulation; }
.touch-mode .quick-help p { margin: 6px 0; }
.touch-mode .btn { min-height: 44px; }
.touch-mode input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--teal); }
.touch-mode .set-row > label { display: flex; align-items: center; min-height: 44px; flex: 1; cursor: pointer; }
.touch-mode .set-row .set-toggle { width: 44px; height: 44px; }
.touch-mode .viewer-canvas { touch-action: pan-y; }

/* 手机菜单：内容滚动，开始与返回操作保留在屏幕内。 */
@media (max-width: 760px), (max-height: 500px) and (pointer: coarse) {
  .title-screen { padding: calc(var(--safe-top) + 24px) calc(var(--safe-right) + 24px) calc(var(--safe-bottom) + 24px) calc(var(--safe-left) + 24px); }
  .title-block { width: 100%; max-width: 520px; margin: auto 0; }
  .logo { font-size: 76px; }
  .logo-en { font-size: 12px; letter-spacing: .25em; margin: 12px 0 20px; }
  .tagline { font-size: 17px; margin-bottom: 24px; }
  .fine { font-size: 11px; line-height: 1.6; margin-top: 20px; }
  .main-screen { padding: calc(var(--safe-top) + 16px) calc(var(--safe-right) + 14px) calc(var(--safe-bottom) + 20px) calc(var(--safe-left) + 14px); }
  .main-head { gap: 12px; align-items: flex-start; flex-wrap: wrap; }
  .logo.small { font-size: 32px; }
  .head-right { gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
  .head-right .btn { padding: 8px 10px; font-size: 12px; }
  .mats { font-size: 11px; margin-right: 0; }
  .mode-grid, body.attract .main-screen .mode-grid { margin-top: 18px; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); padding-bottom: 4px; }
  .mode-card { min-height: 0; flex-shrink: 0; }
  .mc-img, body.attract .mc-img { height: 92px; }
  .mc-body { padding: 12px; }
  .mc-name { font-size: 23px; }
  .mc-en { font-size: 9px; }
  .mc-desc { font-size: 12px; }
  .setup-screen { padding: calc(var(--safe-top) + 12px) calc(var(--safe-right) + 12px) 0 calc(var(--safe-left) + 12px); }
  .setup-head { flex: none; }
  .setup-title { font-size: 25px; }
  .setup-title span { font-size: 10px; }
  .setup-body { gap: 18px; margin-top: 12px; padding: 2px 2px 14px; }
  .setup-foot { gap: 8px; padding: 10px 0 calc(var(--safe-bottom) + 12px); }
  .setup-foot .btn.big { font-size: 16px; padding: 10px 22px; flex-shrink: 0; }
  .diff { gap: 3px; }
  .diff .btn.chip { padding: 7px 8px; font-size: 12px; }
  .diff span { width: 100%; font-size: 12px; }
  .acc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .acc-card { height: 84px; }
  .ac-portrait { width: 40px; }
  .ac-info { padding: 8px 6px; }
  .ac-name { font-size: 15px; }
  .ac-cls, .ac-player { font-size: 10px; }
  .ac-cls span { display: block; margin-left: 0; font-size: 10px; }
  .class-detail { padding: 12px; }
  .cd-flex { flex-direction: column; }
  .viewer { width: 100%; height: 230px; }
  .skill-table { font-size: 11px; }
  .skill-table td { padding: 5px 3px; }
  .skill-table td:nth-child(2) { white-space: normal; min-width: 65px; }
  .boss-preview { flex-direction: column; }
  .boss-preview img { width: 100%; height: 140px; }
  .pause-screen, .results-screen { padding: calc(var(--safe-top) + 12px) calc(var(--safe-right) + 12px) calc(var(--safe-bottom) + 12px) calc(var(--safe-left) + 12px); }
  .panel { padding: 18px 16px; max-width: 100%; flex-shrink: 0; }
  .pause-box, .wide-box, .settings-box, .help-box, .results-box { width: 100%; max-height: 100%; overflow: auto; }
  .help-cols { grid-template-columns: 1fr; gap: 12px; }
  .bind-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .set-row { flex-wrap: wrap; gap: 6px; }
  .set-row .ctl { max-width: 100%; }
  .set-row input[type=range] { width: min(180px, 48vw); min-height: 34px; }
  .set-row select, .net-col input, .net-manual textarea { font-size: 16px; min-height: 44px; }
  .set-foot { flex-wrap: wrap; }
  #menu.side { width: min(340px, 88vw); }
  .wardrobe { padding: calc(var(--safe-top) + 16px) 16px calc(var(--safe-bottom) + 16px) calc(var(--safe-left) + 16px); }
  .res-viewer { display: none; }
  .res-title { font-size: 34px; }
  .res-sub { font-size: 13px; }
  .res-table { font-size: 11px; }
  .res-table th, .res-table td { padding: 5px 2px; }
  .load-box { padding: 40px 24px calc(var(--safe-bottom) + 24px); }
  .load-title { font-size: 32px; }
  .load-tip { font-size: 13px; }
}
@media (orientation: portrait) {
  .touch-mode #hud, #touch-controls { --touch-size: 48px; --touch-gap: 6px; }
  .touch-mode .self-frame { width: 142px; }
  .touch-toolbar { gap: 4px; }
  #touch-controls .touch-toolbar button { width: 44px; }
  .touch-mode .hud-top { top: calc(var(--safe-top) + 94px); width: calc(100% - var(--safe-left) - var(--safe-right) - 24px); }
  .touch-mode .hud-sub { top: calc(var(--safe-top) + 125px); max-width: 90%; }
  .touch-mode .target-frame, .touch-mode .boss-frame { top: calc(var(--safe-top) + 151px); width: min(260px, 70vw); }
  .touch-mode .team-frame { top: calc(var(--safe-top) + 206px); width: 125px; }
  .touch-mode .combo-box { top: 32%; }
  .touch-mode .form-bar { bottom: calc(var(--safe-bottom) + 205px); }
  .touch-look-hint { right: 12%; top: 48%; }
  .touch-mode .announce { top: 28%; }
}
@media (max-width: 360px) and (orientation: portrait) {
  .touch-mode #hud, #touch-controls { --touch-size: 44px; --touch-gap: 5px; }
  .touch-stick { width: 100px; height: 100px; left: calc(var(--safe-left) + 8px); }
  .touch-mode .self-frame { width: 112px; left: calc(var(--safe-left) + 8px); }
  .touch-toolbar { right: calc(var(--safe-right) + 8px); gap: 3px; }
  #touch-controls .touch-toolbar button { width: 44px; }
  #touch-controls .touch-movement button { width: 44px; height: 44px; }
  .head-right .mats { display: none; }
}
@media (max-height: 440px) and (orientation: landscape) {
  .touch-mode #hud, #touch-controls { --touch-size: 48px; --touch-gap: 6px; }
  .touch-mode .self-frame { width: 142px; }
  .touch-mode .hud-top { width: 40vw; }
  .touch-mode .hud-sub { max-width: 38vw; }
  .touch-toolbar { gap: 4px; }
  #touch-controls .touch-toolbar button { width: 44px; }
  .touch-mode .form-bar { bottom: calc(var(--safe-bottom) + 198px); }
  .touch-mode .team-frame { top: calc(var(--safe-top) + 92px); }
  .touch-mode .quick-help { top: 18%; font-size: 12px; padding: 10px 16px; }
  .title-screen .logo { font-size: 62px; }
  .title-screen .logo-en { margin: 8px 0 12px; }
  .title-screen .tagline { margin-bottom: 14px; font-size: 15px; }
  .title-screen .fine { margin-top: 12px; }
  .main-screen .mode-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .main-screen .mc-img, body.attract .main-screen .mc-img { height: 64px; }
}
