* { 
    box-sizing: border-box; 
    -webkit-user-select: none; 
    user-select: none; 
    outline: none; 
}

body { 
    margin: 0; 
    background: #15202b; 
    color: white; 
    font-family: 'Segoe UI', system-ui, sans-serif; 
    overflow: hidden; 
    touch-action: none; 
}

/* 1. PAUSE OVERLAY & SYNC */
body::before {
    content: "GAME PAUSED";
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100vw; 
    height: 100vh;
    background: rgba(10, 20, 30, 0.85); 
    backdrop-filter: blur(8px);
    display: flex; 
    align-items: center; 
    justify-content: center;
    font-size: 3rem; 
    font-weight: 900; 
    color: #1da1f2; 
    letter-spacing: 10px;
    z-index: 2000; 
    opacity: 0; 
    pointer-events: none;
    transition: opacity 0.3s ease;
}

body.game-paused::before { 
    opacity: 1; 
}

#pause-btn { 
    background: #ffffff; 
    color: #15202b; 
    border: none; 
    padding: 10px 24px; 
    border-radius: 6px; 
    font-weight: 900; 
    cursor: pointer; 
    position: relative; 
    z-index: 2005;
}

/* 2. HEADER & TIMER */
#turn-banner {
    display: flex; 
    align-items: center; 
    justify-content: space-between;
    padding: 15px 30px; 
    background: #192734; 
    border-bottom: 2px solid #38444d;
}

#timer-ui { 
    display: flex; 
    align-items: center; 
    gap: 15px; 
    width: 220px; 
}

#timer-bar-bg { 
    flex: 1; 
    height: 12px; 
    background: #38444d; 
    border-radius: 6px; 
    overflow: hidden; 
}

#timer-fill { 
    width: 100%; 
    height: 100%; 
    background: #1da1f2; 
    transition: width 1s linear; 
}

/* 3. GAME LAYOUT */
#game-layout { 
    display: flex; 
    justify-content: center; 
    padding: 25px; 
    gap: 40px; 
}

#play-zone { 
    width: 480px; 
}

#selection-bar {
    display: flex; 
    justify-content: space-between; 
    align-items: center;
    margin-bottom: 20px; 
    background: #192734; 
    padding: 15px 25px;
    border-radius: 12px; 
    border: 2px solid #38444d;
}

#word-preview { 
    font-size: 24px; 
    font-weight: 900; 
    color: #1da1f2; 
    display: block; 
}

#score-preview { 
    font-size: 28px; 
    font-weight: 900; 
}

/* 4. GRID & TILES */
#grid-container { 
    display: grid; 
    grid-template-columns: repeat(5, 1fr); 
    gap: 12px; 
    background: #192734; 
    padding: 15px; 
    border-radius: 18px; 
    border: 2px solid #38444d;
}

.tile { 
    background: white; 
    color: #15202b; 
    border-radius: 10px; 
    aspect-ratio: 1; 
    position: relative; 
    box-shadow: 0 5px #ccd6dd; 
    transition: transform 0.1s; 
    cursor: pointer;
}

/* Multiplier Badge Styling */
.bonus-badge {
    position: absolute; 
    top: 4px; 
    left: 4px; 
    font-size: 10px; 
    font-weight: 900;
    padding: 1px 4px; 
    border-radius: 3px; 
    color: white; 
    line-height: 1;
    z-index: 10;
}

.tile.dl .bonus-badge { background: #1da1f2; }
.tile.tl .bonus-badge { background: #794bc4; }
.tile.dw .bonus-badge { background: #f45d22; }
.tile.tw .bonus-badge { background: #e0245e; }

.tile.selected { 
    background: #1da1f2 !important; 
    color: white !important; 
    transform: translateY(3px); 
    box-shadow: none; 
}

.tile.remote-select { 
    background: #ffad1f !important; 
    border: 3px dashed white; 
    box-shadow: none; 
}

/* Turn States */
body.not-my-turn .tile { 
    filter: grayscale(0.7); 
    opacity: 0.5; 
    cursor: not-allowed; 
}

body.game-paused #grid-container { 
    filter: blur(5px); 
    pointer-events: none; 
}

.tile-inner { 
    width: 100%; 
    height: 100%; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    pointer-events: none; 
}

.tile-letter { 
    font-size: 38px; 
    font-weight: 900; 
}

.tile-pts { 
    position: absolute; 
    top: 5px; 
    right: 8px; 
    font-size: 12px; 
    opacity: 0.4; 
}

/* 5. SIDEBAR & LEADERBOARD */
#sidebar { 
    width: 280px; 
    background: #192734; 
    border-radius: 15px; 
    padding: 25px; 
    border: 2px solid #38444d; 
}

.player-row { 
    display: flex; 
    justify-content: space-between; 
    padding: 15px; 
    border-bottom: 1px solid #38444d; 
}

.sidebar-header { 
    margin-bottom: 20px; 
    border-bottom: 2px solid #1da1f2; 
    padding-bottom: 10px; 
}

/* 6. ANIMATIONS */
.fly-to-score {
    position: fixed; 
    z-index: 1000; 
    pointer-events: none;
    background: #17bf63 !important; 
    color: white !important;
    animation: flyEffect 0.7s forwards ease-in-out;
}

@keyframes flyEffect {
    100% { 
        transform: translate(var(--fly-x), var(--fly-y)) scale(0); 
        opacity: 0; 
    }
}

.shake-red { 
    animation: shake 0.2s 2; 
    background: #e0245e !important; 
    color: white !important; 
}

@keyframes shake {
    25% { transform: translateX(-8px); }
    75% { transform: translateX(8px); }
}