:root{
    --bg1:#120608;
    --bg2:#2a0f12;
    --gold:#f4c55a;
    --gold2:#ffdf87;
    --red:#d61e2a;
    --red2:#ff4257;
    --text:#fff7ea;
    --muted:#d8c7aa;
    --glass:rgba(255,255,255,0.08);
    --line:rgba(255,255,255,0.12);
}

*{
    box-sizing:border-box;
}

body{
    margin:0;
    font-family:Arial,sans-serif;
    background:radial-gradient(circle at top,var(--bg2),var(--bg1) 55%);
    color:var(--text);
}

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

.theme-lottery{
    min-height:100vh;
}

.app-shell,
.page-wrap{
    max-width:720px;
    margin:0 auto;
    padding:14px;
}

.topbar{
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:12px;
    padding:14px;
    border:1px solid var(--line);
    background:linear-gradient(135deg,rgba(255,215,120,.15),rgba(255,40,40,.08));
    border-radius:24px;
    backdrop-filter:blur(10px);
    box-shadow:0 10px 30px rgba(0,0,0,.35);
}

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

.brand-logo{
    width:58px;
    height:58px;
    border-radius:18px;
    display:flex;
    align-items:center;
    justify-content:center;
    font-size:28px;
    background:linear-gradient(180deg,#2f1013,#150607);
    border:1px solid rgba(255,255,255,0.12);
    box-shadow:0 10px 18px rgba(0,0,0,.35);
}

.brand-wrap h1{
    margin:0;
    font-size:20px;
}

.sub{
    margin:3px 0 0;
    color:var(--muted);
    font-size:12px;
}

.live-meta{
    text-align:right;
    font-size:12px;
}

.live-badge{
    display:inline-block;
    background:linear-gradient(90deg,var(--red),var(--red2));
    padding:6px 12px;
    border-radius:999px;
    font-weight:800;
    letter-spacing:1px;
    box-shadow:0 0 18px rgba(255,50,50,.55);
    margin-bottom:6px;
}

.cards-grid{
    display:grid;
    gap:14px;
    margin-top:18px;
}

.game-card{
    position:relative;
    padding:18px;
    border-radius:24px;
    border:1px solid var(--line);
    background:linear-gradient(180deg,rgba(255,255,255,.08),rgba(255,255,255,.04));
    overflow:hidden;
    box-shadow:0 18px 40px rgba(0,0,0,.28);
}

.game-card.waiting{
    animation:softGlow 2.5s infinite ease-in-out;
}

.game-card.drawing{
    animation:flashCard .8s infinite;
}

.game-card.declared{
    animation:pulseCard 1.1s infinite;
}

.card-head{
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:10px;
}

.card-head h2{
    margin:0;
    font-size:24px;
}

.state-badge{
    padding:7px 12px;
    border-radius:999px;
    font-size:12px;
    font-weight:800;
}

.state-badge.waiting{
    background:#493112;
    color:#ffd98b;
}

.state-badge.drawing{
    background:#6e1018;
    color:#fff;
    animation:flashText .7s infinite;
}

.state-badge.declared{
    background:#124925;
    color:#8fffb5;
}

.card-result{
    margin:18px 0;
}

.digits{
    display:flex;
    gap:10px;
    justify-content:center;
}

.digits span{
    width:68px;
    height:78px;
    border-radius:18px;
    display:flex;
    align-items:center;
    justify-content:center;
    font-size:42px;
    font-weight:900;
    background:linear-gradient(180deg,#2f1013,#150607);
    border:1px solid rgba(255,215,130,.22);
    box-shadow:inset 0 4px 10px rgba(255,255,255,.04),0 10px 18px rgba(0,0,0,.35);
}

.drawing .digits span{
    animation:slotSpin .25s infinite;
}

.meta-row{
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:10px;
    color:var(--muted);
    margin-bottom:14px;
}

.view-btn,
.history-btn,
.back-btn{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    padding:12px 16px;
    border-radius:16px;
    background:linear-gradient(90deg,var(--gold),var(--gold2));
    color:#2a1600;
    font-weight:900;
    box-shadow:0 10px 20px rgba(244,197,90,.25);
}

.extra-panels{
    display:grid;
    gap:14px;
    margin-top:18px;
}

.glass-card{
    padding:16px;
    border-radius:22px;
    border:1px solid var(--line);
    background:var(--glass);
    backdrop-filter:blur(10px);
}

.notice-board h3,
.winners-board h3{
    margin-top:0;
}

.notice-board ul{
    margin:0;
    padding-left:18px;
    color:var(--muted);
}

.notice-board li{
    margin-bottom:8px;
}

.winner-row{
    display:flex;
    justify-content:space-between;
    gap:10px;
    padding:10px 0;
    border-bottom:1px dashed rgba(255,255,255,.08);
}

.bottom-ticker{
    position:sticky;
    bottom:0;
    overflow:hidden;
    background:linear-gradient(90deg,#8f101a,#4c0910);
    border-top:1px solid rgba(255,255,255,.08);
    margin-top:18px;
}

.ticker-track{
    white-space:nowrap;
    padding:12px 0;
    display:inline-block;
    animation:tickerMove 18s linear infinite;
    font-weight:700;
    color:#ffe0a0;
}

.result-popup{
    position:fixed;
    inset:0;
    background:rgba(0,0,0,.55);
    display:flex;
    align-items:center;
    justify-content:center;
    padding:20px;
    z-index:999;
}

.hidden{
    display:none;
}

.popup-card{
    width:min(360px,100%);
    padding:28px;
    border-radius:28px;
    text-align:center;
    background:linear-gradient(180deg,#3a1214,#130607);
    border:1px solid rgba(255,220,120,.28);
    box-shadow:0 0 35px rgba(255,60,60,.35);
    animation:popupFlash .8s infinite alternate;
}

.popup-game{
    font-weight:900;
    letter-spacing:1px;
    color:var(--gold2);
    font-size:18px;
}

.popup-result{
    font-size:62px;
    font-weight:900;
    margin:10px 0;
    color:#fff;
}

.popup-note{
    color:#ff9d9d;
    font-weight:700;
}

.page-header{
    margin:14px 0;
}

.page-header h1{
    margin:0;
}

.page-header p{
    margin:6px 0 0;
    color:var(--muted);
}

.timeline-list,
.history-list{
    display:grid;
    gap:10px;
}

.timeline-item{
    display:grid;
    grid-template-columns:1fr 1fr auto;
    gap:10px;
    align-items:center;
    padding:14px;
    border-radius:18px;
    background:rgba(255,255,255,.06);
    border:1px solid rgba(255,255,255,.08);
}

.timeline-item.highlight{
    border-color:rgba(255,220,120,.5);
    box-shadow:0 0 18px rgba(255,210,80,.18);
}

.timeline-item .res{
    font-size:26px;
    font-weight:900;
}

.timeline-item .st{
    padding:6px 10px;
    border-radius:999px;
    font-size:12px;
    text-transform:uppercase;
}

.timeline-item .st.published{
    background:#124925;
}

.timeline-item .st.scheduled{
    background:#573812;
}

.timeline-item .st.paused{
    background:#444;
}

.timeline-item .st.cancelled{
    background:#601217;
}

.filter-box{
    display:grid;
    grid-template-columns:1fr 1fr auto;
    gap:10px;
    margin-bottom:14px;
}

.filter-box select,
.filter-box input,
.filter-box button{
    height:46px;
    border-radius:14px;
    border:none;
    padding:0 14px;
    font-size:14px;
}

.filter-box button{
    background:linear-gradient(90deg,var(--gold),var(--gold2));
    font-weight:800;
    color:#2a1600;
}

.center-btn-wrap{
    display:flex;
    justify-content:center;
    margin:18px 0;
}

@keyframes softGlow{
    0%,100%{box-shadow:0 0 0 rgba(255,215,100,.15)}
    50%{box-shadow:0 0 24px rgba(255,215,100,.22)}
}

@keyframes flashCard{
    0%,100%{box-shadow:0 0 15px rgba(255,40,40,.2)}
    50%{box-shadow:0 0 30px rgba(255,40,40,.45)}
}

@keyframes pulseCard{
    0%,100%{transform:scale(1)}
    50%{transform:scale(1.01)}
}

@keyframes slotSpin{
    0%{transform:translateY(0)}
    50%{transform:translateY(-3px)}
    100%{transform:translateY(0)}
}

@keyframes flashText{
    0%,100%{opacity:1}
    50%{opacity:.4}
}

@keyframes tickerMove{
    0%{transform:translateX(100%)}
    100%{transform:translateX(-100%)}
}

@keyframes popupFlash{
    from{
        transform:scale(1);
        box-shadow:0 0 24px rgba(255,80,80,.25);
    }
    to{
        transform:scale(1.03);
        box-shadow:0 0 42px rgba(255,210,100,.35);
    }
}

@media (max-width:480px){
    .topbar{
        flex-direction:column;
        align-items:flex-start;
    }

    .live-meta{
        text-align:left;
    }

    .digits span{
        width:60px;
        height:72px;
        font-size:38px;
    }

    .filter-box{
        grid-template-columns:1fr;
    }

    .timeline-item{
        grid-template-columns:1fr 1fr;
    }

    .timeline-item .st{
        grid-column:1/-1;
        justify-self:start;
    }
}
.top-nav-actions{
    display:flex;
    gap:10px;
    flex-wrap:wrap;
    margin:14px 0 0 0;
}

.nav-chip{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    padding:10px 14px;
    border-radius:999px;
    background:rgba(255,255,255,.08);
    border:1px solid rgba(255,255,255,.12);
    color:var(--text);
    font-weight:700;
}

.site-footer{
    margin-top:20px;
    padding:18px 14px 28px;
    text-align:center;
    color:var(--muted);
}

.footer-brand{
    font-size:16px;
    font-weight:800;
    color:var(--gold2);
    margin-bottom:6px;
}

.footer-text{
    font-size:13px;
}
.top-nav-actions{
    display:flex;
    gap:10px;
    flex-wrap:wrap;
    margin:14px 0 0 0;
}

.nav-chip{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    padding:10px 14px;
    border-radius:999px;
    background:rgba(255,255,255,.08);
    border:1px solid rgba(255,255,255,.12);
    color:var(--text);
    font-weight:700;
    transition:.2s ease;
}

.nav-chip:hover{
    transform:translateY(-1px);
    background:rgba(255,255,255,.12);
}
.game-tabs{
    display:grid;
    grid-template-columns:repeat(3,1fr);
    gap:10px;
    margin:14px 0;
}

.game-tab{
    display:flex;
    align-items:center;
    justify-content:center;
    min-height:46px;
    padding:10px 12px;
    border-radius:14px;
    background:rgba(255,255,255,.07);
    border:1px solid rgba(255,255,255,.12);
    color:var(--text);
    font-weight:800;
    text-align:center;
    transition:.2s ease;
}

.game-tab:hover{
    transform:translateY(-1px);
    background:rgba(255,255,255,.10);
}

.game-tab.active{
    background:linear-gradient(90deg,var(--gold),var(--gold2));
    color:#2a1600;
    border-color:rgba(255,215,120,.35);
    box-shadow:0 10px 20px rgba(244,197,90,.18);
}
.brand-logo-text{
    width:58px;
    height:58px;
    border-radius:18px;
    display:flex;
    align-items:center;
    justify-content:center;
    font-size:24px;
    font-weight:900;
    background:linear-gradient(180deg,#2f1013,#150607);
    border:1px solid rgba(255,255,255,0.12);
    box-shadow:0 10px 18px rgba(0,0,0,.35);
    color:var(--gold2);
    flex-shrink:0;
}

.brand-text-wrap h1{
    margin:0;
    font-size:20px;
}

.top-nav-actions{
    display:flex;
    gap:10px;
    flex-wrap:wrap;
    margin:14px 0 0 0;
}

.nav-chip{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    min-height:42px;
    padding:10px 14px;
    border-radius:999px;
    background:rgba(255,255,255,.08);
    border:1px solid rgba(255,255,255,.12);
    color:var(--text);
    font-weight:700;
    transition:.2s ease;
}

.nav-chip:hover{
    transform:translateY(-1px);
    background:rgba(255,255,255,.12);
}

.active-chip{
    background:linear-gradient(90deg,var(--gold),var(--gold2));
    color:#2a1600;
    border-color:rgba(255,215,120,.35);
}

.game-tabs{
    display:grid;
    grid-template-columns:repeat(3,1fr);
    gap:10px;
    margin:14px 0;
}

.game-tab{
    display:flex;
    align-items:center;
    justify-content:center;
    min-height:48px;
    padding:10px 12px;
    border-radius:14px;
    background:rgba(255,255,255,.07);
    border:1px solid rgba(255,255,255,.12);
    color:var(--text);
    font-weight:800;
    text-align:center;
    transition:.2s ease;
}

.game-tab:hover{
    transform:translateY(-1px);
    background:rgba(255,255,255,.10);
}

.game-tab.active{
    background:linear-gradient(90deg,var(--gold),var(--gold2));
    color:#2a1600;
    border-color:rgba(255,215,120,.35);
    box-shadow:0 10px 20px rgba(244,197,90,.18);
}

.site-footer{
    margin-top:20px;
    padding:10px 0 28px;
}

.footer-inner{
    text-align:center;
}

.footer-brand{
    font-size:16px;
    font-weight:800;
    color:var(--gold2);
    margin-bottom:6px;
}

.footer-text{
    font-size:13px;
    color:var(--muted);
}

@media (max-width:480px){
    .top-nav-actions{
        display:grid;
        grid-template-columns:1fr 1fr;
        gap:10px;
    }

    .top-nav-actions .nav-chip:first-child{
        grid-column:1/-1;
    }

    .game-tabs{
        grid-template-columns:1fr;
    }
}