:root {
    --board-bg: #1a6b37;
    --board-border: #145a2d;
    --cell-normal: #5a9b6a;
    --cell-tw: #e74c3c;
    --cell-tw-text: #fff;
    --cell-dw: #e8a0bf;
    --cell-dw-text: #6b2040;
    --cell-tl: #3498db;
    --cell-tl-text: #fff;
    --cell-dl: #85c1e9;
    --cell-dl-text: #1a4060;
    --cell-center: #e8a0bf;
    --tile-bg: #f5deb3;
    --tile-text: #333;
    --tile-border: #c5a55a;
    --tile-shadow: rgba(0,0,0,0.2);
    --tile-pending-border: #ff8c00;
    --tile-pending-glow: rgba(255,140,0,0.5);
    --tile-last-border: #d4880a;
    --tile-last-glow: rgba(212,136,10,0.3);
    --tile-last-bg: #e8c878;
    --rack-bg: #6b3a1f;
    --rack-border: #4a2510;
    --rack-shadow: inset 0 2px 6px rgba(0,0,0,0.3);
    --selected-border: #3273dc;
    --selected-glow: rgba(50,115,220,0.5);
    --info-bg: #f7f7f7;
    --info-border: #ddd;
    --history-bg: #fafafa;
    --score-positive: #2ecc71;
    --score-text: #333;
    --ghost-shadow: rgba(0,0,0,0.35);
    --cell-label-size: 0.55em;
    --cell-font-size: clamp(0.55rem, 2.2vw, 0.95rem);
}

[data-theme="dark"] {
    --board-bg: #0d3520;
    --board-border: #0a2a18;
    --cell-normal: #2d5a3a;
    --cell-tw: #8b2020;
    --cell-tw-text: #ffcccc;
    --cell-dw: #6b2850;
    --cell-dw-text: #f0c0d8;
    --cell-tl: #1a4080;
    --cell-tl-text: #aaccff;
    --cell-dl: #253a60;
    --cell-dl-text: #aaccee;
    --cell-center: #6b2850;
    --tile-bg: #b89a5a;
    --tile-text: #1a1a1a;
    --tile-border: #8a7030;
    --tile-shadow: rgba(0,0,0,0.4);
    --tile-pending-border: #cc7000;
    --tile-pending-glow: rgba(204,112,0,0.5);
    --tile-last-border: #d49830;
    --tile-last-glow: rgba(212,152,48,0.3);
    --tile-last-bg: #d4b478;
    --rack-bg: #3a1a08;
    --rack-border: #2a1005;
    --selected-border: #5a9aff;
    --selected-glow: rgba(90,154,255,0.4);
    --info-bg: #2a2a3a;
    --info-border: #444;
    --history-bg: #252535;
    --score-positive: #22b060;
    --score-text: #e0e0e0;
    --ghost-shadow: rgba(0,0,0,0.6);
}

/* ÜLDPAIGUTUS */
.game-layout {
    display: flex;
    gap: 0.75rem;
    max-width: 1200px;
    margin: 0 auto;
    align-items: flex-start;
}

.game-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.game-info-panel {
    width: 220px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.game-actions-panel {
    width: 140px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.actions-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.actions-group .button {
    font-size: 0.85rem;
}

.actions-divider {
    margin: 0.25rem 0;
    border: none;
    border-top: 1px solid var(--info-border);
}

.resign-link {
    margin-top: auto;
    padding-top: 0.5rem;
    text-align: center;
}

.resign-link a {
    font-size: 0.75rem;
    color: var(--text-muted, #999);
    text-decoration: none;
    opacity: 0.7;
    transition: opacity 0.2s, color 0.2s;
}

.resign-link a:hover {
    opacity: 1;
    color: var(--cell-tw);
}

/* SKOORITABEL */
.score-panel {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.score-player {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    background: var(--info-bg);
    border: 2px solid var(--info-border);
    font-weight: 600;
    font-size: 0.95rem;
    transition: border-color 0.3s;
}

.score-player .player-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.score-player.active-turn {
    border-color: var(--score-positive);
    box-shadow: 0 0 8px rgba(46,204,113,0.3);
}

.score-player.time-warning-bg {
    border-color: #e67e22;
    box-shadow: 0 0 8px rgba(230,126,34,0.3);
    animation: scoreWarningPulse 1.5s ease-in-out infinite;
}

.score-player.time-critical-bg {
    border-color: #e74c3c;
    box-shadow: 0 0 12px rgba(231,76,60,0.4);
    animation: scoreCriticalPulse 0.6s ease-in-out infinite;
}

@keyframes scoreWarningPulse {
    0%, 100% { background: var(--info-bg); }
    50% { background: rgba(230,126,34,0.15); }
}

@keyframes scoreCriticalPulse {
    0%, 100% { background: var(--info-bg); }
    50% { background: rgba(231,76,60,0.2); }
}

.score-player .score-value {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--score-positive);
    flex-shrink: 0;
}

.mobile-only {
    display: none !important;
}

.score-player .player-clock {
    font-size: 0.95rem;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    background: rgba(0,0,0,0.08);
    min-width: 3.5em;
    text-align: center;
}

[data-theme="dark"] .score-player .player-clock {
    background: rgba(255,255,255,0.08);
}

.player-clock.time-warning {
    color: #e67e22;
    background: rgba(230,126,34,0.15);
}

.player-clock.time-critical {
    color: #e74c3c;
    background: rgba(231,76,60,0.15);
    animation: timePulse 0.5s ease-in-out infinite;
}

.player-clock.time-overtime {
    color: #e74c3c;
    background: rgba(231,76,60,0.2);
    font-weight: 800;
}

@keyframes timePulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}


/* MÄNGULAUD */
.board-wrapper {
    width: 100%;
    max-width: min(600px, calc(100vh - 170px));
    position: relative;
}

.board-wrapper.board-finished {
    max-width: min(600px, calc(100vh - 100px));
}

.scrabble-board {
    display: grid;
    grid-template-columns: repeat(15, 1fr);
    grid-template-rows: repeat(15, 1fr);
    gap: 1px;
    aspect-ratio: 1;
    width: 100%;
    background: var(--board-border);
    border: 3px solid var(--board-border);
    border-radius: 6px;
    user-select: none;
    -webkit-user-select: none;
    box-shadow: 0 4px 16px rgba(0,0,0,0.25);
}

.board-cell {
    background: var(--cell-normal);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--cell-font-size);
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.15s;
    overflow: hidden;
    touch-action: none;
}

.board-cell::before {
    content: attr(data-label);
    position: absolute;
    font-size: var(--cell-label-size);
    font-weight: 600;
    text-transform: uppercase;
    line-height: 1;
    opacity: 0.5;
    pointer-events: none;
    text-align: center;
    width: 100%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.board-cell.tw { background: var(--cell-tw); color: var(--cell-tw-text); }
.board-cell.dw { background: var(--cell-dw); color: var(--cell-dw-text); }
.board-cell.tl { background: var(--cell-tl); color: var(--cell-tl-text); }
.board-cell.dl { background: var(--cell-dl); color: var(--cell-dl-text); }

.board-cell.center-star::before {
    content: '\2605';
    font-size: 1.4em;
    opacity: 1;
}

.board-cell.drop-target {
    outline: 2.5px solid var(--tile-pending-border);
    outline-offset: -2px;
    background-color: rgba(255,200,0,0.45);
    box-shadow: inset 0 0 8px rgba(255,140,0,0.4);
}

/* KIVID LAUAL */
.board-tile {
    width: 90%;
    height: 90%;
    background: var(--tile-bg);
    color: var(--tile-text);
    border: 1.5px solid var(--tile-border);
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1em;
    position: relative;
    box-shadow: 1px 1px 2px var(--tile-shadow);
    z-index: 1;
}

.board-tile .tile-points {
    position: absolute;
    bottom: 0;
    right: 1px;
    font-size: 0.45em;
    font-weight: 500;
    line-height: 1;
    opacity: 0.7;
}

.board-tile.pending {
    border-color: var(--tile-pending-border);
    box-shadow: 0 0 6px var(--tile-pending-glow);
    cursor: grab;
    touch-action: none;
}

.board-tile.opponent-invalid {
    background: #f5c6c6;
    border-color: #d44;
    box-shadow: 0 0 8px rgba(220, 50, 50, 0.5);
    color: #a22;
    pointer-events: none;
    animation: invalidFadeOut 3s ease-out forwards;
}

.board-tile.opponent-invalid .tile-points {
    color: #c55;
}

[data-theme="dark"] .board-tile.opponent-invalid {
    background: #5c2020;
    border-color: #d44;
    color: #f88;
}

[data-theme="dark"] .board-tile.opponent-invalid .tile-points {
    color: #e77;
}

@keyframes invalidFadeOut {
    0%, 60% { opacity: 1; }
    100% { opacity: 0; }
}

.board-tile.last-placed {
    background: var(--tile-last-bg);
    border-color: var(--tile-last-border);
}

.board-tile.blank-tile {
    font-style: italic;
}

/* RIIULID */
.rack-area {
    width: 100%;
    max-width: min(600px, calc(100vh - 170px));
    margin-top: 0.5rem;
}

.tile-rack {
    display: flex;
    gap: 5px;
    justify-content: center;
    padding: 8px 14px;
    background: var(--rack-bg);
    border: 2px solid var(--rack-border);
    border-radius: 10px;
    min-height: 50px;
    box-shadow: var(--rack-shadow);
    flex-wrap: nowrap;
}

.rack-tile {
    width: clamp(36px, 11vw, 52px);
    height: clamp(42px, 13vw, 60px);
    background: var(--tile-bg);
    color: var(--tile-text);
    border: 2px solid var(--tile-border);
    border-radius: 5px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: clamp(1rem, 4vw, 1.4rem);
    font-weight: 700;
    cursor: grab;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    position: relative;
    box-shadow: 2px 2px 4px var(--tile-shadow);
    transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s, order 0.15s;
}

.rack-tile:hover {
    transform: translateY(-3px);
    box-shadow: 3px 5px 8px var(--tile-shadow);
}

.rack-tile.selected {
    border-color: var(--selected-border);
    box-shadow: 0 0 10px var(--selected-glow);
    transform: translateY(-5px);
}

.rack-tile .rack-tile-points {
    font-size: 0.5em;
    font-weight: 500;
    line-height: 1;
    opacity: 0.6;
    position: absolute;
    bottom: 2px;
    right: 3px;
}

.rack-tile.blank-display {
    font-style: italic;
    opacity: 0.85;
}

.rack-tile.rack-empty {
    opacity: 0.15;
    border-style: dashed;
    cursor: default;
}

.rack-tile.rack-empty:hover {
    transform: none;
    box-shadow: 2px 2px 4px var(--tile-shadow);
}

.tile-rack.has-selection .rack-tile.rack-empty {
    opacity: 0.35;
    border-color: var(--selected-border);
    cursor: pointer;
}

.rack-tile.rack-dragging {
    opacity: 0.2;
    transform: scale(0.85);
    border-style: dashed;
}

.rack-tile.rack-drop-target {
    border-color: var(--tile-pending-border);
    box-shadow: 0 0 8px var(--tile-pending-glow);
    transform: translateY(-3px) scale(1.05);
}

.tile-rack.rack-return-target {
    border-color: var(--score-positive);
    box-shadow: var(--rack-shadow), 0 0 12px rgba(46,204,113,0.4);
}

/* TEGEVUSNUPUD (mobiilne) */
.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    justify-content: center;
    margin-top: 0.5rem;
}

.mobile-btn-row {
    display: flex;
    gap: 0.4rem;
    justify-content: center;
    flex-wrap: wrap;
}

.action-buttons .button {
    min-width: 70px;
}

.action-buttons .button.is-light,
.game-actions-panel .button.is-light {
    border: 1px solid var(--info-border);
}

/* PAUSI OVERLAY */
.board-pause-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--board-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    z-index: 10;
}

.board-pause-overlay span {
    font-size: 2.5rem;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 2px 12px rgba(0,0,0,0.4);
    letter-spacing: 0.1em;
    opacity: 0.85;
}

.rack-wrapper {
    position: relative;
}

.rack-paused-wrapper .tile-rack {
    opacity: 0.4;
    pointer-events: none;
}

.rack-pause-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--rack-bg);
    border-radius: 10px;
    z-index: 10;
}

/* MOBIILNE KÄIKUDE AJALUGU */
.mobile-history-toggle {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.8rem;
    color: var(--text-link, #3273dc);
    user-select: none;
    -webkit-user-select: none;
}

.mobile-history-toggle i {
    transition: transform 0.2s;
}

.mobile-history-toggle.expanded i {
    transform: rotate(180deg);
}

.mobile-history-panel {
    display: none;
    background: var(--history-bg);
    border: 1px solid var(--info-border);
    border-radius: 8px;
    max-height: 200px;
    overflow-y: auto;
    font-size: 0.8rem;
}

.mobile-history-panel.expanded {
    display: block;
}

/* LÕPUEKRAAN */
.finished-bottom-panel {
    text-align: center;
    padding: 1rem 0;
    margin-top: 0.5rem;
}

.finished-scores {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.finished-score-item {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--score-text);
}

.finished-score-item.winner {
    color: var(--score-positive);
}

/* LOHISTAMISE GHOST */
.drag-ghost {
    position: fixed;
    pointer-events: none;
    z-index: 10000;
    width: 40px;
    height: 44px;
    background: var(--tile-bg);
    color: var(--tile-text);
    border: 2px solid var(--tile-pending-border);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 700;
    box-shadow: 0 4px 12px var(--ghost-shadow);
    transform: translate(-50%, -110%);
    opacity: 0.9;
}

@media screen and (min-width: 769px) {
    .drag-ghost {
        transform: translate(-50%, -70%);
    }
}

/* TÜHJA KIVI MODAAL */
.blank-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.blank-modal {
    background: var(--info-bg);
    border-radius: 12px;
    padding: 1.5rem;
    max-width: 360px;
    width: 90%;
    box-shadow: 0 8px 30px rgba(0,0,0,0.3);
}

.blank-modal h3 {
    margin: 0 0 1rem;
    text-align: center;
    font-size: 1.1rem;
    color: var(--score-text);
}

.blank-letters-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
}

.blank-letter-btn {
    padding: 8px 4px;
    background: var(--tile-bg);
    color: var(--tile-text);
    border: 2px solid var(--tile-border);
    border-radius: 5px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    text-align: center;
    transition: all 0.15s;
}

.blank-letter-btn:hover {
    border-color: var(--selected-border);
    transform: scale(1.1);
}

/* OOTEEKRAAN */
.waiting-screen {
    text-align: center;
    padding: 3rem 1rem;
}

.waiting-screen .game-code-display {
    font-size: 2.8rem;
    font-weight: 800;
    letter-spacing: 0.35em;
    color: var(--score-positive);
    margin: 0.25rem 0;
    font-family: 'Courier New', monospace;
    cursor: pointer;
}

.waiting-screen .invite-section {
    max-width: 500px;
    margin: 1.5rem auto 0;
}

.waiting-screen .waiting-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 3px solid var(--info-border);
    border-top-color: var(--score-positive);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-top: 1rem;
}

.qr-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qr-modal-content {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 2rem;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* KÄIKUDE AJALUGU */
.history-panel {
    background: var(--history-bg);
    border: 1px solid var(--info-border);
    border-radius: 8px;
    max-height: 300px;
    overflow-y: auto;
}

.history-panel .panel-heading {
    background: var(--info-bg);
    border-bottom: 1px solid var(--info-border);
    padding: 0.5rem 0.75rem;
    font-weight: 600;
    font-size: 0.85rem;
    position: sticky;
    top: 0;
    z-index: 1;
    color: var(--score-text);
}

.history-item {
    padding: 0.35rem 0.75rem;
    border-bottom: 1px solid var(--info-border);
    font-size: 0.8rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--score-text);
}

.history-item:last-child {
    border-bottom: none;
}

.history-item .history-words {
    font-weight: 600;
}

.history-item .history-score {
    color: var(--score-positive);
    font-weight: 700;
}

.history-item .history-action {
    opacity: 0.6;
    font-style: italic;
}

/* INFO PANEEL */
.info-panel {
    background: var(--info-bg);
    border: 1px solid var(--info-border);
    border-radius: 8px;
    padding: 0.75rem;
    color: var(--score-text);
}

.info-panel .info-row {
    display: flex;
    justify-content: space-between;
    padding: 0.25rem 0;
    font-size: 0.85rem;
}

.info-panel .info-row .info-label {
    opacity: 0.7;
}

.info-panel .info-row .info-value {
    font-weight: 600;
}

/* MÄNGU LÕPUEKRAAN */
.game-over-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 8000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.game-over-card {
    background: var(--info-bg);
    border-radius: 16px;
    padding: 2rem;
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-shadow: 0 8px 40px rgba(0,0,0,0.4);
    animation: popIn 0.3s ease-out;
}

.game-over-card .button.is-light {
    border: 1px solid var(--info-border);
}

@keyframes popIn {
    0% { transform: scale(0.85); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.game-over-card .result-icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.game-over-card .result-title {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 1rem;
    color: var(--score-text);
}

.game-over-card .final-scores {
    margin-bottom: 1.5rem;
}

.game-over-card .final-score-row {
    display: flex;
    justify-content: space-between;
    padding: 0.4rem 1rem;
    font-size: 1.1rem;
    color: var(--score-text);
}

.game-over-card .final-score-row.winner {
    font-weight: 700;
    color: var(--score-positive);
}

/* VAHETUSDIALOOG */
.exchange-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.exchange-modal {
    background: var(--info-bg);
    border-radius: 12px;
    padding: 1.5rem;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 8px 30px rgba(0,0,0,0.3);
    text-align: center;
    color: var(--score-text);
}

.exchange-tiles {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin: 1rem 0;
    flex-wrap: wrap;
}

.exchange-tile {
    width: 44px;
    height: 50px;
    background: var(--tile-bg);
    color: var(--tile-text);
    border: 2px solid var(--tile-border);
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
    position: relative;
}

.exchange-tile.selected-exchange {
    border-color: var(--cell-tw);
    background: #ffe0e0;
    transform: scale(0.9);
}

[data-theme="dark"] .exchange-tile.selected-exchange {
    background: #5a2020;
}

/* KÄIGU INDIKAATOR */
.turn-indicator {
    padding: 0.4rem 0.75rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
}

.turn-indicator.my-turn {
    background: rgba(46,204,113,0.15);
    color: var(--score-positive);
    border: 1px solid rgba(46,204,113,0.3);
}

.turn-indicator.opponent-turn {
    background: rgba(52,152,219,0.15);
    color: #3498db;
    border: 1px solid rgba(52,152,219,0.3);
}

.turn-indicator.paused {
    background: rgba(255,165,0,0.15);
    color: #e67e22;
    border: 1px solid rgba(255,165,0,0.3);
}

/* DESKTOP: väiksem padding et laud mahuks */
@media screen and (min-width: 769px) {
    .section {
        padding-top: 0.75rem;
        padding-bottom: 0.75rem;
    }
}

/* MOBIILNE VAADE */
@media screen and (max-width: 768px) {
    .container {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

    .game-layout {
        flex-direction: column;
        align-items: stretch;
    }

    .game-info-panel {
        width: 100%;
    }

    .game-actions-panel {
        display: none;
    }

    .score-panel {
        flex-direction: row;
        gap: 0.5rem;
    }

    .score-player {
        flex: 1;
        padding: 0.3rem 0.5rem;
        font-size: 0.8rem;
        min-width: 0;
    }

    .score-player .player-name {
        max-width: 80px;
    }

    .game-info-panel .turn-indicator {
        display: none;
    }

    .game-info-panel .info-panel {
        display: flex;
        flex-wrap: wrap;
        padding: 0.4rem 0.6rem;
        font-size: 0.8rem;
    }

    .game-info-panel .info-panel .info-row {
        display: inline-flex;
        gap: 0.3rem;
        padding: 0.1rem 0.8rem 0.1rem 0;
        font-size: 0.8rem;
    }

    .game-info-panel .history-panel {
        display: none;
    }

    .game-info-panel .info-panel .info-row.mobile-only {
        display: inline-flex !important;
    }

    .mobile-history-panel {
        margin-bottom: 0.25rem;
    }

    .game-info-panel .resign-link {
        display: none;
    }

    .mobile-only {
        display: flex !important;
    }

    .board-wrapper,
    .rack-area {
        max-width: none;
        width: 100%;
    }

    .scrabble-board {
        border-radius: 4px;
        border-width: 2px;
    }

    .board-cell::before {
        font-size: 0.9em;
        opacity: 0.5;
    }

    .board-cell.center-star::before {
        font-size: 1.1em;
    }

    .rack-tile {
        width: clamp(34px, 12vw, 48px);
        height: clamp(40px, 14vw, 55px);
    }

    .action-buttons .button {
        min-width: 55px;
        font-size: 0.8rem;
        padding: 0.4em 0.6em;
    }

    .mobile-btn-row {
        gap: 0.3rem;
    }

    .section {
        padding: 0.75rem 0.25rem;
    }
}

@media screen and (max-width: 400px) {
    .tile-rack {
        gap: 3px;
        padding: 8px 10px;
    }

    .rack-tile {
        width: 38px;
        height: 44px;
        font-size: 1rem;
    }

    .board-cell {
        font-size: clamp(0.4rem, 2vw, 0.6rem);
    }
}

/* KORRA MÄRGUANNE */
.board-wrapper.turn-flash {
    animation: turnFlashAnim 2s ease-out;
}

@keyframes turnFlashAnim {
    0% { box-shadow: 0 0 0 5px rgba(46, 204, 113, 0.9); }
    30% { box-shadow: 0 0 20px 8px rgba(46, 204, 113, 0.5); }
    100% { box-shadow: 0 0 0 0 rgba(46, 204, 113, 0); }
}

/* VAHETAMISE NUPP KEELATUD */
.is-exchange-disabled {
    opacity: 0.45 !important;
    cursor: not-allowed !important;
}

/* ANIMATSIOONID */
.tile-place-anim {
    animation: tileDrop 0.2s ease-out;
}

@keyframes tileDrop {
    0% { transform: scale(1.2); opacity: 0.7; }
    100% { transform: scale(1); opacity: 1; }
}

.rack-tile.tile-appear-anim {
    animation: tileAppear 0.25s ease-out both;
}

@keyframes tileAppear {
    0% { transform: translateY(-20px) scale(0.5); opacity: 0; }
    100% { transform: translateY(0) scale(1); opacity: 1; }
}

.score-popup {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--score-positive);
    pointer-events: none;
    animation: scoreFloat 1.5s ease-out forwards;
    z-index: 100;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

@keyframes scoreFloat {
    0% { opacity: 1; transform: translateX(-50%) translateY(0); }
    100% { opacity: 0; transform: translateX(-50%) translateY(-40px); }
}
