/* Main Game Styling */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background: #121212;
    color: #ffffff;
    overflow-x: hidden;
}

.game-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0px;
    display: flex;
    flex-direction: column;
    height: 100vh;
    box-shadow: 0 0 30px rgba(242, 156, 23, 0.2);
    position: relative;
}

.game-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 1px solid;
    border-image-slice: 1;
    border-image-source: linear-gradient(to right, transparent, rgba(242, 156, 23, 0.6), transparent);
    pointer-events: none;
}

/* Top Bar Styling */
.top-bar {
    padding: 15px;
    display: flex;
    justify-content: flex-end;
    background: linear-gradient(to bottom, #000000, #1a1a1a);
    background-image: url('/assets/images/logo.png'), linear-gradient(to bottom, #000000, #000000);
    background-repeat: no-repeat;
    background-position: center center;
    background-size: contain, cover;
    border-radius: 8px 8px 0 0;
    box-shadow: 0 4px 8px -2px rgba(0, 0, 0, 0.5);
    position: relative;
    border-bottom: 3px solid;
    border-image: linear-gradient(to right, transparent, #f29c17, transparent) 1;
}

.balance-container {
    font-size: 1.2em;
    font-weight: bold;
    color: #ffffff;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5), 0 0 10px rgba(242, 156, 23, 0.3);
    background: linear-gradient(to right, rgba(26, 26, 26, 0.7), rgba(26, 26, 26, 0.9));
    padding: 8px 15px;
    border-radius: 30px;
    border: 1px solid rgba(242, 156, 23, 0.3);
}

.controls {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-left: auto;
}

.bet-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(to right, rgba(26, 26, 26, 0.7), rgba(26, 26, 26, 0.9));
    padding: 5px 15px;
    border-radius: 30px;
    border: 1px solid rgba(242, 156, 23, 0.3);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

button {
    background: linear-gradient(to bottom, #f29c17, #e78c07);
    border: none;
    border-radius: 5px;
    color: white;
    font-weight: bold;
    padding: 8px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 3px 5px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.3);
    position: relative;
    overflow: hidden;
}

button:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 40%;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.2), transparent);
    border-radius: 5px 5px 0 0;
}

button:hover {
    background: linear-gradient(to bottom, #a3440e, #933a0c);
    transform: translateY(-2px);
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

button:active {
    transform: translateY(0);
    box-shadow: 0 2px 3px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.control-button {
    width: 40px;
    height: 40px;
    margin-left: 10px;
    border-radius: 5px;
    background: linear-gradient(to bottom, #232323, #1a1a1a);
    color: #f9c324;
    border: 1px solid #f29c17;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.control-button:hover {
    background: linear-gradient(to bottom, #2a2a2a, #232323);
    box-shadow: 0 3px 7px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

#bet-down,
#bet-up {
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

#sound-toggle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    padding: 0;
}

#sound-toggle.sound-off {
    background: linear-gradient(to bottom, #a3440e, #933a0c);
}

#menu-toggle {
    display: none;
    background: linear-gradient(to bottom, #f9c324, #e8b214);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 24px;
    padding: 0;
    align-items: center;
    justify-content: center;
}

/* Canvas Container Styling */
.canvas-container {
    position: relative;
    flex: 1;
    background: url('/assets/images/background.jpg') no-repeat center center;
    background-size: cover;
    border-left: 3px solid;
    border-right: 3px solid;
    border-image: linear-gradient(to right, transparent, #f29c17, transparent) 1;
    overflow: hidden;
    box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.5);
}

canvas {
    width: 100%;
    height: 100%;
    margin: 0 auto;
    opacity: 0.9;
    /* Set to fully opaque */
}

#ui-canvas {
    pointer-events: none;
    opacity: 1;
    /* Keep UI canvas fully opaque for clear text/graphics */
}

/* Bottom Bar Styling */
.bottom-bar {
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(to top, #000000, #1a1a1a);
    border-radius: 0 0 8px 8px;
    box-shadow: 0 -4px 8px -2px rgba(0, 0, 0, 0.5);
    position: relative;
    border-top: 3px solid;
    border-image: linear-gradient(to right, transparent, #f29c17, transparent) 1;
}

.bottom-controls {
    display: flex;
    gap: 20px;
    align-items: center;
    margin-left: 10px;
}

.history-container {
    max-width: 300px;
    overflow-x: auto;
    background: linear-gradient(to right, rgba(26, 26, 26, 0.7), rgba(26, 26, 26, 0.9));
    padding: 10px;
    border-radius: 8px;
    border: 1px solid rgba(242, 156, 23, 0.3);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.history-container h3 {
    margin-bottom: 5px;
    color: #ffffff;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5), 0 0 10px rgba(242, 156, 23, 0.3);
}

#spin-history {
    display: flex;
    gap: 10px;
}

.history-item {
    width: 40px;
    height: 40px;
    background: linear-gradient(to bottom, #4a4a4a, #323232);
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.8em;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.spin-button {
    background: linear-gradient(to bottom, #f29c17, #e78c07);
    padding: 15px 40px;
    font-size: 1.5em;
    border-radius: 30px;
    transition: all 0.3s ease;
    margin-right: 10px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.3),
        0 0 10px rgba(242, 156, 23, 0.5);
}

.spin-button:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.3), transparent);
    border-radius: 30px 30px 0 0;
}

.spin-button:hover {
    background: linear-gradient(to bottom, #a3440e, #933a0c);
    transform: scale(1.05);
    box-shadow: 0 7px 20px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.3),
        0 0 15px rgba(242, 156, 23, 0.7);
}

.spin-button:active {
    transform: scale(0.98);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2),
        0 0 5px rgba(242, 156, 23, 0.5);
}

.spin-button.disabled {
    background: linear-gradient(to bottom, #9e9e9e, #7a7a7a);
    cursor: not-allowed;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* Sidebar Menu Styling */
.sidebar {
    position: fixed;
    top: 0;
    right: -300px;
    width: 300px;
    height: 100%;
    background: linear-gradient(to right, #232323, #1a1a1a);
    transition: all 0.4s ease;
    padding: 20px;
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.7);
    z-index: 1000;
    border-left: 1px solid;
    border-image: linear-gradient(to bottom, transparent, rgba(242, 156, 23, 0.6), transparent) 1 100%;
}

.sidebar.open {
    right: 0;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.8);
}

.sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 5px;
    height: 100%;
    background: linear-gradient(to bottom, transparent, rgba(242, 156, 23, 0.6), transparent);
}

.sidebar-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
}

.sidebar-content::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 20px;
    right: 20px;
    height: 1px;
    background: linear-gradient(to right, transparent, rgba(242, 156, 23, 0.6), transparent);
}

.sidebar-content h2 {
    color: #f29c17;
    margin-bottom: 30px;
    text-align: center;
    font-size: 24px;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.5), 0 0 15px rgba(242, 156, 23, 0.4);
    position: relative;
}

.sidebar-content h2::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 25%;
    width: 50%;
    height: 2px;
    background: linear-gradient(to right, transparent, #f29c17, transparent);
}

.close-sidebar {
    position: absolute;
    top: 10px;
    right: 10px;
    background: transparent;
    color: #f9c324;
    font-size: 24px;
    border: none;
    cursor: pointer;
    box-shadow: none;
    text-shadow: 0 0 10px rgba(242, 156, 23, 0.5);
    transition: all 0.2s ease;
}

.close-sidebar:hover {
    color: #ffffff;
    text-shadow: 0 0 15px rgba(242, 156, 23, 0.8);
    transform: scale(1.1);
}

.sidebar-button {
    width: 100%;
    padding: 12px;
    margin: 8px 0;
    background: linear-gradient(to bottom, #f29c17, #e78c07);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.3);
    position: relative;
    overflow: hidden;
}

.sidebar-button:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 40%;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.2), transparent);
    border-radius: 5px 5px 0 0;
}

.sidebar-button:hover {
    background: linear-gradient(to bottom, #a3440e, #933a0c);
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* Modal Styling */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1001;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
}

.modal.open {
    display: flex;
    animation: modalFadeIn 0.3s ease-out forwards;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-content {
    background: linear-gradient(135deg, #232323, #1a1a1a);
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    border-radius: 10px;
    border: 2px solid;
    border-image: linear-gradient(to right, #a3440e, #f29c17, #a3440e) 1;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 20px rgba(242, 156, 23, 0.3);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: modalContentSlide 0.4s ease-out forwards;
    transform: translateY(20px);
}

@keyframes modalContentSlide {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(to right, #a3440e, #f29c17, #a3440e);
}

.modal-content h2 {
    background: linear-gradient(to right, #f29c17, #a3440e);
    color: white;
    padding: 15px 20px;
    margin: 0;
    font-size: 20px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex-grow: 1;
    background: linear-gradient(to bottom, rgba(26, 26, 26, 0.7), rgba(26, 26, 26, 0.9));
}

.close-modal {
    position: absolute;
    top: 10px;
    right: 10px;
    background: transparent;
    color: white;
    font-size: 24px;
    border: none;
    cursor: pointer;
    box-shadow: none;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    transition: all 0.2s ease;
}

.close-modal:hover {
    transform: scale(1.1);
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.8);
}

/* Spin History Table */
.history-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.history-table th,
.history-table td {
    padding: 12px;
    text-align: center;
}

.history-table th {
    background: linear-gradient(to bottom, #a3440e, #933a0c);
    color: white;
    text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.5);
    position: relative;
}

.history-table th:not(:last-child)::after {
    content: '';
    position: absolute;
    right: 0;
    top: 25%;
    height: 50%;
    width: 1px;
    background: rgba(255, 255, 255, 0.3);
}

.history-table tr:nth-child(even) {
    background: linear-gradient(to right, #2a2a2a, #252525);
}

.history-table tr:nth-child(odd) {
    background: linear-gradient(to right, #212121, #1a1a1a);
}

.history-table tr:hover {
    background: linear-gradient(to right, #333333, #2c2c2c);
}

.history-table .win-amount {
    color: #f9c324;
    font-weight: bold;
    text-shadow: 0 0 8px rgba(249, 195, 36, 0.5);
}

/* Menu Button */
.menu-button {
    background: linear-gradient(to bottom, #f9c324, #e8b214);
    padding: 10px 20px;
    font-size: 1em;
    border-radius: 5px;
}

.menu-button:hover {
    background: linear-gradient(to bottom, #a3440e, #933a0c);
}

/* Responsive Design */
@media (max-width: 768px) {
    .top-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .controls {
        width: 100%;
        justify-content: space-between;
    }

    #menu-toggle {
        display: flex;
    }

    .bet-controls {
        display: none;
    }

    #add-credits {
        display: none;
    }

    .top-bar.expanded .bet-controls,
    .top-bar.expanded #add-credits {
        display: flex;
    }

    .bottom-bar {
        flex-direction: column;
        gap: 15px;
    }

    .menu-button,
    .spin-button {
        width: 100%;
    }
}

/* Animation Classes */
@keyframes spin {
    0% {
        transform: translateY(0);
    }

    100% {
        transform: translateY(-100%);
    }
}

@keyframes winFlash {

    0%,
    100% {
        opacity: 0.6;
        filter: drop-shadow(0 0 5px rgba(249, 195, 36, 0.5));
    }

    50% {
        opacity: 1;
        filter: drop-shadow(0 0 15px rgba(249, 195, 36, 0.8));
    }
}

.win-line {
    animation: winFlash 0.5s infinite;
}

.winning-symbol {
    animation: winFlash 0.5s infinite;
}

@keyframes bigWin {
    0% {
        transform: scale(1);
        opacity: 0;
        filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.2));
    }

    50% {
        transform: scale(1.2);
        opacity: 1;
        filter: drop-shadow(0 0 30px rgba(255, 215, 0, 0.8));
    }

    100% {
        transform: scale(1);
        opacity: 0;
        filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.2));
    }
}

.big-win-text {
    animation: bigWin 2s ease-in-out;
    color: gold;
    font-size: 3em;
    text-align: center;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.9), 0 0 30px rgba(255, 215, 0, 0.5);
    font-weight: bold;
    letter-spacing: 2px;
}