body {
    background-color: #006400; /* TABLE_GREEN */
    display: flex;
    flex-direction: column;
    align-items: center;
    font-family: Tahoma, sans-serif;
    color: white;
}

canvas {
    background-color: #005000; /* DARK_GREEN */
    border: 2px solid #C8A531; /* GOLD */
}

.controls {
    margin-top: 10px; /* Moved buttons closer to canvas */
    display: flex; /* Added to enable centering */
    justify-content: center; /* Added to center buttons */
    width: 100%;
}

button {
    font-size: 16px;
    padding: 8px 16px;
    margin: 0 10px;
    background-color: #C8A531; /* GOLD */
    color: black;
    border: 2px solid #27408B;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
}

button:hover {
    background-color: #E0C161;
}

#declareButton {
    background-color: #C00000; /* RED */
    color: white;
    border-color: #FFD700; /* GOLD */
    font-weight: bold;
}

#declareButton:hover {
    background-color: #E03030;
}

#settings-screen {
    background-color: #005000;
    border: 2px solid #C8A531;
    padding: 20px 40px;
    border-radius: 10px;
    text-align: center;
    color: white;
}

#settings-screen h2 {
    margin-top: 0;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 20px 0;
    font-size: 18px;
}

.setting-item label {
    margin-right: 20px;
}

#start-game-btn {
    font-size: 20px;
    padding: 10px 30px;
    margin-top: 20px;
    background-color: #C00000;
    color: white;
    border: 2px solid #FFD700;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
}
#start-game-btn:hover {
    background-color: #E03030;
}

#scoreboard-screen, #showdown-screen {
    background-color: #005000;
    border: 2px solid #C8A531;
    padding: 20px 40px;
    border-radius: 10px;
    text-align: center;
    color: white;
    width: 80%;
    max-width: 900px;
    position: relative;
    overflow: hidden;
}

#scoreboard-screen h2, #showdown-screen h2 {
    color: #FFD700;
    margin-top: 0;
}

#score-table {
    width: 100%;
    margin: 20px 0;
    border-collapse: collapse;
}

#score-table th, #score-table td {
    border: 1px solid white;
    padding: 8px;
    font-size: 18px;
}

.scoreboard-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
}

#next-round-btn, #continue-to-scoreboard-btn, #scoreboard-new-game-btn, #scoreboard-home-btn {
    font-size: 20px;
    padding: 10px 30px;
    margin-top: 20px;
    background-color: #C00000;
    color: white;
    border: 2px solid #FFD700;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
}
#next-round-btn:hover, #continue-to-scoreboard-btn:hover, #scoreboard-new-game-btn:hover, #scoreboard-home-btn:hover {
    background-color: #E03030;
}

#scoreboard-screen.game-complete {
    animation: scoreboard-celebrate 0.8s ease-out;
    box-shadow: 0 0 25px rgba(255, 215, 0, 0.7);
}

#scoreboard-screen.game-complete::before,
#scoreboard-screen.game-complete::after {
    content: '';
    position: absolute;
    inset: -40px 0 -20px 0;
    background-image:
        radial-gradient(circle, rgba(255, 215, 0, 0.85) 0 6px, transparent 7px),
        radial-gradient(circle, rgba(135, 206, 250, 0.75) 0 5px, transparent 6px),
        radial-gradient(circle, rgba(255, 99, 132, 0.75) 0 5px, transparent 6px),
        radial-gradient(circle, rgba(144, 238, 144, 0.75) 0 5px, transparent 6px);
    background-size: 160px 160px;
    animation: confetti-fall 2.6s linear infinite;
    pointer-events: none;
    opacity: 0.75;
}

#scoreboard-screen.game-complete::after {
    animation-delay: 1.3s;
    background-size: 140px 140px;
    opacity: 0.5;
    filter: hue-rotate(60deg);
}

@keyframes scoreboard-celebrate {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 rgba(255, 215, 0, 0);
    }
    60% {
        transform: scale(1.03);
        box-shadow: 0 0 35px rgba(255, 215, 0, 0.85);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 18px rgba(255, 215, 0, 0.5);
    }
}

@keyframes confetti-fall {
    0% {
        transform: translateY(-40px) rotate(0deg);
        opacity: 0;
    }
    15% {
        opacity: 0.9;
    }
    100% {
        transform: translateY(120px) rotate(1turn);
        opacity: 0;
    }
}

button:disabled {
    background-color: #808080;
    color: #c0c0c0;
    cursor: not-allowed;
    border-color: #606060;
}

.dashboard-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
    margin-top: 30px;
}

.dashboard-actions button {
    min-width: 160px;
}

/* Showdown and Learner Mode Styles */
#showdown-content {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
    margin: 20px 0;
}

.showdown-player-area {
    background-color: rgba(0, 0, 0, 0.2);
    border: 1px solid #C8A531;
    border-radius: 8px;
    padding: 15px;
    width: 45%;
    min-width: 300px;
    box-sizing: border-box;
}

.showdown-player-area h4 {
    margin: 0 0 10px 0;
    color: #FFD700;
    font-size: 20px;
}

.showdown-player-area p {
    font-size: 16px;
    margin: 5px 0;
}

.showdown-card-list {
    background-color: #f0f0f0;
    color: black;
    padding: 15px;
    border-radius: 5px;
    text-align: left;
    min-height: 40px;
    font-size: 20px;
    font-family: 'Consolas', 'Courier New', monospace;
    font-weight: bold;
    line-height: 1.5;
}

#debug-area {
    width: 800px;
    margin-top: 20px;
    padding: 15px;
    background-color: #f0f0f0; /* Light background for high contrast */
    border: 1px solid #C8A531;   /* A solid border to match other elements */
    color: black;                /* Default text color for this area */
    font-family: 'Courier New', Courier, monospace;
    border-radius: 5px;
    box-sizing: border-box; /* Add this for better sizing */
}

#debug-area h3 {
    margin-top: 0;
    text-align: center;
}

.debug-player {
    margin-bottom: 10px;
}

.card-text-red {
    color: #C00000;
}

.card-text-black {
    color: #000000;
}

@media (min-width: 1024px) {
    #game-container {
        width: min(96vw, 1200px);
    }

    canvas {
        width: min(96vw, 1200px);
        height: auto;
        box-sizing: border-box;
    }

    #debug-area {
        width: min(96vw, 1200px);
    }

    .controls {
        gap: 16px;
        flex-wrap: wrap;
    }

    button {
        font-size: 18px;
        padding: 10px 20px;
    }
}
