/* ============================================
   lottery.day - Neubrutalism + Frost Whimsy
   ============================================ */

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --frost-white: #f8f9fc;
    --ice-blue: #d0e4f5;
    --midnight-ink: #1a1b2e;
    --lucky-gold: #e8a830;
    --scratch-silver: #b8c0cc;
    --blush-pink: #f2a7b3;
    --deep-frost: rgba(180, 210, 240, 0.25);
    --border-color: #1a1a1a;
    --card-shadow: 6px 6px 0 #1a1a1a;
    --card-border: 4px solid #1a1a1a;
    --ball-shadow: inset -4px -4px 12px rgba(26,27,46,0.15), 4px 4px 0 #1a1a1a;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'DM Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.15vw, 1.15rem);
    line-height: 1.7;
    color: var(--midnight-ink);
    background: var(--frost-white);
    overflow-x: hidden;
    position: relative;
}

/* --- Bokeh Background --- */
.bokeh-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    background: linear-gradient(180deg, var(--midnight-ink) 0%, var(--frost-white) 100%);
}

.bokeh-circle {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    will-change: transform;
}

/* --- Sections --- */
.act {
    position: relative;
    z-index: 1;
}

.act-one {
    min-height: 100vh;
    padding: 40px;
}

.act-two {
    min-height: 150vh;
    padding: 40px;
}

.act-three {
    min-height: 100vh;
    padding: 40px;
    padding-bottom: 80px;
}

.act-inner {
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
}

/* --- Z-Pattern Layout --- */
.z-pattern {
    display: grid;
    grid-template-columns: 7fr 5fr;
    gap: 24px;
    margin-bottom: 40px;
}

.z-pattern-reverse {
    grid-template-columns: 5fr 7fr;
}

.z-top-left,
.z-bottom-left {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.z-top-right,
.z-bottom-right {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

/* Full width card spans both columns */
.full-width-card {
    grid-column: 1 / -1;
    margin-bottom: 40px;
}

/* --- Typography --- */
.hero-headline {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(2.4rem, 6vw, 5rem);
    letter-spacing: -0.02em;
    line-height: 1.1;
    color: var(--frost-white);
    margin-bottom: 16px;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 1s ease, transform 1s ease;
}

.hero-headline.visible {
    opacity: 1;
    transform: translateY(0);
}

.hero-sub {
    font-family: 'Space Mono', monospace;
    font-weight: 700;
    font-size: clamp(1rem, 2vw, 1.4rem);
    color: var(--lucky-gold);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.section-header {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(1.6rem, 3.5vw, 2.6rem);
    letter-spacing: -0.02em;
    margin-bottom: 16px;
    color: var(--midnight-ink);
}

.act-three-headline {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-style: italic;
    font-size: clamp(2.4rem, 6vw, 5rem);
    letter-spacing: -0.02em;
    text-align: center;
    margin-bottom: 48px;
    color: var(--midnight-ink);
}

.accent-text {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-style: italic;
    font-size: clamp(1.2rem, 2vw, 1.6rem);
    color: var(--lucky-gold);
    margin-top: 12px;
}

/* --- Neubrutalist Cards --- */
.neu-card {
    background: rgba(248, 249, 252, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: var(--card-border);
    box-shadow: var(--card-shadow);
    padding: 32px;
    position: relative;
    overflow: hidden;
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.6s ease, transform 0.6s ease, border-color 0.3s ease;
}

.neu-card.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Animated Border on Hover */
.neu-card::before {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    background: linear-gradient(
        90deg,
        var(--midnight-ink),
        var(--lucky-gold),
        var(--blush-pink),
        var(--ice-blue),
        var(--midnight-ink)
    );
    background-size: 400% 100%;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.neu-card:hover::before {
    opacity: 1;
    animation: borderRainbow 2s linear infinite;
}

@keyframes borderRainbow {
    0% { background-position: 0% 50%; }
    100% { background-position: 400% 50%; }
}

/* --- Lottery Drum --- */
.lottery-drum {
    width: clamp(260px, 30vw, 400px);
    height: clamp(260px, 30vw, 400px);
    border-radius: 50%;
    border: 4px solid var(--border-color);
    background: rgba(248, 249, 252, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: var(--card-shadow);
    position: relative;
    overflow: hidden;
}

.drum-inner {
    width: 100%;
    height: 100%;
    position: relative;
}

/* --- Lottery Balls --- */
.ball {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #ffffff, var(--ice-blue));
    border: 3px solid var(--midnight-ink);
    box-shadow: var(--ball-shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    will-change: transform;
}

.ball span {
    font-family: 'Space Mono', monospace;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--midnight-ink);
}

.ball-1 { top: 20%; left: 25%; animation: ballFloat1 4s cubic-bezier(0.34, 1.56, 0.64, 1) infinite; }
.ball-2 { top: 15%; left: 55%; animation: ballFloat2 3.5s cubic-bezier(0.34, 1.56, 0.64, 1) infinite 0.3s; }
.ball-3 { top: 50%; left: 40%; animation: ballFloat3 4.5s cubic-bezier(0.34, 1.56, 0.64, 1) infinite 0.6s; }
.ball-4 { top: 55%; left: 15%; animation: ballFloat4 3.8s cubic-bezier(0.34, 1.56, 0.64, 1) infinite 0.9s; }
.ball-5 { top: 45%; left: 65%; animation: ballFloat5 4.2s cubic-bezier(0.34, 1.56, 0.64, 1) infinite 1.2s; }

@keyframes ballFloat1 {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(12px, -18px); }
    50% { transform: translate(-8px, 10px); }
    75% { transform: translate(15px, 5px); }
}

@keyframes ballFloat2 {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(-15px, 12px); }
    50% { transform: translate(10px, -14px); }
    75% { transform: translate(-5px, 8px); }
}

@keyframes ballFloat3 {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(8px, 15px); }
    50% { transform: translate(-12px, -8px); }
    75% { transform: translate(10px, -12px); }
}

@keyframes ballFloat4 {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(-10px, -15px); }
    50% { transform: translate(14px, 6px); }
    75% { transform: translate(-8px, 12px); }
}

@keyframes ballFloat5 {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(12px, 10px); }
    50% { transform: translate(-6px, -16px); }
    75% { transform: translate(-14px, 4px); }
}

/* --- Scratch Cards --- */
.scratch-container {
    position: relative;
    width: 100%;
    height: 160px;
    border: 3px solid var(--border-color);
    overflow: hidden;
    cursor: crosshair;
    user-select: none;
}

.scratch-grand {
    height: 300px;
}

.scratch-reveal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    background: var(--frost-white);
    padding: 20px;
}

.reveal-text {
    font-family: 'Space Mono', monospace;
    font-weight: 700;
    font-size: clamp(1.2rem, 3vw, 2.4rem);
    color: var(--lucky-gold);
    text-align: center;
}

.scratch-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
}

.scratch-instruction {
    font-family: 'Space Mono', monospace;
    font-weight: 400;
    font-size: 0.85rem;
    color: var(--scratch-silver);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* --- Number Counter --- */
.number-counter {
    display: flex;
    gap: 16px;
    margin: 24px 0;
    flex-wrap: wrap;
}

.counter-digit {
    font-family: 'Space Mono', monospace;
    font-weight: 700;
    font-size: clamp(1.2rem, 3vw, 2.4rem);
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--frost-white);
    border: 3px solid var(--midnight-ink);
    box-shadow: 3px 3px 0 var(--midnight-ink);
    color: var(--midnight-ink);
}

.counter-digit.settled {
    color: var(--lucky-gold);
    border-color: var(--lucky-gold);
}

/* --- Watermarks --- */
.watermark-hex {
    font-family: 'Space Mono', monospace;
    font-weight: 400;
    font-size: 0.7rem;
    color: var(--midnight-ink);
    opacity: 0.06;
    word-break: break-all;
    margin-top: 12px;
}

.binary-watermark {
    font-family: 'Space Mono', monospace;
    font-weight: 400;
    font-size: 0.7rem;
    color: var(--midnight-ink);
    opacity: 0.06;
    margin-top: 16px;
    letter-spacing: 0.1em;
}

/* --- Circuit Traces --- */
.circuit-trace {
    width: 100%;
    height: 80px;
    margin-top: 24px;
}

.trace-path {
    stroke-dashoffset: 1000;
    animation: traceFlow 8s linear infinite;
}

.trace-delay {
    animation-delay: 2s;
}

@keyframes traceFlow {
    0% { stroke-dashoffset: 1000; }
    100% { stroke-dashoffset: 0; }
}

/* --- Ball Track --- */
.ball-track {
    position: relative;
    height: 100px;
    margin: 40px 0;
    overflow: hidden;
}

.track-ball {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #ffffff, var(--ice-blue));
    border: 3px solid var(--midnight-ink);
    box-shadow: var(--ball-shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 22px;
}

.track-ball span {
    font-family: 'Space Mono', monospace;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--midnight-ink);
}

.track-ball-1 { animation: rollBall 6s ease-in-out infinite; }
.track-ball-2 { animation: rollBall 7s ease-in-out infinite 1s; }
.track-ball-3 { animation: rollBall 5.5s ease-in-out infinite 2s; }

@keyframes rollBall {
    0% { left: -60px; transform: rotate(0deg); }
    100% { left: calc(100% + 60px); transform: rotate(720deg); }
}

/* --- Ticker Ribbon --- */
.ticker-ribbon {
    width: 100%;
    overflow: hidden;
    background: var(--midnight-ink);
    border-top: 4px solid var(--border-color);
    border-bottom: 4px solid var(--border-color);
    padding: 12px 0;
    margin-top: 40px;
}

.ticker-content {
    display: flex;
    white-space: nowrap;
    animation: tickerScroll 20s linear infinite;
}

.ticker-content span {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-style: italic;
    font-size: 1.4rem;
    color: var(--lucky-gold);
    padding: 0 24px;
}

.ticker-content .ticker-bullet {
    color: var(--blush-pink);
    font-size: 1rem;
    padding: 0 8px;
    display: inline-flex;
    align-items: center;
}

@keyframes tickerScroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* --- Frosted Divider --- */
.frost-divider {
    width: 100%;
    height: 120px;
    background: var(--deep-frost);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    position: relative;
    overflow: hidden;
    margin-top: 0;
}

.divider-bokeh {
    width: 100%;
    height: 100%;
    position: relative;
}

/* --- Golden Border Card --- */
.golden-border {
    border-color: var(--lucky-gold);
    box-shadow: 6px 6px 0 var(--lucky-gold);
}

.golden-border::before {
    background: linear-gradient(
        90deg,
        var(--lucky-gold),
        var(--blush-pink),
        var(--lucky-gold),
        var(--frost-white),
        var(--lucky-gold)
    );
    background-size: 400% 100%;
    opacity: 1;
    animation: borderRainbow 2s linear infinite;
}

/* --- Generative Art Container --- */
.generative-art {
    width: 100%;
    height: 200px;
    position: relative;
    margin-bottom: 16px;
}

.grand-message {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-style: italic;
    font-size: clamp(1.4rem, 3vw, 2.2rem);
    color: var(--lucky-gold);
    text-align: center;
}

/* --- Confetti --- */
.confetti-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    z-index: 10;
}

.confetti-piece {
    position: absolute;
    width: 10px;
    height: 10px;
    opacity: 0;
}

.confetti-piece.active {
    opacity: 1;
    animation: confettiFall 3s ease-out forwards;
}

@keyframes confettiFall {
    0% {
        transform: translateY(0) rotate(0deg) scale(1);
        opacity: 1;
    }
    100% {
        transform: translateY(400px) rotate(720deg) scale(0);
        opacity: 0;
    }
}

/* --- Winning Numbers Display --- */
.winning-numbers-display {
    text-align: center;
    margin: 48px 0;
}

.winning-label {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(1.4rem, 3vw, 2rem);
    margin-bottom: 24px;
    color: var(--midnight-ink);
}

.winning-balls {
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}

.winning-ball {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #ffffff, var(--ice-blue));
    border: 3px solid var(--midnight-ink);
    box-shadow: var(--ball-shadow);
    display: flex;
    align-items: center;
    justify-content: center;
}

.winning-ball span {
    font-family: 'Space Mono', monospace;
    font-weight: 700;
    font-size: 1.3rem;
    color: var(--midnight-ink);
}

.bonus-ball {
    background: radial-gradient(circle at 35% 35%, #fff6d6, var(--lucky-gold));
    border-color: var(--lucky-gold);
    box-shadow: inset -4px -4px 12px rgba(26,27,46,0.15), 4px 4px 0 var(--lucky-gold);
}

.bonus-ball span {
    color: var(--midnight-ink);
}

/* --- Closing Card --- */
.card-closing {
    text-align: center;
    max-width: 700px;
    margin: 0 auto;
}

.closing-text {
    font-family: 'DM Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.5vw, 1.2rem);
    line-height: 1.8;
    color: var(--midnight-ink);
    margin-bottom: 16px;
}

.closing-coda {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-style: italic;
    font-size: clamp(1.6rem, 3vw, 2.4rem);
    color: var(--lucky-gold);
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .act-one,
    .act-two,
    .act-three {
        padding: 20px;
    }

    .z-pattern,
    .z-pattern-reverse {
        grid-template-columns: 1fr;
    }

    .lottery-drum {
        width: 220px;
        height: 220px;
        margin: 0 auto;
    }

    .ball {
        width: 48px;
        height: 48px;
    }

    .ball span {
        font-size: 0.85rem;
    }

    .number-counter {
        gap: 8px;
    }

    .counter-digit {
        width: 48px;
        height: 48px;
    }

    .winning-ball {
        width: 56px;
        height: 56px;
    }

    .winning-ball span {
        font-size: 1rem;
    }

    .scratch-grand {
        height: 220px;
    }
}

@media (max-width: 480px) {
    .hero-headline {
        font-size: 2.2rem;
    }

    .neu-card {
        padding: 20px;
    }

    .lottery-drum {
        width: 180px;
        height: 180px;
    }

    .ball {
        width: 40px;
        height: 40px;
    }

    .ball span {
        font-size: 0.75rem;
    }
}
