* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

/* Screen management */
.screen {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.screen.hidden {
    display: none;
}

/* Menu Screen */
.menu-container {
    background: #0f0f23;
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    text-align: center;
    min-width: 320px;
}

.menu-title {
    color: #f0c040;
    font-size: 2.5rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 6px;
    margin-bottom: 32px;
}

.nickname-section {
    margin-bottom: 24px;
}

.nickname-section label {
    display: block;
    color: #888;
    font-size: 0.85rem;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.nickname-section input {
    width: 100%;
    padding: 12px 16px;
    font-size: 1rem;
    border: 2px solid #2a2a4a;
    border-radius: 8px;
    background: #1a1a2e;
    color: #fff;
    text-align: center;
}

.nickname-section input:focus {
    outline: none;
    border-color: #4ecdc4;
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.menu-btn {
    padding: 16px 24px;
    font-size: 1rem;
    font-weight: 600;
    border: 2px solid #2a2a4a;
    border-radius: 8px;
    background: #1a1a2e;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.menu-btn:hover {
    background: #2a2a4a;
    transform: translateY(-2px);
}

.menu-btn.primary {
    background: #4ecdc4;
    color: #0f0f23;
    border-color: #4ecdc4;
}

.menu-btn.primary:hover {
    background: #3dbdb5;
}

.menu-btn .btn-icon {
    font-size: 1.2rem;
    font-weight: 700;
}

.join-section {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.join-section input {
    flex: 1;
    padding: 12px 16px;
    font-size: 1rem;
    border: 2px solid #2a2a4a;
    border-radius: 8px;
    background: #1a1a2e;
    color: #fff;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.join-section input:focus {
    outline: none;
    border-color: #4ecdc4;
}

.join-section .menu-btn {
    padding: 12px 20px;
}

/* Lobby Screen */
.lobby-container {
    background: #0f0f23;
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    text-align: center;
    min-width: 400px;
}

.lobby-title {
    color: #f0c040;
    font-size: 2rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 4px;
    margin-bottom: 24px;
}

.game-code-display {
    background: #1a1a2e;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.code-label {
    color: #888;
    font-size: 0.9rem;
}

.code-value {
    color: #4ecdc4;
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: 4px;
    font-family: monospace;
}

.copy-btn {
    padding: 8px 16px;
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid #4ecdc4;
    border-radius: 4px;
    background: transparent;
    color: #4ecdc4;
    cursor: pointer;
    transition: all 0.2s ease;
}

.copy-btn:hover {
    background: #4ecdc4;
    color: #0f0f23;
}

.players-section {
    margin-bottom: 24px;
}

.players-section h2 {
    color: #fff;
    font-size: 1rem;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.players-section h2 span {
    color: #888;
    font-weight: 400;
}

.player-list {
    list-style: none;
    background: #1a1a2e;
    border-radius: 8px;
    padding: 8px;
    min-height: 100px;
}

.player-list li {
    padding: 12px 16px;
    color: #fff;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.player-list li.host::after {
    content: 'HOST';
    font-size: 0.65rem;
    padding: 2px 6px;
    background: #f0c040;
    color: #0f0f23;
    border-radius: 3px;
    font-weight: 600;
}

.player-list li.you {
    color: #4ecdc4;
}

.lobby-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 16px;
}

.lobby-btn {
    padding: 14px 28px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.lobby-btn.primary {
    background: #4ecdc4;
    color: #0f0f23;
}

.lobby-btn.primary:hover:not(:disabled) {
    background: #3dbdb5;
    transform: translateY(-2px);
}

.lobby-btn.primary:disabled {
    background: #2a2a4a;
    color: #666;
    cursor: not-allowed;
}

.lobby-btn.secondary {
    background: transparent;
    color: #888;
    border: 2px solid #2a2a4a;
}

.lobby-btn.secondary:hover {
    background: #2a2a4a;
    color: #fff;
}

.lobby-status {
    color: #888;
    font-size: 0.9rem;
}

.game-container {
    background: #0f0f23;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid #2a2a4a;
}

header h1 {
    color: #f0c040;
    font-size: 2rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 4px;
}

.header-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

.game-code {
    color: #888;
    font-size: 0.9rem;
    font-family: monospace;
    letter-spacing: 1px;
}

.score-display {
    color: #fff;
    font-size: 1.25rem;
    font-weight: 600;
}

#score {
    color: #4ecdc4;
}

/* Game main layout with optional sidebar */
.game-main {
    display: flex;
    gap: 20px;
}

.board-section {
    flex: 0 0 auto;
}

/* Multiplayer sidebar panel */
.multiplayer-panel {
    width: 200px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-self: flex-start;
}

.multiplayer-panel.hidden {
    display: none;
}

.panel-section {
    background: #1a1a2e;
    border-radius: 8px;
    padding: 12px;
}

.panel-section h3 {
    color: #888;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.game-player-list {
    list-style: none;
}

.game-player-list li {
    padding: 8px;
    border-radius: 4px;
    color: #fff;
    font-size: 0.9rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.game-player-list li.current-turn {
    background: rgba(78, 205, 196, 0.15);
}

.game-player-list li.current-turn::before {
    content: '\25B6';
    color: #4ecdc4;
    margin-right: 6px;
    font-size: 0.7rem;
}

.game-player-list li.you .player-name {
    color: #4ecdc4;
}

.game-player-list li.inactive {
    opacity: 0.5;
}

.player-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.player-score {
    color: #4ecdc4;
    font-weight: 600;
    margin-left: 8px;
}

.player-turns {
    color: #888;
    font-size: 0.85em;
    margin-left: 4px;
}

.move-history {
    list-style: none;
    overflow-y: auto;
    max-height: 280px;
}

.move-history li {
    padding: 6px 0;
    border-bottom: 1px solid #2a2a4a;
    font-size: 0.8rem;
    color: #ccc;
}

.move-history li:last-child {
    border-bottom: none;
}

.move-history .move-player {
    color: #fff;
    font-weight: 500;
}

.move-history .move-words {
    color: #888;
}

.move-history .move-score {
    color: #4ecdc4;
    font-weight: 600;
}

.move-history .move-pass {
    color: #888;
    font-style: italic;
}

.history-panel {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.history-panel .move-history {
    flex: 1;
}

/* Tile bag counter */
.tile-bag-counter {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 0.85rem;
    color: #888;
}

.tile-bag-counter #tiles-remaining {
    color: #4ecdc4;
    font-weight: 700;
    font-size: 1rem;
}

.leave-btn {
    padding: 10px 16px;
    font-size: 0.8rem;
    font-weight: 600;
    background: transparent;
    color: #888;
    border: 1px solid #2a2a4a;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.leave-btn:hover {
    background: #e74c3c;
    color: #fff;
    border-color: #e74c3c;
}

/* Game Over Scoreboard */
.scoreboard-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.scoreboard-modal {
    background: #0f0f23;
    border-radius: 16px;
    padding: 32px 40px;
    min-width: 320px;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 0 2px rgba(240, 192, 64, 0.3);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.scoreboard-title {
    color: #f0c040;
    font-size: 2rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 4px;
}

.scoreboard-winner {
    text-align: center;
    font-size: 1.3rem;
    color: #fff;
    margin-bottom: 24px;
    padding: 12px;
    background: rgba(240, 192, 64, 0.15);
    border-radius: 8px;
}

.scoreboard-list {
    list-style: none;
    margin-bottom: 24px;
}

.scoreboard-player {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 8px;
    background: #1a1a2e;
}

.scoreboard-player.you {
    background: rgba(78, 205, 196, 0.15);
}

.scoreboard-rank {
    color: #888;
    font-weight: 600;
    width: 32px;
}

.scoreboard-player:first-child .scoreboard-rank {
    color: #f0c040;
}

.scoreboard-name {
    flex: 1;
    color: #fff;
    font-weight: 500;
}

.scoreboard-player.you .scoreboard-name {
    color: #4ecdc4;
}

.scoreboard-score {
    color: #4ecdc4;
    font-weight: 700;
    font-size: 1.1rem;
}

.scoreboard-avg {
    color: #888;
    font-size: 0.85rem;
    margin-left: 8px;
}

.scoreboard-btn {
    width: 100%;
    padding: 14px 24px;
    font-size: 1rem;
    font-weight: 600;
    background: #4ecdc4;
    color: #0f0f23;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.scoreboard-btn:hover {
    background: #3dbdb5;
    transform: translateY(-2px);
}

/* Disabled state for controls when not your turn */
.controls.disabled {
    opacity: 0.5;
    pointer-events: none;
}

/* Rack dimming is sufficient - no overlay message needed */

/* Turn indicator message */
.turn-indicator {
    text-align: center;
    padding: 8px 16px;
    margin-bottom: 12px;
    border-radius: 6px;
    font-size: 0.9rem;
}

.turn-indicator.your-turn {
    background: rgba(78, 205, 196, 0.15);
    color: #4ecdc4;
}

.turn-indicator.waiting {
    background: rgba(240, 192, 64, 0.15);
    color: #f0c040;
}

/* Board */
.board {
    display: grid;
    grid-template-columns: repeat(13, 36px);
    gap: 2px;
    background: #1e1e3a;
    padding: 4px;
    border-radius: 8px;
    margin-bottom: 12px;
}

.cell {
    width: 36px;
    height: 36px;
    background: #2d2d4a;
    border-radius: 3px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 11px;
    font-weight: 600;
    color: #888;
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
}

.cell:hover {
    transform: scale(1.08);
    z-index: 1;
    box-shadow: 0 0 0 3px #ffd93d, 0 0 12px rgba(255, 217, 61, 0.6);
}

.cell.center {
    background: #ffd93d;
    color: #1a1a2e;
}

.cell.triple-word {
    background: #9e6b7a;
    color: #f0e8ea;
}

.cell.double-word {
    background: #7a6b9e;
    color: #f0e8f0;
}

.cell.triple-letter {
    background: #6b8a9e;
    color: #e8f0f4;
}

.cell.double-letter {
    background: #7a9e7a;
    color: #e8f4e8;
}

.cell.has-tile {
    background: #3d3d5a;
}

.cell.pending {
    background: #4a4840;
    box-shadow: 0 0 8px #ffd93d;
}

.cell.pending .tile {
    background: linear-gradient(145deg, #fff4c4, #e8c860);
}

.cell.locked {
    cursor: default;
}

.cell.locked:hover {
    transform: none;
}

.cell.drag-over {
    background: rgba(78, 205, 196, 0.4) !important;
    transform: scale(1.08);
    box-shadow: 0 0 12px rgba(78, 205, 196, 0.6);
}

.cell.drag-over.invalid {
    background: rgba(231, 76, 60, 0.3) !important;
    box-shadow: 0 0 12px rgba(231, 76, 60, 0.4);
}

/* Tiles */
.tile {
    width: 32px;
    height: 32px;
    background: #f0f0f5;
    border-radius: 4px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 18px;
    font-weight: 700;
    color: #1a1a2e;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    cursor: grab;
    user-select: none;
    position: relative;
    padding-top: 4px;
    padding-bottom: 0;
}

.tile:active {
    cursor: grabbing;
}

.tile .points {
    position: absolute;
    top: 2px;
    right: 3px;
    font-size: 10px;
    font-weight: 600;
    color: #666;
}

.tile.selected {
    box-shadow: 0 0 0 3px #4ecdc4, 0 4px 8px rgba(0, 0, 0, 0.3);
    transform: scale(1.1);
}

.tile.marked-for-swap {
    box-shadow: 0 0 0 3px #e74c3c, 0 4px 8px rgba(0, 0, 0, 0.3);
    transform: scale(1.1);
}

/* Swap mode button state */
#swap-tiles.swap-mode {
    background: linear-gradient(145deg, #e74c3c, #c0392b);
}

.tile.blank {
    color: #888;
}

/* Blank tiles that have been played should have normal letter color */
.cell.locked .tile.blank {
    color: #1a1a2e;
}

/* Locked tiles use slightly lighter flat background */
.cell.locked .tile {
    background: #e8e8ed;
}

.tile.dragging {
    opacity: 0.5;
    transform: scale(1.1);
}

.tile[draggable="true"] {
    cursor: grab;
}

.tile[draggable="true"]:active {
    cursor: grabbing;
}

/* Tile Rack */
.tile-rack {
    display: flex;
    gap: 6px;
    justify-content: center;
    padding: 6px 10px;
    background: #1e1e3a;
    border-radius: 8px;
}

.rack-slot {
    width: 48px;
    height: 48px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.15s ease;
}

/* Larger tiles in the rack */
.rack-slot .tile {
    width: 42px;
    height: 42px;
    font-size: 22px;
}

.rack-slot.drag-over {
    background: rgba(78, 205, 196, 0.3);
    box-shadow: 0 0 8px rgba(78, 205, 196, 0.5);
    transform: scale(1.05);
}

.tile-rack.drag-over {
    background: #2a2a4a;
    box-shadow: inset 0 0 20px rgba(78, 205, 196, 0.2);
}

.controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 12px;
    position: relative;
    /* Match board width: 13×36 + 12×2 + 8 = 500px */
    max-width: 500px;
    margin: 0 auto;
}

/* Rack takes full width on top */
.tile-rack {
    order: 1;
    flex: 1 1 100%;
}

/* Swap/Skip buttons on left below rack (50% total) */
.controls-stack {
    order: 2;
    display: flex;
    flex-direction: row;
    gap: 8px;
    flex: 1 1 calc(50% - 6px);
}

/* Submit/Finish button on right (50%) */
#submit-word,
#finish-game {
    order: 3;
    flex: 1 1 calc(50% - 6px);
}

button {
    padding: 8px 12px;
    font-size: 10px;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
}

button .icon {
    font-size: 18px;
    line-height: 1;
}

/* All control buttons: same height, fill available width */
.controls-stack button {
    flex: 1;
    height: 56px;
    padding: 4px 10px;
}

.controls-stack button .icon {
    font-size: 16px;
}

#submit-word {
    height: 56px;
    background: #4ecdc4;
    color: #0f0f23;
}

#submit-word:hover {
    background: #3dbdb5;
    transform: translateY(-2px);
}

#swap-tiles {
    background: #f0c040;
    color: #0f0f23;
}

#swap-tiles:hover {
    background: #e0b030;
    transform: translateY(-2px);
}

#skip-turn {
    background: #888;
    color: #fff;
}

#skip-turn:hover {
    background: #777;
    transform: translateY(-2px);
}

#finish-game {
    min-width: 80px;
    height: 78px;
    background: linear-gradient(145deg, #e8e8e8, #c8c8c8);
    color: #333;
}

#finish-game:hover {
    background: linear-gradient(145deg, #f0f0f0, #d8d8d8);
    transform: translateY(-2px);
}

#finish-game.hidden,
.controls-stack.hidden {
    display: none !important;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.message {
    margin-bottom: 16px;
    padding: 12px 20px;
    text-align: center;
    border-radius: 6px;
    font-weight: 500;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 576px;
}

.message.success {
    background: rgba(78, 205, 196, 0.2);
    color: #4ecdc4;
}

.message.error {
    background: rgba(231, 76, 60, 0.2);
    color: #e74c3c;
}

.message.info {
    background: rgba(240, 192, 64, 0.2);
    color: #f0c040;
}

/* Tile Picker Popup */
.tile-picker {
    position: fixed;
    display: none;
    background: #1e1e3a;
    border-radius: 8px;
    padding: 12px 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 2px rgba(240, 192, 64, 0.3);
    z-index: 100;
    animation: popIn 0.15s ease-out;
}

.tile-picker.visible {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.tile-picker .tile {
    width: 40px;
    height: 40px;
    font-size: 20px;
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.tile-picker .tile:hover {
    transform: scale(1.12);
    box-shadow: 0 0 0 2px #4ecdc4, 0 4px 12px rgba(0, 0, 0, 0.4);
}

.tile-picker::before {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    background: #1e1e3a;
    transform: rotate(45deg);
}

.tile-picker.above::before {
    bottom: -6px;
    left: 50%;
    margin-left: -6px;
}

.tile-picker.below::before {
    top: -6px;
    left: 50%;
    margin-left: -6px;
}

@keyframes popIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Blank tile waiting for letter assignment */
.cell.awaiting-letter {
    animation: pulse 0.8s ease-in-out infinite;
}

.cell.awaiting-letter .tile {
    box-shadow: 0 0 0 3px #4ecdc4, 0 0 16px rgba(78, 205, 196, 0.5);
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Loading states */
.loading {
    position: relative;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 3px solid rgba(78, 205, 196, 0.3);
    border-top-color: #4ecdc4;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.menu-btn.loading,
.lobby-btn.loading {
    color: transparent;
}

/* Connection status */
.connection-status {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 0.8rem;
    background: #1a1a2e;
    border: 1px solid #2a2a4a;
}

.connection-status.connected {
    color: #4ecdc4;
}

.connection-status.disconnected {
    color: #e74c3c;
}

/* ===========================================
   MOBILE RESPONSIVE STYLES
   =========================================== */

@media (max-width: 600px) {
    body {
        padding: 2px;
        align-items: flex-start;
    }

    /* Game container */
    .game-container {
        padding: 4px;
        border-radius: 4px;
        width: 100%;
        max-width: 100%;
    }

    /* Header - keep horizontal but compact */
    header {
        flex-direction: row;
        gap: 8px;
        margin-bottom: 8px;
        padding-bottom: 8px;
    }

    header h1 {
        font-size: 1.1rem;
        letter-spacing: 2px;
    }

    .header-info {
        gap: 8px;
        flex-wrap: wrap;
    }

    .score-display {
        font-size: 0.9rem;
    }

    /* Message area */
    .message {
        padding: 6px 10px;
        font-size: 0.8rem;
        min-height: 28px;
        margin-bottom: 8px;
    }

    /* Board - fluid width to fill screen */
    .board {
        grid-template-columns: repeat(13, 1fr);
        gap: 1px;
        padding: 2px;
        margin-bottom: 12px;
        width: 100%;
    }

    .cell {
        width: 100%;
        aspect-ratio: 1;
        height: auto;
        font-size: 7px;
        border-radius: 2px;
    }

    .cell:hover {
        transform: none;
    }

    /* Tiles on board - fit within cells */
    .cell .tile {
        width: 90%;
        height: 90%;
        font-size: clamp(10px, 2.5vw, 14px);
        border-radius: 2px;
        padding-bottom: 1px;
    }

    .cell .tile .points {
        font-size: clamp(5px, 1.2vw, 8px);
        bottom: 0;
        right: 1px;
    }

    /* Tile rack */
    .tile-rack {
        padding: 10px 8px;
        gap: 4px;
        min-height: 50px;
    }

    .rack-slot {
        width: 36px;
        height: 36px;
        border-radius: 4px;
    }

    .rack-slot .tile {
        width: 32px;
        height: 32px;
        font-size: 16px;
    }

    .rack-slot .tile .points {
        font-size: 8px;
    }

    /* Controls - mobile size adjustments */
    .controls {
        gap: 6px;
    }

    .controls-stack {
        gap: 4px;
    }

    /* All buttons same height on mobile */
    .controls-stack button,
    #submit-word,
    #finish-game {
        height: 48px;
        padding: 4px 8px;
        font-size: 9px;
    }

    .controls-stack button .icon,
    #submit-word .icon,
    #finish-game .icon {
        font-size: 14px;
    }

    /* Scoreboard on mobile */
    .scoreboard-modal {
        padding: 24px 20px;
        min-width: auto;
        max-width: 90vw;
        margin: 0 16px;
    }

    .scoreboard-title {
        font-size: 1.5rem;
        letter-spacing: 2px;
    }

    .scoreboard-winner {
        font-size: 1.1rem;
    }

    /* Tile picker */
    .tile-picker {
        padding: 8px 10px;
    }

    .tile-picker .tile {
        width: 34px;
        height: 34px;
        font-size: 16px;
    }

    /* Turn indicator */
    .turn-indicator {
        padding: 6px 12px;
        font-size: 0.8rem;
        margin-bottom: 8px;
    }

    /* Stack board and multiplayer panel vertically, center the board */
    .game-main {
        flex-direction: column;
        align-items: center;
    }

    .board-section {
        display: flex;
        flex-direction: column;
        align-items: center;
        width: 100%;
    }

    .controls {
        width: 100%;
        justify-content: center;
    }

    .multiplayer-panel {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
    }

    .multiplayer-panel .panel-section {
        flex: 1;
        min-width: 140px;
    }

    .multiplayer-panel .history-panel {
        flex-basis: 100%;
    }

    .move-history {
        max-height: 120px;
    }

    /* Menu screen */
    .menu-container {
        padding: 24px 16px;
        min-width: auto;
        width: 100%;
        max-width: 320px;
    }

    .menu-title {
        font-size: 1.8rem;
        letter-spacing: 4px;
        margin-bottom: 24px;
    }

    /* Lobby screen */
    .lobby-container {
        padding: 24px 16px;
        min-width: auto;
        width: 100%;
        max-width: 360px;
    }

    .lobby-title {
        font-size: 1.5rem;
    }

    .code-value {
        font-size: 1.4rem;
    }

    .lobby-buttons {
        flex-direction: column;
    }
}
