:root {
    color-scheme: light;
    --accent: #ff6b16;
    --accent-2: #ff9a43;
    --accent-soft: #fff1e8;
    --accent-glow: rgba(255, 107, 22, .22);
    --page: #f6f8fb;
    --surface: #ffffff;
    --surface-2: #f0f4f8;
    --line: #dce4ee;
    --text: #172033;
    --muted: #8492a8;
    --footer: #17243a;
    --success: #1fc875;
    --danger: #ef4444;
    --blue: #3177f5;
    --shadow: 0 12px 34px rgba(22, 34, 56, .08);
    --header-gradient: linear-gradient(118deg, #ff6815 0%, #ff9a43 100%);
}

body.theme-dark {
    color-scheme: dark;
    --accent: #28d8ff;
    --accent-2: #7c5cff;
    --accent-soft: rgba(40, 216, 255, .12);
    --accent-glow: rgba(40, 216, 255, .25);
    --page: #07111f;
    --surface: #0d1b2d;
    --surface-2: #12243a;
    --line: #203b58;
    --text: #e8f6ff;
    --muted: #7e9bb6;
    --footer: #030a13;
    --success: #32e68f;
    --blue: #47a7ff;
    --shadow: 0 16px 42px rgba(0, 0, 0, .34);
    --header-gradient: radial-gradient(circle at 24% 10%, rgba(38, 208, 255, .24), transparent 30%), linear-gradient(125deg, #071522, #0e2841 60%, #15234b);
}

body.theme-blue {
    --accent: #2475ef;
    --accent-2: #51a6ff;
    --accent-soft: #eaf3ff;
    --accent-glow: rgba(36, 117, 239, .22);
    --page: #f1f6fc;
    --surface: #ffffff;
    --surface-2: #edf4fb;
    --line: #d4e1ef;
    --text: #14263e;
    --muted: #7890ab;
    --footer: #10243e;
    --success: #13bf76;
    --blue: #2475ef;
    --shadow: 0 14px 36px rgba(28, 77, 132, .1);
    --header-gradient: linear-gradient(120deg, #155fd2, #52a7ff);
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--page);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
    font-size: 14px;
    transition: background-color .25s ease, color .25s ease;
}

button, input {
    font: inherit;
}

button, a {
    -webkit-tap-highlight-color: transparent;
}

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

.site-header {
    position: sticky;
    top: 0;
    z-index: 40;
    height: 58px;
    color: #fff;
    background: var(--header-gradient);
    border-bottom: 1px solid rgba(255, 255, 255, .15);
    backdrop-filter: blur(14px);
}

.header-inner {
    width: min(1120px, calc(100% - 32px));
    height: 100%;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 17px;
    font-weight: 800;
    letter-spacing: .02em;
}

.brand-mark {
    width: 29px;
    height: 29px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    color: var(--accent);
    background: #fff;
    box-shadow: 0 5px 16px rgba(0, 0, 0, .14);
    font-size: 15px;
}

.theme-trigger {
    border: 1px solid rgba(255, 255, 255, .2);
    color: #fff;
    background: rgba(255, 255, 255, .15);
    border-radius: 999px;
    height: 34px;
    padding: 0 14px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.theme-panel {
    position: fixed;
    z-index: 70;
    top: 52px;
    right: max(18px, calc((100vw - 1120px) / 2));
    width: 158px;
    padding: 8px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: var(--shadow);
}

.theme-panel button {
    width: 100%;
    border: 0;
    background: transparent;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: 9px;
    cursor: pointer;
    text-align: left;
}

.theme-panel button:hover {
    background: var(--surface-2);
}

.theme-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: inline-block;
    box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .25);
}

.theme-dot.orange { background: #ff721c; }
.theme-dot.dark { background: #10293e; }
.theme-dot.blue { background: #2a7ff1; }

.home-main {
    width: min(1120px, calc(100% - 32px));
    margin: 14px auto 34px;
}

.notice {
    height: 42px;
    display: flex;
    align-items: center;
    overflow: hidden;
    border: 1px solid color-mix(in srgb, var(--accent) 16%, var(--line));
    border-radius: 12px;
    background: var(--accent-soft);
    color: var(--muted);
}

.notice-title {
    flex: 0 0 auto;
    padding: 0 15px;
    color: var(--accent);
    font-weight: 700;
}

.notice-track {
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
}

.notice-track span {
    display: inline-block;
    padding-left: 8px;
}

.category-tabs {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 0 12px;
    overflow-x: auto;
    scrollbar-width: none;
}

.category-tabs::-webkit-scrollbar {
    display: none;
}

.category-tabs button,
.date-filters button {
    flex: 0 0 auto;
    border: 1px solid transparent;
    color: var(--muted);
    background: transparent;
    border-radius: 999px;
    padding: 9px 16px;
    cursor: pointer;
    transition: .2s ease;
}

.category-tabs button:hover,
.category-tabs button.active,
.date-filters button:hover,
.date-filters button.active {
    color: #fff;
    background: var(--accent);
    box-shadow: 0 7px 18px var(--accent-glow);
}

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

.lottery-card {
    position: relative;
    min-height: 154px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: 0 1px 0 rgba(255, 255, 255, .5);
    overflow: hidden;
    cursor: pointer;
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.lottery-card:hover {
    transform: translateY(-2px);
    border-color: color-mix(in srgb, var(--accent) 44%, var(--line));
    box-shadow: var(--shadow);
}

.card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.game-identity {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 11px;
}

.game-icon {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 12px;
    line-height: 1.05;
    font-weight: 900;
    text-align: center;
    box-shadow: 0 8px 18px rgba(20, 38, 62, .15), inset 0 1px 0 rgba(255, 255, 255, .28);
}

.game-icon.race { background: linear-gradient(145deg, #ff7a18, #ff4b12); }
.game-icon.ssc { background: linear-gradient(145deg, #7657ff, #4325d0); }
.game-icon.happy { background: linear-gradient(145deg, #17c6a2, #0a8e94); }
.game-icon.k3 { background: linear-gradient(145deg, #ef5164, #c92845); }
.game-icon.choose5 { background: linear-gradient(145deg, #4ea2ff, #2562d6); }
.game-icon.keno, .game-icon.pc28 { background: linear-gradient(145deg, #20b7df, #286be3); }
.game-icon.marksix { background: linear-gradient(145deg, #845aff, #4b21cd); }
.game-icon.number { background: linear-gradient(145deg, #8190a5, #4b5a6f); }

.game-name {
    max-width: 235px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 800;
    font-size: 15px;
}

.issue-line {
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
}

.countdown-box {
    flex: 0 0 auto;
    text-align: right;
}

.countdown {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 5px;
    color: var(--accent);
    font-weight: 900;
    font-size: 16px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.live-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 0 5px color-mix(in srgb, var(--success) 14%, transparent);
}

.countdown-label {
    margin-top: 5px;
    color: var(--muted);
    font-size: 11px;
}

.ball-row {
    min-height: 33px;
    margin-top: 15px;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.ball {
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    display: inline-grid;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    background: linear-gradient(145deg, #5bb8ff, #2c81de);
    box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .12), 0 3px 7px rgba(32, 97, 164, .18);
    font-weight: 800;
    font-size: 13px;
}

.ball.race-ball {
    width: 25px;
    height: 25px;
    border-radius: 4px;
    color: #fff;
    font-style: italic;
    text-shadow: 0 1px 1px rgba(0, 0, 0, .45);
}

.race-ball.n1 { background: #f3e900; color: #222; }
.race-ball.n2 { background: #1688db; }
.race-ball.n3 { background: #414141; }
.race-ball.n4 { background: #f27422; }
.race-ball.n5 { background: #67d8d3; color: #17354b; }
.race-ball.n6 { background: #6137d8; }
.race-ball.n7 { background: #d7d7d7; color: #414141; }
.race-ball.n8 { background: #ef2329; }
.race-ball.n9 { background: #8e0b0e; }
.race-ball.n10 { background: #18a727; }

.ball.dice-ball {
    border-radius: 8px;
    background: linear-gradient(145deg, #ff6f75, #dc3046);
    font-size: 16px;
}

.ball.mark6-red { background: linear-gradient(145deg, #fb6868, #d42c35); }
.ball.mark6-blue { background: linear-gradient(145deg, #5a9cff, #275cc9); }
.ball.mark6-green { background: linear-gradient(145deg, #52bd87, #218b5e); }

.plus-ball {
    color: var(--muted);
    font-weight: 900;
    padding: 0 2px;
}

.card-bottom {
    min-height: 24px;
    margin-top: 10px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 10px;
}

.summary-line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 7px;
    font-size: 12px;
}

.summary-line b { color: var(--accent); }
.summary-line .odd { color: var(--danger); }
.summary-line .even { color: var(--blue); }
.summary-line .big { color: var(--danger); }
.summary-line .small { color: var(--blue); }
.summary-line .dragon { color: var(--danger); }
.summary-line .tiger { color: var(--blue); }

.mini-progress {
    width: 64px;
    height: 4px;
    margin-bottom: 4px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--accent) 22%, var(--surface-2));
    overflow: hidden;
}

.mini-progress i {
    display: block;
    width: 58%;
    height: 100%;
    background: var(--accent);
    border-radius: inherit;
}

.no-result {
    color: var(--muted);
    font-size: 13px;
}

.empty-state,
.not-found {
    min-height: 360px;
    display: grid;
    place-content: center;
    text-align: center;
    color: var(--muted);
}

.empty-icon {
    width: 62px;
    height: 62px;
    margin: 0 auto 12px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    color: var(--accent);
    background: var(--accent-soft);
    font-size: 30px;
}

.primary-link {
    display: inline-flex;
    margin: 10px auto 0;
    padding: 10px 18px;
    border-radius: 999px;
    color: #fff;
    background: var(--accent);
}

.site-footer {
    min-height: 92px;
    padding: 22px 16px;
    display: grid;
    place-content: center;
    gap: 5px;
    text-align: center;
    color: #8fa5c2;
    background: var(--footer);
    font-size: 12px;
}

.site-footer p {
    margin: 0;
}

.mobile-nav {
    display: none;
}

.skeleton-card {
    cursor: default;
}

.skeleton {
    border-radius: 9px;
    background: linear-gradient(90deg, var(--surface-2), color-mix(in srgb, var(--surface-2) 50%, var(--surface)), var(--surface-2));
    background-size: 200% 100%;
    animation: skeleton 1.35s infinite;
}

.icon-skeleton { width: 40px; height: 40px; }
.line-skeleton { width: 45%; height: 12px; margin: -31px 0 0 53px; }
.balls-skeleton { width: 68%; height: 28px; margin-top: 38px; }

@keyframes skeleton {
    to { background-position: -200% 0; }
}

/* 详情页 */
.detail-main {
    min-height: calc(100vh - 150px);
}

.detail-hero {
    padding: 18px max(16px, calc((100vw - 1120px) / 2)) 20px;
    color: #fff;
    background: var(--header-gradient);
    border-radius: 0 0 24px 24px;
}

.detail-titlebar {
    min-height: 42px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
}

.detail-titlebar h1 {
    margin: 0;
    font-size: 18px;
    text-align: center;
}

.back-link {
    width: max-content;
    color: rgba(255, 255, 255, .92);
}

.type-badge {
    justify-self: end;
    padding: 5px 10px;
    border: 1px solid rgba(255, 255, 255, .2);
    border-radius: 999px;
    background: rgba(255, 255, 255, .12);
    font-size: 11px;
}

.latest-panel {
    min-height: 145px;
    margin-top: 8px;
    padding: 18px;
    border: 1px solid rgba(255, 255, 255, .28);
    border-radius: 17px;
    background: rgba(255, 255, 255, .15);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12);
}

.latest-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.latest-issue {
    color: rgba(255, 255, 255, .9);
    font-weight: 700;
}

.latest-panel .ball-row {
    justify-content: center;
    margin-top: 13px;
}

.latest-panel .summary-line {
    justify-content: center;
    margin-top: 8px;
    color: #fff;
}

.latest-panel .summary-line b,
.latest-panel .summary-line span {
    color: #fff;
}

.hero-countdown {
    margin-top: 14px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 12px;
    color: rgba(255, 255, 255, .85);
    font-size: 12px;
}

.hero-progress {
    height: 4px;
    border-radius: 99px;
    background: rgba(255, 255, 255, .25);
    overflow: hidden;
}

.hero-progress i {
    display: block;
    height: 100%;
    width: 64%;
    background: #fff;
}

.hero-countdown time {
    color: #fff;
    font-size: 17px;
    font-weight: 900;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.detail-content {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto 34px;
}

.detail-tabs {
    height: 54px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    border-bottom: 1px solid var(--line);
}

.detail-tabs button {
    position: relative;
    border: 0;
    color: var(--muted);
    background: transparent;
    cursor: pointer;
}

.detail-tabs button.active {
    color: var(--accent);
    font-weight: 700;
}

.detail-tabs button.active::after {
    content: "";
    position: absolute;
    left: 14%;
    right: 14%;
    bottom: -1px;
    height: 2px;
    background: var(--accent);
}

.detail-pane {
    display: none;
}

.detail-pane.active {
    display: block;
}

.date-filters {
    padding: 12px 0;
    display: flex;
    gap: 7px;
    overflow-x: auto;
}

.date-filters button {
    padding: 7px 13px;
    border-color: var(--line);
    border-radius: 9px;
    background: var(--surface);
}

.history-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
}

.history-table {
    width: 100%;
    min-width: 810px;
    border-collapse: collapse;
    font-size: 12px;
}

.history-table th {
    height: 42px;
    padding: 8px 10px;
    color: var(--muted);
    background: var(--surface-2);
    font-weight: 700;
    white-space: nowrap;
}

.history-table td {
    height: 38px;
    padding: 5px 10px;
    text-align: center;
    border-top: 1px solid var(--line);
    white-space: nowrap;
}

.history-table tbody tr:nth-child(even) {
    background: color-mix(in srgb, var(--surface-2) 52%, transparent);
}

.history-table .ball-row {
    min-height: 0;
    margin: 0;
    justify-content: center;
    flex-wrap: nowrap;
}

.history-table .ball {
    width: 22px;
    height: 22px;
    font-size: 11px;
}

.history-table .race-ball {
    width: 21px;
    height: 21px;
}

.table-loading {
    height: 160px !important;
    color: var(--muted);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    padding: 18px 0;
}

.stat-card,
.streak-item {
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
}

.stat-card span,
.streak-item span {
    color: var(--muted);
    font-size: 12px;
}

.stat-card strong {
    display: block;
    margin-top: 7px;
    color: var(--accent);
    font-size: 25px;
}

.streak-list {
    display: grid;
    gap: 10px;
    padding: 18px 0;
}

.streak-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.streak-item strong {
    color: var(--accent);
}

@media (max-width: 720px) {
    body {
        padding-bottom: calc(60px + env(safe-area-inset-bottom));
    }

    .site-header {
        height: 50px;
    }

    .header-inner,
    .home-main,
    .detail-content {
        width: calc(100% - 28px);
    }

    .brand {
        font-size: 14px;
    }

    .brand-mark {
        width: 25px;
        height: 25px;
        border-radius: 8px;
        font-size: 13px;
    }

    .theme-trigger {
        height: 30px;
        padding: 0 10px;
        font-size: 12px;
    }

    .theme-trigger span:last-child {
        display: none;
    }

    .theme-panel {
        top: 46px;
        right: 12px;
    }

    .home-main {
        margin-top: 10px;
    }

    .notice {
        height: 39px;
        border-radius: 11px;
    }

    .notice-title {
        padding: 0 11px;
    }

    .notice-track {
        position: relative;
        flex: 1;
    }

    .notice-track span {
        animation: marquee 13s linear infinite;
        padding-left: 100%;
    }

    @keyframes marquee {
        to { transform: translateX(-100%); }
    }

    .category-tabs {
        margin: 0 -14px;
        padding: 12px 14px 10px;
    }

    .category-tabs button {
        padding: 8px 14px;
        font-size: 13px;
    }

    .lottery-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .lottery-card {
        min-height: 142px;
        padding: 15px;
        border-radius: 15px;
    }

    .game-icon {
        width: 38px;
        height: 38px;
    }

    .game-name {
        max-width: 155px;
        font-size: 14px;
    }

    .countdown {
        font-size: 15px;
    }

    .ball-row {
        margin-top: 13px;
        gap: 5px;
    }

    .ball {
        width: 28px;
        height: 28px;
    }

    .ball.race-ball {
        width: 23px;
        height: 23px;
    }

    .site-footer {
        display: none;
    }

    .mobile-nav {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 60;
        height: calc(58px + env(safe-area-inset-bottom));
        padding-bottom: env(safe-area-inset-bottom);
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        border-top: 1px solid var(--line);
        background: color-mix(in srgb, var(--surface) 92%, transparent);
        backdrop-filter: blur(16px);
        box-shadow: 0 -10px 24px rgba(20, 38, 62, .06);
    }

    .mobile-nav a,
    .mobile-nav button {
        border: 0;
        color: var(--muted);
        background: transparent;
        display: grid;
        place-content: center;
        gap: 2px;
        text-align: center;
        cursor: pointer;
    }

    .mobile-nav span {
        font-size: 19px;
        line-height: 1;
    }

    .mobile-nav b {
        font-size: 10px;
        font-weight: 600;
    }

    .mobile-nav .active {
        color: var(--accent);
    }

    .detail-site-header .brand span:last-child {
        display: none;
    }

    .detail-hero {
        padding: 12px 16px 18px;
        border-radius: 0 0 22px 22px;
    }

    .detail-titlebar {
        grid-template-columns: 70px 1fr 70px;
    }

    .detail-titlebar h1 {
        font-size: 17px;
    }

    .type-badge {
        display: none;
    }

    .latest-panel {
        min-height: 158px;
        padding: 15px;
    }

    .latest-header {
        font-size: 12px;
    }

    .latest-panel .ball-row {
        margin-top: 18px;
    }

    .hero-countdown {
        margin-top: 17px;
        grid-template-columns: auto 1fr auto;
        gap: 9px;
    }

    .detail-content {
        width: 100%;
    }

    .detail-tabs {
        height: 48px;
    }

    .date-filters {
        padding: 11px 14px;
    }

    .history-wrap {
        margin: 0 14px;
        border-radius: 12px;
    }

    .history-table {
        min-width: 660px;
        font-size: 11px;
    }

    .history-table th,
    .history-table td {
        padding-left: 6px;
        padding-right: 6px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        padding: 14px;
    }

    .streak-list {
        padding: 14px;
    }
}

@media (max-width: 370px) {
    .game-name { max-width: 130px; }
    .ball.race-ball { width: 21px; height: 21px; font-size: 11px; }
    .ball-row { gap: 4px; }
}
