:root {
  --bg: #05070d;
  --panel: rgba(13, 19, 34, 0.94);
  --panel-2: #111a2e;
  --line: rgba(120, 170, 255, 0.18);
  --line-strong: rgba(120, 200, 255, 0.45);
  --text: #e6eefc;
  --dim: #8b9ab8;
  --accent: #3ee6ff;
  --warn: #ffb648;
  --danger: #ff5d6c;
  --good: #62f0a0;
  --ranger: #3ee6ff;
  --warrior: #ff9a3c;
  --mage: #b98bff;
  font-family: "Microsoft YaHei UI", "PingFang SC", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); overflow: hidden; }
body {
  background:
    radial-gradient(ellipse at 20% 0%, rgba(62, 230, 255, 0.07), transparent 55%),
    radial-gradient(ellipse at 90% 100%, rgba(185, 139, 255, 0.07), transparent 55%),
    var(--bg);
}
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
code { background: rgba(255, 255, 255, 0.08); padding: 1px 6px; border-radius: 4px; }

#app { position: relative; height: 100%; }
.screen { position: absolute; inset: 0; display: none; overflow: auto; padding: 28px 24px; }
.screen.active { display: flex; flex-direction: column; align-items: center; }
#screen-game.active { padding: 0; display: flex; overflow: hidden; align-items: stretch; }

/* ---------- 通用组件 ---------- */
.btn {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 18px; cursor: pointer; transition: border-color .15s, background .15s, transform .1s;
}
.btn:hover { border-color: var(--line-strong); background: #16223b; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, .card:focus-visible, .tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn.primary { background: linear-gradient(135deg, #1aa9c9, #2b6fd6); border-color: transparent; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.1); }
.btn.danger { border-color: rgba(255, 93, 108, 0.5); color: #ffc2c8; }
.btn.ghost { background: transparent; }
.btn.small { padding: 6px 12px; font-size: 13px; }
.btn.big { padding: 18px 26px; font-size: 18px; display: flex; flex-direction: column; gap: 4px; min-width: 220px; }
.btn.big small { font-size: 12px; color: var(--dim); font-weight: 400; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.badge { display: inline-block; min-width: 22px; padding: 0 6px; margin-left: 4px; border-radius: 10px; background: rgba(62, 230, 255, 0.18); color: var(--accent); font-size: 12px; }
.note { color: var(--dim); font-size: 13px; line-height: 1.6; margin: 8px 0; }
.note.warn { color: var(--warn); border: 1px solid rgba(255, 182, 72, 0.35); border-radius: 8px; padding: 10px 14px; }
.dim { color: var(--dim); }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 22px 26px; width: min(640px, 100%); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45); }
.panel.wide { width: min(1080px, 100%); }
.panel.narrow { width: min(380px, 100%); text-align: center; }
.panel h2 { margin: 0 0 6px; font-size: 22px; letter-spacing: 1px; }
.panel h3 { margin: 18px 0 8px; font-size: 15px; color: #cfe0ff; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 8px; }
.panel-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; gap: 12px; }
.head-right { display: flex; gap: 14px; align-items: center; }
.points b { color: var(--accent); font-size: 20px; }
.stack { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.stack.row { flex-direction: row; justify-content: center; }

/* ---------- 大厅 ---------- */
.brand { text-align: center; margin: 6px 0 18px; }
.brand h1 { margin: 0; font-size: 56px; letter-spacing: 18px; font-weight: 800; background: linear-gradient(120deg, #3ee6ff, #8fb3ff 45%, #b98bff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand-sub { margin: 4px 0 0; color: var(--dim); letter-spacing: 4px; font-size: 13px; }
.mode-tabs { display: flex; gap: 6px; background: var(--panel-2); padding: 5px; border-radius: 10px; border: 1px solid var(--line); }
.tab { background: transparent; border: 0; padding: 9px 22px; border-radius: 7px; cursor: pointer; color: var(--dim); }
.tab.active { background: rgba(62, 230, 255, 0.14); color: var(--text); box-shadow: inset 0 0 0 1px rgba(62, 230, 255, 0.4); }
.pickers { display: flex; gap: 22px; margin-top: 20px; width: min(1180px, 100%); justify-content: center; }
.picker { flex: 1; max-width: 580px; }
.picker-title { margin: 0 0 10px; font-size: 15px; color: #cfe0ff; display: flex; gap: 10px; align-items: baseline; }
.keys-hint { font-size: 12px; color: var(--dim); font-weight: 400; }
.class-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.card {
  position: relative; text-align: left; background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 14px 12px; cursor: pointer; transition: border-color .15s, transform .15s, box-shadow .15s;
}
.card:hover { transform: translateY(-2px); border-color: var(--line-strong); }
.card.selected { border-color: var(--c, var(--accent)); box-shadow: 0 0 0 1px var(--c, var(--accent)), 0 10px 30px rgba(0, 0, 0, 0.35); }
.card .glyph { width: 34px; height: 34px; margin-bottom: 8px; }
.card .cname { font-size: 18px; font-weight: 700; color: var(--c); }
.card .cen { font-size: 11px; letter-spacing: 2px; color: var(--dim); margin-left: 6px; }
.card .crole { font-size: 12px; color: var(--dim); margin: 2px 0 8px; }
.card .cline { font-size: 12px; line-height: 1.55; color: #c3d0ea; margin: 4px 0; }
.card .cline b { color: var(--text); font-weight: 600; }
.card .branches { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.chip { font-size: 11px; padding: 2px 7px; border-radius: 10px; border: 1px solid var(--line); color: #c3d0ea; }
.chip.todo { border-style: dashed; color: var(--dim); }
.pickers.single .picker[data-player="p2"] { display: none; }
.pickers.single .picker { max-width: 860px; }
.pickers.hidden { display: none; }
.menu-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 18px; }
.menu-actions .btn.primary { padding: 12px 34px; font-size: 16px; }
.foot-note { color: var(--dim); font-size: 12px; margin-top: auto; padding-top: 16px; text-align: center; }
#mode-note { text-align: center; max-width: 760px; }

/* ---------- 局域网 ---------- */
.lan-role { display: flex; gap: 16px; justify-content: center; margin: 24px 0; }
.lan-status { font-size: 16px; margin: 8px 0; }
.lan-addr { color: var(--accent); font-size: 14px; margin: 4px 0 14px; word-break: break-all; }
.lan-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; }
.lan-slot { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.lan-slot h3 { margin-top: 0; }
.lan-slot .btn { margin-top: 12px; width: 100%; }
.lan-peer { color: var(--dim); line-height: 1.8; }
.lan-peer .ready { color: var(--good); }

/* ---------- 局外天赋 ---------- */
.talent-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 12px; }
.talent { border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: var(--panel-2); display: flex; flex-direction: column; gap: 6px; }
.talent .tname { font-weight: 700; font-size: 16px; }
.talent .tlv { color: var(--accent); font-size: 13px; }
.talent .tval { color: #c3d0ea; font-size: 13px; }
.talent .btn { margin-top: 6px; }

/* ---------- 纪录 ---------- */
.rec-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 10px 0 18px; }
.stat { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.stat .k { font-size: 12px; color: var(--dim); }
.stat .v { font-size: 22px; font-weight: 700; margin-top: 4px; }
table.hist, table.keys { width: 100%; border-collapse: collapse; font-size: 13px; }
table.hist th, table.hist td, table.keys th, table.keys td { padding: 7px 8px; border-bottom: 1px solid var(--line); text-align: left; }
table.hist th, table.keys th { color: var(--dim); font-weight: 500; }

/* ---------- 说明 ---------- */
.help-grid { display: grid; grid-template-columns: 1fr 1.3fr 1fr; gap: 24px; }
.help p { font-size: 14px; line-height: 1.75; color: #c3d0ea; }

/* ---------- 战斗 HUD ---------- */
#screen-game { flex-direction: column; }
#hud { display: grid; grid-template-columns: 1fr auto 1fr; gap: 14px; align-items: stretch; padding: 8px 12px; height: 108px; background: rgba(8, 12, 22, 0.9); border-bottom: 1px solid var(--line); }
#stage { position: relative; flex: 1; min-height: 0; }
#canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: crosshair; }
.hud-center { display: flex; flex-direction: column; justify-content: center; align-items: center; min-width: 260px; }
.hud-stage { font-size: 22px; font-weight: 700; display: flex; gap: 12px; align-items: baseline; }
.hud-stage .dim { font-size: 14px; font-weight: 400; }
.hud-meta { display: flex; gap: 16px; font-size: 14px; color: #c3d0ea; margin-top: 4px; }
.hud-meta b { color: var(--accent); }
.hud-player { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.hud-player.right { align-items: flex-end; text-align: right; }
.hp-name { font-size: 14px; font-weight: 600; display: flex; gap: 8px; align-items: baseline; }
.hp-name .sub { font-size: 12px; font-weight: 400; color: var(--dim); }
.hp-bar { position: relative; width: min(340px, 100%); height: 14px; background: rgba(255, 255, 255, 0.07); border-radius: 7px; overflow: hidden; border: 1px solid rgba(255, 255, 255, 0.08); }
.hp-fill { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, #2fd27e, #62f0a0); transition: width .1s; }
.hp-fill.low { background: linear-gradient(90deg, #d93b4b, #ff5d6c); }
.hp-shield { position: absolute; inset: 0 auto 0 0; background: rgba(120, 210, 255, 0.55); mix-blend-mode: screen; }
.hp-text { position: absolute; inset: 0; font-size: 11px; line-height: 13px; text-align: center; text-shadow: 0 1px 2px #000; }
.hud-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.hud-player.right .hud-row { justify-content: flex-end; }
.skill { position: relative; width: 112px; height: 30px; border-radius: 7px; border: 1px solid var(--line); background: var(--panel-2); font-size: 11px; display: flex; align-items: center; gap: 6px; padding: 0 6px; overflow: hidden; }
.skill .key { font-weight: 700; background: rgba(255, 255, 255, 0.1); border-radius: 4px; padding: 1px 5px; z-index: 1; }
.skill .sname { z-index: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.skill .cdv { z-index: 1; font-weight: 700; }
.skill .cdfill { position: absolute; inset: 0 auto 0 0; background: rgba(0, 0, 0, 0.55); }
.skill .actfill { position: absolute; inset: auto 0 0 0; height: 3px; background: var(--good); }
.skill.ready { border-color: var(--good); }
.skill.locked { opacity: .45; border-style: dashed; }
.passive { font-size: 11px; color: #c3d0ea; border: 1px solid var(--line); border-radius: 10px; padding: 2px 8px; }
.ab { font-size: 11px; color: #c3d0ea; background: rgba(255, 255, 255, 0.06); border-radius: 4px; padding: 1px 6px; }

#toasts { position: absolute; top: 120px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; z-index: 5; }
.toast { background: rgba(10, 16, 30, 0.92); border: 1px solid var(--line-strong); padding: 7px 16px; border-radius: 18px; font-size: 14px; animation: toast 2.6s forwards; }
@keyframes toast { 0% { opacity: 0; transform: translateY(-6px); } 10%, 80% { opacity: 1; transform: none; } 100% { opacity: 0; } }

/* ---------- 弹层 ---------- */
.overlay { position: absolute; inset: 0; z-index: 10; display: flex; flex-direction: column; align-items: center; justify-content: center; background: rgba(3, 5, 10, 0.72); backdrop-filter: blur(3px); padding: 20px; overflow: auto; }
.overlay.modal { position: fixed; z-index: 30; }
.choice-head { text-align: center; margin-bottom: 14px; }
.choice-head h2 { margin: 0; font-size: 26px; }
.choice-head p { margin: 6px 0 0; }
.choice-panels { display: flex; gap: 18px; justify-content: center; width: 100%; max-width: 1360px; }
.cpanel { flex: 1; max-width: 680px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.cpanel.done { opacity: .6; }
.cpanel-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; gap: 8px; }
.cpanel-head .who { font-weight: 700; }
.cpanel-head .step { color: var(--warn); font-size: 13px; }
.cpanel-notice { color: var(--warn); font-size: 13px; margin: 0 0 8px; }
.opts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.opts.two { grid-template-columns: repeat(2, 1fr); }
.opt { text-align: left; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px; cursor: pointer; display: flex; flex-direction: column; gap: 6px; min-height: 150px; transition: border-color .12s, transform .12s; }
.opt:hover { border-color: var(--line-strong); }
.opt.focus { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); transform: translateY(-2px); }
.opt .otag { font-size: 11px; color: var(--dim); display: flex; justify-content: space-between; }
.opt .otag .t-ability { color: #8dffc8; }
.opt .otag .t-exclusive { color: #ffd166; }
.opt .otag .t-branch { color: #ff9ad5; }
.opt .oname { font-size: 17px; font-weight: 700; }
.opt .olv { font-size: 12px; color: var(--accent); }
.opt .odesc { font-size: 13px; line-height: 1.55; color: #c3d0ea; }
.opt .oline { font-size: 12px; line-height: 1.5; color: #c3d0ea; }
.opt .oline b { color: var(--text); }
.cpanel-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; font-size: 12px; color: var(--dim); gap: 8px; }
.wait { text-align: center; padding: 40px 0; color: var(--dim); }
.choice-foot { margin-top: 16px; }

.result-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 14px 0; }
.result-players { font-size: 13px; color: #c3d0ea; line-height: 1.8; }
.newbest { color: var(--warn); font-size: 12px; margin-left: 4px; }

.row-field { display: flex; align-items: center; gap: 12px; margin: 12px 0; }
.row-field input[type="range"] { flex: 1; accent-color: var(--accent); }
.row-field.check { cursor: pointer; }
.keymap { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 6px 10px; align-items: center; margin: 10px 0; font-size: 13px; }
.keymap .kh { color: var(--dim); }
.keybtn { background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; cursor: pointer; font-family: Consolas, monospace; font-size: 12px; }
.keybtn.listening { border-color: var(--warn); color: var(--warn); }
.keybtn.conflict { border-color: var(--danger); }

@media (max-width: 900px) {
  .pickers { flex-direction: column; align-items: center; }
  .class-cards, .talent-list, .opts, .help-grid, .rec-grid, .result-grid { grid-template-columns: 1fr; }
  .choice-panels { flex-direction: column; align-items: center; }
  .lan-grid { grid-template-columns: 1fr; }
  #hud { height: auto; grid-template-columns: 1fr; }
  .brand h1 { font-size: 40px; }
}

/* ---------- 局域网配对 ---------- */
.lan-tabs { width: max-content; margin: 6px auto 4px; }
.lan-pane { margin-top: 10px; }
.join-box { display: flex; gap: 10px; align-items: stretch; }
.join-box input { width: 120px; font-size: 26px; letter-spacing: 6px; text-align: center; background: var(--panel-2); color: var(--text); border: 1px solid var(--line-strong); border-radius: 8px; }
.join-box input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.room-code { font-size: 40px; font-weight: 800; letter-spacing: 10px; color: var(--accent); }
.pair-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.pairbox { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; text-align: left; }
.pairbox h3 { margin: 0 0 2px; }
.pairbox label { font-size: 12px; color: var(--dim); }
.pairbox textarea { width: 100%; height: 76px; resize: vertical; background: #0b1222; color: #cfe0ff; border: 1px solid var(--line); border-radius: 8px; padding: 8px; font-family: Consolas, monospace; font-size: 11px; word-break: break-all; }
.pairbox .row { display: flex; gap: 8px; flex-wrap: wrap; }
.net-panel { width: min(560px, 100%); text-align: center; }
.net-panel .pairbox { margin-top: 12px; }
@media (max-width: 900px) { .pair-grid { grid-template-columns: 1fr; } .join-box { flex-direction: column; } }
