/* =========================================================
   HANGMAN RESCUE - SAFE STATIC INDEX LOBBY
   ========================================================= */

.hr-index-lobby {
    position: relative;

    display: none;

    width: min(980px, calc(100% - 24px));
    box-sizing: border-box;

    margin: 14px auto 20px;
    padding: 22px;

    overflow: hidden;

    border: 4px solid #aa6516;
    border-radius: 24px;

    background:
        radial-gradient(
            circle at 15% 0%,
            rgba(255, 203, 62, 0.16),
            transparent 35%
        ),
        linear-gradient(
            180deg,
            rgba(52, 30, 11, 0.99),
            rgba(10, 29, 49, 0.99)
        );

    box-shadow:
        inset 0 0 0 2px rgba(255, 222, 122, 0.16),
        0 18px 45px rgba(0, 0, 0, 0.58),
        0 0 28px rgba(255, 175, 35, 0.14);

    color: #ffffff;
}

.hr-index-lobby.hr-visible {
    display: block;

    animation:
        hrIndexLobbyEnter 520ms
        cubic-bezier(0.18, 0.84, 0.24, 1.12);
}

.hr-index-lobby__glow {
    position: absolute;
    inset: -40%;

    pointer-events: none;

    opacity: 0.12;

    background:
        repeating-conic-gradient(
            from 0deg,
            rgba(255, 213, 84, 0.22) 0deg 8deg,
            transparent 8deg 22deg
        );

    animation:
        hrIndexLobbyGlow 30s linear infinite;
}

.hr-index-lobby > *:not(.hr-index-lobby__glow) {
    position: relative;
    z-index: 2;
}

.hr-index-lobby__heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;

    margin-bottom: 18px;
}

.hr-index-lobby__heading small {
    display: block;

    color: #cfaa57;

    font-size: 11px;
    font-weight: 900;

    letter-spacing: 0.16em;
}

.hr-index-lobby__heading h1 {
    margin: 3px 0 4px;

    color: #ffe18b;

    font-family:
        Georgia,
        "Times New Roman",
        serif;

    font-size: clamp(28px, 5vw, 46px);
    line-height: 1.05;

    text-shadow:
        0 3px 0 #713605,
        0 5px 8px rgba(0, 0, 0, 0.65);
}

.hr-index-lobby__heading p {
    margin: 0;

    color: #d5e7f5;

    font-size: 14px;
    font-weight: 700;
}

.hr-index-lobby__captain {
    display: none;

    flex: 0 0 auto;

    padding: 8px 13px;

    border: 2px solid #f0c65c;
    border-radius: 999px;

    background:
        rgba(104, 60, 9, 0.92);

    color: #ffe6a0;

    font-size: 11px;
    font-weight: 900;

    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.hr-index-lobby__captain.hr-visible {
    display: inline-flex;
}

.hr-index-lobby__content {
    display: grid;
    grid-template-columns:
        minmax(0, 0.9fr)
        minmax(0, 1.1fr);

    gap: 16px;
}

.hr-index-lobby__room-card,
.hr-index-lobby__crew-card {
    padding: 17px;

    border: 2px solid rgba(210, 148, 41, 0.56);
    border-radius: 16px;

    background:
        rgba(8, 23, 39, 0.74);

    box-shadow:
        inset 0 0 14px rgba(255, 220, 109, 0.05);
}

.hr-index-lobby__label {
    display: block;

    margin-bottom: 5px;

    color: #bcd3e7;

    font-size: 11px;
    font-weight: 900;

    letter-spacing: 0.13em;
    text-transform: uppercase;
}

#indexLobbyRoomCode {
    display: block;

    color: #fff0a1;

    font-family:
        ui-monospace,
        SFMono-Regular,
        Menlo,
        Consolas,
        monospace;

    font-size: clamp(30px, 6vw, 52px);
    font-weight: 900;

    letter-spacing: 0.08em;

    text-shadow:
        0 3px 4px rgba(0, 0, 0, 0.72),
        0 0 17px rgba(255, 203, 55, 0.33);
}

.hr-index-lobby__share-buttons {
    display: grid;
    grid-template-columns:
        repeat(3, minmax(0, 1fr));

    gap: 8px;

    margin-top: 16px;
}

.hr-index-lobby__share-buttons button,
.hr-index-lobby__actions button {
    min-height: 44px;

    padding: 9px 11px;

    border: 2px solid #9d6724;
    border-radius: 11px;

    background:
        linear-gradient(
            180deg,
            #34536e,
            #172f45
        );

    color: #ffffff;

    font-size: 12px;
    font-weight: 900;

    cursor: pointer;

    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.13),
        0 4px 9px rgba(0, 0, 0, 0.32);
}

.hr-index-lobby__share-buttons button.primary,
.hr-index-lobby__actions button.primary {
    border-color: #edbd49;

    background:
        linear-gradient(
            180deg,
            #d88b17,
            #7d3d08
        );

    color: #fff8d4;
}

.hr-index-lobby__notice {
    min-height: 18px;

    margin-top: 8px;

    color: #9febba;

    font-size: 11px;
    font-weight: 800;
    text-align: center;
}

.hr-index-lobby__crew-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;

    margin-bottom: 11px;
}

.hr-index-lobby__crew-heading > div {
    display: flex;
    align-items: center;
    gap: 7px;

    color: #ffe08b;

    font-size: 17px;
}

#indexLobbyReadyCount {
    padding: 5px 9px;

    border: 1px solid rgba(150, 190, 221, 0.35);
    border-radius: 999px;

    background:
        rgba(28, 61, 87, 0.61);

    color: #d8ecfb;

    font-size: 10px;
    font-weight: 900;
}

.hr-index-lobby__players {
    display: grid;
    gap: 8px;

    max-height: 300px;
    overflow-y: auto;
}

.hr-index-lobby-player {
    display: grid;
    grid-template-columns:
        auto minmax(0, 1fr) auto;

    align-items: center;
    gap: 9px;

    padding: 10px;

    border: 1px solid rgba(169, 120, 47, 0.48);
    border-radius: 11px;

    background:
        linear-gradient(
            180deg,
            rgba(49, 64, 79, 0.92),
            rgba(21, 35, 49, 0.94)
        );
}

.hr-index-lobby-player.hr-ready {
    border-color:
        rgba(73, 222, 120, 0.72);

    background:
        linear-gradient(
            180deg,
            rgba(31, 101, 59, 0.88),
            rgba(18, 60, 37, 0.94)
        );
}

.hr-index-lobby-player__icon {
    font-size: 22px;
}

.hr-index-lobby-player__identity {
    min-width: 0;
}

.hr-index-lobby-player__identity strong {
    display: block;

    overflow: hidden;

    color: #ffffff;

    font-size: 15px;

    text-overflow: ellipsis;
    white-space: nowrap;
}

.hr-index-lobby-player__identity small {
    display: block;

    margin-top: 3px;

    color: #c5d8e8;

    font-size: 10px;
}

.hr-index-lobby-player__ready {
    color: #ffd978;

    font-size: 11px;
    font-weight: 900;
}

.hr-index-lobby__status {
    margin-top: 11px;
    padding: 9px 11px;

    border: 1px solid rgba(135, 179, 211, 0.31);
    border-radius: 10px;

    background:
        rgba(25, 55, 79, 0.52);

    color: #d7eaff;

    font-size: 12px;
    font-weight: 800;
    text-align: center;
}

.hr-index-lobby__status.hr-all-ready {
    border-color:
        rgba(77, 228, 126, 0.63);

    background:
        rgba(18, 88, 47, 0.63);

    color: #caffda;
}

.hr-index-lobby__footer {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 15px;

    margin-top: 17px;
    padding-top: 16px;

    border-top:
        1px solid rgba(255, 255, 255, 0.10);
}

.hr-index-lobby__match {
    display: none;
    flex-direction: column;
    gap: 5px;

    min-width: 220px;
}

.hr-index-lobby__match.hr-visible {
    display: flex;
}

.hr-index-lobby__match label {
    color: #d4b661;

    font-size: 10px;
    font-weight: 900;

    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.hr-index-lobby__match select {
    min-height: 42px;

    padding: 7px 10px;

    border: 2px solid #a66a1d;
    border-radius: 10px;

    background: #122a3e;
    color: #ffffff;

    font-size: 13px;
    font-weight: 800;
}

.hr-index-lobby__actions {
    display: flex;
    gap: 9px;
}

#indexLobbyStartBtn {
    min-width: 175px;
}

#indexLobbyStartBtn:disabled {
    opacity: 0.52;
    cursor: not-allowed;

    filter:
        grayscale(0.35);
}

#indexLobbyReadyBtn.hr-ready {
    border-color: #79e5a0;

    background:
        linear-gradient(
            180deg,
            #29965a,
            #125e37
        );

    color: #effff4;
}

/* Hide the regular board only while the lobby is active. */
body.hr-static-lobby-active .game-layout {
    display: none !important;
}

/* Keep the original controls available to the client code but hidden. */
body.hr-static-lobby-active .lobby-actions {
    position: absolute !important;

    width: 1px !important;
    height: 1px !important;

    overflow: hidden !important;

    opacity: 0 !important;
    pointer-events: none !important;
}

@keyframes hrIndexLobbyEnter {
    0% {
        opacity: 0;

        transform:
            translateY(15px)
            scale(0.97);
    }

    100% {
        opacity: 1;

        transform:
            translateY(0)
            scale(1);
    }
}

@keyframes hrIndexLobbyGlow {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 700px) {
    .hr-index-lobby {
        width:
            calc(100% - 10px);

        margin:
            8px auto 14px;

        padding:
            14px;

        border-width:
            3px;

        border-radius:
            17px;
    }

    .hr-index-lobby__heading {
        flex-direction: column;
        gap: 9px;
    }

    .hr-index-lobby__heading h1 {
        font-size: 29px;
    }

    .hr-index-lobby__heading p {
        font-size: 12px;
    }

    .hr-index-lobby__content {
        grid-template-columns:
            1fr;
    }

    .hr-index-lobby__room-card,
    .hr-index-lobby__crew-card {
        padding: 12px;
    }

    #indexLobbyRoomCode {
        font-size: 30px;
    }

    .hr-index-lobby__share-buttons {
        grid-template-columns:
            1fr 1fr;
    }

    #indexLobbyShare {
        grid-column:
            1 / -1;
    }

    .hr-index-lobby__footer {
        flex-direction: column;
        align-items: stretch;
    }

    .hr-index-lobby__match {
        width: 100%;
        min-width: 0;
    }

    .hr-index-lobby__actions {
        display: grid;
        grid-template-columns:
            1fr 1fr;
    }

    #indexLobbyStartBtn {
        min-width: 0;
    }
}

@media (max-width: 430px) {
    .hr-index-lobby__share-buttons,
    .hr-index-lobby__actions {
        grid-template-columns:
            1fr;
    }

    #indexLobbyShare {
        grid-column:
            auto;
    }

    .hr-index-lobby-player__identity strong {
        font-size: 14px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .hr-index-lobby,
    .hr-index-lobby * {
        animation:
            none !important;

        transition-duration:
            1ms !important;
    }
}
