:root {
  --bg: #0b0e14;
  --bg-2: #111722;
  --panel: #161d2a;
  --panel-2: #1c2534;
  --line: #2a3648;
  --line-soft: #212b3b;
  --text: #e9edf5;
  --text-dim: #9aa7bb;
  --text-faint: #66748a;
  --accent: #d9a441;
  --accent-2: #f0c874;
  --good: #6fd39b;
  --bad: #ef7b7b;
  --radius: 12px;
  --font: "Segoe UI", "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; min-height: 100%; }

body {
  background:
    radial-gradient(1100px 520px at 50% -12%, #1b2434 0%, transparent 62%),
    radial-gradient(800px 400px at 100% 100%, #171a2b 0%, transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

.app { max-width: 1240px; margin: 0 auto; padding: 20px 22px 44px; }

button { font-family: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .45; }
[hidden] { display: none !important; }

.muted { color: var(--text-dim); }

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 6px 2px 22px;
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 24px;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 11px;
  background: linear-gradient(145deg, #2b3547, #141a26);
  border: 1px solid #3a4760;
  position: relative; flex: none;
  box-shadow: inset 0 1px 0 #ffffff12, 0 6px 18px #00000055;
}
.brand-mark span {
  position: absolute; border-radius: 50%;
  width: 12px; height: 12px; top: 8px; left: 8px;
  background: var(--accent); box-shadow: 0 0 12px #d9a44188;
}
.brand-mark span:last-child {
  top: 19px; left: 19px; width: 12px; height: 12px;
  background: #6ba8e8; box-shadow: 0 0 12px #6ba8e888;
}
/* 品牌图标上传了自己的 LOGO 后，隐藏原本的手绘圆点装饰，避免遮挡素材 */
/* 界面编辑器：勾了「子级字号统一」后，元素内部写死 px 的字号（如倒计时里的「秒」）
   全部继承外层，避免只放大了主数字、后缀还是小字。只作用于后代，元素自身不受影响。 */
.__wowFsUniform * { font-size: inherit !important; }
.brand-mark.__hasImg span { display: none; }
.brand-text h1 { margin: 0; font-size: 19px; letter-spacing: 2px; font-weight: 700; }
.brand-text p { margin: 3px 0 0; font-size: 11.5px; color: var(--text-faint); letter-spacing: .6px; }
.top-actions { display: flex; gap: 8px; }

.ghost-btn {
  background: #18202d; color: var(--text-dim);
  border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 13px; font-size: 12px; letter-spacing: .4px;
  transition: background .16s, color .16s, border-color .16s, transform .12s;
}
.ghost-btn:hover:not(:disabled) { background: #222d3e; color: var(--text); border-color: #42536c; }
.ghost-btn:active:not(:disabled) { transform: translateY(1px); }

.primary-btn {
  background: linear-gradient(180deg, #e8bb62, #c98e2c);
  color: #1a1408; font-weight: 700; font-size: 14px; letter-spacing: 1px;
  border: 1px solid #f0cd84; border-radius: 9px; padding: 12px 30px;
  box-shadow: 0 6px 20px #c98e2c33, inset 0 1px 0 #ffffff55;
  transition: filter .16s, transform .12s, box-shadow .16s;
}
.primary-btn:hover:not(:disabled) { filter: brightness(1.09); box-shadow: 0 8px 26px #c98e2c55, inset 0 1px 0 #ffffff55; }
.primary-btn:active:not(:disabled) { transform: translateY(1px); }

/* ---------- 通用区块头 ---------- */
.section-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 20px; margin-bottom: 20px;
}
.section-head h2 { margin: 0 0 6px; font-size: 21px; letter-spacing: 1px; }
.section-head p { margin: 0; color: var(--text-dim); font-size: 12.5px; }

/* ---------- 职业选择 ---------- */
.class-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px;
}
.class-card {
  position: relative; text-align: left;
  background: linear-gradient(160deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px 20px; color: var(--text);
  overflow: hidden;
  transition: transform .16s, border-color .16s, box-shadow .16s;
}
.class-card::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 3px;
  background: var(--cls-color); opacity: .75;
}
.class-card::after {
  content: ""; position: absolute; width: 130px; height: 130px;
  right: -60px; top: -70px; border-radius: 50%;
  background: var(--cls-color); opacity: .055; filter: blur(8px);
}
.class-card:hover { transform: translateY(-3px); border-color: #46566f; }
.class-card.selected {
  border-color: var(--cls-color);
  box-shadow: 0 0 0 1px var(--cls-color), 0 10px 30px #0007, inset 0 0 30px #ffffff06;
  transform: translateY(-3px);
}
.class-card.selected::before { opacity: 1; box-shadow: 0 0 14px var(--cls-color); }
/* 未解锁：点击进入商店 */
.class-card.locked { cursor: pointer; }
.class-card.locked::before { opacity: .3; }
.class-card.locked .cc-orb { filter: grayscale(1) brightness(.6); box-shadow: none; }
.class-card.locked .cc-name { color: var(--text-dim); }
.class-card.locked .cc-stats { opacity: .35; }
.class-card.locked:hover { border-color: #5a4a34; }
.cc-lock {
  margin-left: auto; font-size: 11px; letter-spacing: .5px; color: #d9a441;
  border: 1px solid #6b542a; background: #241f14; border-radius: 4px; padding: 3px 8px;
}
.cc-head { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; }
.cc-orb {
  width: 48px; height: 48px; border-radius: 50%; flex: none;
  background: radial-gradient(circle at 32% 28%, #ffffffaa, var(--cls-color) 45%, #0006 100%);
  box-shadow: 0 0 18px var(--cls-color);
}
canvas.cc-orb { background: none; display: block; }
.cc-name { font-size: 18px; font-weight: 700; letter-spacing: 1px; }
.cc-trait { font-size: 12.5px; color: var(--text-dim); min-height: 36px; line-height: 1.5; margin: 8px 0 16px; }
.cc-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.cc-stat label { display: block; font-size: 11px; color: var(--text-faint); margin-bottom: 6px; letter-spacing: .5px; }
.cc-stat .bar { height: 5px; border-radius: 3px; background: #2a3344; overflow: hidden; }
.cc-stat .bar i { display: block; height: 100%; border-radius: 3px; background: var(--cls-color); }

.start-footer {
  margin-top: 22px; display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; background: #121926; border: 1px solid var(--line-soft); border-radius: var(--radius);
}
.selected-line { display: flex; align-items: baseline; gap: 10px; font-size: 12.5px; }
.selected-line strong { font-size: 17px; letter-spacing: 1px; }
.start-actions { display: flex; align-items: center; gap: 10px; }
.coin-chip {
  font-size: 12px; font-variant-numeric: tabular-nums; color: var(--accent-2);
  background: #241f14; border: 1px solid #6b542a; border-radius: 999px; padding: 5px 12px;
}

/* ---------- 地图内发射方向瞄准 ---------- */
.aim-overlay {
  position: absolute; left: 0; right: 0; bottom: 14px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none;            /* 不挡住画布拖动，仅按钮可点 */
}
.aim-tip {
  font-size: 12px; color: #cdd8e6; background: rgba(13,20,32,.82);
  border: 1px solid rgba(124,196,255,.35); border-radius: 999px;
  padding: 5px 14px; backdrop-filter: blur(3px);
}
.aim-overlay #launchBtn { pointer-events: auto; font-size: 15px; padding: 10px 26px; box-shadow: 0 6px 22px rgba(124,196,255,.28); }

/* ---------- 计分板 ---------- */
.scoreboard {
  display: grid; grid-template-columns: 1fr 150px 1fr; gap: 12px; align-items: stretch;
  margin-bottom: 12px;
}
.fighter-panel {
  background: linear-gradient(160deg, var(--side-bg, transparent), var(--panel-2) 42%, var(--panel)), var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; position: relative; overflow: hidden;
}
.fighter-panel::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--side-color, #555);
  box-shadow: 0 0 12px var(--side-color, transparent);
}
.player-panel { border-color: #31536b; }
.enemy-panel { border-color: #6b3a38; }
.enemy-panel { text-align: right; }
.enemy-panel::before { left: auto; right: 0; }
.fp-top { display: flex; align-items: center; gap: 9px; margin-bottom: 9px; }
.enemy-panel .fp-top { justify-content: flex-end; }
.fp-ident { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.enemy-panel .fp-ident { align-items: flex-end; }
.fp-name { font-size: 16px; font-weight: 700; letter-spacing: 1px; min-width: 0; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fp-nick {
  font-size: 10.5px; letter-spacing: .3px; max-width: 100%;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.player-panel .fp-nick { color: #8fdcff; }
.enemy-panel .fp-nick { color: #ff9d90; }
.fp-side { font-size: 10.5px; color: var(--text-faint); border: 1px solid var(--line); padding: 2px 7px; border-radius: 5px; flex: none; }
.player-panel .fp-side { color: #8fdcff; border-color: #3c6a86; background: #122435; }
.enemy-panel .fp-side { color: #ff9d90; border-color: #7d4240; background: #2a1a1c; }
.hp-track {
  height: 12px; background: #0d121b; border: 1px solid #2b3648;
  border-radius: 7px; overflow: hidden; position: relative;
}
.hp-bar {
  position: absolute; left: 0; top: 0; bottom: 0; width: 100%;
  background: linear-gradient(90deg, #b8434e, #e8736a);
  transition: width .22s cubic-bezier(.2,.8,.3,1);
}
.enemy-panel .hp-bar { left: auto; right: 0; background: linear-gradient(270deg, #b8434e, #e8736a); }
.shield-bar {
  position: absolute; left: 0; top: 0; bottom: auto; height: 3px; width: 0;
  z-index: 2;
  background: repeating-linear-gradient(115deg, #8fc4f0 0 5px, #5d93c9 5px 10px);
  transition: width .22s;
}
.enemy-panel .shield-bar { left: auto; right: 0; }
.fp-bottom { display: flex; justify-content: space-between; margin-top: 7px; font-size: 11px; color: var(--text-dim); }
.hp-text { font-variant-numeric: tabular-nums; }
.score-text { color: var(--accent-2); }
/* 对局双方卡片：BUFF / DEBUFF 图标栏（图标、颜色、名称、说明均由后台「状态图标」页配置） */
.buff-bar { display: flex; gap: 5px; margin-top: 8px; flex-wrap: wrap; align-items: center; min-height: 0; }
.buff-bar:empty { display: none; }
.enemy-panel .buff-bar { justify-content: flex-end; }
.buff-chip {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; flex: 0 0 28px; border-radius: 8px;
  border: 1px solid var(--st-color, #6b7a96);
  background: var(--st-bg, rgba(120, 140, 170, .14));
  box-shadow: 0 0 8px var(--st-glow, transparent), inset 0 0 0 1px rgba(0, 0, 0, .18);
  cursor: help; transition: transform .12s ease, box-shadow .12s ease;
}
.buff-chip:hover { transform: translateY(-2px); box-shadow: 0 0 12px var(--st-glow, transparent); z-index: 2; }
.buff-chip .st-icon { width: 18px; height: 18px; object-fit: contain; pointer-events: none; }
.buff-chip .st-glyph { width: 18px; height: 18px; display: block; pointer-events: none; }
.buff-chip .st-glyph path, .buff-chip .st-glyph circle, .buff-chip .st-glyph rect, .buff-chip .st-glyph line { fill: none; stroke: var(--st-color, #c7d2e3); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.buff-chip[data-kind="buff"] .st-kind { position: absolute; left: -2px; top: -2px; width: 5px; height: 5px; border-radius: 50%; background: var(--st-color); }
.buff-chip[data-kind="debuff"] .st-kind { position: absolute; left: -2px; top: -2px; width: 5px; height: 5px; border-radius: 50%; border: 1.5px solid var(--st-color); background: #0d1522; }
.buff-chip .st-stack {
  position: absolute; right: -4px; bottom: -5px; min-width: 14px; height: 14px; padding: 0 2px;
  border-radius: 7px; background: #0d1522; border: 1px solid var(--st-color);
  color: var(--st-color); font-size: 9px; line-height: 12px; text-align: center;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.buff-chip .st-stack:empty { display: none; }
.mini-skills { display: flex; gap: 5px; margin-top: 10px; flex-wrap: wrap; min-height: 20px; }
.enemy-panel .mini-skills { justify-content: flex-end; }
.mini-skill {
  display: inline-flex; align-items: center;
  font-size: 10.5px; padding: 3px 8px; border-radius: 5px;
  background: #1e2836; border: 1px solid #33425a; color: #c7d2e3;
  white-space: nowrap;
}
/* 只有带充能条的技能条目才用两行布局；其它位置（战报/结算）沿用单行胶囊 */
.mini-skill.has-cd { display: flex; flex-direction: column; align-items: stretch; gap: 3px; min-width: 62px; padding: 3px 8px 4px; }
.mini-skill .ms-name { line-height: 1.25; }
.mini-skill .ms-cd { display: block; height: 3px; border-radius: 2px; background: #0c1320; overflow: hidden; }
.mini-skill .ms-cd i { display: block; height: 100%; width: 100%; border-radius: 2px; background: #4d7ba8; }
.mini-skill.charging { color: #93a3ba; }
.mini-skill.charging .ms-cd i { background: #4d7ba8; }
.mini-skill.ready { border-color: #5a6a86; color: #eaf1fb; }
.mini-skills .mini-skill.ready { border-color: #5a6a86; }
.mini-skill.ready .ms-cd i { background: linear-gradient(90deg, #b98a2e, #f0c874); box-shadow: 0 0 6px #f0c87455; }
.mini-skill.passive .ms-cd { opacity: .3; }
.mini-skill.empty { background: transparent; border-style: dashed; border-color: #2b3648; color: #4c5a70; }
.mini-skill[data-tier="rare"] { border-color: #4e6fa8; color: #b9d3f5; }
.mini-skill[data-tier="epic"] { border-color: #8a63b8; color: #dcc2f5; }

.round-panel {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 9px; background: #121926; border: 1px solid var(--line-soft); border-radius: var(--radius);
}
.round-label { font-size: 14px; font-weight: 700; letter-spacing: 1px; }
.round-pips { display: flex; gap: 7px; }
.rpip { width: 11px; height: 11px; border-radius: 50%; border: 1px solid #3c4a60; background: #1c2431; }
.rpip.win { background: var(--good); border-color: var(--good); box-shadow: 0 0 9px #6fd39b77; }
.rpip.lose { background: #4a2b32; border-color: #7c444b; }
.rpip.draw { background: #6b6250; border-color: #8c7d5e; }
.rpip.current { outline: 2px solid var(--accent); outline-offset: 2px; }
.phase-label { font-size: 11px; color: var(--text-faint); letter-spacing: .5px; }

/* ---------- 竞技场 ---------- */
.arena-wrap {
  position: relative; width: 100%; aspect-ratio: 900 / 400;
  background: #080b12; border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
  box-shadow: inset 0 0 70px #000a, 0 12px 34px #0006;
}
#arena { display: block; width: 100%; height: 100%; }
.arena-timer {
  position: absolute; left: 14px; top: 12px;
  font-size: 12px; font-variant-numeric: tabular-nums;
  color: var(--text-dim); background: #0a0e16aa; border: 1px solid #2b3648;
  padding: 4px 10px; border-radius: 6px; pointer-events: none;
}
.arena-timer .muted { font-size: 10px; }
.arena-log-btn {
  position: absolute; right: 14px; top: 12px; z-index: 5;
  font-size: 11.5px; letter-spacing: .5px; color: var(--text-dim);
  background: #0a0e16cc; border: 1px solid #2b3648; border-radius: 6px;
  padding: 4px 12px; cursor: pointer; transition: color .12s, border-color .12s;
}
.arena-log-btn:hover { color: var(--text); border-color: #4b5c76; }
.banner {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 6px;
  background: radial-gradient(ellipse at center, #0b0e16dd 0%, #0b0e1699 55%, transparent 100%);
  text-align: center; pointer-events: none;
  animation: bannerIn .28s cubic-bezier(.2,.9,.3,1.2);
}
@keyframes bannerIn { from { opacity: 0; transform: scale(.9); } to { opacity: 1; transform: scale(1); } }
.banner h3 { margin: 0; font-size: 30px; letter-spacing: 4px; text-shadow: 0 3px 20px #000; }
.banner p { margin: 0; font-size: 12.5px; color: var(--text-dim); letter-spacing: 1px; }

/* ---------- 弹层内技能卡片 ---------- */
.panel-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.panel-title h3 { margin: 0; font-size: 13.5px; letter-spacing: .8px; }
.panel-title .muted { font-size: 11px; }
.draft-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.skill-card {
  position: relative; text-align: left; color: var(--text);
  background: #131b28; border: 1px solid #33425a; border-radius: 10px;
  padding: 13px 13px 12px; min-height: 138px;
  display: flex; flex-direction: column; gap: 7px;
  transition: transform .15s, border-color .15s, box-shadow .15s, background .15s;
}
.skill-card:hover:not(:disabled) {
  transform: translateY(-3px); background: #1a2434;
  border-color: var(--tier-color); box-shadow: 0 8px 24px #0008, 0 0 0 1px var(--tier-color) inset;
}
.skill-card:disabled { opacity: .38; }
.skill-card .sc-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.sc-name { font-size: 14px; font-weight: 700; letter-spacing: .6px; }
.sc-tier { font-size: 10px; padding: 2px 7px; border-radius: 4px; border: 1px solid var(--tier-color); color: var(--tier-color); }
.sc-origin { font-size: 10.5px; color: var(--text-faint); letter-spacing: .5px; }
.sc-effect { font-size: 11.5px; line-height: 1.55; color: #c4d0e1; white-space: pre-line; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; }
.sc-hotkey { margin-top: auto; font-size: 10px; color: var(--text-faint); }
.skill-card[data-tier="common"] { --tier-color: #6c829e; }
.skill-card[data-tier="rare"] { --tier-color: #6f9ede; }
.skill-card[data-tier="epic"] { --tier-color: #b888e8; }

/* ---------- 战斗记录 ---------- */
.battle-log { display: flex; flex-direction: column; gap: 2px; }
.log-line { font-size: 11.5px; color: var(--text-dim); line-height: 1.55; padding: 3px 0 3px 10px; position: relative; }
.log-line::before { content: ""; position: absolute; left: 0; top: 9px; width: 4px; height: 4px; border-radius: 50%; background: #46566f; }
.log-line.hl { color: var(--text); }
.log-line.hl::before { background: var(--accent); }
.log-line.good::before { background: var(--good); }
.log-line.bad::before { background: var(--bad); }
/* 回合分隔：无项目符号，右侧接一条细线，把「一回合的伤害流水」框成一段 */
.log-line.sep { display: flex; align-items: center; gap: 8px; margin: 10px 0 2px; padding-left: 0; color: var(--text-dim); font-size: 10.5px; letter-spacing: 1px; }
.log-line.sep::before { display: none; }
.log-line.sep::after { content: ""; flex: 1; height: 1px; background: var(--line-soft); }
.log-line.sep .sep-sub { color: var(--text-faint); letter-spacing: 0; }

/* 战斗记录 · 伤害统计摘要：固定在记录列表上方，不随列表滚动 */
.dmg-summary { margin: 0 0 12px; padding: 12px 13px; border: 1px solid var(--line-soft); border-radius: 10px; background: #0f1723; font-size: 11.5px; color: var(--text-dim); }
.dmg-summary .ds-head { display: flex; align-items: baseline; gap: 8px; color: var(--text); font-weight: 600; letter-spacing: .5px; margin-bottom: 8px; }
.dmg-summary .ds-sub { color: var(--text-faint); font-weight: 400; font-size: 10.5px; letter-spacing: 0; }
.dmg-summary .ds-table { display: grid; gap: 4px; }
.dmg-summary .ds-row { display: grid; grid-template-columns: 42px repeat(3, 1fr); align-items: baseline; gap: 6px; padding: 5px 8px; border-radius: 6px; background: #131c2a; }
.dmg-summary .ds-row.ds-own { background: linear-gradient(90deg, #6fd39b14, #131c2a 62%); }
.dmg-summary .ds-row.ds-enemy { background: linear-gradient(90deg, #ef7b7b14, #131c2a 62%); }
.dmg-summary .ds-who { font-weight: 700; }
.dmg-summary .ds-row.ds-own .ds-who { color: var(--good); }
.dmg-summary .ds-row.ds-enemy .ds-who { color: var(--bad); }
.dmg-summary .ds-cell { display: flex; align-items: baseline; gap: 5px; }
.dmg-summary .ds-cell i { font-style: normal; color: var(--text-faint); font-size: 10px; }
.dmg-summary .ds-cell b { color: var(--text); font-size: 13px; font-variant-numeric: tabular-nums; }
.dmg-summary .ds-src { display: grid; gap: 5px; margin-top: 9px; padding-top: 8px; border-top: 1px dashed var(--line-soft); }
.dmg-summary .ds-src-row { display: flex; align-items: flex-start; gap: 7px; }
.dmg-summary .ds-src-tag { flex: none; font-size: 10px; padding: 1px 6px; border-radius: 4px; border: 1px solid var(--line); margin-top: 1px; }
.dmg-summary .ds-src-tag.ds-own { color: var(--good); border-color: #2f5a45; }
.dmg-summary .ds-src-tag.ds-enemy { color: var(--bad); border-color: #5f3a3a; }
.dmg-summary .ds-chips { display: flex; flex-wrap: wrap; gap: 4px 6px; }
.dmg-summary .ds-chip { display: inline-flex; align-items: baseline; gap: 5px; background: #1a2434; border: 1px solid var(--line-soft); border-radius: 5px; padding: 1px 6px; font-size: 10.5px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.dmg-summary .ds-chip b { color: #cdd8e8; font-weight: 600; }
.dmg-summary .ds-empty { color: var(--text-faint); }

/* 逐笔伤害：四列栅格（方向 / 伤害 / 来源 / 剩余），数值右对齐，扫读不串行。
   我方造成=琥珀底，对手造成=红底；只加同辈修饰类，不动 .log-line 基类。 */
.log-line.dmg-own, .log-line.dmg-enemy {
  display: grid; grid-template-columns: 72px 52px minmax(0, 1fr) 58px;
  align-items: baseline; gap: 8px; padding: 5px 8px 5px 12px;
  border-radius: 6px; font-variant-numeric: tabular-nums;
}
.log-line.dmg-own { color: var(--text); background: #e0a34c0d; }
.log-line.dmg-enemy { color: var(--text); background: #e271710d; }
.log-line.dmg-own::before, .log-line.dmg-enemy::before { top: 50%; margin-top: -2px; left: 4px; }
.log-line .lg-dir { color: var(--text-dim); font-size: 10.5px; letter-spacing: .2px; white-space: nowrap; }
.log-line .lg-val { font-weight: 700; font-size: 13px; text-align: right; white-space: nowrap; }
.log-line.dmg-own .lg-val { color: #f0b45e; }
.log-line.dmg-enemy .lg-val { color: #ef8b8b; }
.log-line .lg-src { display: flex; align-items: baseline; gap: 5px; min-width: 0; }
.log-line .lg-src b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-line .lg-src i { font-style: normal; font-size: 10px; line-height: 1.5; color: var(--text-faint); border: 1px solid var(--line-soft); border-radius: 4px; padding: 0 4px; white-space: nowrap; flex: none; }
.log-line .lg-src i.lg-crit { color: #ffd76a; border-color: #6b542a; }
.log-line .lg-hp { text-align: right; color: var(--text-faint); font-size: 10.5px; white-space: nowrap; }

/* ---------- 结算 ---------- */
.result-card {
  max-width: 820px; margin: 12px auto 0; text-align: center;
  background: linear-gradient(160deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line); border-radius: 16px; padding: 34px 38px 30px;
  box-shadow: 0 24px 60px #0008;
}
.result-kicker { font-size: 11px; letter-spacing: 3px; color: var(--text-faint); margin-bottom: 10px; }
.result-card h2 { margin: 0 0 10px; font-size: 34px; letter-spacing: 5px; }
.result-card h2.win { color: var(--accent-2); text-shadow: 0 0 28px #d9a44155; }
.result-card h2.lose { color: #9db0c9; }
.result-card h2.draw { color: #c9b784; }
.result-desc { margin: 0 0 24px; color: var(--text-dim); font-size: 13px; }
.round-review { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 22px; }
.rr-item { background: #121926; border: 1px solid var(--line-soft); border-radius: 9px; padding: 13px 10px; }
.rr-item .rr-no { font-size: 10.5px; color: var(--text-faint); letter-spacing: 1px; }
.rr-item .rr-res { font-size: 16px; font-weight: 700; margin: 7px 0 4px; }
.rr-item .rr-res.win { color: var(--good); }
.rr-item .rr-res.lose { color: var(--bad); }
.rr-item .rr-res.draw { color: #c9b784; }
.rr-item .rr-detail { font-size: 11px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.build-review { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; text-align: left; margin-bottom: 24px; }
.br-col { background: #121926; border: 1px solid var(--line-soft); border-radius: 9px; padding: 13px 15px; }
.br-col h4 { margin: 0 0 9px; font-size: 12px; letter-spacing: 1px; color: var(--text-dim); }
.br-list { display: flex; flex-wrap: wrap; gap: 6px; }
.result-actions { display: flex; gap: 10px; justify-content: center; align-items: center; flex-wrap: wrap; }
.result-actions .ghost-btn { padding: 12px 20px; font-size: 13px; }

/* ---------- 弹层 ---------- */
.modal {
  position: fixed; inset: 0; background: #04070ccc; backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px;
}
.modal-card {
  width: min(560px, 100%); background: var(--panel); border: 1px solid #3a4760;
  border-radius: 14px; padding: 22px 26px 24px; box-shadow: 0 30px 80px #000b;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal-head h3 { margin: 0; font-size: 17px; letter-spacing: 1px; }
.icon-btn { background: transparent; border: 1px solid var(--line); color: var(--text-dim); border-radius: 7px; padding: 5px 11px; font-size: 11px; }
.icon-btn:hover { color: var(--text); border-color: #4b5c76; }
.rules-list { margin: 0; padding-left: 20px; color: #c6d1e2; font-size: 12.5px; line-height: 1.85; }
.rules-list strong { color: var(--accent-2); }
.modal-foot { margin: 16px 0 0; font-size: 11px; color: var(--text-faint); line-height: 1.6; }
.modal-sub { font-size: 11.5px; color: var(--text-dim); }
.log-modal-card {
  width: min(520px, 100%); max-height: calc(100vh - 40px);
  display: flex; flex-direction: column; overflow: hidden; padding-bottom: 16px;
}
.log-modal-card .modal-head { flex: none; margin-bottom: 12px; }
.log-modal-body { flex: 1 1 auto; min-height: 120px; max-height: min(56vh, 460px); overflow-y: auto; padding-right: 6px; }
/* 深色细滚动条：浏览器默认的白色滚动条在暗色弹层里非常跳 */
.log-modal-body { scrollbar-width: thin; scrollbar-color: #2f3d52 transparent; }
.log-modal-body::-webkit-scrollbar { width: 7px; }
.log-modal-body::-webkit-scrollbar-track { background: transparent; }
.log-modal-body::-webkit-scrollbar-thumb { background: #2f3d52; border-radius: 4px; }
.log-modal-body::-webkit-scrollbar-thumb:hover { background: #3d4f69; }
.draft-modal-card { width: min(780px, 100%); }
.draft-modal-card .modal-head { align-items: baseline; }

/* ---------- 商店弹层 ---------- */
.shop-modal-card { width: min(720px, 100%); }
.shop-head-right { display: flex; align-items: center; gap: 10px; }
.shop-draw-row {
  display: flex; align-items: center; gap: 16px; padding: 12px 14px;
  background: #121926; border: 1px solid var(--line-soft); border-radius: 10px;
}
.shop-draw-info { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
.shop-cost { font-size: 13px; font-weight: 700; color: var(--accent-2); }
.shop-draw-row .primary-btn { flex: none; }
.shop-result {
  margin-top: 12px; padding: 12px 14px; border-radius: 10px;
  font-size: 12.5px; line-height: 1.6; border: 1px solid var(--line); background: #101722;
}
.shop-result.new { border-color: #b888e8; background: #1a1426; color: #e7d7ff; box-shadow: inset 0 0 26px #b888e822; }
.shop-result.dup { border-color: #4b5c76; color: var(--text-dim); }
.shop-result.bad { border-color: #7a3a3a; background: #241414; color: #ffb3ad; }
.shop-result .sr-name { font-size: 15px; font-weight: 700; letter-spacing: 1px; margin-right: 6px; }
.shop-section-title { margin: 16px 0 9px; font-size: 12px; letter-spacing: 1px; color: var(--text-dim); }
.shop-pool { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 9px; }
.shop-item {
  display: flex; align-items: center; gap: 9px; padding: 9px 11px;
  background: #121926; border: 1px solid var(--line-soft); border-radius: 9px;
}
.shop-item.owned { opacity: .6; }
.shop-item .si-orb {
  width: 22px; height: 22px; border-radius: 50%; flex: none;
  background: radial-gradient(circle at 32% 28%, #ffffffaa, var(--si-color, #8aa) 45%, #0006 100%);
  box-shadow: 0 0 10px var(--si-color, #8aa);
}
.shop-item .si-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.shop-item .si-name { font-size: 12.5px; font-weight: 700; letter-spacing: .5px; }
.shop-item .si-meta { font-size: 10px; color: var(--text-faint); }
.shop-item .si-tag { margin-left: auto; font-size: 10px; color: var(--text-faint); white-space: nowrap; }
.shop-item .si-tag.owned { color: #6f9ede; }

/* ---------- 异步对战 · 幽灵 ---------- */
.ghost-modal-card { width: min(680px, 100%); }
.ghost-tip {
  font-size: 12px; color: var(--text-dim); line-height: 1.7;
  background: #121926; border: 1px solid var(--line-soft); border-radius: 9px;
  padding: 10px 12px; margin-bottom: 14px;
}
.ghost-list { display: flex; flex-direction: column; gap: 8px; max-height: 46vh; overflow-y: auto; }
.ghost-empty {
  padding: 22px 12px; text-align: center; font-size: 12px; color: var(--text-faint);
  border: 1px dashed #33425a; border-radius: 10px;
}
.ghost-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  background: #121926; border: 1px solid var(--line-soft); border-radius: 10px;
}
.ghost-item .gh-orb {
  width: 24px; height: 24px; border-radius: 50%; flex: none;
  background: radial-gradient(circle at 32% 28%, #ffffffaa, var(--gh-color, #8aa) 45%, #0006 100%);
  box-shadow: 0 0 10px var(--gh-color, #8aa);
}
.ghost-item .gh-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.ghost-item .gh-name { font-size: 13px; font-weight: 700; letter-spacing: .4px; }
.ghost-item .gh-meta { font-size: 10.5px; color: var(--text-faint); }
.ghost-item .ghost-btn { padding: 5px 10px; font-size: 11px; flex: none; }
.ghost-item .gh-fight { padding: 6px 16px; font-size: 12px; flex: none; }
.ghost-item.is-dup { animation: ghostDup 1.4s ease; }
@keyframes ghostDup {
  0%   { border-color: var(--accent); box-shadow: 0 0 0 0 rgba(217, 164, 65, .45); }
  35%  { border-color: var(--accent); box-shadow: 0 0 0 5px rgba(217, 164, 65, .16); }
  100% { border-color: var(--line-soft); box-shadow: 0 0 0 0 rgba(217, 164, 65, 0); }
}
.ghost-share { margin-top: 14px; }
.ghost-share-head { display: flex; align-items: baseline; gap: 10px; font-size: 12px; color: var(--text-dim); margin-bottom: 8px; }
.ghost-code-row { display: flex; gap: 9px; align-items: stretch; }
.ghost-code {
  flex: 1; min-width: 0; resize: vertical; font-size: 11px; line-height: 1.6;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: #0f1621; color: var(--text-dim); border: 1px solid #33425a;
  border-radius: 7px; padding: 8px 10px; outline: none; transition: border-color .12s;
}
.ghost-code:focus { border-color: var(--accent); }
.ghost-code::placeholder { color: #56657c; }
.ghost-code-row .ghost-btn { flex: none; padding: 0 16px; }
.ghost-msg { margin-top: 8px; font-size: 11.5px; color: var(--text-dim); }
.ghost-msg.ok { color: #7fce9a; }
.ghost-msg.warn { color: var(--accent-2); }
.ghost-msg.bad { color: #e08b93; }
.async-tag {
  margin-top: 4px; max-width: 190px; font-size: 10px; color: var(--accent-2);
  letter-spacing: .3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ---------- 结算 · 分享码 ---------- */
.share-modal-card { width: min(600px, 100%); }
.share-tip {
  font-size: 12px; color: var(--text-dim); line-height: 1.7;
  background: #121926; border: 1px solid var(--line-soft); border-radius: 9px;
  padding: 10px 12px; margin-bottom: 12px;
}
.share-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 12px; color: var(--text-dim); margin-bottom: 10px; }
.share-meta .sm-cls { font-weight: 700; letter-spacing: .5px; }
.share-meta .sm-sep { color: var(--text-faint); }
.share-plays { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.share-play {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px;
  background: #121926; border: 1px solid var(--line-soft); border-radius: 9px; font-size: 12px;
}
.share-play .sp-no { flex: none; width: 62px; font-size: 10.5px; letter-spacing: 1px; color: var(--text-faint); }
.share-play .sp-skill { flex: 1; min-width: 0; font-weight: 700; letter-spacing: .4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.share-play .sp-aim { flex: none; color: var(--accent-2); font-variant-numeric: tabular-nums; }
.share-code-head { display: flex; align-items: baseline; gap: 10px; font-size: 12px; color: var(--text-dim); margin-bottom: 8px; }
.share-code { width: 100%; min-height: 74px; }
.share-actions { display: flex; gap: 10px; margin-top: 14px; }
.share-actions .primary-btn { flex: 1; }

/* ---------- 配置更新提示 ---------- */
.reload-notice {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 16px; padding: 10px 14px;
  background: #2a2414; border: 1px solid #7a602a; border-radius: 9px;
  color: var(--accent-2); font-size: 12.5px;
}
.reload-notice span { flex: 1; }
.reload-notice .ghost-btn { padding: 5px 11px; font-size: 11px; }

/* ---------- 昵称（首次输入 / 顶栏修改） ---------- */
.nick-btn { color: var(--accent-2); border-color: #6b542a; background: #241f14; }
.nick-btn:hover:not(:disabled) { color: #ffe0a0; border-color: #9c7638; background: #2e2617; }
#nameModal { z-index: 60; }
.name-modal-card { width: min(420px, 100%); }
.name-tip { margin: 0 0 16px; font-size: 12px; color: var(--text-dim); line-height: 1.7; }
.name-label { display: block; font-size: 11px; color: var(--text-faint); margin-bottom: 7px; letter-spacing: .5px; }
.name-input {
  width: 100%; box-sizing: border-box; padding: 11px 13px; font-size: 14px; font-family: inherit;
  color: var(--text); background: #0e1520; border: 1px solid #3a4760; border-radius: 8px;
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.name-input::placeholder { color: #55637a; }
.name-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px #d9a44122; }
.name-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.name-actions .primary-btn { padding: 10px 26px; font-size: 13px; }
#nameModal .ghost-msg { margin-top: 10px; }

/* ---------- 自适应 ---------- */
@media (max-width: 980px) {
  .class-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .app { padding: 14px 12px 32px; }
  .topbar { flex-wrap: wrap; gap: 12px; }
  .class-grid { grid-template-columns: 1fr; }
  .class-card { padding: 15px 16px 17px; }
  .cc-trait { min-height: 0; margin-bottom: 13px; }
  .ghost-item { flex-wrap: wrap; }
  .ghost-item .gh-body { flex: 1 1 100%; }
  .scoreboard { grid-template-columns: 1fr 1fr; }
  .round-panel { grid-column: 1 / -1; grid-row: 1; flex-direction: row; gap: 14px; padding: 8px; }
  .draft-cards { grid-template-columns: 1fr; }
  .skill-card { min-height: 0; }
  .round-review, .build-review { grid-template-columns: 1fr; }
  .section-head { flex-direction: column; align-items: flex-start; }
  /* 战斗记录：窄屏压缩列宽，四列仍严格对齐 */
  .log-line.dmg-own, .log-line.dmg-enemy { grid-template-columns: 58px 40px minmax(0, 1fr) 48px; gap: 6px; padding: 5px 6px 5px 10px; }
  .log-line .lg-dir { font-size: 9.5px; letter-spacing: 0; }
  .dmg-summary .ds-row { grid-template-columns: 38px repeat(3, 1fr); gap: 4px; padding: 5px 6px; }
  .dmg-summary .ds-cell i { font-size: 9.5px; }
}

/* ============================================================
   预览模式（后台实时编排内嵌引擎）：隐藏编辑 UI，只留竞技场与 HUD
   ============================================================ */
body.preview-mode .topbar { display: none !important; }
body.preview-mode .app { padding-top: 0 !important; }
body.preview-mode .screen { min-height: auto; }
body.preview-mode .arena-wrap { height: clamp(360px, 60vh, 720px); }
.preview-bar { position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 30;
  display: flex; align-items: center; gap: 8px; padding: 7px 12px; background: rgba(12,17,26,.86);
  border: 1px solid #2a3648; border-radius: 999px; box-shadow: 0 10px 30px rgba(0,0,0,.5); backdrop-filter: blur(6px); }
.preview-bar .pb-tag { font-size: 11px; font-weight: 700; color: #d9a441; letter-spacing: .5px; padding-right: 4px; }
.preview-bar .pb-btn { font-size: 11.5px; padding: 5px 11px; border-radius: 999px; border: 1px solid #2a3648;
  background: #161d2a; color: #e9edf5; }
.preview-bar .pb-btn:hover { background: #1b2433; border-color: #3a4a63; }

/* 右下角私有版本号：只显示内部构建密钥，不干扰任何交互 */
.version-tag {
  position: fixed; right: 10px; bottom: 6px; z-index: 60;
  font: 600 10.5px/1.3 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: .6px; color: rgba(150, 172, 205, .38);
  user-select: none; pointer-events: none; white-space: nowrap;
}
