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

body {
    background-color: #3e0000;
    background-image:
        linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)),
        url('../img/bg_treasure.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    color: #fff;
    font-family: 'Roboto', sans-serif;
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow-y: auto;
    /* Allow scrolling for Log */
}

/* Container for the whole machine with some perspective */
.casino-container {
    background: transparent;
    padding: 0;
    width: 100%;
    max-width: 800px;
    text-align: center;
    position: relative;
    /* Cabinet Shadow */
    filter: drop-shadow(0 0 50px rgba(138, 43, 226, 0.3));
}

/* HEADER / TOP BANNER */
.game-header {
    margin-bottom: -16px;
    /* Overlap the frame */
    position: relative;
    z-index: 5;
    /* Behind the frame */
}

.game-logo {
    max-width: 180px;
    /* Reduced to 180px */
    width: 100%;
    height: auto;
    /* filter: drop-shadow(0 0 15px rgba(255, 215, 0, 0.6)); <-- REMOVED expensive animated filter */
    /* Gold glow */
    /* animation: floatLogo 3s ease-in-out infinite alternate; <-- REMOVED FOR PERFORMANCE (STATIC LOGO) */
}

@keyframes floatLogo {
    from {
        transform: translateY(0);
    }

    to {
        transform: translateY(-10px);
    }
}

/* GOLDEN CABINET FRAME */
/* GOLDEN CABINET FRAME */
/* GOLDEN CABINET FRAME (Coin Master Style) */
.slot-machine {
    background: #1a0500;
    /* Dark reddish brown background */
    position: relative;
    z-index: 10;
    padding: 15px;
    margin: 0 auto;
    max-width: 380px;

    /* Rounded "Cartoon" corners */
    border-radius: 40px 40px 20px 20px;

    /* Thinner top, thicker bottom for weight */
    border-top: 8px solid #ffd700;
    border-right: 20px solid #ffa500;
    border-left: 20px solid #ffa500;
    border-bottom: 25px solid #cd853f;

    /* Deep 3D Shadow Layers */
    box-shadow:
        /* Inner bezel */
        inset 0 0 20px rgba(0, 0, 0, 0.8),
        /* Gold Highlight Rim */
        0 0 0 5px #ffd700,
        /* Outer Casing (Red/Orange) */
        0 0 0 12px #b22222,
        /* Casing Highlight */
        0 0 0 15px #ff4500;
    /* Removed heavy drop shadow: 0 20px 50px rgba(0, 0, 0, 0.6) */
}

/* DECORATIVE LIGHTS */
.cabinet-lights {
    position: absolute;
    top: -15px;
    left: -15px;
    right: -15px;
    bottom: -15px;
    border: 2px dashed #444;
    /* Fallback path */
    border-radius: 25px;
    pointer-events: none;
    z-index: 100;
    /* Using dot pattern for bulbs */
    background-image: radial-gradient(#fff 20%, transparent 20%),
        radial-gradient(#fff 20%, transparent 20%);
    background-size: 30px 30px;
    background-position: 0 0, 15px 15px;
    opacity: 0.1;
    /* Subtle reflection */
}

/* REELS WINDOW */
.reels-container {
    display: flex;
    justify-content: center;
    gap: 15px;
    /* Separation between reels */
    background: #000;
    padding: 10px;
    border-radius: 10px;
    box-shadow: inset 0 0 30px #000;
    height: 160px;
    border: 5px solid #222;
    position: relative;
    /* Glossy Screen Reflection */
    overflow: hidden;
}

.reels-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 40%;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.05) 0%, transparent 100%);
    pointer-events: none;
    z-index: 50;
}

/* INDIVIDUAL REEL STRIP */
.reel-col {
    width: 30%;
    height: 100%;
    position: relative;
    overflow: hidden;
    background: linear-gradient(to right, #000, #222 20%, #222 80%, #000);
    /* Cylindrical 3D look */
    border-radius: 5px;
    border: 1px solid #333;
}

.reel-strip {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
}

.reel-cell {
    min-height: 60px;
    height: auto;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2rem;
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
    /* Symbol pop */
    filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.2));
}

.reel-moving .reel-cell {
    /* filter: blur(8px) grayscale(0.5);  <-- REMOVED FOR PERFORMANCE */
    transform: scaleY(1.2);
    /* Reduced scale slightly */
    opacity: 0.8;
    /* Simple opacity fade is cheaper than blur */
}

/* CONTROLS PANEL */
/* CONTROLS PANEL - FORTUNE STYLE */
.controls-panel {
    background: linear-gradient(to bottom, #4a0e0e, #2a0505);
    border: 4px solid #d4af37;
    border-radius: 15px;
    box-shadow:
        0 0 0 4px #8b0000,
        /* Red outer rim */
        0 10px 20px rgba(0, 0, 0, 0.6);
    margin-top: 15px;
    padding: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    align-items: stretch;
}

/* DIGITAL DISPLAYS (Balance, Win) */
.display-box {
    background: #000;
    border: 2px solid #555;
    border-radius: 5px;
    padding: 5px 10px;
    min-width: 120px;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.8);
    text-align: right;
}

.display-label {
    color: #aaa;
    font-size: 0.7rem;
    text-transform: uppercase;
    display: block;
    margin-bottom: 2px;
}

.display-value {
    color: #17e6e6;
    /* Cyan Glow */
    font-family: 'Courier New', monospace;
    font-weight: bold;
    font-size: 1.2rem;
    text-shadow: 0 0 5px #17e6e6;
}

/* BUTTONS */
.btn-gold {
    background: linear-gradient(to bottom, #fcf6ba 0%, #bf953f 100%);
    border: 1px solid #8a6e2f;
    color: #422904;
    font-weight: bold;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    box-shadow: 0 3px 0 #5e4618, 0 5px 5px rgba(0, 0, 0, 0.3);
    text-transform: uppercase;
    font-size: 0.9rem;
    transition: all 0.1s;
}

.btn-gold:active {
    transform: translateY(3px);
    box-shadow: 0 0 0 #5e4618, inset 0 0 5px rgba(0, 0, 0, 0.5);
}

.bet-input {
    background: #000;
    color: #fff;
    border: 1px solid #8a6e2f;
    padding: 8px 5px;
    border-radius: 5px;
    width: 80px;
    text-align: center;
    font-weight: bold;
    font-size: 1rem;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.8);
    height: auto;
    /* Let padding define height to match buttons */
    /* Remove arrows in some browsers */
    -moz-appearance: textfield;
}

.bet-input::-webkit-outer-spin-button,
.bet-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* SPIN BUTTON - The Big One */
.spin-button-container {
    position: relative;
    display: flex;
    gap: 15px;
    align-items: center;
}

.btn-auto {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #a64dff, #5700b3);
    border: 3px solid #330066;
    color: #fff;
    font-size: 0.7rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 5px rgba(0, 0, 0, 0.4);
    transition: all 0.1s;
    line-height: 1.1;
}

.btn-auto:active {
    transform: scale(0.95);
}

.btn-auto:disabled {
    background: #444;
    border-color: #222;
    cursor: not-allowed;
}

.spin-button {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #4aff80, #009933);
    border: 4px solid #004d1a;
    color: #fff;
    font-size: 1rem;
    font-weight: 900;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    cursor: pointer;
    box-shadow:
        0 5px 0 #003311,
        0 10px 10px rgba(0, 0, 0, 0.4),
        0 0 20px rgba(74, 255, 128, 0.4);
    /* Glow */
    transition: all 0.1s;
    text-transform: uppercase;
}

.spin-button:active:not(:disabled) {
    transform: translateY(5px);
    box-shadow: 0 0 0 #003311, inset 0 0 10px rgba(0, 0, 0, 0.5);
}

.spin-button:disabled {
    background: #333;
    border-color: #111;
    color: #777;
    box-shadow: none;
    transform: translateY(5px);
}

/* WIN ALERT */
/* WIN DISPLAY - EPIC STYLE */
.win-display {
    margin-top: 20px;
    min-height: 80px;
    height: auto;
    display: flex;
    justify-content: center;
    align-items: center;

    font-family: 'Roboto', sans-serif;
    font-weight: 900;
    font-size: 2.5rem;
    text-transform: uppercase;

    /* Simulate gold border with text-stroke/shadow */
    color: #ffd700;
    /* Gold Inner */
    -webkit-text-stroke: 2px #d60000;
    /* Red Border */
    text-shadow:
        0 0 10px rgba(214, 0, 0, 0.8),
        /* Red Glow */
        3px 3px 0px #8b0000;
    /* 3D depth */

    animation: pulseText 0.8s infinite alternate;
}

@keyframes pulseText {
    from {
        transform: scale(1);
        filter: drop-shadow(0 0 5px gold);
    }

    to {
        transform: scale(1.1);
        filter: drop-shadow(0 0 20px gold);
    }
}

/* Winner Cell Highlight */
.winner-cell {
    position: relative;
    z-index: 20;
}

.winner-cell::before {
    content: '';
    position: absolute;
    top: 5px;
    left: 5px;
    right: 5px;
    bottom: 5px;
    border: 3px solid #fff;
    border-radius: 10px;
    box-shadow: 0 0 20px #ffcc00, inset 0 0 20px #ffcc00;
    animation: pulseBorder 0.5s infinite alternate;
}

@keyframes pulseBorder {
    from {
        opacity: 0.5;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1.05);
    }
}

/* LOG DASHBOARD - FORTUNE STYLE */
.log-container {
    margin-top: 30px;
    background: linear-gradient(to bottom, #4a0e0e, #2a0505);
    border: 4px solid #d4af37;
    border-radius: 15px;
    padding: 15px;
    color: #fff;
    text-align: left;
    font-family: 'Courier New', monospace;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    box-shadow:
        0 0 0 4px #8b0000,
        /* Red outer rim */
        0 10px 20px rgba(0, 0, 0, 0.6);
    position: relative;
}

/* Header as a "Scroll" */
.log-container h3 {
    margin: -35px auto 15px auto;
    /* Pull up to overlap border */
    background: linear-gradient(to bottom, #fceabba0, #fbdf93);
    color: #3e0000;
    width: 250px;
    text-align: center;
    padding: 10px;
    border-radius: 5px;
    font-family: 'Roboto', serif;
    font-weight: 900;
    font-size: 1.1rem;
    text-transform: uppercase;
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.4);
    border: 2px solid #b8860b;
    position: relative;
    z-index: 20;
}

/* Scroll Ends simulation */
.log-container h3::before,
.log-container h3::after {
    content: '';
    position: absolute;
    top: 5px;
    width: 20px;
    height: 30px;
    background: #d4af37;
    border-radius: 3px;
    border: 1px solid #5e4618;
    z-index: -1;
}

.log-container h3::before {
    left: -10px;
}

.log-container h3::after {
    right: -10px;
}

.log-scroll {
    max-height: 250px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #ffd700 #2a0505;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 5px;
    padding: 5px;
}

.log-scroll::-webkit-scrollbar {
    width: 10px;
}

.log-scroll::-webkit-scrollbar-track {
    background: #2a0505;
    border-radius: 5px;
}

.log-scroll::-webkit-scrollbar-thumb {
    background-color: #ffd700;
    border-radius: 5px;
    border: 2px solid #2a0505;
}

#log-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 5px;
    /* Spacing between rows */
    font-size: 0.9rem;
}

#log-table th {
    color: #ffd700;
    /* Gold Headers */
    font-weight: bold;
    text-transform: uppercase;
    padding: 10px 5px;
    border-bottom: 2px solid #8b0000;
    background: #4a0e0e;
    /* Solid background to hide scrolling content */
    position: sticky;
    top: 0;
    z-index: 10;
    text-shadow: 1px 1px 0 #000;
}

#log-table td {
    padding: 8px 5px;
    text-align: center;
    background: rgba(0, 0, 0, 0.3);
    /* Dark row background */
    border-bottom: 1px solid #4a0e0e;
    color: #fff;
    font-weight: 500;
}

/* First column styling (index) */
#log-table td:first-child {
    color: #aaa;
    font-size: 0.8rem;
}

.log-win {
    color: #00ff00 !important;
    font-weight: bold;
    text-shadow: 0 0 5px rgba(0, 255, 0, 0.5);
}

.log-loss {
    color: #ffd700;
    /* Show 0.00 as Gold/Yellow usually, or grey? Image shows 0.00 as Yellow */
    opacity: 0.8;
}

@media (max-width: 600px) {
    .casino-container {
        width: 100%;
        padding: 5px;
        min-height: 100vh;
        display: flex;
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    .game-logo {
        max-width: 50%;
        /* Further reduced for mobile */
        margin: 10px auto -20px auto;
        /* Adjust margin */
    }

    .slot-machine {
        width: 98%;
        padding: 5px;
        border-width: 4px;
        /* Thinner border */
        border-radius: 20px;
        box-sizing: border-box;
    }

    .reels-container {
        gap: 5px;
        padding: 5px;
        background: rgba(0, 0, 0, 0.8);
    }

    /* FIX REELS: Make them proportional */
    .reel-cell {
        height: 60px;
        /* Reduced fixed height further */
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .reel-cell img {
        width: 100%;
        /* Fill width */
        max-height: 100%;
        /* limit height */
        object-fit: contain;
    }

    /* CONTROLS REFACTOR */
    .control-panel {
        flex-direction: column;
        gap: 15px;
        padding: 10px;
        background: #222;
        border-radius: 15px;
        margin-top: 10px;
        width: 100%;
        box-sizing: border-box;
    }

    .controls-panel {
        background: linear-gradient(to bottom, #4a0e0e, #2a0505);
        /* Fortune Style */
        margin-top: 10px;
        padding: 10px;
        border-radius: 10px;
        border: 2px solid #d4af37;
        box-shadow: 0 5px 10px rgba(0, 0, 0, 0.5);
        display: flex;
        justify-content: center;
        align-items: center;
        /* Changed from stretch to center for compactness */
        position: relative;
        flex-wrap: wrap;
    }



    /* Row 1: Saldo */
    .display-box {
        width: 100%;
        text-align: center;
        box-sizing: border-box;
        margin-bottom: 13px;
    }

    /* Row 2: Bet Controls */
    .bet-control {
        width: 100%;
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 10px;
        margin-bottom: 10px;
    }

    .bet-control .display-label {
        display: none !important;
        /* Hide 'APOSTA' label to save space/clean up */
    }

    /* Row 3: Buttons */
    .spin-button-container {
        width: 100%;
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 10px;
        flex-wrap: wrap;
        /* Allow wrapping if needed */
    }

    /* Make buttons smaller */
    .btn-auto {
        width: 50px;
        height: 50px;
        font-size: 0.7rem;
        padding: 0;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .spin-button {
        width: 80px;
        height: 80px;
        font-size: 1rem;
    }

    .win-display {
        font-size: 2rem;
        min-height: 50px;
        margin-top: 10px;
    }

    .log-container {
        width: 100%;
        box-sizing: border-box;
    }
}

/* FLOATING WIN ANIMATION */
.floating-win-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Titan One', cursive;
    /* Match the new font if available, or Roboto */
    font-size: 4rem;
    color: #00ff00;
    /* Bright Green */
    -webkit-text-stroke: 2px #003300;
    text-shadow: 0 0 20px rgba(0, 255, 0, 0.8);
    pointer-events: none;
    z-index: 100;
    opacity: 0;
    animation: floatUpFade 2s ease-out forwards;
}

@media (max-width: 600px) {
    .floating-win-text {
        font-size: 2.5rem;
    }
}

@keyframes floatUpFade {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }

    20% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.2);
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -150%) scale(1);
    }
}

/* BIG WIN OVERLAY (THE "MALDADE" VISUAL) */
.big-win-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(50, 0, 50, 0.9) 0%, rgba(0, 0, 0, 0.95) 100%);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s;
    overflow: hidden;
}

.big-win-pig {
    width: 300px;
    /* Adjust size as needed */
    height: auto;
    filter: drop-shadow(0 0 30px rgba(255, 215, 0, 0.5));
    animation: pigBounce 0.6s infinite alternate cubic-bezier(0.5, 0.05, 0.1, 0.3);
    margin-bottom: 20px;
}

.big-win-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 2;
}

.big-win-label {
    font-family: 'Titan One', cursive;
    color: #fff;
    font-size: 2.5rem;
    text-transform: uppercase;
    margin-bottom: 10px;
    letter-spacing: 2px;
    text-shadow: 0 0 10px #ff00de;
}

.big-win-amount {
    font-family: 'Titan One', cursive;
    font-size: 5rem;
    color: #ffd700;
    text-shadow:
        0 5px 0 #b8860b,
        0 0 20px rgba(255, 215, 0, 0.8),
        0 0 50px rgba(255, 0, 200, 0.4);
    /* Pink glow */
    background: linear-gradient(to bottom, #fff7cc 0%, #ffd700 50%, #b8860b 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.5));
    transform: scale(1);
    animation: pulseAmount 0.3s infinite alternate;
}

@keyframes pigBounce {
    from {
        transform: translateY(0) scale(1) rotate(-5deg);
    }

    to {
        transform: translateY(-20px) scale(1.05) rotate(5deg);
    }
}

@keyframes pulseAmount {
    from {
        transform: scale(1);
    }

    to {
        transform: scale(1.1);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@media (max-width: 600px) {
    .floating-win-text {
        font-size: 2.5rem;
    }

    .big-win-pig {
        width: 200px;
    }

    .big-win-amount {
        font-size: 3.5rem;
    }

    .big-win-label {
        font-size: 1.5rem;
    }
}

/* FAKE TREND GRAPH STYLES - FORTUNE STYLE */
.trend-wrapper {
    width: 100%;
    max-width: 600px;
    /* Match others */
    margin: 40px auto 0 auto;
    /* Center */
    /* Space for scroll header */
    background: linear-gradient(to bottom, #4a0e0e, #2a0505);
    border: 4px solid #d4af37;
    border-radius: 15px;
    padding: 20px;
    text-align: center;
    box-shadow:
        0 0 0 4px #8b0000,
        0 10px 20px rgba(0, 0, 0, 0.6);
    position: relative;
}

.trend-title {
    margin: -35px auto 15px auto !important;
    /* Pull up to overlap border */
    background: linear-gradient(to bottom, #fceabba0, #fbdf93);
    color: #3e0000 !important;
    width: 280px;
    text-align: center;
    padding: 10px;
    border-radius: 5px;
    font-family: 'Roboto', serif;
    font-weight: 900;
    font-size: 1.0rem !important;
    text-transform: uppercase;
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.4);
    border: 2px solid #b8860b;
    position: relative;
    z-index: 20;
    display: block;
    /* Ensure block for margins */
}

/* Scroll Ends for Trend Title */
.trend-title::before,
.trend-title::after {
    content: '';
    position: absolute;
    top: 5px;
    width: 20px;
    height: 30px;
    background: #d4af37;
    border-radius: 3px;
    border: 1px solid #5e4618;
    z-index: -1;
}

.trend-title::before {
    left: -10px;
}

.trend-title::after {
    right: -10px;
}

.trend-graph {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 5px;
    overflow-x: auto;
    padding: 10px 5px;
    background: #000;
    border-radius: 4px;
    min-height: 20px;
}

/* Hide scrollbar */
.trend-graph::-webkit-scrollbar {
    display: none;
}

.trend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 0 5px rgba(255, 255, 255, 0.2);
}

.dot-win {
    background: #00ff00;
    box-shadow: 0 0 8px #00ff00;
}

.dot-loss {
    background: #ff0000;
    box-shadow: 0 0 8px #ff0000;
}

.dot-warm {
    background: #ffd700;
    box-shadow: 0 0 8px #ffd700;
}

/* Near Miss / Small Win */

.pulse-dot {
    display: inline-block;
    color: #ff0000;
    animation: flash 1s infinite alternate;
}

@keyframes flash {
    from {
        opacity: 1;
    }

    to {
        opacity: 0.2;
    }
}