:root {
    color-scheme: light;
    --ink: #1d2025;
    --muted: #676d76;
    --line: #d8dce1;
    --surface: #ffffff;
    --canvas: #eceff2;
    --module-head: #202329;
    --module-head-soft: #2c3036;
    --red: #c92a2a;
    --blue: #2266b3;
    --green: #21854a;
    --gold: #b18a2d;
    --gold-bright: #d0ad55;
    --gold-pale: #f6eed5;
    --radius: 8px;
}

* {
    box-sizing: border-box;
}

html {
    background: var(--canvas);
    color: var(--ink);
    font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
    line-height: 1.5;
    overflow-x: hidden;
}

body {
    margin: 0;
    min-width: 320px;
}

button,
input {
    font: inherit;
}

.shell {
    width: min(1280px, calc(100% - 32px));
    margin-inline: auto;
}

.site-header {
    background: #202329;
    color: #fff;
    border-bottom: 3px solid var(--gold);
}

.header-inner {
    min-height: 112px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 0;
    font-size: 30px;
    font-weight: 800;
    letter-spacing: 0;
}

h2 {
    margin-bottom: 0;
    font-size: 20px;
    letter-spacing: 0;
}

h3 {
    margin-bottom: 10px;
    font-size: 15px;
    letter-spacing: 0;
}

.eyebrow {
    margin-bottom: 4px;
    color: #c9a64d;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.sync-state {
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 360px;
    color: #e2e6ea;
    font-size: 13px;
    text-align: right;
}

.status-dot {
    width: 9px;
    height: 9px;
    flex: 0 0 9px;
    border-radius: 50%;
    background: #d39b1d;
}

.status-dot.is-ok {
    background: #39ad69;
}

.dashboard {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
    gap: 16px;
    padding-block: 20px;
}

.panel {
    min-width: 0;
    padding: 20px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.module-box {
    position: relative;
    min-width: 0;
    padding: 0 20px 20px;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid #c9cdd3;
    border-top: 3px solid var(--gold);
    border-radius: var(--radius);
    box-shadow: 0 3px 10px rgb(23 27 32 / 8%);
}

.trend-panel,
.history-panel,
.settlement-panel,
.performance-panel,
.ad-placement {
    grid-column: 1 / -1;
}

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

.module-heading {
    position: relative;
    min-height: 72px;
    align-items: center;
    margin: 0 -20px 18px;
    padding: 12px 18px;
    border-left: 0;
    border-bottom: 1px solid #111419;
    background: var(--module-head);
    color: #fff;
}

.module-heading h2 {
    color: #fff;
}

.module-heading-accent {
    position: absolute;
    left: 18px;
    bottom: -1px;
    width: 72px;
    height: 3px;
    background: var(--gold-bright);
}

.module-heading .eyebrow {
    margin-bottom: 2px;
    color: #dfc67e;
}

.module-heading time {
    color: #d6d9dc;
}

.heading-actions {
    display: grid;
    justify-items: end;
    gap: 4px;
}

.heading-actions a,
.history-home-link {
    color: #f0d58e;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
}

.section-heading time,
.metadata,
.issue {
    color: var(--muted);
    font-size: 13px;
}

.issue {
    margin-bottom: 12px;
}

.balls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.balls.compact {
    gap: 8px;
}

.ball {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    display: inline-grid;
    place-items: center;
    border: 2px solid currentColor;
    border-radius: 50%;
    background: #fff;
    color: var(--ink);
    font-size: 15px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.number-badge {
    width: 44px;
    flex: 0 0 44px;
    display: grid;
    justify-items: center;
    align-content: start;
    padding-block: 2px;
    gap: 3px;
}

.number-badge .ball {
    flex: none;
}

.ball-zodiac {
    width: 100%;
    overflow: hidden;
    color: var(--muted);
    font-size: 11px;
    line-height: 16px;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.compact .ball,
.metric-row .ball {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
    font-size: 13px;
}

.compact .number-badge {
    width: 36px;
    flex-basis: 36px;
}

.ball-red {
    color: var(--red);
}

.ball-blue {
    color: var(--blue);
}

.ball-green {
    color: var(--green);
}

.ball-special {
    box-shadow: 0 0 0 3px #f3e7bc;
}

.ball-hit {
    background: #fff8dc;
}

.plus {
    color: var(--muted);
    font-weight: 800;
}

.lock-label,
.outcome {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 4px 9px;
    border: 1px solid #dcc47a;
    border-radius: 6px;
    background: #fff9e8;
    color: #76570f;
    font-size: 12px;
    font-weight: 700;
}

.candidate-group + .candidate-group {
    margin-top: 18px;
}

.metadata {
    margin: 14px 0 0;
}

.settlement-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 16px;
    margin-bottom: 14px;
}

.tabs {
    display: inline-flex;
    gap: 4px;
    padding: 4px;
    margin-bottom: 16px;
    border: 1px solid #c9cdd3;
    border-radius: 7px;
    background: #e8ebef;
}

.tabs button {
    min-width: 70px;
    min-height: 36px;
    padding: 6px 12px;
    border: 0;
    border-radius: 5px;
    background: transparent;
    color: #5b616b;
    cursor: pointer;
}

.tabs button[aria-selected="true"] {
    border-bottom: 3px solid var(--gold-bright);
    background: var(--module-head);
    color: #fff;
}

.trend-columns {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 28px;
}

.metric-row {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr);
    align-items: start;
    gap: 10px;
    padding-block: 8px;
    border-top: 1px solid #eef0f2;
}

.metric-label {
    padding-top: 7px;
    color: var(--muted);
    font-size: 13px;
}

.metric-values {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.metric-item {
    display: grid;
    justify-items: center;
    gap: 2px;
}

.metric-item small {
    color: var(--muted);
    font-size: 10px;
}

.structure-list,
.performance-grid {
    margin: 0;
}

.module-box[data-module="latest"],
.module-box[data-module="prediction"] {
    min-height: 250px;
}

.module-box[data-module="performance"] {
    border-bottom-color: #b9bec5;
}

.structure-list > div,
.performance-grid > div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 11px 0;
    border-top: 1px solid #eef0f2;
}

dt {
    color: var(--muted);
}

dd {
    margin: 0;
    font-weight: 750;
}

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

.table-scroll {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    min-width: 680px;
    border-collapse: collapse;
}

th,
td {
    padding: 11px 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    white-space: nowrap;
}

th {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.performance-table thead,
.history-panel thead {
    background: #2b2f35;
}

.performance-table thead th,
.history-panel thead th {
    color: #f1dfaa;
}

td {
    font-size: 13px;
}

.empty-state {
    margin-bottom: 0;
    padding: 14px 0;
    color: var(--muted);
}

.ad-placement {
    display: grid;
    grid-template-columns: minmax(180px, 0.7fr) minmax(0, 1.3fr);
    align-items: center;
    gap: 18px;
    min-width: 0;
    padding: 10px;
    border: 1px solid #d9c98e;
    border-radius: 8px;
    background: #fffdf5;
}

.ad-placement > a {
    display: block;
    min-width: 0;
}

.ad-text-only {
    grid-template-columns: minmax(0, 1fr);
}

.ad-placement img {
    width: 100%;
    max-height: 150px;
    display: block;
    object-fit: contain;
    aspect-ratio: 4 / 1;
    border-radius: 5px;
    background: #fff;
}

.ad-copy strong {
    display: block;
    color: #594714;
    font-size: 15px;
}

.ad-copy p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.footer-ad {
    margin-block: 0 20px;
}

.risk-notice {
    white-space: pre-line;
}

.history-page {
    padding-block: 20px;
}

.history-draw-panel {
    padding: 0;
    overflow: hidden;
}

.history-draw-panel > .section-heading {
    padding: 18px;
    border-bottom: 1px solid var(--line);
}

.history-limit-nav {
    display: inline-flex;
    gap: 5px;
}

.history-limit-nav a,
.history-page-actions a {
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    padding: 6px 11px;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--ink);
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
}

.history-limit-nav a[aria-current="page"] {
    border-color: #202329;
    background: #202329;
    color: #fff;
}

.draw-history-list {
    padding-inline: 18px;
}

.draw-history-row {
    display: grid;
    grid-template-columns: 190px minmax(0, 1fr);
    align-items: center;
    gap: 18px;
    padding-block: 15px;
    border-bottom: 1px solid #e8eaed;
}

.draw-history-row:last-child {
    border-bottom: 0;
}

.draw-history-meta {
    display: grid;
    gap: 3px;
}

.draw-history-meta time {
    color: var(--muted);
    font-size: 12px;
}

.history-page-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 14px;
}

.site-footer {
    padding: 24px 0 32px;
    background: #202329;
    color: #d6d9dc;
    font-size: 13px;
}

.site-footer strong {
    color: #f0d58e;
}

.site-footer p {
    margin: 6px 0 0;
}

@media (max-width: 767px) {
    .shell {
        width: min(100% - 20px, 1280px);
    }

    .header-inner {
        min-height: 132px;
        align-items: flex-start;
        flex-direction: column;
        justify-content: center;
        gap: 12px;
    }

    h1 {
        font-size: 24px;
    }

    .sync-state {
        text-align: left;
    }

    .dashboard {
        grid-template-columns: minmax(0, 1fr);
        gap: 10px;
        padding-block: 10px;
    }

    .trend-panel,
    .history-panel,
    .settlement-panel,
    .performance-panel,
    .ad-placement {
        grid-column: auto;
    }

    .panel {
        padding: 16px;
    }

    .module-box {
        padding: 0 14px 16px;
    }

    .module-box[data-module="latest"],
    .module-box[data-module="prediction"] {
        min-height: 0;
    }

    .module-heading {
        min-height: 66px;
        margin-inline: -14px;
        padding-inline: 13px;
    }

    .module-heading-accent {
        left: 13px;
    }

    .section-heading {
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
    }

    .trend-columns,
    .performance-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 0;
    }

    .tabs {
        width: 100%;
    }

    .tabs button {
        min-width: 0;
        flex: 1 1 0;
    }

    .ball {
        width: 38px;
        height: 38px;
        flex-basis: 38px;
    }

    .number-badge {
        width: 40px;
        flex-basis: 40px;
    }

    .compact .number-badge {
        width: 36px;
        flex-basis: 36px;
    }

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

    .ad-placement {
        grid-template-columns: minmax(0, 1fr);
        gap: 9px;
    }

    .ad-placement img {
        max-height: 120px;
        aspect-ratio: 3 / 1;
    }

    .history-draw-panel {
        padding: 0;
    }

    .history-limit-nav {
        width: 100%;
    }

    .history-limit-nav a {
        flex: 1 1 0;
        justify-content: center;
    }

    .draw-history-row {
        grid-template-columns: minmax(0, 1fr);
        gap: 10px;
    }
}
