* {
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
    margin: 0;
    padding: 20px;
    background: #f8f9fa;
    color: #2c3e50;
}

.tengwar-img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 14px auto 4px;
}

[data-theme="dark"] .tengwar-img { filter: invert(1); }

.title-latin {
    font-size: 15px;
    color: #7f8c8d;
    margin: 0 0 10px;
    line-height: 1.6;
}

.title-credit {
    font-size: 11px;
    color: #b2bec3;
    margin: 4px 0 0;
}

.title-credit a { color: inherit; }

.title-help {
    margin: 22px auto 0;
    max-width: 660px;
    text-align: left;
    font-size: 13px;
    line-height: 1.85;
    color: #7f8c8d;
    background: #f8f9fa;
    border: 1px solid #e6e9ef;
    border-radius: 12px;
    padding: 16px 20px;
}
.title-help b { color: #2c3e50; }
[data-theme="dark"] .title-help { background: #14192b; border-color: #2f3b5c; color: #9aa4b5; }
[data-theme="dark"] .title-help b { color: #e0e0e0; }

.header-bar {
    max-width: 960px;
    margin: 0 auto 15px;
}

.utility-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.utility-btn {
    padding: 8px 16px;
    border: 2px solid #4a90e2;
    border-radius: 20px;
    background: white;
    color: #4a90e2;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.utility-btn:hover {
    background: #4a90e2;
    color: white;
    transform: translateY(-1px);
}

.page-title {
    margin: 0;
    font-size: 26px;
    letter-spacing: 1px;
}

.page-sub {
    margin: 6px 0 0;
    color: #7f8c8d;
    font-size: 13px;
}

.main-container {
    max-width: 960px;
    margin: 0 auto;
}

.panel {
    background: white;
    border-radius: 12px;
    padding: 22px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    margin-bottom: 18px;
}

.hidden { display: none !important; }

/* 状态条 */
.status-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 14px;
}

.stat {
    background: #f1f4f8;
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 14px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* —— 顶栏首领预览 —— */
.boss-preview {
    display: inline-flex; align-items: center; gap: 5px; cursor: help;
    background: #f3e8f8; border: 1px solid #cba7e0; border-radius: 20px; padding: 2px 12px 2px 4px;
}
.boss-mini { width: 30px; height: 30px; display: block; }
.boss-mini svg { width: 30px; height: 30px; animation: none !important; filter: none; }
.boss-name { font-size: 13px; font-weight: 700; font-style: italic; color: #6d3a86; }
[data-theme="dark"] .boss-preview { background: #2a1f3d; border-color: #55397a; }
[data-theme="dark"] .boss-name { color: #c9a6e6; }

.stat.hp { color: #c0392b; }
.stat.block { color: #2980b9; }
.stat.energy { color: #d68910; }
.stat.coin { color: #7d6608; }
.stat.floor { color: #6c3483; }

.bar-outer {
    width: 100%;
    height: 14px;
    background: #e6e9ef;
    border-radius: 8px;
    overflow: hidden;
}

.bar-inner {
    height: 100%;
    transition: width 0.3s;
}

.bar-inner.hp { background: linear-gradient(90deg, #e74c3c, #c0392b); }
.bar-inner.foe { background: linear-gradient(90deg, #8e44ad, #5b2c6f); }

/* 地图 */
.room-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 16px;
}

.room-card {
    border: 2px solid #dfe4ea;
    border-radius: 12px;
    padding: 18px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    background: #fbfcfd;
}

.room-card:hover {
    transform: translateY(-3px);
    border-color: #4a90e2;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
}

.room-icon { font-size: 30px; }
.room-name { font-size: 18px; font-weight: 600; margin: 8px 0 4px; }
.room-desc { font-size: 13px; color: #7f8c8d; line-height: 1.5; }

/* 战斗 */
.foe-box {
    text-align: center;
    padding: 18px;
    border-radius: 12px;
    background: linear-gradient(180deg, #f4f0fa, #ece5f5);
    margin-bottom: 16px;
    border: 3px solid transparent;
    transition: box-shadow 0.15s, border-color 0.15s;
}

.foe-name {
    font-size: 30px;
    font-weight: 700;
    color: #5b2c6f;
    font-style: italic;
}

.foe-gloss { font-size: 14px; color: #7f8c8d; margin-top: 4px; }

.foe-intent {
    margin-top: 10px;
    display: inline-block;
    background: #fff;
    border-radius: 18px;
    padding: 6px 16px;
    font-size: 14px;
    font-weight: 600;
    color: #c0392b;
}

.foe-box.drop-active {
    border-color: #c0392b;
    box-shadow: 0 0 0 6px rgba(192, 57, 43, 0.15);
}

/* 手牌 */
.hand {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
    min-height: 200px;
}

.card {
    width: 150px;
    border-radius: 12px;
    border: 2px solid #dfe4ea;
    background: #fff;
    padding: 12px;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: relative;
}

.card:hover {
    transform: translateY(-6px);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.12);
}

.card.mastered { border-color: #27ae60; background: #f6fdf8; }
.card.unaffordable { opacity: 0.45; cursor: not-allowed; }
.card.unaffordable:hover { transform: none; box-shadow: none; }

.card.card-attack {
    cursor: grab;
    border-color: #e0a1a1;
    touch-action: none;
}
.card.card-attack.unaffordable { cursor: not-allowed; }
.card.card-attack.dragging { opacity: 0.35; }

.card.card-exhaust {
    background: linear-gradient(180deg, #fff, #fff7ec);
    box-shadow: 0 0 0 1px #f0c674 inset;
}

.card-exhaust-hint {
    font-size: 10.5px;
    color: #b7791f;
    font-weight: 600;
    text-align: center;
}

.card-target-hint {
    font-size: 11px;
    color: #c0392b;
    font-weight: 600;
    text-align: center;
}

/* —— 瞄准箭头 —— */
.aim-layer {
    position: fixed; left: 0; top: 0; z-index: 1050;
    pointer-events: none; display: none;
}
.aim-layer.active { display: block; }
.aim-path {
    fill: none; stroke: #9aa4b5; stroke-width: 5; stroke-linecap: round;
    stroke-dasharray: 10 9; opacity: .85;
    animation: aimFlow .5s linear infinite;
}
.aim-head { fill: #9aa4b5; opacity: .85; }
.aim-layer.valid .aim-path { stroke: #4ade80; stroke-dasharray: none; opacity: 1;
    filter: drop-shadow(0 0 6px rgba(74,222,128,.75)); }
.aim-layer.valid .aim-head { fill: #4ade80; opacity: 1;
    filter: drop-shadow(0 0 6px rgba(74,222,128,.75)); }
@keyframes aimFlow { to { stroke-dashoffset: -19; } }
/* 键盘瞄准中的那张牌 */
.card.aiming { outline: 3px solid #4ade80; outline-offset: 3px; transform: translateY(-8px); }

.card-ghost {
    position: fixed;
    z-index: 1000;
    pointer-events: none;
    cursor: grabbing;
    transform: scale(1.06) rotate(-2deg);
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.3);
}

.card-cost {
    position: absolute;
    top: -10px;
    left: -10px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #d68910;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
}

.card-word {
    font-size: 19px;
    font-weight: 700;
    font-style: italic;
    color: #2c3e50;
    word-break: break-word;
}

.card-part {
    font-size: 11px;
    color: #7f8c8d;
    font-style: italic;
}

.card-effect {
    font-size: 13px;
    color: #34495e;
    line-height: 1.4;
    flex-grow: 1;
}

.card-meaning {
    font-size: 12px;
    color: #27ae60;
    border-top: 1px dashed #dfe4ea;
    padding-top: 6px;
}

.pips { display: flex; gap: 3px; }

.pip {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #dfe4ea;
}

.pip.on { background: #27ae60; }

/* 按钮 */
.primary-btn, .secondary-btn {
    padding: 10px 22px;
    border-radius: 22px;
    font-size: 15px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
}

.primary-btn { background: #4a90e2; color: #fff; }
.primary-btn:hover { background: #357abd; }
.secondary-btn { background: #fff; border-color: #b2bec3; color: #57606f; }
.secondary-btn:hover { border-color: #4a90e2; color: #4a90e2; }

.btn-row {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 16px;
    flex-wrap: wrap;
}

/* 日志 */
.log {
    margin-top: 14px;
    max-height: 150px;
    overflow-y: auto;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 12px;
    font-size: 13px;
    line-height: 1.7;
}

.log-good { color: #27ae60; }
.log-bad { color: #c0392b; }
.log-info { color: #7f8c8d; }

/* 弹窗 */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(20, 20, 35, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 500;
    padding: 20px;
}

.modal {
    background: #fff;
    border-radius: 14px;
    padding: 26px;
    max-width: 520px;
    width: 100%;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
    max-height: 90vh;
    overflow-y: auto;
}

.modal h3 { margin: 0 0 6px; font-size: 20px; }

.modal-word {
    font-size: 30px;
    font-weight: 700;
    font-style: italic;
    color: #4a90e2;
    text-align: center;
    margin: 12px 0;
}

.modal-hint {
    text-align: center;
    color: #7f8c8d;
    font-size: 14px;
    margin-bottom: 16px;
}

.option-btn {
    display: block;
    width: 100%;
    text-align: left;
    padding: 13px 16px;
    margin-bottom: 10px;
    border: 2px solid #dfe4ea;
    border-radius: 10px;
    background: #fff;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.15s;
    color: #2c3e50;
}

.option-btn:hover { border-color: #4a90e2; background: #f4f9ff; }
.option-btn.right { border-color: #27ae60; background: #eafaf1; }
.option-btn.wrong { border-color: #e74c3c; background: #fdedec; }

#mutationInput {
    width: 100%;
    padding: 12px;
    border: 2px solid #4a90e2;
    border-radius: 22px;
    font-size: 16px;
    outline: none;
    font-style: italic;
}

.char-row {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin: 10px 0;
    justify-content: center;
}

.char-btn {
    padding: 4px 10px;
    border: 1px solid #dfe4ea;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    font-size: 15px;
    color: #2c3e50;
}

.char-btn:hover { border-color: #4a90e2; }

.reward-list { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }

.deck-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
}

.deck-chip {
    background: #f1f4f8;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 13px;
}

.deck-chip .w { font-style: italic; font-weight: 600; }
.deck-chip .m { color: #27ae60; font-size: 11px; margin-left: 4px; }
.deck-chip.clickable { cursor: pointer; transition: transform .15s, box-shadow .15s; position: relative; }
.deck-chip.clickable:hover { transform: translateY(-2px); box-shadow: 0 4px 10px rgba(0,0,0,.15); }

/* —— 卡牌详情：基础 → 弱强化 → 强强化 —— */
/* 详情弹窗需要容纳三张卡并排 */
.modal:has(.upgrade-chain) { max-width: 640px; }
.upgrade-chain {
    display: flex; align-items: flex-start; justify-content: center; gap: 6px;
    flex-wrap: nowrap; overflow-x: auto; padding: 4px 2px 8px;
}
.chain-col { display: flex; flex-direction: column; align-items: center; gap: 6px; flex: 0 0 auto; }
.chain-col .card { position: relative; }
.chain-col.is-current .card { outline: 3px solid #4a90e2; outline-offset: 3px; }
.chain-label { font-size: 12px; font-weight: 700; color: #7f8c8d; }
.chain-col.is-current .chain-label { color: #4a90e2; }
.chain-arrow { align-self: center; font-size: 20px; color: #b2bec3; padding: 0 2px; flex: 0 0 auto; }
.detail-notes { font-size: 12.5px; line-height: 1.7; color: #57606f; border-top: 1px dashed #dfe4ea; padding-top: 10px; }
.detail-notes p { margin: 4px 0; }
.kw-help { margin: 6px 0 0; padding-left: 18px; }
[data-theme="dark"] .chain-label { color: #999; }
[data-theme="dark"] .chain-col.is-current .chain-label { color: #6cb4e8; }
[data-theme="dark"] .chain-arrow { color: #55607a; }
[data-theme="dark"] .detail-notes { color: #aab4c4; border-top-color: #2f3b5c; }

.relic-row { display: flex; gap: 8px; flex-wrap: wrap; }

.relic {
    background: #fff7e6;
    border: 1px solid #f0c674;
    border-radius: 18px;
    padding: 5px 12px;
    font-size: 13px;
}

.relic .w { font-style: italic; font-weight: 600; }

.loading { text-align: center; padding: 40px; color: #7f8c8d; }

/* 深色模式 */
[data-theme="dark"] body { background: #1a1a2e; color: #e0e0e0; }
[data-theme="dark"] .panel { background: #16213e; box-shadow: 0 2px 6px rgba(0,0,0,0.25); }
[data-theme="dark"] .utility-btn { background: #1a1a2e; border-color: #3a6db5; color: #6cb4e8; }
[data-theme="dark"] .utility-btn:hover { background: #3a6db5; color: #fff; }
[data-theme="dark"] .page-sub, [data-theme="dark"] .room-desc, [data-theme="dark"] .foe-gloss, [data-theme="dark"] .card-part { color: #999; }
[data-theme="dark"] .stat { background: #1f2a48; }
[data-theme="dark"] .stat.hp { color: #ff7675; }
[data-theme="dark"] .stat.block { color: #74b9ff; }
[data-theme="dark"] .stat.energy { color: #f6c344; }
[data-theme="dark"] .stat.coin { color: #e5c76b; }
[data-theme="dark"] .stat.floor { color: #c39bd3; }
[data-theme="dark"] .bar-outer { background: #2a2a45; }
[data-theme="dark"] .room-card { background: #1a1a2e; border-color: #2f3b5c; }
[data-theme="dark"] .room-card:hover { border-color: #3a6db5; }
[data-theme="dark"] .foe-box { background: linear-gradient(180deg, #2a1f3d, #1f1830); }
[data-theme="dark"] .foe-name { color: #c39bd3; }
[data-theme="dark"] .foe-intent { background: #1a1a2e; color: #ff7675; }
[data-theme="dark"] .card { background: #1a1a2e; border-color: #2f3b5c; }
[data-theme="dark"] .card-word { color: #e8e8e8; }
[data-theme="dark"] .card-effect { color: #c8c8c8; }
[data-theme="dark"] .card.mastered { background: #16281f; border-color: #27ae60; }
[data-theme="dark"] .card.card-attack { border-color: #8a3a3a; }
[data-theme="dark"] .card.card-exhaust { background: linear-gradient(180deg, #1a1a2e, #2b2415); box-shadow: 0 0 0 1px #6b5628 inset; }
[data-theme="dark"] .card-exhaust-hint { color: #e6bf88; }
[data-theme="dark"] .card-target-hint { color: #ff7675; }
[data-theme="dark"] .foe-box.drop-active { box-shadow: 0 0 0 6px rgba(255, 118, 117, 0.2); border-color: #ff7675; }
[data-theme="dark"] .card-meaning { border-top-color: #2f3b5c; }
[data-theme="dark"] .pip { background: #2f3b5c; }
[data-theme="dark"] .log { background: #1a1a2e; }
[data-theme="dark"] .modal { background: #16213e; }
[data-theme="dark"] .option-btn { background: #1a1a2e; border-color: #2f3b5c; color: #e0e0e0; }
[data-theme="dark"] .option-btn:hover { background: #1f2a48; border-color: #3a6db5; }
[data-theme="dark"] .option-btn.right { background: #16281f; border-color: #27ae60; }
[data-theme="dark"] .option-btn.wrong { background: #2e1a1a; border-color: #e74c3c; }
[data-theme="dark"] #mutationInput { background: #1a1a2e; border-color: #3a6db5; color: #e0e0e0; }
[data-theme="dark"] .char-btn { background: #1a1a2e; border-color: #2f3b5c; color: #e0e0e0; }
[data-theme="dark"] .secondary-btn { background: #1a1a2e; border-color: #57606f; color: #b2bec3; }
[data-theme="dark"] .deck-chip { background: #1f2a48; }
[data-theme="dark"] .relic { background: #2b2415; border-color: #6b5628; }
[data-theme="dark"] .loading { color: #888; }

/* ============================================================
   新版：圣物顶栏 / 战斗舞台 / 角色 / 血条 / 能力 / 地图 / 商店
   ============================================================ */

/* —— 圣物常驻顶栏 —— */
.relic-strip {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    margin-bottom: 10px; padding: 8px 10px;
    background: #fff7e6; border: 1px solid #f0c674; border-radius: 12px;
}
.relic-label { font-size: 12px; font-weight: 700; color: #b7791f; }
.relic-chip {
    display: inline-flex; align-items: center; gap: 5px;
    background: #fff; border: 1px solid #f0c674; border-radius: 16px;
    padding: 3px 10px; font-size: 13px; cursor: help;
}
.relic-w { font-style: italic; font-weight: 600; }
/* 圣物稀有度描边 */
.relic-chip.rr-common   { border-color: #b9c0cc; }
.relic-chip.rr-uncommon { border-color: #3d7fd6; box-shadow: 0 0 0 1px rgba(61,127,214,.35); }
.relic-chip.rr-rare     { border-color: #d4a017; box-shadow: 0 0 8px -1px rgba(212,160,23,.65); }
[data-theme="dark"] .relic-chip.rr-common   { border-color: #4a5261; }
[data-theme="dark"] .relic-chip.rr-uncommon { border-color: #3a6db5; }
[data-theme="dark"] .relic-chip.rr-rare     { border-color: #b8860b; }

/* —— 战斗顶部：回合 / 能量 / 结束回合 —— */
.combat-top { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.turn-chip { background: #eef1f6; border-radius: 16px; padding: 6px 14px; font-weight: 700; font-size: 14px; color: #5b6b7a; }
.energy-orb {
    background: radial-gradient(circle at 40% 35%, #ffd873, #e8a01e);
    color: #4a2f00; border-radius: 16px; padding: 6px 14px; font-weight: 800; font-size: 15px; cursor: help;
    box-shadow: 0 2px 6px rgba(232,160,30,.4);
}
.end-turn { margin-left: auto; }

/* —— 战斗舞台：左人物 / 右怪物 —— */
/* 战斗区：玩家侧与敌方侧各占一半并各自居中，敌人数量变化时自动重新分配 */
.battle-stage {
    display: flex; align-items: flex-start; justify-content: center; gap: 8px;
    padding: 20px 10px 22px; border-radius: 16px; margin-bottom: 14px; position: relative; overflow: hidden;
    background: linear-gradient(180deg, #eef1f6 0%, #e4e9f1 65%, #d5dbe6 100%);
    box-shadow: inset 0 -14px 24px -18px rgba(0,0,0,.3);
}
.stage-vs { font-size: 24px; color: #aeb8c6; flex: 0 0 auto; align-self: flex-start; margin-top: 108px; }
.fighter { display: flex; flex-direction: column; align-items: center; gap: 5px; }
/* 两侧等分整个战斗区，各自在自己的半边居中 */
.fighter-player { flex: 1 1 0; min-width: 0; }
.enemy-group { flex: 1 1 0; min-width: 0; }
/* 图形区固定高度、底部对齐：立绘高矮可以不同，但下方的血条会落在同一水平线 */
.fighter-figure {
    position: relative; display: flex; justify-content: center; align-items: flex-end;
    height: 152px; width: 100%;
}
.fighter-sub { min-height: 26px; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.fighter-figure::after {
    content: ""; position: absolute; bottom: -6px; left: 50%; transform: translateX(-50%);
    width: 92px; height: 14px; background: radial-gradient(ellipse, rgba(0,0,0,.22), transparent 70%); z-index: 0;
}
.fighter-svg { width: 132px; height: auto; position: relative; z-index: 1; filter: drop-shadow(0 6px 5px rgba(0,0,0,.16)); }
.fighter-name { font-weight: 800; font-size: 16px; }
.fighter-name.enemy { font-style: italic; color: #5b2c6f; }
.fighter-gloss { font-size: 12px; color: #7f8c8d; }
.fighter-player .fighter-svg { transform: scaleX(1); }
/* 有朝向的敌人造型水平翻转，使其面朝左侧的玩家 */
.fighter-svg.face-left { transform: scaleX(-1); }

.rank-tag { position: absolute; top: 0; right: 0; font-size: 11px; font-weight: 800; border-radius: 8px; padding: 2px 7px; color: #fff; z-index: 2; }
.rank-tag.elite { background: #c0392b; }
.rank-tag.boss { background: #8e44ad; }

.fighter-enemy.drop-active { outline: 3px solid #c0392b; outline-offset: 6px; border-radius: 16px; }
.battle-stage.stage-drop-ok { outline: 3px solid #4a90e2; outline-offset: -6px; }
.card .stage-hint { color: #2980b9; }
.fighter-enemy.drop-active .fighter-figure { transform: scale(1.06); transition: transform .1s; }

/* —— 多敌人队列 —— */
.enemy-group { display: flex; align-items: flex-start; justify-content: space-evenly; gap: 10px; }
.enemy-group.multi { gap: 6px; }
.enemy-group .fighter-enemy { width: auto; flex: 0 1 auto; }
.fighter-enemy.compact .fighter-svg { width: 92px; }
.fighter-enemy.compact .fighter-figure { height: 152px; }
.fighter-enemy.compact .block-badge { left: calc(50% - 72px); }
.fighter-enemy.compact .hpbar { width: 116px; height: 19px; }
.fighter-enemy.compact .hpbar-text { font-size: 11px; }
.fighter-enemy.compact .fighter-name { font-size: 14px; }
.fighter-enemy.compact .fighter-gloss { font-size: 11px; }
.fighter-enemy.dead { opacity: .32; filter: grayscale(1); pointer-events: none; }
.fighter-enemy.dead .intent-bubble { visibility: hidden; }
.enemy-group.multi .fighter-figure::after { width: 66px; }

/* —— 血条（杀戮尖塔式：红条 + 居中数字） —— */
.hpbar {
    position: relative; width: 170px; max-width: 100%; height: 22px;
    background: #4a1414; border-radius: 5px; overflow: hidden; border: 1px solid rgba(0,0,0,.25);
}
.hpbar-fill { position: absolute; inset: 0; background: linear-gradient(180deg, #e0483d, #b5271d); transition: width .35s; }
.hpbar-text {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    font-size: 12.5px; font-weight: 800; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.6);
    font-variant-numeric: tabular-nums; letter-spacing: .3px;
}
.block-badge {
    position: absolute; left: calc(50% - 92px); bottom: 6px; z-index: 3;
    background: #cdd6e4; color: #1c2b4a; border: 2px solid #8ea2c4; border-radius: 8px;
    padding: 2px 7px; font-weight: 800; font-size: 13px; box-shadow: 0 2px 4px rgba(0,0,0,.25);
}

/* —— 状态图标（力量/易伤/虚弱） —— */
.status-icons { display: flex; gap: 5px; flex-wrap: wrap; justify-content: center; min-height: 22px; margin-top: 4px; }
.status-pill { font-size: 12px; font-weight: 700; border-radius: 12px; padding: 2px 8px; cursor: help; }
.s-str { background: #fde7d6; color: #b9770f; }
.s-dex { background: #ddf3e4; color: #1e8449; }
.s-vuln { background: #fbe0e0; color: #c0392b; }
.s-weak { background: #e7e0f5; color: #7d3c98; }
.s-frail { background: #efe2f7; color: #8e44ad; }
.s-poison { background: #e2f5e2; color: #248232; }

/* —— 成长标记（精英/首领会越打越强） —— */
.growth-tag {
    font-size: 10.5px; font-weight: 700; cursor: help;
    background: #fdecec; color: #c0392b; border: 1px solid #f0b4b4;
    border-radius: 10px; padding: 1px 7px;
}
[data-theme="dark"] .growth-tag { background: #3a1a1a; color: #ff8a8a; border-color: #6b2f2f; }

/* —— 敌方意图气泡（可能包含多个动作） —— */
.intent-bubble { height: 32px; margin-bottom: 4px; display: flex; gap: 4px; justify-content: center; align-items: center; flex-wrap: wrap; }
.intent {
    background: #fff; border-radius: 14px; padding: 4px 13px; font-weight: 800; font-size: 15px;
    box-shadow: 0 2px 6px rgba(0,0,0,.15); display: inline-block;
}
.intent.atk { color: #c0392b; }
.intent.def { color: #2980b9; }
.intent.buff { color: #8e44ad; }
.intent.heal { color: #27ae60; }
.intent.debuff, .intent.doom { color: #7d3c98; }
.intent.poison { color: #248232; }
.intent-unknown { color: #b2bec3; font-weight: 800; }

/* —— 人物身下能力卡区（可悬浮查看效果） —— */
.powers-row { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; min-height: 24px; margin-top: 4px; }
.power-chip {
    display: inline-flex; align-items: center; gap: 4px;
    background: #efe9fb; border: 1px solid #c9b6ec; border-radius: 14px; padding: 3px 9px; font-size: 12px; cursor: help;
}
.pw-w { font-style: italic; font-weight: 600; }

/* —— 跟随鼠标的悬浮提示 —— */
.hover-tip {
    position: fixed; z-index: 2000; max-width: 240px;
    background: #1c2333; color: #f0f0f0; font-size: 12.5px; line-height: 1.5;
    padding: 8px 11px; border-radius: 8px; box-shadow: 0 6px 18px rgba(0,0,0,.35); pointer-events: none;
}

/* —— 卡牌：类型条 / 强化环 / 复习选中 —— */
.card.k-attack { border-top: 3px solid #e07a5a; }
.card.k-skill  { border-top: 3px solid #4a90e2; }
.card.k-power  { border-top: 3px solid #9b59b6; }
.card.tier-1 { box-shadow: 0 0 0 2px rgba(39,174,96,.55) inset; }
.card.tier-2 { box-shadow: 0 0 0 2px rgba(201,162,39,.75) inset; }
.card.review-selected { outline: 3px solid #4a90e2; outline-offset: 2px; }
.tier-badge { position: absolute; top: -9px; right: -8px; font-size: 11px; font-weight: 800; border-radius: 10px; padding: 1px 6px; color: #fff; z-index: 2; }
.tier-badge.t1 { background: #27ae60; }
.tier-badge.t2 { background: #c9a227; }

/* —— 地图：杀戮尖塔式分岔路线图 —— */
.map-head { text-align: center; }
.map-title { margin: 0 0 4px; }
.map-sub { margin: 0 0 12px; font-size: 13px; color: #7f8c8d; }
.map-scroll {
    max-height: 460px; overflow-y: auto; overflow-x: auto;
    border-radius: 14px; padding: 10px;
    background: linear-gradient(180deg, #efe9db 0%, #e3dac6 60%, #d6cbb2 100%);
    box-shadow: inset 0 0 30px -10px rgba(90, 70, 40, .35);
    display: flex; justify-content: center;
}
.map-svg { display: block; }
.map-edge { stroke: #b9a888; stroke-width: 2.5; stroke-linecap: round; stroke-dasharray: 5 5; opacity: .55; }
.map-edge.walked { stroke: #8a6d3b; opacity: .95; stroke-dasharray: none; stroke-width: 3; }
.map-edge.open { stroke: var(--nc, #4a90e2); opacity: 1; stroke-dasharray: none; stroke-width: 3.5; animation: edgeFlow 1.6s linear infinite; }
@keyframes edgeFlow { from { stroke-dashoffset: 20; } to { stroke-dashoffset: 0; } }

.map-node circle { fill: #fdfbf6; stroke: #b9a888; stroke-width: 2.5; transition: transform .18s, filter .18s; }
.map-node text { font-size: 15px; pointer-events: none; }
.map-node.visited circle { fill: #e6dcc4; stroke: #8a6d3b; }
.map-node.current circle { fill: #fff3cf; stroke: #c9a227; stroke-width: 4; }
.map-node.avail { cursor: pointer; }
.map-node.avail circle { stroke: var(--nc, #4a90e2); stroke-width: 4; filter: drop-shadow(0 0 6px var(--nc, rgba(74,144,226,.75))); animation: nodePulse 1.5s ease-in-out infinite; }
.map-node.avail:hover circle { fill: #fffdf4; }
.map-node:not(.avail):not(.visited):not(.current) circle { opacity: .8; }
@keyframes nodePulse { 0%,100% { r: 15; } 50% { r: 17; } }
.map-node.r-combat circle { stroke: #b0764a; }
.map-node.r-event circle  { stroke: #9b59b6; }
.map-node.r-elite circle  { stroke: #c0392b; }
.map-node.r-boss circle   { stroke: #8e44ad; stroke-width: 4; fill: #f3e8f8; }
.map-node.r-rest circle   { stroke: #e67e22; }
.map-node.r-shop circle   { stroke: #16a085; }
.map-node.r-treasure circle { stroke: #c9a227; }

.map-legend { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; margin-top: 12px; font-size: 12.5px; color: #7f8c8d; }
.legend-item { display: inline-flex; align-items: center; gap: 5px; }
.legend-ic {
    width: 24px; height: 24px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
    background: #fdfbf6; border: 2px solid #b9a888; font-size: 12px;
}
.legend-ic.r-combat { border-color: #b0764a; }
.legend-ic.r-event { border-color: #9b59b6; }
.legend-ic.r-elite { border-color: #c0392b; }
.legend-ic.r-boss { border-color: #8e44ad; }
.legend-ic.r-rest { border-color: #e67e22; }
.legend-ic.r-shop { border-color: #16a085; }
.legend-ic.r-treasure { border-color: #c9a227; }

/* —— 卡牌稀有度 —— */
.rar-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 2px; vertical-align: middle; }
.rar-dot.rar-common { background: #b9c0cc; }
.rar-dot.rar-uncommon { background: #3d7fd6; }
.rar-dot.rar-rare { background: #d4a017; }
.card.rar-common { border-color: #b9c0cc; }
.card.rar-uncommon { border-color: #3d7fd6; }
.card.rar-rare { border-color: #d4a017; box-shadow: 0 0 10px -2px rgba(212,160,23,.5); }
.card-rarity { position: absolute; top: 6px; right: 8px; font-size: 11px; line-height: 1; }

/* —— 快捷键 —— */
.card-hotkey {
    position: absolute; bottom: -8px; left: -8px; width: 22px; height: 22px; border-radius: 6px;
    background: #57606f; color: #fff; font-size: 12px; font-weight: 800;
    display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 5px rgba(0,0,0,.25);
}
.hotkey-hint {
    font-size: 12px; color: #7f8c8d; cursor: help;
    border: 1px dashed #b2bec3; border-radius: 14px; padding: 4px 10px;
}
.end-turn kbd {
    background: rgba(255,255,255,.25); border-radius: 4px; padding: 0 5px;
    font-size: 12px; font-family: inherit; margin-left: 4px;
}
/* 键盘选中的目标 */
.fighter-enemy.kb-target { outline: 2px solid #4a90e2; outline-offset: 5px; border-radius: 14px; }
[data-theme="dark"] .card-hotkey { background: #3a4763; }
[data-theme="dark"] .hotkey-hint { color: #999; border-color: #4a5262; }
[data-theme="dark"] .fighter-enemy.kb-target { outline-color: #6cb4e8; }
.card.rar-common .card-rarity { color: #a8b0be; }
.card.rar-uncommon .card-rarity { color: #3d7fd6; }
.card.rar-rare .card-rarity { color: #d4a017; }
.deck-chip.rar-uncommon { box-shadow: inset 3px 0 0 #3d7fd6; }
.deck-chip.rar-rare { box-shadow: inset 3px 0 0 #d4a017; }

/* —— 待机动画：轻微的呼吸起伏，各敌人错开相位避免整齐划一 —— */
@keyframes idleBreath {
    0%, 100% { transform: translateY(0) scale(1); }
    50%      { transform: translateY(-4px) scale(1.015); }
}
@keyframes idleBreathFlip {
    0%, 100% { transform: translateY(0) scaleX(-1) scaleY(1); }
    50%      { transform: translateY(-4px) scaleX(-1.015) scaleY(1.015); }
}
.fighter-svg { animation: idleBreath 3.2s ease-in-out infinite; will-change: transform; }
.fighter-svg.face-left { animation: idleBreathFlip 3.2s ease-in-out infinite; }
.fighter-player .fighter-svg { animation-duration: 3.8s; }
/* 敌人按序错开相位与节奏 */
.enemy-group .fighter-enemy:nth-child(1) .fighter-svg { animation-delay: -.4s; animation-duration: 3.0s; }
.enemy-group .fighter-enemy:nth-child(2) .fighter-svg { animation-delay: -1.5s; animation-duration: 3.5s; }
.enemy-group .fighter-enemy:nth-child(3) .fighter-svg { animation-delay: -2.4s; animation-duration: 2.7s; }
/* 受击/突进时暂停待机，避免与动作动画打架 */
.shake .fighter-svg, .lunge-left .fighter-svg, .lunge-right .fighter-svg { animation-play-state: paused; }
.fighter-enemy.dead .fighter-svg { animation: none; }

/* —— 动画 —— */
@keyframes shakeX { 0%,100% { transform: translateX(0); } 20% { transform: translateX(-7px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(3px); } }
.shake { animation: shakeX .38s ease-in-out; }
@keyframes lungeL { 0%,100% { transform: translateX(0); } 45% { transform: translateX(-16px); } }
@keyframes lungeR { 0%,100% { transform: translateX(0); } 45% { transform: translateX(16px); } }
.lunge-left { animation: lungeL .34s ease-out; }
.lunge-right { animation: lungeR .34s ease-out; }

.float-num {
    position: absolute; left: 50%; top: 26%; transform: translateX(-50%);
    font-weight: 900; font-size: 21px; pointer-events: none; z-index: 6; white-space: nowrap;
    text-shadow: 0 2px 4px rgba(0,0,0,.45); animation: floatUp .9s ease-out forwards;
}
@keyframes floatUp {
    0% { opacity: 0; transform: translate(-50%, 8px) scale(.7); }
    18% { opacity: 1; transform: translate(-50%, -4px) scale(1.15); }
    100% { opacity: 0; transform: translate(-50%, -46px) scale(1); }
}
.fx-damage { color: #ff4d4d; }
.fx-block { color: #7fb3ff; }
.fx-heal { color: #4ade80; }
.fx-buff { color: #ffd23f; font-size: 16px; }
.fx-debuff { color: #d982ff; font-size: 16px; }
.fx-poison { color: #7ee08a; }

@keyframes dealIn { from { opacity: 0; transform: translateY(26px) rotate(-4deg); } to { opacity: 1; transform: none; } }
.hand.dealing .card { animation: dealIn .3s ease-out backwards; animation-delay: calc(var(--i, 0) * 60ms); }

/* —— 关键词：固有 / 保留 / 虚无 —— */
.card-keywords { display: flex; gap: 4px; flex-wrap: wrap; }
.kw-badge {
    font-size: 10px; font-weight: 800; letter-spacing: .5px;
    border-radius: 5px; padding: 1px 5px; cursor: help; border: 1px solid;
}
.kw-innate   { color: #1e8449; border-color: #7fcf9f; background: #e7f8ee; }
.kw-retain   { color: #1f6fb2; border-color: #8dc0e8; background: #e8f3fb; }
.kw-ethereal { color: #8e44ad; border-color: #cba7e0; background: #f4ebfa; }
[data-theme="dark"] .kw-innate   { color: #6fcf97; border-color: #2c6b47; background: #142a1e; }
[data-theme="dark"] .kw-retain   { color: #74b9ff; border-color: #2a4d78; background: #12203a; }
[data-theme="dark"] .kw-ethereal { color: #c9a6e6; border-color: #55397a; background: #241a33; }

/* —— 阵亡：粒子消散 —— */
.death-burst { position: fixed; z-index: 1100; width: 0; height: 0; pointer-events: none; }
.death-burst i {
    position: absolute; left: 0; top: 0; border-radius: 50%; opacity: 0;
    box-shadow: 0 0 7px currentColor, 0 0 14px currentColor;
    animation: deathParticle .95s cubic-bezier(.2, .7, .3, 1) forwards;
}
@keyframes deathParticle {
    0%   { opacity: 0; transform: translate(0, 0) scale(1.5); }
    14%  { opacity: 1; }
    100% { opacity: 0; transform: translate(var(--dx, 0), var(--dy, -40px)) scale(.25); }
}
/* 角色本体升腾、模糊、淡出 */
.fighter-svg.dying { animation: fighterDissolve .9s ease-out forwards !important; }
@keyframes fighterDissolve {
    0%   { opacity: 1; filter: blur(0) brightness(1); transform: translateY(0) scale(1); }
    30%  { opacity: .9; filter: blur(1.5px) brightness(1.9) saturate(1.4); transform: translateY(-4px) scale(1.04); }
    100% { opacity: 0; filter: blur(8px) brightness(2.4); transform: translateY(-30px) scale(1.18); }
}
/* 消散过程中先不套用「已阵亡」的灰化，否则看不清粒子 */
.fighter-enemy.dead.just-died { opacity: 1; filter: none; }

/* —— 消耗牌的溶解消散特效 —— */
.card-dissolve {
    position: fixed; z-index: 1200; pointer-events: none; margin: 0;
    animation: dissolveAway .68s ease-out forwards;
}
@keyframes dissolveAway {
    0%   { opacity: 1; transform: scale(1) translateY(0); filter: blur(0) brightness(1); }
    28%  { opacity: .95; transform: scale(1.09) translateY(-10px); filter: blur(0) brightness(1.9) saturate(1.5); }
    100% { opacity: 0; transform: scale(1.28) translateY(-58px) rotate(4deg); filter: blur(7px) brightness(2.4); }
}
.dissolve-spark {
    position: absolute; inset: -6px; border-radius: 14px; pointer-events: none;
    background:
        radial-gradient(circle at 24% 78%, rgba(255,196,84,.95) 0 2.5px, transparent 3px),
        radial-gradient(circle at 68% 86%, rgba(255,150,60,.9) 0 2px, transparent 2.5px),
        radial-gradient(circle at 44% 62%, rgba(255,226,140,.9) 0 2px, transparent 2.5px),
        radial-gradient(circle at 82% 54%, rgba(255,170,70,.85) 0 1.8px, transparent 2.3px),
        radial-gradient(circle at 14% 46%, rgba(255,210,110,.85) 0 1.8px, transparent 2.3px),
        radial-gradient(circle at 58% 32%, rgba(255,180,80,.8) 0 2px, transparent 2.5px);
    animation: sparkRise .68s ease-out forwards;
}
@keyframes sparkRise {
    0%   { opacity: 0; transform: translateY(6px) scale(.9); }
    25%  { opacity: 1; }
    100% { opacity: 0; transform: translateY(-42px) scale(1.35); }
}

@media (prefers-reduced-motion: reduce) {
    .shake, .lunge-left, .lunge-right, .float-num, .hand.dealing .card,
    .map-node.avail circle, .map-edge.open,
    .card-dissolve, .dissolve-spark, .fighter-svg,
    .death-burst i, .fighter-svg.dying,
    .card-toast, .turn-banner, .upgrade-fx .ufx-ring, .upgrade-fx i, .upgrade-fx .ufx-word, .upgrade-fx .ufx-label,
    .card.final-star, .card.final-star::after { animation: none !important; }
    .card-dissolve, .death-burst, .card-toast, .turn-banner, .upgrade-fx { display: none !important; }
    .fighter-svg.dying { opacity: 0; }
    .fighter-svg.face-left { transform: scaleX(-1); }
}

.choice-medallions { display: flex; align-items: stretch; justify-content: center; gap: 18px; flex-wrap: wrap; }
.medallion {
    flex: 1; min-width: 210px; max-width: 320px; border: 2px solid #dfe4ea; border-radius: 16px;
    background: #fbfcfd; padding: 22px 18px; cursor: pointer; font: inherit; color: inherit;
    display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center;
    transition: transform .18s, box-shadow .18s, border-color .18s;
}
.medallion:hover { transform: translateY(-4px); box-shadow: 0 10px 24px rgba(0,0,0,.12); border-color: #4a90e2; }
.medallion-icon { font-size: 44px; line-height: 1; }
.medallion-name { font-size: 19px; font-weight: 700; }
.medallion-desc { font-size: 13px; color: #7f8c8d; line-height: 1.5; }
.medallion-or { align-self: center; color: #b2bec3; font-weight: 700; }
.medallion.r-combat:hover { border-color: #e07a5a; }
.medallion.r-elite:hover  { border-color: #c0392b; }
.medallion.r-rest:hover   { border-color: #e67e22; }
.medallion.r-shop:hover   { border-color: #16a085; }
.medallion.r-event:hover  { border-color: #8e44ad; }
.medallion.r-treasure:hover { border-color: #c9a227; }
.medallion.r-boss:hover   { border-color: #8e44ad; }

/* —— 奇遇事件 —— */
.event-card {
    max-width: 620px; margin: 0 auto; padding: 22px 24px; border-radius: 14px;
    background: #fbfcfd; border: 2px solid #dfe4ea;
}
.event-title { margin: 0 0 8px; font-size: 19px; }
.event-text { margin: 0 0 18px; color: #57606f; line-height: 1.75; font-size: 14.5px; }
.event-options { display: flex; flex-direction: column; gap: 10px; }
.event-option {
    display: flex; flex-direction: column; align-items: flex-start; gap: 3px;
    width: 100%; text-align: left; padding: 12px 16px; border-radius: 10px;
    border: 2px solid #dfe4ea; background: #fff; cursor: pointer; font: inherit; color: inherit;
    transition: border-color .15s, background .15s, transform .15s;
}
.event-option:hover:not(.disabled) { border-color: #4a90e2; background: #f4f9ff; transform: translateX(3px); }
.event-option.disabled { opacity: .45; cursor: not-allowed; }
.ev-label { font-weight: 700; font-size: 15px; }
.ev-hint { font-size: 12.5px; color: #7f8c8d; }
[data-theme="dark"] .event-card { background: #1a1a2e; border-color: #2f3b5c; }
[data-theme="dark"] .event-text { color: #aab4c4; }
[data-theme="dark"] .event-option { background: #14192b; border-color: #2f3b5c; }
[data-theme="dark"] .event-option:hover:not(.disabled) { background: #1f2a48; border-color: #3a6db5; }
[data-theme="dark"] .ev-hint { color: #8b93a3; }

/* —— 商店 —— */
.shop-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.shop-item { border: 2px solid #dfe4ea; border-radius: 14px; padding: 18px; text-align: center; background: #fbfcfd; }
.shop-ic { font-size: 36px; }
.shop-name { font-weight: 700; margin: 6px 0 4px; }
.shop-desc { font-size: 13px; color: #7f8c8d; line-height: 1.5; }
.shop-price { font-weight: 700; margin: 8px 0 4px; color: #7d6608; }

/* —— 深色模式（新增部分） —— */
[data-theme="dark"] .relic-strip { background: #2b2415; border-color: #6b5628; }
[data-theme="dark"] .relic-label { color: #e6bf88; }
[data-theme="dark"] .relic-chip { background: #1a1a2e; border-color: #6b5628; color: #e0e0e0; }
[data-theme="dark"] .turn-chip { background: #1f2a48; color: #aab6c8; }
[data-theme="dark"] .battle-stage { background: linear-gradient(180deg, #2a3555 0%, #222a45 65%, #1b2136 100%); }
/* 深色下给角色描一层微光，保证与背景分离 */
[data-theme="dark"] .fighter-svg { filter: drop-shadow(0 0 3px rgba(255,255,255,.28)) drop-shadow(0 6px 5px rgba(0,0,0,.45)); }
[data-theme="dark"] .stage-vs { color: #4a5772; }
[data-theme="dark"] .fighter-name { color: #e8e8e8; }
[data-theme="dark"] .fighter-name.enemy { color: #c39bd3; }
[data-theme="dark"] .fighter-gloss { color: #999; }
[data-theme="dark"] .intent { background: #16213e; }
[data-theme="dark"] .hpbar { background: #2a0f0f; }
[data-theme="dark"] .block-badge { background: #2a3856; color: #cdd6e4; border-color: #4a5f88; }
[data-theme="dark"] .power-chip { background: #241d3a; border-color: #4a3a6e; color: #d8cff0; }
[data-theme="dark"] .status-pill.s-str { background: #3a2c16; color: #f0c078; }
[data-theme="dark"] .status-pill.s-vuln { background: #3a1a1a; color: #ff8a8a; }
[data-theme="dark"] .status-pill.s-weak { background: #2a1f3d; color: #c9a6e6; }
[data-theme="dark"] .card.k-attack { border-top-color: #b5563a; }
[data-theme="dark"] .card.k-skill { border-top-color: #3a6db5; }
[data-theme="dark"] .card.k-power { border-top-color: #7d3c98; }
[data-theme="dark"] .map-scroll { background: linear-gradient(180deg, #241f16 0%, #1d1810 60%, #15110b 100%); box-shadow: inset 0 0 30px -10px rgba(0,0,0,.6); }
[data-theme="dark"] .map-sub { color: #999; }
[data-theme="dark"] .map-edge { stroke: #5a4c33; }
[data-theme="dark"] .map-edge.walked { stroke: #c9a227; }
[data-theme="dark"] .map-edge.open { stroke: var(--nc, #5a9fe6); }
[data-theme="dark"] .map-node circle { fill: #221d15; stroke: #7d6a48; }
/* 深色下重申各类型描边，否则会被上面这条同优先级的规则覆盖成一片暗褐 */
[data-theme="dark"] .map-node.r-elite circle    { stroke: #ff6b6b; }
[data-theme="dark"] .map-node.r-rest circle     { stroke: #ffa94d; }
[data-theme="dark"] .map-node.r-shop circle     { stroke: #35d0b5; }
[data-theme="dark"] .map-node.r-treasure circle { stroke: #ffd43b; }
[data-theme="dark"] .map-node.r-boss circle     { stroke: #d59bff; fill: #2a1f3d; }
[data-theme="dark"] .map-node.r-event circle    { stroke: #b98ce0; }
[data-theme="dark"] .map-node.visited circle { fill: #33291a; stroke: #c9a227; }
[data-theme="dark"] .map-node.current circle { fill: #3a2f16; stroke: #ffd23f; }
[data-theme="dark"] .map-node.avail circle { stroke: var(--nc, #5a9fe6); filter: drop-shadow(0 0 7px var(--nc, rgba(90,159,230,.8))); }
[data-theme="dark"] .map-node.avail:hover circle { fill: #2b2a1f; }
[data-theme="dark"] .legend-ic { background: #221d15; border-color: #7d6a48; }
[data-theme="dark"] .legend-ic.r-elite { border-color: #ff6b6b; }
[data-theme="dark"] .legend-ic.r-rest { border-color: #ffa94d; }
[data-theme="dark"] .legend-ic.r-shop { border-color: #35d0b5; }
[data-theme="dark"] .legend-ic.r-treasure { border-color: #ffd43b; }
[data-theme="dark"] .legend-ic.r-boss { border-color: #d59bff; }
[data-theme="dark"] .map-legend { color: #999; }
[data-theme="dark"] .card.rar-common { border-color: #4a5261; }
[data-theme="dark"] .card.rar-uncommon { border-color: #3a6db5; }
[data-theme="dark"] .card.rar-rare { border-color: #b8860b; box-shadow: 0 0 10px -2px rgba(212,160,23,.45); }
[data-theme="dark"] .status-pill.s-dex { background: #16281f; color: #6fcf97; }
[data-theme="dark"] .status-pill.s-frail { background: #2a1f3d; color: #c9a6e6; }
[data-theme="dark"] .status-pill.s-poison { background: #16281c; color: #7ee08a; }
[data-theme="dark"] .medallion { background: #1a1a2e; border-color: #2f3b5c; }
[data-theme="dark"] .medallion:hover { border-color: #3a6db5; }
[data-theme="dark"] .medallion-desc { color: #999; }
[data-theme="dark"] .medallion-or { color: #55607a; }
[data-theme="dark"] .shop-item { background: #1a1a2e; border-color: #2f3b5c; }
[data-theme="dark"] .shop-desc { color: #999; }
[data-theme="dark"] .shop-price { color: #e5c76b; }
[data-theme="dark"] .hover-tip { background: #0d1220; border: 1px solid #2f3b5c; }

@media (max-width: 640px) {
    body { padding: 12px; }
    .panel { padding: 16px; }
    .card { width: 132px; }
    .fighter-player { min-width: 96px; }
    .enemy-group { gap: 4px; }
    .enemy-group.multi .fighter-svg { width: 62px; }
    .enemy-group.multi .hpbar { width: 76px; height: 16px; }
    .enemy-group.multi .hpbar-text { font-size: 9.5px; }
    .enemy-group.multi .fighter-name { font-size: 11.5px; }
    .enemy-group.multi .fighter-gloss { display: none; }
    .fighter-svg { width: 96px; }
    .fighter-name { font-size: 14px; }
    .hpbar { width: 128px; height: 20px; }
    .stage-vs { font-size: 18px; padding-bottom: 30px; }
    .battle-stage { padding: 14px 6px 18px; }
    .medallion { min-width: 150px; padding: 18px 12px; }
    .medallion-icon { font-size: 36px; }
}

/* —— 出牌提示：中央短暂显示后渐隐 —— */
.card-toast {
    position: fixed; left: 50%; top: 38%; transform: translate(-50%, -50%);
    z-index: 2400; pointer-events: none; text-align: center;
    animation: toastFade 1s ease-out forwards;
}
.card-toast .ct-word {
    display: block; font-size: 26px; font-weight: 800; font-style: italic;
    color: #fff; text-shadow: 0 2px 10px rgba(0,0,0,.55), 0 0 24px rgba(74,144,226,.5);
}
.card-toast.k-attack .ct-word { text-shadow: 0 2px 10px rgba(0,0,0,.55), 0 0 24px rgba(224,90,74,.65); }
.card-toast.k-power .ct-word { text-shadow: 0 2px 10px rgba(0,0,0,.55), 0 0 24px rgba(155,89,182,.65); }
.card-toast .ct-name { display: block; font-size: 13px; color: rgba(255,255,255,.85); text-shadow: 0 1px 4px rgba(0,0,0,.6); }
@keyframes toastFade {
    0%   { opacity: 0; transform: translate(-50%, -30%) scale(.8); }
    18%  { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    70%  { opacity: 1; }
    100% { opacity: 0; transform: translate(-50%, -75%) scale(1.02); }
}

/* —— 升级动画：金环爆发 + 粒子 —— */
.upgrade-fx { position: fixed; left: 50%; top: 42%; z-index: 2500; pointer-events: none; width: 0; height: 0; }
.upgrade-fx .ufx-ring {
    position: absolute; left: -70px; top: -70px; width: 140px; height: 140px; border-radius: 50%;
    border: 4px solid #ffd23f; box-shadow: 0 0 30px rgba(255,210,63,.8), inset 0 0 20px rgba(255,210,63,.5);
    animation: ufxRing 1.1s ease-out forwards;
}
@keyframes ufxRing {
    0%   { opacity: 0; transform: scale(.25); }
    25%  { opacity: 1; }
    100% { opacity: 0; transform: scale(1.6); }
}
.upgrade-fx i {
    position: absolute; left: 0; top: 0; width: 6px; height: 6px; border-radius: 50%;
    background: #ffd23f; box-shadow: 0 0 8px #ffd23f; opacity: 0;
    animation: ufxSpark 1s ease-out forwards;
}
@keyframes ufxSpark {
    0%   { opacity: 0; transform: translate(0,0) scale(1.3); }
    20%  { opacity: 1; }
    100% { opacity: 0; transform: translate(var(--dx,0), var(--dy,-50px)) scale(.3); }
}
.upgrade-fx .ufx-word {
    position: absolute; left: 50%; top: -14px; transform: translateX(-50%);
    font-size: 24px; font-weight: 800; font-style: italic; white-space: nowrap;
    color: #fff; text-shadow: 0 2px 8px rgba(0,0,0,.6), 0 0 22px rgba(255,210,63,.8);
    animation: toastFade 1.4s ease-out forwards;
}
.upgrade-fx .ufx-label {
    position: absolute; left: 50%; top: 22px; transform: translateX(-50%);
    font-size: 15px; font-weight: 800; white-space: nowrap; border-radius: 14px; padding: 3px 14px;
    animation: toastFade 1.4s ease-out forwards;
}
.upgrade-fx .ufx-label.t1 { background: #27ae60; color: #fff; box-shadow: 0 0 16px rgba(39,174,96,.7); }
.upgrade-fx .ufx-label.t2 { background: #c9a227; color: #fff; box-shadow: 0 0 16px rgba(201,162,39,.8); }

/* —— 卡面动态数值 —— */
.card-effect .num-up { color: #1e8449; font-weight: 800; }
.card-effect .num-down { color: #c0392b; font-weight: 800; }
[data-theme="dark"] .card-effect .num-up { color: #6fcf97; }
[data-theme="dark"] .card-effect .num-down { color: #ff8a8a; }

/* —— 三星卡：彩虹流动边框 + 闪烁粒子 —— */
.card.final-star {
    border-color: transparent !important;
    background:
        linear-gradient(var(--card-bg, #fff), var(--card-bg, #fff)) padding-box,
        linear-gradient(115deg, #ff5f5f, #ffb347, #ffe45c, #5cd97e, #58b6ff, #b06bff, #ff5f5f) border-box;
    background-size: 100% 100%, 340% 340%;
    animation: rainbowFlow 4.5s linear infinite;
}
[data-theme="dark"] .card.final-star { --card-bg: #1a1a2e; }
@keyframes rainbowFlow {
    0%   { background-position: 0 0, 0% 50%; }
    100% { background-position: 0 0, 340% 50%; }
}
.card.final-star::after {
    content: ""; position: absolute; inset: -3px; border-radius: inherit; pointer-events: none;
    background:
        radial-gradient(circle at 12% 22%, rgba(255,255,255,.95) 0 1.6px, transparent 2.4px),
        radial-gradient(circle at 84% 12%, rgba(255,255,255,.9) 0 1.3px, transparent 2px),
        radial-gradient(circle at 68% 88%, rgba(255,255,255,.9) 0 1.5px, transparent 2.2px),
        radial-gradient(circle at 24% 78%, rgba(255,255,255,.85) 0 1.2px, transparent 1.9px);
    animation: starTwinkle 2.2s ease-in-out infinite;
}
@keyframes starTwinkle {
    0%, 100% { opacity: .15; }
    45%      { opacity: 1; }
    60%      { opacity: .4; }
    75%      { opacity: .9; }
}

/* —— 生词手册星级 —— */
.deck-chip .m.star-1 { color: #27ae60; }
.deck-chip .m.star-2 { color: #c9a227; }
.deck-chip .m.star-3 {
    background: linear-gradient(90deg, #ff5f5f, #ffb347, #5cd97e, #58b6ff, #b06bff);
    -webkit-background-clip: text; background-clip: text; color: transparent; font-weight: 800;
}

/* —— 首领台词 —— */
.boss-quote {
    margin: 10px 0 14px; padding: 10px 16px; border-left: 4px solid #8e44ad;
    background: #f7f2fb; border-radius: 0 10px 10px 0;
}
.boss-quote .bq-sd { display: block; font-style: italic; font-weight: 700; font-size: 15px; color: #6d3a86; margin-bottom: 3px; }
.boss-quote .bq-zh { display: block; font-size: 13.5px; color: #57606f; }
[data-theme="dark"] .boss-quote { background: #241a33; border-left-color: #a874d8; }
[data-theme="dark"] .boss-quote .bq-sd { color: #c9a6e6; }
[data-theme="dark"] .boss-quote .bq-zh { color: #aab4c4; }

/* —— 回合横幅 —— */
.turn-banner {
    position: fixed; left: 50%; top: 30%; transform: translate(-50%, -50%);
    z-index: 2300; pointer-events: none;
    font-size: 34px; font-weight: 900; letter-spacing: 6px; color: #fff;
    text-shadow: 0 2px 12px rgba(0,0,0,.6), 0 0 30px rgba(255,210,63,.45);
    animation: toastFade 1.3s ease-out forwards;
}

/* —— 退出按钮 —— */
.utility-btn.danger { border-color: #c0392b; color: #c0392b; }
.utility-btn.danger:hover { background: #c0392b; color: #fff; }
[data-theme="dark"] .utility-btn.danger { border-color: #8a3a3a; color: #ff8a8a; background: #1a1a2e; }
[data-theme="dark"] .utility-btn.danger:hover { background: #8a3a3a; color: #fff; }

/* —— 敌人特色机制标签 —— */
.mech-row { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; }
.mech-chip {
    font-size: 10.5px; font-weight: 700; cursor: help;
    background: #eef1f6; color: #5b6b7a; border: 1px solid #ccd5e0;
    border-radius: 10px; padding: 1px 7px;
}
.mech-chip.m-doom { background: #f3e8f8; color: #6d3a86; border-color: #cba7e0; }
.mech-chip.hot { background: #fdecec; color: #c0392b; border-color: #f0b4b4; animation: mechPulse 1.2s ease-in-out infinite; }
@keyframes mechPulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.08); } }
[data-theme="dark"] .mech-chip { background: #1f2a48; color: #aab6c8; border-color: #2f3b5c; }
[data-theme="dark"] .mech-chip.m-doom { background: #2a1f3d; color: #c9a6e6; border-color: #55397a; }
[data-theme="dark"] .mech-chip.hot { background: #3a1a1a; color: #ff8a8a; border-color: #6b2f2f; }

/* —— 被易伤增幅的敌方攻击数字 —— */
.intent.atk.amped { color: #ff2d2d; font-size: 17px; text-shadow: 0 0 8px rgba(255,45,45,.45); }
[data-theme="dark"] .intent.atk.amped { color: #ff6b6b; }
