@import url('https://fonts.googleapis.com/css2?family=Oswald:wght@700&family=Roboto+Condensed:wght@400;700&display=swap');

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

body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: #0a0612;
    background-image:
        radial-gradient(ellipse at 50% 0%, rgba(120, 40, 180, 0.35) 0%, transparent 60%),
        radial-gradient(ellipse at 20% 80%, rgba(180, 20, 60, 0.2) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(20, 80, 180, 0.2) 0%, transparent 50%);
    font-family: 'Roboto Condensed', 'Trebuchet MS', sans-serif;
    overflow-x: hidden;
    padding: 16px;
}

/* ── Floating sparkle dots in background ── */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
        radial-gradient(1px 1px at 15% 20%, rgba(255,215,0,0.6) 0%, transparent 100%),
        radial-gradient(1px 1px at 35% 60%, rgba(255,215,0,0.4) 0%, transparent 100%),
        radial-gradient(1px 1px at 65% 30%, rgba(255,215,0,0.5) 0%, transparent 100%),
        radial-gradient(1px 1px at 80% 70%, rgba(255,215,0,0.4) 0%, transparent 100%),
        radial-gradient(1px 1px at 50% 85%, rgba(255,100,100,0.5) 0%, transparent 100%),
        radial-gradient(1.5px 1.5px at 25% 45%, rgba(200,150,255,0.5) 0%, transparent 100%),
        radial-gradient(1.5px 1.5px at 70% 55%, rgba(200,150,255,0.4) 0%, transparent 100%);
    pointer-events: none;
    z-index: 0;
    animation: twinkle 4s ease-in-out infinite alternate;
}

@keyframes twinkle {
    0%   { opacity: 0.5; }
    100% { opacity: 1; }
}

/* ── WRAPPER: machine + lever side by side ── */
.machine-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    z-index: 1;
}

/* ── MAIN MACHINE ── */
.casino-machine {
    position: relative;
    width: min(90vw, 360px);
    background: linear-gradient(160deg, #2a1a00 0%, #1a1000 40%, #0d0800 100%);
    border-radius: 28px 28px 14px 14px;
    box-shadow:
        0 0 0 3px #7a5500,
        0 0 0 6px #c89000,
        0 0 0 8px #7a5500,
        0 0 60px rgba(200, 144, 0, 0.4),
        0 30px 80px rgba(0, 0, 0, 0.9);
    padding: 14px 14px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

/* Gold corner accents */
.casino-machine::before,
.casino-machine::after {
    content: '★';
    position: absolute;
    top: 10px;
    font-size: 22px;
    color: #ffd700;
    text-shadow: 0 0 10px #ffd700, 0 0 20px #ffaa00;
    animation: starPulse 2s ease-in-out infinite alternate;
}
.casino-machine::before { left: 14px; }
.casino-machine::after  { right: 14px; }

@keyframes starPulse {
    0%   { opacity: 0.6; transform: scale(0.9); }
    100% { opacity: 1;   transform: scale(1.1); }
}

/* ── MARQUEE HEADER ── */
.marquee {
    width: 100%;
    background: #080408;
    border-radius: 16px;
    border: 3px solid #9b0000;
    box-shadow:
        inset 0 0 20px rgba(0,0,0,0.9),
        0 0 12px rgba(200, 0, 0, 0.5),
        0 0 25px rgba(200, 0, 0, 0.2);
    padding: 12px 10px 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

h1 {
    font-family: 'Oswald', 'Impact', sans-serif;
    color: #ffd700;
    font-size: clamp(16px, 5vw, 22px);
    letter-spacing: 2px;
    text-align: center;
    line-height: 1.25;
    font-weight: 700;
    text-transform: uppercase;
    text-shadow:
        0 0 8px #ff6600,
        0 0 18px #ff4400,
        0 0 35px #cc2200,
        2px 2px 0 #6b2600;
}

/* ── LIGHTS ── */
.lights {
    display: flex;
    justify-content: space-around;
    width: 100%;
    padding: 0 4px;
}

.light {
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: #ff2200;
    box-shadow: 0 0 6px #ff2200, 0 0 14px #ff0000;
    animation: blink 0.55s infinite alternate;
    flex-shrink: 0;
}

.light:nth-child(even) {
    background: #ffd700;
    box-shadow: 0 0 6px #ffd700, 0 0 14px #ffaa00;
    animation-delay: 0.275s;
}

@keyframes blink {
    0%   { opacity: 0.25; transform: scale(0.85); }
    100% { opacity: 1;    transform: scale(1.1); }
}

/* ── MACHINE BODY ── */
.machine-body {
    width: 100%;
    background: linear-gradient(175deg, #181818 0%, #0e0e0e 100%);
    border-radius: 14px;
    border: 3px solid #3a3a3a;
    box-shadow: inset 0 0 40px rgba(0,0,0,0.9), 0 4px 16px rgba(0,0,0,0.6);
    padding: 14px 12px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

/* ── REEL SCREEN ── */
.screen-glass {
    width: 100%;
    background: linear-gradient(135deg, rgba(80,60,0,0.6), rgba(30,20,0,0.8));
    border-radius: 10px;
    padding: 6px;
    border: 3px solid #6a4800;
    box-shadow:
        inset 0 0 20px rgba(0,0,0,0.8),
        0 0 10px rgba(180, 120, 0, 0.3);
}

.screen {
    width: 100%;
    background: #0c0a06;
    border-radius: 6px;
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    overflow: hidden;
    padding: 8px 6px;
    gap: 6px;
    min-height: 120px;
}

.reel {
    flex: 1;
    background: linear-gradient(180deg, #1a1408 0%, #0e0c06 100%);
    border: 2px solid #3d2f00;
    border-radius: 6px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 4px 14px rgba(0,0,0,0.7);
    min-height: 100px;
}

/* Reel horizontal divider lines (classic slot look) */
.reel::before,
.reel::after {
    content: '';
    position: absolute;
    left: 0; right: 0;
    height: 2px;
    background: rgba(255, 215, 0, 0.12);
    pointer-events: none;
}
.reel::before { top: 30%; }
.reel::after  { bottom: 30%; }

.symbol {
    font-size: clamp(30px, 8vw, 42px);
    font-weight: 900;
    color: #ffd700;
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.6);
    position: absolute;
    text-align: center;
    width: 100%;
    user-select: none;
}

/* ── LED STATUS BOARD ── */
.led-board {
    width: 100%;
    background: #060606;
    border: 3px solid #222;
    border-radius: 8px;
    padding: 10px 8px;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.9), 0 0 8px rgba(0,0,0,0.5);
    position: relative;
    overflow: hidden;
}

/* Scanline effect on LED board */
.led-board::after {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 3px,
        rgba(0,0,0,0.15) 3px,
        rgba(0,0,0,0.15) 4px
    );
    pointer-events: none;
}

.slot-text {
    font-size: clamp(20px, 6vw, 28px);
    font-weight: 700;
    font-family: 'Oswald', 'Courier New', monospace;
    color: #ff3333;
    text-align: center;
    text-shadow: 0 0 6px #ff0000, 0 0 14px #cc0000;
    letter-spacing: 4px;
    text-transform: uppercase;
}

/* ── PULL BUTTON (tap area below lever on mobile) ── */
.pull-btn {
    display: none; /* shown only on mobile via media query */
    width: 85%;
    padding: 14px 10px;
    background: linear-gradient(135deg, #cc0000, #880000);
    color: #ffd700;
    font-family: 'Oswald', sans-serif;
    font-size: 20px;
    letter-spacing: 3px;
    font-weight: 700;
    text-transform: uppercase;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    box-shadow:
        0 0 10px rgba(200, 0, 0, 0.6),
        0 0 25px rgba(200, 0, 0, 0.3),
        inset 0 2px 4px rgba(255,255,255,0.15);
    transition: transform 0.1s, box-shadow 0.1s;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.pull-btn:active {
    transform: scale(0.96);
    box-shadow:
        0 0 6px rgba(200, 0, 0, 0.5),
        inset 0 3px 8px rgba(0,0,0,0.4);
}

/* ── LEVER (desktop) ── */
.lever-container {
    position: absolute;
    right: -58px;
    top: 50%;
    transform: translateY(-50%);
    width: 55px;
    height: 230px;
    cursor: pointer;
    z-index: 10;
    -webkit-tap-highlight-color: transparent;
}

.lever-base {
    position: absolute;
    bottom: 20px;
    left: 0;
    width: 36px;
    height: 75px;
    background: linear-gradient(90deg, #333, #777, #2a2a2a);
    border-radius: 12px 0 0 12px;
    box-shadow: -4px 4px 12px rgba(0,0,0,0.7), inset 1px 0 4px rgba(255,255,255,0.1);
    border-left: 2px solid #888;
}

.lever-arm {
    position: absolute;
    bottom: 58px;
    left: 13px;
    width: 16px;
    height: 135px;
    background: linear-gradient(90deg, #999, #fff, #888);
    transform-origin: bottom center;
    transition: transform 0.4s cubic-bezier(0.25, 0.1, 0.25, 1.3);
    border-radius: 8px;
    box-shadow: -2px 0 8px rgba(0,0,0,0.5);
    border: 1px solid #666;
}

.lever-ball {
    position: absolute;
    top: -22px;
    left: -16px;
    width: 48px;
    height: 48px;
    background: radial-gradient(circle at 35% 30%, #ff6666, #cc0000 55%, #7a0000);
    border-radius: 50%;
    box-shadow:
        0 6px 16px rgba(0,0,0,0.7),
        inset -4px -4px 10px rgba(0,0,0,0.5),
        0 0 12px rgba(200, 0, 0, 0.5);
}

/* ── ANIMATION: LEVER PULL ── */
.pulling .lever-arm {
    transform: rotateX(160deg);
}

/* ── ANIMATION: REEL SPIN ── */
.spinning-reel .symbol {
    animation: reelSpin 0.12s linear infinite;
    filter: blur(2px);
    color: #ffcc00;
}

@keyframes reelSpin {
    0%   { transform: translateY(-100px); }
    100% { transform: translateY(100px); }
}

/* ── ANIMATION: WINNER ── */
.winner .slot-text {
    color: #00ff88;
    text-shadow: 0 0 10px #00ff88, 0 0 25px #00ff44, 0 0 50px #00dd33;
    animation: winPulse 0.35s infinite alternate;
}

@keyframes winPulse {
    0%   { transform: scale(1);    opacity: 0.85; }
    100% { transform: scale(1.08); opacity: 1; }
}

/* ── STROBE / WIN LIGHTS ── */
.strobe .light {
    animation-duration: 0.06s !important;
}

.strobe .casino-machine {
    animation: goldFlare 0.3s infinite alternate;
}

@keyframes goldFlare {
    0%   { box-shadow: 0 0 0 3px #7a5500, 0 0 0 6px #c89000, 0 0 0 8px #7a5500, 0 0 40px rgba(255,215,0,0.5), 0 30px 80px rgba(0,0,0,0.9); }
    100% { box-shadow: 0 0 0 3px #7a5500, 0 0 0 6px #ffd700, 0 0 0 8px #c89000, 0 0 80px rgba(255,215,0,0.9), 0 30px 80px rgba(0,0,0,0.9); }
}

/* ── COIN BURST ANIMATION ── */
.coin {
    position: fixed;
    font-size: 28px;
    pointer-events: none;
    z-index: 999;
    animation: coinFall var(--dur) ease-in forwards;
    top: -40px;
}

@keyframes coinFall {
    0%   { transform: translateY(0)      rotate(0deg);   opacity: 1; }
    80%  { opacity: 1; }
    100% { transform: translateY(105vh)  rotate(720deg); opacity: 0; }
}

/* ── RESPONSIVE ── */

/* Tablet / narrow desktop */
@media (max-width: 520px) {
    .lever-container {
        display: none;
    }
    .pull-btn {
        display: block;
    }
    .casino-machine {
        width: min(94vw, 340px);
        padding: 12px 10px 18px;
    }
}

/* Small phones */
@media (max-width: 360px) {
    h1 {
        font-size: 14px;
        letter-spacing: 1px;
    }
    .slot-text {
        font-size: 18px;
        letter-spacing: 2px;
    }
    .screen {
        min-height: 90px;
    }
    .light {
        width: 10px;
        height: 10px;
    }
}

/* Desktop: ensure wrapper centers nicely with lever space */
@media (min-width: 521px) {
    .machine-wrapper {
        padding-right: 58px; /* offset for lever */
    }
    .pull-btn {
        display: none !important;
    }
}
