/* ══════════════════════════════════════════════
   BingoKing v11.1 — Modern Dark Theme (Refined)
   ══════════════════════════════════════════════ */

:root {
    --bg: #0a0e14;
    --bg-card: #111820;
    --bg-hover: #182030;
    --bg-elevated: #141b25;
    --bg-glass: rgba(17, 24, 32, 0.85);
    --border: #1e2a3a;
    --border-light: #283848;
    --text: #e8edf4;
    --text-dim: #9aabbc;
    --text-muted: #6b7f94;
    --accent: #4d9fff;
    --accent-dim: rgba(77,159,255,0.12);
    --red: #ff6b6b;
    --red-dim: rgba(255,107,107,0.12);
    --green: #4ecb71;
    --green-dim: rgba(78,203,113,0.12);
    --orange: #ffb347;
    --orange-dim: rgba(255,179,71,0.12);
    --blue: #4d9fff;
    --blue-dim: rgba(77,159,255,0.12);
    --gold: #ffd369;
    --gold-dim: rgba(255,211,105,0.12);
    --purple: #b892ff;
    --purple-dim: rgba(184,146,255,0.12);
    --cyan: #56d4e0;
    --cyan-dim: rgba(86,212,224,0.12);
    --radius: 14px;
    --radius-sm: 9px;
    /* 分層柔和陰影（ui-ux-pro-max：soft shadows） */
    --shadow: 0 1px 2px rgba(0,0,0,0.28), 0 2px 8px rgba(0,0,0,0.22);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.35), 0 12px 32px rgba(0,0,0,0.30);
    --transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    /* 字體系統：內文 Noto Sans TC，數據用等寬 tabular（帳本/終端機質感） */
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans TC', sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', 'Cascadia Code', Menlo, monospace;
    /* 間距尺度（8pt 節奏） */
    --space-1: 0.25rem; --space-2: 0.5rem; --space-3: 0.75rem;
    --space-4: 1rem; --space-5: 1.5rem; --space-6: 2rem;
}

/* 數據一律用等寬 tabular 數字：金額/機率/倒數/期號對齊不跳動 */
.num, .hero-cd-time, .board-rate, .board-ci b, .ev-edge b, .ev-loss b,
.ball, .latest-id, .countdown-time { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }

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

body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    font-size: 14px;
    overflow-x: hidden;
    /* iOS safe area */
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    /* 防止手機雙擊縮放 */
    touch-action: manipulation;
}

/* ── 置頂容器（導航 + 最新開獎） ──────────────── */
.sticky-header {
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

/* ── 導航列 ──────────────────────────────────── */
.navbar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 1rem;
    background: rgba(10, 14, 20, 0.95);
    border-bottom: 1px solid var(--border);
}

.nav-brand {
    font-size: 1.05rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--gold), #ff9933);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

.nav-links {
    display: flex;
    gap: 2px;
    margin-left: auto;
    flex: 1;
    justify-content: center;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}
.nav-links::-webkit-scrollbar { display: none; }
.nav-actions { display: flex; gap: 0.3rem; flex-shrink: 0; align-items: center; }
.nav-icon-btn {
    background: none; border: none; cursor: pointer;
    font-size: 1rem; padding: 0.2rem 0.35rem;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    line-height: 1;
}
.nav-icon-btn:hover { background: var(--bg-hover); }

.online-badge {
    display: flex; align-items: center; gap: 0.3rem;
    font-size: 0.72rem; font-weight: 600;
    color: var(--green);
    background: var(--green-dim);
    border: 1px solid color-mix(in srgb, var(--green) 30%, transparent);
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-sm);
    white-space: nowrap;
}
.online-dot {
    width: 6px; height: 6px;
    background: var(--green);
    border-radius: 50%;
    animation: pulse-dot 2s ease-in-out infinite;
}
@keyframes pulse-dot {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 color-mix(in srgb, var(--green) 40%, transparent); }
    50% { opacity: 0.7; box-shadow: 0 0 0 3px transparent; }
}

.nav-link {
    padding: 0.3rem 0.7rem;
    color: var(--text-dim);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 600;
    transition: all var(--transition);
}

.nav-link:hover { background: var(--bg-hover); color: var(--text); }
.nav-link.active { background: var(--accent); color: #fff; }

.countdown-label { color: var(--text-dim); font-size: 0.72rem; }
.countdown-time { color: var(--gold); font-weight: 700; font-variant-numeric: tabular-nums; }

/* ── 最新開獎速報（置頂橫幅） ────────────────── */
.latest-bar {
    padding: 0.5rem 1rem;
    background: rgba(20, 27, 37, 0.95);
    border-bottom: 1px solid var(--border);
}

.latest-draw-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    max-width: 960px;
    margin: 0 auto;
}

.latest-info-row {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.8rem;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.latest-id {
    color: var(--accent);
    font-weight: 700;
    font-size: 0.82rem;
    flex-shrink: 0;
}

.latest-time {
    color: var(--text-dim);
    font-size: 0.75rem;
    flex-shrink: 0;
}

.latest-badges {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.latest-super { flex-shrink: 0; }

.latest-countdown {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.75rem;
    flex-shrink: 0;
    background: var(--bg-hover);
    padding: 0.2rem 0.55rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.latest-numbers-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    flex: 1;
    min-width: 0;
}

/* ── 容器 ────────────────────────────────────── */
.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 1.2rem 1.2rem;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

/* ── 頁面標題 ────────────────────────────────── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.2rem;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.page-header h1 {
    font-size: 1.35rem;
    font-weight: 800;
}

.header-badges {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.badge {
    font-size: 0.75rem;
    padding: 0.22rem 0.6rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text-dim);
    white-space: nowrap;
    flex-shrink: 0;
    font-weight: 500;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.badge-green { color: var(--green); border-color: var(--green); background: var(--green-dim); }
.badge-orange { color: var(--orange); border-color: var(--orange); background: var(--orange-dim); }
.badge-red { color: var(--red); border-color: var(--red); background: var(--red-dim); }
.badge-blue { color: var(--blue); border-color: var(--blue); background: var(--blue-dim); }
.badge-gold { color: var(--gold); border-color: var(--gold); background: var(--gold-dim); }
.badge-bs { font-weight: 700; font-size: 0.72rem; padding: 0.18rem 0.5rem; }
.badge-oe { font-weight: 700; font-size: 0.72rem; padding: 0.18rem 0.5rem; }

/* ── 卡片 ────────────────────────────────────── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 0.85rem;
    box-shadow: var(--shadow);
    overflow: visible;
    min-width: 0;
    max-width: 100%;
}

.card-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 0.9rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition);
    user-select: none;
}

.card-header:hover { background: var(--bg-hover); }

.card-header-info {
    color: var(--text-dim);
    font-size: 0.78rem;
    font-weight: 400;
    flex: 1;
}

.toggle-icon { color: var(--text-muted); font-size: 0.65rem; }

.btn-star-tab { color: var(--text-secondary); background: var(--card-bg); border: 1px solid var(--border); }
.btn-star-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 600; }

.card-body { padding: 0.85rem 0.9rem; min-width: 0; overflow-wrap: break-word; }

/* ── 三格卡片列（猜大小/單雙/超級獎號） ──── */
.card-row-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.65rem;
    margin-bottom: 0.85rem;
}

.card-sm {
    text-align: center;
    padding: 1rem 0.6rem;
    position: relative;
    overflow: hidden;
    min-width: 0;
}

.card-sm::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
}

.card-accent-red::before { background: linear-gradient(90deg, var(--red), #ff9999); }
.card-accent-blue::before { background: linear-gradient(90deg, var(--blue), #99ccff); }
.card-accent-orange::before { background: linear-gradient(90deg, var(--orange), #ffcc77); }
.card-accent-green::before { background: linear-gradient(90deg, var(--green), #77dd99); }
.card-accent-gold::before { background: linear-gradient(90deg, var(--gold), #ffee99); }

.card-title {
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-bottom: 0.3rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.card-value {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.1;
    overflow-wrap: break-word;
}

.card-sub {
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-top: 0.25rem;
    overflow-wrap: break-word;
    word-break: break-word;
}

.card-payout {
    font-size: 0.68rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

/* ══════════════════════════════════════════════
   號碼球（全新漸層樣式）
   ══════════════════════════════════════════════ */
.number-balls { display: flex; flex-wrap: wrap; gap: 5px; }

.ball-wrap {
    position: relative;
    display: inline-flex;
}

.ball {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.2rem;
    height: 2.2rem;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 700;
    background: radial-gradient(circle at 35% 30%, #4a5a6e, #2a3545 50%, #1a2535 100%);
    border: 1.5px solid #3a4a5e;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3), inset 0 1px 1px rgba(255,255,255,0.08);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    position: relative;
    color: var(--text);
    text-shadow: 0 1px 1px rgba(0,0,0,0.3);
}

.ball:hover {
    transform: scale(1.12);
    z-index: 1;
}

.ball-sm { width: 1.75rem; height: 1.75rem; font-size: 0.68rem; }
.ball-xs { width: 1.5rem; height: 1.5rem; font-size: 0.62rem; }


/* 模擬器命中球 — 綠色 */
.ball-hit {
    background: radial-gradient(circle at 35% 30%, #a5d6a7, #66bb6a 40%, #388e3c 100%);
    color: #fff;
    border-color: #66bb6a;
    box-shadow: 0 2px 6px rgba(76,175,80,0.3);
}
/* 模擬器未中球 — 暗色 */
.ball-miss {
    background: var(--surface-2);
    color: var(--text-dim);
    border-color: var(--border);
    opacity: 0.6;
}

/* 預測球 — 藍色漸層 */
.ball-predicted {
    background: radial-gradient(circle at 35% 30%, #8bc4ff, #5ba3ff 40%, #3a7bd5 100%);
    color: #fff;
    border-color: #5ba3ff;
    box-shadow: 0 2px 8px rgba(77,159,255,0.35), inset 0 1px 2px rgba(255,255,255,0.15);
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

/* 熱門球 — 橘紅漸層 */
.ball-hot {
    background: radial-gradient(circle at 35% 30%, #ffb89e, #ff8a65 40%, #e65100 100%);
    color: #fff;
    border-color: #ff8a65;
    box-shadow: 0 2px 6px rgba(255,107,107,0.25), inset 0 1px 2px rgba(255,255,255,0.15);
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

/* 溫球 — 橘黃漸層 */
.ball-warm {
    background: radial-gradient(circle at 35% 30%, #ffe0a0, #ffc266 40%, #e69500 100%);
    color: #1a1a1a;
    border-color: #ffb347;
    box-shadow: 0 2px 6px rgba(255,179,71,0.25), inset 0 1px 2px rgba(255,255,255,0.2);
}

/* 冷球 — 藍色漸層 */
.ball-cold {
    background: radial-gradient(circle at 35% 30%, #9ed4ff, #64b5f6 40%, #1565c0 100%);
    color: #fff;
    border-color: #4d9fff;
    box-shadow: 0 2px 6px rgba(77,159,255,0.2), inset 0 1px 2px rgba(255,255,255,0.15);
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

/* 中性球 */
.ball-neutral {
    background: radial-gradient(circle at 35% 30%, #4a5a6e, #2a3545 50%, #1a2535 100%);
    color: var(--text-dim);
    box-shadow: 0 2px 4px rgba(0,0,0,0.3), inset 0 1px 1px rgba(255,255,255,0.06);
}

/* 大號球 — 粉紅漸層（參考截圖風格） */
.ball-big {
    background: radial-gradient(circle at 35% 30%, #ffb8c8, #ff8a9e 40%, #d84872 100%);
    color: #fff;
    border-color: rgba(255,107,107,0.5);
    box-shadow: 0 2px 6px rgba(216,72,114,0.3), inset 0 1px 2px rgba(255,255,255,0.15);
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

/* 小號球 — 金色漸層（參考截圖風格） */
.ball-small {
    background: radial-gradient(circle at 35% 30%, #ffe8a0, #ffd478 40%, #e6a020 100%);
    color: #1a1a1a;
    border-color: rgba(255,200,80,0.5);
}

/* ── Latest draw 球（小尺寸用） ────────────── */
.ball-latest {
    width: 1.65rem;
    height: 1.65rem;
    font-size: 0.62rem;
}

/* 超級獎號球 — 紫色脈動，優先於分區色（用於 .ball 系列） */
.ball-super, .ball.ball-super {
    background: radial-gradient(circle at 35% 30%, #e0b8ff, #b07aff 40%, #8b5cf6 100%);
    color: #fff;
    border: 2px solid #c89aff;
    box-shadow: 0 2px 6px rgba(139,92,246,0.5), 0 0 12px rgba(184,146,255,0.4), inset 0 1px 2px rgba(255,255,255,0.2);
    animation: super-pulse 2s ease-in-out infinite;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

/* ── 連莊標籤 ────────────────────────────────── */
.streak-tag {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    background: linear-gradient(135deg, #ff4444, #ff6b6b);
    color: #fff;
    font-size: 0.5rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
    line-height: 1;
    box-shadow: 0 1px 4px rgba(255,68,68,0.4);
    z-index: 2;
}

.ball-sm .streak-tag,
.ball-wrap .ball-sm + .streak-tag {
    min-width: 14px;
    height: 14px;
    font-size: 0.46rem;
    top: -3px;
    right: -3px;
}

.ball-xs .streak-tag,
.ball-wrap .ball-xs + .streak-tag {
    min-width: 12px;
    height: 12px;
    font-size: 0.42rem;
    top: -2px;
    right: -2px;
}

.hball + .streak-tag {
    min-width: 14px;
    height: 14px;
    font-size: 0.48rem;
    top: -3px;
    right: -3px;
}

.super-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 35% 30%, #e0b8ff, #b07aff 40%, #8b5cf6 100%);
    color: #fff;
    width: 1.7rem;
    height: 1.7rem;
    border-radius: 50%;
    font-size: 0.78rem;
    font-weight: 800;
    border: 1.5px solid #c89aff;
    box-shadow: 0 2px 6px rgba(139,92,246,0.5), 0 0 10px rgba(184,146,255,0.4), inset 0 1px 2px rgba(255,255,255,0.2);
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.super-glow {
    animation: super-pulse 2s ease-in-out infinite;
}

@keyframes super-pulse {
    0%, 100% { box-shadow: 0 2px 6px rgba(139,92,246,0.5), 0 0 8px rgba(184,146,255,0.3), inset 0 1px 2px rgba(255,255,255,0.2); }
    50% { box-shadow: 0 2px 8px rgba(139,92,246,0.6), 0 0 18px rgba(184,146,255,0.5), 0 0 28px rgba(139,92,246,0.2), inset 0 1px 2px rgba(255,255,255,0.2); }
}

/* ── 號碼球圖例 ──────────────────────────────── */
.ball-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.8rem;
    padding: 0.5rem 0.8rem;
    margin-bottom: 0.6rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.72rem;
    color: var(--text-dim);
}
.ball-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}
.ball-legend-swatch {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.2rem;
    height: 1.2rem;
    border-radius: 50%;
    font-size: 0.5rem;
    font-weight: 700;
}
.bls-big {
    background: linear-gradient(145deg, #ff8a9e, #d84872);
    color: #fff;
    border: 1px solid rgba(255,107,107,0.5);
}
.bls-small {
    background: linear-gradient(145deg, #ffd478, #e6a020);
    color: #1a1a1a;
    border: 1px solid rgba(255,200,80,0.5);
}
.bls-super {
    background: radial-gradient(circle at 35% 30%, #e0b8ff, #b07aff 40%, #8b5cf6 100%);
    color: #fff;
    border: 2px solid #c89aff;
    box-shadow: 0 2px 4px rgba(139,92,246,0.5), 0 0 8px rgba(184,146,255,0.4), inset 0 1px 1px rgba(255,255,255,0.2);
    animation: super-pulse 2s ease-in-out infinite;
}
.bls-predicted {
    background: linear-gradient(145deg, #5ba3ff, #3a7bd5);
    color: #fff;
    border: 1px solid #5ba3ff;
}
.bls-hit {
    background: linear-gradient(145deg, #5ba3ff, #3a7bd5);
    color: #fff;
    border: 1px solid #5ba3ff;
}
.bls-streak {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    border-radius: 7px;
    background: linear-gradient(135deg, #ff4444, #ff6b6b);
    color: #fff;
    font-size: 0.42rem;
    font-weight: 800;
}

/* ── 星級徽章 ────────────────────────────────── */
.star-badge {
    display: inline-block;
    padding: 0.12rem 0.42rem;
    border-radius: 5px;
    font-size: 0.68rem;
    font-weight: 700;
    border: 1px solid;
    flex-shrink: 0;
}

.star-1, .star-2, .star-3 { border-color: var(--green); color: var(--green); background: var(--green-dim); }
.star-4, .star-5, .star-6 { border-color: var(--blue); color: var(--blue); background: var(--blue-dim); }
.star-7, .star-8 { border-color: var(--orange); color: var(--orange); background: var(--orange-dim); }
.star-9, .star-10 { border-color: var(--red); color: var(--red); background: var(--red-dim); }

/* ── 大小/單雙/超級獎號 ──────────────────── */
.side-cards-grid {
    display: flex;
    gap: 0.65rem;
    margin-bottom: 0.85rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 0.3rem;
}
.side-cards-grid::-webkit-scrollbar { display: none; }
.side-cards-grid > .card {
    flex: 0 0 calc(50% - 0.35rem);
    min-width: calc(50% - 0.35rem);
    scroll-snap-align: start;
}
@media (min-width: 769px) {
    .side-cards-grid > .card {
        flex: 1 1 0;
        min-width: 0;
    }
}

.side-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.7rem 0.4rem 0.6rem;
    margin-bottom: 0;
    text-align: center;
}

.side-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin-bottom: 0.25rem;
}

.side-badge {
    font-size: 0.68rem;
    font-weight: 700;
    padding: 0.12rem 0.42rem;
    border-radius: 5px;
    border: 1px solid;
}
.side-bs { border-color: var(--red); color: var(--red); background: var(--red-dim); }
.side-oe { border-color: var(--orange); color: var(--orange); background: var(--orange-dim); }
.side-su { border-color: var(--purple); color: var(--purple); background: var(--purple-dim); }

.side-ev {
    font-size: 0.7rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.side-ev.positive { color: var(--green); }
.side-ev.negative { color: var(--red); }
.recent-ev { opacity: 0.75; border-left: 1px solid var(--border); padding-left: 0.35rem; margin-left: 0.2rem; font-size: 0.6rem; }

.side-hero {
    padding: 0.55rem 0 0.5rem;
}

.side-value {
    font-size: 2.4rem;
    font-weight: 900;
    line-height: 1;
    letter-spacing: -0.03em;
}

.side-value.glow-red { color: var(--red); text-shadow: 0 0 20px rgba(255,107,107,0.35); }
.side-value.glow-blue { color: var(--blue); text-shadow: 0 0 20px rgba(77,159,255,0.35); }
.side-value.glow-orange { color: var(--orange); text-shadow: 0 0 20px rgba(255,179,71,0.35); }
.side-value.glow-green { color: var(--green); text-shadow: 0 0 20px rgba(78,203,113,0.35); }
.side-value.glow-purple { color: var(--purple); text-shadow: 0 0 20px rgba(184,146,255,0.4); }
.side-value.super-num { font-size: 2rem; }

.side-tags {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
    justify-content: center;
}

.side-tag {
    font-size: 0.62rem;
    font-weight: 600;
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
    line-height: 1.3;
}

.tag-mult { color: var(--orange); background: var(--orange-dim); }
.tag-period { color: var(--cyan); background: var(--cyan-dim); }
.tag-hit { color: var(--green); background: var(--green-dim); }

/* ── 星級預測卡片網格 ────────────────────────── */
.star-cards-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
    margin-bottom: 0.85rem;
}

.star-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.7rem 0.4rem 0.6rem;
    margin-bottom: 0;
    text-align: center;
    position: relative;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.star-card:hover {
    border-color: var(--border-light);
    box-shadow: var(--shadow-lg);
}

.star-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin-bottom: 0.25rem;
}

.star-card-nums {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    justify-content: center;
    padding: 0.55rem 0 0.5rem;
}

.star-card-tags {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
    justify-content: center;
}

.star-ev {
    font-size: 0.7rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.star-ev.positive { color: var(--green); }
.star-ev.negative { color: var(--red); }

/* legacy detail-item support (tools page etc.) */
.star-card-details {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding-top: 0.45rem;
    border-top: 1px solid var(--border);
    font-size: 0.75rem;
}

.detail-item {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.5rem;
}

.detail-label {
    color: var(--text-muted);
    font-size: 0.68rem;
    font-weight: 500;
    flex-shrink: 0;
}

.detail-value {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    font-size: 0.75rem;
    text-align: right;
}

.detail-value.positive { color: var(--green); }
.detail-value.negative { color: var(--red); }
.detail-value.highlight { color: var(--gold); }
.detail-value.info { color: var(--accent); }
.detail-value.dim { color: var(--text-muted); font-weight: 500; }

/* ══════════════════════════════════════════════
   v2 儀表盤式卡片（星級 + 大小/單雙/超級）
   ══════════════════════════════════════════════ */

.star-card-v2,
.side-card-v2 {
    padding: 0.8rem;
    margin-bottom: 0;
    transition: border-color var(--transition), box-shadow var(--transition);
    overflow: hidden;
    min-width: 0;
}
.star-card-v2:hover,
.side-card-v2:hover {
    border-color: var(--border-light);
    box-shadow: var(--shadow-lg);
}

/* ── 卡片頭部：徽章 + 號碼/預測值 ── */
.sc-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
    min-width: 0;
}
.sc-nums {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    min-width: 0;
}
.side-value-inline {
    font-size: 1.1rem;
    font-weight: 800;
    margin-left: auto;
}

/* ── 分隔線標題 ── */
.sc-divider-label {
    text-align: center;
    font-size: 0.6rem;
    color: var(--text-muted);
    letter-spacing: 0.3px;
    padding: 0.4rem 0 0.35rem;
    margin: 0.25rem 0 0.4rem;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

/* ── 績效主體：環形圖 + 指標 ── */
.sc-perf-body {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.45rem;
    min-width: 0;
}

/* 環形勝率圖 */
.sc-ring-wrap {
    position: relative;
    width: 52px;
    height: 52px;
    flex-shrink: 0;
}
.sc-ring-wrap svg {
    transform: rotate(-90deg);
    width: 52px;
    height: 52px;
}
.sc-ring-bg {
    fill: none;
    stroke: var(--border);
    stroke-width: 4;
}
.sc-ring-fg {
    fill: none;
    stroke-width: 4;
    stroke-linecap: round;
    transition: stroke-dasharray 0.5s ease;
}
.sc-ring-text {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.sc-ring-pct {
    font-size: 0.78rem;
    font-weight: 800;
    line-height: 1;
}
.sc-ring-sub {
    font-size: 0.48rem;
    color: var(--text-muted);
    margin-top: 1px;
}

/* 績效指標列 */
.sc-metrics {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.sc-row {
    display: flex;
    justify-content: space-between;
    min-width: 0;
    align-items: baseline;
    font-size: 0.72rem;
    line-height: 1.5;
}
.sc-label {
    color: var(--text-muted);
    font-size: 0.62rem;
    flex-shrink: 0;
    margin-right: 0.3rem;
}
.sc-value {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    text-align: right;
    white-space: nowrap;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 1;
    max-width: 100%;
}
.sc-pos { color: var(--green); }
.sc-neg { color: var(--red); }
.sc-neutral { color: var(--text-dim); }

/* ── 勝敗點陣 ── */
.sc-dots-row {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.35rem 0 0.25rem;
}
.sc-wl {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-dim);
    flex-shrink: 0;
    min-width: 3.5rem;
}
.sc-dots {
    display: flex;
    gap: 2px;
    flex-wrap: nowrap;
    overflow: hidden;
}
.sc-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}
.sc-dot-w { background: var(--green); }
.sc-dot-l { background: var(--red); opacity: 0.45; }
.sc-dots-wrapper {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
    overflow: hidden;
}
.sc-time-label {
    font-size: 0.55rem;
    color: var(--muted);
    opacity: 0.6;
    flex-shrink: 0;
}

/* ── 無資料 ── */
.sc-empty {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.68rem;
    padding: 0.8rem 0;
}

/* ── 底部：投注建議 + 詳情按鈕 ── */
.sc-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 0.35rem;
    border-top: 1px solid var(--border);
    margin-top: 0.3rem;
}
.sc-advice {
    font-size: 0.62rem;
    color: var(--text-muted);
}
.sc-detail-toggle {
    font-size: 0.65rem;
    color: var(--accent);
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s;
    flex-shrink: 0;
}
.sc-detail-toggle:hover { opacity: 1; }

/* ── 展開詳情面板 ── */
.sc-detail-panel {
    margin-top: 0.45rem;
    padding: 0.5rem;
    background: var(--surface-2, #1a2332);
    border-radius: var(--radius-sm);
    overflow-x: auto;
}
.sc-detail-title {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.3rem;
}

/* 逐期明細表格 */
.sc-detail-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.72rem;
    font-variant-numeric: tabular-nums;
}
.sc-detail-table th {
    text-align: left;
    padding: 2px 4px;
    color: var(--text-muted);
    font-size: 0.6rem;
    font-weight: 500;
    border-bottom: 1px solid var(--border);
}
.sc-detail-table td {
    padding: 2px 4px;
    word-break: break-word;
    overflow-wrap: break-word;
    max-width: 0;
}
.sc-r { text-align: right; }
.sc-row-win { color: var(--green); font-weight: 600; }
.sc-row-lose { color: var(--text-muted); }

/* 命中分布比例條 */
.sc-bar-cell { padding: 2px 4px; }
.sc-bar-bg {
    background: var(--bg-card);
    border-radius: 3px;
    height: 0.75rem;
    overflow: hidden;
}
.sc-bar-fg {
    height: 100%;
    border-radius: 3px;
}
.sc-dist-hint {
    margin-top: 0.3rem;
    font-size: 0.6rem;
    color: var(--text-muted);
}

/* ── 星級表格模式 ────────────────────────────── */
.star-table {
    display: grid;
    gap: 0;
}

.star-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.9rem;
    border-bottom: 1px solid var(--border);
    transition: background var(--transition);
}

.star-row:last-child { border-bottom: none; }
.star-row:hover { background: var(--bg-hover); }

.star-nums {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    flex: 1;
}

.star-info {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.ev-tag {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.14rem 0.4rem;
    border-radius: 6px;
    font-variant-numeric: tabular-nums;
}

.ev-pos { color: var(--green); background: var(--green-dim); }
.ev-neg { color: var(--red); background: var(--red-dim); }

/* ── 顏色工具類 ──────────────────────────────── */
.text-red { color: var(--red); }
.text-green { color: var(--green); }
.text-blue { color: var(--blue); }
.text-orange { color: var(--orange); }
.text-gold { color: var(--gold); }
.text-purple { color: var(--purple); }

/* ── 信號面板 ────────────────────────────────── */
.signal-grid { display: grid; gap: 0.3rem; }

.signal-item {
    display: grid;
    grid-template-columns: 1fr auto auto 24px;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.82rem;
    padding: 0.35rem 0.45rem;
    border-radius: 6px;
}

.signal-item:hover { background: var(--bg-hover); }
.signal-name { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.signal-hit { color: var(--text-dim); font-size: 0.75rem; white-space: nowrap; }

.signal-status {
    font-size: 0.62rem;
    font-weight: 700;
    text-align: center;
    padding: 0.12rem 0.3rem;
    border-radius: 4px;
    letter-spacing: 0.5px;
}

.signal-status.text-green { background: var(--green-dim); }
.signal-status.text-red { background: var(--red-dim); }
.signal-active { opacity: 1; }
.signal-inactive { opacity: 0.5; }

.signal-drift {
    font-size: 0.72rem;
    font-weight: 800;
    text-align: center;
    width: 20px;
}
.drift-up { color: var(--green); }
.drift-down { color: var(--red); }
.drift-flat { color: var(--text-muted); }

/* ── 權重條 ──────────────────────────────────── */
.weight-bar-bg {
    height: 4px;
    background: var(--bg);
    border-radius: 2px;
    overflow: hidden;
    min-width: 35px;
}

.weight-bar {
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.bar-active { background: var(--green); }

.weight-grid { display: grid; gap: 0.3rem; }
.weight-item { display: grid; grid-template-columns: 100px 1fr 40px; align-items: center; gap: 0.4rem; font-size: 0.78rem; }
.weight-name { color: var(--text-dim); }
.weight-val { color: var(--text-dim); text-align: right; }

/* ── 排名列表（工具頁）─────────────────────── */
.number-rank-list { display: grid; gap: 0.25rem; }

.rank-item {
    display: grid;
    grid-template-columns: 2.2rem 1fr 70px;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.82rem;
    padding: 0.2rem 0;
}

.rank-bar-bg { height: 6px; background: var(--bg); border-radius: 3px; overflow: hidden; }
.rank-bar { height: 100%; border-radius: 3px; transition: width 0.3s ease; }
.rank-bar-hot { background: linear-gradient(90deg, var(--red), #ff9999); }
.rank-bar-cold { background: linear-gradient(90deg, var(--blue), #99ccff); }
.rank-bar-gap { background: linear-gradient(90deg, var(--orange), #ffcc77); }
.rank-bar-consensus { background: linear-gradient(90deg, var(--green), #77dd99); }
.rank-bar-zone { background: linear-gradient(90deg, var(--purple), #cc99ff); }
.rank-bar-tail { background: linear-gradient(90deg, var(--accent), #99ccff); }
.rank-val { color: var(--text-dim); font-size: 0.75rem; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── 分布網格 ────────────────────────────────── */
.dist-grid { display: grid; gap: 0.3rem; }
.dist-item { display: grid; grid-template-columns: 70px 1fr 90px; align-items: center; gap: 0.4rem; font-size: 0.8rem; }
.dist-label { color: var(--text-dim); }
.dist-val { color: var(--text-dim); font-size: 0.72rem; text-align: right; }

/* ── 分頁標籤 ────────────────────────────────── */
.tab-bar {
    display: flex;
    gap: 3px;
    padding: 0.5rem 0;
    overflow-x: auto;
    margin-bottom: 0.85rem;
    border-bottom: 1px solid var(--border);
}

.tab {
    padding: 0.4rem 0.8rem;
    color: var(--text-dim);
    text-decoration: none;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    font-size: 0.82rem;
    font-weight: 500;
    white-space: nowrap;
    transition: all var(--transition);
}

.tab:hover { background: var(--bg-hover); color: var(--text); }
.tab.active { background: var(--accent); color: #fff; }

/* ── 日期導航（圓角 pill 風格） ──────────────── */
.date-nav {
    display: flex;
    gap: 0.4rem;
    padding: 0.6rem 0;
    overflow-x: auto;
    margin-bottom: 1rem;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.date-nav::-webkit-scrollbar { display: none; }

.date-btn {
    padding: 0.4rem 0.8rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text-dim);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
    transition: all var(--transition);
}
.date-btn:hover { background: var(--bg-hover); color: var(--text); border-color: var(--border-light); }
.date-btn.active {
    background: linear-gradient(135deg, var(--red), #e04545);
    color: #fff;
    border-color: var(--red);
    box-shadow: 0 2px 8px rgba(255,107,107,0.25);
}

/* ── 歷史紀錄（改良卡片樣式） ────────────────── */
.history-list { display: grid; gap: 0.65rem; }

.hist-card {
    border-radius: var(--radius);
    overflow: visible;
    transition: box-shadow var(--transition);
}
.hist-card:hover {
    box-shadow: var(--shadow-lg);
}

.hist-head {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0.9rem;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
}

.hist-period { color: var(--accent); font-weight: 700; font-size: 0.88rem; }
.hist-time { color: var(--text-dim); font-size: 0.78rem; }
.hist-tags { display: flex; gap: 5px; margin-left: auto; }

.hist-tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.7rem;
    height: 1.7rem;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 700;
}
.ht-red { background: var(--red-dim); color: var(--red); }
.ht-blue { background: var(--blue-dim); color: var(--blue); }
.ht-orange { background: var(--orange-dim); color: var(--orange); }
.ht-green { background: var(--green-dim); color: var(--green); }
.ht-purple { background: var(--purple-dim); color: var(--purple); }

.hist-super {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.7rem;
    height: 1.7rem;
    border-radius: 50%;
    font-size: 0.72rem;
    font-weight: 700;
    background: radial-gradient(circle at 35% 30%, #e0b8ff, #b07aff 40%, #8b5cf6 100%);
    color: #fff;
    border: 1.5px solid #c89aff;
    box-shadow: 0 2px 6px rgba(139,92,246,0.5), 0 0 10px rgba(184,146,255,0.4), inset 0 1px 2px rgba(255,255,255,0.2);
    animation: super-pulse 2s ease-in-out infinite;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.hist-body {
    padding: 0.7rem 0.9rem 0.8rem;
}

.hist-balls {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.hball {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.1rem;
    height: 2.1rem;
    border-radius: 50%;
    font-size: 0.72rem;
    font-weight: 700;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    background: radial-gradient(circle at 35% 30%, #4a5a6e, #2a3545 50%, #1a2535 100%);
    color: var(--text);
    border: 1.5px solid #3a4a5e;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3), inset 0 1px 1px rgba(255,255,255,0.08);
    text-shadow: 0 1px 1px rgba(0,0,0,0.3);
}
.hball:hover { transform: scale(1.15); z-index: 1; box-shadow: 0 3px 8px rgba(0,0,0,0.4), inset 0 1px 1px rgba(255,255,255,0.1); }

/* 超級獎號球 — 紫色脈動，優先於分區色 */
.hball-super, .hball.hball-super {
    background: radial-gradient(circle at 35% 30%, #e0b8ff, #b07aff 40%, #8b5cf6 100%);
    color: #fff;
    border: 2px solid #c89aff;
    box-shadow: 0 2px 6px rgba(139,92,246,0.5), 0 0 12px rgba(184,146,255,0.4), inset 0 1px 2px rgba(255,255,255,0.2);
    animation: super-pulse 2s ease-in-out infinite;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.draw-id { color: var(--accent); font-weight: 700; }
.draw-time { color: var(--text-dim); font-size: 0.78rem; }

/* ── 分頁導航 ────────────────────────────────── */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 1rem;
    padding: 1rem 0;
}

.page-btn {
    padding: 0.45rem 1.3rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--accent);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all var(--transition);
}

.page-btn:hover { background: var(--bg-hover); border-color: var(--accent); }
.page-info { color: var(--text-dim); font-size: 0.85rem; }

/* ── 資料表格 ────────────────────────────────── */
.table-scroll { overflow-x: auto; overflow-y: auto; -webkit-overflow-scrolling: touch; margin-bottom: 0.5rem; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.data-table th, .data-table td { padding: 0.45rem 0.65rem; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; overflow-wrap: break-word; }
.data-table td.wrap-ok { white-space: normal; }
.data-table th { color: var(--text-dim); font-weight: 600; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.3px; }
.data-table tr:hover td { background: var(--bg-hover); }

/* ── 工具區段 ────────────────────────────────── */
.tool-section h3 { font-size: 0.95rem; margin-bottom: 0.55rem; font-weight: 700; }
.tool-desc { font-size: 0.78rem; color: var(--text-dim); margin-bottom: 0.85rem; }
.empty-state { text-align: center; padding: 2.5rem; color: var(--text-dim); }

/* ── 信號詳情（工具頁） ────────────────────── */
.signal-detail-list { display: grid; gap: 0.45rem; }
.signal-detail .card-body { padding: 0.45rem 0.85rem; }
.signal-meta { display: flex; gap: 0.85rem; font-size: 0.78rem; color: var(--text-dim); flex-wrap: wrap; min-width: 0; overflow-wrap: break-word; }
.signal-name-lg { font-weight: 700; font-size: 0.88rem; }
.section-title { font-size: 1.05rem; font-weight: 700; margin: 1.2rem 0 0.6rem; }

/* ── 引擎狀態 ────────────────────────────────── */
.engine-status {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.5rem;
}

.status-item { text-align: center; padding: 0.45rem; }
.status-label { font-size: 0.7rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; margin-bottom: 0.15rem; }
.status-value { font-size: 1.05rem; font-weight: 700; }
.status-sub { font-size: 0.68rem; color: var(--text-muted); }

.progress-bar-bg { height: 3px; background: var(--bg); border-radius: 2px; overflow: hidden; margin-top: 0.35rem; }
.progress-bar { height: 100%; border-radius: 2px; background: linear-gradient(90deg, var(--accent), var(--green)); }

.card-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.star-payout { font-size: 0.72rem; color: var(--text-dim); font-weight: 600; font-variant-numeric: tabular-nums; }
.star-stat-hits { font-size: 0.7rem; color: var(--text-muted); }

/* ── 頁尾 ────────────────────────────────────── */
.footer {
    text-align: center;
    padding: 2rem 1rem;
    margin-top: 2.5rem;
    color: var(--text-muted);
    font-size: 0.72rem;
    border-top: 1px solid var(--border);
}

/* ══════════════════════════════════════════════
   新手指南頁面
   ══════════════════════════════════════════════ */
.guide-card .card-body { padding: 1rem; }

.guide-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.85rem;
}

.guide-item {
    display: flex;
    gap: 0.65rem;
    align-items: flex-start;
}

.guide-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
    width: 2.2rem;
    text-align: center;
}

.guide-text strong {
    display: block;
    font-size: 0.88rem;
    margin-bottom: 0.15rem;
}

.guide-text p {
    font-size: 0.8rem;
    color: var(--text-dim);
    line-height: 1.5;
}

.guide-subtitle {
    font-size: 0.92rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid var(--border);
}

.guide-desc {
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-bottom: 0.75rem;
    line-height: 1.5;
}

.guide-payout-table { margin-bottom: 0.5rem; }

.guide-rule-box {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.75rem;
    font-size: 0.82rem;
}

.guide-rule-box p { margin-bottom: 0.4rem; line-height: 1.5; }

.guide-rule-items {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin: 0.4rem 0;
}

.guide-rule-tag {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.2rem 0.55rem;
    border-radius: 6px;
}

.tag-red { color: var(--red); background: var(--red-dim); }
.tag-blue { color: var(--blue); background: var(--blue-dim); }
.tag-orange { color: var(--orange); background: var(--orange-dim); }
.tag-green { color: var(--green); background: var(--green-dim); }
.tag-gray { color: var(--text-dim); background: var(--bg-hover); }

.guide-rule-payout {
    font-size: 0.75rem;
    color: var(--gold);
    margin-top: 0.3rem;
}

.guide-explain-list { display: grid; gap: 0.55rem; }

.guide-explain {
    display: grid;
    grid-template-columns: 100px 1fr;
    gap: 0.5rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.82rem;
}

.guide-explain:last-child { border-bottom: none; }

.guide-explain-label {
    font-weight: 700;
    color: var(--accent);
    font-size: 0.78rem;
}

.guide-explain-desc {
    color: var(--text-dim);
    line-height: 1.5;
    font-size: 0.8rem;
}

.guide-signal-list { display: grid; gap: 0.35rem; }

.guide-signal {
    display: grid;
    grid-template-columns: 90px 1fr;
    gap: 0.5rem;
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.8rem;
    align-items: baseline;
}

.guide-signal:last-child { border-bottom: none; }

.guide-signal strong {
    color: var(--text);
    font-size: 0.78rem;
}

.guide-signal span {
    color: var(--text-dim);
    line-height: 1.4;
}

.guide-glossary dl { display: grid; gap: 0.45rem; }

.guide-glossary dt {
    font-weight: 700;
    color: var(--accent);
    font-size: 0.82rem;
    margin-top: 0.3rem;
}

.guide-glossary dd {
    color: var(--text-dim);
    font-size: 0.8rem;
    line-height: 1.5;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--border);
}

.guide-glossary dd:last-child { border-bottom: none; }

.guide-cta {
    text-align: center;
    margin: 1.5rem 0;
}

.guide-cta-btn {
    display: inline-block;
    padding: 0.7rem 2rem;
    background: linear-gradient(135deg, var(--accent), #3a7bd5);
    color: #fff;
    text-decoration: none;
    border-radius: var(--radius);
    font-weight: 700;
    font-size: 0.92rem;
    transition: all var(--transition);
    box-shadow: 0 3px 12px rgba(77,159,255,0.35);
}

.guide-cta-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(77,159,255,0.45);
}

/* ── 新手引導導航連結 ────────────────────── */
.nav-link-guide {
    color: var(--gold) !important;
    font-size: 0.72rem !important;
}
.nav-link-guide.active {
    background: var(--gold) !important;
    color: #000 !important;
}

/* ══════════════════════════════════════════════
   Tooltip 系統（純 CSS）
   ══════════════════════════════════════════════ */
.tip {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: var(--bg-hover);
    border: 1px solid var(--border-light);
    color: var(--text-muted);
    font-size: 0.55rem;
    font-weight: 700;
    cursor: help;
    flex-shrink: 0;
    vertical-align: middle;
    margin-left: 0.25rem;
}

.tip::after {
    content: attr(data-tip);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-elevated);
    border: 1px solid var(--border-light);
    color: var(--text);
    font-size: 0.72rem;
    font-weight: 400;
    padding: 0.45rem 0.65rem;
    border-radius: 6px;
    white-space: normal;
    width: max-content;
    max-width: min(280px, 90vw);
    line-height: 1.4;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
    z-index: 200;
}

/* 靠右側的 tip 向左對齊，避免超出螢幕 */
.card-header .tip::after,
.nav-actions .tip::after {
    left: auto;
    right: 0;
    transform: none;
}

/* 表格內的 tip 改為向下彈出，避免被裁切 */
th .tip::after,
thead .tip::after {
    bottom: auto;
    top: calc(100% + 6px);
}

.tip:hover::after,
.tip:focus::after {
    opacity: 1;
}

/* ── 首次訪問歡迎橫幅 ────────────────────── */
.welcome-banner {
    background: linear-gradient(135deg, rgba(77,159,255,0.12), rgba(255,211,105,0.08));
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    padding: 0.85rem 1rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.82rem;
    animation: fadeIn 0.3s ease;
}

.welcome-banner-icon { font-size: 1.3rem; flex-shrink: 0; }

.welcome-banner-text {
    flex: 1;
    line-height: 1.5;
    color: var(--text-dim);
}

.welcome-banner-text strong {
    color: var(--text);
    display: block;
    margin-bottom: 0.15rem;
}

.welcome-banner-link {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    white-space: nowrap;
    padding: 0.35rem 0.8rem;
    border: 1px solid var(--accent);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    transition: all var(--transition);
    flex-shrink: 0;
}

.welcome-banner-link:hover {
    background: var(--accent);
    color: #fff;
}

.welcome-banner-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    padding: 0.2rem;
    flex-shrink: 0;
    transition: color var(--transition);
}
.welcome-banner-close:hover { color: var(--text); }

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

/* ── 區段說明文字 ──────────────────────── */
.section-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    overflow-wrap: break-word;
    word-break: break-word;
    line-height: 1.5;
}

/* ══════════════════════════════════════════════
   RWD 響應式（手機優先）
   ══════════════════════════════════════════════ */

/* ── 768px 以下：平板/大手機 ── */
@media (max-width: 768px) {
    .container { padding: 0.85rem; }
    .page-header { flex-direction: column; align-items: flex-start; gap: 0.4rem; }
    .header-badges { width: 100%; }
}

/* ── 640px 以下：手機 ── */
@media (max-width: 640px) {
    /* 全域 */
    body { font-size: 13px; }
    .container { padding: 0.6rem; }

    /* 導航：水平捲動 + 更大觸控區 */
    .navbar { padding: 0.35rem 0.5rem; gap: 0.25rem; }
    .nav-brand { font-size: 0.88rem; }
    .nav-links { gap: 1px; justify-content: flex-start; flex-shrink: 1; min-width: 0; }
    .nav-link {
        padding: 0.35rem 0.6rem;
        font-size: 0.75rem;
        min-height: 2rem;
        display: inline-flex;
        align-items: center;
    }
    .nav-link-guide { font-size: 0.68rem !important; }
    .nav-actions { gap: 0.15rem; }
    .nav-icon-btn { font-size: 0.85rem; padding: 0.2rem 0.3rem; min-width: 2rem; min-height: 2rem; }

    /* 最新開獎 */
    .latest-bar { padding: 0.35rem 0.5rem; }
    .latest-draw-row { flex-direction: column; gap: 0.35rem; }
    .latest-info-row { gap: 0.3rem; font-size: 0.72rem; }
    .latest-numbers-grid { gap: 2px; }
    .ball-latest { width: 1.6rem; height: 1.6rem; font-size: 0.6rem; }

    /* 頁面標題 */
    .page-header { gap: 0.3rem; }
    .page-header h1 { font-size: 1.1rem; }
    .badge { font-size: 0.68rem; padding: 0.15rem 0.45rem; flex-shrink: 1; }

    /* 號碼球 */
    .ball { width: 2.1rem; height: 2.1rem; font-size: 0.72rem; }
    .ball-sm { width: 1.7rem; height: 1.7rem; font-size: 0.65rem; }
    .ball-xs { width: 1.35rem; height: 1.35rem; font-size: 0.56rem; }
    .hball { width: 2rem; height: 2rem; font-size: 0.68rem; }

    /* 三格卡片 */
    .card-row-3 { gap: 0.35rem; }
    .card-sm { padding: 0.65rem 0.3rem; }
    .card-value { font-size: 1.4rem; }

    /* 大小/單雙卡片 */
    .side-cards-grid { gap: 0.35rem; }
    .side-card { padding: 0.5rem 0.25rem 0.45rem; }
    .side-value { font-size: 1.7rem; }
    .side-value.super-num { font-size: 1.4rem; }
    .side-ev { font-size: 0.62rem; }
    .side-tag { font-size: 0.56rem; padding: 0.08rem 0.28rem; }
    .side-badge { font-size: 0.6rem; padding: 0.1rem 0.35rem; }

    /* 星級預測 */
    .star-cards-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.45rem; }
    .star-card { padding: 0.5rem 0.3rem 0.45rem; }
    .star-ev { font-size: 0.62rem; }
    .star-row { padding: 0.4rem 0.55rem; gap: 0.35rem; }

    /* v2 卡片 */
    .sc-value { white-space: normal; word-break: break-word; overflow: visible; text-overflow: clip; font-size: 0.68rem; }
    .sc-nums { gap: 3px; }
    .sc-detail-table { font-size: 0.65rem; }
    .sc-detail-table th, .sc-detail-table td { padding: 1px 2px; }

    /* 日期導航 */
    .date-nav { gap: 0.25rem; }
    .date-btn { padding: 0.35rem 0.65rem; font-size: 0.75rem; min-height: 2rem; }

    /* 排名/分布/信號 */
    .rank-item { grid-template-columns: 1.8rem 1fr 55px; }
    .dist-item { grid-template-columns: 55px 1fr 70px; }
    .signal-item { grid-template-columns: 1fr auto 30px; }
    .signal-hit { display: none; }

    /* 表格 */
    .data-table th, .data-table td { white-space: normal; word-break: break-word; padding: 0.35rem 0.4rem; font-size: 0.72rem; }

    /* 歡迎/指南 */
    .welcome-banner { flex-wrap: wrap; gap: 0.5rem; padding: 0.65rem 0.75rem; }
    .guide-explain { grid-template-columns: 80px 1fr; }
    .guide-signal { grid-template-columns: 80px 1fr; }
    .guide-grid { grid-template-columns: 1fr; }

    /* Tooltip */
    .tip::after { max-width: 220px; font-size: 0.68rem; }

    /* 預測/回測 */
    .bet-rec-banner { padding: 10px 12px; gap: 8px; font-size: 0.82rem; flex-wrap: wrap; }
    .pred-detail-row { word-break: break-word; }
    .section-hint { font-size: 0.7rem; }

    /* 工具控制列 */
    .tool-controls { gap: 0.4rem; }
    .tool-select { font-size: 0.72rem; padding: 0.3rem 0.5rem; }
    .tool-input { width: 120px; font-size: 0.72rem; }
    .tool-btn { padding: 0.35rem 0.8rem; font-size: 0.72rem; min-height: 2rem; }
}

/* ── 480px 以下：小手機 ── */
@media (max-width: 480px) {
    .container { padding: 0.45rem; }

    /* 導航更緊湊 */
    .nav-link { padding: 0.3rem 0.45rem; font-size: 0.7rem; }

    /* 號碼球縮小 */
    .ball { width: 1.9rem; height: 1.9rem; font-size: 0.68rem; }
    .ball-sm { width: 1.55rem; height: 1.55rem; font-size: 0.6rem; }
    .ball-xs { width: 1.25rem; height: 1.25rem; font-size: 0.52rem; }
    .ball-latest { width: 1.4rem; height: 1.4rem; font-size: 0.55rem; }
    .hball { width: 1.8rem; height: 1.8rem; font-size: 0.65rem; }

    /* 大小/單雙卡片 */
    .side-cards-grid { gap: 0.25rem; }
    .side-card { padding: 0.4rem 0.15rem 0.35rem; }
    .side-value { font-size: 1.4rem; }
    .side-value.super-num { font-size: 1.15rem; }
    .side-hero { padding: 0.3rem 0; }
    .side-tags { gap: 0.15rem; }

    /* 星級卡片 */
    .star-cards-grid { gap: 0.35rem; }
    .star-card { padding: 0.4rem 0.15rem 0.35rem; }
    .star-card-tags { gap: 0.15rem; }
    .star-card-nums { gap: 3px; }

    /* 三格卡片 */
    .card-value { font-size: 1rem; word-break: break-all; }
    .card-sub { font-size: 0.62rem; word-break: break-word; }

    /* v2 卡片 */
    .sc-row { flex-wrap: wrap; }
    .sc-ring-wrap { width: 44px; height: 44px; }
    .sc-ring-wrap svg { width: 44px; height: 44px; }
    .sc-ring-pct { font-size: 0.68rem; }

    /* 最新開獎 */
    .latest-countdown { padding: 0.15rem 0.4rem; font-size: 0.68rem; }
    .super-badge { width: 1.5rem; height: 1.5rem; font-size: 0.65rem; }

    /* 排名 */
    .rank-item { grid-template-columns: 1.6rem 1fr 45px; gap: 0.25rem; }
    .dist-item { grid-template-columns: 45px 1fr 55px; }
    .rank-val { font-size: 0.65rem; }
    .dist-val { font-size: 0.62rem; }

    /* 頁尾 */
    .footer { padding: 1.2rem 0.5rem; font-size: 0.65rem; }
}

/* ── 380px 以下：超小螢幕 ── */
@media (max-width: 380px) {
    .card-row-3 { grid-template-columns: 1fr; }
    .star-cards-grid { grid-template-columns: 1fr; }
    .nav-brand { font-size: 0.8rem; }
    .nav-link { padding: 0.25rem 0.35rem; font-size: 0.65rem; }
    .ball { width: 1.75rem; height: 1.75rem; font-size: 0.62rem; }
    .hball { width: 1.65rem; height: 1.65rem; font-size: 0.6rem; }
}

/* ══════════════════════════════════════════════
   美化工具分頁導航
   ══════════════════════════════════════════════ */
.tool-tabs {
    display: flex;
    gap: 0.45rem;
    padding: 0.5rem 0;
    margin-bottom: 1rem;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    /* Fade hint for scrollable tabs */
    mask-image: linear-gradient(to right, black 90%, transparent 100%);
    -webkit-mask-image: linear-gradient(to right, black 90%, transparent 100%);
}
.tool-tabs::-webkit-scrollbar { display: none; }

.tool-tab {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 1rem;
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: 10px;
    color: var(--text-dim);
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
    transition: all 0.2s ease;
    cursor: pointer;
}

.tool-tab:hover {
    background: var(--bg-hover);
    border-color: var(--border-light);
    color: var(--text);
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(0,0,0,0.2);
}

.tool-tab.active {
    background: linear-gradient(135deg, var(--accent), #3a7bd5);
    border-color: var(--accent);
    color: #fff;
    box-shadow: 0 3px 12px rgba(77,159,255,0.35);
}

.tool-tab-icon {
    font-size: 1rem;
    line-height: 1;
}

.tool-tab-label {
    line-height: 1;
}

@media (max-width: 640px) {
    .tool-tabs { gap: 0.3rem; padding: 0.4rem 0; margin-bottom: 0.75rem; }
    .tool-tab {
        padding: 0.4rem 0.65rem;
        font-size: 0.72rem;
        gap: 0.25rem;
        min-height: 2rem;
    }
    .tool-tab-icon { font-size: 0.85rem; }
}
@media (max-width: 480px) {
    .tool-tab { padding: 0.35rem 0.5rem; font-size: 0.68rem; }
    .tool-tab-label { display: none; }
    .tool-tab-icon { font-size: 1rem; }
}

/* ══════════════════════════════════════════════
   落球分布圖（Number Grid）
   ══════════════════════════════════════════════ */
.grid-legend {
    margin-bottom: 0.75rem;
    padding: 0.6rem 0.8rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
.grid-legend-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-dim);
    display: block;
    margin-bottom: 0.4rem;
}
.grid-legend-items {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}
.gl-item {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.72rem;
    color: var(--text-dim);
}
.gl-swatch {
    display: inline-block;
    width: 16px;
    height: 16px;
    border-radius: 3px;
    border: 1px solid rgba(255,255,255,0.1);
}
.gl-big-odd    { background: #4a7d4a; }
.gl-big-even   { background: #7b5ea7; }
.gl-small-odd  { background: #c9a94e; }
.gl-small-even { background: #d46a7e; }
.gl-neutral    { background: var(--bg-hover); }

.grid-scroll-wrap {
    overflow-x: auto;
    overflow-y: auto;
    max-height: 75vh;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    scrollbar-width: thin;
    scrollbar-color: var(--border-light) var(--bg);
}

.number-grid-table {
    border-collapse: collapse;
    font-size: 0.62rem;
    width: max-content;
    min-width: 100%;
}

.number-grid-table thead {
    position: sticky;
    top: 0;
    z-index: 2;
}

.grid-th-period {
    position: sticky;
    left: 0;
    z-index: 3;
    background: var(--bg-elevated);
    padding: 0.35rem 0.25rem;
    font-weight: 700;
    color: var(--text-dim);
    text-align: center;
    border-bottom: 2px solid var(--border-light);
    border-right: 2px solid var(--border-light);
    min-width: 52px;
    font-size: 0.62rem;
}

.grid-th-num {
    background: var(--bg-elevated);
    padding: 0.3rem 0;
    font-weight: 600;
    color: var(--text-dim);
    text-align: center;
    border-bottom: 2px solid var(--border-light);
    min-width: 22px;
    width: 22px;
    font-size: 0.58rem;
}

.grid-row { transition: background 0.1s ease; }
.grid-row:hover { background: rgba(77,159,255,0.06); }
.grid-row-alt { background: rgba(255,255,255,0.01); }

.grid-td-period {
    position: sticky;
    left: 0;
    z-index: 1;
    background: var(--bg-card);
    padding: 0.2rem 0.25rem;
    text-align: center;
    border-right: 2px solid var(--border-light);
    border-bottom: 1px solid var(--border);
    font-variant-numeric: tabular-nums;
}
.grid-row:hover .grid-td-period {
    background: var(--bg-hover);
}

.grid-period-id {
    color: var(--accent);
    font-weight: 700;
    font-size: 0.62rem;
}

.grid-cell {
    padding: 0.15rem 0;
    text-align: center;
    border-bottom: 1px solid rgba(30,42,58,0.5);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    min-width: 22px;
    height: 22px;
    font-size: 0.58rem;
}

.grid-cell-hit {
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}

/* 大/單 (Big + Odd) — 綠色系 */
.gc-big-odd {
    background: #4a7d4a;
}
/* 大/雙 (Big + Even) — 紫色系 */
.gc-big-even {
    background: #7b5ea7;
}
/* 小/單 (Small + Odd) — 黃色系 */
.gc-small-odd {
    background: #c9a94e;
    color: #1a1a1a;
    text-shadow: none;
}
/* 小/雙 (Small + Even) — 粉紅色系 */
.gc-small-even {
    background: #d46a7e;
}

/* 超級獎號紅框 */
.grid-cell-super {
    outline: 2px solid var(--red);
    outline-offset: -2px;
    position: relative;
}

/* 號碼篩選高亮 */
.grid-th-highlight {
    background: var(--accent) !important;
    color: #fff !important;
}
.grid-cell-filter {
    outline: 2px solid var(--accent) !important;
    outline-offset: -2px;
}
.grid-col-highlight {
    background: var(--accent-dim);
}

/* 每 10 號加重邊框方便閱讀 */
.number-grid-table th:nth-child(11n+1),
.number-grid-table td:nth-child(11n+1) {
    border-left: 1.5px solid var(--border-light);
}

@media (max-width: 640px) {
    .grid-scroll-wrap { max-height: 65vh; }
    .grid-cell { min-width: 18px; width: 18px; height: 18px; font-size: 0.52rem; }
    .grid-th-num { min-width: 18px; width: 18px; font-size: 0.52rem; }
    .grid-td-period { min-width: 44px; }
    .grid-period-id { font-size: 0.56rem; }
}
@media (max-width: 480px) {
    .grid-cell { min-width: 16px; width: 16px; height: 16px; font-size: 0.48rem; }
    .grid-th-num { min-width: 16px; width: 16px; font-size: 0.48rem; }
    .grid-td-period { min-width: 38px; padding: 0.15rem 0.2rem; }
    .grid-period-id { font-size: 0.5rem; }
    .hm-th { min-width: 24px; padding: 0.2rem; font-size: 0.58rem; }
    .hm-cell { min-width: 24px; height: 24px; font-size: 0.58rem; }
}

/* ══════════════════════════════════════════════
   Light Theme
   ══════════════════════════════════════════════ */

/* ══════════════════════════════════════════════
   Target draw badge
   ══════════════════════════════════════════════ */
.badge-accent {
    background: var(--accent-dim);
    color: var(--accent);
    border: 1px solid var(--accent);
    font-weight: 700;
}
.badge-link {
    background: var(--bg-hover);
    color: var(--accent);
    text-decoration: none;
    cursor: pointer;
    border: 1px solid var(--border);
}
.badge-link:hover {
    background: var(--accent-dim);
    border-color: var(--accent);
}

/* ══════════════════════════════════════════════
   Tool Controls (period selectors etc)
   ══════════════════════════════════════════════ */
.tool-controls {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}
.tool-control-label {
    font-size: 0.78rem;
    color: var(--text-dim);
    font-weight: 600;
}
.tool-select {
    padding: 0.35rem 0.65rem;
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color var(--transition);
}
.tool-select:hover { border-color: var(--accent); }
.tool-select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-dim); }
.tool-input {
    padding: 0.35rem 0.65rem;
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.78rem;
    width: 160px;
}
.tool-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-dim); }
.tool-btn {
    padding: 0.4rem 1rem;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition);
}
.tool-btn:hover { filter: brightness(1.15); }
.tool-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.tool-btn-sm { padding: 0.25rem 0.6rem; font-size: 0.7rem; }

/* ══════════════════════════════════════════════
   Gap Warning
   ══════════════════════════════════════════════ */
.rank-item-warn {
    background: var(--orange-dim);
    border-radius: var(--radius-sm);
    padding: 0.1rem 0.3rem;
}
.ball-warn {
    background: linear-gradient(135deg, #ffb347, #ff8c00) !important;
    color: #000 !important;
    text-shadow: none !important;
}
.rank-bar-warn {
    background: linear-gradient(90deg, var(--orange), #ff8c00);
}
.rank-bar-consec {
    background: linear-gradient(90deg, var(--cyan), var(--blue));
}

/* ══════════════════════════════════════════════
   Heatmap
   ══════════════════════════════════════════════ */
.heatmap-scroll {
    overflow-x: auto;
    margin: 0.5rem 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
.heatmap-table {
    border-collapse: collapse;
    font-size: 0.65rem;
    width: max-content;
}
.hm-th {
    background: var(--bg-elevated);
    padding: 0.3rem 0.35rem;
    font-weight: 700;
    color: var(--text-dim);
    text-align: center;
    border: 1px solid var(--border);
    min-width: 28px;
}
.hm-cell {
    text-align: center;
    padding: 0.2rem;
    border: 1px solid rgba(30,42,58,0.3);
    min-width: 28px;
    height: 28px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--text);
    background: color-mix(in srgb, var(--accent) var(--hm-intensity, 0%), var(--bg-card));
}
.hm-diag {
    background: var(--bg-elevated) !important;
    color: var(--text-muted);
}
.heatmap-legend {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: center;
    font-size: 0.72rem;
    color: var(--text-dim);
    margin-top: 0.5rem;
}
.hm-gradient {
    width: 120px;
    height: 12px;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--bg-card), var(--accent));
    border: 1px solid var(--border);
}

/* ══════════════════════════════════════════════
   Trend Chart
   ══════════════════════════════════════════════ */
.trend-chart-wrap {
    margin: 1rem 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.8rem;
    overflow-x: auto;
}
.trend-chart-wrap canvas { width: 100%; height: auto; }
.trend-legend {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}
.trend-legend-item {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.78rem;
    color: var(--text-dim);
    font-weight: 600;
}
.trend-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

/* ══════════════════════════════════════════════
   Picker (Smart Number Picker)
   ══════════════════════════════════════════════ */
.picker-grid {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 0.3rem;
    margin-bottom: 1rem;
}
.picker-ball {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1;
    border-radius: 50%;
    border: 2px solid var(--border);
    background: var(--bg-card);
    color: var(--text-dim);
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
    font-variant-numeric: tabular-nums;
}
.picker-ball:hover {
    border-color: var(--accent);
    color: var(--text);
    background: var(--bg-hover);
}
.picker-selected {
    background: var(--accent) !important;
    border-color: var(--accent) !important;
    color: #fff !important;
    box-shadow: 0 2px 8px rgba(77,159,255,0.4);
}
.picker-info {
    margin-top: 1rem;
}
.picker-selected-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}
.picker-label {
    font-size: 0.82rem;
    color: var(--text-dim);
}
.picker-result {
    margin-top: 1rem;
}

@media (max-width: 640px) {
    .picker-grid { grid-template-columns: repeat(8, 1fr); gap: 0.2rem; }
    .picker-ball { font-size: 0.62rem; border-width: 1.5px; }
}
@media (max-width: 380px) {
    .picker-grid { grid-template-columns: repeat(8, 1fr); gap: 0.15rem; }
    .picker-ball { font-size: 0.56rem; }
}

/* ══════════════════════════════════════════════
   Simulator
   ══════════════════════════════════════════════ */
.sim-result { margin-top: 1rem; }
.sim-chart-wrap {
    margin-top: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.8rem;
    overflow-x: auto;
}
.sim-chart-wrap canvas { width: 100%; height: auto; }

/* ══════════════════════════════════════════════
   Signal Validation Table (信號規律性驗證)
   ══════════════════════════════════════════════ */
.sv-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.sv-table { width: 100%; border-collapse: collapse; font-size: 0.75rem; }
.sv-table th { text-align: left; padding: 4px 6px; color: var(--text-dim); border-bottom: 1px solid rgba(255,255,255,0.08); font-weight: 500; white-space: nowrap; }
.sv-table td { padding: 5px 6px; border-bottom: 1px solid rgba(255,255,255,0.04); }
.sv-name { display: flex; align-items: center; gap: 4px; }
.sv-weight { font-size: 0.6rem; color: var(--text-dim); background: rgba(255,255,255,0.05); padding: 1px 4px; border-radius: 3px; }
.sv-bar-wrap { position: relative; width: 60px; height: 14px; background: rgba(255,255,255,0.05); border-radius: 3px; overflow: hidden; }
.sv-bar { position: absolute; top: 0; left: 0; height: 100%; border-radius: 3px; opacity: 0.6; }
.sv-bar-text { position: relative; z-index: 1; font-size: 0.65rem; line-height: 14px; padding-left: 3px; }
.sv-trend { font-size: 0.85rem; }
.sv-improving { color: var(--green); }
.sv-declining { color: var(--red); }
.sv-stable { color: var(--text-dim); }
.sv-verdict { font-size: 0.65rem; padding: 1px 5px; border-radius: 3px; }
.sv-v-effective { background: rgba(76,175,80,0.15); color: var(--green); }
.sv-v-promising { background: rgba(255,152,0,0.15); color: var(--orange); }
.sv-v-ineffective { background: rgba(244,67,54,0.1); color: var(--red); }

/* ══════════════════════════════════════════════
   Strategy Performance (策略績效追蹤)
   ══════════════════════════════════════════════ */
.sp-tabs { display: flex; gap: 4px; margin-bottom: 0.5rem; overflow-x: auto; scrollbar-width: none; }
.sp-tab { background: rgba(255,255,255,0.05); border: none; color: var(--text-dim); padding: 4px 10px; border-radius: 4px; font-size: 0.75rem; cursor: pointer; white-space: nowrap; }
.sp-tab-active { background: var(--accent); color: #000; font-weight: 600; }
.sp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 6px; }
.sp-item { background: rgba(255,255,255,0.03); border-radius: 6px; padding: 6px 8px; }
.sp-inactive { opacity: 0.4; }
.sp-name { font-size: 0.72rem; color: var(--text-dim); margin-bottom: 2px; }
.sp-metrics { display: flex; gap: 6px; align-items: center; font-size: 0.75rem; }
.sp-hit { font-weight: 700; }
.sp-ema { font-size: 0.65rem; color: var(--text-dim); }

/* ══════════════════════════════════════════════
   RNG Audit Panel (RNG 審計)
   ══════════════════════════════════════════════ */
.rng-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.rng-item { background: rgba(255,255,255,0.03); border-radius: 6px; padding: 6px 8px; text-align: center; }
.rng-test-name { font-size: 0.65rem; color: var(--text-dim); }
.rng-result { font-size: 0.85rem; font-weight: 700; margin-top: 2px; }
.rng-pass { color: var(--green); }
.rng-fail { color: var(--red); }
.rng-conclusion { text-align: center; padding: 0.5rem; font-size: 0.85rem; font-weight: 600; border-radius: 6px; margin-top: 0.5rem; }
.rng-conclusion-ok { background: rgba(76,175,80,0.1); color: var(--green); }
.rng-conclusion-bias { background: rgba(244,67,54,0.1); color: var(--red); }

@media (max-width: 480px) {
    .sv-table { font-size: 0.65rem; }
    .sv-bar-wrap { width: 45px; }
    .sp-grid { grid-template-columns: 1fr 1fr; }
    .rng-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ══════════════════════════════════════════════
   Play Stats Panel (玩法命中追蹤)
   ══════════════════════════════════════════════ */
.play-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.6rem;
    padding: 0.6rem 0;
}
.ps-item {
    background: var(--bg-card-inner, rgba(255,255,255,0.03));
    border-radius: 8px;
    padding: 0.5rem 0.6rem;
}
.ps-label { font-size: 0.75rem; color: var(--text-dim); margin-bottom: 2px; }
.ps-rate { font-size: 1.2rem; font-weight: 700; }
.ps-detail { font-size: 0.7rem; color: var(--text-dim); display: flex; gap: 0.5rem; margin: 2px 0; }
.ps-dots { display: flex; gap: 2px; margin-top: 4px; }
.sc-dot-skip { background: var(--text-dim); opacity: 0.3; }
.ps-stars-summary { grid-column: 1 / -1; }
.ps-star-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
    margin-top: 4px;
}
.ps-star-cell {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.7rem;
    padding: 2px 4px;
    background: rgba(255,255,255,0.02);
    border-radius: 4px;
}
.ps-star-num { color: var(--text-dim); }
.ps-star-roi { font-weight: 600; font-variant-numeric: tabular-nums; }
@media (max-width: 480px) {
    .play-stats-grid { grid-template-columns: 1fr 1fr; }
    .ps-star-grid { grid-template-columns: repeat(5, 1fr); }
}

/* ══════════════════════════════════════════════
   Predictions History
   ══════════════════════════════════════════════ */
.pred-history-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.pred-history-card .card-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}
.pred-draw-id {
    font-weight: 700;
    color: var(--accent);
    font-size: 0.82rem;
    font-variant-numeric: tabular-nums;
}
.pred-created {
    font-size: 0.72rem;
    color: var(--text-muted);
}
.pred-tags {
    display: flex;
    gap: 0.3rem;
    margin-left: auto;
}
.pred-actual {
    margin-bottom: 0.5rem;
}
.pred-label {
    font-size: 0.75rem;
    color: var(--text-dim);
    font-weight: 600;
    margin-bottom: 0.3rem;
    display: block;
}
.pred-detail-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    font-size: 0.78rem;
    color: var(--text-dim);
    margin-top: 0.4rem;
}
.text-dim { color: var(--text-muted); }

/* ══════════════════════════════════════════════
   History + Prediction Merged View
   ══════════════════════════════════════════════ */
.hist-pred-tags {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    margin-left: 0.5rem;
}
.hist-pred-tags .toggle-icon {
    font-size: 0.65rem;
    color: var(--text-dim);
    margin-left: 0.2rem;
}
.hist-pred-detail {
    padding: 0.6rem 0.9rem;
    border-top: 1px dashed var(--border);
    background: var(--bg-card);
}
.hist-pred-table {
    font-size: 0.78rem;
    margin-top: 0.5rem;
}
.hball-hit {
    background: radial-gradient(circle at 35% 30%, #8bc4ff, #5ba3ff 40%, #3a7bd5 100%) !important;
    color: #fff !important;
    border-color: #5ba3ff !important;
    box-shadow: 0 2px 8px rgba(77,159,255,0.35), inset 0 1px 2px rgba(255,255,255,0.15);
}

/* (Mobile Ball Size — 已合併至 RWD 區段) */

/* ── 冷啟動進度條動畫 ──────────────────────── */
.pulse-bg {
    animation: pulse-bg-anim 1.5s ease-in-out infinite;
}
@keyframes pulse-bg-anim {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.65; }
}

/* ══ v9.0: 下注建議橫幅 ═══════════════════════ */
.bet-rec-banner {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 18px; border-radius: 10px; margin-bottom: 16px;
    font-size: 0.95rem; font-weight: 500;
    min-width: 0; max-width: 100%; overflow: hidden;
}
.bet-rec-go {
    background: rgba(78, 203, 113, 0.12);
    border: 1px solid rgba(78, 203, 113, 0.3);
    color: var(--green);
}
.bet-rec-mid {
    background: rgba(255, 180, 50, 0.12);
    border: 1px solid rgba(255, 180, 50, 0.3);
    color: var(--orange);
}
.bet-rec-wait {
    background: rgba(160, 160, 180, 0.10);
    border: 1px solid rgba(160, 160, 180, 0.25);
    color: var(--text-dim);
}
.bet-rec-icon { font-size: 1.1rem; flex-shrink: 0; }
.bet-rec-text { flex: 1; min-width: 0; word-break: break-word; overflow-wrap: break-word; }
.bet-rec-cal { flex-shrink: 1; min-width: 0; word-break: break-word; overflow-wrap: break-word; font-size: 0.78rem; }
.star-recommended { border-color: var(--green) !important; box-shadow: 0 0 0 1px rgba(78,203,113,0.25); }

/* ══ v13: 凱利準則面板 ═══════════════════════════ */
.kelly-panel { margin-bottom: 16px; }
.kelly-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
    padding: 0 0.8rem 0.8rem;
}
.kelly-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
}
.kelly-star { flex-shrink: 0; }
.kelly-info { flex: 1; min-width: 0; }
.kelly-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.82rem;
    line-height: 1.6;
}
.kelly-label { color: var(--text-dim); }
.kelly-value { font-weight: 600; font-variant-numeric: tabular-nums; }

/* ══ v13: RNG 審計面板 ═══════════════════════════ */
.rng-conclusion {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 1rem;
}
.rng-ok {
    background: var(--green-dim);
    border: 1px solid rgba(78, 203, 113, 0.3);
    color: var(--green);
}
.rng-bias {
    background: var(--red-dim);
    border: 1px solid rgba(255, 107, 107, 0.3);
    color: var(--red);
}
.rng-conclusion-icon { font-size: 1.3rem; flex-shrink: 0; }
.rng-error {
    padding: 10px 14px;
    background: var(--red-dim);
    border: 1px solid rgba(255, 107, 107, 0.3);
    border-radius: var(--radius-sm);
    color: var(--red);
    font-size: 0.85rem;
    margin-bottom: 1rem;
}
.rng-tests-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 10px;
}
.rng-test-item {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
}
.rng-test-pass { border-left: 3px solid var(--green); }
.rng-test-fail { border-left: 3px solid var(--red); }
.rng-test-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
    font-weight: 600;
    font-size: 0.9rem;
}
.rng-test-pass .rng-test-status { color: var(--green); }
.rng-test-fail .rng-test-status { color: var(--red); }
.rng-test-detail {
    font-size: 0.78rem;
    color: var(--text-dim);
    line-height: 1.5;
}
.rng-test-pval {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
    font-variant-numeric: tabular-nums;
}
.rng-bias-list {
    list-style: none;
    padding: 0;
}
.rng-bias-list li {
    padding: 6px 10px;
    margin-bottom: 4px;
    background: var(--orange-dim);
    border: 1px solid rgba(255, 179, 71, 0.25);
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    color: var(--orange);
}

/* ── 凱利 + RNG 手機端 ── */
@media (max-width: 600px) {
    .kelly-grid { grid-template-columns: 1fr 1fr; gap: 8px; padding: 0 0.5rem 0.5rem; }
    .kelly-item { padding: 8px 10px; gap: 8px; }
    .kelly-row { font-size: 0.75rem; }
    .rng-tests-grid { grid-template-columns: 1fr; }
    .rng-conclusion { font-size: 0.82rem; padding: 10px 12px; }
}
@media (max-width: 380px) {
    .kelly-grid { grid-template-columns: 1fr; }
}

/* ══════════════════════════════════════════════════════
   誠實工作台首頁（index.html）
   ══════════════════════════════════════════════════════ */
.home { display: flex; flex-direction: column; gap: 1rem; }

.home-hero {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.1rem 1.1rem 1.2rem;
    box-shadow: var(--shadow);
}
.hero-countdown { display: flex; align-items: baseline; gap: 0.6rem; margin-bottom: 0.6rem; }
.hero-cd-label { color: var(--text-muted); font-size: 0.8rem; }
.hero-cd-time {
    font-size: 1.8rem; font-weight: 900; letter-spacing: 0.04em;
    color: var(--text); font-variant-numeric: tabular-nums;
}
.hero-claim { color: var(--text-dim); font-size: 0.86rem; line-height: 1.7; }
.hero-claim strong { color: var(--text); }
.claim-tag {
    display: inline-block; margin: 0.2rem 0.25rem 0 0;
    padding: 0.12rem 0.5rem; border-radius: 999px;
    background: var(--accent-dim); color: var(--accent);
    border: 1px solid var(--border-light); font-size: 0.74rem; white-space: nowrap;
}

.home-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.9rem 1rem 1rem;
    box-shadow: var(--shadow);
}
.home-card-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.7rem; }
.home-card-head h2 { font-size: 1rem; font-weight: 700; color: var(--text); margin: 0; }
.warn-pill, .info-pill {
    font-size: 0.7rem; padding: 0.15rem 0.55rem; border-radius: 999px; white-space: nowrap;
}
.warn-pill { background: var(--red-dim); color: var(--red); border: 1px solid var(--red); }
.info-pill { background: var(--gold-dim); color: var(--gold); border: 1px solid var(--gold); }

/* EV 排行 */
.ev-list { display: flex; flex-direction: column; gap: 0.35rem; }
.ev-row {
    display: grid; grid-template-columns: 2rem 1fr auto auto; gap: 0.5rem; align-items: center;
    padding: 0.45rem 0.6rem; border-radius: var(--radius-sm);
    background: var(--bg-elevated); border: 1px solid var(--border);
}
.ev-row.ev-best { border-color: var(--green); background: var(--green-dim); }
.ev-row.ev-worst { border-color: var(--red); background: var(--red-dim); }
.ev-rank { text-align: center; font-size: 0.85rem; }
.ev-name { font-weight: 700; color: var(--text); }
.ev-edge, .ev-loss { font-size: 0.78rem; color: var(--text-dim); white-space: nowrap; }
.ev-edge b { color: var(--orange); }
.ev-loss b { color: var(--red); }

/* 隨機組合 */
.combo-controls { display: flex; align-items: flex-end; gap: 0.7rem; flex-wrap: wrap; margin-bottom: 0.7rem; }
.combo-controls label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.78rem; color: var(--text-muted); }
.combo-controls select {
    background: var(--bg-elevated); color: var(--text); border: 1px solid var(--border-light);
    border-radius: var(--radius-sm); padding: 0.4rem 0.6rem; font-size: 0.9rem;
}
.btn-primary {
    background: var(--accent); color: #fff; border: none; cursor: pointer;
    border-radius: var(--radius-sm); padding: 0.45rem 1rem; font-size: 0.85rem; font-weight: 700;
    transition: var(--transition);
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.1); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-ghost {
    background: transparent; color: var(--text-dim); border: 1px dashed var(--border-light);
    cursor: pointer; border-radius: var(--radius-sm); padding: 0.45rem 1rem; font-size: 0.82rem;
}
.btn-ghost:disabled { opacity: 0.7; cursor: progress; }
.combo-balls { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.3rem 0 0.7rem; }
.ball-combo { background: radial-gradient(circle at 35% 30%, #5a6e8a, #34405a 50%, #222d40 100%); border-color: var(--accent); }
.combo-actions { margin-bottom: 0.5rem; }

/* 透明對賬榜 */
.board { display: flex; flex-direction: column; gap: 0.5rem; }
.board-big { display: flex; flex-direction: column; align-items: center; padding: 0.5rem 0; }
.board-rate { font-size: 2.2rem; font-weight: 900; color: var(--text); font-variant-numeric: tabular-nums; }
.board-vs { font-size: 0.78rem; color: var(--text-muted); }
.board-ci { text-align: center; font-size: 0.82rem; color: var(--text-dim); }
.board-ci b { color: var(--text); }
.board-verdict { text-align: center; font-size: 0.86rem; font-weight: 700; padding: 0.5rem; border-radius: var(--radius-sm); }
.vd-neutral { background: var(--bg-elevated); color: var(--text-dim); border: 1px solid var(--border); }
.vd-good { background: var(--green-dim); color: var(--green); border: 1px solid var(--green); }

.card-foot { font-size: 0.74rem; margin-top: 0.6rem; line-height: 1.5; }
.card-foot.warn { color: var(--orange); }
.card-foot a { color: var(--accent); text-decoration: none; }
.muted { color: var(--text-muted); }

/* 進階入口 */
.home-links { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.3rem; }
.home-link {
    flex: 1 1 auto; text-align: center; padding: 0.6rem 0.8rem;
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm);
    color: var(--text-dim); text-decoration: none; font-size: 0.8rem; transition: var(--transition);
}
.home-link:hover { background: var(--bg-hover); color: var(--text); }

/* 誠實頁尾 */
.footer-honest { max-width: 640px; margin: 0 auto 0.6rem; line-height: 1.6; }
.footer-honest strong { color: var(--text-dim); }
.footer-help { max-width: 640px; margin: 0 auto; line-height: 1.6; color: var(--text-muted); }
.footer-help strong { color: var(--orange); }

/* 凍結鏈狀態 */
.lock-chain { margin-top: 0.7rem; padding: 0.5rem 0.6rem; border-radius: var(--radius-sm);
    background: var(--bg-elevated); border: 1px solid var(--border); font-size: 0.78rem; }
.chain-on { color: var(--text-dim); }
.chain-on b, .chain-off b { color: var(--text); }
.chain-off { color: var(--text-muted); }
.chain-on .vd-good { color: var(--green); background: none; border: none; padding: 0; font-weight: 700; }
.chain-on .warn { color: var(--red); font-weight: 700; }

/* 降級橫幅 */
[x-cloak] { display: none !important; }
.stale-banner { padding: 0.6rem 0.8rem; border-radius: var(--radius-sm);
    background: var(--orange-dim); border: 1px solid var(--orange); color: var(--orange);
    font-size: 0.82rem; font-weight: 600; }

/* 責任博弈面板 */
.rg-panel { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem;
    padding: 0.5rem 0.6rem; margin-bottom: 0.7rem; border-radius: var(--radius-sm);
    background: var(--bg-elevated); border: 1px solid var(--border); font-size: 0.78rem; }
.rg-panel label { display: flex; flex-direction: column; gap: 0.2rem; color: var(--text-muted); }
.rg-panel input { width: 6rem; background: var(--bg-card); color: var(--text);
    border: 1px solid var(--border-light); border-radius: var(--radius-sm); padding: 0.35rem 0.5rem; }
.rg-status { flex: 1 1 auto; }
.rg-ok { color: var(--text-dim); }
.rg-warn { color: var(--orange); font-weight: 600; }
.rg-blocked { color: var(--red); font-weight: 700; }
.rg-exclude { font-size: 0.74rem; padding: 0.3rem 0.7rem; }
.rg-excluded { color: var(--red); font-weight: 700; }
.rg-blocked { padding: 0.6rem 0.8rem; border-radius: var(--radius-sm);
    background: var(--red-dim); border: 1px solid var(--red); }

/* EV 列：加入凱利 + 一句話理由 */
.ev-row { display: flex; flex-direction: column; gap: 0.25rem; }
.ev-line { display: grid; grid-template-columns: 2rem 1fr auto auto auto; gap: 0.5rem; align-items: center; }
.ev-kelly { font-size: 0.72rem; color: var(--green); white-space: nowrap; }
.ev-reason { font-size: 0.72rem; color: var(--text-muted); padding-left: 2.5rem; }

/* ══════════════════════════════════════════════════════
   首頁無障礙 + RWD 強化（對齊 frontend-design / ui-ux-pro-max 檢查表）
   ══════════════════════════════════════════════════════ */

/* 鍵盤可操作：清楚的 focus 環（不靠瀏覽器預設，且不誤傷滑鼠點擊） */
.home a:focus-visible,
.home button:focus-visible,
.home select:focus-visible,
.home input:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* 所有可點擊元素游標一致 */
.home button, .home select, .home a { cursor: pointer; }
.home input[type="number"] { cursor: text; }

/* inline SVG 圖示（取代 emoji 功能性圖示） */
.ico { width: 1.05em; height: 1.05em; vertical-align: -0.15em; flex-shrink: 0; display: inline-block; }
.home-card-head h2 { display: flex; align-items: center; gap: 0.45rem; }
.home-card-head h2 .ico { width: 1.15rem; height: 1.15rem; color: var(--accent); }
.ev-ico-best .ico { color: var(--gold); }
.ev-ico-worst .ico { color: var(--red); }
.chain-on .ico { color: var(--green); vertical-align: -0.18em; }
.chain-off .ico, .rg-excluded .ico { color: var(--text-muted); }
.footer-help .ico { color: var(--orange); }

/* 尊重使用者「減少動態」偏好 */
@media (prefers-reduced-motion: reduce) {
    .home *, .home *::before, .home *::after {
        animation-duration: 0.001ms !important;
        transition-duration: 0.001ms !important;
    }
}

/* 行動裝置（≤480px）：EV 列與面板改堆疊，避免窄螢幕溢出 */
@media (max-width: 480px) {
    .ev-line {
        grid-template-columns: 1.6rem 1fr auto;
        row-gap: 0.2rem;
    }
    .ev-line .ev-loss, .ev-line .ev-kelly { grid-column: 2 / -1; }
    .ev-reason { padding-left: 1.8rem; }
    .rg-panel, .combo-controls { flex-direction: column; align-items: stretch; }
    .rg-panel input, .combo-controls select { width: 100%; }
    .hero-cd-time { font-size: 1.5rem; }
    .board-rate { font-size: 1.8rem; }
}

/* 平板（≤768px）：英雄宣言行高放寬、卡片內距微調 */
@media (max-width: 768px) {
    .home-card, .home-hero { padding-left: 0.85rem; padding-right: 0.85rem; }
    .claim-tag { font-size: 0.72rem; }
}

/* ══════════════════════════════════════════════════════
   視覺重設計：帳本/終端機設計語言（呼應「誠實資料」主題）
   依 frontend-design（型別人格、hero 即論點、一個美學冒險）
   + ui-ux-pro-max（柔和陰影、克制動畫、對比）
   ══════════════════════════════════════════════════════ */

/* 數據字體：等寬 + tabular，金額/機率/倒數對齊不跳動 */
.hero-cd-time, .board-rate, .ev-edge b, .ev-loss b, .ev-kelly,
.board-ci b, .ball-combo { font-family: var(--font-mono); }

/* Hero 即論點：放大、加結構線、強化字級層次 */
.home-hero {
    position: relative;
    padding: var(--space-5) var(--space-5) var(--space-6);
    background:
        radial-gradient(120% 140% at 100% 0%, rgba(77,159,255,0.06), transparent 55%),
        var(--bg-card);
    border: 1px solid var(--border);
}
.hero-countdown { align-items: baseline; gap: var(--space-3); margin-bottom: var(--space-4); }
.hero-cd-label { text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.7rem; color: var(--text-muted); }
.hero-cd-time { font-size: 2.4rem; font-weight: 700; letter-spacing: 0.02em; line-height: 1; }
.hero-claim { font-size: 0.92rem; line-height: 1.85; color: var(--text-dim); max-width: 60ch; }
.hero-claim strong { color: var(--accent); font-weight: 700; }
.claim-tag {
    display: inline-flex; align-items: center; margin: var(--space-2) var(--space-2) 0 0;
    padding: 0.28rem 0.7rem; border-radius: 999px; font-size: 0.76rem; font-weight: 500;
    background: transparent; color: var(--text-dim);
    border: 1px solid var(--border-light);
}

/* 卡片：更克制的邊框 + 分層陰影，標題加細分隔 */
.home-card { padding: var(--space-4) var(--space-5) var(--space-5); transition: border-color var(--transition); }
.home-card:hover { border-color: var(--border-light); }
.home-card-head { margin-bottom: var(--space-4); padding-bottom: var(--space-3); border-bottom: 1px solid var(--border); }
.home-card-head h2 { font-size: 1.02rem; letter-spacing: 0.01em; }

/* EV 排行：表格化節奏，最省/最坑用左側色條（結構編碼意義） */
.ev-row { position: relative; padding: var(--space-3) var(--space-3) var(--space-3) calc(var(--space-3) + 3px); border-radius: var(--radius-sm); transition: background var(--transition); }
.ev-row::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; border-radius: 3px 0 0 3px; background: transparent; }
.ev-row.ev-best::before { background: var(--gold); }
.ev-row.ev-worst::before { background: var(--red); }
/* 覆蓋舊規則的綠色邊框/底，對齊「最省＝金」的設計語意 */
.ev-row.ev-best { border-color: var(--gold); background: var(--gold-dim); }
.ev-row.ev-worst { border-color: var(--red); background: var(--red-dim); }
.ev-row:hover { background: var(--bg-hover); }
.ev-edge b { color: var(--orange); font-weight: 700; }
.ev-loss b { color: var(--red); font-weight: 700; }

/* 號碼球：精修立體感 + 等寬數字 */
.ball-combo { font-family: var(--font-mono); font-weight: 700; }

/* 對賬大數字：終端機儀表感 */
.board-rate { font-weight: 700; letter-spacing: 0.01em; }

/* 按鈕：active-voice 已於文案處理；此處精修觸感 */
.btn-primary { letter-spacing: 0.02em; box-shadow: 0 1px 0 rgba(255,255,255,0.06) inset; }
.btn-primary:active { transform: translateY(1px); }

/* 一個克制的入場動畫（orchestrated，非散落）；尊重 reduced-motion */
@media (prefers-reduced-motion: no-preference) {
    /* nth-of-type 只數 section，不受首個 .stale-banner div 位移；涵蓋全部 5 段 */
    .home > section { animation: home-rise 0.4s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
    .home > section:nth-of-type(2) { animation-delay: 0.04s; }
    .home > section:nth-of-type(3) { animation-delay: 0.08s; }
    .home > section:nth-of-type(4) { animation-delay: 0.12s; }
    .home > section:nth-of-type(5) { animation-delay: 0.16s; }
    @keyframes home-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
}
