/* 烟雨江湖 · 洗髓模拟器 */

:root {
    --bg-primary: #0c0d10;
    --bg-secondary: #15171c;
    --bg-card: #1a1d24;
    --bg-card-hover: #22262f;
    --border-color: #2c313c;
    --border-accent: #6b7280;
    --text-primary: #e8e4dc;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --accent: #a8a29e;
    --white: #e5e7eb;
    --white-dim: #9ca3af;
    --green: #5fad6a;
    --green-bright: #86d492;
    --blue: #5b8fd4;
    --blue-bright: #7eb0f0;
    --purple: #9b6bc9;
    --purple-bright: #c084fc;
    --red: #e0746a;

    --font-serif: 'Noto Serif SC', 'STSong', 'SimSun', serif;
    --font-sans: 'Noto Sans SC', 'Microsoft YaHei', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    background-image:
        radial-gradient(ellipse at 30% 0%, rgba(155, 107, 201, 0.06) 0%, transparent 45%),
        radial-gradient(ellipse at 80% 100%, rgba(95, 173, 106, 0.04) 0%, transparent 40%);
}

.app-container {
    max-width: 760px;
    margin: 0 auto;
    padding: 0 1rem 2rem;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Header */
.app-header {
    text-align: center;
    padding: 2.25rem 1rem 1.25rem;
}

.sim-nav {
    margin-top: 0.75rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.sim-nav a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.15s;
}

.sim-nav a:hover,
.sim-nav a.active {
    color: var(--purple-bright);
}

.nav-sep {
    margin: 0 0.4rem;
    color: var(--border-color);
}

.app-header h1 {
    font-family: var(--font-serif);
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.2em;
    margin-bottom: 0.35rem;
}

.app-header .subtitle {
    font-family: var(--font-serif);
    color: var(--text-secondary);
    font-size: 0.85rem;
    letter-spacing: 0.35em;
}

.app-header .app-version {
    margin-left: 0.35em;
    font-family: var(--font-sans);
    font-size: 0.78em;
    color: var(--text-muted);
    letter-spacing: 0.04em;
    vertical-align: middle;
}

/* Config */
.config-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1.15rem 1.25rem;
    margin-bottom: 1.25rem;
}

.config-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 0.9rem;
}

.config-row:last-child {
    margin-bottom: 0;
}

.config-group {
    flex: 1;
    min-width: 120px;
}

.config-group.grow {
    flex: 2;
}

.config-group.import-group {
    flex: 0 0 auto;
    min-width: 110px;
}

.config-group label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
}

.config-group select,
.config-group input {
    width: 100%;
    padding: 0.5rem 0.65rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.88rem;
    outline: none;
}

.config-group select:focus,
.config-group input:focus {
    border-color: var(--border-accent);
}

.save-key-row {
    padding-top: 0.75rem;
    border-top: 1px dashed var(--border-color);
}

.save-key-hint {
    margin-top: 0.35rem;
    color: var(--text-secondary);
    font-size: 0.72rem;
    line-height: 1.45;
}

.role-row[hidden] {
    display: none !important;
}

.role-row {
    padding: 0.75rem 0 0;
    margin-top: 0.25rem;
    border-top: 1px solid var(--border-color);
    align-items: flex-end;
}

.bag-group {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    text-align: right;
    min-width: 100px;
}

.bag-label {
    font-size: 0.72rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.bag-value {
    font-family: var(--font-serif);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--purple-bright);
}

.btn-import {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0.5rem 0.9rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.88rem;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.btn-import:hover {
    border-color: var(--purple);
    background: rgba(155, 107, 201, 0.1);
}

.zizhi-panel {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    margin-top: 0.25rem;
    padding-top: 0.9rem;
    border-top: 1px solid var(--border-color);
}

.zz-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    flex: 1;
}

.zz-pill {
    font-size: 0.78rem;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    padding: 0.25rem 0.65rem;
}

.zz-pill b {
    color: var(--text-primary);
    font-weight: 600;
    margin-left: 0.15rem;
}

.zz-pill.total {
    border-color: rgba(155, 107, 201, 0.35);
    color: var(--purple-bright);
}

.zz-pill.total b {
    color: var(--purple-bright);
}

.btn-upgrade-zz {
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-radius: 6px;
    padding: 0.4rem 0.85rem;
    font-size: 0.8rem;
    cursor: pointer;
    white-space: nowrap;
}

.btn-upgrade-zz:hover:not(:disabled) {
    border-color: var(--blue);
}

.btn-upgrade-zz:disabled {
    opacity: 0.55;
    cursor: default;
}

/* Section title */
.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.9rem;
}

.section-heading {
    font-family: var(--font-serif);
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: var(--text-primary);
}

.section-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.btn-text {
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    color: var(--text-secondary);
    font-size: 0.75rem;
    padding: 0.2rem 0.65rem;
    cursor: pointer;
    line-height: 1.4;
}

.btn-text:hover {
    color: var(--text-primary);
    border-color: var(--border-accent);
}

.history-title {
    margin-bottom: 0.75rem;
}

/* Talent cards — 白 / 绿 / 蓝 / 紫 */
.talent-display {
    margin-bottom: 1.25rem;
}

.talent-slots {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.talent-tip {
    font-size: 0.72rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin: -0.35rem 0 0.75rem;
}

.talent-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.9rem 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.9rem;
    position: relative;
    overflow: hidden;
}

.talent-card.conflict {
    border-color: rgba(224, 116, 106, 0.45);
    background: linear-gradient(135deg, var(--bg-card), rgba(224, 116, 106, 0.06));
}

.talent-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.talent-actions {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    flex-shrink: 0;
}

.talent-bang {
    color: var(--red);
    font-style: normal;
    font-weight: 900;
    margin-left: 0.2rem;
}

.talent-conflict {
    font-size: 0.7rem;
    color: var(--red);
}

.talent-exchange-btn {
    border: 1px solid rgba(155, 107, 201, 0.5);
    background: rgba(155, 107, 201, 0.12);
    color: var(--purple-bright);
    border-radius: 5px;
    padding: 0.28rem 0.55rem;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
}

.talent-exchange-btn:hover {
    background: rgba(155, 107, 201, 0.22);
    border-color: var(--purple-bright);
}

.talent-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
}

.talent-card.q1 { border-color: rgba(229, 231, 235, 0.18); }
.talent-card.q1::before { background: var(--white-dim); }

.talent-card.q2 { border-color: rgba(95, 173, 106, 0.35); }
.talent-card.q2::before { background: var(--green); }

.talent-card.q3 { border-color: rgba(91, 143, 212, 0.35); }
.talent-card.q3::before { background: var(--blue); }

.talent-card.q4 {
    border-color: rgba(155, 107, 201, 0.45);
    background: linear-gradient(135deg, var(--bg-card), rgba(155, 107, 201, 0.08));
}
.talent-card.q4::before { background: var(--purple-bright); }

.talent-card.empty {
    border-style: dashed;
    justify-content: center;
    min-height: 56px;
    opacity: 0.55;
    color: var(--text-muted);
    font-size: 0.85rem;
}
.talent-card.empty::before { display: none; }

.talent-card.locked {
    background: rgba(155, 107, 201, 0.05);
}

.talent-name {
    font-family: var(--font-serif);
    font-weight: 700;
    font-size: 0.98rem;
    min-width: 5.5rem;
}

.talent-name.q1 { color: var(--white); }
.talent-name.q2 { color: var(--green-bright); }
.talent-name.q3 { color: var(--blue-bright); }
.talent-name.q4 { color: var(--purple-bright); }

.talent-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.45;
    flex: 1;
}

.talent-lock-btn {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    color: var(--text-muted);
    padding: 0.28rem 0.55rem;
    font-size: 0.72rem;
    cursor: pointer;
    flex-shrink: 0;
}

.talent-lock-btn:hover {
    border-color: var(--border-accent);
    color: var(--text-secondary);
}

.talent-lock-btn.locked {
    background: rgba(155, 107, 201, 0.15);
    border-color: rgba(155, 107, 201, 0.45);
    color: var(--purple-bright);
}

@keyframes talentAppear {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.talent-card.animate-in {
    animation: talentAppear 0.28s ease-out forwards;
}

/* Actions */
.action-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1.15rem 1.25rem;
    margin-bottom: 1.25rem;
}

.action-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.6rem;
    margin-bottom: 1rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.7rem 0.4rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.btn:hover {
    border-color: var(--border-accent);
    background: var(--bg-card-hover);
}

.btn-wash:hover { border-color: var(--green); }
.btn-wash-multi:hover { border-color: var(--blue); }
.btn-wash-auto:hover { border-color: var(--purple); }
.btn-wash-gold {
    border-color: rgba(155, 107, 201, 0.4);
    background: linear-gradient(135deg, var(--bg-secondary), rgba(155, 107, 201, 0.12));
}
.btn-wash-gold:hover { border-color: var(--purple-bright); }

.pity-bar {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin-bottom: 0.65rem;
}

.pity-label {
    font-size: 0.78rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.pity-track {
    flex: 1;
    height: 7px;
    background: var(--bg-secondary);
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.pity-fill {
    height: 100%;
    background: linear-gradient(90deg, #6d4d91, var(--purple-bright));
    border-radius: 4px;
    transition: width 0.25s ease;
}

.pity-text {
    font-size: 0.78rem;
    color: var(--purple-bright);
    font-weight: 600;
    min-width: 72px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.cost-info {
    text-align: center;
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* Stats */
.stats-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1.15rem 1.25rem;
    margin-bottom: 1.25rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.6rem;
    margin-bottom: 1rem;
}

.stat-card {
    text-align: center;
    padding: 0.7rem 0.4rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.stat-value {
    font-family: var(--font-serif);
    font-size: 1.35rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.stat-value.purple { color: var(--purple-bright); }

.stat-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-top: 0.2rem;
}

.quality-stats {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.quality-bar {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.quality-label {
    font-size: 0.78rem;
    font-weight: 600;
    min-width: 1.5rem;
    text-align: center;
}

.quality-label.q1 { color: var(--white); }
.quality-label.q2 { color: var(--green); }
.quality-label.q3 { color: var(--blue); }
.quality-label.q4 { color: var(--purple); }

.quality-track {
    flex: 1;
    height: 5px;
    background: var(--bg-secondary);
    border-radius: 3px;
    overflow: hidden;
}

.quality-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.4s ease;
}

.quality-fill.q1 { background: var(--white-dim); }
.quality-fill.q2 { background: var(--green); }
.quality-fill.q3 { background: var(--blue); }
.quality-fill.q4 { background: var(--purple-bright); }

.quality-count {
    font-size: 0.75rem;
    color: var(--text-secondary);
    min-width: 72px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.stats-actions {
    margin-top: 0.9rem;
    text-align: center;
}

.btn-reset {
    display: inline-flex;
    padding: 0.45rem 1.5rem;
    border: 1px solid rgba(224, 116, 106, 0.35);
    border-radius: 6px;
    background: rgba(224, 116, 106, 0.08);
    color: var(--red);
    font-size: 0.82rem;
    cursor: pointer;
}

.btn-reset:hover {
    background: rgba(224, 116, 106, 0.15);
}

/* History */
.history-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1.15rem 1.25rem;
    margin-bottom: 1.5rem;
}

.history-log {
    max-height: 340px;
    overflow-y: auto;
    font-size: 0.8rem;
    line-height: 1.7;
    color: var(--text-secondary);
    scrollbar-width: thin;
    scrollbar-color: #3a4150 transparent;
}

.history-log::-webkit-scrollbar { width: 6px; }
.history-log::-webkit-scrollbar-track { background: transparent; }
.history-log::-webkit-scrollbar-thumb {
    background: #3a4150;
    border-radius: 3px;
}
.history-log::-webkit-scrollbar-thumb:hover { background: #525b6e; }

.pager-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.55rem 0.75rem;
    margin-top: 0.65rem;
    padding: 0.45rem 0;
    font-size: 0.82rem;
    color: var(--text-muted);
}
.pager-bar[hidden] {
    display: none !important;
}
.pager-bar .pager-size {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-left: auto;
}
.pager-bar select {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 4px;
    padding: 0.25rem 0.4rem;
    font-family: var(--font-sans);
}
.pager-bar .meta-text {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.log-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 1.75rem;
}

.log-entry {
    padding: 0.4rem 0;
    border-bottom: 1px solid rgba(44, 49, 60, 0.7);
    display: flex;
    gap: 0.5rem;
    align-items: baseline;
    flex-wrap: wrap;
}

.log-entry.log-purple {
    background: rgba(155, 107, 201, 0.08);
    margin: 0 -0.35rem;
    padding-left: 0.35rem;
    padding-right: 0.35rem;
    border-radius: 4px;
}

.log-entry.log-pity-hit {
    background: rgba(155, 107, 201, 0.14);
}

.log-entry.log-exchange {
    background: rgba(91, 143, 212, 0.1);
}

.log-num {
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    min-width: 2.4rem;
}

.log-talents {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    flex: 1;
    min-width: 140px;
}

.log-talent {
    padding: 0.08rem 0.45rem;
    border-radius: 4px;
    font-size: 0.74rem;
    font-weight: 500;
}

.log-talent.q1 { background: rgba(229, 231, 235, 0.1); color: var(--white); }
.log-talent.q2 { background: rgba(95, 173, 106, 0.15); color: var(--green-bright); }
.log-talent.q3 { background: rgba(91, 143, 212, 0.15); color: var(--blue-bright); }
.log-talent.q4 { background: rgba(155, 107, 201, 0.2); color: var(--purple-bright); font-weight: 700; }

.log-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-left: auto;
    justify-content: flex-end;
}

.log-tag {
    font-size: 0.68rem;
    white-space: nowrap;
    color: var(--text-muted);
}

.log-tag.pity { color: var(--purple-bright); font-weight: 700; }
.log-tag.purple { color: var(--purple-bright); }
.log-tag.gap { color: var(--green-bright); font-weight: 600; }
.log-tag.meta { color: var(--text-secondary); }

.app-footer {
    text-align: center;
    padding: 0.5rem 0 1.5rem;
    color: var(--text-muted);
    font-size: 0.72rem;
}

@media (max-width: 640px) {
    .app-header h1 { font-size: 1.6rem; letter-spacing: 0.12em; }
    .action-buttons { grid-template-columns: repeat(2, 1fr); }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .talent-card { flex-wrap: wrap; }
    .talent-main { min-width: 100%; }
    .talent-actions { flex-direction: row; width: 100%; justify-content: flex-end; }
}

/* 角色选择重置按钮 */
.select-with-btn {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}
.select-with-btn select { flex: 1; }
.btn-reset-role {
    background: #222630;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    padding: 0.35rem 0.75rem;
    font-size: 0.78rem;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}
.btn-reset-role:hover {
    background: #2d3342;
    color: var(--text-primary);
    border-color: var(--border-accent);
}

/* 自定义连洗与紫脉预测行 */
.action-custom-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.8rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px dashed var(--border-color);
}
.custom-wash-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.82rem;
    color: var(--text-secondary);
}
.custom-wash-group input[type="number"] {
    width: 70px;
    background: #12141a;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.3rem 0.5rem;
    border-radius: 4px;
    font-size: 0.85rem;
    text-align: center;
}
.btn-wash-custom {
    background: #202736;
    color: #7eb0f0;
    border: 1px solid #34425a;
    padding: 0.35rem 0.8rem;
    font-size: 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-wash-custom:hover {
    background: #2a3447;
    color: #9cbff7;
    border-color: #485c7d;
}
.btn-analyze-purple {
    background: #2b2236;
    color: #d094fc;
    border: 1px solid #4a3461;
    padding: 0.4rem 1rem;
    font-size: 0.82rem;
    font-weight: 500;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    margin-left: auto;
}
.btn-analyze-purple:hover {
    background: #362945;
    color: #e4c4fe;
    border-color: #5d3f7d;
}

/* 洗脉区：下一紫最近冲突脉 */
.next-conflict-panel {
    margin-top: 0.9rem;
    padding-top: 0.85rem;
    border-top: 1px dashed var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}
.next-conflict-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 0.55rem;
    font-size: 0.78rem;
}
.next-conflict-title {
    font-weight: 600;
    color: var(--text-primary);
}
.next-conflict-from {
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}
.next-conflict-from input {
    width: 4rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 6px;
    padding: 0.2rem 0.35rem;
    font-size: 0.78rem;
}
.next-conflict-result {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.55;
    padding: 0.55rem 0.7rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}
.next-conflict-result .nc-steps {
    margin-top: 0.3rem;
    color: var(--text-muted);
    font-size: 0.75rem;
}
.next-conflict-result .nc-actions {
    margin-top: 0.45rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}
.next-conflict-result .nc-actions .btn {
    padding: 0.35rem 0.65rem;
    font-size: 0.75rem;
    border-radius: 6px;
}

/* 弹窗模态框 UI */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(8, 10, 14, 0.62);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1.25rem;
}
.modal-overlay[hidden] { display: none !important; }

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    max-height: min(88vh, 920px);
    width: min(1120px, 96vw);
    overflow: hidden;
}
.modal-large { max-width: 1000px; }
.modal-split { max-width: none; }

.purple-split-body {
    display: grid !important;
    grid-template-columns: minmax(300px, 1fr) minmax(340px, 1fr);
    gap: 0 !important;
    overflow: hidden !important;
    min-height: 0;
    padding: 0 !important;
    flex: 1;
}
.purple-pane {
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    overflow: hidden;
    padding: 0.85rem 1rem;
}
.purple-pane-seq {
    border-right: 1px solid var(--border-color);
    background: rgba(12, 14, 18, 0.35);
}
.purple-pane-seq .purple-table-container {
    flex: 1;
    max-height: none;
    min-height: 0;
}
.purple-pane-exchange .exchange-analysis-block {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: none;
    background: transparent;
    padding: 0;
}
.purple-pane-exchange .block-content {
    flex: 1;
    min-height: 0;
    overflow: auto;
}

/* 细滚动条，与历史记录区一致 */
.purple-table-container,
.purple-pane-exchange .block-content,
.route-pad-table-wrap,
.modal-body {
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}
.purple-table-container::-webkit-scrollbar,
.purple-pane-exchange .block-content::-webkit-scrollbar,
.route-pad-table-wrap::-webkit-scrollbar,
.modal-body::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}
.purple-table-container::-webkit-scrollbar-track,
.purple-pane-exchange .block-content::-webkit-scrollbar-track,
.route-pad-table-wrap::-webkit-scrollbar-track,
.modal-body::-webkit-scrollbar-track {
    background: transparent;
}
.purple-table-container::-webkit-scrollbar-thumb,
.purple-pane-exchange .block-content::-webkit-scrollbar-thumb,
.route-pad-table-wrap::-webkit-scrollbar-thumb,
.modal-body::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}
.purple-table-container::-webkit-scrollbar-thumb:hover,
.purple-pane-exchange .block-content::-webkit-scrollbar-thumb:hover,
.route-pad-table-wrap::-webkit-scrollbar-thumb:hover {
    background: var(--border-accent);
}

.purple-table tr.row-highlight {
    background: rgba(155, 107, 201, 0.16) !important;
}
.purple-table tr.row-highlight-conflict td:nth-child(5) {
    color: var(--red);
    font-weight: 600;
}

@media (max-width: 900px) {
    .purple-split-body {
        grid-template-columns: 1fr !important;
        overflow-y: auto !important;
    }
    .purple-pane-seq {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    .purple-pane-seq .purple-table-container {
        max-height: 260px;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.85rem 1.15rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-card);
    border-radius: 12px 12px 0 0;
    flex-shrink: 0;
}
.modal-header h2 {
    font-size: 1.1rem;
    color: var(--text-primary);
    font-family: var(--font-serif);
}
.modal-close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0 0.4rem;
}
.modal-close-btn:hover { color: var(--red); }

.modal-body {
    padding: 1rem 1.25rem;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.modal-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    background: var(--bg-card);
    padding: 0.75rem 1rem;
    border-radius: 6px;
    font-size: 0.8rem;
    border: 1px solid var(--border-color);
}
.search-box input {
    background: #12141a;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.35rem 0.75rem;
    border-radius: 4px;
    font-size: 0.8rem;
    width: 260px;
}
.filter-box {
    display: flex;
    gap: 1rem;
    color: var(--text-secondary);
}
.filter-box label {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}
.stats-summary {
    margin-left: auto;
    color: var(--text-muted);
}

.purple-table-container {
    overflow: auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    max-height: 480px;
}
.purple-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
    text-align: left;
}
.purple-table th, .purple-table td {
    padding: 0.6rem 0.8rem;
    border-bottom: 1px solid var(--border-color);
}
.purple-table th {
    background: #1c1f28;
    color: var(--text-secondary);
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 2;
}
.purple-table tbody tr:hover {
    background: var(--bg-card-hover);
}
.purple-table td.loading-td {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

.tag-pity {
    color: var(--purple-bright);
    font-weight: 700;
    background: rgba(155, 107, 201, 0.15);
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    font-size: 0.75rem;
}
.conflict-cell {
    color: var(--red);
    font-weight: 500;
}
.conflict-wash-no {
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-left: 0.2rem;
}
/* 独立无限置换推演面板 */
.exchange-analysis-block {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.exchange-analysis-block .block-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}
.exchange-analysis-block .block-header h3 {
    font-size: 0.95rem;
    color: var(--text-primary);
    font-weight: 600;
}
.exchange-analysis-block .block-tip {
    font-size: 0.75rem;
    color: var(--text-muted);
}
.exchange-analysis-block .block-empty {
    text-align: center;
    padding: 1.5rem;
    color: var(--text-muted);
    font-size: 0.82rem;
}

.selected-exchange-card {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    background: #14171f;
    border: 1px solid #2b3345;
    border-radius: 6px;
    padding: 0.85rem;
}
.selected-exchange-card.fixed-node {
    border-color: #1e3a5f;
    background: #0f1624;
}
.selected-exchange-card .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px dashed var(--border-color);
}
.selected-exchange-card .card-title {
    font-size: 0.88rem;
    color: var(--text-primary);
}
.selected-exchange-card .card-conflict {
    font-size: 0.78rem;
    color: var(--red);
}
.selected-exchange-card .card-last-slot {
    font-size: 0.75rem;
    color: var(--text-muted);
}
.btn-select-exchange {
    background: #202736;
    color: #7eb0f0;
    border: 1px solid #34425a;
    padding: 0.25rem 0.6rem;
    font-size: 0.78rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-select-exchange:hover {
    background: #2a354a;
    color: #9cbff7;
}
.btn-select-exchange.active {
    background: #2b2236;
    color: #d094fc;
    border-color: #4a3461;
}

.exchange-stepper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.82rem;
    color: var(--text-secondary);
}
.exchange-stepper .step-btn {
    background: #1f2430;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 24px;
    height: 24px;
    border-radius: 3px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}
.exchange-stepper .step-btn:hover {
    background: #2a3142;
}
.exchange-stepper .step-val {
    font-weight: bold;
    color: var(--purple-bright);
    min-width: 20px;
    text-align: center;
}

.multi-exchange-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 0.5rem;
    margin-top: 0.5rem;
}
.multi-exchange-item {
    background: #1a1e28;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 0.4rem 0.6rem;
    font-size: 0.78rem;
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.multi-exchange-item.current-step {
    border-color: var(--purple-bright);
    background: rgba(155, 107, 201, 0.15);
}
.multi-exchange-item .seq-num {
    color: var(--text-muted);
    font-size: 0.72rem;
}

.route-joint-panel {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.route-nodes-summary {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}
.route-pad-stepper {
    flex-wrap: wrap;
}
.route-pad-stepper .pad-jump {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-left: 0.35rem;
}
.route-pad-stepper .pad-jump input {
    width: 4.2rem;
    background: #1a1e28;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 3px;
    padding: 0.15rem 0.35rem;
    font-size: 0.8rem;
}
.reconflict-tag {
    color: var(--red);
    font-size: 0.7rem;
    margin-left: 0.15rem;
}
.shenmai-forks {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}
.shenmai-fork {
    line-height: 1.35;
    white-space: normal;
}
.shenmai-fork-note {
    margin-top: 0.15rem;
    font-size: 0.68rem;
    line-height: 1.3;
}
.shenmai-roll-hint {
    display: inline-block;
    margin-left: 0.25rem;
    color: var(--text-muted);
    font-size: 0.65rem;
    opacity: 0.9;
}
.chain-stop-alts {
    margin-top: 0.35rem;
    font-size: 0.72rem;
    line-height: 1.4;
}
.chain-stop-alts > summary {
    cursor: pointer;
    color: var(--text-secondary);
    user-select: none;
}
.chain-stop-alts > summary:hover {
    color: var(--text-primary);
}
.chain-stop-body {
    margin-top: 0.3rem;
    padding: 0.35rem 0.45rem;
    border-left: 2px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}
.chain-stop-row {
    white-space: normal;
}
.chain-follow-item {
    white-space: normal;
}
.route-pad-table-wrap {
    max-height: 360px;
    overflow: auto;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}
.route-pad-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
}
.route-pad-table th,
.route-pad-table td {
    padding: 0.4rem 0.55rem;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
    vertical-align: top;
}
.route-pad-table thead th {
    position: sticky;
    top: 0;
    background: #151922;
    color: var(--text-secondary);
    z-index: 1;
    font-weight: 600;
}
.route-pad-table .th-fixed {
    color: var(--text-muted);
    font-weight: 400;
    font-size: 0.7rem;
}
.route-pad-row {
    cursor: pointer;
}
.route-pad-row:hover {
    background: rgba(126, 176, 240, 0.06);
}
.route-pad-row.current-step {
    background: rgba(155, 107, 201, 0.15);
}
.route-pad-row.current-step td {
    border-color: rgba(155, 107, 201, 0.35);
}

.modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.7rem 1.15rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-card);
    border-radius: 0 0 12px 12px;
    flex-shrink: 0;
    gap: 0.75rem;
}
.modal-tip {
    font-size: 0.75rem;
    color: var(--text-muted);
}


/* ===== DLC 300 保底紫切换 ===== */
.dlc-row {
    padding-top: 10px;
    margin-bottom: 2px;
}
/* 提高优先级（0,2,1）覆盖 .config-group label 的 display:block（0,1,1），让 checkbox 与文字同行左对齐 */
.dlc-row .config-group > .dlc-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 1.05rem;
    font-weight: 500;
    color: var(--text-primary, #222);
    cursor: pointer;
    line-height: 1.4;
    margin: 0 0 4px 0;
}
.dlc-row .dlc-check {
    width: 18px;
    height: 18px;
    accent-color: var(--ok-color, #2e8b57);
    cursor: pointer;
    flex-shrink: 0;
}
.dlc-row .dlc-hint {
    display: block;
    font-size: 0.9rem;
    color: var(--text-muted, #777);
    margin-top: 4px;
    padding-left: 26px;
}
