/* Variables */
:root {
    --background-color: #f0f0f0;
    --board-color: #f9f9f9;
    --border-color: #ccc;
    --tile-color: #f9d66b;
    --tile-text: #333;
    --ui-padding: 10px;
    --center-star-color: #ff7777;
    --double-letter-color: #a6d8ff;
    --triple-letter-color: #5db9ff;
    --double-word-color: #ffb9b9;
    --triple-word-color: #ff7777;
}

/* General Layout */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--background-color);
    padding: 0;
    margin: 0;
}

.game-container {
    display: flex;
    flex-direction: column;
    max-width: 1100px;
    margin: 0 auto;
    padding: 15px;
}

/* Game Board */
.board-container {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

#gameBoard {
    display: grid;
    grid-template-columns: repeat(15, 35px);
    grid-template-rows: repeat(15, 35px);
    gap: 0;
    border: 2px solid var(--border-color);
    background-color: var(--board-color);
    width: 525px;
    height: 525px;
}

.board-cell {
    position: relative;
    width: 35px;
    height: 35px;
    box-sizing: border-box;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7em;
    background-color: var(--board-color);
}

.center-star {
    position: relative;
}

.center-star::before {
    content: "★";
    position: absolute;
    font-size: 22px;
    color: var(--center-star-color);
    z-index: 1;
}

/* Special Tiles */
.double-letter {
    background-color: var(--double-letter-color);
}

.double-letter::after {
    content: "DL";
    font-size: 0.6em;
    position: absolute;
    z-index: 1;
}

.triple-letter {
    background-color: var(--triple-letter-color);
}

.triple-letter::after {
    content: "TL";
    font-size: 0.6em;
    position: absolute;
    z-index: 1;
}

.double-word {
    background-color: var(--double-word-color);
}

.double-word::after {
    content: "DW";
    font-size: 0.6em;
    position: absolute;
    z-index: 1;
}

.triple-word {
    background-color: var(--triple-word-color);
}

.triple-word::after {
    content: "TW";
    font-size: 0.6em;
    position: absolute;
    z-index: 1;
}

/* Tiles */
.tile {
    width: 34px;
    height: 34px;
    background-color: var(--tile-color);
    border-radius: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    cursor: pointer;
    position: relative;
    box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
    z-index: 10;
    font-size: 1.2em;
    user-select: none;
}

.tile[data-recommended="true"] {
    background-color: #adff9e;
}

.points {
    position: absolute;
    bottom: 2px;
    right: 2px;
    font-size: 0.6em;
}

/* Tile Rack */
.rack-container {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

#tileRack {
    display: flex;
    gap: 5px;
    padding: 10px;
    background-color: #e1c38c;
    border-radius: 5px;
    min-height: 50px;
    width: 300px;
    justify-content: center;
    align-items: center;
    margin: 0 auto;
    z-index: 20;
    position: relative;
}

/* Game Controls & Info */
.game-interface {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
    margin: 0 auto;
}

.game-controls, .game-chat, .game-history, .game-stats {
    border: 1px solid var(--border-color);
    padding: 15px;
    border-radius: 5px;
    background-color: white;
    max-width: 250px;
    min-width: 230px;
    flex: 1;
}

#controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

#controls button {
    padding: 8px 12px;
    cursor: pointer;
    background-color: #4285f4;
    color: white;
    border: none;
    border-radius: 4px;
    margin: 4px 0;
    font-size: 0.95em;
    flex-grow: 1;
    min-width: 90px;
}

#controls button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

#controls button#denyRecommendation {
    background-color: #db4437;
}

#controls button#acceptRecommendation {
    background-color: #0f9d58;
}

#controls button#resetBoard {
    background-color: #fbbc05;
}

.game-chat-box {
    display: flex;
    gap: 5px;
    margin-top: 10px;
}

#chatInput {
    flex: 1;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

#sendMessage {
    padding: 8px;
    background-color: #4285f4;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

#chatHistory {
    height: 150px;
    overflow-y: auto;
    margin-bottom: 10px;
    border: 1px solid var(--border-color);
    padding: 5px;
    font-size: 0.9em;
    border-radius: 4px;
}

#historyContent {
    height: 200px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    padding: 5px;
    font-size: 0.9em;
    border-radius: 4px;
}

.player-score {
    display: flex;
    align-items: center;
    margin-bottom: 5px;
}

.human-icon::before {
    content: "👤";
    margin-right: 5px;
}

.cpu-icon::before {
    content: "💻";
    margin-right: 5px;
}

/* Game Start Screen */
#gameStart {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 100;
}

#gameStart.inactive {
    opacity: 0;
    pointer-events: none;
}

.start-container {
    background-color: white;
    padding: 20px;
    border-radius: 10px;
    width: 300px;
}

.start-container input, .start-container select {
    width: 100%;
    padding: 8px;
    margin-bottom: 15px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.start-container button {
    width: 100%;
    padding: 10px;
    background-color: #4285f4;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .game-container {
        padding: 10px;
        max-width: 900px;
    }
    
    .game-interface {
        justify-content: center;
    }
}

@media (max-width: 950px) {
    #gameBoard {
        width: 465px;
        height: 465px;
        grid-template-columns: repeat(15, 31px);
        grid-template-rows: repeat(15, 31px);
    }
    
    .board-cell {
        width: 31px;
        height: 31px;
    }
    
    .tile {
        width: 30px;
        height: 30px;
    }
    
    .game-controls, .game-chat, .game-history, .game-stats {
        min-width: 200px;
    }
}

@media (max-width: 768px) {
    #gameBoard {
        width: 420px;
        height: 420px;
        grid-template-columns: repeat(15, 28px);
        grid-template-rows: repeat(15, 28px);
    }
    
    .board-cell {
        width: 28px;
        height: 28px;
    }
    
    .tile {
        width: 27px;
        height: 27px;
        font-size: 0.9em;
    }
    
    .game-interface {
        flex-direction: column;
        align-items: center;
    }
    
    .game-controls, .game-chat, .game-history, .game-stats {
        width: 90%;
        max-width: none;
    }
}

/* API Connection Status */
#connectionStatus {
    font-weight: bold;
    padding: 2px 5px;
    border-radius: 3px;
}

#connectionStatus.connecting {
    color: #f39c12;
    background-color: #fef5e7;
}

#connectionStatus.connected {
    color: #27ae60;
    background-color: #e9f7ef;
}

#connectionStatus.error {
    color: #e74c3c;
    background-color: #fdedec;
}

#retryConnection {
    background-color: #e74c3c !important;
    color: white;
    font-weight: bold;
}

/* Current Player Highlight */
.player-score.current-player {
    font-weight: bold;
    background-color: #f0f7ff;
    border-left: 3px solid #4285f4;
    padding-left: 5px;
    border-radius: 3px;
} 