:root {
    --bg: #070b16;
    --bg-2: #0b1122;
    --panel: rgba(20, 27, 48, 0.62);
    --panel-line: rgba(255, 210, 120, 0.16);
    --gold: #ffd24a;
    --gold-2: #f5b942;
    --gold-deep: #d68a1a;
    --red: #ff3b5c;
    --teal: #22e0c8;
    --txt: #eef1fa;
    --muted: #8a93ad;
    --ball-dark-a: #26304d;
    --ball-dark-b: #121828;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
    font-family: 'Noto Sans TC', system-ui, sans-serif;
    background: var(--bg);
    color: var(--txt);
    min-height: 100dvh;
    overflow-x: hidden;
    position: relative;
}

/* 背景光暈 */
.bg-glow {
    position: fixed; inset: 0; z-index: -1; pointer-events: none;
    background:
        radial-gradient(60% 45% at 78% 8%, rgba(245, 185, 66, 0.16), transparent 70%),
        radial-gradient(55% 40% at 12% 88%, rgba(34, 224, 200, 0.12), transparent 70%),
        radial-gradient(90% 70% at 50% 50%, var(--bg-2), var(--bg) 75%);
}

/* ── Header ── */
.site-head {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 18px clamp(16px, 4vw, 40px);
    max-width: 1180px; margin: 0 auto;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark {
    width: 52px; height: 52px; border-radius: 15px; flex: none;
    display: grid; place-items: center;
    font-family: 'Orbitron', sans-serif; font-weight: 900; font-size: 30px; color: #241700;
    background: radial-gradient(circle at 34% 28%, #ffe89a, var(--gold-2) 60%, var(--gold-deep));
    box-shadow: 0 6px 22px rgba(245, 185, 66, 0.4), inset 0 2px 4px rgba(255, 255, 255, 0.6);
}
.brand-txt h1 {
    font-family: 'Orbitron', sans-serif; font-weight: 900; font-size: clamp(20px, 4vw, 27px);
    letter-spacing: 1px; line-height: 1; color: var(--gold);
}
.brand-txt h1 span { color: var(--txt); margin-left: 6px; }
.brand-txt p { font-size: 12.5px; color: var(--muted); margin-top: 5px; letter-spacing: 2px; }

.head-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 7px; }
.live-dot {
    display: inline-flex; align-items: center; gap: 7px;
    font-family: 'Orbitron', sans-serif; font-weight: 700; font-size: 13px; letter-spacing: 2px;
    color: var(--red);
    padding: 5px 12px; border-radius: 999px;
    border: 1px solid rgba(255, 59, 92, 0.4); background: rgba(255, 59, 92, 0.08);
}
.live-dot i { width: 9px; height: 9px; border-radius: 50%; background: var(--red);
    box-shadow: 0 0 10px var(--red); animation: pulse 1.4s ease-in-out infinite; }
.live-dot.stale { color: var(--muted); border-color: rgba(138,147,173,.35); background: rgba(138,147,173,.08); }
.live-dot.stale i { background: var(--muted); box-shadow: none; animation: none; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }
.upd { font-size: 12px; color: var(--muted); }

/* ── Layout ── */
.wrap { max-width: 1180px; margin: 0 auto; padding: 6px clamp(14px, 4vw, 40px) 40px; }

.stage {
    background: var(--panel);
    border: 1px solid var(--panel-line);
    border-radius: 22px;
    padding: clamp(16px, 3vw, 28px);
    backdrop-filter: blur(10px);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.04);
    position: relative; overflow: hidden;
}
.stage::before {
    content: ''; position: absolute; top: 0; left: -40%; width: 40%; height: 100%;
    background: linear-gradient(100deg, transparent, rgba(255, 225, 150, 0.06), transparent);
    animation: sweep 7s ease-in-out infinite;
}
@keyframes sweep { 0%, 100% { left: -45%; } 55% { left: 105%; } }

.stage-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.term-label, .next-label { display: block; font-size: 12px; letter-spacing: 3px; color: var(--muted); margin-bottom: 6px; }
.term-no {
    font-family: 'Orbitron', sans-serif; font-weight: 900; font-size: clamp(30px, 7vw, 52px);
    line-height: 0.95; color: var(--gold);
    text-shadow: 0 0 26px rgba(245, 185, 66, 0.35);
}
.next-block { text-align: right; }
.next-count {
    font-family: 'Orbitron', sans-serif; font-weight: 700; font-size: clamp(24px, 5vw, 34px);
    color: var(--teal); text-shadow: 0 0 18px rgba(34, 224, 200, 0.3);
}

/* ── 80 號球盤 ── */
.board {
    display: grid; grid-template-columns: repeat(10, 1fr); gap: clamp(5px, 1.1vw, 10px);
    margin-bottom: 22px;
}
.cell {
    aspect-ratio: 1; border-radius: 50%;
    display: grid; place-items: center; position: relative;
    font-family: 'Orbitron', sans-serif; font-weight: 700;
    font-size: clamp(11px, 1.9vw, 18px);
    color: #56607e;
    background: radial-gradient(circle at 32% 28%, var(--ball-dark-a), var(--ball-dark-b) 72%);
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: inset 0 -3px 6px rgba(0, 0, 0, 0.5), inset 0 2px 3px rgba(255, 255, 255, 0.05);
    transition: color .2s;
}
.cell.hit {
    color: #3a2600;
    background: radial-gradient(circle at 32% 28%, #ffe89a, var(--gold-2) 55%, var(--gold-deep));
    box-shadow: 0 0 0 1px rgba(255, 220, 120, 0.6), 0 0 16px 2px rgba(245, 190, 66, 0.5),
        inset 0 -3px 6px rgba(150, 85, 0, 0.5), inset 0 2px 4px rgba(255, 255, 255, 0.55);
    animation: pop .45s cubic-bezier(.2, 1.3, .4, 1) both;
}
.cell.super {
    color: #fff;
    background: radial-gradient(circle at 32% 28%, #ffd3db, var(--red) 55%, #c11033);
    box-shadow: 0 0 0 2px rgba(255, 130, 155, 0.75), 0 0 22px 3px rgba(255, 59, 92, 0.6),
        inset 0 -3px 6px rgba(150, 0, 25, 0.5), inset 0 2px 4px rgba(255, 255, 255, 0.5);
}
@keyframes pop { 0% { transform: scale(.25); opacity: 0; } 60% { transform: scale(1.18); } 100% { transform: scale(1); opacity: 1; } }
.cell .ord {
    position: absolute; top: -4px; right: -4px;
    min-width: 15px; height: 15px; padding: 0 3px; border-radius: 8px;
    font-size: 9px; font-weight: 800; line-height: 15px; text-align: center;
    background: #0a0f1e; color: var(--gold); border: 1px solid rgba(255, 210, 120, 0.5);
}
.cell.super .ord { color: #fff; border-color: rgba(255, 150, 170, 0.7); }

/* ── 開出順序 ── */
.order-row { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; flex-wrap: wrap; }
.order-label { font-size: 12px; letter-spacing: 2px; color: var(--muted); flex: none; }
.order-balls { display: flex; flex-wrap: wrap; gap: 6px; }
.ob {
    width: 30px; height: 30px; border-radius: 50%; flex: none;
    display: grid; place-items: center;
    font-family: 'Orbitron', sans-serif; font-weight: 700; font-size: 12.5px; color: #3a2600;
    background: radial-gradient(circle at 32% 28%, #ffe89a, var(--gold-2) 60%, var(--gold-deep));
    box-shadow: inset 0 -2px 4px rgba(150, 85, 0, .5), inset 0 1px 2px rgba(255, 255, 255, .5);
}
.ob.super { color: #fff; background: radial-gradient(circle at 32% 28%, #ffd3db, var(--red) 55%, #c11033); }

/* ── 統計 ── */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.stat {
    background: rgba(10, 15, 30, 0.55); border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 13px; padding: 12px 14px; text-align: center;
}
.stat-k { display: block; font-size: 11.5px; color: var(--muted); letter-spacing: 1.5px; margin-bottom: 6px; }
.stat-v { font-family: 'Orbitron', sans-serif; font-weight: 700; font-size: clamp(16px, 3.4vw, 22px); color: var(--txt); }
.stat-v.super { color: var(--red); text-shadow: 0 0 14px rgba(255, 59, 92, 0.4); }

/* ── 今日各期 ── */
.history { margin-top: 30px; }
.sec-title { display: flex; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.sec-title span { font-family: 'Orbitron', sans-serif; font-weight: 700; font-size: 18px; color: var(--gold); letter-spacing: 1px; }
.sec-title small { font-size: 12px; color: var(--muted); }
.hist-scroll {
    display: flex; gap: 12px; overflow-x: auto; padding-bottom: 12px;
    scroll-snap-type: x mandatory; scrollbar-width: thin; scrollbar-color: var(--gold-deep) transparent;
}
.hist-scroll::-webkit-scrollbar { height: 7px; }
.hist-scroll::-webkit-scrollbar-thumb { background: var(--gold-deep); border-radius: 4px; }
.hcard {
    flex: none; width: 208px; scroll-snap-align: start;
    background: var(--panel); border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 14px; padding: 13px;
}
.hcard-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; }
.hcard-term { font-family: 'Orbitron', sans-serif; font-weight: 700; font-size: 13px; color: var(--gold); }
.hcard-super { font-size: 11px; color: var(--red); font-weight: 700; }
.hcard-nums { display: grid; grid-template-columns: repeat(10, 1fr); gap: 3px; }
.hn {
    aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center;
    font-size: 9px; font-weight: 700; font-family: 'Orbitron', sans-serif;
    background: rgba(255, 210, 120, 0.14); color: var(--gold);
}
.hn.sup { background: rgba(255, 59, 92, 0.25); color: #ffb3c1; }

/* ── Footer ── */
.site-foot { text-align: center; padding: 30px 20px 40px; color: var(--muted); font-size: 12.5px; line-height: 1.9; }
.site-foot a { color: var(--gold-2); }
.disclaimer { font-size: 11.5px; opacity: 0.7; margin-top: 4px; }

@media (max-width: 560px) {
    .stats { grid-template-columns: repeat(2, 1fr); }
    .brand-mark { width: 44px; height: 44px; font-size: 25px; }
}
@media (prefers-reduced-motion: reduce) {
    .stage::before, .live-dot i { animation: none; }
    .cell.hit { animation: none; }
}
