/* ========== WORD DUEL ========== */

.wordduel-stage {
    display: grid;
    gap: 1rem;
    padding: 1.1rem;
    border-radius: 1.2rem;
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.96), rgba(248, 244, 236, 0.92));
    border: 1px solid rgba(242, 165, 65, 0.35);
}

.wordduel-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.wordduel-round,
.wordduel-timer {
    padding: 0.3rem 0.7rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.wordduel-round {
    background: rgba(242, 165, 65, 0.2);
    color: #9a4a1b;
}

.wordduel-timer {
    background: rgba(195, 80, 31, 0.12);
    color: #b04a1d;
}

/* The letter rack is the container: the letters size off the width actually available to them,
   not the viewport, because this row sits inside the drawer-offset main area. */
.wordduel-letters {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    container-type: inline-size;
}

/* Narrow-screen contract: the letter count is a property of the word, not of the screen, so no
   amount of fluid sizing can promise one row -- flex-wrap stays the backstop. What this does
   promise is a floor: 32x38px, comfortably past 24px, and flex:none keeps wrapping (not
   shrinking) the release valve so the floor actually holds. The cqw terms only bite below
   ~436px of available width, so desktop keeps the original 48x56 exactly.
   At 320px a 7-letter word now fits one row (7*32 + 6*8 = 272 <= 288) where 48px wrapped it. */
.wordduel-letter {
    width: clamp(32px, 11cqw, 48px);
    height: clamp(38px, 13cqw, 56px);
    flex: none;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(0.95rem, 3.4cqw, 1.25rem);
    font-weight: 700;
    color: #5a2a0b;
    background: linear-gradient(180deg, #fff2d9 0%, #f2c98c 100%);
    border: 1px solid rgba(147, 88, 38, 0.25);
    box-shadow: 0 8px 16px rgba(184, 120, 45, 0.25);
}

.wordduel-input {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.wordduel-input input {
    flex: 1;
    min-width: 180px;
    padding: 0.6rem 0.75rem;
    border-radius: 0.75rem;
    border: 1px solid var(--line);
    font-size: 1rem;
    font-family: inherit;
}

.wordduel-input input:focus {
    outline: none;
    border-color: rgba(242, 165, 65, 0.7);
    box-shadow: 0 0 0 3px rgba(242, 165, 65, 0.2);
}

.wordduel-status {
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    background: rgba(185, 52, 52, 0.12);
    color: #b03434;
    font-size: 0.85rem;
    text-align: center;
}

.wordduel-scoreboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.75rem;
}

.wordduel-score-card {
    display: grid;
    gap: 0.2rem;
    padding: 0.6rem 0.85rem;
    border-radius: 0.9rem;
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(242, 165, 65, 0.2);
}

.wordduel-score-name {
    font-size: 0.75rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.wordduel-score-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: #a84b1e;
}

.wordduel-feed {
    display: grid;
    gap: 0.35rem;
    max-height: 180px;
    overflow-y: auto;
    padding-right: 0.2rem;
}

.wordduel-feed-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.55rem;
    border-radius: 0.75rem;
    background: rgba(255, 255, 255, 0.75);
    border: 1px solid rgba(242, 165, 65, 0.12);
    font-size: 0.85rem;
}

.wordduel-feed-row.me {
    background: rgba(242, 165, 65, 0.22);
    border-color: rgba(242, 165, 65, 0.3);
}

.wordduel-feed-name {
    font-size: 0.75rem;
    color: var(--muted);
}

.wordduel-feed-word {
    font-weight: 600;
    color: #4a2a0f;
}

.wordduel-feed-points {
    font-weight: 600;
    color: #b45a18;
}
