:root {
    --primary-gold: #d4a017;
    --secondary-amber: #b8860b;
    --accent-sand: #f5deb3;
    --dark-bg: #1a0f00;
    --panel-bg: rgba(30, 20, 5, 0.85);
    --text-color: #f5e6c8;
    --reel-bg: #0d0800;
    --reel-border: #5a4220;
    --gold: #ffd700;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Cinzel Decorative', serif;
    background-color: var(--dark-bg);
    color: var(--text-color);
    overflow-x: hidden;
    overflow-y: auto;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background-image: url('assets/background.png');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
}

.background-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, transparent 0%, rgba(10, 5, 0, 0.85) 100%);
    z-index: -1;
}

.game-wrapper {
    width: 100%;
    max-width: 100%;
    height: auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 10px;
    box-sizing: border-box;
    position: relative;
}

.ui-header {
    text-align: center;
    margin-bottom: 10px;
}

.game-title {
    font-size: 1.8rem;
    margin: 0 0 10px 0;
    color: var(--gold);
    text-shadow: 0 0 10px var(--gold), 0 0 20px rgba(255, 215, 0, 0.5), 0 2px 4px rgba(0,0,0,0.8);
    letter-spacing: 2px;
}

.stats-container {
    display: flex;
    justify-content: space-around;
    background: var(--panel-bg);
    padding: 8px;
    border-radius: 10px;
    border: 1px solid var(--secondary-amber);
    box-shadow: 0 0 10px rgba(184, 134, 11, 0.3), inset 0 0 15px rgba(30, 20, 5, 0.5);
    flex-wrap: wrap;
    gap: 5px;
}

.stat-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 80px;
}

.label {
    font-size: 0.6rem;
    color: #a89070;
    margin-bottom: 3px;
    white-space: nowrap;
}

.value {
    font-size: 1rem;
    font-weight: bold;
    color: var(--gold);
    text-shadow: 0 0 5px var(--gold);
}

/* Slot Machine Reels */
.slot-machine {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    margin: 10px 0;
    width: 100%;
}

.reels-container {
    display: flex;
    gap: 3px;
    padding: 8px;
    background: linear-gradient(180deg, #1a1000 0%, #0d0800 50%, #1a1000 100%);
    border-radius: 15px;
    border: 3px solid var(--primary-gold);
    box-shadow: 0 0 20px rgba(212, 160, 23, 0.4), inset 0 0 20px rgba(212, 160, 23, 0.05);
    position: relative;
    overflow: hidden;
}

/* Decorative Egyptian corner ornaments */
.reels-container::before,
.reels-container::after {
    content: '𓋹';
    position: absolute;
    font-size: 16px;
    color: var(--primary-gold);
    opacity: 0.4;
    z-index: 6;
}

.reels-container::before {
    top: 2px;
    left: 6px;
}

.reels-container::after {
    bottom: 2px;
    right: 6px;
}

.reel {
    width: 50px;
    height: 150px;
    background: var(--reel-bg);
    border: 1px solid var(--reel-border);
    border-radius: 5px;
    overflow: hidden;
    position: relative;
}

.reel::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(10, 5, 0, 0.3) 0%, transparent 15%, transparent 85%, rgba(10, 5, 0, 0.3) 100%);
    pointer-events: none;
    z-index: 5;
}

.reel-strip {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    transition: transform 0.1s ease-out;
}

.symbol {
    width: 50px;
    height: 50px;
    background-color: #0d0800;
    background-image: url('assets/symbols.png');
    background-size: 300% 300%;
    background-repeat: no-repeat;
    box-sizing: border-box;
    filter: brightness(1.2);
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.symbol.win-highlight {
    background-color: rgba(255, 215, 0, 0.4);
    box-shadow: inset 0 0 20px var(--gold), 0 0 10px rgba(255, 215, 0, 0.6);
    border-radius: 50%;
    z-index: 2;
}

/* Symbol positions */
.symbol-0 {
    background-position: 0% 0%;
}

.symbol-1 {
    background-position: 50% 0%;
}

.symbol-2 {
    background-position: 100% 0%;
}

.symbol-3 {
    background-position: 0% 50%;
}

.symbol-4 {
    background-position: 50% 50%;
}

.symbol-5 {
    background-position: 100% 50%;
}

.symbol-6 {
    background-position: 0% 100%;
}

.symbol-7 {
    background-position: 50% 100%;
}

.symbol-8 {
    background-position: 100% 100%;
}

/* Paylines Layer */
.paylines-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

.payline-path {
    position: absolute;
    height: 2px;
    background: var(--gold);
    box-shadow: 0 0 5px var(--gold);
    opacity: 0;
    transition: opacity 0.3s;
    transform-origin: left center;
}

.payline-path.active {
    opacity: 1;
    animation: flash 0.5s infinite;
}

/* Controls */
.ui-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 10px;
}

.bet-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    background: var(--panel-bg);
    padding: 8px;
    border-radius: 30px;
    border: 1px solid var(--primary-gold);
}

.control-btn {
    background: transparent;
    border: 1px solid var(--primary-gold);
    color: var(--primary-gold);
    padding: 8px 12px;
    border-radius: 50%;
    font-family: inherit;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.control-btn:hover {
    background: var(--primary-gold);
    color: #1a0f00;
    box-shadow: 0 0 10px var(--primary-gold);
}

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

#btn-max {
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: bold;
    padding: 8px 15px;
}

.bet-label {
    font-size: 0.9rem;
    font-weight: bold;
    color: var(--text-color);
}

.spin-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(180deg, #d4a017 0%, #8B6914 50%, #b8860b 100%);
    border: none;
    border-radius: 50px;
    color: #fff;
    font-family: inherit;
    font-size: 1.5rem;
    font-weight: bold;
    letter-spacing: 3px;
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.7);
    cursor: pointer;
    box-shadow: 0 0 20px rgba(212, 160, 23, 0.5), 0 5px 0 #5a4220;
    transition: all 0.1s;
    position: relative;
    overflow: hidden;
    min-height: 60px;
}

.spin-btn:active {
    transform: translateY(5px);
    box-shadow: 0 0 10px rgba(212, 160, 23, 0.4), 0 0 0 #5a4220;
}

.spin-btn:disabled {
    filter: grayscale(1);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.message-area {
    text-align: center;
    min-height: 25px;
    font-size: 0.9rem;
    color: var(--accent-sand);
    text-transform: uppercase;
    text-shadow: 0 0 5px rgba(245, 222, 179, 0.5);
    padding: 5px;
}

/* Animations */
@keyframes flash {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.win-anim {
    animation: flash 0.5s infinite;
    filter: brightness(1.5);
}

/* ============================================
   RESPONSIVE BREAKPOINTS
   ============================================ */

/* Small Phones: 375px - 599px */
@media (min-width: 375px) {
    .game-title {
        font-size: 2rem;
    }

    .reel,
    .symbol {
        width: 55px;
        height: 55px;
    }

    .reel {
        height: 165px;
    }

    .label {
        font-size: 0.65rem;
    }

    .value {
        font-size: 1.1rem;
    }
}

/* Large Phones: 600px - 767px */
@media (min-width: 600px) {
    .game-wrapper {
        padding: 15px;
        max-width: 600px;
    }

    .game-title {
        font-size: 2.2rem;
    }

    .reel,
    .symbol {
        width: 70px;
        height: 70px;
    }

    .reel {
        height: 210px;
    }

    .reels-container {
        gap: 5px;
        padding: 10px;
    }

    .value {
        font-size: 1.2rem;
    }

    .label {
        font-size: 0.7rem;
    }

    .spin-btn {
        font-size: 1.8rem;
        padding: 18px;
    }
}

/* Tablets Portrait: 768px+ - FLEXIBLE SCALING */
@media (min-width: 768px) {
    body {
        padding: 2vh 2vw;
    }

    .game-wrapper {
        width: min(90vmin, 700px);
        max-height: 90vh;
        padding: 2vmin;
        border: 2px solid var(--primary-gold);
        border-radius: 20px;
        background: rgba(20, 12, 0, 0.6);
        box-shadow: 0 0 50px rgba(212, 160, 23, 0.15);
        margin: auto;
        justify-content: space-between;
    }

    .game-title {
        font-size: clamp(1.5rem, 4vmin, 3rem);
        margin-bottom: 1.5vmin;
    }

    .reels-container {
        padding: 1.5vmin;
        gap: 1vmin;
    }

    .reel,
    .symbol {
        width: clamp(60px, 12vmin, 100px);
        height: clamp(60px, 12vmin, 100px);
    }

    .reel {
        height: clamp(180px, 36vmin, 300px);
    }

    .stats-container {
        padding: 1.5vmin;
    }

    .value {
        font-size: clamp(1rem, 2vmin, 1.5rem);
    }

    .label {
        font-size: clamp(0.6rem, 1.2vmin, 0.9rem);
    }

    .ui-controls {
        flex-direction: row;
        justify-content: space-between;
        gap: 2vmin;
    }

    .bet-controls {
        width: 48%;
        padding: 1.5vmin;
    }

    .spin-btn {
        width: 48%;
        font-size: clamp(1.2rem, 3vmin, 2rem);
        padding: 1.5vmin;
    }

    .control-btn {
        font-size: clamp(0.9rem, 2vmin, 1.3rem);
        padding: 1.5vmin 2vmin;
    }

    .bet-label {
        font-size: clamp(0.8rem, 1.5vmin, 1.1rem);
    }

    .message-area {
        font-size: clamp(0.8rem, 2vmin, 1.2rem);
    }
}

/* Large Desktop: 1024px+ */
@media (min-width: 1024px) {
    .game-wrapper {
        width: min(85vmin, 800px);
    }

    .reel,
    .symbol {
        width: clamp(70px, 11vmin, 110px);
        height: clamp(70px, 11vmin, 110px);
    }

    .reel {
        height: clamp(210px, 33vmin, 330px);
    }
}

/* Extra Large Desktop: 1440px+ */
@media (min-width: 1440px) {
    .game-wrapper {
        width: min(80vmin, 900px);
    }
}