/* CSS Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* CSS Custom Properties */
:root {
    --felt-green: #0f5132;
    --felt-green-light: #198754;
    --casino-gold: #ffd700;
    --casino-red: #dc3545;
    --card-white: #f8f9fa;
    --text-dark: #212529;
    --text-light: #ffffff;
    --shadow-dark: rgba(0, 0, 0, 0.3);
    --shadow-light: rgba(255, 255, 255, 0.1);
    
    --font-primary: 'Playfair Display', serif;
    --font-secondary: 'Roboto', sans-serif;
}

/* Body and Main Layout */
body {
    font-family: var(--font-secondary);
    background: linear-gradient(135deg, var(--felt-green) 0%, #1a5d37 50%, var(--felt-green) 100%);
    background-attachment: fixed;
    min-height: 100vh;
    color: var(--text-light);
    position: relative;
}

/* Casino table texture overlay */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 25% 25%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 75% 75%, rgba(255, 255, 255, 0.05) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
    z-index: 1;
}

/* Header Styles */
.header {
    text-align: center;
    margin-bottom: 30px;
    padding: 30px 20px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 15px;
    border: 2px solid var(--casino-gold);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.title {
    font-family: var(--font-primary);
    font-size: 3rem;
    font-weight: 700;
    color: var(--casino-gold);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

.suit-icon {
    font-size: 2.5rem;
    animation: pulse 2s ease-in-out infinite alternate;
}

.suit-icon:first-child {
    color: var(--text-light);
}

.suit-icon:last-child {
    color: var(--casino-red);
}

@keyframes pulse {
    0% { transform: scale(1); }
    100% { transform: scale(1.1); }
}

.subtitle {
    font-size: 1.2rem;
    color: var(--text-light);
    font-weight: 300;
}

/* Stats Panel */
.stats-panel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-item {
    background: rgba(0, 0, 0, 0.4);
    padding: 20px;
    border-radius: 10px;
    border: 1px solid var(--casino-gold);
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(255, 215, 0, 0.2);
}

.stat-label {
    display: block;
    font-size: 0.9rem;
    color: var(--casino-gold);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-light);
}

/* Mode Selection */
.mode-selection {
    background: rgba(0, 0, 0, 0.3);
    padding: 30px;
    border-radius: 15px;
    margin-bottom: 30px;
    border: 2px solid var(--casino-gold);
}

.mode-selection h2 {
    text-align: center;
    font-family: var(--font-primary);
    font-size: 2rem;
    color: var(--casino-gold);
    margin-bottom: 30px;
}

.mode-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.mode-btn {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
    border: 2px solid var(--casino-gold);
    border-radius: 12px;
    padding: 25px 20px;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    font-family: var(--font-secondary);
}

.mode-btn:hover {
    background: linear-gradient(145deg, rgba(255, 215, 0, 0.2), rgba(255, 215, 0, 0.1));
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(255, 215, 0, 0.3);
}

.mode-icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.mode-title {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--casino-gold);
}

.mode-desc {
    font-size: 0.95rem;
    opacity: 0.9;
    line-height: 1.4;
}

/* Game Settings */
.game-settings {
    background: rgba(0, 0, 0, 0.4);
    padding: 25px;
    border-radius: 12px;
    margin-bottom: 30px;
    border: 1px solid var(--casino-gold);
}

.game-settings h3 {
    color: var(--casino-gold);
    margin-bottom: 20px;
    font-family: var(--font-primary);
    font-size: 1.5rem;
}

.settings-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.settings-row label {
    font-weight: 500;
    color: var(--text-light);
}

.settings-row select {
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid var(--casino-gold);
    border-radius: 6px;
    padding: 8px 12px;
    color: var(--text-light);
    font-size: 1rem;
}

.start-btn {
    width: 100%;
    background: linear-gradient(45deg, var(--casino-gold), #ffed4e);
    border: none;
    border-radius: 8px;
    padding: 15px;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-dark);
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
}

.start-btn:hover {
    background: linear-gradient(45deg, #ffed4e, var(--casino-gold));
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 215, 0, 0.4);
}

/* Game Area */
.game-area {
    background: rgba(0, 0, 0, 0.3);
    padding: 30px;
    border-radius: 15px;
    border: 2px solid var(--casino-gold);
    position: relative;
}

/* Timer Display */
.timer-display {
    text-align: center;
    margin-bottom: 20px;
}

.timer-circle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    border: 4px solid var(--casino-gold);
    border-radius: 50%;
    background: rgba(255, 215, 0, 0.1);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--casino-gold);
    animation: timerPulse 1s ease-in-out infinite;
}

@keyframes timerPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.timer-urgent {
    border-color: var(--casino-red) !important;
    color: var(--casino-red) !important;
    animation: timerUrgent 0.5s ease-in-out infinite;
}

@keyframes timerUrgent {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); box-shadow: 0 0 20px rgba(220, 53, 69, 0.5); }
}

/* Cards Display */
.cards-display {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 15px;
    margin: 30px 0;
    min-height: 140px;
    align-items: center;
}

.card {
    width: 80px;
    height: 120px;
    background: var(--card-white);
    border: 2px solid #333;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease;
    position: relative;
    animation: cardDeal 0.5s ease-out forwards;
}

@keyframes cardDeal {
    0% {
        transform: translateY(-50px) rotateY(180deg);
        opacity: 0;
    }
    100% {
        transform: translateY(0) rotateY(0deg);
        opacity: 1;
    }
}

.card:hover {
    transform: translateY(-5px);
}

.card.red {
    color: var(--casino-red);
}

.card-rank {
    font-size: 1.2rem;
    margin-bottom: 5px;
}

.card-suit {
    font-size: 1.5rem;
}

/* Question Area */
.question-area {
    text-align: center;
    margin: 30px 0;
}

.question-area h3 {
    font-family: var(--font-primary);
    font-size: 1.8rem;
    color: var(--casino-gold);
    margin-bottom: 25px;
}

/* Answer Options (Multiple Choice) */
.answer-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
    max-width: 600px;
    margin: 0 auto;
}

.option-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid var(--casino-gold);
    border-radius: 8px;
    padding: 15px 10px;
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.3s ease;
}

.option-btn:hover {
    background: rgba(255, 215, 0, 0.2);
    transform: translateY(-2px);
}

.option-btn.correct {
    background: linear-gradient(45deg, #28a745, #20c997);
    border-color: #28a745;
    animation: correctAnswer 0.6s ease-out;
}

.option-btn.incorrect {
    background: linear-gradient(45deg, var(--casino-red), #e74c3c);
    border-color: var(--casino-red);
    animation: incorrectAnswer 0.6s ease-out;
}

@keyframes correctAnswer {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

@keyframes incorrectAnswer {
    0% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
    100% { transform: translateX(0); }
}

/* Answer Input */
.answer-input {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    max-width: 400px;
    margin: 0 auto;
}

#userAnswer {
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid var(--casino-gold);
    border-radius: 8px;
    padding: 12px 15px;
    font-size: 1.3rem;
    color: var(--text-light);
    text-align: center;
    width: 120px;
}

#userAnswer:focus {
    outline: none;
    border-color: var(--casino-gold);
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

.submit-btn {
    background: linear-gradient(45deg, var(--casino-gold), #ffed4e);
    border: none;
    border-radius: 8px;
    padding: 12px 25px;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-dark);
    cursor: pointer;
    transition: all 0.3s ease;
}

.submit-btn:hover {
    background: linear-gradient(45deg, #ffed4e, var(--casino-gold));
    transform: translateY(-2px);
}

/* Practice Answer */
.practice-answer {
    max-width: 500px;
    margin: 0 auto;
}

.answer-reveal {
    background: rgba(40, 167, 69, 0.2);
    border: 2px solid #28a745;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
}

.answer-reveal p {
    font-size: 1.3rem;
    margin-bottom: 15px;
}

#correctTotal {
    font-weight: 700;
    color: var(--casino-gold);
    font-size: 1.5rem;
}

.next-btn {
    background: linear-gradient(45deg, #28a745, #20c997);
    border: none;
    border-radius: 8px;
    padding: 12px 25px;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.3s ease;
}

.next-btn:hover {
    background: linear-gradient(45deg, #20c997, #28a745);
    transform: translateY(-2px);
}

/* Feedback */
.feedback {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    border: 3px solid var(--casino-gold);
    border-radius: 15px;
    padding: 30px;
    text-align: center;
    z-index: 100;
    min-width: 300px;
}

.feedback-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.feedback-icon {
    font-size: 3rem;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.feedback.correct .feedback-icon {
    background: #28a745;
}

.feedback.correct .feedback-icon::after {
    content: '✓';
    color: white;
}

.feedback.incorrect .feedback-icon {
    background: var(--casino-red);
}

.feedback.incorrect .feedback-icon::after {
    content: '✗';
    color: white;
}

.feedback-text {
    font-size: 1.2rem;
    color: var(--text-light);
}

.continue-btn {
    background: linear-gradient(45deg, var(--casino-gold), #ffed4e);
    border: none;
    border-radius: 8px;
    padding: 12px 30px;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-dark);
    cursor: pointer;
    transition: all 0.3s ease;
}

.continue-btn:hover {
    background: linear-gradient(45deg, #ffed4e, var(--casino-gold));
    transform: translateY(-2px);
}

/* Game Controls */
.game-controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.control-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--casino-gold);
    border-radius: 6px;
    padding: 10px 20px;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.95rem;
}

.control-btn:hover {
    background: rgba(255, 215, 0, 0.2);
    transform: translateY(-2px);
}

/* Footer */
.footer {
    text-align: center;
    margin-top: 40px;
    padding: 20px;
    font-size: 1.1rem;
    color: var(--casino-gold);
    font-weight: 300;
}

/* Responsive Design */
@media (max-width: 768px) {
    .title {
        font-size: 2rem;
        flex-direction: column;
        gap: 10px;
    }
    
    .suit-icon {
        font-size: 2rem;
    }
    
    .stats-panel {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .mode-buttons {
        grid-template-columns: 1fr;
    }
    
    .cards-display {
        gap: 10px;
    }
    
    .card {
        width: 70px;
        height: 105px;
        font-size: 1rem;
    }
    
    .answer-options {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .answer-input {
        flex-direction: column;
        gap: 10px;
    }
    
    .game-controls {
        flex-direction: column;
        align-items: center;
    }
    
    .control-btn {
        width: 200px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 15px;
    }
    
    .title {
        font-size: 1.8rem;
    }
    
    .stats-panel {
        grid-template-columns: 1fr;
    }
    
    .card {
        width: 60px;
        height: 90px;
        font-size: 0.9rem;
    }
    
    .card-rank {
        font-size: 1rem;
    }
    
    .card-suit {
        font-size: 1.2rem;
    }
}