/* ---------- Word Duel (original word-tile board, player vs AI) ---------- */

.wd-wrap {
    width: 100%;
    max-width: 640px;
    margin: 0 auto;
    padding: 4px 0;
    box-sizing: border-box;
    position: relative;
}

/* On desktop the fixed 640px board dwarfed the rest of the page next to
   it, but a fixed smaller cap (e.g. a flat 460px) also felt wrong: it
   stayed exactly the same size no matter how wide the browser window
   got. This scales with the viewport instead — smaller than before on a
   typical laptop, but it keeps growing on a bigger monitor, up to a
   sensible cap so it never gets as oversized as the original again. */
@media (min-width: 900px) {
    .wd-wrap {
        max-width: clamp(400px, 36vw, 720px);
    }
}

.wd-scores {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}

.wd-score-box {
    flex: 1;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    padding: 8px 6px;
    text-align: center;
}

.wd-score-label {
    display: block;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(231, 238, 245, 0.6);
}

.wd-score-val {
    display: block;
    font-size: 1.3rem;
    font-weight: 700;
    color: #E7EEF5;
}

.wd-score-you .wd-score-val { color: #35D48A; }
.wd-score-ai .wd-score-val { color: #E6007A; }
.wd-score-time .wd-score-val { color: #FFC400; font-variant-numeric: tabular-nums; }

/* under a minute left on the player's clock — a clear "hurry up" cue */
.wd-time-low .wd-score-val {
    color: #E6007A;
    animation: wd-time-pulse 1s ease-in-out infinite;
}

@keyframes wd-time-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.45; }
}

.wd-status {
    text-align: center;
    color: #E7EEF5;
    font-size: 0.92rem;
    min-height: 1.4em;
    margin-bottom: 10px;
    padding: 0 6px;
}

.wd-board {
    display: grid;
    grid-template-columns: repeat(15, 1fr);
    grid-template-rows: repeat(15, 1fr);
    gap: 2px;
    width: 100%;
    aspect-ratio: 1 / 1;
    margin: 0 auto;
    background: rgba(0, 0, 0, 0.25);
    padding: 4px;
    border-radius: 8px;
    box-sizing: border-box;
}

.wd-cell {
    position: relative;
    background: #16233F;
    border-radius: 3px;
    aspect-ratio: 1 / 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.wd-bonus-label {
    font-size: clamp(6px, 1.6vw, 9px);
    font-weight: 700;
    color: rgba(255, 255, 255, 0.55);
    pointer-events: none;
}

.wd-b-dl { background: #1C4A63; }
.wd-b-tl { background: #14647A; }
.wd-b-dw { background: #5A2A55; }
.wd-b-tw { background: #7A1E4A; }
.wd-b-center { background: #7A1E4A; }

.wd-cell-filled { cursor: default; }

.wd-cell-pending { box-shadow: inset 0 0 0 2px #35D48A; }
.wd-cell-picked-up {
    box-shadow: inset 0 0 0 2px #FFC400, 0 0 10px rgba(255, 196, 0, 0.7);
    z-index: 5;
}
.wd-cell-picked-up .wd-tile { transform: scale(1.08); }
.wd-cell-just-player { box-shadow: inset 0 0 0 2px rgba(53, 212, 138, 0.6); }
.wd-cell-just-ai { box-shadow: inset 0 0 0 2px rgba(230, 0, 122, 0.6); }

.wd-tile {
    position: absolute;
    inset: 1px;
    background: #F2E6C9;
    border-radius: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.wd-tile-blank { background: #DCE7E0; }

.wd-tile-letter {
    font-weight: 700;
    color: #23324A;
    font-size: clamp(8px, 2.6vw, 17px);
    line-height: 1;
}

.wd-tile-value {
    position: absolute;
    bottom: 1px;
    right: 2px;
    font-size: clamp(5px, 1.1vw, 8px);
    color: #5A6A80;
    line-height: 1;
}

.wd-rack {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    margin: 14px 0;
    min-height: 52px;
}

.wd-rack-tile {
    position: relative;
    width: 44px;
    height: 44px;
    background: #F2E6C9;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
    transition: transform 0.15s;
}

.wd-rack-tile .wd-tile-letter { font-size: 19px; }
.wd-rack-tile .wd-tile-value { font-size: 9px; }

.wd-rack-tile-selected {
    transform: translateY(-6px);
    box-shadow: 0 0 0 3px #35D48A, 0 4px 8px rgba(0, 0, 0, 0.5);
}

.wd-controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-top: 6px;
}

.wd-controls button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* "Finish game now" itself is the shared .play-finish-pill style
   (assets/css/style.css), so it matches the Score/Best pills next to it
   and stays consistent with the same button in other games (e.g. Doom). */

.wd-submit-btn {
    background: linear-gradient(135deg, #E6007A, #B3005C);
    border: none;
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
    padding: 10px 22px;
    border-radius: 999px;
    cursor: pointer;
    box-shadow: 0 3px 8px rgba(230, 0, 122, 0.4);
}

.wd-submit-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    box-shadow: none;
}

.wd-picker {
    position: absolute;
    inset: 0;
    background: rgba(8, 14, 26, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    border-radius: 12px;
}

.wd-picker-card {
    background: #16233F;
    border-radius: 12px;
    padding: 16px;
    max-width: 320px;
    text-align: center;
}

.wd-picker-card p {
    color: #E7EEF5;
    margin: 0 0 10px;
    font-size: 0.9rem;
}

.wd-picker-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
}

.wd-picker-grid button {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    border: none;
    background: #F2E6C9;
    color: #23324A;
    font-weight: 700;
    cursor: pointer;
}

.wd-picker-cancel {
    margin-top: 12px;
}

@media (max-width: 480px) {
    .wd-rack-tile { width: 36px; height: 36px; }
    .wd-rack-tile .wd-tile-letter { font-size: 15px; }
    /* four score boxes (You / Time / Tiles left / AI) get tight on small
       phones — shrink the numbers a touch so nothing wraps awkwardly */
    .wd-scores { gap: 5px; }
    .wd-score-val { font-size: 1.05rem; }
    .wd-score-label { font-size: 0.6rem; }
}
