* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1100px;
    margin: 1.5rem auto;
    padding: 1.5rem;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Scoreboard */
.scoreboard {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 1rem;
    background-color: #f8f9fa;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.team {
    text-align: center;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    min-width: 120px;
}

.team-a {
    background-color: #3498db;
    color: white;
}

.team-b {
    background-color: #e74c3c;
    color: white;
}

.team h3 {
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
}

.score {
    font-size: 2rem;
    font-weight: bold;
}

.turn-indicator {
    font-size: 1.2rem;
    font-weight: bold;
    padding: 0.5rem 1rem;
    background-color: #2c3e50;
    color: white;
    border-radius: 4px;
    animation: pulse 2s infinite;
}

/* Two-column layout */
.content-wrapper {
    display: flex;
    gap: 1.5rem;
}

.game-content {
    flex: 1;
    min-width: 0; /* Prevents flex children from overflowing */
}

.sidebar {
    width: 320px;
    flex-shrink: 0;
}

/* Make the sidebar responsive */
@media (max-width: 900px) {
    .content-wrapper {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        margin-bottom: 1.5rem;
    }
    
    .scoreboard {
        flex-direction: column;
    }
    
    .team {
        margin: 0.5rem 0;
        width: 100%;
    }
    
    .turn-indicator {
        margin: 0.5rem 0;
    }
}

h1 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: #2c3e50;
}

h2 {
    margin-bottom: 1rem;
    color: #3498db;
}

/* Category Grid */
.categories-container {
    margin-top: 1.5rem;
}

#categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.category-card {
    padding: 1.5rem;
    background-color: #fff;
    border-radius: 8px;
    border: 2px solid #e0e0e0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    text-align: center;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.category-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    border-color: #3498db;
}

.category-card h3 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    color: #2c3e50;
}

/* Category highlight styling */
.category-highlight {
    font-weight: bold;
    color: #4285f4;
    font-size: 1.1em;
}

/* Instructions */
.instructions {
    padding: 1.5rem;
    background-color: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #3498db;
}

.instructions h3 {
    color: #2c3e50;
    margin-bottom: 1rem;
}

.instructions ol {
    padding-left: 1.5rem;
}

.instructions li {
    margin-bottom: 0.8rem;
    line-height: 1.5;
}

/* Word Card */
.card {
    padding: 1.5rem;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    transform: rotate(-1deg);
    border: 1px solid #e0e0e0;
    position: relative;
    animation: flash 1s ease;
}

.flash-animation {
    animation: flash 1s ease;
}

@keyframes flash {
    0% { transform: rotate(-1deg); box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15); }
    50% { transform: rotate(0deg); box-shadow: 0 4px 30px rgba(52, 152, 219, 0.6); }
    100% { transform: rotate(-1deg); box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15); }
}

.card::before {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    right: 3px;
    bottom: 3px;
    border: 1px dashed #ccc;
    border-radius: 6px;
    pointer-events: none;
}

.card h3 {
    text-align: center;
    margin-bottom: 1rem;
    font-size: 1.3rem;
    color: #2c3e50;
}

#word-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
}

.word-item {
    background-color: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 0.5rem 0.8rem;
    font-size: 0.9rem;
    position: relative;
    transition: background-color 0.2s;
}

.word-item.selected {
    background-color: #d4edda;
    border-color: #c3e6cb;
}

.word-item.guessed {
    background-color: #fff3cd;
    border-color: #ffeeba;
}

.point-value {
    position: absolute;
    top: -8px;
    right: -8px;
    background-color: #3498db;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 0.7rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Word Items */
.word-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 12px;
    margin: 4px 0;
    border-radius: 6px;
    background-color: #f5f5f5;
    font-size: 0.9rem;
}

/* Highlighted word that was guessed correctly */
.word-guessed {
    background-color: #e6f7ea;
    border-left: 3px solid #4caf50;
    animation: highlight-pulse 2s infinite;
}

@keyframes highlight-pulse {
    0% { box-shadow: 0 0 0 rgba(76, 175, 80, 0.2); }
    50% { box-shadow: 0 0 8px rgba(76, 175, 80, 0.5); }
    100% { box-shadow: 0 0 0 rgba(76, 175, 80, 0.2); }
}

.word-text {
    font-weight: 500;
}

.word-points {
    background-color: #f0f0f0;
    border-radius: 50%;
    min-width: 24px;
    height: 24px;
    line-height: 24px;
    text-align: center;
    color: #666;
    font-weight: bold;
}

/* Timer and Game Phases */
.timer-container {
    text-align: center;
    margin-bottom: 1rem;
}

.timer {
    display: inline-block;
    font-size: 1.5rem;
    font-weight: bold;
    padding: 0.5rem 1rem;
    background-color: #3498db;
    color: white;
    border-radius: 4px;
}

.game-phase {
    display: none;
    padding: 1.5rem;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.game-phase.active {
    display: block;
}

.team-instruction {
    margin-bottom: 1rem;
    font-size: 1.1rem;
    text-align: center;
}

.current-team {
    font-weight: bold;
}

#prompt-input {
    width: 100%;
    min-height: 150px;
    padding: 1rem;
    margin-bottom: 1rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    resize: vertical;
    font-size: 1rem;
}

button {
    display: block;
    width: 100%;
    padding: 0.8rem;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s;
}

button:hover {
    background-color: #2980b9;
}

/* Generation Phase */
.progress-container {
    width: 100%;
    height: 20px;
    background-color: #f1f1f1;
    border-radius: 10px;
    margin: 1rem 0;
    overflow: hidden;
}

#progress-bar {
    height: 100%;
    width: 0;
    background-color: #3498db;
    transition: width 0.3s;
}

#generation-status {
    text-align: center;
    margin-top: 1rem;
    font-style: italic;
}

/* Guess Phase */
#image-container,
#results-image-container {
    width: 100%;
    margin: 1rem 0;
    text-align: center;
}

#generated-image,
#results-image {
    max-width: 100%;
    max-height: 400px;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.blur-effect {
    filter: blur(20px);
    transition: filter 0.5s ease;
}

#recording-indicator {
    margin-top: 1rem;
    text-align: center;
    padding: 0.5rem;
    background-color: #e74c3c;
    color: white;
    border-radius: 4px;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.hidden {
    display: none;
}

/* Results Phase */
#prompt-result,
#transcript-result,
#score-result {
    margin: 1rem 0;
    padding: 1rem;
    background-color: #f9f9f9;
    border-radius: 4px;
}

#original-prompt {
    white-space: pre-wrap;
    line-height: 1.5;
}

#transcript {
    white-space: pre-wrap;
    line-height: 1.5;
}

.highlight {
    background-color: #e3f2fd;
    border-radius: 3px;
    padding: 2px 4px;
    color: #1565c0;
}

.card-word-highlight {
    background-color: #e6f7ea;
    border-radius: 3px;
    padding: 2px 4px;
    font-weight: bold;
    color: #2e7d32;
}

.card-word-used {
    background-color: #fff8e1;
    border-radius: 3px;
    padding: 2px 4px;
    font-weight: bold;
    color: #ff8f00;
}

.highlight-points {
    position: relative;
    display: inline-block;
}

.point-indicator {
    font-size: 0.7rem;
    font-weight: bold;
    position: absolute;
    top: -12px;
    right: -10px;
    background: #3498db;
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#round-score {
    font-size: 1.5rem;
    font-weight: bold;
    text-align: center;
}

/* Game Over Phase */
#winner-announcement {
    text-align: center;
    margin: 2rem 0;
}

#winner-announcement h3 {
    font-size: 1.8rem;
    margin-bottom: 1rem;
    color: #2c3e50;
}

#winner-announcement p {
    font-size: 1.3rem;
}

.header-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px; /* Adjust as needed */
}

.header-controls h1 {
    margin-bottom: 0; /* Remove default h1 margin if it interferes */
}

#clear-api-key-btn {
    padding: 6px 12px;
    font-size: 0.85em;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    background-color: #f8f9fa;
    color: #333;
    border: 1px solid #ced4da;
    border-radius: 4px;
    transition: background-color 0.2s ease-in-out, border-color 0.2s ease-in-out;
}

#clear-api-key-btn:hover {
    background-color: #e9ecef;
    border-color: #adb5bd;
}

/* API Key Controls */
#api-key-controls {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 100;
}

#clear-api-key-btn {
    font-size: 0.75rem;
    padding: 5px 10px;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    color: #6c757d;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s, background-color 0.2s;
}

#clear-api-key-btn:hover {
    opacity: 1;
    background-color: #e9ecef;
}