:root {
    --bg: #f5f6fa;
    --surface: #ffffff;
    --text: #1c2233;
    --muted: #6b7285;
    --border: #e3e6ee;
    --brand: #0b3d91;
    --brand-2: #0575e6;
    --accent: #f53f51;
    --gold: #b7791f;
    --gold-bg: #fff7e6;
    --win: #0f7b3f;
    --win-bg: #e8f7ee;
    --lose-bg: #f1f2f6;
    --radius: 12px;
    --navy: #13205a;
    --navy-2: #1d2f7a;
    --poster-gold: #f5b301;
    --meta-red: #c0161f;
    --rank-1: #c0161f;
    --rank-2: #1e6b1e;
    --rank-3: #1c4fa8;
    --rank-4: #5b1aa0;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #11141c;
        --surface: #1a1f2b;
        --text: #e8eaf0;
        --muted: #9aa1b3;
        --border: #2a3040;
        --gold: #f0b85a;
        --gold-bg: #2a2416;
        --win: #5fd394;
        --win-bg: #15291e;
        --lose-bg: #20242f;
        --meta-red: #ff7a7a;
        --rank-1: #ff6b6b;
        --rank-2: #5fcf6a;
        --rank-3: #6ea8ff;
        --rank-4: #b98cff;
    }
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: inherit; }

.wrap {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 16px;
}

/* Top strip */
.topbar {
    background: #0a1238;
    color: #c9d2f5;
    font-size: 12px;
}
.topbar-inner {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 30px;
}
.live {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 1px 8px;
    border-radius: 999px;
    background: #e11d2e;
    color: #fff;
    font-weight: 800;
    font-size: 11px;
    letter-spacing: .08em;
}
.live-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #fff;
    animation: live-blink 1.2s ease-in-out infinite;
}
@keyframes live-blink { 50% { opacity: .25; } }
.topbar-text { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-date { color: #ffd23f; font-weight: 600; white-space: nowrap; }

/* Header */
.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    color: #fff;
    background:
        radial-gradient(circle at 8% 50%, rgba(255, 210, 63, .16), transparent 26%),
        radial-gradient(circle at 70% -40%, rgba(80, 120, 255, .35), transparent 45%),
        linear-gradient(120deg, var(--navy-2), var(--navy) 60%, #0e1847);
    box-shadow: 0 6px 20px rgba(10, 18, 56, .25);
}
.site-header::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, #f5b301 15%, #ffe89a 50%, #f5b301 85%, transparent);
}
.header-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 20px;
    padding-top: 12px;
    padding-bottom: 14px;
}
.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}
.brand-mark {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #fff3c4, #f7c21d 45%, #c98a00);
    color: var(--navy);
    font-size: 22px;
    font-weight: 900;
    box-shadow: 0 0 0 3px rgba(255, 210, 63, .25), 0 0 18px rgba(255, 200, 40, .45), inset 0 -3px 6px rgba(120, 70, 0, .35);
    transition: transform .4s;
}
.brand:hover .brand-mark { transform: rotateY(180deg); }
.brand-text { display: grid; line-height: 1.05; }
.brand-text strong {
    font-size: 22px;
    font-weight: 900;
    letter-spacing: .03em;
    background: linear-gradient(180deg, #ffe89a 0%, #f7c21d 55%, #e08a00 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.brand-text small {
    margin-top: 3px;
    color: #c9d2f5;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .32em;
    text-transform: uppercase;
}
.tabs {
    display: flex;
    gap: 4px;
    padding: 4px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .08);
    border: 1px solid rgba(255, 210, 63, .25);
    overflow-x: auto;
    scrollbar-width: none;
}
.tabs a {
    padding: 7px 16px;
    border-radius: 999px;
    color: #e3e8ff;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
    transition: background .15s, color .15s;
}
.tabs a:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.tabs a.active {
    background: linear-gradient(180deg, #fbe08a, #e2a627);
    color: var(--navy);
    font-weight: 800;
    box-shadow: 0 2px 10px rgba(245, 179, 1, .45);
}

@media (max-width: 640px) {
    .topbar-text { display: none; }
    .topbar-inner { justify-content: space-between; }
    .header-inner { justify-content: center; }
    .brand-mark { width: 38px; height: 38px; font-size: 19px; }
    .brand-text strong { font-size: 19px; }
    .tabs { width: 100%; }
    .tabs a { flex: 1; text-align: center; padding: 7px 10px; }
}
@media (prefers-reduced-motion: reduce) { .live-dot { animation: none; } }

/* Hero */
.hero { padding: 24px 0 12px; }
.hero h1 { margin: 0 0 6px; font-size: 24px; line-height: 1.25; }
.hero p { margin: 0; color: var(--muted); }

.muted { color: var(--muted); }
.chip {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 999px;
    background: var(--gold-bg);
    color: var(--gold);
    font-size: 12px;
    font-weight: 600;
    margin-right: 6px;
}

.alert, .empty {
    padding: 16px;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--border);
    margin: 16px 0;
}
.alert { border-color: var(--accent); color: var(--accent); }

.pager { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 20px 0; }
.pager a {
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
    text-decoration: none;
}
.pager a.active { background: var(--brand); color: #fff; border-color: var(--brand); }

/* Result page */
.back { display: inline-block; margin-top: 16px; color: var(--muted); text-decoration: none; }
.back:hover { color: var(--text); }

.checker {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin: 12px 0;
}
.checker label { display: block; font-weight: 600; margin-bottom: 8px; }
.checker-row { display: flex; gap: 8px; }
.checker input {
    flex: 1;
    min-width: 0;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-size: 16px;
    letter-spacing: .05em;
}
button {
    padding: 10px 18px;
    border: 0;
    border-radius: 8px;
    background: var(--accent);
    color: #fff;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
}
button.ghost {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
    padding: 6px 12px;
    font-size: 13px;
}
.checker-result { margin-top: 12px; padding: 12px; border-radius: 8px; }
.checker-result.win { background: var(--win-bg); color: var(--win); }
.checker-result.lose { background: var(--lose-bg); }
.checker-result p, .checker-result ul { margin: 4px 0; }
.checker-result .small { font-size: 12px; opacity: .8; }

.table-actions { display: flex; justify-content: flex-end; margin: 8px 0; }

.prizes { display: grid; gap: 12px; margin-bottom: 24px; }
.prize {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
}
.prize.top { border: 2px solid var(--gold); background: var(--gold-bg); }
.prize header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 10px;
}
.prize h2 { margin: 0; font-size: 17px; }
.prize .muted { font-size: 13px; }
.amount { font-size: 20px; font-weight: 700; color: var(--gold); text-align: right; white-space: nowrap; }
.amount small { display: block; font-size: 12px; font-weight: 500; color: var(--muted); }

.tickets {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.tickets li {
    padding: 4px 10px;
    border-radius: 6px;
    background: var(--lose-bg);
    font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
    font-size: 15px;
    font-weight: 600;
}
.prize.top .tickets li { font-size: 22px; padding: 6px 14px; background: var(--surface); }
.tickets.dense li { font-size: 13px; padding: 2px 6px; font-weight: 500; }
.tickets li.hit { background: var(--win); color: #fff; outline: 3px solid var(--win-bg); }

.site-footer {
    color: var(--muted);
    font-size: 12px;
    padding-top: 16px;
    padding-bottom: 32px;
    border-top: 1px solid var(--border);
}

/* Result card (poster style) */
.visually-hidden {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap;
}
.section-title { font-size: 18px; margin: 24px 0 8px; }

.rcard-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; margin: 8px 0; }
.rcard {
    background: var(--bg);
    border: 2px solid var(--poster-gold);
    border-radius: 18px;
    overflow: hidden;
    margin-top: 12px;
    box-shadow: 0 6px 20px rgba(19, 32, 90, .12);
}
.rcard-head {
    position: relative;
    text-align: center;
    padding: 18px 16px 22px;
    color: #fff;
    background:
        radial-gradient(circle at 12% 30%, rgba(255, 215, 90, .18), transparent 30%),
        radial-gradient(circle at 88% 70%, rgba(255, 215, 90, .14), transparent 30%),
        linear-gradient(160deg, var(--navy-2), var(--navy));
}
.rcard-head::before, .rcard-head::after {
    content: "✦";
    position: absolute;
    color: #ffd23f;
    font-size: 26px;
    top: 14px;
    left: 20px;
}
.rcard-head::after { left: auto; right: 20px; top: auto; bottom: 14px; }
.rcard-kicker {
    margin: 0;
    font-weight: 800;
    letter-spacing: .12em;
    font-size: 15px;
}
.rcard-kicker span { color: #ffd23f; margin: 0 6px; }
.rcard-title {
    margin: 2px 0 10px;
    font-size: clamp(30px, 7vw, 54px);
    font-weight: 900;
    line-height: 1.05;
    letter-spacing: .01em;
    overflow-wrap: anywhere;
    background: linear-gradient(180deg, #ffe89a 0%, #f7c21d 55%, #e08a00 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.rcard-title a { text-decoration: none; color: inherit; }
.rcard-ribbon { margin: 0; }
.rcard-ribbon span {
    display: inline-block;
    padding: 6px 34px;
    background: linear-gradient(180deg, #fbe08a, #e2a627);
    color: var(--navy);
    font-weight: 900;
    font-size: clamp(14px, 3vw, 22px);
    letter-spacing: .02em;
    clip-path: polygon(0 0, 100% 0, calc(100% - 14px) 50%, 100% 100%, 0 100%, 14px 50%);
}

.rcard-meta {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    margin: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
}
.rcard-meta div { padding: 10px 6px; text-align: center; min-width: 0; }
.rcard-meta div + div { border-left: 1px solid var(--border); }
.rcard-meta dt { font-size: 12px; font-weight: 600; text-transform: uppercase; color: var(--muted); }
.rcard-meta dd { margin: 2px 0 0; font-size: 20px; font-weight: 800; color: var(--meta-red); }

.rcard-note { margin: 0 10px 10px; padding: 14px; background: var(--surface); border-radius: 12px; text-align: center; }

.rrow {
    --rank: var(--rank-4);
    display: grid;
    grid-template-columns: 150px 190px 1fr auto;
    align-items: center;
    gap: 14px;
    margin: 0 10px 8px;
    padding: 10px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
}
.rrow.rank-1 { --rank: var(--rank-1); }
.rrow.rank-2 { --rank: var(--rank-2); }
.rrow.rank-3 { --rank: var(--rank-3); }
.rbadge {
    padding: 10px 8px;
    border-radius: 8px;
    background: var(--rank);
    color: #fff;
    font-weight: 800;
    font-size: 18px;
    text-align: center;
    white-space: nowrap;
}
@media (prefers-color-scheme: dark) {
    .rrow.rank-1 .rbadge { background: #b3141c; }
    .rrow.rank-2 .rbadge { background: #1e6b1e; }
    .rrow.rank-3 .rbadge { background: #1c4fa8; }
    .rrow.rank-4 .rbadge { background: #5b1aa0; }
}
.rbadge sup { font-size: 60%; }
.ramount { color: var(--rank); font-size: 34px; font-weight: 800; white-space: nowrap; line-height: 1.1; }
.ramount small { font-size: 16px; }

.rrow .tickets { gap: 4px 22px; }
.rrow .tickets li {
    padding: 0;
    background: none;
    color: var(--rank);
    font-family: inherit;
    font-size: 34px;
    font-weight: 800;
    line-height: 1.15;
    font-variant-numeric: tabular-nums;
}
.rrow.rank-1 .rtickets li { font-size: 46px; }
.rrow .rtickets.small li { font-size: 24px; }
.rrow .tickets li.more { font-size: 15px; font-weight: 600; color: var(--muted); align-self: center; }
.rcard .tickets li.hit { background: var(--win); color: #fff; border-radius: 6px; padding: 0 8px; outline: 3px solid var(--win-bg); }

.rcons {
    --rank: var(--rank-2);
    min-width: 170px;
    text-align: center;
    border: 1px solid var(--rank);
    border-radius: 8px;
    overflow: hidden;
}
.rcons-label { display: block; background: #1e6b1e; color: #fff; font-weight: 700; font-size: 13px; padding: 4px 8px; }
.rcons-amount { display: block; color: var(--rank); font-weight: 800; font-size: 18px; padding: 2px 8px; }
.rrow .rcons-tickets { justify-content: center; gap: 2px 10px; padding: 2px 8px 6px; }
.rrow .rcons-tickets li { font-size: 16px; }

.rcard-foot {
    display: block;
    margin-top: 2px;
    padding: 14px 16px;
    background: linear-gradient(160deg, var(--navy-2), var(--navy));
    color: #ffd23f;
    text-align: center;
    text-decoration: none;
    font-weight: 800;
    font-size: clamp(16px, 3vw, 22px);
}
.rcard-foot:hover { color: #fff; }

@media (max-width: 720px) {
    .rrow { grid-template-columns: auto minmax(0, 1fr); gap: 8px 12px; }
    .rcard-head::before, .rcard-head::after { font-size: 18px; }
    .rrow .rtickets, .rcons { grid-column: 1 / -1; }
    .rbadge { font-size: 15px; padding: 8px 10px; }
    .ramount { font-size: 26px; }
    .rrow .tickets li { font-size: 26px; }
    .rrow.rank-1 .rtickets li { font-size: 38px; }
    .rrow .rtickets.small li { font-size: 20px; }
}

@media (max-width: 560px) {
    .hero h1 { font-size: 20px; }
    .amount { font-size: 17px; }
    .rcard-meta { grid-template-columns: repeat(2, 1fr); }
    .rcard-meta div:nth-child(3) { border-left: 0; }
    .rcard-meta div:nth-child(n+3) { border-top: 1px solid var(--border); }
    .rcard-meta dd { font-size: 17px; }
}

/* Floating share button */
.share-fab {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}
.share-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: 999px;
    background: linear-gradient(180deg, #2fd46b, #1a9e4a);
    color: #fff;
    font-weight: 800;
    font-size: 16px;
    box-shadow: 0 6px 18px rgba(26, 158, 74, .45);
    animation: share-pulse 2.4s ease-in-out infinite;
}
.share-btn:hover { filter: brightness(1.08); }
@keyframes share-pulse {
    0%, 100% { box-shadow: 0 6px 18px rgba(26, 158, 74, .45), 0 0 0 0 rgba(47, 212, 107, .5); }
    50%      { box-shadow: 0 6px 18px rgba(26, 158, 74, .45), 0 0 0 10px rgba(47, 212, 107, 0); }
}
@media (prefers-reduced-motion: reduce) { .share-btn { animation: none; } }

.share-menu {
    display: grid;
    min-width: 170px;
    padding: 6px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
}
.share-menu[hidden] { display: none; }
.share-menu a, .share-menu button {
    display: block;
    padding: 9px 12px;
    border-radius: 8px;
    background: none;
    color: var(--text);
    font-size: 15px;
    font-weight: 600;
    text-align: left;
    text-decoration: none;
}
.share-menu a:hover, .share-menu button:hover { background: var(--lose-bg); }

/* keep the last card's footer clear of the floating button */
.site-footer { padding-bottom: 88px; }

@media (max-width: 560px) {
    .share-fab { right: 12px; bottom: 12px; }
    .share-btn { padding: 11px 16px; font-size: 15px; }
}

/* SEO text & footer links */
.back a { color: inherit; text-decoration: none; }
.back a:hover { color: var(--text); text-decoration: underline; }
.result-hero h1 { font-size: 22px; }
.result-hero p { max-width: 820px; }
.hero a { color: var(--brand-2); }

.seo-text {
    margin: 28px 0 8px;
    padding: 18px 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--muted);
    font-size: 14px;
}
.seo-text h2 { margin: 0 0 8px; font-size: 17px; color: var(--text); }
.seo-text p { margin: 0 0 8px; }
.seo-text p:last-child { margin-bottom: 0; }

.footer-links { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-bottom: 10px; }
.footer-links a { color: var(--text); font-weight: 600; text-decoration: none; }
.footer-links a:hover { text-decoration: underline; }

/* Blinking "Click Here to View the Full Result" call to action */
.rcard-foot { animation: cta-blink 1.2s ease-in-out infinite; }
.rcard-foot span { display: inline-block; animation: cta-nudge 1.2s ease-in-out infinite; }
.rcard-foot:hover { animation: none; color: #fff; }
.rcard-foot:hover span { animation: none; }
@keyframes cta-blink {
    0%, 100% { color: #ffd23f; text-shadow: 0 0 10px rgba(255, 210, 63, .7); }
    50%      { color: #ffffff; text-shadow: none; }
}
@keyframes cta-nudge {
    0%, 100% { transform: translateX(0); }
    50%      { transform: translateX(6px); }
}
@media (prefers-reduced-motion: reduce) {
    .rcard-foot, .rcard-foot span { animation: none; }
}
