:root {
    --bg: #0f172a;
    --panel: #111c34;
    --panel-soft: #162441;
    --panel-deep: rgba(15, 23, 42, 0.72);
    --border: rgba(148, 163, 184, 0.2);
    --text: #e2e8f0;
    --muted: #94a3b8;
    --primary: #38bdf8;
    --primary-strong: #0ea5e9;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --shadow: 0 18px 50px rgba(15, 23, 42, 0.35);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
    background: radial-gradient(circle at top, #15264a 0%, var(--bg) 48%);
    color: var(--text);
}

code,
pre,
table {
    font-family: "Consolas", "Courier New", monospace;
}

.page-shell {
    max-width: 1680px;
    margin: 0 auto;
    padding: 24px 24px 40px;
}

.global-drop-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.55);
    z-index: 20;
}

.global-drop-card {
    width: min(520px, calc(100vw - 32px));
    padding: 28px 24px;
    border-radius: 24px;
    border: 2px dashed rgba(56, 189, 248, 0.55);
    background: rgba(15, 23, 42, 0.96);
    text-align: center;
    box-shadow: var(--shadow);
}

.global-drop-card h2 {
    margin: 0 0 10px;
    font-size: 28px;
}

.global-drop-card p {
    margin: 0;
    color: var(--muted);
    font-size: 15px;
}

.global-drop-icon {
    width: 84px;
    height: 84px;
    margin: 0 auto 18px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: rgba(56, 189, 248, 0.14);
    color: var(--primary);
    font-size: 34px;
    font-weight: 700;
}

.hero {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    align-items: flex-start;
    margin-bottom: 18px;
}

.hero-copy {
    max-width: 880px;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--primary);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-size: 12px;
}

.hero h1 {
    margin: 0;
    font-size: 36px;
    line-height: 1.2;
}

.hero-text {
    margin: 10px 0 0;
    color: var(--muted);
    line-height: 1.7;
}

.hero-actions {
    min-width: 260px;
    display: grid;
    gap: 12px;
    justify-items: end;
}

.hero-tip {
    font-size: 13px;
    color: var(--muted);
}

.primary-btn,
.secondary-btn {
    border: none;
    border-radius: 999px;
    padding: 12px 22px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.primary-btn {
    color: #082f49;
    background: linear-gradient(135deg, var(--primary), #7dd3fc);
    box-shadow: 0 12px 22px rgba(14, 165, 233, 0.25);
}

.primary-btn:hover,
.secondary-btn:hover {
    transform: translateY(-1px);
}

.secondary-btn {
    padding: 10px 18px;
    font-size: 14px;
    color: var(--text);
    background: rgba(56, 189, 248, 0.16);
    border: 1px solid rgba(56, 189, 248, 0.24);
}

.secondary-btn.ghost {
    background: rgba(148, 163, 184, 0.12);
    border-color: rgba(148, 163, 184, 0.2);
}

.state-badge {
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    border: 1px solid transparent;
}

.state-badge.idle {
    background: rgba(148, 163, 184, 0.16);
    color: #cbd5e1;
    border-color: rgba(148, 163, 184, 0.24);
}

.state-badge.processing {
    background: rgba(56, 189, 248, 0.16);
    color: #7dd3fc;
    border-color: rgba(56, 189, 248, 0.28);
}

.state-badge.success {
    background: rgba(34, 197, 94, 0.16);
    color: #86efac;
    border-color: rgba(34, 197, 94, 0.26);
}

.state-badge.error {
    background: rgba(239, 68, 68, 0.16);
    color: #fca5a5;
    border-color: rgba(239, 68, 68, 0.26);
}

.message-box {
    margin-bottom: 14px;
    padding: 14px 16px;
    border-radius: 16px;
    line-height: 1.6;
    font-size: 14px;
}

.message-box.error {
    background: rgba(127, 29, 29, 0.4);
    border: 1px solid rgba(248, 113, 113, 0.28);
    color: #fecaca;
}

.message-box.warning {
    background: rgba(120, 53, 15, 0.35);
    border: 1px solid rgba(251, 191, 36, 0.25);
    color: #fde68a;
}

.hidden {
    display: none !important;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}

.summary-grid-5 {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.summary-card,
.meta-block,
.chart-panel,
.selector-panel,
.chart-main-panel {
    background: rgba(15, 23, 42, 0.82);
    border: 1px solid var(--border);
    border-radius: 22px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
}

.summary-card {
    padding: 18px;
}

.summary-card span,
.summary-card em {
    display: block;
}

.summary-card span {
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 10px;
}

.summary-card strong {
    font-size: 20px;
    line-height: 1.2;
    word-break: break-word;
}

.model-badge {
    margin-top: 10px;
    font-style: normal;
    font-size: 12px;
    font-weight: 700;
    padding: 5px 10px;
    border-radius: 999px;
    width: fit-content;
}

.model-badge.neutral {
    background: rgba(148, 163, 184, 0.16);
    color: #cbd5e1;
}

.model-badge.model-2x {
    background: rgba(56, 189, 248, 0.18);
    color: #7dd3fc;
}

.model-badge.model-3c3s {
    background: rgba(34, 197, 94, 0.18);
    color: #86efac;
}

.meta-block {
    padding: 18px;
    margin-bottom: 18px;
}

.block-title-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.block-title-row h3,
.selector-panel-header h4,
.chart-stage-header h4 {
    margin: 0;
}

.block-subtext,
.chart-hint,
.selector-count,
.chart-stage-meta {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.6;
}

.meta-content {
    margin: 14px 0 0;
    padding: 16px;
    border-radius: 14px;
    background: rgba(15, 23, 42, 0.8);
    color: #cbd5e1;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 180px;
    overflow: auto;
}

.chart-panel {
    padding: 18px;
}

.chart-topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 16px;
}

.chart-topbar h3 {
    margin: 0;
    font-size: 22px;
}

.chart-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.chart-workspace {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 18px;
    min-height: 640px;
}

.selector-panel,
.chart-main-panel {
    padding: 16px;
}

.selector-panel {
    display: flex;
    flex-direction: column;
    min-height: 640px;
}

.selector-panel-header {
    margin-bottom: 12px;
}

.field-search-input {
    width: 100%;
    margin-bottom: 12px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: rgba(15, 23, 42, 0.7);
    color: var(--text);
    outline: none;
}

.field-search-input::placeholder {
    color: var(--muted);
}

.chart-field-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    min-height: 0;
    max-height: 540px;
    overflow: auto;
    padding-right: 4px;
}

.chart-field-list.empty,
.chart-legend.empty,
.chart-panel.empty {
    color: var(--muted);
}

.chart-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--panel-deep);
    cursor: pointer;
}

.chart-checkbox input {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

.chart-checkbox span {
    color: #dbeafe;
    font-size: 13px;
    word-break: break-all;
    flex: 1;
}

.field-note {
    font-style: normal;
    font-size: 12px;
    color: var(--warning);
    flex: 0 0 auto;
}

.chart-main-panel {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.chart-stage-header {
    margin-bottom: 12px;
}

.chart-canvas-wrap {
    position: relative;
    padding: 14px;
    border-radius: 18px;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--border);
    overflow: auto;
    min-height: 460px;
}

.chart-canvas {
    width: 100%;
    display: block;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.98), rgba(19, 33, 61, 0.98));
    border-radius: 12px;
    cursor: crosshair;
}

.chart-tooltip {
    position: absolute;
    min-width: 180px;
    max-width: 320px;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.96);
    border: 1px solid rgba(56, 189, 248, 0.3);
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.38);
    color: #e2e8f0;
    font-size: 12px;
    line-height: 1.6;
    pointer-events: none;
    z-index: 3;
}

.chart-tooltip-title {
    margin-bottom: 6px;
    color: #7dd3fc;
    font-weight: 700;
}

.chart-tooltip-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chart-tooltip-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex: 0 0 auto;
}

.chart-empty-state {
    margin-top: 14px;
    padding: 16px;
    border-radius: 14px;
    background: rgba(15, 23, 42, 0.45);
    border: 1px dashed rgba(148, 163, 184, 0.24);
    color: var(--muted);
}

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.65);
    border: 1px solid var(--border);
    font-size: 13px;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex: 0 0 auto;
}

@media (max-width: 1280px) {
    .chart-workspace {
        grid-template-columns: 260px minmax(0, 1fr);
    }
}

@media (max-width: 1180px) {
    .summary-grid,
    .summary-grid-5 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .chart-workspace {
        grid-template-columns: 1fr;
    }

    .selector-panel {
        min-height: 0;
    }

    .chart-field-list {
        max-height: 260px;
    }
}

@media (max-width: 768px) {
    .page-shell {
        padding: 18px 14px 28px;
    }

    .hero,
    .chart-topbar {
        flex-direction: column;
    }

    .hero h1 {
        font-size: 28px;
    }

    .hero-actions {
        justify-items: start;
        width: 100%;
    }

    .summary-grid,
    .summary-grid-5 {
        grid-template-columns: 1fr;
    }

    .chart-actions {
        justify-content: flex-start;
        width: 100%;
    }

    .global-drop-card h2 {
        font-size: 22px;
    }
}
