:root {
    --bg: #f4f7fb;
    --bg-soft: #eef4fb;
    --card: #ffffff;
    --card-soft: #f8fbff;
    --border: #dce5ef;
    --text: #172334;
    --muted: #5f6f84;
    --muted-soft: #7e8da1;
    --from: #2f7cf6;
    --from-soft: #eaf3ff;
    --to: #ef8a37;
    --to-soft: #fff1e6;
    --good: #1f9d6a;
    --good-soft: #edf9f3;
    --danger: #d54b63;
    --danger-soft: #fff1f3;
    --warn: #c97a12;
    --warn-soft: #fff8ea;
    --radius: 4px;
    --shadow: 0 10px 24px rgba(23, 35, 52, 0.08);
}

* {
    box-sizing: border-box;
}

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

body {
    font-family: "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(47, 124, 246, 0.12), transparent 24%),
        linear-gradient(180deg, #f8fbff 0%, #f4f7fb 38%, #eef4fb 100%);
    -webkit-font-smoothing: antialiased;
    padding: 10px 10px 22px;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select {
    font: inherit;
}

.page {
    width: min(100%, 730px);
    margin: 0 auto;
}

.hero,
.summary-card,
.feedback-box,
.match-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
    box-shadow: var(--shadow);
}

.hero {
    overflow: hidden;
}

.hero-top {
    padding: 14px 14px 10px;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    background: linear-gradient(135deg, #4e95ff 0%, #2f7cf6 100%);
    color: #fff;
}

.eyebrow {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    opacity: 0.92;
}

.hero h1 {
    margin: 6px 0 0;
    font-size: 24px;
    line-height: 1.1;
}

.hero p {
    margin: 10px 0 0;
    font-size: 12px;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.92);
}

.ghost-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 0 12px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
    white-space: nowrap;
}

.version-strip {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 10px;
    align-items: center;
    padding: 10px 14px;
    background: #f7fbff;
    border-top: 1px solid #d7e6fb;
    border-bottom: 1px solid var(--border);
}

.version-card {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
}

.version-card.from {
    background: var(--from-soft);
    border-color: #cfe2ff;
}

.version-card.to {
    background: var(--to-soft);
    border-color: #ffd7b6;
}

.version-card .label {
    display: block;
    color: var(--muted);
    font-size: 12px;
}

.version-card strong {
    display: block;
    margin-top: 4px;
    font-size: 20px;
    color: var(--text);
}

.version-divider {
    color: var(--muted-soft);
    font-size: 12px;
    font-weight: 700;
}

.filter-panel {
    padding: 10px 14px 12px;
    background: var(--card);
}

.filter-grid,
.summary,
.metric-row,
.diff-bars,
.model-grid,
.review-grid,
.lambda-row {
    display: grid;
    gap: 10px;
}

.filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.field,
.toggle {
    display: flex;
    gap: 6px;
}

.field {
    flex-direction: column;
}

.field span,
.toggle span,
.metric .k,
.prob-group-title,
.lottery-id,
.match-time,
.model-sub,
.half-score,
.tip-row,
.summary-card .key,
.summary-card .sub,
.review-item {
    color: var(--muted);
}

.field input,
.field select {
    width: 100%;
    min-height: 38px;
    padding: 0 12px;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
    outline: none;
}

.field input:focus,
.field select:focus {
    border-color: #9fc0f9;
    box-shadow: 0 0 0 3px rgba(47, 124, 246, 0.1);
}

.field select option {
    background: #fff;
    color: var(--text);
}

.toggle {
    align-items: center;
    min-height: 38px;
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card-soft);
}

.toggle input {
    margin: 0;
}

.button-row {
    margin-top: 10px;
    display: flex;
    gap: 10px;
}

.btn {
    appearance: none;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    min-height: 38px;
    padding: 0 14px;
    color: var(--text);
    background: #fff;
    cursor: pointer;
    font-weight: 700;
}

.btn.primary {
    color: #fff;
    border-color: var(--from);
    background: linear-gradient(135deg, #4e95ff, var(--from));
    box-shadow: 0 8px 18px rgba(47, 124, 246, 0.18);
}

.tip-row {
    margin-top: 8px;
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: 12px;
    line-height: 1.6;
}

.summary {
    margin-top: 10px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.summary-card {
    padding: 10px;
    background: linear-gradient(180deg, #ffffff 0%, #f9fbfe 100%);
}

.summary-card .value {
    margin-top: 6px;
    font-size: 22px;
    font-weight: 800;
    line-height: 1;
    color: var(--text);
}

.summary-card .sub {
    margin-top: 6px;
    font-size: 11px;
    line-height: 1.5;
}

.feedback {
    margin-top: 10px;
}

.feedback-box {
    padding: 12px 10px;
    font-size: 12px;
    line-height: 1.6;
    color: var(--muted);
    background: #fff;
}

.feedback-box.loading::before {
    content: "";
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-right: 8px;
    border: 2px solid #d9e6fb;
    border-top-color: var(--from);
    border-radius: 50%;
    vertical-align: -2px;
    animation: spin 0.8s linear infinite;
}

.feedback-box.error {
    color: var(--danger);
    background: var(--danger-soft);
    border-color: #f1c7cf;
}

.match-list {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.match-card {
    overflow: hidden;
}

.match-card.high-gap {
    border-color: #f0b562;
    box-shadow: 0 0 0 1px rgba(201, 122, 18, 0.18), 0 10px 24px rgba(201, 122, 18, 0.12);
}

.match-card.error {
    border-color: #f1c7cf;
    background: linear-gradient(180deg, #fffafb 0%, #ffffff 100%);
}

.card-head,
.card-body,
.card-detail {
    padding: 10px;
}

.card-head {
    border-bottom: 1px solid #edf2f7;
    background: linear-gradient(180deg, #ffffff 0%, #f9fbff 100%);
}

.meta-row,
.team-row,
.diff-title,
.detail-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.meta-left,
.meta-right,
.teams,
.tag-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.league {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 700;
    color: var(--text);
}

.league-color {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    box-shadow: 0 0 0 3px rgba(47, 124, 246, 0.08);
}

.team-row {
    margin-top: 8px;
    align-items: center;
}

.team-name {
    font-size: 16px;
    font-weight: 800;
    line-height: 1.3;
}

.handicap {
    display: inline-flex;
    align-items: center;
    min-height: 20px;
    margin-left: 6px;
    padding: 0 6px;
    border-radius: var(--radius);
    font-size: 11px;
    font-weight: 700;
    border: 1px solid transparent;
    vertical-align: 1px;
}

.handicap.positive {
    color: var(--danger);
    background: var(--danger-soft);
    border-color: #f1c7cf;
}

.handicap.negative {
    color: var(--good);
    background: var(--good-soft);
    border-color: #ccebdc;
}

.vs {
    min-height: 20px;
    padding: 0 7px;
    display: inline-flex;
    align-items: center;
    border-radius: var(--radius);
    background: #eff6ff;
    color: var(--from);
    font-size: 10px;
    font-weight: 700;
    border: 1px solid #dceaff;
}

.score-box {
    text-align: right;
}

.score {
    font-size: 22px;
    font-weight: 800;
    line-height: 1;
}

.half-score {
    margin-top: 3px;
    font-size: 12px;
}

.tag {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 0 7px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 10px;
    font-weight: 700;
    color: #43556b;
    background: #f9fafb;
}

.tag.from {
    border-color: #cfe2ff;
    background: var(--from-soft);
    color: #1f5dc2;
}

.tag.to {
    border-color: #ffd7b6;
    background: var(--to-soft);
    color: #b96311;
}

.tag.good {
    border-color: #ccebdc;
    background: var(--good-soft);
    color: var(--good);
}

.tag.warn {
    border-color: #f4dfab;
    background: var(--warn-soft);
    color: var(--warn);
}

.tag.danger {
    border-color: #f1c7cf;
    background: var(--danger-soft);
    color: var(--danger);
}

.metric-row {
    margin-top: 10px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    display: none;
}

.metric-row.is-open {
    display: grid;
}

.metric-toggle {
    margin-top: 10px;
    width: 100%;
}

.metric {
    padding: 8px;
    border: 1px solid #edf2f7;
    border-radius: var(--radius);
    background: var(--card-soft);
}

.metric .k {
    font-size: 11px;
}

.metric .v {
    margin-top: 4px;
    font-size: 16px;
    font-weight: 800;
    color: var(--text);
}

.metric .v.highlight {
    color: var(--warn);
}

.card-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #fff;
}

.diff-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.diff-title strong {
    font-size: 13px;
}

.diff-title span {
    color: var(--muted);
    font-size: 11px;
}

.diff-bars {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
}

.diff-bar {
    padding: 8px;
    border: 1px solid #edf2f7;
    border-radius: var(--radius);
    background: var(--card-soft);
}

.diff-bar .label {
    display: flex;
    justify-content: space-between;
    gap: 6px;
    color: var(--muted);
    font-size: 11px;
}

.diff-track,
.prob-track {
    position: relative;
    height: 8px;
    border-radius: 999px;
    background: #eaf0f7;
    overflow: hidden;
}

.diff-track {
    margin-top: 6px;
}

.diff-fill,
.prob-fill {
    position: absolute;
    top: 0;
    height: 100%;
}

.diff-fill.pos {
    left: 50%;
    background: linear-gradient(90deg, #8ec1ff, var(--from));
}

.diff-fill.neg {
    right: 50%;
    background: linear-gradient(90deg, var(--to), #ffc48a);
}

.diff-value {
    margin-top: 6px;
    font-size: 14px;
    font-weight: 800;
}

.diff-value.pos {
    color: var(--from);
}

.diff-value.neg {
    color: var(--to);
}

.detail-toggle {
    width: 100%;
}

.card-detail {
    display: none;
    border-top: 1px solid #edf2f7;
    background: #fbfdff;
}

.match-card.expanded .card-detail {
    display: block;
    animation: fadeIn 0.2s ease;
}

.detail-head,
.review-grid {
    align-items: center;
}

.detail-head strong,
.model-box h3,
.review-box h3 {
    font-size: 13px;
    color: var(--text);
}

.model-grid {
    margin-top: 8px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.model-box,
.review-box {
    padding: 10px;
    border: 1px solid #edf2f7;
    border-radius: var(--radius);
    background: #fff;
}

.model-box.from {
    background: linear-gradient(180deg, #ffffff 0%, #f7fbff 100%);
    box-shadow: inset 0 0 0 1px #d9e9ff;
}

.model-box.to {
    background: linear-gradient(180deg, #ffffff 0%, #fff9f4 100%);
    box-shadow: inset 0 0 0 1px #ffe2c8;
}

.model-box h3,
.review-box h3 {
    margin: 0;
}

.model-sub {
    margin-top: 3px;
    font-size: 12px;
}

.lambda-row {
    margin-top: 8px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.mini-stat {
    padding: 7px;
    border-radius: var(--radius);
    background: #f8fafc;
}

.mini-stat .k,
.prob-item .name {
    color: var(--muted);
    font-size: 11px;
}

.mini-stat .v {
    margin-top: 3px;
    font-size: 15px;
    font-weight: 800;
    color: var(--text);
}

.prob-group {
    margin-top: 10px;
}

.prob-list {
    margin-top: 6px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.prob-item {
    display: grid;
    grid-template-columns: 28px 1fr auto;
    gap: 8px;
    align-items: center;
}

.prob-fill.from {
    left: 0;
    background: linear-gradient(90deg, #8ec1ff, var(--from));
}

.prob-fill.to {
    left: 0;
    background: linear-gradient(90deg, #ffc48a, var(--to));
}

.prob-value {
    font-size: 12px;
    font-weight: 700;
    color: var(--text);
}

.review-box {
    margin-top: 8px;
}

.review-box.dimmed {
    opacity: 0.62;
}

.review-grid {
    margin-top: 8px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.review-column {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.review-column-title {
    padding: 8px 10px;
    border: 1px solid #edf2f7;
    border-radius: var(--radius);
    background: #f8fafc;
    color: var(--text);
    font-size: 12px;
    font-weight: 800;
}

.review-item {
    padding: 8px 9px;
    border-radius: var(--radius);
    background: #f8fafc;
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 12px;
}

.review-item .result {
    font-weight: 800;
}

.review-item .result.hit {
    color: var(--danger);
}

.review-item .result.miss {
    color: var(--good);
}

.error-note {
    margin-top: 8px;
    padding: 8px;
    border-radius: var(--radius);
    background: var(--danger-soft);
    color: var(--danger);
    font-size: 12px;
    line-height: 1.6;
    border: 1px solid #f1c7cf;
}

.site-footer {
    margin-top: 12px;
    padding: 12px 10px 14px;
    text-align: center;
    color: var(--muted);
    font-size: 12px;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

.law-note {
    color: #b83a53;
    line-height: 1.6;
}

.footer-links {
    margin-top: 10px;
    display: flex;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 640px) {
    .hero-top,
    .meta-row,
    .team-row,
    .diff-title,
    .detail-head,
    .tip-row {
        flex-direction: column;
        align-items: stretch;
    }

    .version-strip,
    .filter-grid,
    .summary,
    .metric-row,
    .diff-bars,
    .model-grid,
    .review-grid,
    .lambda-row {
        grid-template-columns: 1fr;
    }

    .button-row {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .score-box {
        text-align: left;
    }
}
