.room { display: flex; flex-direction: column; gap: .8rem; padding-bottom: 6rem; }

@media (min-width: 768px) { .room { padding-bottom: 2rem; } }

.room__head { display: flex; align-items: center; gap: .7rem; }

.room__head > div { flex: 1; min-width: 0; }

.room__head h1 { margin: 0; font-size: 1.25rem; font-weight: 800; color: var(--foreground); }

.room__head p { margin: .1rem 0 0; font-size: .85rem; color: var(--muted-foreground); }

.room__back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--foreground);
    text-decoration: none;
    font-size: 1.2rem;
}

[dir="ltr"] .room__back { transform: scaleX(-1); }

.room__timer { padding: .35rem .75rem; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-weight: 800; color: var(--foreground); font-variant-numeric: tabular-nums; }

.room__help-btn {
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: color-mix(in srgb, var(--surface) 90%, var(--primary));
    color: var(--primary);
    font-size: 0.82rem;
    font-weight: 800;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.room__help-btn:hover {
    background: var(--primary);
    color: var(--primary-foreground, #fff);
    border-color: var(--primary);
}

.room__timer.is-low { border-color: #f59e0b; background: color-mix(in srgb, #f59e0b 14%, var(--surface)); }

.room__error { margin: 0; padding: .7rem 1rem; border-radius: .9rem; background: color-mix(in srgb, #dc2626 10%, var(--surface)); color: var(--foreground); }

.room__skeleton { height: 18rem; border-radius: 1.2rem; background: color-mix(in srgb, var(--foreground) 6%, var(--surface)); }

.room__players { margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: .45rem; }

.room__players li {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .3rem .7rem .3rem .35rem;
    border-radius: 999px;
    border: 2px solid transparent;
    background: var(--surface);
    color: var(--foreground);
    font-size: .88rem;
}

.room__players li.is-turn { border-color: var(--seat-color); }

.room__players li.is-me .room__name { font-weight: 800; }

.room__avatar { display: inline-flex; align-items: center; justify-content: center; width: 1.8rem; height: 1.8rem; border-radius: 999px; background: var(--seat-color); color: #fff; font-weight: 800; }

.room__points { font-weight: 800; color: var(--primary); }

.room__tag { padding: 0 .5rem; border-radius: 999px; font-size: .75rem; font-weight: 700; background: color-mix(in srgb, var(--primary) 12%, var(--surface)); color: var(--primary); }

.room__ready { font-size: .8rem; font-weight: 700; color: var(--muted-foreground); }

.room__ready.is-ready { color: #15803d; }

.room__player-cheer-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.85rem;
    height: 1.85rem;
    padding: 0;
    border-radius: 999px;
    border: 1px solid color-mix(in srgb, #f59e0b 50%, var(--border));
    background: color-mix(in srgb, #f59e0b 16%, var(--surface));
    font-size: 0.95rem;
    cursor: pointer;
    transition: transform 0.15s ease, background 0.15s ease;
    margin-inline-start: 0.25rem;
}

.room__player-cheer-btn:hover:not(:disabled) {
    transform: scale(1.15);
    background: color-mix(in srgb, #f59e0b 32%, var(--surface));
}

.room__player-cheer-btn:disabled {
    opacity: 0.5;
    cursor: default;
    transform: none;
}

.room__players .seat-1 { --seat-color: #2563eb; }
.room__players .seat-2 { --seat-color: #db2777; }
.room__players .seat-3 { --seat-color: #059669; }
.room__players .seat-4 { --seat-color: #d97706; }
.room__players .seat-5 { --seat-color: #7c3aed; }
.room__players .seat-6 { --seat-color: #0f766e; }

.room__message { margin: 0; padding: .55rem .9rem; border-radius: .9rem; background: var(--surface); border: 1px solid var(--border); color: var(--foreground); font-weight: 700; text-align: center; }

.room__message.is-good { border-color: #16a34a; background: color-mix(in srgb, #16a34a 10%, var(--surface)); }

.room__outcome { display: flex; flex-direction: column; gap: .2rem; padding: .9rem 1rem; border-radius: 1rem; border: 1px solid var(--border); background: var(--surface); color: var(--foreground); text-align: center; }

.room__outcome strong { font-size: 1.1rem; }

.room__outcome small { color: var(--muted-foreground); }

.room__outcome.is-winner { border-color: #f59e0b; background: color-mix(in srgb, #f59e0b 12%, var(--surface)); }

/* The winner, by name, for everyone in the room. Fixed over the board for a few seconds; a tap closes it. */
.room__party {
    position: fixed;
    inset-inline: 1rem;
    top: 22%;
    z-index: 60;
    max-width: 24rem;
    margin-inline: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .35rem;
    padding: 1.2rem 1rem 1.1rem;
    border-radius: 1.4rem;
    border: 2px solid #f59e0b;
    background: color-mix(in srgb, #f59e0b 14%, var(--surface));
    color: var(--foreground);
    box-shadow: 0 18px 40px -18px rgb(0 0 0 / .45);
    font: inherit;
    animation: room-party-in .45s cubic-bezier(.2, 1.4, .4, 1) both;
}

.room__party-close {
    position: absolute;
    top: 0.6rem;
    inset-inline-end: 0.6rem;
    width: 2rem;
    height: 2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--muted-foreground);
    font-size: 1.1rem;
    font-weight: 700;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.room__party-close:hover {
    background: color-mix(in srgb, var(--foreground) 10%, transparent);
    color: var(--foreground);
}

.room__cheer-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    margin-block-start: 0.6rem;
    padding: 0.55rem 1.4rem;
    border-radius: 999px;
    border: 1px solid #16a34a;
    background: #16a34a;
    color: #ffffff;
    font-size: 1.05rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.28);
    transition: transform 0.15s ease, background 0.15s ease;
}

.room__cheer-btn:hover:not(:disabled) {
    background: #15803d;
    transform: scale(1.04);
}

.room__cheer-btn:disabled {
    background: color-mix(in srgb, #16a34a 25%, var(--surface));
    border-color: color-mix(in srgb, #16a34a 35%, var(--border));
    color: var(--muted-foreground);
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.room__cheer-btn--party {
    margin-block-start: 0.5rem;
    padding: 0.65rem 1.8rem;
    font-size: 1.15rem;
    animation: room-cheer-bounce 1.6s infinite ease-in-out;
}

@keyframes room-cheer-bounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.06); }
}

@media (prefers-reduced-motion: reduce) {
    .room__cheer-btn--party { animation: none; }
}

.room__cheer-toast {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-inline: auto;
    padding: 0.55rem 1.2rem;
    border-radius: 999px;
    border: 1px solid #16a34a;
    background: color-mix(in srgb, #16a34a 15%, var(--surface));
    color: var(--foreground);
    font-weight: 800;
    font-size: 1rem;
    animation: room-party-in 0.25s ease-out;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
}

.room__party strong { font-size: 1.35rem; font-weight: 900; line-height: 1.35; text-align: center; }

.room__party span { font-weight: 700; color: var(--muted-foreground); text-align: center; }

.room__party-icon { font-size: 2.8rem; line-height: 1; color: inherit; }

@keyframes room-party-in {
    from { transform: scale(.6) translateY(20px); opacity: 0; }
    to { transform: none; opacity: 1; }
}

.room__treasure {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .5rem;
    padding: 1rem;
    border-radius: 1.2rem;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--foreground);
    text-align: center;
}

.room__treasure.is-found { border-color: #f59e0b; background: linear-gradient(180deg, color-mix(in srgb, #f59e0b 18%, var(--surface)), var(--surface)); }

.room__treasure h2 { margin: 0; font-size: 1.15rem; font-weight: 900; line-height: 1.45; }

.room__chest { position: relative; font-size: 3rem; line-height: 1; height: 3.4rem; }

.room__chest-lid { display: inline-block; animation: room-chest-open 1.2s ease-out .2s both; }

.room__chest-prize { position: absolute; inset-inline: 0; top: -.4rem; font-size: 1.6rem; animation: room-chest-shine 1.6s ease-out .9s both; }

@keyframes room-chest-open {
    0% { transform: scale(.8) rotate(0); }
    40% { transform: scale(1.15) rotate(-8deg); }
    70% { transform: scale(1.05) rotate(6deg); }
    100% { transform: scale(1) rotate(0); }
}

@keyframes room-chest-shine {
    from { transform: translateY(10px) scale(.4); opacity: 0; }
    to { transform: translateY(-14px) scale(1.2); opacity: 1; }
}

.room__credits { margin: 0; padding: 0; list-style: none; width: 100%; display: flex; flex-direction: column; gap: .35rem; }

.room__credits li {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    justify-content: flex-start;
    padding: .5rem .7rem;
    border-radius: .8rem;
    background: color-mix(in srgb, var(--primary) 6%, var(--surface));
    text-align: start;
    line-height: 1.5;
}

@media (prefers-reduced-motion: reduce) {
    .room__party, .room__chest-lid, .room__chest-prize { animation: none; }
}

.room__hint { align-self: flex-start; min-height: 2.6rem; padding: .3rem 1rem; border-radius: 999px; border: 1px solid color-mix(in srgb, #f59e0b 50%, var(--border)); background: color-mix(in srgb, #f59e0b 10%, var(--surface)); color: var(--foreground); font-weight: 800; cursor: pointer; }

.room__hint-text, .room__watch { margin: 0; color: var(--foreground); font-weight: 700; }

.room__watch--live, .room__live-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 0.9rem;
    border-radius: 999px;
    background: color-mix(in srgb, #ef4444 14%, var(--surface));
    color: #dc2626;
    border: 1px solid color-mix(in srgb, #ef4444 35%, var(--border));
    font-size: 0.9rem;
    font-weight: 800;
}

.room__live-dot {
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 999px;
    background: #ef4444;
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    animation: room-live-pulse 1.5s infinite;
}

@keyframes room-live-pulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 6px rgba(239, 68, 68, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

.room__confirm { flex-basis: 100%; margin: 0; font-weight: 700; color: var(--foreground); }

.room__btn--danger { background: #dc2626; border-color: #dc2626; color: #fff; }

.room__stopped {
    margin: 0;
    padding: .7rem .9rem;
    border-radius: 1rem;
    border: 1px solid color-mix(in srgb, var(--primary) 35%, var(--border));
    background: color-mix(in srgb, var(--primary) 8%, var(--surface));
    color: var(--foreground);
    font-weight: 700;
    line-height: 1.5;
}

.room__rules { margin: 0; font-size: .8rem; color: var(--muted-foreground); text-align: center; }

.room__actions { display: flex; flex-wrap: wrap; gap: .5rem; }

.room__btn {
    flex: 1 1 9rem;
    min-height: 3rem;
    padding: .5rem 1rem;
    border-radius: 999px;
    border: 1px solid color-mix(in srgb, var(--primary) 45%, var(--border));
    background: var(--surface);
    color: var(--foreground);
    font-weight: 800;
    cursor: pointer;
}

.room__btn--primary { background: var(--primary); border-color: var(--primary); color: var(--primary-foreground, #fff); }

.room__btn--quiet { flex: 0 1 auto; border-color: var(--border); color: var(--muted-foreground); }

.room__btn--small { flex: 0 0 auto; min-height: 2.6rem; padding-inline: 1.1rem; }

.room__invite { display: flex; flex-direction: column; gap: .5rem; padding: .9rem 1rem; border-radius: 1rem; border: 1px solid var(--border); background: var(--surface); }

.room__invite h2 { margin: 0; font-size: 1rem; font-weight: 800; color: var(--foreground); }

.room__invite ul, .room__invited { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: .4rem; }

.room__invite li, .room__invited li { display: flex; align-items: center; justify-content: space-between; gap: .5rem; min-height: 2.6rem; color: var(--foreground); }

.room__invite em { font-style: normal; font-size: .85rem; color: var(--muted-foreground); }

.room__invited li { font-size: .9rem; color: var(--muted-foreground); }

.room__muted { margin: 0; color: var(--muted-foreground); }

.room__link { min-height: 2.6rem; padding: 0 .6rem; border: 0; background: none; color: var(--primary); font-weight: 700; cursor: pointer; }

.room__btn:disabled, .room__hint:disabled { opacity: .6; cursor: default; }

.room__btn:focus-visible, .room__hint:focus-visible, .room__back:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
