:root {
    --primary-color: #f0e68c;
    --secondary-color: #ff6347;
    --bg-color: #1a1a1a;
    --ui-bg: rgba(0, 0, 0, 0.8);
    --text-color: #ffffff;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    /* Prevent scrolling */
    position: relative;
}

.game-wrapper {
    position: absolute;
    top: 50%;
    left: 50%;
    /* Transformation handled by JS (translate + scale) */
    width: 1280px;
    height: 720px;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
    background: #000;
}

.game-logo {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 660px;
    /* Reduced by another ~10% */
    height: auto;
    z-index: 2001;
    /* Above everything (Modals are ~200) */
    filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.8));
    pointer-events: none;
}

.modal-content {
    background: #2c3e50;
    border: 2px solid #ffd700;
    border-radius: 10px;
    padding: 30px;
    width: 95%;
    max-width: 1200px;
    max-height: 55%;
    /* Reduced height significantly to ensure no overlap */
    overflow-y: auto;
    position: relative;
    color: white;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.2);
}

canvas {
    width: 100%;
    height: 100%;
    display: block;
    background: #2c3e50;
    border-radius: 8px;
}

.ui-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9), rgba(0, 0, 0, 0));
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 40px;
    box-sizing: border-box;
    pointer-events: none;
}

.stats-panel {
    display: flex;
    gap: 30px;
    pointer-events: auto;
}

.stat-box {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.label {
    font-size: 0.8rem;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.value {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
}

input[type="number"] {
    background: transparent;
    border: 1px solid #555;
    color: white;
    font-size: 1.2rem;
    width: 80px;
    padding: 5px;
    border-radius: 4px;
    pointer-events: auto;
}

.spin-button {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #ff7f50, #cd3700);
    border: 4px solid #fff;
    color: white;
    font-weight: bold;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    transition: transform 0.1s;
    pointer-events: auto;
}

.spin-button:active {
    transform: scale(0.95);
}

.spin-button:disabled {
    filter: grayscale(1);
    cursor: not-allowed;
}

/* Turbo Button Styles */
.controls-panel {
    display: flex;
    align-items: center;
    gap: 20px;
    pointer-events: auto;
}

.stake-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(180deg, #ffd700, #b8860b);
    border: 3px solid #000;
    color: #000;
    font-size: 2rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.stake-btn:hover {
    background: linear-gradient(180deg, #fffacd, #daa520);
    transform: scale(1.1);
    box-shadow: 0 0 15px #ffd700;
}

.stake-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    background: #ccc;
    border-color: #555;
}

.control-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(180deg, #ffd700, #b8860b);
    /* Gold Gradient */
    border: 3px solid #000;
    /* Black Border */
    color: #000;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.5);
    /* Black Shadow */
    font-weight: bold;
}

.control-button.active {
    background: linear-gradient(180deg, #daa520, #b8860b);
    box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.5);
    border-color: #fff;
    color: #fff;
}

.control-button:hover {
    background: linear-gradient(180deg, #fffacd, #daa520);
    transform: scale(1.1);
    box-shadow: 0 0 15px #ffd700;
}

.control-button.active:hover {
    background: linear-gradient(180deg, #b8860b, #daa520);
}

/* New Top-Right Free Spins Display */
#free-spins-display {
    position: absolute;
    top: 100px;
    /* Below Help/Volume buttons */
    right: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(0, 0, 0, 0.5);
    /* Semi-transparent bg for readability */
    padding: 10px;
    border-radius: 10px;
    border: 2px solid #FFD700;
    z-index: 100;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.3);
    pointer-events: none;
    animation: pulseGlow 2s infinite;
}

.fs-label {
    font-size: 1rem;
    font-weight: bold;
    color: #FFD700;
    margin-bottom: 5px;
    text-shadow: 1px 1px 2px black;
}

.fs-count {
    font-size: 2.5rem;
    font-weight: 900;
    color: #fff;
    text-shadow: 0 0 10px #FFD700;
    line-height: 1;
}

@keyframes pulseGlow {
    0% {
        box-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
    }

    50% {
        box-shadow: 0 0 20px rgba(255, 215, 0, 0.6);
    }

    100% {
        box-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
    }
}

/* Bonus UI */
#bonus-indicator {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: auto;
    height: 100px;
    box-sizing: border-box;
    /* Ensure padding doesn't increase height */
    padding-top: 25px;
    /* Push content down safely */

    display: flex;
    flex-direction: row;
    align-items: flex-start;
    /* Start from the padded top */
    justify-content: center;
    gap: 50px;

    font-size: 2rem;
    font-weight: bold;
    color: red;
    /* Kept from original, maybe override? */
    text-shadow: 2px 2px 4px black;
    z-index: 55;
    pointer-events: none;
    white-space: nowrap;
}

#bonus-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    display: flex;
    justify-content: center;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

#stats-modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 200;
}

/* Clear .floating-stats if it's no longer needed for other things, or just leave it empty/generic */
.floating-stats {
    /* Empty or generic styles only */
}

.floating-stats .stat-box {
    align-items: center;
    /* Center text inside */
}

.bonus-stat {
    min-width: 80px;
}

#bonus-message {
    font-size: 4rem;
    font-weight: bold;
    color: gold;
    text-align: center;
    /* Strong black outline */
    -webkit-text-stroke: 3px black;
    /* Plus shadow for depth */
    text-shadow: 0 0 10px #000, 5px 5px 0 #000;
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Dynamic Win Popup */
#win-popup {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 150;
    /* Above game, below bonus overlay/modals */
    pointer-events: none;
    /* Let clicks pass through to dismiss */
    text-align: center;
}

.win-text {
    font-size: 3rem;
    font-weight: 900;
    color: #fff;
    -webkit-text-stroke: 2px black;
    text-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    margin-bottom: 10px;
    opacity: 0;
    animation: slideUpFade 0.3s forwards;
}

.win-amount {
    font-size: 4rem;
    font-weight: 900;
    color: #FFD700;
    -webkit-text-stroke: 3px black;
    text-shadow: 5px 5px 0 #000;
    line-height: 1;
    transform: scale(0.5);
    opacity: 0;
    /* Animation handled by JS for dynamic scaling */
}

@keyframes slideUpFade {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes popIn {
    from {
        transform: scale(0);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Help Modal */
#help-modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    /* Reverted to center */
    padding-top: 0;
    /* Removed padding */
    z-index: 200;
    backdrop-filter: blur(5px);
}

.modal-content {
    background: #2c3e50;
    border: 2px solid #ffd700;
    border-radius: 10px;
    padding: 30px;
    width: 95%;
    max-width: 1200px;
    max-height: 80vh;
    margin: 0;
    position: relative;
    overflow-y: auto;
    color: white;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.2);
    outline: none;
}

/* Specific adjustment for auto-content modals (smaller ones) */
.auto-content {
    max-width: 600px;
    margin: 0 auto;
}

#close-help {
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 40px;
    font-weight: bold;
    color: #f1f1f1;
    cursor: pointer;
    transition: color 0.2s;
}

#close-help:hover {
    color: #ffd700;
}

.paytable-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.paytable-item {
    background: rgba(0, 0, 0, 0.3);
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    border: 1px solid #444;
}

.paytable-item img {
    width: 80px;
    height: 80px;
    object-fit: contain;
    margin-bottom: 10px;
}

.paytable-item h4 {
    margin: 5px 0;
    color: #ffd700;
}

.paytable-item ul {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 0.9rem;
    color: #ccc;
}

.paylines-info {
    margin-top: 30px;
    padding: 20px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    text-align: center;
    font-style: italic;
    color: #ffd700;
}

/* Scrollbar for modal */
.modal-content::-webkit-scrollbar {
    width: 8px;
}

.modal-content::-webkit-scrollbar-track {
    background: #1a1a1a;
}

.modal-content::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 4px;
}

/* Top Right Help Button */
.help-button {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(180deg, #ffd700, #b8860b);
    border: 3px solid #000;
    color: #000;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.5);
    transition: all 0.3s;
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.help-button:hover {
    transform: scale(1.1);
    background: linear-gradient(180deg, #fffacd, #daa520);
    box-shadow: 0 0 15px #ffd700;
}

.volume-button {
    position: absolute;
    top: 20px;
    left: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(180deg, #ffd700, #b8860b);
    border: 3px solid #000;
    color: #000;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.5);
    transition: all 0.3s;
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.volume-button:hover {
    transform: scale(1.1);
    background: linear-gradient(180deg, #fffacd, #daa520);
    box-shadow: 0 0 15px #ffd700;
}



.volume-panel {
    position: absolute;
    top: 20px;
    left: 80px;
    background: rgba(0, 0, 0, 0.9);
    padding: 15px 10px;
    border-radius: 10px;
    border: 2px solid #f5576c;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    z-index: 999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
    height: 150px;
}

.volume-slider {
    writing-mode: bt-lr;
    /* IE */
    -webkit-appearance: slider-vertical;
    /* WebKit */
    width: 8px;
    height: 100px;
    background: linear-gradient(to top, #f5576c, #f093fb);
    border-radius: 5px;
    outline: none;
    cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(245, 87, 108, 0.8);
}

.volume-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    border: none;
    box-shadow: 0 0 10px rgba(245, 87, 108, 0.8);
}

#volume-value {
    color: #fff;
    font-weight: bold;
    font-size: 14px;
}

/* Help Modal Tabs */
.modal-tabs {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
    border-bottom: 1px solid #555;
    padding-bottom: 15px;
}

.tab-btn {
    background: transparent;
    border: 2px solid #555;
    color: #aaa;
    padding: 10px 30px;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    border-radius: 25px;
    transition: all 0.3s;
}

.tab-btn.active {
    background: #ffd700;
    color: #000;
    border-color: #ffd700;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.tab-btn:hover:not(.active) {
    border-color: #ffd700;
    color: #fff;
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Paylines Grid */
.paylines-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    margin-top: 10px;
}

.payline-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid #444;
    border-radius: 8px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.payline-name {
    color: #ffd700;
    font-size: 0.9rem;
    margin-bottom: 10px;
    text-align: center;
}

.mini-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 2px;
    width: 100%;
    aspect-ratio: 5/3;
}

.mini-cell {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.mini-cell.active {
    background: #ffd700;
    /* Default, will be overridden by JS for specific colors */
    box-shadow: 0 0 5px currentColor;
    border-color: transparent;
}

/* Stake Control */
/* Increased size and transparency for Stake Control */
.stake-control {
    display: flex;
    align-items: center;
    background: transparent;
    /* Removed background */
    border: none;
    /* Removed border */
    border-radius: 30px;
    padding: 10px 20px;
    gap: 20px;
    box-shadow: none;
    /* Removed shadow */
}

.stake-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 80px;
}

.stake-display .label {
    font-size: 0.7rem;
    color: #aaa;
    margin-bottom: 2px;
}

.stake-display .value {
    font-size: 1.3rem;
    color: #fff;
    font-weight: bold;
}

/* Side Controls */
.side-controls {
    position: absolute;
    top: 50%;
    right: 30px;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    z-index: 50;
}

.side-controls-left {
    position: absolute;
    top: 50%;
    left: 30px;
    /* Mirrored from right: 30px */
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    z-index: 50;
}

.side-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #f0f0f0;
    border: 3px solid #ccc;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    transition: all 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
}

.side-btn:hover {
    transform: scale(1.1);
    background: #fff;
}

.side-btn.active {
    background: #ffd700;
    border-color: #ff8c00;
    box-shadow: 0 0 15px #ffd700;
}

.side-main-btn {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #ff7f50, #cd3700);
    border: 4px solid #fff;
    color: white;
    font-weight: bold;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    transition: transform 0.1s;
}

.side-main-btn:active {
    transform: scale(0.95);
}

.side-main-btn:disabled {
    filter: grayscale(1);
    cursor: not-allowed;
}

/* Auto Spin & Buy Bonus Modal */
#auto-modal,
#buy-bonus-modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 200;
    backdrop-filter: blur(5px);
}

.auto-content {
    background: #2c3e50;
    border: 2px solid #00ced1;
    border-radius: 10px;
    padding: 30px;
    width: 400px;
    text-align: center;
    position: relative;
    color: white;
    box-shadow: 0 0 20px rgba(0, 206, 209, 0.3);
}

#close-auto {
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 30px;
    font-weight: bold;
    color: #f1f1f1;
    cursor: pointer;
}

#close-auto:hover {
    color: #00ced1;
}

.auto-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-top: 20px;
}

.auto-option {
    background: rgba(0, 206, 209, 0.2);
    border: 1px solid #00ced1;
    color: white;
    padding: 15px;
    font-size: 1.2rem;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s;
}

.auto-option:hover {
    background: #00ced1;
    color: black;
    transform: scale(1.05);
}

/* Make the last option span full width */
.auto-option:last-child {
    grid-column: span 2;
}

/* Buy Bonus Custom Helper */
.bonus-buttons-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-top: 20px;
}

/* Ensure no span-2 for bonus buttons */
.bonus-buttons-grid>button {
    grid-column: span 1;
}

.bonus-btn-option {
    color: white;
    padding: 15px;
    font-size: 1.2rem;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.bonus-btn-option:hover {
    transform: scale(1.05);
    filter: brightness(1.2);
}

/* Difficulty Modal */
#difficulty-modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 200;
    backdrop-filter: blur(5px);
}

#close-difficulty {
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 30px;
    font-weight: bold;
    color: #f1f1f1;
    cursor: pointer;
}

#close-difficulty:hover {
    color: #00ced1;
}

.difficulty-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-top: 20px;
}

.difficulty-option {
    background: rgba(0, 206, 209, 0.2);
    border: 2px solid #00ced1;
    color: white;
    padding: 20px 15px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.difficulty-option:hover {
    background: rgba(0, 206, 209, 0.3);
    transform: scale(1.05);
    border-color: #ffd700;
}

.difficulty-option.active {
    background: rgba(255, 215, 0, 0.2);
    border-color: #ffd700;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.4);
}

.difficulty-title {
    font-size: 1.3rem;
    font-weight: bold;
    color: #ffd700;
}

.difficulty-lines {
    font-size: 1.1rem;
    color: #00ced1;
    font-weight: bold;
}


/* Payline Visualization Controls */
.paylines-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.payline-controls {
    display: flex;
    gap: 10px;
}

.payline-view-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid #00ced1;
    color: #fff;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.payline-view-btn:hover {
    background: rgba(0, 206, 209, 0.2);
    transform: translateY(-2px);
}

.payline-view-btn.active {
    background: #00ced1;
    color: #000;
    font-weight: bold;
    box-shadow: 0 0 10px rgba(0, 206, 209, 0.5);
}

/* Start Screen Overlay */
#start-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #000;
    z-index: 5000;
    /* Highest priority */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 50px;
    transition: opacity 0.5s ease;
}

#start-screen .start-logo {
    width: 800px;
    max-width: 90%;
    height: auto;
    filter: drop-shadow(0 0 50px rgba(255, 215, 0, 0.5));
    animation: pulseLogo 2s infinite ease-in-out;
}

#start-btn {
    padding: 20px 80px;
    font-size: 32px;
    font-weight: bold;
    color: #fff;
    background: linear-gradient(180deg, #ff4500, #8b0000);
    border: 4px solid #ffd700;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 0 30px rgba(255, 69, 0, 0.6);
    transition: transform 0.2s, filter 0.2s;
    font-family: inherit;
    text-transform: uppercase;
    letter-spacing: 2px;
}

#start-btn:hover {
    transform: scale(1.1);
    filter: brightness(1.2);
    box-shadow: 0 0 50px rgba(255, 69, 0, 0.9);
}

@keyframes pulseLogo {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

/* Force ID overrides for control buttons to ensure Gold Style applies */
#turbo-btn,
#auto-btn,
#difficulty-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(180deg, #ffd700, #b8860b);
    border: 3px solid #000;
    color: #000;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
}

#turbo-btn:hover,
#auto-btn:hover,
#difficulty-btn:hover {
    background: linear-gradient(180deg, #fffacd, #daa520);
    transform: scale(1.1);
    box-shadow: 0 0 15px #ffd700;
}

#turbo-btn.active,
#auto-btn.active {
    background: linear-gradient(180deg, #daa520, #b8860b);
    color: #fff;
    border-color: #fff;
    box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.8);
}

/* Difficulty Label and Arrows */
.difficulty-label {
    font-size: 13px;
    font-weight: bold;
    text-align: center;
    margin-top: 5px;
    color: #FFD700;
    /* Default yellow for medium */
    text-shadow: 2px 2px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000;
    /* Black border */
}

.difficulty-label.easy {
    color: #00FF00;
    /* Green */
}

.difficulty-label.medium {
    color: #FFD700;
    /* Yellow/Gold */
}

.difficulty-label.hard {
    color: #FF0000;
    /* Red */
}

.difficulty-arrows {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 6px;
}

.difficulty-arrow {
    background: linear-gradient(145deg, #2a2a2a, #1a1a1a);
    border: 2px solid #000;
    /* Black border */
    color: #FFD700;
    font-size: 16px;
    width: 38px;
    /* Bigger */
    height: 30px;
    /* Bigger */
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
}

.difficulty-arrow:hover {
    background: linear-gradient(145deg, #3a3a3a, #2a2a2a);
    border-color: #FFD700;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
    transform: scale(1.05);
}

.difficulty-arrow:active {
    transform: scale(0.95);
}

/* Help Modal V2 - Square & Tabbed */
#help-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(8px);
}

.square-modal-v2 {
    width: 540px;
    height: 540px;
    background: linear-gradient(135deg, #1f1f1f, #0f0f0f);
    border: 4px solid #FFD700;
    border-radius: 25px;
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.9), 0 0 20px rgba(255, 215, 0, 0.3);
    display: flex;
    flex-direction: column;
    padding: 15px;
    /* Reduced padding slightly */
    position: relative;
    overflow: hidden;
}

#close-help {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 32px;
    color: #666;
    cursor: pointer;
    z-index: 10;
    line-height: 1;
}

#close-help:hover {
    color: #fff;
}

/* Tabs */
.help-nav-tabs {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
    margin-top: 10px;
    border-bottom: 1px solid #333;
    padding-bottom: 15px;
}

.nav-tab {
    background: transparent;
    border: 2px solid #555;
    color: #888;
    padding: 8px 24px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
    font-size: 14px;
    transition: all 0.3s;
}

.nav-tab.active {
    border-color: #FFD700;
    background: rgba(255, 215, 0, 0.1);
    color: #FFD700;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.2);
}

.nav-tab:hover:not(.active) {
    border-color: #999;
    color: #ccc;
}

/* Views */
.help-view {
    display: none;
    flex: 1;
    overflow: hidden;
    position: relative;
    animation: fadeIn 0.3s ease;
}

.help-view.active {
    display: flex;
    flex-direction: column;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Symbols Carousel View */
#symbols-view {
    align-items: center;
    justify-content: center;
    flex-direction: row;
    /* Arrows on sides */
}

.symbol-card {
    flex: 1;
    display: flex;
    flex-direction: row;
    /* Row layout as requested */
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    gap: 10px;
    /* Reduced gap */
    height: 100%;
}

.carousel-arrow {
    background: transparent;
    border: 2px solid #FFD700;
    color: #FFD700;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    user-select: none;
    flex-shrink: 0;
}

.carousel-arrow:hover {
    background: #FFD700;
    color: #000;
    transform: scale(1.1);
}

.carousel-arrow:active {
    transform: scale(0.95);
}

.symbol-left-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    /* Center content */
    width: 40%;
}

.symbol-icon-wrapper {
    width: 100px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 5px;
    /* Glow */
    filter: drop-shadow(0 0 15px rgba(255, 215, 0, 0.4));
}

.help-symbol-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

#help-symbol-name {
    color: #FFD700;
    font-size: 16px;
    /* Smaller */
    margin: 5px 0;
    text-transform: uppercase;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
    text-align: center;
}

.symbol-right-col {
    display: flex;
    flex-direction: column;
    width: 50%;
    /* Narrower */
    justify-content: center;
    /* Move up */
    /* Less offset */
    margin-right: 40px;
    /* More space from arrow */
    /* Space from arrow */
}

.payout-table {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    /* Very subtle bg */
    border-radius: 8px;
    padding: 2px;
    /* Minimal padding */
    margin-bottom: 5px;
    border: 1px solid rgba(255, 215, 0, 0.1);
}

.payout-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 6px;
    /* Tight padding */
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 13px;
    /* Much smaller font */
    /* Reduced font size */
    font-family: 'Segoe UI', sans-serif;
    /* Clean font */
}

.payout-row:last-child {
    border-bottom: none;
}

.payout-label {
    color: #fff;
    font-weight: 900;
}

.payout-val {
    color: #FF69B4;
    /* Pink/HotPink from reference image */
    font-weight: 900;
}

.symbol-desc-text {
    color: #ccc;
    font-size: 13px;
    line-height: 1.4;
    text-align: center;
    margin-top: 5px;
}

.page-dots {
    position: absolute;
    bottom: 15px;
    font-size: 14px;
    color: #555;
    background: #000;
    padding: 4px 12px;
    border-radius: 12px;
    border: 1px solid #333;
}

/* Paylines View (Scrollable) */
#paylines-view {
    overflow-y: auto;
    padding-right: 5px;
    /* space for scrollbar */
    display: none;
    /* toggled by JS */
}

/* When active, override display */
#paylines-view.active {
    display: block;
}

.paylines-grid-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    padding-bottom: 20px;
}

.payline-help-card {
    background: #252525;
    border: 1px solid #444;
    border-radius: 10px;
    padding: 10px;
    text-align: center;
}

.payline-help-num {
    color: #aaa;
    font-size: 14px;
    margin-bottom: 8px;
    font-weight: bold;
}

/* Customize scrollbar inside modal */
#paylines-view::-webkit-scrollbar {
    width: 8px;
}

#paylines-view::-webkit-scrollbar-track {
    background: #111;
}

#paylines-view::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 4px;
}

#paylines-view::-webkit-scrollbar-thumb:hover {
    background: #666;
}

.mini-grid-help {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 2px;
    width: 100px;
    height: 60px;
    margin: 0 auto;
}

.mini-cell-help {
    background: #111;
    border: 1px solid #333;
    border-radius: 2px;
}

.mini-cell-help.active {
    background: #FFD700;
    box-shadow: 0 0 5px #FFD700;
}

/* Stats Modal Styles */
/* Override positioning for Stats Modal specifically if needed, but standard modal-content should work now */
/* Stats Modal Styles (Now inside Help) */
.stats-grid-container {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 5px;
    /* Remove fixed height, let parent scroll */
    width: 100%;
}

.stats-section {
    flex: 1;
    min-width: 250px;
    background: rgba(0, 0, 0, 0.3);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #444;
}

.stats-section.full-width {
    flex: 100%;
}

.stats-section h3 {
    margin-top: 0;
    color: #ffd700;
    border-bottom: 1px solid #555;
    padding-bottom: 10px;
    margin-bottom: 15px;
    font-size: 1.1rem;
    text-transform: uppercase;
}

.stats-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.stats-table th {
    text-align: left;
    color: #aaa;
    padding: 8px;
    border-bottom: 1px solid #555;
}

.stats-table td {
    padding: 8px;
    border-bottom: 1px solid #333;
    color: #fff;
}

.stats-table tr:last-child td {
    border-bottom: none;
}

.stats-table tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* ANTICIPATION / DRAMA MODE */
.reel-container.dimmed-all .reel canvas {
    opacity: 0.3;
    filter: brightness(0.3);
    transition: opacity 0.5s, filter 0.5s;
}

.reel-container.dimmed-all .reel.anticipation canvas {
    opacity: 1;
    filter: brightness(1.2) drop-shadow(0 0 10px white);
    z-index: 10;
    position: relative;
    border: 2px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 0 25px 5px rgba(255, 255, 255, 0.6);
}

/* Updated Difficulty Label */
#difficulty-label {
    font-size: 1.4rem;
    /* Increased size */
    font-weight: bold;
    color: #FFD700;
    text-align: center;
    margin-bottom: 5px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
    width: 100%;
}