:root {
    --green: #39ff5a;
    --green-soft: rgba(57, 255, 90, .16);
    --green-line: rgba(57, 255, 90, .55);
    --text: #eaffee;
    --muted: #7d9983;
    --bg: #000;
    --danger: #ff3434;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    min-height: 100vh;
    background: #000;
    color: var(--text);
    font-family: "Courier New", Consolas, monospace;
    overflow-x: hidden;
}

#matrixCanvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    opacity: .38;
}

body::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -1;
    background:
        radial-gradient(circle at 50% 20%, rgba(57, 255, 90, .12), transparent 34%),
        linear-gradient(90deg, rgba(0,0,0,.72), rgba(0,0,0,.38), rgba(0,0,0,.72)),
        repeating-linear-gradient(0deg, rgba(255,255,255,.03), rgba(255,255,255,.03) 1px, transparent 1px, transparent 4px);
}

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

.site-shell {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 28px 0;
}

.public-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.brand-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    margin-bottom: 42px;
}

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

.brand-logo, .sidebar-logo, .login-logo {
    image-rendering: pixelated;
    filter: drop-shadow(0 0 18px var(--green));
}

.brand-logo {
    width: 86px;
    height: 86px;
    object-fit: contain;
}

.brand-title {
    color: var(--green);
    text-transform: none;
    letter-spacing: .05em;
    font-size: 28px;
    font-weight: 900;
    text-shadow: 0 0 14px rgba(57,255,90,.75);
}

.brand-subtitle {
    color: var(--muted);
    margin-top: 6px;
    font-size: 14px;
}

.ghost-link, .ghost-btn {
    border: 1px solid var(--green-line);
    background: rgba(0, 20, 4, .68);
    color: var(--green);
    padding: 13px 18px;
    border-radius: 14px;
    box-shadow: 0 0 22px rgba(57,255,90,.12);
    cursor: pointer;
    font: inherit;
    font-weight: 800;
}

.public-grid {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr .86fr;
    gap: 26px;
    align-items: center;
}

.panel {
    border: 1px solid var(--green-line);
    background:
        linear-gradient(180deg, rgba(1, 17, 5, .86), rgba(0, 0, 0, .78));
    box-shadow:
        inset 0 0 40px rgba(57,255,90,.045),
        0 0 34px rgba(57,255,90,.13);
    border-radius: 22px;
    padding: 34px;
    backdrop-filter: blur(3px);
}

.hero-panel {
    text-align: center;
    padding: clamp(34px, 5vw, 72px);
}

.panel-kicker {
    color: var(--green);
    text-transform: uppercase;
    letter-spacing: .08em;
    font-size: 22px;
    font-weight: 900;
    margin-bottom: 18px;
    text-shadow: 0 0 12px rgba(57,255,90,.65);
}

h1 {
    margin: 0;
    color: var(--green);
    font-size: clamp(44px, 7vw, 84px);
    line-height: .98;
    text-shadow: 0 0 22px rgba(57,255,90,.55);
}

h2 {
    margin: 0 0 18px;
    color: var(--green);
    letter-spacing: .03em;
}

.lead, .muted, .micro {
    color: var(--muted);
    line-height: 1.55;
}

.lead {
    font-size: 18px;
    margin: 22px 0 28px;
}

.micro {
    max-width: 580px;
    margin: 20px auto 0;
    font-size: 13px;
}

.neon-btn, .danger-btn {
    border-radius: 16px;
    padding: 17px 28px;
    font: inherit;
    font-size: 18px;
    font-weight: 900;
    cursor: pointer;
    transition: .18s ease;
}

.neon-btn {
    color: var(--green);
    background: rgba(0, 22, 5, .88);
    border: 1px solid var(--green);
    box-shadow:
        inset 0 0 20px rgba(57,255,90,.08),
        0 0 24px rgba(57,255,90,.26);
    text-transform: uppercase;
}

.neon-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 36px rgba(57,255,90,.45);
}

.neon-btn:disabled {
    opacity: .6;
    cursor: wait;
    transform: none;
}

.full { width: 100%; }

.number-card, .winner-box {
    width: min(440px, 100%);
    margin: 34px auto 0;
    border: 1px solid rgba(57,255,90,.38);
    border-radius: 18px;
    background: rgba(0, 18, 4, .68);
    padding: 24px;
    text-align: center;
    box-shadow: inset 0 0 24px rgba(57,255,90,.08);
}

.number-card span, .winner-box span {
    display: block;
    color: var(--green);
    text-transform: uppercase;
    margin-bottom: 10px;
}

.number-card strong, .winner-box strong, .stat-number, .rolling-number {
    color: var(--green);
    font-size: clamp(54px, 8vw, 92px);
    line-height: 1;
    text-shadow: 0 0 18px rgba(57,255,90,.8);
}

.hidden { display: none; }

.error, .alert {
    border: 1px solid rgba(255,52,52,.65);
    background: rgba(70, 0, 0, .42);
    color: #ff7878;
    padding: 14px;
    border-radius: 14px;
}

.notice {
    border: 1px solid var(--green-line);
    background: var(--green-soft);
    color: var(--green);
    padding: 14px;
    border-radius: 14px;
    margin-bottom: 18px;
}

.rabbit-panel {
    text-align: center;
    display: grid;
    place-items: center;
    min-height: 540px;
}

.orb {
    width: min(360px, 72vw);
    height: min(360px, 72vw);
    border: 1px solid var(--green);
    border-radius: 999px;
    display: grid;
    place-items: center;
    box-shadow:
        inset 0 0 58px rgba(57,255,90,.12),
        0 0 42px rgba(57,255,90,.23);
    animation: pulse 2.8s infinite ease-in-out;
}

.orb img {
    width: 62%;
    image-rendering: pixelated;
    filter: drop-shadow(0 0 20px var(--green));
}

.stat-title {
    color: var(--green);
    margin-top: 22px;
    text-transform: uppercase;
}

.status-pill {
    border: 1px solid var(--green-line);
    border-radius: 10px;
    color: var(--green);
    padding: 11px 18px;
    margin-top: 18px;
    background: rgba(0,20,4,.55);
}

.footer {
    text-align: center;
    color: rgba(234,255,238,.45);
    padding: 24px 0 0;
}

/* Login */
.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.login-panel {
    width: min(430px, 100%);
    text-align: center;
}

.login-logo {
    width: 120px;
    height: 120px;
    object-fit: contain;
}

.matrix-input {
    width: 100%;
    border: 1px solid var(--green-line);
    background: rgba(0, 10, 2, .86);
    color: var(--green);
    padding: 16px;
    border-radius: 14px;
    font: inherit;
    outline: none;
    margin-bottom: 14px;
}

/* Admin */
.admin-layout {
    width: min(1440px, calc(100% - 28px));
    margin: 0 auto;
    padding: 18px 0;
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 18px;
}

.sidebar {
    position: sticky;
    top: 18px;
    height: calc(100vh - 36px);
    padding: 24px;
}

.sidebar-logo {
    width: 112px;
    height: 112px;
    object-fit: contain;
    display: block;
    margin: 0 auto 12px;
}

.small-title {
    text-align: center;
    font-size: 22px;
}

.sidebar .brand-subtitle {
    text-align: center;
}

.side-nav {
    display: grid;
    gap: 10px;
    margin-top: 34px;
}

.side-nav a {
    border: 1px solid transparent;
    color: var(--green);
    padding: 13px 14px;
    border-radius: 12px;
    background: rgba(57,255,90,.035);
}

.side-nav a:hover {
    border-color: var(--green-line);
    background: var(--green-soft);
}

.side-nav .danger-link {
    color: #ff5a5a;
}

.logout-form {
    position: absolute;
    left: 24px;
    right: 24px;
    bottom: 24px;
}

.logout-form button { width: 100%; }

.admin-main {
    min-width: 0;
}

.admin-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 18px;
}

.admin-top h1 {
    font-size: clamp(34px, 4vw, 54px);
}

.admin-top p {
    color: var(--muted);
}

.time-pill {
    border: 1px solid var(--green-line);
    color: var(--green);
    padding: 14px 18px;
    border-radius: 14px;
    background: rgba(0,20,4,.6);
    white-space: nowrap;
}

.stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-bottom: 18px;
}

.mini-card {
    border: 1px solid var(--green-line);
    border-radius: 16px;
    padding: 20px;
    background: rgba(0, 18, 4, .66);
}

.mini-card span {
    display: block;
    color: var(--muted);
    text-transform: uppercase;
    font-size: 13px;
}

.mini-card strong {
    display: block;
    color: var(--green);
    font-size: 42px;
    margin-top: 8px;
    text-shadow: 0 0 14px rgba(57,255,90,.55);
}

.draw-panel {
    text-align: center;
    margin-bottom: 18px;
}

.lottery-machine {
    width: min(720px, 100%);
    margin: 20px auto 24px;
    min-height: 280px;
    border: 1px solid var(--green-line);
    border-radius: 20px;
    background:
        radial-gradient(circle at 50% 30%, rgba(57,255,90,.14), transparent 42%),
        rgba(0, 12, 3, .7);
    display: grid;
    place-items: center;
    position: relative;
    overflow: hidden;
}

.lottery-machine::before {
    content: "0101010101010101010101010101010101010101010101010101010101010101";
    position: absolute;
    inset: 0;
    color: rgba(57,255,90,.12);
    font-size: 28px;
    letter-spacing: .4em;
    line-height: 1.6;
    word-break: break-all;
}

.machine-logo {
    position: absolute;
    left: 24px;
    bottom: 24px;
    width: 110px;
    opacity: .88;
    filter: drop-shadow(0 0 18px var(--green));
}

.rolling-number {
    position: relative;
    z-index: 2;
    border: 1px solid var(--green);
    border-radius: 14px;
    padding: 16px 30px;
    background: rgba(0,0,0,.72);
}

.lottery-machine.active {
    animation: shake .12s infinite;
}

.pop { animation: pop .11s ease-out; }
.final-pop { animation: finalPop .8s ease-out; }

.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    margin-bottom: 18px;
}

.reset-panel {
    border-color: rgba(255,52,52,.48);
}

.danger-btn {
    width: 100%;
    color: #ff7777;
    background: rgba(70,0,0,.42);
    border: 1px solid rgba(255,52,52,.65);
    box-shadow: 0 0 18px rgba(255,52,52,.16);
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    border-bottom: 1px solid rgba(57,255,90,.22);
    padding: 13px 14px;
    text-align: left;
}

th {
    color: var(--muted);
    text-transform: uppercase;
    font-size: 12px;
}

td {
    color: var(--green);
}

@keyframes pulse {
    0%, 100% { transform: scale(1); box-shadow: inset 0 0 58px rgba(57,255,90,.12), 0 0 42px rgba(57,255,90,.23); }
    50% { transform: scale(1.025); box-shadow: inset 0 0 74px rgba(57,255,90,.18), 0 0 58px rgba(57,255,90,.36); }
}

@keyframes shake {
    0% { transform: translateX(0); }
    25% { transform: translateX(-2px); }
    50% { transform: translateX(2px); }
    75% { transform: translateX(-1px); }
    100% { transform: translateX(0); }
}

@keyframes pop {
    from { transform: scale(.92); opacity: .75; }
    to { transform: scale(1); opacity: 1; }
}

@keyframes finalPop {
    0% { transform: scale(.7); opacity: .3; }
    60% { transform: scale(1.18); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

@media (max-width: 920px) {
    .public-grid, .two-col, .stats-row {
        grid-template-columns: 1fr;
    }

    .admin-layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        height: auto;
    }

    .logout-form {
        position: static;
        margin-top: 20px;
    }

    .admin-top {
        flex-direction: column;
    }
}

@media (max-width: 560px) {
    .brand-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .panel {
        padding: 22px;
    }

    h1 {
        font-size: 42px;
    }

    .brand-logo {
        width: 68px;
        height: 68px;
    }

    .machine-logo {
        width: 70px;
    }
}
