/* Base styles */
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f5f5f5;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    padding-top: 0; /* Reduces top padding to move content up */
}

/* Header */
.header {
    background-color: #333;
    color: white;
    padding: 15px 0;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.header h1 {
    margin: 0;
    font-size: 28px;
}

/* Form Styles */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.form-group input, .form-group select {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

/* Button Styles */
.button-group {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.btn {
    padding: 10px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: background-color 0.3s;
}

.btn.primary {
    background-color: #4CAF50;
    color: white;
}

.btn.primary:hover {
    background-color: #388E3C;
}

.btn.secondary {
    background-color: #f0f0f0;
    color: #333;
}

.btn.secondary:hover {
    background-color: #e0e0e0;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Login Panel */
.login-panel {
    background-color: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin: 0 auto;
    max-width: 400px;
}

.login-panel h2 {
    margin-top: 0;
    color: #333;
    text-align: center;
}

/* Game list */
.games-list {
    margin: 20px 0;
    max-height: 300px;
    overflow-y: auto;
}

.game-item {
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 10px 15px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: background-color 0.2s;
}

.game-item:hover {
    background-color: #f9f9f9;
}

.game-item-name {
    font-weight: bold;
}

.game-item-players {
    color: #666;
}

/* Game containers */
.game-container {
    background-color: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.game-content {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    gap: 20px;
    margin-top: 10px; /* Moves the game boards up */
}

.player-area {
    background-color: #f9f9f9;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
}

.active-player {
    border: 3px solid #4CAF50;
    position: relative;
}

.active-player::before {
    content: "Your Turn";
    position: absolute;
    top: -10px;
    right: 10px;
    background-color: #4CAF50;
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
}

.player-name {
    font-weight: bold;
    font-size: 18px;
    margin-bottom: 10px;
    text-align: center;
}

.score-info {
    margin-bottom: 15px;
    text-align: center;
}

/* Connection Status */
.connection-status {
    position: absolute;
    top: 12px; /* Match vertical distance from top as Start Game button */
    right: 20px;
    margin: 0;
}

.connection-status span {
    display: inline-block;
    padding: 10px 15px; /* Match padding of the Start Game button */
    border-radius: 4px;
    font-size: 16px; /* Match font size of buttons */
    font-weight: bold; /* Match font weight of buttons */
}

.connected {
    background-color: #4CAF50;
    color: white;
}

.disconnected {
    background-color: #f44336;
    color: white;
}

/* Game Status */
.game-status {
    text-align: center;
    margin: 5px 0; /* Reduces margins to compact these elements */
    font-size: 18px;
    font-weight: bold;
}

/* Round Info */
.round-info {
    text-align: center;
    margin: 5px 0; /* Reduces margins to compact these elements */
    font-size: 16px;
}

/* Timer */
.timer {
    text-align: center;
    font-size: 24px;
    margin: 5px 0; /* Reduces margins to compact these elements */
    font-weight: bold;
}

/* Phrase display */
.phrase-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.phrase-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px 5px;
    margin: 20px 0;
}

.word-container {
    display: flex;
    gap: 5px;
    margin-right: 10px;
    margin-bottom: 10px;
}

.letter-blank {
    width: 30px;
    height: 40px;
    border-bottom: 2px solid #333;
    display: flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
    font-weight: bold;
    font-size: 20px;
}

/* Alphabet display */
.alphabet {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
    margin-top: 15px;
}

.letter {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s;
    margin: 0 auto;
}

/* Letter colors */
.letter:not(.vowel):not(.used) {
    background-color: #4CAF50; /* Green for consonants */
    color: white;
}

.letter.vowel:not(.used) {
    background-color: #2196F3; /* Blue for vowels */
    color: white;
}

.letter:hover:not(.used) {
    transform: scale(1.1);
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.letter.used {
    opacity: 0.5;
    cursor: not-allowed;
}

.letter.correct {
    background-color: #4CAF50;
    color: white;
}

.letter.used.incorrect {
    background-color: #f44336; /* Red background */
    color: white; /* White text */
    opacity: 1; /* Make sure it's fully visible */
}

/* Vowel Button */
.vowel-btn {
    margin-bottom: 15px;
    background-color: #2196F3;
    color: white;
    width: 100%;
}

.vowel-btn:hover {
    background-color: #1976D2;
}

.vowel-btn:disabled {
    background-color: #90CAF9;
}

/* Solve Puzzle */
.solve-btn {
    margin-top: 20px;
    background-color: #673AB7;
    color: white;
}

.solve-btn:hover {
    background-color: #5E35B1;
}

.solve-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: white;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    z-index: 100;
    width: 90%;
    max-width: 500px;
}

.solve-container h3 {
    margin-top: 0;
    text-align: center;
}

.solve-timer {
    text-align: center;
    margin-bottom: 15px;
    font-size: 18px;
}

#solve-input {
    width: 100%;
    padding: 10px;
    font-size: 16px;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* Game Results */
.game-results {
    text-align: center;
}

.game-results h2 {
    margin-top: 0;
}

#winner-display {
    font-size: 24px;
    margin: 20px 0;
    font-weight: bold;
}

#results-content {
    margin-bottom: 20px;
}

/* Helper Classes */
.hidden {
    display: none !important;
}

.host-only {
    position: absolute;
    top: 80px; /* Position it above the game status */
    left: 170px; /* Keep it aligned to the left */
    text-align: left;
    margin: 0;
    z-index: 50;
}

/* Reset any flex properties on the button group when it's host-only */
.host-only.button-group {
    display: block;
    margin-top: 0;
    width: auto;
}

/* Hide when game starts */
.game-started .host-only {
    display: none !important;
}

/* Responsive Styling */
@media (max-width: 768px) {
    .game-content {
        grid-template-columns: 1fr;
    }
    
    .player-area {
        margin-bottom: 20px;
    }
    
    .letter {
        width: 32px;
        height: 32px;
    }
    
    .button-group:not(.host-only) {
        flex-direction: column;
    }
    
    .host-only {
        top: 80px; /* Adjust for smaller screens */
    }

}/* Button itself doesn't need absolute positioning */
#start-game-btn {
    display: inline-block;
    position: static;
    transform: none;
}
}