:root {
    --topbar-height: 60px;
    --bg: #070709;
    --panel: #111116;
    --panel-2: #18181f;
    --line: #34343f;
    --text: #f4f4f5;
    --muted: #a3a3ad;
    --red: #c1121f;
    --red-bright: #ef233c;
    --gold: #f2b134;
    --body-background: radial-gradient(circle at top right, #28040a 0, var(--bg) 34rem);
    --topbar-bg: rgba(7, 7, 9, 0.88);
    --panel-glass: rgba(17, 17, 22, 0.96);
    --panel-gradient-end: #0d0d11;
    --accent-shadow: transparent;
}

html[data-theme="crimson-night"] {
    --bg: #09070b;
    --panel: #151118;
    --panel-2: #211820;
    --line: #4a3038;
    --text: #fff7f7;
    --muted: #bca8ad;
    --red: #b91c35;
    --red-bright: #ff4964;
    --gold: #ffbf69;
    --body-background: radial-gradient(circle at 92% 0, rgba(145, 18, 47, 0.34) 0, transparent 34rem), radial-gradient(circle at 8% 100%, rgba(255, 73, 100, 0.15) 0, transparent 30rem), var(--bg);
    --topbar-bg: rgba(9, 7, 11, 0.9);
    --panel-glass: rgba(21, 17, 24, 0.96);
    --panel-gradient-end: #100b12;
    --accent-shadow: rgba(255, 73, 100, 0.28);
}

html[data-theme="arctic-neon"] {
    --bg: #050b14;
    --panel: #0c1725;
    --panel-2: #12263a;
    --line: #294862;
    --text: #eefaff;
    --muted: #91a9bd;
    --red: #087f9c;
    --red-bright: #35d9ff;
    --gold: #a78bfa;
    --body-background: radial-gradient(circle at 92% 0, rgba(0, 171, 210, 0.27) 0, transparent 34rem), radial-gradient(circle at 8% 100%, rgba(53, 217, 255, 0.14) 0, transparent 30rem), var(--bg);
    --topbar-bg: rgba(5, 11, 20, 0.9);
    --panel-glass: rgba(12, 23, 37, 0.96);
    --panel-gradient-end: #07111d;
    --accent-shadow: rgba(53, 217, 255, 0.25);
}

html[data-theme="emerald-stage"] {
    --bg: #07100d;
    --panel: #0d1b16;
    --panel-2: #142820;
    --line: #315345;
    --text: #f3fbf5;
    --muted: #9bb5a6;
    --red: #0d7b58;
    --red-bright: #35d399;
    --gold: #eabf55;
    --body-background: radial-gradient(circle at 92% 0, rgba(25, 145, 101, 0.28) 0, transparent 34rem), radial-gradient(circle at 8% 100%, rgba(53, 211, 153, 0.14) 0, transparent 30rem), var(--bg);
    --topbar-bg: rgba(7, 16, 13, 0.9);
    --panel-glass: rgba(13, 27, 22, 0.96);
    --panel-gradient-end: #091510;
    --accent-shadow: rgba(53, 211, 153, 0.24);
}

html[data-theme="royal-violet"] {
    --bg: #0d0815;
    --panel: #191126;
    --panel-2: #28183b;
    --line: #51376b;
    --text: #fbf7ff;
    --muted: #b7a4c9;
    --red: #7c3aed;
    --red-bright: #c084fc;
    --gold: #f472b6;
    --body-background: radial-gradient(circle at 92% 0, rgba(124, 58, 237, 0.3) 0, transparent 34rem), radial-gradient(circle at 8% 100%, rgba(192, 132, 252, 0.14) 0, transparent 30rem), var(--bg);
    --topbar-bg: rgba(13, 8, 21, 0.9);
    --panel-glass: rgba(25, 17, 38, 0.96);
    --panel-gradient-end: #110a1c;
    --accent-shadow: rgba(192, 132, 252, 0.25);
}

html[data-theme="sunset-orange"] {
    --bg: #120b06;
    --panel: #21140b;
    --panel-2: #352012;
    --line: #674126;
    --text: #fff8f1;
    --muted: #cbb19a;
    --red: #c6530a;
    --red-bright: #ff8a2a;
    --gold: #ffd166;
    --body-background: radial-gradient(circle at 92% 0, rgba(255, 122, 24, 0.32) 0, transparent 34rem), radial-gradient(circle at 8% 100%, rgba(255, 193, 77, 0.12) 0, transparent 30rem), var(--bg);
    --topbar-bg: rgba(18, 11, 6, 0.9);
    --panel-glass: rgba(33, 20, 11, 0.96);
    --panel-gradient-end: #180e08;
    --accent-shadow: rgba(255, 138, 42, 0.27);
}

html[data-theme="daylight"] {
    --bg: #eef2f7;
    --panel: #ffffff;
    --panel-2: #dfe7f0;
    --line: #b8c4d3;
    --text: #182230;
    --muted: #5f6f82;
    --red: #315f9d;
    --red-bright: #447dc6;
    --gold: #b56b0a;
    --body-background: radial-gradient(circle at 92% 0, rgba(68, 125, 198, 0.18) 0, transparent 34rem), linear-gradient(145deg, #f8fafc, var(--bg));
    --topbar-bg: rgba(255, 255, 255, 0.88);
    --panel-glass: rgba(255, 255, 255, 0.94);
    --panel-gradient-end: #e8eef5;
    --accent-shadow: rgba(49, 95, 157, 0.2);
}

html[data-theme="warm-parchment"] {
    --bg: #e8ddc8;
    --panel: #f5ecd9;
    --panel-2: #ddd0b8;
    --line: #b8a589;
    --text: #392f27;
    --muted: #75675a;
    --red: #a64b2a;
    --red-bright: #cf6841;
    --gold: #8d681e;
    --body-background: radial-gradient(circle at 92% 0, rgba(207, 104, 65, 0.16) 0, transparent 34rem), linear-gradient(145deg, #f1e8d6, var(--bg));
    --topbar-bg: rgba(245, 236, 217, 0.9);
    --panel-glass: rgba(245, 236, 217, 0.95);
    --panel-gradient-end: #d4c5aa;
    --accent-shadow: rgba(166, 75, 42, 0.2);
}

html[data-theme="mint-fog"] {
    --bg: #dce8e3;
    --panel: #edf5f1;
    --panel-2: #c9dbd3;
    --line: #9db8ad;
    --text: #20342d;
    --muted: #5b746a;
    --red: #18705c;
    --red-bright: #2b9479;
    --gold: #8a6420;
    --body-background: radial-gradient(circle at 92% 0, rgba(43, 148, 121, 0.17) 0, transparent 34rem), linear-gradient(150deg, #edf3f0, var(--bg));
    --topbar-bg: rgba(237, 245, 241, 0.9);
    --panel-glass: rgba(237, 245, 241, 0.95);
    --panel-gradient-end: #c1d5cc;
    --accent-shadow: rgba(24, 112, 92, 0.2);
}

html[data-theme="ukrainian-sky"] {
    --bg: #061529;
    --panel: #0b2545;
    --panel-2: #123a66;
    --line: #2d5e8d;
    --text: #f7fbff;
    --muted: #a9c4dd;
    --red: #0057b8;
    --red-bright: #2f80ed;
    --gold: #ffd700;
    --body-background: linear-gradient(160deg, rgba(0, 87, 184, 0.32) 0 48%, rgba(255, 215, 0, 0.13) 52% 100%), var(--bg);
    --topbar-bg: rgba(6, 21, 41, 0.9);
    --panel-glass: rgba(11, 37, 69, 0.96);
    --panel-gradient-end: #071c35;
    --accent-shadow: rgba(255, 215, 0, 0.2);
}

html[data-theme="italian-spirit"] {
    --bg: #0b1511;
    --panel: #12221a;
    --panel-2: #1b3428;
    --line: #3d5f4e;
    --text: #fffaf7;
    --muted: #b7c5bd;
    --red: #008c45;
    --red-bright: #20b86a;
    --gold: #f05a5a;
    --body-background: linear-gradient(120deg, rgba(0, 140, 69, 0.2), transparent 38%), linear-gradient(240deg, rgba(205, 33, 42, 0.18), transparent 38%), var(--bg);
    --topbar-bg: rgba(11, 21, 17, 0.9);
    --panel-glass: rgba(18, 34, 26, 0.96);
    --panel-gradient-end: #0d1a14;
    --accent-shadow: rgba(32, 184, 106, 0.22);
}

html[data-theme="pride-spectrum"] {
    --bg: #100b18;
    --panel: #1a1325;
    --panel-2: #291b38;
    --line: #5a3c70;
    --text: #fff8ff;
    --muted: #c4accb;
    --red: #c22d8f;
    --red-bright: #ff69c7;
    --gold: #ffd166;
    --body-background: radial-gradient(circle at 12% 10%, rgba(228, 3, 3, 0.18) 0, transparent 24rem), radial-gradient(circle at 38% 0, rgba(255, 140, 0, 0.15) 0, transparent 22rem), radial-gradient(circle at 64% 0, rgba(255, 237, 0, 0.12) 0, transparent 22rem), radial-gradient(circle at 86% 18%, rgba(0, 128, 38, 0.15) 0, transparent 24rem), radial-gradient(circle at 92% 75%, rgba(0, 77, 255, 0.17) 0, transparent 28rem), radial-gradient(circle at 8% 82%, rgba(117, 7, 135, 0.2) 0, transparent 28rem), var(--bg);
    --topbar-bg: rgba(16, 11, 24, 0.9);
    --panel-glass: rgba(26, 19, 37, 0.96);
    --panel-gradient-end: #120c1b;
    --accent-shadow: rgba(255, 105, 199, 0.25);
}

html[data-theme="retro-arcade"] {
    --bg: #07081a;
    --panel: #10132b;
    --panel-2: #1a2040;
    --line: #39427a;
    --text: #f8f7ff;
    --muted: #a9add1;
    --red: #be1f91;
    --red-bright: #ff43d1;
    --gold: #b8f34a;
    --body-background: radial-gradient(circle at 88% 0, rgba(255, 67, 209, 0.27) 0, transparent 32rem), radial-gradient(circle at 8% 100%, rgba(184, 243, 74, 0.12) 0, transparent 28rem), var(--bg);
    --topbar-bg: rgba(7, 8, 26, 0.9);
    --panel-glass: rgba(16, 19, 43, 0.96);
    --panel-gradient-end: #090b20;
    --accent-shadow: rgba(255, 67, 209, 0.26);
}

html[data-theme="custom"] {
    --line: color-mix(in srgb, var(--panel-2) 72%, var(--text));
    --body-background: radial-gradient(circle at 92% 0, color-mix(in srgb, var(--red-bright) 26%, transparent) 0, transparent 34rem), radial-gradient(circle at 8% 100%, color-mix(in srgb, var(--gold) 14%, transparent) 0, transparent 30rem), var(--bg);
    --topbar-bg: color-mix(in srgb, var(--bg) 90%, transparent);
    --panel-glass: color-mix(in srgb, var(--panel) 96%, transparent);
    --panel-gradient-end: color-mix(in srgb, var(--panel) 76%, var(--bg));
    --accent-shadow: color-mix(in srgb, var(--red-bright) 25%, transparent);
}

* {
    box-sizing: border-box;
}

html {
    font-family: Inter, Segoe UI, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--body-background);
    background-attachment: fixed;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
textarea,
select {
    font: inherit;
}

.topbar {
    min-height: var(--topbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    border-bottom: 1px solid var(--line);
    background: var(--topbar-bg);
    position: sticky;
    top: 0;
    z-index: 20;
    backdrop-filter: blur(14px);
}

.brand {
    font-weight: 900;
    letter-spacing: 0.08em;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    order: 1;
}

.topbar-page-context {
    order: 2;
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.game-header-context {
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.game-header-context h2 {
    max-width: min(38vw, 32rem);
    margin: 0;
    overflow: hidden;
    font-size: clamp(1rem, 1.45vw, 1.35rem);
    text-overflow: ellipsis;
    white-space: nowrap;
}

    .brand span {
        color: var(--red-bright);
    }

.brand-logo {
    display: block;
    width: auto;
    height: 44px;
    max-width: min(280px, 28vw);
    object-fit: contain;
}

.brand-logo-input-row {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-logo-preview {
    width: 140px;
    height: 54px;
    object-fit: contain;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 4px;
    background: transparent;
}

.topbar nav {
    display: flex;
    gap: 22px;
    color: var(--muted);
    font-size: 1.05rem;
    line-height: 1.15;
}

.action-menu {
    position: relative;
    flex: 0 0 auto;
}

.action-menu > summary {
    list-style: none;
}

.action-menu > summary::-webkit-details-marker {
    display: none;
}

.action-menu-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
}

.action-menu[open] > .action-menu-trigger {
    border-color: var(--red-bright);
}

.action-menu-popover {
    position: absolute;
    top: calc(100% + 0.55rem);
    right: 0;
    z-index: 120;
    display: grid;
    min-width: 15rem;
    max-width: min(22rem, calc(100vw - 2rem));
    padding: 0.45rem;
    border: 1px solid var(--line);
    border-radius: 0.8rem;
    background: var(--panel);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
}

.action-menu-popover form {
    display: contents;
}

.action-menu-item {
    display: block;
    width: 100%;
    padding: 0.7rem 0.8rem;
    border: 0;
    border-radius: 0.55rem;
    background: transparent;
    color: var(--text);
    font: inherit;
    text-align: left;
    white-space: normal;
    cursor: pointer;
}

.action-menu-item:hover,
.action-menu-item:focus-visible,
.action-menu-item.active {
    background: var(--panel-2);
    color: var(--text);
    outline: none;
}

.action-menu-item:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

.action-menu-danger {
    color: color-mix(in srgb, #ef233c 82%, var(--text));
}

.action-menu-separator {
    height: 1px;
    margin: 0.35rem 0.25rem;
    background: var(--line);
}

.header-action-menu .action-menu-popover {
    min-width: 17rem;
}

.header-action-menu {
    order: 4;
    margin-left: 0.65rem;
}

.quiz-action-menu .action-menu-popover,
.board-action-menu .action-menu-popover {
    min-width: 16rem;
}

    .topbar nav a:hover {
        color: var(--red-bright);
    }

.page-shell {
    padding: 34px;
    max-width: 1800px;
    margin: 0 auto;
}

.hero {
    min-height: calc(100vh - 140px);
    display: grid;
    align-content: center;
    max-width: 850px;
}

    .hero h1 {
        font-size: clamp(3rem, 8vw, 7rem);
        line-height: 0.92;
        margin: 12px 0 24px;
        letter-spacing: -0.055em;
    }

.hero-copy {
    max-width: 680px;
    font-size: 1.25rem;
    line-height: 1.6;
    color: var(--muted);
}

.hero-actions,
.form-actions,
.editor-actions,
.card-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.discord-button {
    gap: 9px;
}

.discord-button svg {
    width: 1.35em;
    height: 1.35em;
    flex: 0 0 auto;
}

.eyebrow {
    color: var(--red-bright);
    font-weight: 800;
    letter-spacing: 0.16em;
    font-size: 0.75rem;
}

.button {
    border: 1px solid var(--line);
    padding: 12px 18px;
    border-radius: 10px;
    font-weight: 800;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
}

.button-primary {
    background: var(--red);
    border-color: var(--red-bright);
    color: white;
    box-shadow: 0 8px 24px var(--accent-shadow);
    transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

    .button-primary:hover {
        background: var(--red-bright);
        transform: translateY(-1px);
        box-shadow: 0 10px 30px var(--accent-shadow);
    }

.button-secondary {
    background: var(--panel);
    color: var(--text);
}

    .button-secondary:hover {
        border-color: #646473;
    }

.page-heading,
.editor-toolbar {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 28px;
}

h1,
h2,
p {
    margin-top: 0;
}

.page-heading h1,
.editor-toolbar h1 {
    margin-bottom: 0;
}

.quiz-list {
    display: grid;
    gap: 14px;
}

.quiz-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: linear-gradient(145deg, var(--panel), var(--panel-gradient-end));
}

    .quiz-card p,
    .quiz-card small {
        color: var(--muted);
    }

.form-card,
.content-panel {
    background: var(--panel-glass);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 24px;
}

.narrow {
    max-width: 720px;
    margin: 30px auto;
}

.stack-form {
    display: grid;
    gap: 10px;
}

label {
    font-weight: 750;
}

input,
textarea,
select {
    width: 100%;
    background: color-mix(in srgb, var(--panel) 88%, var(--text));
    color: var(--text);
    border: 2px solid var(--line);
    border-radius: 8px;
    padding: 12px 14px;
}

    input:focus,
    textarea:focus,
    select:focus {
        outline: none;
        border-color: var(--red-bright);
    }

textarea {
    resize: vertical;
}

.faq-page {
    width: min(920px, 100%);
    margin: 0 auto;
}

.faq-heading {
    margin-bottom: 24px;
}

.faq-list {
    display: grid;
    gap: 12px;
}

.faq-item {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--panel-glass);
    box-shadow: 0 12px 28px rgba(0, 0, 0, .12);
}

.faq-item summary {
    position: relative;
    padding: 20px 54px 20px 22px;
    color: var(--text);
    font-size: 1.05rem;
    font-weight: 850;
    line-height: 1.35;
    cursor: pointer;
    list-style: none;
}

.faq-item summary::-webkit-details-marker {
    display: none;
}

.faq-item summary::after {
    content: "+";
    position: absolute;
    top: 50%;
    right: 22px;
    color: var(--gold);
    font-size: 1.55rem;
    line-height: 1;
    transform: translateY(-50%);
}

.faq-item[open] summary {
    border-bottom: 1px solid var(--line);
    background: color-mix(in srgb, var(--red) 12%, var(--panel));
}

.faq-item[open] summary::after {
    content: "−";
}

.faq-answer {
    padding: 18px 22px 20px;
    color: var(--muted);
    line-height: 1.65;
}

.faq-answer p,
.faq-contact p {
    margin: 0;
}

.faq-contact {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin-top: 28px;
}

.faq-contact h2 {
    margin: 0 0 8px;
}

@media (max-width: 640px) {
    .faq-item summary {
        padding: 17px 48px 17px 17px;
    }

    .faq-item summary::after {
        right: 17px;
    }

    .faq-answer {
        padding: 16px 17px 18px;
    }

    .faq-contact {
        align-items: stretch;
        flex-direction: column;
    }
}

.round-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.round-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.round-drag-handle {
    cursor: grab;
    color: var(--muted);
    font-size: 16px;
    user-select: none;
    opacity: .65;
    transition: .15s;
}

    .round-drag-handle:hover {
        opacity: 1;
        color: var(--gold);
    }

    .round-drag-handle:active {
        cursor: grabbing;
    }

    .round-tab.active {
        border-color: var(--gold);
        color: var(--gold);
    }

.round-tab-item {
    flex: 0 0 auto;
}

.round-tab-ghost {
    opacity: 0.3;
    border-color: var(--red-bright);
}

.round-tab-chosen {
    border-color: var(--gold);
}

.round-tab-dragging {
    opacity: 0.9;
    cursor: grabbing;
}

.round-add-button {
    flex: 0 0 auto;
}

.round-tab-link {
    display: inline-flex;
    align-items: center;
    color: inherit;
    text-decoration: none;
}

    .round-tab-link:hover {
        color: inherit;
    }

.quiz-board-form {
    display: grid;
    gap: 14px;
}

.quiz-board-scroll {
    max-width: 100%;
    overflow: auto;
    border-radius: 12px;
    background: color-mix(in srgb, var(--bg) 88%, #000);
}

.quiz-board {
    display: flex;
    align-items: stretch;
    gap: 5px;
    width: 100%;
    min-width: 0;
    padding: 5px;
    box-sizing: border-box;
    background: color-mix(in srgb, var(--bg) 88%, #000);
}

.quiz-board-corner,
.category-cell,
.question-points-cell,
.question-cell {
    min-height: 120px;
    border: 1px solid var(--line);
    background: linear-gradient(145deg, var(--panel-2), var(--panel-gradient-end));
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    position: relative;
}

.quiz-board-corner,
.category-cell {
    min-height: 105px;
    position: sticky;
    top: 0;
    z-index: 4;
}

.quiz-board-corner {
    left: 0;
    z-index: 6;
    background: linear-gradient(145deg, color-mix(in srgb, var(--red) 24%, var(--panel)), var(--panel-gradient-end));
}

.category-cell {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    font-size: 1.25rem;
    font-weight: 900;
    text-transform: uppercase;
    padding: 12px 14px;
    background: linear-gradient(145deg, color-mix(in srgb, var(--red) 28%, var(--panel-2)), var(--panel));
}

.category-title {
    min-width: 0;
    text-align: center;
    overflow-wrap: anywhere;
}

.category-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.category-actions .icon-button {
    width: 36px;
    height: 36px;
    min-height: 36px;
    flex: 0 0 36px;
}

.question-points-cell {
    position: sticky;
    left: 0;
    z-index: 3;
    padding: 12px;
    background: linear-gradient(145deg, color-mix(in srgb, var(--red) 28%, var(--panel-2)), var(--panel));
}

.question-points-input {
    width: 100%;
    min-width: 0;
    padding: 10px 8px;
    border: 1px solid rgba(242, 177, 52, 0.45);
    background: var(--panel-gradient-end);
    color: var(--gold);
    text-align: center;
    font-size: 1.18rem;
    font-weight: 950;
    font-variant-numeric: tabular-nums;
}

.question-points-input:hover,
.question-points-input:focus {
    border-color: var(--gold);
}

.quiz-board-actions {
    display: flex;
    justify-content: flex-end;
}

.question-cell:hover {
    border-color: var(--red-bright);
    transform: translateY(-1px);
}

.question-cell.filled {
    background: linear-gradient(145deg, color-mix(in srgb, var(--red) 18%, var(--panel-2)), var(--panel));
}

.question-editor-preview {
    display: flex;
    min-width: 0;
    max-width: 100%;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 30px 12px 31px;
}

.question-editor-preview img {
    display: block;
    width: min(100%, 110px);
    height: 56px;
    border-radius: 7px;
    object-fit: contain;
}

.question-editor-preview-text {
    display: -webkit-box;
    overflow: hidden;
    color: var(--text);
    font-size: .82rem;
    font-weight: 750;
    line-height: 1.25;
    overflow-wrap: anywhere;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

.question-editor-preview-media {
    color: var(--gold);
    font-size: 1.8rem;
    line-height: 1;
}

.question-editor-preview-type {
    color: var(--muted);
    font-size: .72rem;
    font-weight: 800;
    text-transform: uppercase;
}

.question-completion {
    position: absolute;
    right: 8px;
    bottom: 7px;
    left: 8px;
    display: flex;
    justify-content: center;
    gap: 5px;
}

.question-completion-item {
    padding: 2px 6px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    background: color-mix(in srgb, var(--panel) 88%, transparent);
    font-size: .64rem;
    font-weight: 900;
    line-height: 1.2;
}

.question-completion-item.complete {
    border-color: color-mix(in srgb, #238636 68%, var(--line));
    color: color-mix(in srgb, #238636 72%, var(--text));
    background: color-mix(in srgb, #238636 14%, var(--panel));
}

.question-cell-slot {
    position: relative;
    min-width: 0;
    min-height: 0;
    height: 100%;
    cursor: grab;
}

.question-cell-slot .question-cell {
    width: 100%;
    height: 100%;
}

.question-cell-slot:active {
    cursor: grabbing;
}

.question-exchange-button {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 2;
    width: 34px;
    height: 34px;
    min-height: 34px;
    padding: 0;
    opacity: .82;
}

.question-exchange-button:hover,
.question-exchange-button:focus-visible {
    opacity: 1;
}

.question-cell-dragging {
    opacity: .42;
}

.question-cell-drop-target .question-cell {
    border-color: var(--gold);
    box-shadow: inset 0 0 0 2px var(--gold), 0 0 18px var(--accent-shadow);
}

.question-editor-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 28px;
}

.panel-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--line);
    margin-bottom: 16px;
}

    .panel-title-row h2 {
        margin-bottom: 14px;
    }

.type-tabs {
    display: flex;
    gap: 6px;
}

.type-tab {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text);
    font-weight: 900;
    cursor: pointer;
}

    .type-tab.active {
        background: var(--red);
        border-color: var(--red-bright);
    }

.editor-type-panel {
    display: none;
    gap: 10px;
}

    .editor-type-panel.active {
        display: grid;
    }

.drop-zone {
    min-height: 150px;
    border: 2px dashed #686876;
    border-radius: 10px;
    background: #d9d9e2;
    color: #15151b;
    display: grid;
    place-content: center;
    text-align: center;
    padding: 20px;
}

    .drop-zone small {
        color: #62626e;
        margin-top: 8px;
    }

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
}

    .checkbox-row input {
        width: auto;
    }

.editor-actions {
    justify-content: center;
    margin-top: 24px;
}

@media (max-width: 900px) {
    .page-shell {
        padding: 20px;
    }

    .topbar {
        padding: 0 18px;
    }

    .question-editor-grid {
        grid-template-columns: 1fr;
    }

    .editor-toolbar,
    .page-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .quiz-board {
        grid-template-columns: 88px repeat(var(--columns), minmax(130px, 1fr));
    }

    .quiz-board-corner,
    .category-cell,
    .question-points-cell,
    .question-cell {
        min-height: 100px;
    }

    .question-points-cell {
        padding: 8px;
    }

    .question-points-input {
        padding: 9px 4px;
        font-size: 1rem;
    }
}

.alert {
    margin-bottom: 1rem;
    padding: 0.85rem 1rem;
    border-radius: 0.65rem;
}

.alert-success {
    border: 1px solid rgba(63, 185, 80, 0.45);
    background: rgba(63, 185, 80, 0.12);
}

.validation-summary,
.field-validation-error {
    color: #ff8d8d;
}

    .validation-summary:empty,
    .field-validation-valid {
        display: none;
    }

.language-selector {
    position: relative;
    margin-left: 22px;
    order: 3;
}

.language-button {
    width: 44px;
    height: 40px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--panel);
    color: var(--text);
    cursor: pointer;
    font-size: 1.35rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .language-button:hover,
    .language-button:focus {
        border-color: var(--red-bright);
        outline: none;
    }

.language-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 185px;
    padding: 7px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--panel-glass);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
    display: none;
    z-index: 100;
}

    .language-menu.open {
        display: grid;
    }

    .language-menu a {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 10px 12px;
        border-radius: 8px;
        color: var(--muted);
        white-space: nowrap;
        cursor: pointer;
    }

    .language-menu a:not(.active) {
        color: var(--muted);
    }

        .language-menu a:hover {
            background: var(--panel-2);
            color: var(--text);
        }

@media (max-width: 700px) {
    .topbar {
        gap: 12px;
    }

        .topbar nav {
            gap: 12px;
        }

    .language-selector {
        margin-left: 0;
    }
}

.language-menu a.active {
    background: var(--red);
    color: white;
}

#success-message {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

    #success-message.success-message-hidden {
        opacity: 0;
        transform: translateY(-6px);
    }

[data-auto-dismiss] {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

[data-auto-dismiss].message-hidden {
    opacity: 0;
    transform: translateY(-6px);
}

.content-block-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.content-block-add-menu {
    position: relative;
}

.content-block-type-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 20;
    min-width: 180px;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel-glass);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.content-block-type-option {
    display: block;
    width: 100%;
    padding: 9px 12px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: inherit;
    text-align: left;
    cursor: pointer;
}

    .content-block-type-option:hover {
        background: var(--panel-2);
    }

.content-block-card {
    position: relative;
    transition: opacity 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

    .content-block-card h3,
    .content-block-card h4,
    .content-block-card .content-block-title {
        padding-right: 76px;
    }

.content-block-toolbar {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 6px;
}

.content-block-drag-handle,
.content-block-remove-button {
    width: 28px;
    height: 28px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #9a9aa3;
    font-family: Arial, sans-serif;
    line-height: 1;
    opacity: 0.65;
    transition: opacity 0.15s, background-color 0.15s, color 0.15s;
}

.content-block-drag-handle {
    font-size: 18px;
    cursor: grab;
    user-select: none;
}

    .content-block-drag-handle:hover {
        background: rgba(255, 255, 255, 0.1);
        color: var(--text);
        opacity: 1;
    }

    .content-block-drag-handle:active {
        cursor: grabbing;
    }

.content-block-remove-button {
    font-size: 24px;
    cursor: pointer;
}

    .content-block-remove-button:hover {
        background: rgba(220, 53, 69, 0.15);
        color: #ff6b6b;
        opacity: 1;
    }

.content-block-dragging {
    opacity: 0.45;
    transform: scale(0.99);
}

.content-block-drop-before {
    box-shadow: 0 -4px 0 0 var(--red-bright);
}

.content-block-drop-after {
    box-shadow: 0 4px 0 0 var(--red-bright);
}

.image-block-preview {
    margin-top: 16px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: color-mix(in srgb, var(--bg) 55%, transparent);
    text-align: center;
}

.image-block-preview-image {
    display: block;
    max-width: 100%;
    max-height: 420px;
    margin: 0 auto;
    border-radius: 8px;
    object-fit: contain;
}

.image-block-preview-top-caption,
.image-block-preview-bottom-caption {
    font-weight: 700;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.image-block-preview-top-caption {
    margin-bottom: 10px;
}

.image-block-preview-bottom-caption {
    margin-top: 10px;
}

.image-block-preview-error {
    padding: 18px;
    color: #ff8d8d;
}

.stored-image-preview {
    margin-bottom: 12px;
}

.stored-image-preview-element {
    display: block;
    max-width: 100%;
    max-height: 400px;
    object-fit: contain;
    border-radius: 8px;
    margin-bottom: 8px;
}

.stored-file-info {
    font-size: 14px;
}

.stored-audio-preview {
    margin-bottom: 12px;
}

.stored-audio-preview-element {
    display: block;
    width: 100%;
    margin-bottom: 8px;
}

.audio-block-editor {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.stored-file-preview {
    margin-bottom: 12px;
}

.remove-stored-file-button {
    margin-top: 8px;
}

/* Quiz management: rename and delete dialogs */

.quiz-card-content {
    min-width: 0;
}

.button-danger {
    color: #fff;
}

.button-danger {
    background: #9f101b;
    border-color: var(--red-bright);
}

    .button-danger:hover {
        background: var(--red-bright);
    }

.button-danger-outline {
    background: transparent;
    color: color-mix(in srgb, #d41f35 78%, var(--text));
    border-color: currentColor;
}

    .button-danger-outline:hover {
        color: color-mix(in srgb, #ef233c 82%, var(--text));
        background: color-mix(in srgb, #ef233c 12%, transparent);
        border-color: currentColor;
    }

.button:disabled,
.button[disabled],
.button-danger:disabled,
.button-danger-outline:disabled {
    color: var(--muted);
    background: var(--panel-2);
    border-color: var(--line);
    box-shadow: none;
    opacity: 0.72;
    cursor: not-allowed;
    transform: none;
}

.button:disabled:hover,
.button[disabled]:hover {
    color: var(--muted);
    background: var(--panel-2);
    border-color: var(--line);
    transform: none;
}

.icon-button {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-size: 1.15rem;
}

.message {
    margin-bottom: 20px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 10px;
    font-weight: 700;
}

.message-success {
    background: rgba(46, 160, 67, .12);
    border-color: rgba(63, 185, 80, .55);
}

.message-error {
    background: rgba(239, 35, 60, .12);
    border-color: rgba(239, 35, 60, .62);
}

.app-dialog {
    width: min(580px, calc(100vw - 32px));
    max-height: calc(100vh - 32px);
    padding: 0;
    overflow: auto;
    color: var(--text);
    background: transparent;
    border: 0;
}

    .app-dialog::backdrop {
        background: rgba(0, 0, 0, .76);
        backdrop-filter: blur(5px);
    }

.dialog-card {
    padding: 24px;
    color: var(--text);
    background: linear-gradient(145deg, var(--panel-2), var(--panel-gradient-end));
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, .55);
}

.dialog-card-danger {
    border-color: rgba(239, 35, 60, .55);
}

.dialog-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 20px;
}

    .dialog-heading h2 {
        margin-bottom: 0;
    }

.dialog-close {
    width: 40px;
    height: 40px;
    flex: 0 0 auto;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--text);
    background: var(--panel);
    cursor: pointer;
    font-size: 1.6rem;
    line-height: 1;
}

    .dialog-close:hover {
        border-color: var(--red-bright);
    }

.dialog-actions {
    justify-content: flex-end;
    margin-top: 24px;
}

.blocked-player-list {
    display: grid;
    gap: 0.65rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.blocked-player-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem;
    border: 1px solid var(--line);
    border-radius: 0.7rem;
    background: var(--panel);
}

.dialog-target {
    padding: 14px 16px;
    border-left: 3px solid var(--red-bright);
    background: color-mix(in srgb, var(--red-bright) 8%, transparent);
    font-size: 1.08rem;
    font-weight: 850;
    overflow-wrap: anywhere;
}

.dialog-warning {
    color: var(--muted);
}

@media (max-width: 700px) {
    .quiz-card {
        align-items: stretch;
        flex-direction: column;
    }

    .card-actions form {
        display: flex;
        flex: 1 1 auto;
    }

    .card-actions form .button {
        width: 100%;
    }

    .card-actions .button {
        flex: 1 1 auto;
    }
}

/* Quiz editor: round management */

.round-navigation {
    display: grid;
    justify-items: end;
    gap: 10px;
}

.round-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.round-action-button {
    min-height: 38px;
    padding: 8px 13px;
}

.alert-error {
    border: 1px solid rgba(239, 35, 60, 0.55);
    background: rgba(239, 35, 60, 0.12);
}

@media (max-width: 900px) {
    .round-navigation {
        width: 100%;
        justify-items: start;
    }

    .round-actions {
        justify-content: flex-start;
    }
}

/* Quiz editor: board point values */

.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

@media (max-width: 700px) {
    .quiz-board-actions .button {
        width: 100%;
    }
}

/* Quiz editor: draggable category columns */

.quiz-board-points-column {
    width: 104px;
    flex: 0 0 104px;
    display: grid;
    grid-template-rows: 105px repeat(var(--row-count, 5), 120px);
    gap: 5px;
    position: sticky;
    left: 0;
    z-index: 5;
}

.quiz-board-categories {
    display: flex;
    align-items: stretch;
    gap: 5px;
    flex: 1 1 auto;
    min-width: 0;
}

.quiz-board-category-column {
    flex: 1 1 160px;
    min-width: 160px;
    max-width: none;
    display: grid;
    grid-template-rows: 105px repeat(var(--row-count, 5), 120px);
    gap: 5px;
}

.category-cell,
.question-cell,
.question-points-cell,
.quiz-board-corner {
    min-height: 0;
    height: 100%;
}

.category-drag-handle {
    flex: 0 0 auto;
    cursor: grab;
    color: var(--muted);
    font-size: 18px;
    line-height: 1;
    user-select: none;
    opacity: .65;
    transition: opacity .15s, color .15s;
}

.category-drag-handle:hover {
    color: var(--gold);
    opacity: 1;
}

.category-drag-handle:active {
    cursor: grabbing;
}

.category-column-ghost {
    opacity: .3;
}

.category-column-chosen .category-cell {
    border-color: var(--gold);
}

.category-column-dragging {
    opacity: .9;
    cursor: grabbing;
}

@media (max-width: 900px) {
    .quiz-board-points-column {
        width: 88px;
        flex-basis: 88px;
        grid-template-rows: 100px repeat(var(--row-count, 5), 100px);
    }

    .quiz-board-category-column {
        min-width: 130px;
        width: 130px;
        grid-template-rows: 100px repeat(var(--row-count, 5), 100px);
    }
}


/* Game lobby and player joining */

.game-code-panel {
    display: grid;
    justify-items: center;
    gap: 8px;
    padding: 24px;
    border: 1px solid rgba(242, 177, 52, 0.5);
    border-radius: 12px;
    background: rgba(242, 177, 52, 0.08);
    text-align: center;
}

.game-code-panel span,
.game-code-panel small {
    color: var(--muted);
}

.game-code-panel strong {
    color: var(--gold);
    font-size: clamp(2.4rem, 10vw, 4.5rem);
    letter-spacing: 0.16em;
    line-height: 1;
}

.game-code-panel.compact strong {
    font-size: clamp(2rem, 9vw, 3.2rem);
}

.player-list {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.player-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--panel-2);
}

.player-list li.current-player {
    border-color: var(--gold);
}

.player-lobby h2 {
    margin-top: 22px;
}


/* Player presence */

.player-presence {
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.presence-badge {
    min-width: 96px;
    padding: 5px 9px;
    border: 1px solid var(--line);
    border-radius: 999px;
    text-align: center;
    font-size: 0.78rem;
    font-weight: 850;
}

.presence-active {
    color: color-mix(in srgb, #238636 78%, var(--text));
    border-color: currentColor;
    background: color-mix(in srgb, #3fb950 15%, transparent);
}

.presence-inactive {
    color: color-mix(in srgb, #9a6700 78%, var(--text));
    border-color: currentColor;
    background: color-mix(in srgb, #f2b134 16%, transparent);
}

.presence-disconnected {
    color: color-mix(in srgb, #d1242f 78%, var(--text));
    border-color: currentColor;
    background: color-mix(in srgb, #ef233c 14%, transparent);
}


/* Host runtime game board */

.host-game-board {
    margin-top: 0;
}

.host-game-heading {
    align-items: center;
    margin-bottom: 16px;
}

.host-game-heading h2 {
    margin-bottom: 0;
}

.host-board-grid {
    display: grid;
    grid-template-columns: repeat(var(--board-columns), minmax(150px, 1fr));
    height: 100%;
    min-height: 0;
    gap: 6px;
    overflow: auto;
    padding: 6px;
    border-radius: 14px;
    background: color-mix(in srgb, var(--bg) 88%, #000);
}

.host-board-layout {
    flex: 1 1 auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    min-width: 0;
    min-height: 0;
}

.board-player-sidebar {
    display: none;
}

.board-host-sidebar {
    position: fixed;
    z-index: 17;
    left: var(--board-host-left, 12px);
    top: var(--board-host-top, 120px);
    display: none;
    width: var(--board-host-width, 238px);
    height: var(--board-host-height, 300px);
    min-width: 0;
    align-self: start;
}

.board-host-sidebar .host-card {
    width: 100%;
    height: 100%;
    min-width: 0;
    max-width: none;
    box-sizing: border-box;
}

.board-host-card-list {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    list-style: none;
}

.board-host-card-resizer {
    position: absolute;
    z-index: 4;
    right: -7px;
    bottom: -7px;
    width: 22px;
    height: 22px;
    border: 2px solid var(--gold);
    border-top: 0;
    border-left: 0;
    border-radius: 0 0 7px 0;
    cursor: nwse-resize;
    touch-action: none;
}

.board-host-card-resizer:hover,
.board-host-card-resizer:focus-visible,
.is-resizing-host-card .board-host-card-resizer {
    filter: brightness(1.35);
}

.board-host-card-drag-handle {
    position: absolute;
    z-index: 5;
    top: -9px;
    left: 50%;
    width: 58px;
    height: 20px;
    border: 2px solid var(--gold);
    border-radius: 999px;
    background: var(--panel);
    cursor: ns-resize;
    touch-action: none;
    transform: translateX(-50%);
}

.board-host-card-drag-handle::after {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: var(--gold);
    content: "•••";
    font-size: .7rem;
    letter-spacing: .12em;
    line-height: 1;
}

.board-host-card-drag-handle:hover,
.board-host-card-drag-handle:focus-visible,
.is-moving-host-card .board-host-card-drag-handle {
    filter: brightness(1.35);
}

.is-moving-host-card {
    cursor: ns-resize;
    user-select: none;
}

.board-player-list {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.board-player-list li {
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: linear-gradient(145deg, var(--panel-2), var(--panel-gradient-end));
}

.board-player-name {
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    font-weight: 800;
}

.board-player-name > span {
    display: inline-block;
}

.board-player-name.is-overflowing > span {
    padding-left: 100%;
    animation: board-player-name-scroll 8s linear infinite;
}

.board-player-score {
    color: var(--gold);
    font-size: 1.2rem;
    font-variant-numeric: tabular-nums;
}

.board-player-score.score-negative {
    color: #ff5d68;
}

@keyframes board-player-name-scroll {
    from { transform: translateX(0); }
    to { transform: translateX(-100%); }
}

@media (prefers-reduced-motion: reduce) {
    .board-player-name.is-overflowing > span {
        padding-left: 0;
        animation: none;
        text-overflow: ellipsis;
        overflow: hidden;
        max-width: 100%;
    }
}

@media (min-width: 1500px) {
    .host-board-layout {
        grid-template-columns: minmax(0, 1fr) 250px;
        align-items: stretch;
        gap: 18px;
    }

    .board-player-sidebar {
        display: block;
        min-width: 0;
        max-height: 100%;
        overflow-y: auto;
    }

    .host-game-board:has(.board-player-sidebar) .game-scoreboard .scoreboard-score {
        display: none;
    }
}

@media (min-width: 1750px) {
    .board-host-sidebar.is-positioned {
        display: block;
    }
}

.host-board-column {
    display: grid;
    grid-auto-rows: minmax(92px, 1fr);
    gap: 6px;
    min-width: 150px;
    min-height: 0;
}

.host-board-column h3 {
    min-height: 92px;
    margin: 0;
    padding: 14px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    background: linear-gradient(145deg, color-mix(in srgb, var(--red) 28%, var(--panel-2)), var(--panel));
    text-align: center;
    text-transform: uppercase;
    font-size: var(--category-title-size, 1.2rem);
    line-height: 1.08;
    overflow: hidden;
}

.host-board-column form {
    display: flex;
}

.host-board-question {
    width: 100%;
    min-height: 92px;
    border: 1px solid var(--line);
    background: linear-gradient(145deg, var(--panel-2), var(--panel-gradient-end));
    color: var(--gold);
    font-size: 1.65rem;
    font-weight: 950;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.host-board-question.status-resolved {
    border-color: var(--line);
    color: var(--muted);
    background: linear-gradient(145deg, var(--panel), var(--bg));
    box-shadow: inset 0 0 28px rgba(0, 0, 0, 0.58);
    filter: grayscale(0.85) saturate(0.35) brightness(0.62);
    opacity: 0.5;
    transition: opacity 140ms ease, filter 140ms ease;
}

.host-board-question.status-resolved:hover {
    filter: grayscale(0.6) saturate(0.5) brightness(0.78);
    opacity: 0.72;
}

.question-review-preview {
    display: grid;
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.question-review-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.question-review-heading h2 {
    margin-bottom: 0;
}

.question-review-content {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
}

.question-review-content .game-content-presentation {
    min-height: 24rem;
    padding: clamp(1rem, 3vw, 2rem);
    border: 1px solid var(--line);
    border-radius: 1rem;
    background: var(--panel-2);
}

.question-review-content .game-content-text {
    font-size: clamp(1.4rem, 3vw, 2.6rem);
}

.question-review-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
}

@media (max-width: 900px) {
    .question-review-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .question-review-content {
        grid-template-columns: 1fr;
    }
}

.host-board-question:hover:not(:disabled) {
    border-color: var(--red-bright);
    transform: translateY(-1px);
}

.host-board-question:disabled {
    cursor: default;
    opacity: 0.48;
}

.host-board-question.status-selected,
.host-board-question.status-awaitingwager {
    border-color: var(--gold);
    background: rgba(242, 177, 52, 0.14);
    opacity: 1;
}

.current-question-summary {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
    border-color: rgba(242, 177, 52, 0.55);
}

/* Quiz editor: wager questions */

.wager-question-setting span {
    display: grid;
    gap: 3px;
}

.wager-question-setting small {
    color: var(--muted);
    font-weight: 500;
}

.question-cell.wager-question {
    border-color: rgba(242, 177, 52, 0.65);
}

.question-wager-badge {
    position: absolute;
    top: 10px;
    left: 12px;
    padding: 3px 7px;
    border: 1px solid rgba(242, 177, 52, 0.65);
    border-radius: 999px;
    color: var(--gold);
    background: rgba(242, 177, 52, 0.12);
    font-size: 0.7rem;
    font-weight: 850;
    text-transform: uppercase;
}

/* In-game player scoreboard */

.game-scoreboard {
    display: flex;
    align-items: stretch;
    justify-content: center;
    gap: 10px;
    margin: 18px 0 0;
    padding: 0 6px 6px;
    overflow-x: auto;
    list-style: none;
}

.player-join-lock-form {
    position: fixed;
    z-index: 19;
    right: max(12px, calc((100vw - 1800px) / 2 + 12px));
    bottom: calc((var(--game-scoreboard-space) - 42px) / 2);
}

.player-join-lock {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--text);
    background: var(--panel-2);
    box-shadow: 0 5px 18px rgba(0, 0, 0, 0.35);
    cursor: pointer;
    font-size: 1.3rem;
}

.player-join-lock.is-open {
    border-color: rgba(72, 199, 142, 0.8);
    background: rgba(37, 112, 78, 0.95);
}

.player-join-lock.is-closed {
    border-color: rgba(255, 93, 104, 0.8);
    background: rgba(123, 38, 48, 0.95);
}

.player-join-lock:hover {
    transform: translateY(-1px);
    filter: brightness(1.12);
}

.scoreboard-player {
    position: relative;
    min-width: 207px;
    max-width: 311px;
    flex: 1 1 230px;
    display: grid;
    align-content: center;
    justify-items: center;
    gap: 8px;
    padding: 14px 50px 14px 16px;
    border: 2px solid var(--line);
    border-radius: 10px 10px 0 0;
    background: linear-gradient(145deg, var(--panel-2), var(--panel-gradient-end));
    text-align: center;
}

.game-scoreboard .scoreboard-player:not(.host-card) {
    min-width: var(--player-card-width, 230px);
    max-width: var(--player-card-width, 230px);
    flex: 0 0 var(--player-card-width, 230px);
}

.game-scoreboard .scoreboard-player.host-card {
    min-width: var(--host-bottom-card-width, 230px);
    max-width: var(--host-bottom-card-width, 230px);
    flex: 0 0 var(--host-bottom-card-width, 230px);
}

.player-card-width-resizer {
    position: absolute;
    z-index: 5;
    top: 50%;
    left: -6px;
    width: 12px;
    height: 52px;
    border-radius: 999px;
    background: #77778a;
    box-shadow: 0 0 0 1px #111;
    transform: translateY(-50%);
    cursor: ew-resize;
    touch-action: none;
    transition: height 120ms ease, background 120ms ease;
}

.player-card-width-resizer:hover,
.player-card-width-resizer:focus-visible,
.is-resizing-player-cards .player-card-width-resizer {
    height: 72px;
    background: var(--gold);
}

.is-resizing-player-cards {
    cursor: ew-resize;
    user-select: none;
}

.scoreboard-player > strong {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 1.05rem;
}

.scoreboard-player.host-card {
    grid-template-rows: auto minmax(0, 1fr);
    align-content: stretch;
    padding-right: 16px;
}

.board-host-sidebar .player-card-width-resizer {
    display: none;
}

.host-card-media {
    width: 100%;
    height: 100%;
    min-height: 0;
    max-height: none;
    object-fit: contain;
    border-radius: 8px;
    background: transparent;
}

.host-image-field {
    grid-column: 1 / -1;
}

.host-image-input-row {
    display: flex;
    align-items: center;
    gap: 14px;
}

.host-image-input-row input[type="file"] {
    min-width: 0;
    flex: 1 1 auto;
}

.host-image-preview {
    width: 88px;
    height: 66px;
    flex: 0 0 auto;
    object-fit: contain;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--bg);
}

.host-image-preview[hidden] {
    display: none;
}

.host-avatar-field {
    grid-column: 1 / -1;
}

.host-avatar-input-row,
.player-avatar-control {
    display: flex;
    align-items: center;
    gap: 14px;
}

.player-avatar-control {
    flex-wrap: wrap;
}

.player-media-settings {
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--panel-2);
}

.player-media-settings > summary {
    padding: 10px 12px;
    color: var(--text);
    font-weight: 850;
    cursor: pointer;
}

.player-media-settings-content {
    display: grid;
    gap: 10px;
    padding: 0 12px 12px;
}

.player-menu-settings {
    margin-bottom: 8px;
}

.player-menu-settings .player-language-settings {
    padding-top: 0;
    border-top: 0;
}

.player-menu-links {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
}

.player-menu-links .button,
.player-menu-links form,
.player-menu-links form .button {
    width: 100%;
}

.player-menu-links + .player-language-settings {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--line);
}

.player-language-settings {
    display: grid;
    gap: 7px;
    padding-top: 10px;
    border-top: 1px solid var(--line);
}

.player-language-options {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.player-language-options .button {
    min-height: 38px;
    padding: 7px 10px;
}

.player-language-options .is-selected {
    border-color: var(--gold);
    color: var(--text);
    box-shadow: 0 0 0 1px var(--gold);
}

.player-lobby.is-page-buzzer-active {
    cursor: pointer;
}

.player-lobby.is-page-buzzer-active :is(button, a, input, textarea, select, summary) {
    cursor: auto;
}

.player-image-source-switch,
.player-image-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.player-image-source-switch .button,
.player-image-actions .button {
    min-height: 42px;
}

.host-avatar-preview,
.player-avatar-current,
.player-list-avatar {
    width: 64px;
    height: 64px;
    flex: 0 0 auto;
    object-fit: contain;
    border-radius: 10px;
}

.player-webcam-preview,
video.player-card-avatar,
video.host-card-media {
    object-fit: cover;
}

.player-webcam-preview,
video.host-card-media {
    transform: scaleX(-1);
}

.host-avatar-preview[hidden],
.player-avatar-current[hidden] {
    display: none;
}

.player-card-avatar {
    width: 100%;
    height: 100%;
    min-height: 0;
    object-fit: contain;
}

.scoreboard-player:has(.player-card-avatar) {
    grid-template-rows: minmax(0, 1fr) auto auto;
    align-content: stretch;
}

.avatar-picker {
    width: min(960px, calc(100vw - 32px));
    max-width: none;
    max-height: 92dvh;
    padding: 0;
    border: 0;
    border-radius: 16px;
    background: transparent;
}

.avatar-picker::backdrop {
    background: rgba(0, 0, 0, 0.78);
}

.avatar-picker-card {
    max-height: 92dvh;
    overflow: auto;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--panel);
    color: var(--text);
}

.avatar-gender-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
}

.avatar-gender-grid button,
.avatar-option {
    padding: 10px;
    border: 2px solid transparent;
    border-radius: 14px;
    background: var(--panel-2);
    color: var(--text);
    cursor: pointer;
}

.avatar-gender-grid button:hover,
.avatar-option:hover,
.avatar-option:focus-visible {
    border-color: var(--gold);
}

.avatar-gender-grid img,
.avatar-option img {
    width: 100%;
    display: block;
    object-fit: contain;
}

.avatar-picker-toolbar {
    margin-bottom: 12px;
}

.avatar-option-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 10px;
}

@media (max-width: 600px) {
    .avatar-picker {
        width: calc(100vw - 16px);
        max-height: 96dvh;
    }

    .avatar-picker-card {
        max-height: 96dvh;
        padding: 12px;
    }

    .avatar-option-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 7px;
    }
}

.scoreboard-details {
    display: grid;
    justify-items: center;
    gap: 7px;
}

.scoreboard-score {
    color: var(--gold);
    font-size: 1.45rem;
    font-weight: 950;
    font-variant-numeric: tabular-nums;
}

.scoreboard-score.score-negative {
    color: #ff5d68;
}

.scoreboard-details .presence-badge {
    min-width: 0;
    font-size: 0.68rem;
}

.scoreboard-details .button {
    min-height: 34px;
    padding: 6px 10px;
    font-size: 0.75rem;
}

.presence-rejoinpending {
    color: color-mix(in srgb, #9a6700 82%, var(--text));
    border-color: currentColor;
    background: color-mix(in srgb, #f2b134 20%, transparent);
}

@media (max-width: 700px) {
    .game-scoreboard {
        justify-content: flex-start;
    }

    .scoreboard-player {
        min-width: 155px;
    }

    .game-scoreboard .scoreboard-player:not(.host-card) {
        min-width: var(--player-card-width, 155px);
        max-width: var(--player-card-width, 155px);
        flex-basis: var(--player-card-width, 155px);
    }
}

body:has(.player-lobby) > .topbar {
    display: none;
}

body:has(.player-lobby) > .page-shell {
    min-height: 100dvh;
}

@media (max-width: 700px) {
    body:has(.player-lobby:has(.player-buzzer-panel)) > .page-shell {
        height: 100dvh;
    }
}

/* In-game join code overlay */

.join-code-dialog {
    width: min(760px, calc(100vw - 32px));
    max-height: calc(100dvh - 32px);
    padding: 0;
    overflow: auto;
    color: var(--text);
    background: transparent;
    border: 0;
}

.join-code-dialog::backdrop {
    background: rgba(0, 0, 0, 0.82);
    backdrop-filter: blur(8px);
}

.join-code-card {
    position: relative;
    display: grid;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    justify-items: center;
    gap: 18px;
    padding: clamp(28px, 6vw, 64px);
    border: 2px solid var(--gold);
    border-radius: 20px;
    background: radial-gradient(circle at top, color-mix(in srgb, var(--red) 26%, var(--panel-2)), var(--panel-gradient-end) 65%);
    box-shadow: 0 28px 100px rgba(0, 0, 0, 0.7);
    text-align: center;
}

.join-code-card h2 {
    max-width: 100%;
    margin: 0;
    font-size: clamp(1.65rem, 5vw, 3.2rem);
    overflow-wrap: anywhere;
}

.join-code-card .eyebrow {
    margin: 0;
}

.join-code-value {
    display: block;
    max-width: 100%;
    color: var(--gold);
    font-size: clamp(2.4rem, 11vw, 6rem);
    letter-spacing: 0.1em;
    line-height: 0.95;
    text-indent: 0.1em;
    white-space: nowrap;
}

.join-qr-code {
    width: min(320px, 70vw);
    max-width: 100%;
    height: auto;
    box-sizing: border-box;
    padding: 12px;
    border-radius: 12px;
    background: #fff;
    image-rendering: pixelated;
}

.lobby-join-qr {
    width: min(280px, 68vw);
}

.join-selected-game {
    margin: 0;
    padding: 0.75rem 1rem;
    border: 1px solid var(--gold);
    border-radius: 0.75rem;
    color: var(--gold);
    text-align: center;
    font-weight: 700;
}

.join-code-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 44px;
    height: 44px;
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--text);
    background: var(--panel-glass);
    cursor: pointer;
    font-size: 1.7rem;
    line-height: 1;
}

.join-code-close:hover {
    border-color: var(--red-bright);
}

/* Quiz editor: random wager settings */

.round-wager-settings {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(220px, 320px);
    align-items: end;
    gap: 24px;
    margin-bottom: 18px;
}

.round-wager-settings .checkbox-row {
    margin: 0;
}

.round-wager-settings .checkbox-row span,
#random-wager-count-setting {
    display: grid;
    gap: 5px;
}

.round-wager-settings small {
    color: var(--muted);
    font-weight: 500;
}

@media (max-width: 700px) {
    .round-wager-settings {
        grid-template-columns: 1fr;
    }
}


/* Host question wager */

.current-question-summary {
    display: grid;
}

.current-question-heading {
    display: flex;
    justify-content: space-between;
    gap: 16px;
}

.question-wager-form {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) minmax(140px, 220px) auto;
    align-items: end;
    gap: 12px;
    margin-top: 16px;
}

.question-wager-form label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 750;
}

.question-wager-form select,
.question-wager-form input {
    min-height: 46px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--text);
    background: var(--panel);
}

.accepted-wager {
    margin: 12px 0 0;
    color: var(--gold);
    font-weight: 850;
}

@media (max-width: 700px) {
    .current-question-heading {
        flex-direction: column;
    }

    .question-wager-form {
        grid-template-columns: 1fr;
    }
}


/* Active player and wager keypad */

.active-player {
    border-color: var(--gold) !important;
    box-shadow: 0 0 0 1px rgba(242, 177, 52, 0.32);
}

.active-player-badge {
    padding: 4px 8px;
    border: 1px solid rgba(242, 177, 52, 0.65);
    border-radius: 999px;
    color: var(--gold);
    background: rgba(242, 177, 52, 0.12);
    font-size: 0.7rem;
    font-weight: 850;
    text-transform: uppercase;
}

.player-management {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.player-management .button,
.scoreboard-player .button {
    min-height: 32px;
    padding: 5px 9px;
    font-size: 0.72rem;
}

.player-card-actions {
    position: absolute;
    top: 50%;
    right: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transform: translateY(-50%);
}

.player-list .player-card-actions {
    flex-direction: row;
}

.player-list li:has(.player-card-actions) {
    position: relative;
    min-height: 88px;
    padding-right: 88px;
}

.player-management .player-action-button,
.scoreboard-player .player-action-button {
    width: 32px;
    height: 32px;
    min-height: 32px;
    flex: 0 0 32px;
    padding: 0;
    border-radius: 8px;
    font-size: 1rem;
    line-height: 1;
}

.wager-entry-panel {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) minmax(260px, 360px);
    gap: 24px;
    margin-top: 16px;
}

.wager-player-summary {
    display: grid;
    align-content: start;
    gap: 8px;
}

.wager-player-summary span,
.wager-player-summary small {
    color: var(--muted);
}

.wager-player-summary strong {
    color: var(--gold);
    font-size: 1.5rem;
}

.question-wager-form {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin: 0;
}

.wager-display-label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 750;
}

.wager-display {
    width: 100%;
    min-height: 64px !important;
    padding: 8px 14px !important;
    color: var(--gold) !important;
    font-size: 2rem !important;
    font-weight: 950;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.wager-keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.wager-keypad button {
    min-height: 54px;
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--text);
    background: var(--panel-2);
    cursor: pointer;
    font-size: 1.25rem;
    font-weight: 900;
}

.wager-keypad button:hover {
    border-color: var(--gold);
    background: rgba(242, 177, 52, 0.12);
}

.wager-validation {
    min-height: 1.25em;
    margin: 0;
    color: #ff8d8d;
    font-size: 0.82rem;
}

.wager-validation.wager-valid {
    color: color-mix(in srgb, #22c55e 58%, var(--text));
    font-weight: 800;
}

@media (max-width: 700px) {
    .wager-entry-panel {
        grid-template-columns: 1fr;
    }
}


/* Focused wager entry */

.current-question-summary.wager-mode {
    width: 100%;
    min-height: min(680px, calc(100vh - 210px));
    grid-template-columns: minmax(0, 1fr);
    place-items: center;
    align-content: center;
    padding: clamp(20px, 4vw, 48px);
}

.current-question-summary.wager-mode .current-question-heading {
    width: min(720px, 100%);
}

.current-question-summary.wager-mode .wager-entry-panel {
    width: 100%;
    justify-self: stretch;
    grid-template-columns: 160px minmax(0, 1fr);
    align-items: center;
    column-gap: 24px;
}

.current-question-summary.wager-mode .wager-player-summary {
    grid-column: 1;
    width: 100%;
    justify-self: stretch;
    text-align: left;
}

.current-question-summary.wager-mode .question-wager-form {
    grid-column: 2;
    width: min(360px, 100%);
    justify-self: center;
}

.wager-keypad-max {
    grid-column: 1 / -1;
    color: var(--gold) !important;
    border-color: rgba(242, 177, 52, 0.65) !important;
    letter-spacing: 0.08em;
}

@media (max-width: 700px) {
    .current-question-summary.wager-mode {
        min-height: auto;
    }

    .current-question-summary.wager-mode .wager-entry-panel {
        width: min(360px, 100%);
        grid-template-columns: 1fr;
        justify-self: center;
    }

    .current-question-summary.wager-mode .wager-player-summary,
    .current-question-summary.wager-mode .question-wager-form {
        grid-column: 1;
        width: 100%;
        justify-self: stretch;
        text-align: left;
    }
}


/* Host question judgment */

.question-judgment-panel {
    display: grid;
    gap: 14px;
    margin: 18px 0;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--panel-glass);
}

.question-judgment-panel h3 {
    margin: 0;
}

.judgment-player-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px;
}

.judgment-player {
    display: grid;
    gap: 10px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--panel-2);
}

.judgment-player > span {
    color: var(--gold);
    font-weight: 900;
}

.judgment-correct-button {
    color: #fff;
    border-color: rgba(63, 185, 80, 0.7);
    background: #237a37;
}

.judgment-correct-button:hover {
    background: #2ea043;
}

.judgment-incorrect-button {
    color: #fff;
    border-color: rgba(239, 35, 60, 0.7);
    background: #9f101b;
}

.judgment-incorrect-button:hover {
    background: var(--red-bright);
}

.question-attempts {
    display: grid;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.question-attempts li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 10px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
}

.judgment-correct {
    color: #7ee787;
}

.judgment-incorrect {
    color: #ff8d8d;
}


/* Full-screen question and answer presentation */

.current-question-summary:not(.wager-mode) {
    min-height: min(720px, calc(100vh - 210px));
    align-content: center;
    gap: 8px;
    padding: clamp(24px, 4vw, 56px);
}

.game-content-presentation {
    width: min(1200px, 100%);
    min-width: 0;
    margin: 0 auto;
    display: grid;
    justify-items: center;
    gap: 24px;
    text-align: center;
}

.game-content-blocks {
    width: 100%;
    min-width: 0;
    display: grid;
    gap: clamp(18px, 3vw, 36px);
}

.game-content-block {
    min-width: 0;
    display: grid;
    justify-items: center;
    gap: 12px;
}

.game-content-text {
    width: 100%;
    max-width: 1100px;
    margin: 0;
    font-size: clamp(1.8rem, 4.5vw, 4rem);
    font-weight: 850;
    line-height: 1.2;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.game-content-caption {
    max-width: 1000px;
    margin: 0;
    color: var(--muted);
    font-size: clamp(1rem, 2vw, 1.45rem);
    line-height: 1.4;
}

.game-content-image,
.game-content-video {
    display: block;
    width: auto;
    max-width: 100%;
    max-height: min(62vh, 680px);
    border: 0;
    border-radius: 12px;
    object-fit: contain;
}

iframe.game-content-video {
    width: min(100%, 960px);
    aspect-ratio: 16 / 9;
}

.game-content-audio {
    width: min(720px, 100%);
}

.answer-presentation {
    padding-top: 8px;
}

.answer-presentation > .eyebrow {
    color: var(--gold);
}

@media (max-width: 700px) {
    .current-question-summary:not(.wager-mode) {
        min-height: auto;
        padding: 20px;
    }
}


/* Viewport-anchored gameplay layout */

/* Viewport-anchored gameplay layout */

.host-game-board {
    --game-scoreboard-space: 230px;
    min-height: calc(100dvh - var(--topbar-height) - 68px);
    padding-bottom: var(--game-scoreboard-space);
}

@media (max-width: 900px) {
    .host-game-board {
        min-height: calc(100dvh - var(--topbar-height) - 40px);
    }
}

.game-scoreboard {
    position: fixed;
    z-index: 18;
    right: 0;
    bottom: 0;
    left: 0;
    height: var(--game-scoreboard-space);
    min-height: 0;
    max-height: none;
    margin: 0;
    padding: 12px max(66px, calc((100vw - 1800px) / 2 + 66px)) 0
        max(12px, calc((100vw - 1800px) / 2 + 34px));
    border-top: 1px solid var(--line);
    background: color-mix(in srgb, var(--bg) 97%, transparent);
    box-shadow: 0 -16px 36px rgba(0, 0, 0, 0.42);
    backdrop-filter: blur(14px);
}

.game-scoreboard-resizer {
    position: fixed;
    z-index: 20;
    right: 0;
    bottom: calc(var(--game-scoreboard-space) - 8px);
    left: 0;
    height: 16px;
    display: grid;
    place-items: center;
    cursor: ns-resize;
    touch-action: none;
}

.game-scoreboard-resizer span {
    width: 72px;
    height: 5px;
    border-radius: 999px;
    background: #77778a;
    box-shadow: 0 0 0 1px #111;
    transition: width 120ms ease, background 120ms ease;
}

.game-scoreboard-resizer:hover span,
.game-scoreboard-resizer:focus-visible span,
.is-resizing-scoreboard .game-scoreboard-resizer span {
    width: 104px;
    background: var(--gold);
}

.is-resizing-scoreboard {
    cursor: ns-resize;
    user-select: none;
}

.current-question-summary:not(.wager-mode) {
    min-height: calc(100dvh - var(--topbar-height) - var(--game-scoreboard-space) - 24px);
    max-height: calc(100dvh - var(--topbar-height) - var(--game-scoreboard-space) - 24px);
    grid-template-rows: auto minmax(0, 1fr) auto;
    align-content: stretch;
    overflow: hidden;
}

.answering-player-header {
    align-self: start;
    justify-self: center;
    margin: 0;
    text-align: center;
}

.game-content-presentation {
    overflow: hidden;
    min-height: 0;
    height: 100%;
    grid-template-rows: auto minmax(0, 1fr) auto;
    align-content: stretch;
}

.game-content-blocks {
    min-height: 0;
    align-self: stretch;
    align-content: safe center;
    place-items: center;
    overflow: auto;
    overscroll-behavior: contain;
    padding: 12px 8px;
}

.game-content-presentation > form {
    align-self: end;
    justify-self: center;
}

.current-question-summary:not(.wager-mode) > .question-controls {
    align-self: end;
    width: 100%;
    margin: 0;
}

.current-question-summary:not(.wager-mode) .judgment-player {
    grid-template-rows: auto auto 1fr;
}

.current-question-summary:not(.wager-mode) .judgment-player .form-actions {
    align-self: end;
}

@media (max-width: 700px) {
    .host-game-board {
        --game-scoreboard-space: 212px;
    }

    .game-scoreboard {
        min-height: 140px;
        padding-right: 66px;
        padding-left: 12px;
    }

    .current-question-summary:not(.wager-mode) {
        min-height: calc(100dvh - var(--topbar-height) - var(--game-scoreboard-space) - 16px);
        max-height: none;
    }
}


.current-question-summary:not(.wager-mode) > .answering-player-header {
    grid-row: 1;
}

.current-question-summary:not(.wager-mode) > .game-content-presentation {
    grid-row: 2;
}

.current-question-summary:not(.wager-mode) > .question-controls {
    grid-row: 3;
}


/* Center gameplay regions and shared host actions */

.current-question-summary:not(.wager-mode) {
    grid-template-columns: minmax(0, 1fr);
    justify-content: stretch;
    justify-items: stretch;
}

.current-question-summary:not(.wager-mode) > .answering-player-header {
    width: min(960px, 100%);
    justify-self: center;
}

.current-question-summary:not(.wager-mode) > .game-content-presentation {
    width: 100%;
    justify-self: center;
}

.current-question-summary:not(.wager-mode) .game-content-text,
.current-question-summary:not(.wager-mode) .game-content-caption {
    max-width: none;
}

.current-question-summary:not(.wager-mode) > .question-controls {
    width: min(960px, 100%);
    justify-self: center;
}

.judgment-general-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* Keep gameplay content above the fixed player scoreboard */

.host-game-board {
    --game-scoreboard-space: 230px;
    display: flex;
    flex-direction: column;
    /*
     * --topbar-height - top navigation
     * 34px   top padding of .page-shell
     */
    height: calc(100dvh - var(--topbar-height) - 34px);
    min-height: 0;
    /*
     * The scoreboard is position: fixed, so reserve its space
     * inside the gameplay container.
     */
    padding-bottom: var(--game-scoreboard-space);
    /*
     * Cancel the bottom padding of .page-shell so the whole
     * gameplay layout still fits exactly inside the viewport.
     */
    margin-bottom: -34px;
    overflow-y: auto;
}

.current-question-summary:not(.wager-mode) {
    flex: 1 1 auto;
    /*
     * Override the previous viewport-based min/max height.
     * The panel now receives only the free space above the scoreboard.
     */
    height: auto;
    min-height: 0;
    max-height: none;
    margin-bottom: 0;
    padding: 16px clamp(24px, 4vw, 56px) 8px;
    overflow: hidden;
}

/* Let active questions and answers use the viewport instead of the page-shell cap. */
.host-game-board:has(> .current-question-summary:not(.wager-mode)) {
    width: calc(100vw - 32px);
    max-width: none;
    margin-left: calc(50% - 50vw + 16px);
    margin-right: calc(50% - 50vw + 16px);
}

.host-game-board:has(> .current-question-summary:not(.wager-mode)),
.host-game-board:has(> .host-board-layout) {
    margin-top: -17px;
}

.current-question-summary:not(.wager-mode) > .game-content-presentation {
    gap: 8px;
}

.current-question-summary:not(.wager-mode) > .game-content-presentation > .eyebrow {
    font-size: clamp(.95rem, 1.25vw, 1.3rem);
    line-height: 1.15;
}

.current-question-summary:not(.wager-mode) .game-content-blocks {
    padding-block: 4px;
}

.current-question-summary:not(.wager-mode) > .question-controls {
    padding-top: 0;
}

@media (max-width: 900px) {
    .host-game-board:has(> .current-question-summary:not(.wager-mode)),
    .host-game-board:has(> .host-board-layout) {
        margin-top: -10px;
    }

    .host-game-board {
        /*
         * .page-shell uses 20px padding below 900px.
         */
        height: calc(100dvh - var(--topbar-height) - 20px);
        margin-bottom: -20px;
    }
}

@media (max-width: 700px) {
    .host-game-board {
        --game-scoreboard-space: 212px;
    }
}

/* Player buzzer */

.buzzer-status {
    margin: 0;
    text-align: center;
}

.player-buzzer-panel {
    display: grid;
    justify-items: center;
    gap: 12px;
    margin: 24px 0;
}

.player-buzzer {
    width: min(320px, 80vw);
    aspect-ratio: 1;
    border: 6px solid #5a151d;
    border-radius: 50%;
    color: #fff;
    background: #5c0b14;
    box-shadow: inset 0 -18px 0 rgba(0, 0, 0, 0.28);
    font-size: clamp(2rem, 10vw, 4rem);
    font-weight: 950;
    cursor: not-allowed;
}

.player-buzzer.player-buzzer-open {
    border-color: #ff6072;
    background: var(--red);
    box-shadow:
        0 0 36px rgba(239, 35, 60, 0.5),
        inset 0 -18px 0 rgba(0, 0, 0, 0.22);
    cursor: pointer;
}

.player-buzzer.player-buzzer-open:active {
    transform: translateY(6px);
    box-shadow:
        0 0 22px rgba(239, 35, 60, 0.4),
        inset 0 -8px 0 rgba(0, 0, 0, 0.22);
}

@media (max-width: 700px) {
    .page-shell:has(.player-lobby:has(.player-buzzer-panel)) {
        height: 100dvh;
        padding: 8px;
        overflow: hidden;
    }

    .player-lobby:has(.player-buzzer-panel) {
        width: 100%;
        height: 100%;
        max-width: none;
        margin: 0;
        padding: 10px;
        display: flex;
        flex-direction: column;
        gap: 5px;
        overflow: hidden;
    }

    .player-lobby:has(.player-buzzer-panel) > .eyebrow,
    .player-lobby:has(.player-buzzer-panel) > h1,
    .player-lobby:has(.player-buzzer-panel) > p,
    .player-lobby:has(.player-buzzer-panel) > h2 {
        margin: 0;
    }

    .player-lobby:has(.player-buzzer-panel) > h1 {
        font-size: clamp(1.25rem, 6vw, 1.8rem);
        line-height: 1.05;
    }

    .player-lobby:has(.player-buzzer-panel) .game-code-panel.compact {
        min-height: 0;
        padding: 6px 10px;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
    }

    .player-lobby:has(.player-buzzer-panel) .game-code-panel.compact strong {
        font-size: 1.35rem;
    }

    .player-lobby:has(.player-buzzer-panel) .player-media-settings > summary {
        padding: 7px 10px;
    }

    .player-lobby:has(.player-buzzer-panel) .player-buzzer-panel {
        flex: 1 1 auto;
        min-height: 0;
        gap: 5px;
        margin: 2px 0;
    }

    .player-lobby:has(.player-buzzer-panel) .player-buzzer {
        width: min(100%, 34dvh, 250px);
        min-width: 0;
        min-height: 0;
    }

    .player-lobby:has(.player-buzzer-panel) .player-list {
        grid-template-columns: repeat(auto-fit, minmax(105px, 1fr));
        gap: 4px;
    }

    .player-lobby:has(.player-buzzer-panel) .player-list li {
        gap: 6px;
        padding: 5px 7px;
    }

    .player-lobby:has(.player-buzzer-panel) > .dialog-warning:last-child {
        display: none;
    }
}


/* Near-simultaneous buzzer result */

.buzzer-race-overlay {
    position: fixed;
    z-index: 40;
    right: 0;
    bottom: 0;
    left: 0;
    height: var(--game-scoreboard-space, 230px);
    display: grid;
    place-items: center;
    padding: 24px;
    pointer-events: none;
    animation: buzzer-race-overlay-life 5s ease forwards;
}

.buzzer-race-card {
    width: min(900px, 94vw);
    padding: clamp(24px, 4vw, 42px);
    border: 2px solid var(--gold);
    border-radius: 22px;
    color: var(--text);
    background: var(--panel-glass);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.72);
    text-align: center;
}

.buzzer-race-card p {
    margin: 0 0 18px;
    color: var(--gold);
    font-size: clamp(1.5rem, 3vw, 2.6rem);
    font-weight: 950;
    white-space: nowrap;
}

.buzzer-race-card ul {
    display: grid;
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: clamp(1rem, 2vw, 1.4rem);
    font-weight: 800;
}

@media (max-width: 700px) {
    .buzzer-race-card p {
        white-space: normal;
    }
}

@keyframes buzzer-race-overlay-life {
    0%, 82% {
        opacity: 1;
        visibility: visible;
    }

    100% {
        opacity: 0;
        visibility: hidden;
    }
}


/* Compact host question controls */

.question-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    margin: 0;
    padding: 8px 0 0;
}

.question-controls form,
.question-judge-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 0;
}

.question-controls .button {
    min-height: 42px;
}

/* Current-question state in the fixed scoreboard */

.scoreboard-player.question-answering-player {
    border-color: var(--gold);
    background:
        linear-gradient(rgba(255, 184, 0, 0.3), rgba(255, 184, 0, 0.16)),
        var(--panel-2);
    box-shadow:
        0 0 0 2px rgba(255, 184, 0, 0.35),
        0 0 28px rgba(255, 184, 0, 0.24);
}

.scoreboard-player.question-attempted-player {
    border-color: #555;
    background: #25252a;
    filter: grayscale(1);
    opacity: 0.52;
}


/* Solid question-state colors override persistent active-player styling */

.scoreboard-player.question-answering-player,
.scoreboard-player.active-player.question-answering-player {
    color: #111;
    border-color: #ffd45a;
    background: #dca900;
    box-shadow: none;
    filter: none;
    opacity: 1;
}

.scoreboard-player.question-answering-player .scoreboard-score,
.scoreboard-player.question-answering-player .active-player-badge {
    color: #111;
    border-color: rgba(17, 17, 17, 0.45);
    background: rgba(255, 255, 255, 0.28);
}

.scoreboard-player.question-attempted-player,
.scoreboard-player.active-player.question-attempted-player {
    color: #aaa;
    border-color: #555;
    background: #303035;
    box-shadow: none;
    filter: grayscale(1);
    opacity: 0.58;
}


.scoreboard-player.question-answering-player .scoreboard-score {
    border-color: #dca900;
    background: #dca900;
    box-shadow: none;
}


/* Inter-round leaderboard */

.round-summary {
    width: 100%;
    flex: 1 1 auto;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    place-content: center;
    justify-items: center;
    gap: 24px;
    padding: clamp(24px, 5vw, 72px);
    text-align: center;
    overflow: auto;
}

.round-summary h2 {
    margin: 0;
    font-size: clamp(2rem, 5vw, 4.5rem);
}

.round-podium {
    width: min(1100px, 100%);
    min-width: 0;
    justify-self: center;
    display: flex;
    align-items: end;
    justify-content: center;
    gap: clamp(12px, 2vw, 28px);
    margin: 0;
    padding: 24px 0;
    list-style: none;
}

.round-podium-player {
    width: min(280px, 100%);
    min-width: 0;
    flex: 0 1 280px;
    min-height: 190px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 12px;
    padding: 24px 16px;
    border: 2px solid #454550;
    border-radius: 20px 20px 8px 8px;
    background: var(--panel-2);
    animation: round-podium-rise 650ms ease both;
}

.round-podium-player:only-child {
    width: min(420px, 100%);
    flex-basis: 420px;
}

.round-podium-player:nth-child(2) { animation-delay: 120ms; }
.round-podium-player:nth-child(3) { animation-delay: 240ms; }

.round-podium-player.round-winner {
    min-height: 260px;
    color: #111;
    border-color: #ffe07a;
    background: #dca900;
    box-shadow: 0 0 42px rgba(220, 169, 0, 0.42);
}

.round-podium-position {
    display: grid;
    place-items: center;
    width: 48px;
    aspect-ratio: 1;
    border-radius: 50%;
    color: #111;
    background: var(--gold);
    font-size: 1.35rem;
    font-weight: 950;
}

.round-winner .round-podium-position {
    color: #dca900;
    background: #111;
}

.round-podium-player strong {
    max-width: 100%;
    font-size: clamp(1.1rem, 2.4vw, 1.8rem);
    overflow-wrap: anywhere;
}
.round-podium-score { font-size: clamp(1.5rem, 3vw, 2.5rem); font-weight: 950; }
.round-summary-finished { color: var(--gold); font-size: 1.2rem; font-weight: 850; }

@keyframes round-podium-rise {
    from { opacity: 0; transform: translateY(70px) scale(0.9); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 700px) {
    .round-podium { align-items: stretch; flex-direction: column; }
    .round-podium-player,
    .round-podium-player.round-winner { width: 100%; min-height: 120px; }
}


/* Podium medal colors */

.round-podium-player:nth-child(2) {
    color: #111;
    border-color: #f2f2f2;
    background: #c0c0c0;
    box-shadow: 0 0 34px rgba(192, 192, 192, 0.28);
}

.round-podium-player:nth-child(2) .round-podium-position {
    color: #c0c0c0;
    background: #111;
}

.round-podium-player:nth-child(3) {
    color: #111;
    border-color: #e2a36f;
    background: #b87333;
    box-shadow: 0 0 34px rgba(184, 115, 51, 0.28);
}

.round-podium-player:nth-child(3) .round-podium-position {
    color: #b87333;
    background: #111;
}


/* Synchronized question timers */

.game-timer {
    position: absolute;
    z-index: 6;
    top: 18px;
    right: 18px;
    min-width: 132px;
    display: grid;
    justify-items: center;
    gap: 2px;
    padding: 10px 16px;
    border: 2px solid var(--gold);
    border-radius: 14px;
    color: var(--gold);
    background: var(--panel-glass);
    box-shadow: 0 0 24px rgba(220, 169, 0, 0.22);
}

.game-timer[hidden] {
    display: none;
}

.game-timer span {
    font-size: 0.78rem;
    font-weight: 850;
    text-transform: uppercase;
}

.game-timer strong {
    font-variant-numeric: tabular-nums;
    font-size: 1.75rem;
    line-height: 1;
}

.game-timer.answer-timer {
    color: color-mix(in srgb, #d1242f 78%, var(--text));
    border-color: currentColor;
    box-shadow: 0 0 24px color-mix(in srgb, #d1242f 24%, transparent);
}

.current-question-summary {
    position: relative;
}

.player-game-timer {
    position: static;
    width: min(240px, 100%);
    margin: 18px auto;
}


/* Compact timer controls */

.game-timer {
    min-width: 0;
    grid-auto-flow: column;
    align-items: center;
    gap: 8px;
    padding: 9px 11px;
}

.game-timer strong {
    min-width: 68px;
    text-align: center;
}

.game-timer-control {
    display: block;
    margin: 0;
}

.game-timer-control[hidden] {
    display: none;
}

.game-timer-control button {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 1px solid currentColor;
    border-radius: 8px;
    color: inherit;
    background: transparent;
    font-size: 0.9rem;
    line-height: 1;
    cursor: pointer;
}

.game-timer-control button:hover {
    background: rgba(255, 255, 255, 0.12);
}


/* Timer and quiz editor layout refinements */

.host-game-timer {
    grid-template-columns: 68px 30px;
    grid-template-rows: 30px;
    grid-auto-flow: initial;
    gap: 6px;
    padding: 7px 9px;
}

.host-game-timer > strong {
    grid-column: 1;
    grid-row: 1;
}

.host-game-timer > .game-timer-control {
    grid-column: 2;
    grid-row: 1;
}

.final-question-panel {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.25rem;
    text-align: center;
    overflow-y: auto;
}

.final-submission-list,
.final-judging-list {
    width: min(100%, 52rem);
    margin: 0;
    padding: 0;
    list-style: none;
}

.final-submission-list li,
.final-judging-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 1rem;
    border: 1px solid var(--line);
    border-radius: 0.75rem;
    background: var(--panel-2);
}

.final-submission-list li + li,
.final-judging-card + .final-judging-card {
    margin-top: 0.65rem;
}

.final-judging-card {
    flex-wrap: wrap;
    text-align: left;
}

.final-judging-card p {
    flex: 1 1 100%;
    margin: 0;
}

.final-judging-mode {
    justify-content: stretch;
}

.final-judging-mode .final-judging-list {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.final-player-answer-presentation {
    flex: 1 1 auto;
    width: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.final-player-answer-presentation h2 {
    margin: 0 0 1rem;
    color: var(--gold);
    font-size: clamp(1.5rem, 4vw, 3rem);
}

.final-player-answer-presentation .game-content-text {
    width: 100%;
    align-self: center;
    margin-inline: auto;
    font-size: clamp(2rem, 6vw, 5rem);
    text-align: center;
}

.final-judging-actions {
    flex: 0 0 auto;
    justify-content: center;
    width: 100%;
    margin-top: auto;
}

.player-final-panel {
    display: grid;
    gap: 1rem;
    margin-block: 1.5rem;
    padding: 1.25rem;
    border: 1px solid var(--gold);
    border-radius: 1rem;
}

.player-final-panel textarea {
    min-height: 8rem;
    resize: vertical;
}

.final-wager-form {
    width: min(360px, 100%);
    justify-self: center;
}

.host-game-actions {
    align-items: center;
    justify-content: flex-end;
    flex-wrap: nowrap;
}

.host-game-actions form {
    margin: 0;
}

.final-game-actions {
    flex: 0 0 auto;
    width: 100%;
}

.answer-history-page,
.answer-history-list {
    display: grid;
    gap: 1rem;
}

.answer-history-add summary {
    cursor: pointer;
    color: var(--gold);
    font-weight: 850;
}

.answer-history-form {
    display: grid;
    grid-template-columns: repeat(3, minmax(10rem, 1fr)) auto auto;
    align-items: end;
    gap: 0.75rem;
    margin-top: 1rem;
}

.answer-history-entry-form {
    grid-template-columns: repeat(2, minmax(10rem, 1fr)) repeat(4, auto);
}

.answer-history-form label {
    display: grid;
    gap: 0.35rem;
}

.answer-history-correct {
    display: flex !important;
    align-items: center;
    align-self: end;
    justify-content: flex-start;
    width: max-content;
    min-height: 46px;
    gap: 0.5rem !important;
}

.answer-history-correct input[type="checkbox"] {
    flex: 0 0 auto;
    width: auto;
    margin: 0;
}

.answer-history-add-warning {
    grid-column: 1 / -1;
    margin: 0;
    color: var(--red-bright);
}

.answer-history-delta {
    display: flex;
    align-items: center;
    align-self: end;
    min-height: 46px;
    color: var(--success);
    font-size: 1.15rem;
    font-weight: 900;
}

.answer-history-question h2 {
    margin-top: 0;
}

@media (max-width: 900px) {
    .host-game-actions {
        flex-wrap: wrap;
    }

    .answer-history-form {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

}

.answer-key-page {
    min-height: calc(100dvh - 140px);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.game-history-list {
    display: grid;
    gap: 1rem;
}

.game-history-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.game-history-card h2,
.game-history-card p {
    margin-block: 0.35rem;
}

.game-history-player-list {
    display: grid;
    gap: 0.65rem;
}

.game-history-player {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border: 1px solid var(--line);
    border-radius: 0.75rem;
    background: var(--panel-2);
    font-size: 1.1rem;
}

.table-scroll {
    overflow-x: auto;
}

.game-history-table {
    width: 100%;
    border-collapse: collapse;
}

.game-history-table th,
.game-history-table td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--line);
    text-align: left;
}

.statistics-table th,
.statistics-table td {
    white-space: nowrap;
    text-align: center;
}

.statistics-table th:first-child,
.statistics-table td:first-child {
    text-align: left;
}

@media (max-width: 700px) {
    .game-history-card {
        align-items: stretch;
        flex-direction: column;
    }
}

.answer-key-header {
    text-align: center;
}

.answer-key-header h1,
.answer-key-header p {
    margin-block: 0.35rem;
}

.answer-key-content,
.answer-key-waiting {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: center;
}

.round-wager-settings {
    align-items: center;
}

.category-cell {
    display: flex;
    min-width: 0;
    padding: 10px 46px 10px 28px;
    overflow: hidden;
}

.category-cell .category-drag-handle {
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
}

.category-cell .category-actions {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
}

.category-cell .category-title {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
    overflow-wrap: anywhere;
    word-break: normal;
    hyphens: auto;
    font-size: clamp(0.78rem, 1.15vw, 1.25rem);
    line-height: 1.12;
}


/* Game settings */

.lobby-join-code-button {
    justify-self: start;
}

.lobby-settings-panel {
    overflow: hidden;
    border: 1px solid var(--gold);
    border-radius: 12px;
    background: color-mix(in srgb, var(--panel) 88%, var(--gold) 12%);
}

.lobby-settings-panel > summary {
    padding: 16px 18px;
    color: var(--text);
    font-size: 1.1rem;
    font-weight: 850;
    cursor: pointer;
}

.lobby-settings-panel[open] > summary {
    border-bottom: 1px solid var(--line);
}

.lobby-settings-panel > form {
    padding: 18px;
}

.settings-description {
    color: var(--muted);
    line-height: 1.55;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    margin: 12px 0 18px;
}

.settings-grid label {
    display: grid;
    align-content: start;
    gap: 8px;
}

.settings-grid small {
    color: var(--muted);
}

.theme-picker {
    grid-column: 1 / -1;
    margin: 0;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: color-mix(in srgb, var(--panel-2) 52%, transparent);
}

.theme-picker summary {
    padding: 2px 4px;
    font-weight: 850;
    cursor: pointer;
    user-select: none;
}

.theme-picker summary::marker {
    color: var(--red-bright);
}

.theme-picker-content {
    padding-top: 16px;
}

.theme-picker-content > p {
    margin-bottom: 16px;
    color: var(--muted);
}

.theme-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.settings-grid .theme-option {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    padding: 12px;
    border: 2px solid var(--line);
    border-radius: 12px;
    background: var(--panel);
    cursor: pointer;
    transition: border-color 0.15s ease, transform 0.15s ease;
}

.theme-option:hover {
    transform: translateY(-1px);
}

.theme-option:has(input:checked) {
    border-color: var(--red-bright);
    box-shadow: 0 0 0 3px var(--accent-shadow);
}

.theme-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.theme-option strong {
    min-width: 0;
    overflow-wrap: normal;
    word-break: normal;
    hyphens: auto;
}

.theme-swatch {
    display: flex;
    gap: 3px;
    flex: 0 0 auto;
    padding: 6px;
    border-radius: 999px;
    background: #09090b;
}

.theme-swatch i {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ef233c;
}

.theme-swatch i:nth-child(2) { background: #f2b134; }
.theme-swatch i:nth-child(3) { background: #f4f4f5; }
.theme-option-crimson .theme-swatch { background: #151118; }
.theme-option-crimson .theme-swatch i { background: #ff4964; }
.theme-option-crimson .theme-swatch i:nth-child(2) { background: #ffbf69; }
.theme-option-crimson .theme-swatch i:nth-child(3) { background: #fff7f7; }
.theme-option-arctic .theme-swatch { background: #0c1725; }
.theme-option-arctic .theme-swatch i { background: #35d9ff; }
.theme-option-arctic .theme-swatch i:nth-child(2) { background: #a78bfa; }
.theme-option-arctic .theme-swatch i:nth-child(3) { background: #eefaff; }
.theme-option-emerald .theme-swatch { background: #0d1b16; }
.theme-option-emerald .theme-swatch i { background: #35d399; }
.theme-option-emerald .theme-swatch i:nth-child(2) { background: #eabf55; }
.theme-option-emerald .theme-swatch i:nth-child(3) { background: #f3fbf5; }
.theme-option-violet .theme-swatch { background: #191126; }
.theme-option-violet .theme-swatch i { background: #c084fc; }
.theme-option-violet .theme-swatch i:nth-child(2) { background: #f472b6; }
.theme-option-violet .theme-swatch i:nth-child(3) { background: #fbf7ff; }
.theme-option-orange .theme-swatch { background: #21140b; }
.theme-option-orange .theme-swatch i { background: #ff8a2a; }
.theme-option-orange .theme-swatch i:nth-child(2) { background: #ffd166; }
.theme-option-orange .theme-swatch i:nth-child(3) { background: #fff8f1; }
.theme-option-light .theme-swatch { background: #ffffff; }
.theme-option-light .theme-swatch i { background: #447dc6; }
.theme-option-light .theme-swatch i:nth-child(2) { background: #b56b0a; }
.theme-option-light .theme-swatch i:nth-child(3) { background: #182230; }
.theme-option-parchment .theme-swatch { background: #f5ecd9; }
.theme-option-parchment .theme-swatch i { background: #cf6841; }
.theme-option-parchment .theme-swatch i:nth-child(2) { background: #8d681e; }
.theme-option-parchment .theme-swatch i:nth-child(3) { background: #392f27; }
.theme-option-mint .theme-swatch { background: #edf5f1; }
.theme-option-mint .theme-swatch i { background: #2b9479; }
.theme-option-mint .theme-swatch i:nth-child(2) { background: #8a6420; }
.theme-option-mint .theme-swatch i:nth-child(3) { background: #20342d; }
.theme-option-ukraine .theme-swatch { background: #0057b8; }
.theme-option-ukraine .theme-swatch i { background: #2f80ed; }
.theme-option-ukraine .theme-swatch i:nth-child(2) { background: #ffd700; }
.theme-option-ukraine .theme-swatch i:nth-child(3) { background: #f7fbff; }
.theme-option-italy .theme-swatch { background: #ffffff; }
.theme-option-italy .theme-swatch i { background: #008c45; }
.theme-option-italy .theme-swatch i:nth-child(2) { background: #f4f4f2; }
.theme-option-italy .theme-swatch i:nth-child(3) { background: #cd212a; }
.theme-option-pride .theme-swatch { background: linear-gradient(90deg, #e40303 0 16.6%, #ff8c00 16.6% 33.2%, #ffed00 33.2% 49.8%, #008026 49.8% 66.4%, #004dff 66.4% 83%, #750787 83%); }
.theme-option-pride .theme-swatch i { background: #ff69c7; }
.theme-option-pride .theme-swatch i:nth-child(2) { background: #ffd166; }
.theme-option-pride .theme-swatch i:nth-child(3) { background: #fff8ff; }
.theme-option-arcade .theme-swatch { background: #10132b; }
.theme-option-arcade .theme-swatch i { background: #ff43d1; }
.theme-option-arcade .theme-swatch i:nth-child(2) { background: #b8f34a; }
.theme-option-arcade .theme-swatch i:nth-child(3) { background: #f8f7ff; }
.theme-option-custom .theme-swatch { background: var(--panel); }
.theme-option-custom .theme-swatch i { background: var(--red-bright); }
.theme-option-custom .theme-swatch i:nth-child(2) { background: var(--gold); }
.theme-option-custom .theme-swatch i:nth-child(3) { background: var(--text); }

.custom-theme-colors {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}

.settings-grid .custom-theme-colors label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 9px;
    background: var(--panel);
    font-size: 0.82rem;
}

.custom-theme-colors input[type="color"] {
    width: 38px;
    height: 32px;
    flex: 0 0 auto;
    padding: 2px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: transparent;
    cursor: pointer;
}

.settings-grid .settings-checkbox {
    display: flex;
    align-items: center;
    align-self: center;
}

.settings-checkbox input[type="checkbox"] {
    width: auto;
    margin: 0;
}

@media (max-width: 700px) {
    .settings-grid {
        grid-template-columns: 1fr;
    }

    .theme-options {
        grid-template-columns: 1fr;
    }

    .custom-theme-colors {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
.nav-form {
    display: inline;
}

.nav-link-button {
    border: 0;
    padding: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    cursor: pointer;
}

.auth-card {
    width: min(100%, 34rem);
    margin: 3rem auto;
}

.auth-card form {
    display: grid;
    gap: 0.75rem;
}

.auth-card input[type="email"],
.auth-card input[type="password"] {
    width: 100%;
}
.four-clue-grid {
    --four-clue-gap: clamp(.5rem, 1vw, 1rem);
    display: flex;
    justify-content: center;
    align-items: stretch;
    gap: var(--four-clue-gap);
    width: 100%;
}

.four-clue-grid .game-content-block {
    flex: 0 0 calc((100% - 3 * var(--four-clue-gap)) / 4);
    align-self: stretch;
    height: auto;
    min-height: clamp(8rem, 24vh, 18rem);
    padding: clamp(.6rem, 1.3vw, 1.25rem);
    border: 2px solid var(--line);
    border-radius: 1rem;
    background: var(--panel);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.four-clue-grid .game-content-text {
    font-size: clamp(1rem, 2.2vw, 2.25rem);
}

.four-clue-grid .game-content-image {
    width: 100%;
    height: 100%;
    max-height: 24vh;
    object-fit: contain;
}

.four-clue-grid .game-content-audio {
    width: 100%;
    max-width: 22rem;
}

.page-heading-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.page-heading-actions form {
    margin: 0;
}

@media (max-width: 760px) {
    .four-clue-grid {
        flex-wrap: wrap;
    }

    .four-clue-grid .game-content-block {
        flex-basis: calc((100% - var(--four-clue-gap)) / 2);
    }
}
