:root {
    --bg: #f3ece0;
    --surface: #fffdf8;
    --surface-2: #fbf5ec;
    --ink: #3e3730;
    --ink-soft: #857a6c;
    --ink-faint: #a99d8c;
    --line: #ece2d3;
    --line-strong: #e0d4c1;
    --terra: #c8694a;
    --terra-deep: #b0573b;
    --terra-soft: #f6e7de;
    --sage: #7e9a6e;
    --sage-soft: #e8f0e0;
    --danger: #bc5640;
    --danger-soft: #fbe9e3;
    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 12px;
    --shadow: 0 12px 34px rgba(122, 90, 54, 0.10), 0 3px 10px rgba(122, 90, 54, 0.05);
    --shadow-sm: 0 6px 18px rgba(122, 90, 54, 0.08);
    --font: "ui-rounded", "SF Pro Rounded", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", system-ui, -apple-system, sans-serif;
}
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}
html {
    -webkit-text-size-adjust: 100%;
}
body {
    font-family: var(--font);
    color: var(--ink);
    background:
        radial-gradient(1200px 520px at 50% -220px, #fbf4e8 0%, rgba(251, 244, 232, 0) 70%),
        var(--bg);
    background-attachment: fixed;
    padding: 28px 20px 48px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}
.wrap {
    max-width: 1080px;
    margin: 0 auto;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 32px 30px;
    box-shadow: var(--shadow);
}
h1 {
    text-align: center;
    font-size: 26px;
    font-weight: 800;
    letter-spacing: 0.3px;
    color: var(--ink);
    margin-bottom: 10px;
}
.subtitle {
    max-width: 680px;
    margin: 0 auto 26px;
    text-align: center;
    color: var(--ink-soft);
    font-size: 14.5px;
    line-height: 1.75;
}
.section-title {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 26px 0 15px;
    font-size: 16px;
    font-weight: 800;
    color: var(--ink);
}
.section-title::before {
    content: "";
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--terra);
    box-shadow: 0 0 0 4px var(--terra-soft);
}
.section-title:first-of-type {
    margin-top: 0;
}
/* 输入区域 */
.input-box {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
    margin-bottom: 18px;
}
.input-item {
    display: flex;
    flex-direction: column;
    gap: 7px;
}
label {
    font-size: 14px;
    font-weight: 600;
    color: var(--ink);
}
label small {
    font-weight: 400;
    color: var(--ink-faint);
}
input, select {
    padding: 12px 14px;
    font-size: 15px;
    font-family: inherit;
    color: var(--ink);
    background: var(--surface-2);
    border: 1.5px solid var(--line-strong);
    border-radius: var(--radius-sm);
    transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
}
input::placeholder {
    color: var(--ink-faint);
}
input:hover, select:hover {
    border-color: #d2c3ac;
}
input:focus, select:focus {
    outline: none;
    border-color: var(--terra);
    background: var(--surface);
    box-shadow: 0 0 0 4px var(--terra-soft);
}
input.invalid {
    border-color: var(--danger);
    background: var(--danger-soft);
    box-shadow: 0 0 0 4px rgba(188, 86, 64, 0.12);
}
.input-note {
    font-size: 12px;
    color: var(--ink-faint);
    line-height: 1.55;
}
.btn-row {
    grid-column: 1 / -1;
    display: flex;
    gap: 14px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 6px;
    padding: 16px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
}
.btn {
    min-width: 190px;
    padding: 12px 22px;
    font-size: 15.5px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    border: none;
    border-radius: 999px;
    background: var(--terra);
    color: #fff;
    box-shadow: 0 8px 18px rgba(200, 105, 74, 0.28);
    transition: transform 0.12s, box-shadow 0.18s, background 0.18s;
}
.btn:hover {
    background: var(--terra-deep);
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgba(176, 87, 59, 0.32);
}
.btn:active {
    transform: translateY(0);
}
.btn.secondary {
    background: var(--sage-soft);
    color: #4f6243;
    box-shadow: 0 6px 16px rgba(126, 154, 110, 0.18);
}
.btn.secondary:hover {
    background: #dce7d0;
    color: #43543a;
}
.btn:focus-visible {
    outline: 3px solid var(--terra);
    outline-offset: 3px;
}
.status-tip {
    margin: 0 auto 8px;
    text-align: center;
    color: var(--ink-soft);
    font-size: 13px;
    min-height: 18px;
}
.error-tip {
    display: none;
    max-width: 560px;
    margin: 4px auto 12px;
    text-align: center;
    color: var(--danger);
    background: var(--danger-soft);
    border: 1px solid #f0cfc4;
    border-radius: var(--radius-sm);
    padding: 9px 14px;
    font-size: 13.5px;
    font-weight: 600;
}
/* 图形可视化区域 */
.chart-box {
    width: 100%;
    overflow: hidden;
    margin: 8px 0 4px;
    padding: 14px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
}
svg.chart {
    display: block;
    width: 100%;
    height: auto;
}
.zone-block {
    transition: opacity 0.15s;
}
.zone-block:focus-visible {
    outline: 3px solid var(--terra-deep);
    outline-offset: 2px;
}
/* SVG 内可点击元素的指针样式（从内联 style 抽出，便于收紧 CSP） */
.zone-marker-hit,
.zone-marker-label {
    cursor: pointer;
}
.zone-marker-label {
    user-select: none;
}
.model-note {
    margin-top: 12px;
    padding: 12px 14px;
    background: var(--surface-2);
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius-sm);
    color: var(--ink-soft);
    font-size: 12.5px;
    line-height: 1.65;
}
.zone-detail-card {
    margin-top: 16px;
    padding: 18px 20px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-top: 5px solid var(--terra);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}
.zone-detail-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.zone-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 14px;
    border-radius: 999px;
    font-size: 16px;
    font-weight: 800;
    color: var(--ink);
    background: var(--terra-soft);
    box-shadow: inset 0 0 0 1px rgba(62, 55, 48, 0.08);
}
.zone-detail-title {
    font-size: 16.5px;
    font-weight: 800;
    color: var(--ink);
}
.zone-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 12px 16px;
    margin-bottom: 12px;
}
.zone-detail-item {
    padding: 10px 12px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 10px;
    font-size: 13.5px;
    color: var(--ink);
    line-height: 1.6;
}
.zone-detail-item strong {
    display: block;
    margin-bottom: 3px;
    color: var(--ink-faint);
    font-size: 11.5px;
    font-weight: 600;
}
.zone-detail-use {
    padding: 11px 13px;
    background: var(--terra-soft);
    border-radius: 10px;
    font-size: 13.5px;
    color: var(--ink-soft);
    line-height: 1.75;
}
.zone-detail-use strong {
    color: var(--terra-deep);
}
/* 移动端区间卡片列表（窄屏替代横向 SVG） */
.zone-mobile {
    display: none;
    flex-direction: column;
    gap: 10px;
    margin: 8px 0 4px;
}
.zone-mobile-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    text-align: left;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    font-family: inherit;
    cursor: pointer;
    transition: transform 0.12s;
}
.zone-mobile-item:active {
    transform: scale(0.99);
}
.zone-mobile-item.is-active {
    box-shadow: inset 0 0 0 2px var(--terra-deep);
}
.zone-mobile-item:focus-visible {
    outline: 3px solid var(--terra-deep);
    outline-offset: 2px;
}
.zmi-badge {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 800;
    color: var(--ink);
    box-shadow: inset 0 0 0 1px rgba(62, 55, 48, 0.08);
}
.zmi-main {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}
.zmi-name {
    font-size: 14.5px;
    font-weight: 700;
    color: var(--ink);
}
.zmi-sub {
    font-size: 12px;
    color: var(--ink-soft);
    line-height: 1.5;
}
.footer-note {
    margin-top: 26px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
    text-align: center;
    color: var(--ink-soft);
    font-size: 13px;
    line-height: 1.85;
}
.footer-note strong {
    color: var(--ink);
}
.footer-note a {
    color: var(--terra);
    text-decoration: none;
    font-weight: 600;
}
.footer-note a:hover {
    text-decoration: underline;
}
/* 数据表格 */
.table-box {
    margin-top: 6px;
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
}
table {
    width: 100%;
    border-collapse: collapse;
    min-width: 880px;
}
thead th {
    padding: 13px 12px;
    text-align: center;
    background: var(--surface-2);
    color: var(--ink);
    font-weight: 700;
    font-size: 13.5px;
    border-bottom: 1px solid var(--line-strong);
}
tbody td {
    padding: 12px;
    text-align: center;
    font-size: 13.5px;
    color: var(--ink-soft);
    border-bottom: 1px solid var(--line);
}
tbody tr {
    cursor: pointer;
    transition: filter 0.15s;
}
tbody tr:last-child td {
    border-bottom: none;
}
tbody tr:hover {
    filter: brightness(0.985);
}
tbody tr:focus-visible {
    outline: 3px solid var(--terra-deep);
    outline-offset: -3px;
}
tr.is-active-row td {
    font-weight: 700;
    color: var(--ink);
    box-shadow: inset 0 0 0 2px var(--terra-deep);
}
@media (max-width: 768px) {
    body {
        padding: 16px 12px 32px;
    }
    .wrap {
        padding: 20px 16px;
        border-radius: 20px;
    }
    h1 {
        font-size: 21px;
    }
    .subtitle {
        font-size: 13.5px;
    }
    .btn {
        width: 100%;
        min-width: 0;
    }
    .input-box {
        gap: 14px;
    }
    /* 窄屏：隐藏横向滚动 SVG，改用竖向卡片列表 */
    .chart-box {
        display: none;
    }
    .zone-mobile {
        display: flex;
    }
    /* 窄屏：明细表转为堆叠卡片，免横向滚动 */
    .table-box {
        border: none;
        overflow: visible;
    }
    table {
        min-width: 0;
    }
    thead {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
        border: 0;
    }
    tbody tr {
        display: block;
        margin-bottom: 12px;
        border: 1px solid var(--line);
        border-radius: 14px;
        overflow: hidden;
        box-shadow: var(--shadow-sm);
    }
    tbody td {
        display: flex;
        justify-content: space-between;
        gap: 14px;
        text-align: right;
        padding: 9px 14px;
        font-size: 12.5px;
        border-bottom: 1px solid rgba(62, 55, 48, 0.06);
    }
    tbody td:last-child {
        border-bottom: none;
    }
    tbody td::before {
        content: attr(data-label);
        flex: 0 0 auto;
        text-align: left;
        font-weight: 700;
        color: var(--ink);
    }
    tr.is-active-row td {
        box-shadow: none;
    }
    tr.is-active-row {
        outline: 2px solid var(--terra-deep);
        outline-offset: -2px;
    }
}
