* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #fff;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
}

.game-container {
    max-width: 1400px;
    width: 100%;
    text-align: center;
    padding: 1.5rem;
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
    color: #ffd700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

.game-info {
    display: flex;
    justify-content: space-around;
    margin-bottom: 1.5rem;
    background: rgba(255, 255, 255, 0.1);
    padding: 1.25rem;
    border-radius: 15px;
    backdrop-filter: blur(10px);
}

.current-offer, .player-case, .cases-counter {
    padding: 0.5rem;
}

.current-offer h2, .player-case h2, .cases-counter h2 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.offer-amount, .case-number, .counter {
    font-size: 1.5rem;
    font-weight: bold;
}

.counter {
    color: #e74c3c;
}

.cases-grid {
    display: grid;
    grid-template-columns: repeat(13, 1fr);
    gap: 1.25rem;
    margin: 2.5rem auto;
    max-width: 1400px;
    padding: 0 1.5rem;
}

.case {
    background: #2c3e50;
    border: 4px solid #3498db;
    border-radius: 12px;
    padding: 1.25rem;
    cursor: pointer;
    transition: all 0.3s ease;
    aspect-ratio: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
    font-weight: bold;
    position: relative;
    min-width: 80px;
    min-height: 80px;
    overflow: hidden;
}

.case .case-number {
    font-size: 1.1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    padding: 0 0.25rem;
}

.case:hover {
    transform: scale(1.05);
    box-shadow: 0 0 10px rgba(52, 152, 219, 0.5);
}

.case.opened {
    background: #34495e;
    border-color: #95a5a6;
    cursor: not-allowed;
    color: #95a5a6;
}

.case.selected {
    background: #27ae60;
    border-color: #2ecc71;
    box-shadow: 0 0 10px rgba(46, 204, 113, 0.5);
}

.case.selected:hover {
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(46, 204, 113, 0.7);
}

.case.opened::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 3px;
}

/* Add new styles for selected and opened case */
.case.selected.opened {
    background: #27ae60;
    border-color: #2ecc71;
    color: #fff;
    box-shadow: 0 0 15px rgba(46, 204, 113, 0.7);
}

.case.selected.opened::after {
    background: rgba(46, 204, 113, 0.2);
}

.case.selected::after {
    content: 'YOURS';
    position: absolute;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.6rem;
    color: #2ecc71;
    text-shadow: 0 0 5px rgba(46, 204, 113, 0.5);
}

.game-controls {
    display: none;
    justify-content: center;
    gap: 1rem;
    margin: 2rem 0 1rem 0;
}

.btn {
    padding: 0.75rem 1.5rem;
    font-size: 1.1rem;
    font-weight: bold;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    opacity: 0.7;
}

.btn.active {
    opacity: 1;
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.3);
}

.deal {
    background: #4CAF50;
    color: white;
}

.deal.active {
    box-shadow: 0 0 15px rgba(76, 175, 80, 0.5);
}

.no-deal {
    background: #e74c3c;
    color: white;
}

.no-deal.active {
    box-shadow: 0 0 15px rgba(231, 76, 60, 0.5);
}

.btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
}

.game-message {
    font-size: 1.2rem;
    margin-top: 1rem;
    min-height: 1.8rem;
}

.game-content {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
}

.game-main {
    flex: 1;
}

.prize-list {
    width: 320px;
    background: rgba(255, 255, 255, 0.1);
    padding: 1rem;
    border-radius: 12px;
    backdrop-filter: blur(10px);
}

.prize-list h2 {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    color: #ffd700;
}

.prizes-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

.prize-item {
    background: #2c3e50;
    border: 2px solid #3498db;
    border-radius: 6px;
    padding: 0.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
}

.prize-item.unopened {
    background: #27ae60;
    border-color: #2ecc71;
    box-shadow: 0 0 10px rgba(46, 204, 113, 0.3);
}

.prize-item.opened {
    background: #34495e;
    border-color: #95a5a6;
    color: #95a5a6;
}

.prize-value {
    font-weight: bold;
    font-size: 0.9rem;
    text-align: center;
}

.prize-status {
    font-size: 0.7rem;
    padding: 0.15rem 0.35rem;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.1);
    text-align: center;
}

@media (max-width: 1200px) {
    .game-content {
        flex-direction: column;
    }

    .prize-list {
        width: 100%;
        margin-top: 1.5rem;
    }

    .prizes-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
}

@media (max-width: 768px) {
    .game-info {
        flex-direction: column;
        gap: 1rem;
    }

    .cases-grid {
        grid-template-columns: repeat(6, 1fr);
        gap: 1rem;
        padding: 0 0.75rem;
    }

    .case {
        font-size: 1rem;
        padding: 0.75rem;
        min-width: 60px;
        min-height: 60px;
    }

    .case .case-number {
        font-size: 0.9rem;
    }
}

/* Popup styles */
.popup {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.popup.active {
    display: flex;
}

.popup-content {
    background-color: #1a1a1a;
    padding: 2rem;
    border-radius: 10px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

.popup-content h2 {
    color: #ffd700;
    margin-bottom: 1rem;
    font-size: 2rem;
}

.popup-content p {
    color: #fff;
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
}

.popup-offer {
    color: #ffd700;
    font-size: 1.5rem;
    font-weight: bold;
}

.popup-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.popup-buttons .btn {
    min-width: 120px;
    opacity: 1 !important;
    filter: none !important;
    pointer-events: auto !important;
    cursor: pointer !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    transition: transform 0.1s;
}

.popup-buttons .btn:active {
    transform: scale(0.97);
}

@media (max-width: 1200px) {
    .game-content {
        flex-direction: column;
    }

    .prize-list {
        width: 100%;
        margin-top: 1.5rem;
    }

    .prizes-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
}

@media (max-width: 768px) {
    .game-info {
        flex-direction: column;
        gap: 1rem;
    }

    .cases-grid {
        grid-template-columns: repeat(6, 1fr);
        gap: 1rem;
        padding: 0 0.75rem;
    }

    .case {
        font-size: 1rem;
        padding: 0.75rem;
        min-width: 60px;
        min-height: 60px;
    }

    .case .case-number {
        font-size: 0.9rem;
    }
}

.btn.settings {
    position: absolute;
    top: 20px;
    right: 20px;
    background-color: #4a4a4a;
    color: white;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.btn.settings:hover {
    background-color: #666;
}

.settings-form {
    padding: 20px;
}

.prize-inputs {
    margin-bottom: 20px;
}

.prize-list-input {
    margin-bottom: 15px;
}

.prize-list-input label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
}

.prize-input-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.prize-input {
    width: 80px;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
}

.regular-prizes {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
}

.settings-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* --- Settings Popup Fixes --- */
#settings-popup .popup-content {
    max-width: 420px;
    width: 100%;
    margin: 0 auto;
    background: #222;
    border-radius: 16px;
    padding: 32px 24px 24px 24px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    color: #fff;
    position: relative;
    overflow-y: auto;
    max-height: 90vh;
}
#settings-popup h2 {
    color: #ffd600;
    font-size: 2rem;
    text-align: center;
    margin-bottom: 18px;
    font-weight: 700;
}
#settings-popup h3 {
    color: #fff;
    font-size: 1.1rem;
    margin-bottom: 10px;
    font-weight: 600;
}
#settings-popup label {
    color: #fff;
    font-size: 1rem;
    margin-bottom: 6px;
}
.prize-input-group.regular-prizes {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin-bottom: 10px;
}
.prize-input-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}
.prize-input {
    width: 100%;
    min-width: 0;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
    background: #333;
    color: #fff;
}
.settings-buttons {
    display: flex;
    gap: 16px;
    justify-content: center;
    margin-top: 20px;
}
#save-settings {
    background: #27d940;
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
    padding: 8px 18px;
    border-radius: 18px;
    border: none;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(39,217,64,0.15);
    transition: background 0.2s, box-shadow 0.2s;
}
#save-settings:hover {
    background: #1fa331;
    box-shadow: 0 4px 16px rgba(39,217,64,0.25);
}
#cancel-settings {
    background: #ff3b3b;
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
    padding: 8px 18px;
    border-radius: 18px;
    border: none;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(255,59,59,0.15);
    transition: background 0.2s, box-shadow 0.2s;
}
#cancel-settings:hover {
    background: #c82323;
    box-shadow: 0 4px 16px rgba(255,59,59,0.25);
}
#restore-defaults {
    background: #3498db;
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
    padding: 8px 18px;
    border-radius: 18px;
    border: none;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(52,152,219,0.15);
    transition: background 0.2s, box-shadow 0.2s;
}
#restore-defaults:hover {
    background: #217dbb;
    box-shadow: 0 4px 16px rgba(52,152,219,0.25);
}
/* --- End Settings Popup Fixes --- */

#save-settings, #cancel-settings {
    font-size: 0.95rem;
    padding: 8px 18px;
    border-radius: 18px;
} 