body {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
}

.game-container {
    text-align: center;
    max-width: 1100px;
}

.game-area {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

h1 {
    color: var(--primary-color);
    margin: 0;
}

.status {
    font-size: 1.2rem;
    margin-bottom: 10px;
    font-weight: bold;
    color: #2c3e50;
    height: 1.5em;
}

/* Layout */
.scrabble-layout {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    justify-content: center;
    flex-wrap: wrap;
}

.board-wrapper {
    flex-shrink: 0;
}

/* Scoreboard */
.scoreboard {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 160px;
    background: var(--background-color);
    padding: 15px;
    border-radius: var(--border-radius);
    border: 2px solid var(--border-color);
}

.score-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: var(--card-background);
    border-radius: var(--border-radius);
    border: 2px solid transparent;
    transition: var(--transition);
}

.score-card.active {
    border-color: var(--primary-color);
    box-shadow: 0 0 8px rgba(41, 128, 185, 0.3);
}

.score-card .player-label {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--secondary-color);
}

.score-card .player-score {
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--primary-color);
}

/* Board */
.scrabble-board {
    display: grid;
    grid-template-columns: repeat(15, 1fr);
    gap: 1px;
    background: #333;
    border: 3px solid #333;
    border-radius: 4px;
    width: fit-content;
    user-select: none;
}

.board-cell {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.55rem;
    font-weight: 700;
    text-transform: uppercase;
    cursor: pointer;
    position: relative;
    transition: background-color 0.15s ease;
    background: #c8b98a;
    color: #666;
    line-height: 1.1;
    text-align: center;
}

.board-cell:hover {
    filter: brightness(1.08);
}

/* Premium squares */
.board-cell.tw {
    background: #e74c3c;
    color: rgba(255,255,255,0.85);
}

.board-cell.dw {
    background: #f5a0b8;
    color: rgba(255,255,255,0.85);
}

.board-cell.tl {
    background: #2980b9;
    color: rgba(255,255,255,0.85);
}

.board-cell.dl {
    background: #85c1e9;
    color: rgba(255,255,255,0.85);
}

.board-cell.center {
    background: #f5a0b8;
    color: rgba(255,255,255,0.85);
}

.board-cell.center::after {
    content: '\2605';
    font-size: 1rem;
    position: absolute;
}

/* Tiles on board */
.board-cell.has-tile {
    background: #f5deb3;
    color: #333;
    font-size: 1rem;
    font-weight: 700;
    cursor: default;
    border: 1px solid #c4a66a;
    box-shadow: inset 0 1px 2px rgba(255,255,255,0.5), 0 1px 2px rgba(0,0,0,0.2);
}

.board-cell.has-tile .tile-points {
    position: absolute;
    bottom: 1px;
    right: 2px;
    font-size: 0.5rem;
    font-weight: 600;
    color: #666;
}

.board-cell.has-tile.just-placed {
    background: #ffe4a0;
    border-color: #e6a817;
    box-shadow: inset 0 1px 2px rgba(255,255,255,0.5), 0 0 6px rgba(230, 168, 23, 0.5);
}

.board-cell.has-tile.locked {
    cursor: default;
}

/* Tile Rack */
.rack-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    min-width: 160px;
}

.tile-rack {
    display: flex;
    gap: 4px;
    padding: 10px;
    background: #8b5e3c;
    border-radius: 6px;
    min-height: 52px;
    justify-content: center;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.3);
}

.rack-tile {
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5deb3;
    border: 2px solid #c4a66a;
    border-radius: 4px;
    font-size: 1.2rem;
    font-weight: 700;
    color: #333;
    cursor: grab;
    position: relative;
    user-select: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2), inset 0 1px 2px rgba(255,255,255,0.5);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.rack-tile:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3), inset 0 1px 2px rgba(255,255,255,0.5);
}

.rack-tile.selected {
    transform: translateY(-6px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.3), 0 0 0 3px var(--primary-color);
    border-color: var(--primary-color);
}

.rack-tile.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.rack-tile .tile-points {
    position: absolute;
    bottom: 1px;
    right: 2px;
    font-size: 0.5rem;
    font-weight: 600;
    color: #666;
}

.rack-tile.blank-tile {
    color: #999;
    font-style: italic;
}

/* Exchange mode */
.rack-tile.exchange-selected {
    box-shadow: 0 0 0 3px var(--danger-color);
    border-color: var(--danger-color);
    transform: translateY(-4px);
}

.exchange-prompt {
    background: #fdecea;
    color: var(--danger-color);
    padding: 10px 15px;
    border-radius: var(--border-radius);
    font-weight: 600;
    margin-bottom: 10px;
}

/* Game Controls */
.game-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.game-controls button {
    padding: 8px 14px;
    font-size: 0.85rem;
}

/* Game Info Bar */
.game-info-bar {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 12px 0;
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* Game Buttons */
.game-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 10px;
}

#exit-game-btn {
    padding: 10px 20px;
    font-size: 1rem;
}

/* Online Game Info */
.online-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 15px;
}

.opponent-name {
    font-weight: 600;
    color: var(--text-muted);
}

/* Cover Screen for pass-and-play */
.cover-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.cover-content {
    text-align: center;
    color: white;
}

.cover-content h2 {
    font-size: 2rem;
    margin-bottom: 15px;
}

.cover-content p {
    font-size: 1.1rem;
    margin-bottom: 25px;
    color: #ccc;
}

/* Blank tile chooser */
.blank-chooser-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1001;
}

.blank-chooser {
    background: white;
    padding: 25px;
    border-radius: var(--border-radius);
    text-align: center;
    max-width: 360px;
}

.blank-chooser h3 {
    margin-bottom: 15px;
    color: var(--secondary-color);
}

.blank-chooser-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
    margin-bottom: 15px;
}

.blank-chooser-grid button {
    width: 38px;
    height: 38px;
    padding: 0;
    font-size: 1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5deb3;
    color: #333;
    border: 2px solid #c4a66a;
    border-radius: 4px;
}

.blank-chooser-grid button:hover {
    background: #ffe4a0;
    border-color: var(--primary-color);
}

/* Game Over overlay */
.game-over-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
}

.game-over-content {
    background: white;
    padding: 30px 40px;
    border-radius: var(--border-radius);
    text-align: center;
    max-width: 400px;
}

.game-over-content h2 {
    color: var(--secondary-color);
    margin-bottom: 15px;
}

.game-over-scores {
    margin: 15px 0;
}

.game-over-scores div {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 1.1rem;
}

.game-over-scores .winner-row {
    font-weight: 700;
    color: var(--success-color);
}

/* Responsive */
@media (max-width: 900px) {
    .scrabble-layout {
        flex-direction: column;
        align-items: center;
    }

    .scoreboard {
        flex-direction: row;
        flex-wrap: wrap;
        min-width: auto;
        width: 100%;
        justify-content: center;
    }

    .rack-area {
        min-width: auto;
        width: 100%;
    }
}

@media (max-width: 640px) {
    .board-cell {
        width: 26px;
        height: 26px;
        font-size: 0.4rem;
    }

    .board-cell.has-tile {
        font-size: 0.7rem;
    }

    .board-cell.has-tile .tile-points {
        font-size: 0.35rem;
    }

    .board-cell.center::after {
        font-size: 0.7rem;
    }

    .rack-tile {
        width: 34px;
        height: 34px;
        font-size: 1rem;
    }

    .game-area {
        padding: 10px;
    }

    .game-controls button {
        padding: 6px 10px;
        font-size: 0.8rem;
    }
}
