/* =========================================================
   开奖信息展示 · 赛博霓虹 / 玻璃拟态
   ========================================================= */
:root,
html[data-theme="dark"] {
    --bg-0: #070b16;
    --bg-1: #0c1224;
    --cyan: #00f0ff;
    --cyan-dim: rgba(0, 240, 255, 0.35);
    --violet: #b14cff;
    --violet-dim: rgba(177, 76, 255, 0.35);
    --text: #e8f1ff;
    --text-dim: #8ea0bf;
    --glass: rgba(16, 24, 48, 0.55);
    --glass-border: rgba(120, 180, 255, 0.18);
    --red: #ff3b5c;
    --blue: #3b8bff;
    --green: #22d17a;
    --danger: #ff5c7a;
    --ball-text: #1a1f2e;
    --ball-face: radial-gradient(circle at 35% 30%, #fff 0%, #f0f3f8 55%, #d8dee8 100%);
    --history-bg: rgba(0, 0, 0, 0.22);
    --dig-bg: rgba(0, 0, 0, 0.35);
    --shell-shadow: 0 0 80px rgba(0, 240, 255, 0.08);
    --pc-bg-a: rgba(177, 76, 255, 0.18);
    --pc-bg-b: rgba(0, 240, 255, 0.12);
    --pc-bg: #04060e;
    --radius: 16px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --tabbar-h: 64px;
    --header-h: 58px;
    --app-max: 480px;
    --font: "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    color-scheme: dark;
}

html[data-theme="light"] {
    --bg-0: #eef3fb;
    --bg-1: #f7f9fc;
    --cyan: #0088aa;
    --cyan-dim: rgba(0, 136, 170, 0.28);
    --violet: #7a3fd4;
    --violet-dim: rgba(122, 63, 212, 0.25);
    --text: #1c2740;
    --text-dim: #5d6b86;
    --glass: rgba(255, 255, 255, 0.72);
    --glass-border: rgba(40, 70, 120, 0.12);
    --red: #e11d48;
    --blue: #2563eb;
    --green: #059669;
    --danger: #dc2626;
    --ball-text: #1a1f2e;
    --ball-face: radial-gradient(circle at 35% 30%, #fff 0%, #f5f7fb 55%, #e2e8f0 100%);
    --history-bg: rgba(255, 255, 255, 0.65);
    --dig-bg: rgba(255, 255, 255, 0.85);
    --shell-shadow: 0 12px 40px rgba(30, 60, 120, 0.12);
    --pc-bg-a: rgba(122, 63, 212, 0.1);
    --pc-bg-b: rgba(0, 136, 170, 0.1);
    --pc-bg: #d9e3f2;
    color-scheme: light;
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    height: 100%;
    background: var(--bg-0);
    color: var(--text);
    font-family: var(--font);
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

body {
    overflow: hidden;
}

button {
    font: inherit;
    color: inherit;
    background: none;
    border: 0;
    cursor: pointer;
}

a {
    color: var(--cyan);
    text-decoration: none;
}

.app-shell {
    position: relative;
    width: 100%;
    max-width: var(--app-max);
    height: 100%;
    margin: 0 auto;
    background: linear-gradient(180deg, var(--bg-1) 0%, var(--bg-0) 100%);
    overflow: hidden;
    box-shadow: var(--shell-shadow);
    transition: background 0.35s ease, color 0.35s ease;
}

/* ---- 背景氛围 ---- */
.bg-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(0, 240, 255, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 240, 255, 0.04) 1px, transparent 1px);
    background-size: 28px 28px;
    mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
    pointer-events: none;
    z-index: 0;
}

.bg-glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    pointer-events: none;
    z-index: 0;
    opacity: 0.55;
    animation: floatGlow 10s ease-in-out infinite alternate;
}

.bg-glow-a {
    width: 220px;
    height: 220px;
    top: -40px;
    right: -60px;
    background: var(--violet);
}

.bg-glow-b {
    width: 260px;
    height: 260px;
    bottom: 80px;
    left: -80px;
    background: var(--cyan);
    animation-delay: -4s;
}

@keyframes floatGlow {
    from { transform: translate(0, 0) scale(1); }
    to { transform: translate(18px, 24px) scale(1.12); }
}

.glass {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

/* ---- Header ---- */
.app-header {
    position: relative;
    z-index: 5;
    height: var(--header-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    border-top: 0;
}

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

.brand-mark {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: rgba(0, 240, 255, 0.08);
    box-shadow: 0 0 16px var(--cyan-dim);
}

.brand-title {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.06em;
    background: linear-gradient(90deg, var(--cyan), var(--violet));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.brand-sub {
    font-size: 11px;
    color: var(--text-dim);
    margin-top: 1px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.theme-toggle {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    color: var(--cyan);
    background: rgba(0, 240, 255, 0.08);
    border: 1px solid var(--cyan-dim);
    transition: transform 0.15s ease, background 0.2s ease;
}

html[data-theme="light"] .theme-toggle {
    background: rgba(0, 136, 170, 0.1);
}

.theme-toggle:active {
    transform: scale(0.94);
}

.theme-toggle .icon-sun {
    display: none;
}

html[data-theme="light"] .theme-toggle .icon-moon {
    display: none;
}

html[data-theme="light"] .theme-toggle .icon-sun {
    display: block;
}

.header-status {
    font-size: 11px;
    color: var(--cyan);
    opacity: 0.85;
    font-variant-numeric: tabular-nums;
}

/* ---- Main ---- */
.app-main {
    position: relative;
    z-index: 2;
    height: calc(100% - var(--header-h) - var(--tabbar-h) - var(--safe-bottom));
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding: 12px 14px 24px;
    scroll-behavior: smooth;
}

.tab-panel {
    animation: panelIn 0.35s ease;
}

.tab-panel[hidden] {
    display: none !important;
}

@keyframes panelIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---- Countdown Card ---- */
.countdown-card {
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 14px;
    position: relative;
    overflow: hidden;
}

.countdown-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(0, 240, 255, 0.08), rgba(177, 76, 255, 0.06));
    pointer-events: none;
}

.cd-top {
    position: relative;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 14px;
}

.cd-expect {
    font-size: 14px;
    color: var(--text-dim);
}

.cd-expect em {
    font-style: normal;
    color: var(--danger);
    font-weight: 700;
    font-size: 18px;
    text-shadow: 0 0 12px rgba(255, 92, 122, 0.45);
}

.cd-name {
    font-size: 12px;
    color: var(--cyan);
    padding: 3px 8px;
    border-radius: 999px;
    border: 1px solid var(--cyan-dim);
    background: rgba(0, 240, 255, 0.08);
}

.cd-timer {
    position: relative;
    text-align: center;
    padding: 8px 0 14px;
}

.cd-label {
    display: block;
    font-size: 12px;
    color: var(--text-dim);
    margin-bottom: 8px;
    letter-spacing: 0.12em;
}

.cd-digits {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-variant-numeric: tabular-nums;
}

.cd-digits .dig {
    min-width: 52px;
    padding: 10px 8px;
    border-radius: 12px;
    background: var(--dig-bg);
    border: 1px solid var(--cyan-dim);
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.12), inset 0 0 12px rgba(0, 240, 255, 0.05);
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: 0.04em;
}

.cd-digits i {
    font-style: normal;
    font-size: 24px;
    color: var(--violet);
    text-shadow: 0 0 10px var(--violet-dim);
    animation: blinkColon 1s steps(1) infinite;
}

@keyframes blinkColon {
    50% { opacity: 0.35; }
}

.cd-next {
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-dim);
}

.cd-last {
    position: relative;
    padding-top: 12px;
    border-top: 1px dashed rgba(120, 180, 255, 0.15);
}

.section-label {
    font-size: 12px;
    color: var(--text-dim);
    margin-bottom: 10px;
}

/* ---- Balls ---- */
.balls-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 4px;
    flex-wrap: nowrap;
}

.ball-item {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.ball-plus {
    flex: 0 0 auto;
    align-self: center;
    margin: 0 2px;
    margin-bottom: 28px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-dim);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.ball {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 13px;
    font-weight: 700;
    color: var(--ball-text);
    background: var(--ball-face);
    border: 2px solid currentColor;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    position: relative;
}

.ball.red {
    color: var(--red);
    box-shadow: 0 0 12px rgba(255, 59, 92, 0.45), 0 2px 8px rgba(0, 0, 0, 0.35);
}

.ball.blue {
    color: var(--blue);
    box-shadow: 0 0 12px rgba(59, 139, 255, 0.45), 0 2px 8px rgba(0, 0, 0, 0.35);
}

.ball.green {
    color: var(--green);
    box-shadow: 0 0 12px rgba(34, 209, 122, 0.45), 0 2px 8px rgba(0, 0, 0, 0.35);
}

.ball.tema {
    transform: scale(1.05);
}

.ball-meta {
    text-align: center;
    line-height: 1.25;
}

.ball-meta .zx {
    display: block;
    font-size: 11px;
    color: var(--text);
}

.ball-meta .wx {
    display: block;
    font-size: 10px;
    color: var(--text-dim);
}

/* ---- History ---- */
.history-card,
.discover-card {
    border-radius: var(--radius);
    padding: 14px 14px 16px;
    margin-bottom: 14px;
}

.section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 12px;
}

.section-head h2 {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.section-tip {
    font-size: 11px;
    color: var(--text-dim);
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.history-item {
    padding: 12px;
    border-radius: 12px;
    background: var(--history-bg);
    border: 1px solid var(--glass-border);
    animation: itemIn 0.3s ease both;
}

@keyframes itemIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.history-item-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.history-expect {
    font-size: 13px;
    color: var(--text);
}

.history-expect em {
    font-style: normal;
    color: var(--danger);
    font-weight: 700;
}

.history-time {
    font-size: 11px;
    color: var(--text-dim);
    font-variant-numeric: tabular-nums;
}

.btn-more {
    width: 100%;
    margin-top: 14px;
    padding: 12px;
    border-radius: 12px;
    border: 1px solid var(--cyan-dim);
    background: linear-gradient(90deg, rgba(0, 240, 255, 0.1), rgba(177, 76, 255, 0.1));
    color: var(--cyan);
    font-size: 13px;
    letter-spacing: 0.08em;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-more:active {
    transform: scale(0.98);
}

.btn-more:disabled {
    opacity: 0.45;
    cursor: default;
}

.btn-more.is-loading {
    opacity: 0.7;
}

.empty-tip,
.loading-tip {
    text-align: center;
    padding: 28px 12px;
    color: var(--text-dim);
    font-size: 13px;
}

/* ---- Discover ---- */
.shortcut-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.shortcut-item {
    padding: 14px 12px;
    border-radius: 12px;
    background: var(--history-bg);
    border: 1px solid var(--glass-border);
    text-align: left;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.shortcut-item:active {
    border-color: var(--cyan-dim);
    box-shadow: 0 0 16px rgba(0, 240, 255, 0.15);
}

.shortcut-item .sc-name {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
}

.shortcut-item .sc-desc {
    font-size: 11px;
    color: var(--text-dim);
}

/* ---- 发现页橙色栏目导航 ---- */
.discover-nav-wrap {
    position: relative;
    margin-bottom: 14px;
    padding-top: 22px;
}

.discover-back-home {
    position: absolute;
    top: 0;
    right: 4px;
    z-index: 2;
    font-size: 12px;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
    letter-spacing: 0.04em;
}

.discover-back-home:active {
    opacity: 0.75;
}

.discover-nav-bar {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: 2px;
    padding: 10px 6px;
    border-radius: 6px;
    background: linear-gradient(180deg, #ff8a1a 0%, #f06a00 55%, #e85d00 100%);
    box-shadow:
        0 4px 16px rgba(240, 106, 0, 0.35),
        inset 0 1px 0 rgba(255, 220, 150, 0.35);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.discover-nav-bar::-webkit-scrollbar {
    display: none;
}

.discover-nav-bar .nav-link {
    flex: 1 0 auto;
    min-width: 0;
    padding: 4px 6px;
    text-align: center;
    font-size: 13px;
    font-weight: 700;
    color: #ffe566;
    text-shadow: 0 1px 0 rgba(120, 40, 0, 0.35);
    white-space: nowrap;
    letter-spacing: 0.02em;
    border-radius: 4px;
    transition: background 0.15s, transform 0.15s;
}

.discover-nav-bar .nav-link:active,
.discover-nav-bar .nav-link.active {
    background: rgba(0, 0, 0, 0.18);
    transform: scale(0.96);
}

.link-back {
    font-size: 12px;
    color: var(--cyan);
}

.discover-nav-content {
    font-size: 13px;
    color: var(--text-dim);
    line-height: 1.6;
    min-height: 80px;
}

.discover-nav-content .nav-placeholder {
    padding: 18px 8px;
    text-align: center;
}

.discover-nav-content .nav-placeholder strong {
    display: block;
    color: var(--text);
    font-size: 15px;
    margin-bottom: 8px;
}

/* ---- 跑狗图（下一期三玩法） ---- */
.paogou-card {
    margin-bottom: 14px;
    padding: 12px;
    border-radius: 12px;
    background: var(--history-bg);
    border: 1px solid var(--glass-border);
}

.paogou-card:last-child {
    margin-bottom: 0;
}

.paogou-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
}

.paogou-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
}

.paogou-expect {
    font-size: 12px;
    color: var(--danger);
    font-weight: 600;
}

.paogou-time {
    font-size: 11px;
    color: var(--text-dim);
    margin-bottom: 10px;
}

.paogou-img-wrap {
    display: block;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--glass-border);
    background: rgba(0, 0, 0, 0.12);
}

.paogou-img {
    display: block;
    width: 100%;
    height: auto;
    vertical-align: top;
}

.paogou-empty {
    padding: 28px 12px;
    text-align: center;
    font-size: 12px;
    color: var(--text-dim);
    border-radius: 10px;
    border: 1px dashed var(--glass-border);
}

/* ---- Tabbar ---- */
.tabbar {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
    height: calc(var(--tabbar-h) + var(--safe-bottom));
    padding: 6px 8px var(--safe-bottom);
    display: flex;
    align-items: flex-start;
    justify-content: space-around;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
}

.tab-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 2px;
    color: var(--text-dim);
    transition: color 0.2s, transform 0.2s;
}

.tab-item .tab-icon {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 10px;
    transition: background 0.2s, box-shadow 0.2s, color 0.2s;
}

.tab-item .tab-text {
    font-size: 10px;
    letter-spacing: 0.02em;
}

.tab-item.active {
    color: var(--cyan);
}

.tab-item.active .tab-icon {
    background: rgba(0, 240, 255, 0.12);
    box-shadow: 0 0 14px rgba(0, 240, 255, 0.25);
    color: var(--cyan);
}

.tab-item:active {
    transform: scale(0.96);
}

/* ---- Toast ---- */
.toast {
    position: absolute;
    left: 50%;
    bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 16px);
    transform: translateX(-50%);
    z-index: 50;
    max-width: 80%;
    padding: 10px 16px;
    border-radius: 10px;
    background: rgba(10, 16, 32, 0.92);
    border: 1px solid var(--cyan-dim);
    color: var(--text);
    font-size: 13px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    animation: toastIn 0.25s ease;
}

.toast[hidden] {
    display: none !important;
}

@keyframes toastIn {
    from { opacity: 0; transform: translate(-50%, 8px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

/* ---- PC 居中手机宽度 ---- */
@media (min-width: 520px) {
    body {
        display: flex;
        align-items: stretch;
        justify-content: center;
        background:
            radial-gradient(ellipse at 20% 10%, var(--pc-bg-a), transparent 40%),
            radial-gradient(ellipse at 80% 90%, var(--pc-bg-b), transparent 45%),
            var(--pc-bg);
        padding: 24px 0;
        overflow: auto;
        transition: background 0.35s ease;
    }

    .app-shell {
        height: min(900px, calc(100vh - 48px));
        border-radius: 24px;
        border: 1px solid rgba(120, 180, 255, 0.15);
        overflow: hidden;
    }
}

@media (max-width: 360px) {
    .ball {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }

    .cd-digits .dig {
        min-width: 44px;
        font-size: 24px;
        padding: 8px 4px;
    }
}
