body {
    background-color: #000000;
    color: white;
    font-family: 'Roboto Condensed', sans-serif;
    margin: 0;
    position: relative;
    overflow-x: hidden;
    min-height: 100vh;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, rgba(255, 215, 0, 0.08), transparent 70%);
    pointer-events: none;
    z-index: -1;
}

.container {
    text-align: center;
    max-width: 100%;
    padding: 1vmin;
    margin: 0 auto;
    box-sizing: border-box;
    background-color: black;
}

h1 {
    font-size: clamp(2.5rem, 6vw, 3.5rem);
    margin: 1vmin 0;
    color: #ffd700;
    text-shadow: 0.2vmin 0.2vmin 0.4vmin rgba(184, 134, 11, 0.8);
    font-weight: 700;
}

.mode-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5vmin;
    margin: 1vmin 0;
}

.mode-btn {
    background-color: #2e2e2e;
    color: white;
    border: 1px solid #b8860b;
    padding: 0.8vmin 1.5vmin;
    font-size: clamp(0.9rem, 2.5vw, 1.1rem);
    font-weight: 600;
    cursor: pointer;
    border-radius: 5px;
    transition: background-color 0.3s, transform 0.1s, box-shadow 0.3s;
    flex: 1 1 auto;
    max-width: 120px;
}

.mode-btn:hover {
    background-color: #8b0000;
    box-shadow: 0 0 1vmin rgba(184, 134, 11, 0.5);
    transform: scale(1.05);
}

.mode-btn.active {
    background: linear-gradient(45deg, #b8860b, #ffd700);
    color: black;
    font-weight: bold;
    box-shadow: 0 0 1.5vmin rgba(184, 134, 11, 0.7);
}

#gameCanvas {
    background: radial-gradient(circle at center, #4A2C2A 0%, #4A2C2A 70%, #3B1F1D 100%);
    border: 0.5vmin solid #b8860b;
    border-radius: 10px;
    margin: 0.5vmin auto; /* Reduced margin */
    box-shadow: inset 0 0 1vmin rgba(0, 0, 0, 0.5), 0 0 2vmin rgba(184, 134, 11, 0.3);
    position: relative;
    transition: background-image 0.5s ease;
    background-size: cover;
    width: 100%;
    max-width: 1200px;
    height: 70vh; /* Increased to fill more space */
    min-height: 400px;
    display: block;
}

#gameCanvas::before {
    content: '';
    position: absolute;
    bottom: 1vmin;
    left: 50%;
    transform: translateX(-50%);
    width: 6vmin;
    height: 6vmin;
    border: 0.3vmin solid #ffffff;
    border-radius: 50%;
    background: transparent;
    box-shadow: 0 0 1vmin rgba(255, 255, 255, 0.5);
}

#gameCanvas::after {
    content: '';
    position: absolute;
    top: 35%;
    left: 15%;
    width: 70%;
    height: 35%;
    border: 0.2vmin dashed #b8860b;
    border-radius: 5px;
    background: transparent;
}

#jackpotDisplay {
    position: absolute;
    top: 0.5vmin;
    right: 0.5vmin;
    color: gold;
    font-size: clamp(1rem, 3vw, 1.4rem);
    text-shadow: 0.2vmin 0.2vmin 0.4vmin black;
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: 18vmin;
    background-color: #2e2e2e;
    color: white;
    text-align: center;
    border-radius: 5px;
    padding: 0.8vmin;
    position: absolute;
    z-index: 100;
    top: 100%;
    right: 0;
    margin-top: 0.5vmin;
    border: 1px solid #b8860b;
    font-size: clamp(0.7rem, 2vw, 0.9rem);
    opacity: 0;
    transition: opacity 0.3s;
}

.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

#message {
    font-size: clamp(1rem, 3vw, 1.4rem);
    margin: 0.5vmin 0;
    min-height: 2.5vmin;
    color: #d3d3d3;
    text-shadow: 0.3vmin 0.3vmin 0.6vmin rgba(184, 134, 11, 0.8);
    font-weight: 600;
}

#betAmount, #balance {
    font-size: clamp(1rem, 3vw, 1.4rem);
    margin: 0.5vmin 0;
    display: block;
    visibility: visible;
    z-index: 20;
    color: #d4af37;
    text-shadow: 0.1vmin 0.1vmin 0.3vmin rgba(184, 134, 11, 0.7);
}

#betandbalance {
    margin-bottom:0
}

#chip-stack {
    position: relative;
    height: 4vmin;
    margin: 0.5vmin 0;
    margin-top:0
}

.chip {
    width: 3.5vmin;
    height: 3.5vmin;
    border-radius: 50%;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    line-height: 3.5vmin;
    color: white;
    font-weight: bold;
    box-shadow: 0 0.3vmin 0.8vmin rgba(0, 0, 0, 0.6);
    border: 0.2vmin solid #ffffff;
    font-size: clamp(0.7rem, 2vw, 0.9rem);
}

.chip-5 { background-color: #ff4040; }
.chip-10 { background-color: #000000; }
.chip-25 { background-color: #00ff00; }
.chip-50 { background-color: #ffffff; }
.chip-100 { background-color: #8b0000; }
.chip-500 { background-color: #b8860b; }
.chip-1000 { background-color: #00ced1; }

.chip-drop {
    animation: drop 0.5s ease-out forwards;
}

@keyframes drop {
    from { top: -4vmin; }
    to { top: 0; }
}

.controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5vmin;
    margin: 0.5vmin 0;
}

.controls button {
    background-color: #b8860b;
    color: #000000;
    border: 1px solid #b8860b;
    padding: 0.8vmin 1.5vmin;
    font-size: clamp(0.9rem, 2.5vw, 1.1rem);
    font-weight: 600;
    cursor: pointer;
    border-radius: 5px;
    transition: background-color 0.3s, box-shadow 0.3s;
    flex: 1 1 auto;
    max-width: 100px;
    touch-action: manipulation;
}

.controls button:hover {
    background-color: #ffd700;
    box-shadow: 0 0 1vmin rgba(184, 134, 11, 0.7);
}

.chip-controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5vmin;
    margin: 0.5vmin 0;
}

.chip-btn {
    padding: 0.6vmin 1.2vmin;
    font-size: clamp(0.7rem, 2vw, 0.9rem);
    font-weight: 600;
    cursor: pointer;
    border-radius: 5px;
    transition: background-color 0.3s, box-shadow 0.3s;
    flex: 1 1 auto;
    max-width: 80px;
    touch-action: manipulation;
}

.chip-btn[data-amount="5"], .chip-btn[data-amount="-5"] {
    background-color: #ff4040;
    color: white;
    border: 1px solid #b8860b;
}

.chip-btn[data-amount="5"]:hover, .chip-btn[data-amount="-5"]:hover {
    background-color: #ff6666;
    box-shadow: 0 0 1vmin rgba(184, 134, 11, 0.5);
}

.chip-btn[data-amount="10"], .chip-btn[data-amount="-10"] {
    background-color: #000000;
    color: white;
    border: 1px solid #cccccc;
}

.chip-btn[data-amount="10"]:hover, .chip-btn[data-amount="-10"]:hover {
    background-color: #333333;
    box-shadow: 0 0 1vmin rgba(184, 134, 11, 0.5);
}

.chip-btn[data-amount="25"], .chip-btn[data-amount="-25"] {
    background-color: #00ff00;
    color: #000000;
    border: 1px solid #b8860b;
}

.chip-btn[data-amount="25"]:hover, .chip-btn[data-amount="-25"]:hover {
    background-color: #66ff66;
    box-shadow: 0 0 1vmin rgba(184, 134, 11, 0.5);
}

.chip-btn[data-amount="100"], .chip-btn[data-amount="-100"] {
    background-color: #8b0000;
    color: white;
    border: 1px solid #b8860b;
}

.chip-btn[data-amount="100"]:hover, .chip-btn[data-amount="-100"]:hover {
    background-color: #b22222;
    box-shadow: 0 0 1vmin rgba(184, 134, 11, 0.5);
}

#tournamentTableContainer {
    margin: 0.5vmin auto;
    max-width: 95%;
}

#tournamentTable {
    width: 100%;
    border-collapse: collapse;
    background-color: #333;
    color: white;
    border: 1px solid #b8860b;
    font-size: clamp(0.7rem, 2vw, 0.9rem);
}

#tournamentTable th, #tournamentTable td {
    border: 1px solid #555;
    padding: 0.6vmin;
    text-align: center;
}

#tournamentTable th {
    background-color: #444;
}

.hidden {
    display: none !important;
}

.glow {
    animation: glow 1s infinite alternate;
}

@keyframes glow {
    from { box-shadow: 0 0 1vmin #ffd700; }
    to { box-shadow: 0 0 2vmin #b8860b; }
}

.shake {
    animation: shake 0.5s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-0.5vmin); }
    75% { transform: translateX(0.5vmin); }
}

.balance-error {
    color: #ff4040 !important;
    font-weight: bold;
    border: 0.2vmin solid #ff4040;
    padding: 0.5vmin;
    display: inline-block;
    text-shadow: none;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background-color: #2e2e2e;
    color: white;
    padding: 1.5vmin;
    border-radius: 10px;
    max-width: 95vw;
    width: 95%;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 0 2vmin rgba(184, 134, 11, 0.6);
    border: 1px solid #b8860b;
}

.modal-content h2 {
    margin-top: 0;
    font-size: clamp(1.5rem, 4vw, 1.8rem);
    text-align: center;
    text-shadow: 0.2vmin 0.2vmin 0.4vmin rgba(184, 134, 11, 0.8);
    font-weight: 700;
}

.modal-content p, .modal-content ul {
    font-size: clamp(0.8rem, 2.5vw, 1rem);
    line-height: 1.5;
    font-weight: 500;
}

.modal-content ul {
    padding-left: 1.5vmin;
}

.modal-close-btn {
    background-color: #b8860b;
    color: #000000;
    border: 1px solid #b8860b;
    padding: 0.8vmin 1.5vmin;
    font-size: clamp(0.8rem, 2.5vw, 1rem);
    font-weight: 600;
    cursor: pointer;
    border-radius: 5px;
    display: block;
    margin: 1vmin auto 0;
    transition: background-color 0.3s, box-shadow 0.3s;
}

.modal-close-btn:hover {
    background-color: #ffd700;
    box-shadow: 0 0 1vmin rgba(184, 134, 11, 0.7);
}

.back-btn {
    position: absolute;
    top: 0.5vmin;
    left: 0.5vmin;
    background-color: #22d3ee;
    color: #000000;
    padding: 0.5vmin 1vmin;
    border-radius: 5px;
    text-decoration: none;
    font-size: clamp(0.7rem, 2vw, 0.9rem);
    transition: background-color 0.3s;
}

.back-btn:hover {
    background-color: #67e8f9;
}

@media (max-width: 600px) {
    #gameCanvas {
        height: 75vh; /* Increased for mobile */
        min-height: 350px;
    }

    .mode-btn, .controls button, .chip-btn {
        padding: 0.6vmin 1vmin;
        font-size: clamp(0.7rem, 2vw, 0.9rem);
        max-width: 90px;
    }

    #gameCanvas::before, #gameCanvas::after {
        display: none;
    }

    .modal-content {
        padding: 1vmin;
        max-width: 98vw;
    }

    .chip {
        width: 3vmin;
        height: 3vmin;
        line-height: 3vmin;
        font-size: clamp(0.6rem, 1.8vw, 0.8rem);
    }
}