* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    min-height: 100vh;

    display: flex;
    align-items: center;
    justify-content: center;

    background: #17182b;

    font-family: Arial, Helvetica, sans-serif;
    color: white;
}

/* MAIN MENU */

.menu {
    width: 100%;
    max-width: 650px;

    padding: 30px;

    text-align: center;
}

/* LOGO */

.logo {
    font-size: clamp(3rem, 10vw, 6rem);
    font-weight: 900;

    letter-spacing: -4px;

    margin-bottom: 5px;
}

.subtitle {
    font-size: 1.2rem;
    color: #b7b8ca;

    margin-bottom: 55px;
}

/* BUTTON AREA */

.menu-buttons {
    display: flex;
    flex-direction: column;

    gap: 18px;

    max-width: 400px;
    margin: auto;
}

/* BUTTONS */

.menu-button {
    width: 100%;

    border: none;
    border-radius: 18px;

    padding: 22px;

    font-size: 1.4rem;
    font-weight: bold;

    cursor: pointer;

    transition:
        transform 0.15s ease,
        filter 0.15s ease;
}

.host-button {
    background: #7657ff;
    color: white;
}

.join-button {
    background: #34d399;
    color: #10231c;
}

.menu-button:hover {
    transform: translateY(-3px);
    filter: brightness(1.1);
}

.menu-button:active {
    transform: translateY(1px);
}

/* PHONE */

@media (max-width: 600px) {

    .menu {
        padding: 22px;
    }

    .logo {
        letter-spacing: -2px;
    }

    .subtitle {
        margin-bottom: 40px;
    }

    .menu-button {
        padding: 20px;
    }
}

/* -------------------------------- */
/* GAME MODE SELECTION              */
/* -------------------------------- */

.small-heading:empty, .game-panel-message:empty { display: none; }

.small-heading {
    color: #8f91ad;

    font-size: 0.9rem;
    font-weight: bold;

    letter-spacing: 3px;

    margin-bottom: 10px;
}

.screen-title {
    font-size: clamp(2.5rem, 7vw, 4.5rem);
    font-weight: 900;

    margin-bottom: 45px;
}

.game-modes {
    display: flex;
    flex-direction: column;

    gap: 18px;

    max-width: 520px;
    margin: auto;
}

.play-style-panel {
    max-width: 520px;
    margin: -15px auto 32px;
}

.play-style-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.play-style-options:has([data-play-mode="solo"]) {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.play-style-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 105px;
    padding: 17px;
    border: 2px solid #3d4062;
    border-radius: 16px;
    background: #22243b;
    color: white;
    cursor: pointer;
    text-align: center;
}

.play-style-button strong { font-size: 1.1rem; }

.play-style-button span {
    color: #b7b8ca;
    font-size: 0.85rem;
    line-height: 1.3;
}

.play-style-button.selected {
    border-color: #34d399;
    background: #293947;
}

.play-style-button:focus-visible {
    outline: 3px solid #7657ff;
    outline-offset: 3px;
}

.play-style-summary {
    margin: -30px 0 30px;
    color: #34d399;
    font-weight: 900;
    letter-spacing: 0.12em;
}

.host-identity {
    margin-top: 14px;
    padding: 20px;
    border-radius: 16px;
    background: #22243b;
    text-align: left;
}

.host-identity label {
    display: block;
    margin-bottom: 8px;
    color: #b7b8ca;
    font-size: 0.8rem;
    font-weight: 900;
    letter-spacing: 0.12em;
}

.host-identity .emoji-title {
    margin-top: 18px;
}

.host-identity .join-error {
    margin-top: 12px;
}

.game-mode {
    width: 100%;

    display: flex;
    align-items: center;

    gap: 22px;

    padding: 24px;

    border: none;
    border-radius: 20px;

    cursor: pointer;

    text-align: left;

    transition:
        transform 0.15s ease,
        filter 0.15s ease;
}

.game-mode:hover {
    transform: translateY(-3px);
    filter: brightness(1.08);
}

.game-mode:active {
    transform: translateY(1px);
}

.trivia-mode {
    background: #7657ff;
    color: white;
}

.drawing-mode {
    background: #34d399;
    color: #10231c;
}

.imposter-mode {
    background: #f87171;
    color: #2a151a;
}

.flappy-mode {
    background: #64b5ff;
    color: #10243b;
}

.range-mode { background: #ffb357; color: #2b1b12; }
.memory-mode { background: #df90e9; color: #28172f; }

.range-settings-page { display: block; min-height: 100dvh; }
.range-settings-page .menu { margin: 0 auto; }
.range-settings-page .category-filter-list { max-height: min(55dvh, 520px); }
.memory-settings-page { display: block; min-height: 100dvh; }
.memory-settings-page .menu { margin: 0 auto; }
.memory-settings-page .category-filter-list { max-height: min(55dvh, 520px); }

.game-mode:disabled { opacity: .45; cursor: not-allowed; transform: none; }

.game-icon {
    font-size: 3rem;
}

.game-info {
    display: flex;
    flex-direction: column;

    gap: 5px;
}

.game-name {
    font-size: 1.4rem;
    font-weight: 900;
}

.game-description {
    font-size: 0.95rem;
    opacity: 0.8;
}

.back-button {
    margin-top: 35px;

    padding: 12px 20px;

    border: none;
    background: transparent;

    color: #8f91ad;

    font-size: 1rem;
    font-weight: bold;

    cursor: pointer;
}

.back-button:hover {
    color: white;
}


/* PHONE */

@media (max-width: 600px) {

    .play-style-options,
    .play-style-options:has([data-play-mode="solo"]) { grid-template-columns: 1fr; }

    .play-style-button { min-height: 0; }

    .game-mode {
        padding: 20px;
        gap: 15px;
    }

    .game-icon {
        font-size: 2.4rem;
    }

    .game-name {
        font-size: 1.15rem;
    }

    .game-description {
        font-size: 0.85rem;
    }
}

/* -------------------------------- */
/* TRIVIA SETTINGS                  */
/* -------------------------------- */

.settings-panel {
    width: 100%;
    max-width: 600px;

    margin: auto;

    display: flex;
    flex-direction: column;

    gap: 18px;
}

.setting {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 30px;

    padding: 25px;

    background: #22243b;

    border-radius: 20px;
}

.setting-text {
    display: flex;
    flex-direction: column;

    gap: 6px;

    text-align: left;
}

.setting-name {
    font-size: 1.1rem;
    font-weight: 900;
}

.setting-description {
    color: #9fa1ba;

    font-size: 0.9rem;
}

.number-selector {
    display: flex;
    align-items: center;

    gap: 14px;
}

.number-button {
    width: 48px;
    height: 48px;

    border: none;
    border-radius: 12px;

    background: #7657ff;
    color: white;

    font-size: 1.7rem;
    font-weight: bold;

    cursor: pointer;

    transition:
        transform 0.1s ease,
        filter 0.1s ease;
}

.number-button:hover {
    filter: brightness(1.15);
}

.number-button:active {
    transform: scale(0.92);
}

.number-display {
    min-width: 55px;

    display: flex;
    flex-direction: column;

    align-items: center;
}

.number-display span {
    font-size: 2rem;
    font-weight: 900;
}

.number-display small {
    color: #8587a3;

    font-size: 0.65rem;
    font-weight: bold;
}

.create-game-button {
    width: 100%;
    max-width: 600px;

    margin-top: 30px;

    padding: 20px;

    border: none;
    border-radius: 16px;

    background: #34d399;
    color: #10231c;

    font-size: 1.2rem;
    font-weight: 900;

    cursor: pointer;

    transition:
        transform 0.15s ease,
        filter 0.15s ease;
}

.create-game-button:hover {
    transform: translateY(-2px);
    filter: brightness(1.08);
}

.create-game-button:active {
    transform: translateY(1px);
}


@media (max-width: 600px) {

    .setting {
        flex-direction: column;
        align-items: stretch;

        gap: 20px;
    }

    .setting-text {
        text-align: center;
    }

    .number-selector {
        justify-content: center;
    }
}

/* -------------------------------- */
/* LOBBY                            */
/* -------------------------------- */

.lobby {
    width: 100%;
    max-width: 900px;

    padding: 30px;
    padding-top: 72px;

    text-align: center;
}

.join-instructions {
    margin-bottom: 50px;
}

.join-text {
    color: #a6a8bd;

    font-size: 1.1rem;

    margin-top: 15px;
}

.room-code {
    font-size: clamp(4rem, 12vw, 8rem);

    font-weight: 900;

    letter-spacing: 15px;

    color: #34d399;

    margin-top: 5px;
}

.players-area h2 {
    font-size: 1rem;

    letter-spacing: 3px;

    color: #8f91ad;

    margin-bottom: 20px;
}

.player-list {
    min-height: 130px;

    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr));
    align-items: stretch;

    gap: 16px;

    padding: 25px;

    background: #22243b;

    border-radius: 20px;
}

.waiting-text {
    color: #777a97;
    grid-column: 1 / -1;
    align-self: center;
}

.category-filter {
    width: 100%;
    max-width: 600px;
    margin: 18px auto 0;
    border: 1px solid #3d4062;
    border-radius: 16px;
    background: #22243b;
    text-align: left;
}

.category-filter summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 18px 22px;
    color: white;
    font-weight: 900;
    letter-spacing: .08em;
    cursor: pointer;
    list-style: none;
}
.category-filter summary::-webkit-details-marker { display: none; }
.category-filter summary::after { content: "▾"; color: #34d399; }
.category-filter[open] summary::after { content: "▴"; }
.category-filter summary span { margin-left: auto; color: #34d399; font-size: .72rem; letter-spacing: .03em; }
.category-filter-content { padding: 0 16px 16px; }
.category-filter-actions { display: flex; gap: 8px; margin-bottom: 10px; }
.category-filter-actions button {
    padding: 8px 12px;
    border: 1px solid #4a426f;
    border-radius: 9px;
    background: #2b2e49;
    color: white;
    font-weight: 900;
    cursor: pointer;
}
.category-filter-list { display: grid; gap: 5px; max-height: 260px; overflow-y: auto; }
.category-filter-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 11px;
    border-radius: 9px;
    background: #2b2e49;
    cursor: pointer;
}
.category-filter-option:hover { background: #343753; }
.category-filter-option input { width: 18px; height: 18px; accent-color: #34d399; }

[hidden] {
    display: none !important;
}

.player-card {
    min-width: 0;
    min-height: 150px;
    display: flex;
    flex-direction: column;
    align-items: safe center;
    justify-content: safe center;
    gap: 12px;
    padding: 20px 14px;
    border: 1px solid #3d4062;
    border-radius: 18px;
    background: #2b2e49;
    box-shadow: 0 8px 20px rgba(8, 9, 24, 0.18);
}

.player-card-emoji {
    display: grid;
    place-items: center;
    width: 72px;
    height: 72px;
    border-radius: 18px;
    background: #383b60;
    font-size: 2.6rem;
    line-height: 1;
}

.player-card-name {
    max-width: 100%;
    overflow-wrap: anywhere;
    font-size: 1.15rem;
    font-weight: 900;
    line-height: 1.2;
}

.player-card-away { opacity: .52; border-color: #525469; box-shadow: none; }
.player-card-away .player-card-emoji { filter: grayscale(1); background: #3a3b4e; }
.player-card-status { color: #b7b8ca; font-size: .65rem; font-weight: 900; letter-spacing: .06em; }

.start-game-button {
    width: 100%;
    max-width: 500px;

    margin-top: 30px;

    padding: 20px;

    border: none;
    border-radius: 16px;

    background: #7657ff;
    color: white;

    font-size: 1.2rem;
    font-weight: 900;

    cursor: pointer;
}

.start-game-button:disabled {
    opacity: 0.35;

    cursor: not-allowed;
}

.exit-button {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 10;
    padding: 11px 16px;
    border: 2px solid #b95e6d;
    border-radius: 12px;
    background: #342638;
    color: #ffb2bc;
    font-size: 0.8rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    cursor: pointer;
}

.exit-button:hover,
.exit-button:focus-visible {
    background: #583044;
}

.exit-button:disabled { opacity: 0.5; cursor: wait; }

.return-lobby-button:disabled {
    background: #4b4d63;
    color: #a6a8bd;
    opacity: 1;
}

.game-panel {
    width: 100%;
    max-width: 900px;
    margin: auto;
    text-align: center;
}

.lobby-screen {
    height: 100vh;
    height: 100dvh;
    max-width: 1200px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: clamp(10px, 2vh, 22px);
    padding: clamp(64px, 9vh, 88px) clamp(16px, 3vw, 40px) clamp(14px, 3vh, 30px);
    overflow: hidden;
}

.lobby-screen .join-instructions { flex: none; margin: 0; }
.lobby-screen .join-text { margin-top: 4px; font-size: clamp(0.85rem, 1.6vh, 1.1rem); }
.lobby-screen .room-code {
    margin-top: 0;
    font-size: clamp(2.7rem, min(9vw, 10vh), 7rem);
    line-height: 1.05;
    letter-spacing: 0.12em;
}

.lobby-screen .players-area {
    display: flex;
    flex: 0 1 auto;
    flex-direction: column;
    min-height: 0;
}

.lobby-screen .players-area h2 { flex: none; margin-bottom: 10px; }
.lobby-screen .player-list {
    flex: 0 1 auto;
    min-height: 90px;
    max-height: min(60dvh, 620px);
    align-content: start;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 180px), 1fr));
    gap: clamp(8px, 1.5vh, 14px);
    padding: clamp(10px, 2vh, 20px);
    overflow-y: auto;
}

.lobby-screen .player-card {
    min-height: clamp(88px, 15vh, 150px);
    gap: 7px;
    padding: 10px;
}

.lobby-screen .player-card-emoji {
    width: clamp(42px, 7vh, 68px);
    height: clamp(42px, 7vh, 68px);
    font-size: clamp(1.7rem, 4vh, 2.5rem);
}

.lobby-screen .player-card-name { font-size: clamp(0.82rem, 1.9vh, 1.1rem); }
.lobby-screen .start-game-button {
    flex: none;
    margin: 0 auto;
    padding: clamp(12px, 2vh, 20px);
}

.player-card-self {
    border-color: #34d399;
    box-shadow: 0 0 0 2px rgba(52, 211, 153, 0.17);
}

.lobby-footer {
    flex: none;
    color: #b7b8ca;
    font-size: clamp(0.85rem, 1.8vh, 1.1rem);
    font-weight: bold;
}

@media (max-width: 600px) {
    .lobby.lobby-screen {
        padding: 62px 12px 12px;
        gap: 10px;
    }

    .lobby-screen .small-heading { margin-bottom: 2px; }
    .lobby-screen .player-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .lobby-screen .player-card { min-height: 94px; }
    .lobby-screen .players-area h2 { margin-bottom: 6px; }
}

@media (max-height: 600px) {
    .lobby.lobby-screen { padding-top: 52px; gap: 7px; }
    .lobby-screen .player-card { min-height: 76px; flex-direction: row; }
    .lobby-screen .player-card-emoji { flex: none; width: 38px; height: 38px; font-size: 1.5rem; }
    .lobby-screen .room-code { font-size: clamp(2.5rem, 9vh, 5rem); }
    .lobby-screen .start-game-button { padding: 10px; }
}

.game-panel-title {
    margin: 14px 0;
    font-size: clamp(2rem, 6vw, 4rem);
    font-weight: 900;
    overflow-wrap: anywhere;
}

.game-panel-message {
    color: #b7b8ca;
    font-size: clamp(1rem, 2.5vw, 1.4rem);
    line-height: 1.4;
}

.game-mode:disabled { opacity: 0.45; cursor: not-allowed; }

.drawing-layout {
    width: min(100%, 1120px);
    height: 100vh;
    height: 100dvh;
    margin: auto;
    padding: clamp(58px, 8vh, 78px) 16px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(5px, 1vh, 12px);
    text-align: center;
    overflow: hidden;
}
.drawing-layout .small-heading,
.drawing-layout .game-panel-message { margin: 0; }
.drawing-title { margin: 0; font-size: clamp(1.4rem, 4vw, 3rem); font-weight: 900; overflow-wrap: anywhere; }
.drawing-reveal-label { color: #b7b8ca; font-size: clamp(.9rem, 2vw, 1.2rem); font-weight: 800; letter-spacing: .18em; }
.drawing-layout .circle-timer { flex: none; width: 68px; height: 68px; margin: 0; }
.drawing-layout .circle-timer::before { inset: 7px; }
.drawing-layout .circle-timer span { font-size: 1.5rem; }
.drawing-categories { width: min(100%, 850px); margin: auto 0; }
.drawing-board { width: min(100%, 980px); min-height: 0; max-height: 55vh; aspect-ratio: 16 / 9; border: 4px solid #7657ff; border-radius: 18px; background: white; overflow: hidden; flex: 1 1 auto; }
.drawing-board canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
.drawing-tools, .drawing-guess-form { display: flex; align-items: center; justify-content: center; gap: 12px; width: min(100%, 700px); }
.drawing-tools label { display: flex; align-items: center; gap: 6px; color: #b7b8ca; font-size: .8rem; font-weight: 800; }
.drawing-tools button, .drawing-guess-form button { border: 0; border-radius: 10px; padding: 12px 18px; background: #7657ff; color: white; font-weight: 900; cursor: pointer; }
.drawing-guess-form .join-input { flex: 1; min-width: 0; margin: 0; }
.drawing-guesses { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; min-height: 0; margin-top: auto; overflow: hidden; }
.drawing-guess { padding: 5px 10px; border: 1px solid #3d4062; border-radius: 99px; color: #b7b8ca; font-size: .85rem; }
.drawing-guess.correct { border-color: #34d399; color: #34d399; }
.drawing-layout .scoreboard-panel { width: min(100%, 800px); min-height: 0; overflow: auto; }
.drawing-layout .return-lobby-button { flex: none; margin: auto 0 0; }
.drawing-layout.finished-layout .drawing-title { font-size: clamp(1.35rem, 4vw, 2.5rem); }

.imposter-hint-setting { cursor: pointer; }
.imposter-hint-setting input { width: 26px; height: 26px; accent-color: #34d399; cursor: pointer; }
.imposter-layout {
    width: min(100%, 1120px);
    height: 100vh;
    height: 100dvh;
    margin: auto;
    padding: clamp(58px, 8vh, 78px) 16px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(7px, 1vh, 12px);
    text-align: center;
    overflow: hidden;
}
.imposter-title { margin: 0; font-size: clamp(1.5rem, 4vw, 3.2rem); font-weight: 900; overflow-wrap: anywhere; }
.imposter-layout .game-panel-message { margin: 0; }
.imposter-layout .circle-timer { flex: none; width: 72px; height: 72px; margin: 0; }
.imposter-layout .circle-timer::before { inset: 7px; }
.imposter-layout .circle-timer span { font-size: 1.5rem; }
.imposter-categories { width: min(100%, 850px); margin: auto 0; }
.imposter-categories .category-card { min-height: clamp(68px, 12vh, 110px); }
.imposter-secret {
    display: flex;
    flex-direction: column;
    gap: 5px;
    width: min(100%, 480px);
    padding: 12px 18px;
    border: 2px solid #34d399;
    border-radius: 16px;
    background: #25263e;
}
.imposter-secret:not(.is-imposter) { background: #202e36; }
.imposter-secret.is-imposter { border-color: #f87171; background: #342833; }
.imposter-secret span:first-child { color: #b7b8ca; font-size: .72rem; font-weight: 900; letter-spacing: .16em; }
.imposter-secret strong { color: #34d399; font-size: clamp(1.4rem, 3vw, 2rem); text-transform: uppercase; }
.imposter-secret.is-imposter strong { color: #f87171; }
.imposter-secret span:last-child { color: #b7b8ca; font-size: .85rem; }
.imposter-secret span:last-child:empty { display: none; }
.imposter-layout.voting .imposter-secret { flex-direction: row; align-items: center; justify-content: center; gap: 10px; padding: 7px 12px; }
.imposter-layout.voting .imposter-secret span:last-child { display: none; }
.imposter-layout.voting .imposter-secret strong { font-size: 1rem; }
.imposter-word-form { display: flex; gap: 10px; width: min(100%, 560px); }
.imposter-word-form .join-input { flex: 1; min-width: 0; margin: 0; text-transform: uppercase; }
.imposter-word-form button {
    flex: none;
    padding: 12px 18px;
    border: 0;
    border-radius: 12px;
    background: #7657ff;
    color: white;
    font-weight: 900;
    cursor: pointer;
}
.imposter-player-status, .imposter-entries, .imposter-votes {
    display: grid;
    width: min(100%, 950px);
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr));
    gap: 10px;
}
.imposter-player-status:empty { display: none; }
.imposter-status-card, .imposter-entry-card, .imposter-vote-card {
    min-width: 0;
    padding: 10px;
    border: 2px solid #3d4062;
    border-radius: 14px;
    background: #2b2e49;
}
.imposter-status-card { display: flex; align-items: center; justify-content: center; gap: 7px; padding: 7px 10px; font-size: .9rem; font-weight: 800; overflow-wrap: anywhere; }
.imposter-status-card.done { border-color: #34d399; }
.imposter-entries { align-content: start; min-height: 0; max-height: 38vh; overflow-y: auto; padding: 3px; }
.imposter-entry-card { display: flex; flex-direction: column; align-items: flex-start; gap: 9px; }
.imposter-entry-card span { color: #e1dcff; font-size: clamp(.9rem, 1.8vw, 1.05rem); font-weight: 900; }
.imposter-entry-words { display: flex; flex-wrap: wrap; gap: 6px; max-width: 100%; }
.imposter-entry-words strong { max-width: 100%; padding: 6px 9px; border-radius: 8px; background: #3a3d5b; font-size: clamp(.85rem, 1.7vw, 1rem); overflow-wrap: anywhere; text-transform: uppercase; }
.imposter-entry-card.missing { opacity: .6; }
.imposter-entries.voting { max-height: 20vh; }
.imposter-entries.voting .imposter-entry-card { padding: 8px 10px; }
.imposter-entries.voting .imposter-entry-words strong { font-size: .9rem; }
.imposter-entries.voting .imposter-entry-card span { font-size: 1rem; }
.imposter-votes { max-height: 28vh; overflow-y: auto; padding: 3px; }
.imposter-vote-card { display: flex; flex-direction: column; align-items: center; gap: 5px; color: white; cursor: pointer; }
.imposter-vote-card span { font-size: 1.8rem; }
.imposter-vote-card:hover, .imposter-vote-card:focus-visible { border-color: #7657ff; }
.imposter-vote-card:disabled { cursor: default; opacity: .6; }
.imposter-layout .scoreboard-panel { width: min(100%, 800px); min-height: 0; overflow: auto; }
.imposter-result { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; width: min(100%, 720px); margin: auto 0; }
.imposter-result-card { display: flex; flex-direction: column; justify-content: center; gap: 9px; min-width: 0; padding: clamp(18px, 3vw, 32px); border: 2px solid #34d399; border-radius: 20px; background: #202e36; }
.imposter-result-card span { color: #b7b8ca; font-size: .75rem; font-weight: 900; letter-spacing: .16em; }
.imposter-result-card strong { color: #34d399; font-size: clamp(1.6rem, 4vw, 2.8rem); line-height: 1.1; overflow-wrap: anywhere; text-transform: uppercase; }
.imposter-result-person { border-color: #f87171; background: #342833; }
.imposter-result-person strong { color: #f87171; }
.imposter-result p { grid-column: 1 / -1; padding: 12px; border-radius: 12px; background: #25263e; color: #e1dcff; font-size: clamp(.8rem, 2vw, 1rem); font-weight: 900; letter-spacing: .08em; }
.imposter-layout .return-lobby-button { flex: none; margin: auto 0 0; }
.imposter-layout.finished-layout .imposter-title { font-size: clamp(1.35rem, 4vw, 2.5rem); }
@media (max-width: 600px) {
    .imposter-layout { padding: 62px 10px 10px; }
    .imposter-player-status, .imposter-entries, .imposter-votes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .imposter-word-form button { padding: 10px; font-size: .8rem; }
    .imposter-result { grid-template-columns: 1fr; }
    .imposter-result p { grid-column: 1; }
    .imposter-layout.voting .imposter-secret span:first-child { display: none; }
}
@media (max-width: 600px) {
    .drawing-layout { padding: 62px 10px 10px; }
    .drawing-board { max-height: 48vh; }
    .drawing-tools { flex-wrap: wrap; }
}

.game-ended-page {
    width: min(100% - 40px, 620px);
    margin: auto;
    padding: 48px 24px;
    text-align: center;
}

.game-ended-icon {
    display: grid;
    place-items: center;
    width: 112px;
    height: 112px;
    margin: 36px auto 22px;
    border: 3px solid #7657ff;
    border-radius: 28px;
    background: #2b2e49;
    color: #34d399;
    font-size: 4rem;
    box-shadow: 0 0 36px rgba(118, 87, 255, 0.25);
}

.game-ended-link {
    display: inline-block;
    min-width: 220px;
    margin-top: 36px;
    padding: 18px 28px;
    border-radius: 16px;
    background: #34d399;
    color: #10231c;
    font-weight: 900;
    text-decoration: none;
}

.game-ended-link:hover,
.game-ended-link:focus-visible { filter: brightness(1.1); }

.circle-timer {
    --timer-progress: 100%;
    position: relative;
    display: grid;
    place-items: center;
    width: 106px;
    height: 106px;
    margin: 24px auto 0;
    border-radius: 50%;
    background: conic-gradient(#34d399 var(--timer-progress), #3d4062 0);
    box-shadow: 0 0 24px rgba(52, 211, 153, 0.16);
}

.circle-timer::before {
    content: "";
    position: absolute;
    inset: 10px;
    border-radius: 50%;
    background: #22243b;
}

.circle-timer span {
    position: relative;
    color: white;
    font-size: 2.4rem;
    font-weight: 900;
    font-variant-numeric: tabular-nums;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-top: 30px;
}

.category-card {
    display: grid;
    place-items: center;
    min-height: 110px;
    padding: 20px;
    border: 2px solid #4a426f;
    border-radius: 18px;
    background: #2b2e49;
    color: white;
    font-size: clamp(1.1rem, 3vw, 1.6rem);
    font-weight: 900;
    font-family: inherit;
    overflow-wrap: anywhere;
}

.category-card.category-selected {
    border-color: #34d399;
    background: #303b4a;
    box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.2),
        0 0 28px rgba(52, 211, 153, 0.22);
    transform: scale(1.03);
}

.category-card.category-muted {
    border-color: #383a55;
    background: #25273e;
    color: #8f91ad;
    opacity: 0.65;
}

.category-card.answer-picked {
    border-color: #7657ff;
    background: #39335f;
}

.answer-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 0;
}
.answer-option-text { display: block; width: 100%; overflow-wrap: anywhere; }
.answer-guess-list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 5px;
    width: 100%;
}
.answer-guess {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    max-width: 100%;
    padding: 4px 7px;
    border: 1px solid #555879;
    border-radius: 999px;
    background: #202238;
    color: white;
    font-size: clamp(.7rem, 1.5vh, .85rem);
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
}
.answer-guess-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }

.players-heading {
    margin: 30px 0 14px;
    color: #8f91ad;
    font-size: 0.95rem;
    letter-spacing: 0.2em;
}

.scoreboard-panel {
    width: 100%;
    max-width: 900px;
    margin: 26px auto 0;
}

.answer-player-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr));
    gap: 12px;
}

.answer-player-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    min-width: 0;
    padding: 17px 10px;
    border: 3px solid #3d4062;
    border-radius: 16px;
    background: #2b2e49;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.answer-player-card.answered {
    border-color: #34d399;
    box-shadow: 0 0 18px rgba(52, 211, 153, 0.2);
}

.answer-player-emoji { font-size: 2.2rem; line-height: 1.2; }
.answer-player-name { max-width: 100%; overflow-wrap: anywhere; font-size: 1rem; font-weight: 900; }
.answer-player-score { color: #b7b8ca; font-size: 0.9rem; }

.category-choice {
    width: 100%;
    cursor: pointer;
    transition: transform 0.15s ease, border-color 0.15s ease;
}

.category-choice:hover,
.category-choice:focus-visible {
    transform: translateY(-2px);
    border-color: #34d399;
}

.category-choice:disabled {
    cursor: default;
    opacity: 0.6;
}

.category-choice.answer-revealed:disabled { opacity: 1; }

.game-layout {
    width: 100%;
    max-width: 1600px;
    height: 100vh;
    height: 100dvh;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    gap: clamp(10px, 2vw, 28px);
    padding: 66px clamp(12px, 2vw, 28px) 16px;
    overflow: hidden;
}

.game-layout .game-panel {
    grid-column: 1;
    grid-row: 1;
    align-self: center;
    min-width: 0;
    max-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 6px 10px;
}

.game-layout .category-card.category-selected { transform: none; }

.game-layout .game-panel-title {
    margin: 6px 0;
    font-size: clamp(1.35rem, min(3vw, 4.8vh), 3.25rem);
    line-height: 1.15;
}

.game-layout .game-panel-message { font-size: clamp(.82rem, 1.8vh, 1.2rem); }
.game-layout #hostAnswerCount,
.game-layout #playerAnswerStatus { min-height: 1.4em; }
.game-layout #playerAnswerStatus.couch-screen-hint {
    width: fit-content;
    max-width: 100%;
    margin: 10px auto;
    padding: 8px 16px;
    border: 1px solid rgba(118, 87, 255, 0.65);
    border-radius: 999px;
    background: rgba(118, 87, 255, 0.14);
    color: #e1dcff;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.game-layout #hostAnswerCount.couch-answer-count {
    width: fit-content;
    max-width: 100%;
    margin: 10px auto;
    padding: 8px 16px;
    border: 1px solid rgba(118, 87, 255, 0.65);
    border-radius: 999px;
    background: rgba(118, 87, 255, 0.14);
    color: #e1dcff;
    font-weight: 800;
    letter-spacing: 0.04em;
}
.game-layout .circle-timer {
    width: clamp(64px, 10vh, 96px);
    height: clamp(64px, 10vh, 96px);
    margin-top: clamp(6px, 1.5vh, 18px);
}
.game-layout .circle-timer span { font-size: clamp(1.5rem, 4vh, 2.3rem); }
.game-layout .circle-timer::before { inset: 8px; }
.game-layout .category-grid { gap: clamp(7px, 1.5vh, 16px); margin-top: clamp(10px, 2vh, 24px); }
.game-layout .category-card {
    min-height: clamp(54px, 11vh, 100px);
    padding: clamp(7px, 1.5vh, 18px);
    font-size: clamp(.85rem, min(2vw, 2.7vh), 1.5rem);
}

.game-layout .scoreboard-panel {
    grid-column: 1;
    grid-row: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    max-height: 100%;
    margin: 0;
    padding: 10px;
    border: 1px solid #3d4062;
    border-radius: 18px;
    background: #22243b;
}

.game-layout .players-heading { flex: none; margin: 3px 0 12px; font-size: .8rem; }
.game-layout .answer-player-grid {
    display: grid;
    flex: 1;
    min-height: 0;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: repeat(var(--leaderboard-count, 1), minmax(0, clamp(34px, 6vh, 60px)));
    align-content: start;
    gap: clamp(4px, .9vh, 9px);
}

.game-layout .answer-player-card {
    display: grid;
    grid-template-columns: 27px 38px minmax(0, 1fr);
    grid-template-rows: 1fr 1fr;
    align-items: center;
    column-gap: 7px;
    row-gap: 0;
    min-height: 0;
    padding: 3px 7px;
    border-width: 2px;
    border-radius: 11px;
    text-align: left;
}

.game-layout .answer-player-rank { grid-row: 1 / 3; color: #34d399; font-weight: 900; font-size: .9rem; }
.game-layout .answer-player-emoji { grid-row: 1 / 3; font-size: clamp(1.25rem, 3vh, 1.85rem); }
.game-layout .answer-player-name { grid-column: 3; align-self: end; font-size: clamp(.75rem, 1.7vh, 1rem); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.game-layout .answer-player-score { grid-column: 3; align-self: start; font-size: clamp(.65rem, 1.4vh, .85rem); }
.game-layout .answer-player-card.own-player { box-shadow: inset 0 0 0 1px #34d399; }
.game-layout .answer-player-card.answered { border-color: #34d399; }

.game-layout.finished-layout {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}
.game-layout.finished-layout .game-panel { flex: none; overflow: visible; }
.game-layout.finished-layout .scoreboard-panel { flex: 1; width: min(100%, 520px); min-height: 0; }
.game-layout.finished-layout .players-heading { text-align: center; }
.game-layout.finished-layout .answer-player-card.winner {
    border-color: #7657ff;
    background: #39335f;
    box-shadow: 0 0 22px rgba(118, 87, 255, .3);
}
.game-layout.finished-layout .return-lobby-button { flex: none; margin: 0; padding: 12px; }

.flappy-layout {
    box-sizing: border-box;
    width: min(100%, 1300px);
    height: 100dvh;
    min-height: 0;
    margin: 0 auto;
    padding: clamp(64px, 8vh, 80px) 16px 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(6px, 1.3vh, 14px);
    overflow: hidden;
    text-align: center;
    touch-action: manipulation;
    user-select: none;
}
.flappy-layout .small-heading,
.flappy-layout .game-panel-message { margin: 0; }
.flappy-title { margin: 0; font-size: clamp(1.65rem, 4.5vh, 3.5rem); line-height: 1.1; }
.flappy-board {
    width: min(100%, 1100px, calc((100dvh - 225px) * 16 / 9));
    min-width: 0;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border: 4px solid #7657ff;
    border-radius: 18px;
    background: #202b48;
    box-shadow: 0 18px 40px #0b0d1c77;
}
.flappy-board canvas { display: block; width: 100%; height: 100%; }
.flappy-tap {
    flex: 1;
    width: min(100%, 600px);
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    border: 3px solid #34d399;
    border-radius: 28px;
    background: #263647;
    color: white;
    font-size: clamp(1.5rem, 6vw, 3rem);
}
.flappy-tap span { font-size: clamp(3rem, 13vw, 6rem); }
.flappy-tap small { font-size: clamp(.8rem, 2.5vw, 1rem); color: #bec6d8; }
.flappy-players {
    width: min(100%, 1100px);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 145px), 1fr));
    gap: 7px;
    overflow: auto;
    min-height: 0;
}
.flappy-player {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 7px 10px;
    border: 2px solid #444967;
    border-radius: 12px;
    background: #2b2e49;
    font-size: clamp(.7rem, 1.8vh, .9rem);
    white-space: nowrap;
}
.flappy-player span { overflow: hidden; text-overflow: ellipsis; }
.flappy-player strong { flex: none; color: #a4f3d4; }
.flappy-player.flappy-self { border-color: #34d399; }
.flappy-player.flappy-out { opacity: .42; }
.flappy-layout .scoreboard-panel { width: min(100%, 800px); min-height: 0; overflow: auto; }
.flappy-layout.finished-layout .return-lobby-button { flex: none; margin-top: auto; }
.flappy-layout [hidden] { display: none !important; }
@media (max-width: 600px) {
    .flappy-layout { padding: 62px 8px 8px; }
    .flappy-board { width: 100%; border-width: 2px; border-radius: 11px; }
    .flappy-players { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.solo-result {
    position: relative;
    width: min(100%, 540px);
    padding: clamp(30px, 6vw, 56px) clamp(22px, 6vw, 50px);
    border: 1px solid #494366;
    border-radius: 28px;
    background: radial-gradient(circle at 50% 0, rgba(118, 87, 255, .24), transparent 65%), #22243b;
    text-align: center;
    box-shadow: 0 20px 60px rgba(8, 9, 24, .35);
}

.solo-result-label { color: #34d399; font-size: .8rem; font-weight: 900; letter-spacing: .24em; }
.solo-result-heading { margin: 12px 0 6px; font-size: clamp(1.8rem, 5vw, 2.7rem); font-weight: 900; letter-spacing: .02em; }
.solo-result-total { margin: 10px 0 0; font-variant-numeric: tabular-nums; }
#soloScore { color: white; font-size: clamp(5rem, 17vw, 8.5rem); font-weight: 900; letter-spacing: -.06em; line-height: 1; }
.solo-result-maximum { margin: 2px 0 26px; color: #b7b8ca; font-size: clamp(.85rem, 2vw, 1rem); font-weight: 900; letter-spacing: .14em; }
#soloMaxScore { color: white; }
.solo-result-track { height: 9px; border-radius: 999px; background: #3d4062; overflow: hidden; }
.solo-result-track > div { height: 100%; border-radius: inherit; background: #34d399; transition: width .8s ease; }
.flappy-solo-result { text-align: center; }
.flappy-solo-distance { display: flex; align-items: baseline; justify-content: center; gap: .3em; margin: 14px 0 0; color: #34d399; font-size: clamp(4rem, 14vw, 8rem); font-weight: 900; line-height: 1; }
.flappy-solo-distance small { color: #b7b8ca; font-size: .3em; }

.range-layout {
    box-sizing: border-box;
    width: min(100%, 1100px);
    height: 100dvh;
    min-height: 0;
    margin: 0 auto;
    padding: clamp(64px, 8vh, 80px) 14px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(7px, 1.4vh, 16px);
    overflow: hidden;
    text-align: center;
}
.range-layout .small-heading,
.range-layout .game-panel-message { margin: 0; }
.range-category { margin: 0; color: #ffb357; font-size: .85rem; font-weight: 900; letter-spacing: .16em; text-transform: uppercase; }
.range-question { margin: 0; max-width: 1000px; font-size: clamp(1.35rem, 4vw, 3.2rem); line-height: 1.13; }
.range-bounds { margin: 0; padding: 5px 16px; border: 1px solid #6c5972; border-radius: 999px; color: #ffca87; font-weight: 900; font-variant-numeric: tabular-nums; }
.range-bounds:empty { display: none; }
.range-layout .circle-timer { flex: none; margin: 0; }
.range-categories { width: min(100%, 800px); margin-top: 8px; }
.range-categories .category-card { min-height: clamp(70px, 14vh, 115px); }
.range-form {
    width: min(100%, 700px);
    padding: clamp(14px, 3vh, 26px);
    border: 2px solid #58506b;
    border-radius: 22px;
    background: #282b43;
}
.range-value { margin: 0 0 14px; color: #ffb357; font-size: clamp(2.5rem, 7vw, 4.5rem); font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; }
.range-form input[type="range"] { display: block; width: 100%; height: 38px; margin: 0; accent-color: #ffb357; cursor: pointer; touch-action: pan-y; }
.range-limits { display: flex; justify-content: space-between; color: #b7b8ca; font-weight: 800; font-variant-numeric: tabular-nums; }
.range-form .start-game-button { width: 100%; max-width: none; margin-top: 12px; }
.range-reveal { width: min(100%, 800px); min-height: 0; overflow: auto; }
.range-reveal > p { margin: 0; color: #b7b8ca; font-weight: 900; letter-spacing: .2em; }
.range-reveal > strong { display: block; color: #34d399; font-size: clamp(2.6rem, 7vw, 5rem); line-height: 1.1; }
.range-guesses { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); gap: 8px; margin-top: 10px; }
.range-guess { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px; border: 2px solid #444967; border-radius: 12px; background: #2b2e49; }
.range-guess span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.range-guess strong { color: #fff; font-size: 1.2rem; }
.range-guess small { color: #b7b8ca; white-space: nowrap; }
.range-guess.range-closest { border-color: #34d399; background: #263d3f; }
.range-players { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 165px), 1fr)); gap: 7px; width: min(100%, 1000px); min-height: 0; overflow: auto; }
.range-layout.range-showing-reveal .range-players { margin-top: clamp(14px, 2.5vh, 24px); }
.range-player { display: flex; justify-content: space-between; gap: 8px; padding: 8px 10px; border: 2px solid #444967; border-radius: 12px; background: #2b2e49; font-size: .85rem; }
.range-player span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.range-player strong { flex: none; color: #b7b8ca; }
.range-player.range-self,
.range-player.range-answered { border-color: #34d399; }
.range-layout .scoreboard-panel { width: min(100%, 800px); min-height: 0; overflow: auto; }
.range-layout.finished-layout .return-lobby-button { flex: none; margin-top: auto; }
.memory-layout {
    box-sizing: border-box;
    width: min(100%, 1200px);
    height: 100dvh;
    margin: 0 auto;
    padding: clamp(64px, 8vh, 80px) 14px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(7px, 1.4vh, 15px);
    overflow: hidden;
    text-align: center;
}
.memory-layout .small-heading,
.memory-layout .game-panel-message { margin: 0; }
.memory-title { margin: 0; font-size: clamp(1.5rem, 5vw, 3.4rem); line-height: 1.08; }
.memory-category { margin: 0; color: #74e8d1; font-size: .85rem; font-weight: 900; letter-spacing: .16em; text-transform: uppercase; }
.memory-category:empty,
.memory-layout .game-panel-message:empty { display: none; }
.memory-layout .circle-timer { flex: none; width: 72px; height: 72px; margin: 0; }
.memory-layout .circle-timer::before { inset: 7px; }
.memory-layout .circle-timer span { font-size: 1.5rem; }
.memory-words {
    position: relative;
    flex: 1;
    width: min(100%, 1100px);
    min-height: 0;
}
.memory-word {
    position: absolute;
    left: var(--x);
    top: var(--y);
    width: max-content;
    max-width: var(--cell-width);
    color: #58ddb1;
    font-size: clamp(1rem, 2.1vw, 1.6rem);
    font-weight: 900;
    line-height: 1.18;
    overflow-wrap: anywhere;
    text-shadow: 0 2px 20px rgba(88, 221, 177, .45);
    transform: translate(-50%, -50%);
    animation: memory-float var(--float-time, 3s) ease-in-out var(--float-delay, 0s) infinite alternate;
}
@keyframes memory-float {
    from { transform: translate(-50%, calc(-50% + 5px)) rotate(-2deg); }
    to { transform: translate(-50%, calc(-50% - 5px)) rotate(2deg); }
}
.memory-form { display: flex; width: min(100%, 680px); gap: 10px; }
.memory-form input { flex: 1; min-width: 0; }
.memory-form button {
    flex: none;
    padding: 0 20px;
    border: 0;
    border-radius: 12px;
    background: #7056fa;
    color: white;
    font-weight: 900;
    cursor: pointer;
}
.memory-own-guesses { display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; width: min(100%, 900px); min-height: 0; overflow-y: auto; }
.memory-own-guesses span,
.memory-correct-words span { padding: 5px 10px; border-radius: 999px; background: #343953; color: #fff; font-size: .85rem; font-weight: 800; }
.memory-results { flex: 1; width: min(100%, 1000px); min-height: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-content: start; gap: 10px; overflow-y: auto; }
.memory-result-card { min-width: 0; padding: 14px; border: 2px solid #454b6c; border-radius: 16px; background: #292d45; text-align: left; }
.memory-result-heading { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 5px 12px; margin-bottom: 10px; }
.memory-result-heading strong { overflow-wrap: anywhere; }
.memory-result-heading span { color: #58ddb1; font-weight: 900; }
.memory-correct-words { display: flex; flex-wrap: wrap; gap: 6px; }
.memory-correct-words span { background: #23463f; }
.memory-layout .scoreboard-panel { width: min(100%, 800px); min-height: 0; overflow: auto; }
.memory-layout.finished-layout .return-lobby-button { flex: none; margin-top: auto; }
@media (max-width: 600px) {
    .range-layout { padding: 62px 8px 8px; }
    .range-player { font-size: .72rem; }
    .range-players { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .range-guess { font-size: .8rem; }
    .memory-layout { padding: 62px 8px 8px; }
    .memory-word { font-size: clamp(.75rem, 3vw, 1rem); }
    .memory-results { grid-template-columns: 1fr; }
    .memory-result-card { padding: 10px; }
    .memory-form button { padding: 0 12px; font-size: .75rem; }
}
@media (prefers-reduced-motion: reduce) { .memory-word { animation: none; } }
.game-layout.solo-results-layout { justify-content: center; gap: 20px; }
.game-layout.solo-results-layout .return-lobby-button { width: min(100%, 540px); max-width: 540px; }

@media (max-width: 650px) {
    .game-layout { gap: 8px; padding: 60px 7px 8px; }
    .game-layout .scoreboard-panel { padding: 5px; border-radius: 11px; }
    .game-layout .players-heading { font-size: .55rem; letter-spacing: .08em; margin-bottom: 5px; }
    .game-layout .answer-player-card { grid-template-columns: 20px minmax(0, 1fr); grid-template-rows: auto auto; padding: 2px 3px; column-gap: 2px; }
    .game-layout .answer-player-rank { grid-column: 1; grid-row: 1; font-size: .7rem; }
    .game-layout .answer-player-emoji { grid-column: 1; grid-row: 2; font-size: 1rem; }
    .game-layout .answer-player-name { grid-column: 2; grid-row: 1; font-size: .68rem; }
    .game-layout .answer-player-score { grid-column: 2; grid-row: 2; font-size: .58rem; }
    .game-layout .category-grid { grid-template-columns: 1fr; }
    .game-layout .category-card { min-height: clamp(44px, 8vh, 70px); font-size: clamp(.8rem, 2.2vh, 1rem); }
    .game-layout .game-panel-title { font-size: clamp(1.15rem, 3.2vh, 2rem); }
    .game-layout.finished-layout .answer-player-card { grid-template-columns: 28px 38px minmax(0, 1fr); }
    .game-layout.finished-layout .answer-player-rank { grid-row: 1 / 3; }
    .game-layout.finished-layout .answer-player-emoji { grid-column: 2; grid-row: 1 / 3; }
    .game-layout.finished-layout .answer-player-name,
    .game-layout.finished-layout .answer-player-score { grid-column: 3; }
}

@media (max-height: 550px) {
    .game-layout { padding-top: 52px; padding-bottom: 5px; }
    .game-layout .game-panel-title { font-size: clamp(1rem, 3.4vh, 1.5rem); }
    .game-layout .circle-timer { width: 52px; height: 52px; margin-top: 4px; }
    .game-layout .circle-timer span { font-size: 1.25rem; }
    .game-layout .category-grid { margin-top: 6px; gap: 5px; }
    .game-layout .category-card { min-height: 38px; padding: 5px; }
    .game-layout .answer-player-grid { gap: 2px; grid-template-rows: repeat(var(--leaderboard-count, 1), minmax(0, 7vh)); }
}

@media (max-width: 600px) {
    .lobby {
        padding: 22px;
        padding-top: 72px;
    }

    .join-instructions {
        margin-bottom: 36px;
    }

    .room-code {
        letter-spacing: 0.08em;
    }

    .player-list {
        gap: 12px;
        padding: 16px;
    }

    .category-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .category-card {
        min-height: 72px;
    }
}

/* ==========================================
   JOIN GAME PAGE
   ========================================== */

.join-page {
    width: 100%;
    max-width: 500px;
    padding: 30px;
    text-align: center;
}

.join-form {
    display: flex;
    flex-direction: column;
    gap: 22px;
    width: 100%;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: left;
}

.input-group label {
    color: #9fa1ba;
    font-size: 0.8rem;
    font-weight: 900;
    letter-spacing: 2px;
}


/* INPUT BOXES */

.join-input {
    width: 100%;
    padding: 18px 20px;

    border: 2px solid #30334f;
    border-radius: 14px;

    outline: none;

    background: #22243b;
    color: white;

    font-size: 1.2rem;
    font-weight: bold;

    transition:
        border-color 0.15s ease,
        transform 0.15s ease;
}

.join-input:focus {
    border-color: #7657ff;
}


/* ROOM CODE INPUT */

.room-input {
    text-transform: uppercase;

    letter-spacing: 8px;

    font-size: 1.6rem;
    font-weight: 900;
}


/* JOIN BUTTON */

.join-submit {
    width: 100%;

    padding: 20px;

    border: none;
    border-radius: 15px;

    background: #34d399;
    color: #10231c;

    font-size: 1.15rem;
    font-weight: 900;

    cursor: pointer;

    transition:
        transform 0.15s ease,
        filter 0.15s ease;
}

.join-submit:hover {
    transform: translateY(-2px);
    filter: brightness(1.08);
}

.join-submit:active {
    transform: translateY(1px);
}

.join-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}


/* ERROR MESSAGE */

.join-error {
    min-height: 20px;

    color: #ff7777;

    font-size: 0.9rem;
    font-weight: bold;
}


/* MOBILE */

@media (max-width: 600px) {

    .join-page {
        padding: 22px;
    }

    .join-input {
        padding: 17px;
    }

}

/* ==========================================
   PLAYER WAITING SCREEN
   ========================================== */

.player-waiting {
    width: 100%;
    max-width: 500px;
    padding: 30px;
    padding-top: 72px;
    text-align: center;
}

.player-waiting h1 {
    font-size: clamp(2.8rem, 10vw, 4.5rem);
    font-weight: 900;
    margin-bottom: 12px;
}

#playerWelcome {
    color: #b7b8ca;
    font-size: 1.2rem;
    font-weight: bold;
}


/* WAITING ICON */

.waiting-icon {
    width: 120px;
    height: 120px;

    display: flex;
    align-items: center;
    justify-content: center;

    margin: 45px auto 25px;

    background: #22243b;

    border-radius: 30px;

    font-size: 4rem;
}


/* LOOK AT MAIN SCREEN */

.look-screen {
    color: #8f91ad;

    font-size: 1.05rem;
    font-weight: bold;

    letter-spacing: 1px;
}


/* MOBILE */

@media (max-width: 600px) {

    .player-waiting {
        padding: 22px;
        padding-top: 72px;
    }

    .waiting-icon {
        width: 105px;
        height: 105px;

        font-size: 3.5rem;
    }

}

/* ==========================================
   EMOJI SELECTOR
   ========================================== */

.emoji-section {
    width: 100%;
    padding: 20px;

    background: #22243b;
    border-radius: 16px;

    text-align: left;
}

.emoji-title {
    margin-bottom: 15px;

    color: #9fa1ba;

    font-size: 0.8rem;
    font-weight: 900;
    letter-spacing: 2px;
}


/* EMOJI GRID */

.emoji-grid {
    display: grid;

    grid-template-columns:
        repeat(5, 1fr);

    gap: 10px;
}


/* INDIVIDUAL EMOJI */

.emoji-button {
    aspect-ratio: 1 / 1;

    display: flex;
    align-items: center;
    justify-content: center;

    border: 2px solid transparent;
    border-radius: 13px;

    background: #2b2e49;

    font-size: 2rem;

    cursor: pointer;

    transition:
        transform 0.15s ease,
        border-color 0.15s ease,
        background 0.15s ease;
}


.emoji-button:hover {
    transform: translateY(-2px);

    background: #343753;
}


/* SELECTED EMOJI */

.emoji-button.selected {
    border-color: #34d399;

    background: #303b4a;

    box-shadow:
        0 0 0 2px rgba(52, 211, 153, 0.12);
}


/* MOBILE */

@media (max-width: 450px) {

    .emoji-section {
        padding: 15px;
    }

    .emoji-grid {
        gap: 8px;
    }

    .emoji-button {
        font-size: 1.7rem;
        border-radius: 11px;
    }

}

@media (max-width: 600px) {
    .exit-button { top: calc(10px + env(safe-area-inset-top)); right: 10px; padding: 8px 11px; font-size: .7rem; }
    .flappy-layout { padding-top: calc(92px + env(safe-area-inset-top)); }
}
