:root {
    --bg-0: #050506;
    --bg-1: #111317;
    --bg-2: #1d222b;
    --panel: rgba(10, 12, 16, 0.78);
    --panel-stroke: rgba(255, 255, 255, 0.15);
    --text-main: #edf2f9;
    --text-muted: #aeb8c8;
    --accent: #88ff00;
    --accent-dark: #2f5300;
    --danger: #f97373;
}

html,
body {
    margin: 0;
    min-height: 100%;
    font-family: "Trebuchet MS", "Segoe UI", Arial, sans-serif;
    color: var(--text-main);
    background:
        radial-gradient(1200px 700px at 10% 5%, #1f242f 0%, transparent 55%),
        radial-gradient(900px 600px at 85% 90%, #20262f 0%, transparent 55%),
        linear-gradient(170deg, var(--bg-0) 0%, var(--bg-1) 45%, var(--bg-2) 100%);
    overflow-x: hidden;
    overflow-y: auto;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.65rem 1.1rem;
}

.topbar-link {
    color: var(--text-main);
    text-decoration: none;
    padding: 0.55rem 1rem;
    border-radius: 999px;
    border: 1px solid var(--panel-stroke);
    background: rgba(255, 255, 255, 0.05);
    transition: transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

.topbar-link:hover {
    transform: translateY(-1px);
    border-color: rgba(136, 255, 0, 0.55);
    background: rgba(136, 255, 0, 0.12);
}

.topbar-link-leaderboard {
    border-color: rgba(136, 255, 0, 0.72);
    background: rgba(136, 255, 0, 0.2);
    font-weight: 700;
}

.topbar-link-leaderboard:hover {
    border-color: rgba(136, 255, 0, 0.9);
    background: rgba(136, 255, 0, 0.28);
}

.topbar-kicker {
    margin: 0;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.game-shell {
    min-height: calc(100vh - 76px);
    padding: 0.25rem clamp(1rem, 2.6vw, 2rem) 1.5rem clamp(1rem, 2.6vw, 2rem);
}

.arena-layout {
    width: 100%;
}

.side-panel {
    display: none;
}

.game-card {
    width: min(1180px, 100%);
    margin: 0 auto;
    box-sizing: border-box;
    border-radius: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    padding: clamp(1rem, 2vw, 1.7rem);
    display: grid;
    gap: 0.9rem;
}

.card-top {
    display: grid;
    gap: 0.35rem;
}

.card-main {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.85rem;
    align-items: stretch;
}

.card-main.question-transition {
    animation: questionSweepIn 360ms cubic-bezier(0.22, 0.61, 0.36, 1);
}

@keyframes questionSweepIn {
    0% {
        opacity: 0.28;
        transform: translateX(36px);
        filter: blur(1px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
        filter: blur(0);
    }
}

.flag-panel,
.answer-panel {
    border: 0;
    background: transparent;
    padding: 0;
}

.flag-panel {
    width: min(860px, 100%);
    margin: 0 auto;
}

.answer-panel {
    display: flex;
    flex-direction: column;
    width: min(860px, 100%);
    margin: 0 auto;
}

.mobile-layout-slot {
    display: none;
}

.title {
    margin: 0;
    font-size: clamp(2rem, 6vw, 3.4rem);
    letter-spacing: 0.04em;
    overflow-wrap: anywhere;
}

.interactive-text {
    display: inline-block;
    color: var(--text-main);
    font-weight: 800;
}

.interactive-text.animated {
    color: var(--accent);
    animation: hop 0.2s ease-in-out;
}

@keyframes hop {
    0% { transform: translateY(0); }
    50% { transform: translateY(-13px); }
    100% { transform: translateY(0); }
}

.subhead {
    margin-top: 0.55rem;
    margin-bottom: 1.4rem;
    color: var(--text-muted);
}

.mode-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem;
    margin-bottom: 1rem;
}

.mode-toggle-btn {
    display: none;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
    border-radius: 999px;
    padding: 0.45rem 0.8rem;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
    text-align: left;
    width: fit-content;
    cursor: pointer;
}

.mode-toggle-btn:hover {
    border-color: rgba(136, 255, 0, 0.55);
    background: rgba(136, 255, 0, 0.12);
}

.mode-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 106px;
    height: 42px;
    box-sizing: border-box;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
    border-radius: 999px;
    padding: 0 1rem;
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease;
    white-space: nowrap;
}

.mode-btn:hover {
    border-color: rgba(136, 255, 0, 0.55);
}

.mode-btn.active {
    border-color: rgba(136, 255, 0, 0.75);
    background: rgba(136, 255, 0, 0.14);
}

.score-row {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 0.25rem 0;
    border: 0;
    background: transparent;
    font-weight: 700;
}

.score-row span {
    overflow-wrap: anywhere;
}

.flag-fact {
    margin: 0 0 0.35rem 0;
    color: #c8d7ec;
    font-size: 0.92rem;
    line-height: 1.35;
    text-align: center;
}

.flag-wrapper {
    min-height: min(52vh, 460px);
    height: 100%;
    border-radius: 8px;
    border: 0;
    background: transparent;
    display: grid;
    place-items: center;
    padding: 1.1rem;
}

#flag-image {
    width: min(500px, 96%);
    aspect-ratio: 4 / 3;
    object-fit: contain;
    background: transparent;
    border-radius: 6px;
    border: 0;
}

.choices {
    margin-top: 1.1rem;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.8rem;
}

.hard-answer {
    margin-top: 1.1rem;
    display: flex;
    justify-content: center;
}

.hard-answer input {
    width: min(520px, 100%);
    box-sizing: border-box;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
    border-radius: 10px;
    padding: 0.7rem 0.85rem;
    font-size: 1rem;
}

.hard-answer input:focus {
    outline: none;
    border-color: rgba(136, 255, 0, 0.72);
    box-shadow: 0 0 0 2px rgba(136, 255, 0, 0.25);
}

.hint-row {
    margin-top: 0.75rem;
}

.hint-row button {
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
    border-radius: 10px;
    padding: 0.55rem 0.9rem;
    cursor: pointer;
}

.hint-row button:hover {
    border-color: rgba(136, 255, 0, 0.6);
    background: rgba(136, 255, 0, 0.12);
}

.hint-row button:disabled {
    opacity: 0.6;
    cursor: default;
}

.hidden {
    display: none;
}

.modal {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    background: rgba(0, 0, 0, 0.65);
    z-index: 20;
    padding: 1rem;
}

.modal.hidden {
    display: none;
}

.modal-card {
    width: 92vw;
    max-width: 360px;
    box-sizing: border-box;
    border-radius: 14px;
    background: #12171f;
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.4);
    padding: 1rem 1rem 1.1rem 1rem;
}

.modal-card h2 {
    margin: 0 0 0.65rem 0;
}

.modal-card p {
    margin: 0.35rem 0;
}

.missed-wrap {
    margin-top: 0.8rem;
    border-top: 1px solid rgba(255, 255, 255, 0.14);
    padding-top: 0.7rem;
}

.missed-wrap h3 {
    margin: 0 0 0.45rem 0;
    font-size: 0.95rem;
}

.missed-wrap ul {
    margin: 0;
    padding-left: 1rem;
    max-height: 170px;
    overflow-y: auto;
}

.missed-wrap li {
    margin: 0.45rem 0;
    color: var(--text-muted);
    font-size: 0.86rem;
    line-height: 1.35;
    display: grid;
    grid-template-columns: 56px 1fr;
    gap: 0.55rem;
    align-items: center;
}

.leaderboard-wrap {
    margin-top: 0.8rem;
    border-top: 1px solid rgba(255, 255, 255, 0.14);
    padding-top: 0.7rem;
}

.leaderboard-wrap h3 {
    margin: 0 0 0.45rem 0;
    font-size: 0.95rem;
}

.leaderboard-submit-row {
    display: flex;
    gap: 0.45rem;
}

.leaderboard-submit-row input {
    flex: 1 1 auto;
    min-width: 0;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
    border-radius: 10px;
    padding: 0.45rem 0.55rem;
}

.leaderboard-submit-row button {
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-main);
    border-radius: 10px;
    padding: 0.45rem 0.7rem;
    cursor: pointer;
}

.leaderboard-submit-row button:hover {
    border-color: rgba(136, 255, 0, 0.6);
    background: rgba(136, 255, 0, 0.12);
}

.leaderboard-feedback {
    margin: 0.35rem 0 0 0;
    font-size: 0.8rem;
}

.leaderboard-wrap ol {
    margin: 0;
    padding-left: 1.1rem;
    max-height: 145px;
    overflow-y: auto;
}

.leaderboard-wrap li {
    margin: 0.25rem 0;
    font-size: 0.84rem;
    color: var(--text-muted);
}

.missed-flag-thumb {
    width: 56px;
    height: 42px;
    object-fit: contain;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.06);
}

.missed-flag-text {
    overflow-wrap: anywhere;
}

.modal-actions {
    margin-top: 0.9rem;
    display: flex;
    gap: 0.65rem;
    flex-wrap: wrap;
}

.modal-actions button {
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-main);
    border-radius: 10px;
    padding: 0.55rem 0.95rem;
    cursor: pointer;
}

.modal-actions button:hover {
    border-color: rgba(136, 255, 0, 0.6);
    background: rgba(136, 255, 0, 0.12);
}

.choice-btn {
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-main);
    border-radius: 12px;
    padding: 0.8rem 0.75rem;
    cursor: pointer;
    font-size: 1rem;
    transition: transform 0.18s ease, border-color 0.2s ease, background-color 0.2s ease;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.choice-btn:hover {
    transform: translateY(-1px);
    border-color: rgba(136, 255, 0, 0.6);
    background: rgba(136, 255, 0, 0.12);
}

.choice-btn:disabled {
    cursor: default;
    opacity: 0.88;
}

.choice-btn.correct {
    background: rgba(47, 83, 0, 0.78);
    border-color: rgba(136, 255, 0, 0.8);
}

.choice-btn.incorrect {
    background: rgba(107, 24, 24, 0.85);
    border-color: var(--danger);
}

.feedback {
    min-height: 1.6rem;
    margin: 0.95rem 0 0.2rem 0;
    color: var(--text-muted);
    overflow-wrap: anywhere;
}

.double-enter-hint {
    margin: 0.15rem 0 0 0;
    color: #f7d79a;
    font-size: 0.82rem;
    line-height: 1.2;
}

.action-row {
    margin-top: 0.8rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
}

.action-row button {
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-main);
    border-radius: 10px;
    padding: 0.65rem 1rem;
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.action-row button:hover {
    border-color: rgba(136, 255, 0, 0.6);
    background: rgba(136, 255, 0, 0.12);
}

@media (min-width: 1200px) {
    html,
    body {
        overflow-x: hidden;
        overflow-y: clip;
    }

    .topbar-link-mobile {
        display: none;
    }

    .game-shell {
        min-height: calc(100vh - 76px);
        height: auto;
        padding-top: 0.1rem;
        padding-bottom: 0.45rem;
        overflow: visible;
    }

    .arena-layout {
        max-width: 1780px;
        margin: 0 auto;
        display: grid;
        grid-template-columns: 42px minmax(0, 1fr) 42px;
        gap: 1rem;
        align-items: stretch;
        transition: grid-template-columns 520ms cubic-bezier(0.16, 1, 0.3, 1);
        will-change: grid-template-columns;
    }

    .arena-layout.leaderboard-expanded {
        grid-template-columns: clamp(220px, 18vw, 280px) minmax(0, 1fr) clamp(220px, 18vw, 280px);
    }

    .arena-layout > * {
        min-width: 0;
    }

    .arena-layout .game-card {
        width: 100%;
        margin: 0;
        overflow: visible;
        padding-top: 0.2rem;
        gap: 0.45rem;
    }

    .arena-layout .card-top {
        width: min(860px, 100%);
        margin: 0 auto;
        gap: 0.12rem;
        text-align: center;
    }

    .arena-layout .title {
        font-size: clamp(1.9rem, 4.2vw, 3rem);
    }

    .arena-layout .subhead {
        margin-top: 0.15rem;
        margin-bottom: 0.5rem;
    }

    .arena-layout .score-row {
        width: min(860px, 100%);
        margin: 0 auto;
        justify-content: center;
        gap: 1.25rem;
        padding: 0;
    }

    .arena-layout .card-main {
        align-items: start;
        gap: 0.45rem;
    }

    .arena-layout .flag-wrapper {
        min-height: clamp(260px, 38vh, 390px);
        padding: 0.45rem 0.65rem 0.55rem 0.65rem;
        place-items: center;
    }

    .arena-layout .action-row {
        margin-top: 0.8rem;
    }

    .side-panel {
        display: block;
        position: sticky;
        top: 0.45rem;
        height: calc(100vh - 96px);
        min-height: 520px;
        max-height: none;
        overflow: hidden;
        box-sizing: border-box;
        will-change: transform;
    }

    .side-panel-peek {
        position: absolute;
        z-index: 3;
        top: 0;
        bottom: 0;
        width: 42px;
        height: 100%;
        border: 1px solid rgba(255, 255, 255, 0.13);
        border-radius: 14px;
        background: rgba(12, 16, 23, 0.68);
        color: #b7c6dc;
        font-size: 0.76rem;
        letter-spacing: 0.12em;
        text-transform: uppercase;
        display: grid;
        place-items: center;
        writing-mode: vertical-rl;
        text-orientation: mixed;
        transform: rotate(180deg);
        transition: opacity 250ms ease, border-color 180ms ease, background-color 180ms ease;
        cursor: pointer;
        padding: 0;
        box-sizing: border-box;
    }

    .side-panel-left .side-panel-peek {
        left: 0;
    }

    .side-panel-right .side-panel-peek {
        right: 0;
    }

    .side-panel-peek:hover {
        border-color: rgba(136, 255, 0, 0.62);
        background: rgba(136, 255, 0, 0.12);
    }

    .side-panel-peek:focus-visible {
        outline: 2px solid rgba(136, 255, 0, 0.72);
        outline-offset: 2px;
    }

    .side-panel-card {
        position: absolute;
        inset: 0;
        border: 1px solid rgba(255, 255, 255, 0.14);
        border-radius: 14px;
        background:
            linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0)),
            rgba(9, 13, 18, 0.88);
        padding: 0.78rem;
        box-sizing: border-box;
        opacity: 0;
        pointer-events: none;
        overflow: hidden;
        transition:
            opacity 240ms ease,
            transform 520ms cubic-bezier(0.16, 1, 0.3, 1),
            left 520ms cubic-bezier(0.16, 1, 0.3, 1),
            right 520ms cubic-bezier(0.16, 1, 0.3, 1);
        box-sizing: border-box;
        will-change: transform, opacity, left, right;
        transform: translate3d(0, 0, 0);
    }

    .side-panel-left .side-panel-card {
        left: 0;
        transform: translate3d(-24px, 0, 0);
    }

    .side-panel-right .side-panel-card {
        right: 0;
        transform: translate3d(24px, 0, 0);
    }

    .arena-layout.leaderboard-expanded .side-panel-left .side-panel-card {
        left: 46px;
    }

    .arena-layout.leaderboard-expanded .side-panel-right .side-panel-card {
        right: 46px;
    }

    .arena-layout.leaderboard-expanded .side-panel-peek {
        opacity: 0.92;
    }

    .arena-layout.leaderboard-expanded .side-panel-card {
        opacity: 1;
        pointer-events: auto;
        transform: translate3d(0, 0, 0);
    }

    .side-panel-card h2 {
        margin: 0;
        font-size: 1rem;
    }

    .side-panel-subhead {
        margin: 0.35rem 0 0.6rem 0;
        color: var(--text-muted);
        font-size: 0.84rem;
    }

    .desktop-lb-mode-row {
        display: flex;
        flex-wrap: wrap;
        gap: 0.4rem;
    }

    .desktop-lb-mode-btn {
        border: 1px solid rgba(255, 255, 255, 0.2);
        background: rgba(255, 255, 255, 0.06);
        color: var(--text-main);
        border-radius: 999px;
        padding: 0.34rem 0.65rem;
        font-size: 0.76rem;
        cursor: pointer;
    }

    .desktop-lb-mode-btn.active {
        border-color: rgba(136, 255, 0, 0.75);
        background: rgba(136, 255, 0, 0.14);
    }

    .desktop-lb-status {
        margin: 0.6rem 0 0.48rem 0;
        color: #c8d7ec;
        font-size: 0.8rem;
    }

    .rail-loading {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.35rem;
        width: 100%;
        z-index: 5;
        pointer-events: none;
    }

    .rail-loading.hidden {
        display: none;
    }

    .rail-loader {
        display: inline-block;
        width: 13px;
        height: 13px;
        border: 2px solid #eef3fc;
        border-radius: 3px;
        transform: rotate(0deg);
        animation: railLoaderSpin 1.6s infinite ease-in-out;
    }

    .rail-loader:nth-child(2) {
        animation-delay: 0.1s;
    }

    .rail-loader:nth-child(3) {
        animation-delay: 0.2s;
    }

    .rail-loader-inner {
        display: block;
        width: 100%;
        height: 0%;
        background: #eef3fc;
        animation: railLoaderFill 1.6s infinite ease-in-out;
    }

    .desktop-lb-list {
        margin: 0;
        padding: 0;
        list-style: none;
        display: grid;
        gap: 0.4rem;
        max-height: none;
        overflow: hidden;
    }

    .desktop-lb-list li {
        border: 1px solid rgba(255, 255, 255, 0.12);
        background: rgba(255, 255, 255, 0.04);
        border-radius: 10px;
        padding: 0.45rem 0.52rem;
        font-size: 0.8rem;
        color: #d9e5f7;
    }

    .desktop-lb-summary {
        margin: 0.52rem 0 0.34rem 0;
        color: #c8d7ec;
        font-size: 0.85rem;
        line-height: 1.35;
    }

    .desktop-lb-top-player {
        margin: 0 0 0.55rem 0;
        color: var(--text-main);
        font-size: 0.82rem;
    }

    .desktop-lb-chart-hook {
        border: 1px dashed rgba(136, 255, 0, 0.45);
        border-radius: 10px;
        background: linear-gradient(90deg, rgba(136, 255, 0, 0.08), rgba(136, 255, 0, 0.02));
        padding: 0.55rem;
        font-size: 0.78rem;
        color: #d8f0b2;
        line-height: 1.35;
        animation: chartPulse 2.5s ease-in-out infinite;
    }
}

@media (prefers-reduced-motion: reduce) {
    .arena-layout,
    .side-panel-card,
    .side-panel-peek {
        transition: none !important;
    }
}

@keyframes chartPulse {
    0%, 100% {
        box-shadow: 0 0 0 rgba(136, 255, 0, 0);
    }
    50% {
        box-shadow: 0 0 18px rgba(136, 255, 0, 0.16);
    }
}

@keyframes railLoaderSpin {
    0% {
        transform: rotate(0deg);
    }
    25% {
        transform: rotate(180deg);
    }
    50% {
        transform: rotate(180deg);
    }
    75% {
        transform: rotate(360deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

@keyframes railLoaderFill {
    0% {
        height: 0%;
    }
    25% {
        height: 0%;
    }
    50% {
        height: 100%;
    }
    75% {
        height: 100%;
    }
    100% {
        height: 0%;
    }
}

@media (max-width: 680px) {
    .game-shell {
        padding-top: 0.2rem;
        min-height: auto;
    }

    .card-main {
        grid-template-columns: 1fr;
    }

    .flag-panel,
    .answer-panel {
        padding: 0.75rem;
    }

    .choices {
        grid-template-columns: 1fr;
    }

    .flag-wrapper {
        min-height: 250px;
    }

    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .action-row button {
        flex: 1 1 140px;
    }
}

@media (max-width: 900px) {
    .card-main {
        grid-template-columns: 1fr;
    }

    .flag-wrapper {
        min-height: 280px;
    }

    .game-shell {
        padding-bottom: 1.25rem;
    }
}

@media (max-width: 430px) {
    html,
    body {
        height: 100dvh;
        overflow: hidden;
    }

    .topbar {
        gap: 0.55rem;
        padding: 0.45rem 0.75rem;
    }

    .topbar-link {
        font-size: 0.88rem;
        padding: 0.45rem 0.7rem;
    }

    .topbar-kicker {
        display: none;
    }

    .game-shell {
        height: calc(100dvh - 52px);
        min-height: calc(100dvh - 52px);
        padding: 0.15rem 0.55rem 0.5rem 0.55rem;
    }

    .game-card {
        height: 100%;
        padding: 0.45rem;
        gap: 0.45rem;
        grid-template-rows: auto auto 1fr;
        overflow: hidden;
    }

    .card-main {
        gap: 0.4rem;
    }

    .card-top {
        gap: 0.2rem;
    }

    .title {
        font-size: clamp(1.5rem, 12vw, 2.1rem);
        letter-spacing: 0.02em;
    }

    .subhead {
        margin-top: 0.2rem;
        margin-bottom: 0.45rem;
        font-size: 0.8rem;
        line-height: 1.25;
    }

    .mode-row {
        gap: 0.45rem;
    }

    .mode-toggle-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: min(92%, 260px);
        margin: 0 auto 0.45rem auto;
        text-align: center;
        padding: 0.35rem 0.6rem;
        font-size: 0.82rem;
    }

    .mode-row.collapsed {
        display: none;
    }

    .mode-btn {
        flex: 1 1 calc(50% - 0.45rem);
        min-width: 0;
        padding: 0.36rem 0.44rem;
        font-size: 0.8rem;
        text-align: center;
    }

    .score-row {
        gap: 0.2rem 0.4rem;
        font-size: 0.76rem;
        padding: 0;
    }

    .score-row span {
        flex: 1 1 30%;
        min-width: 0;
    }

    .flag-fact {
        display: none;
    }

    .flag-wrapper {
        min-height: 128px;
        max-height: 24dvh;
        padding: 0.4rem;
    }

    #flag-image {
        width: auto;
        max-width: 100%;
        max-height: 100%;
    }

    .choices {
        margin-top: 0.45rem;
        gap: 0.4rem;
    }

    .choice-btn {
        font-size: 0.82rem;
        padding: 0.5rem 0.45rem;
        line-height: 1.2;
    }

    .hard-answer {
        margin-top: 0.45rem;
    }

    .hard-answer input {
        width: 100%;
        box-sizing: border-box;
        font-size: 0.86rem;
        padding: 0.5rem 0.6rem;
    }

    .hint-row button,
    .action-row button {
        font-size: 0.82rem;
        padding: 0.46rem 0.58rem;
    }

    .feedback {
        min-height: 1.1rem;
        margin-top: 0.45rem;
        font-size: 0.8rem;
        line-height: 1.2;
    }

    .action-row {
        gap: 0.4rem;
        margin-top: 0.45rem;
    }

    .action-row button {
        flex: 1 1 31%;
        min-width: 0;
    }

    .mobile-layout-slot {
        display: block;
    }

    .mobile-layout-slot.hidden {
        display: none;
    }

    #mobile-typing-top .hard-answer {
        margin-top: 0;
    }

    #mobile-typing-top .feedback {
        margin-top: 0.35rem;
        margin-bottom: 0;
    }

    #mobile-typing-top .double-enter-hint {
        font-size: 0.74rem;
    }

    #mobile-typing-bottom .action-row {
        margin-top: 0;
    }

    .modal-card {
        width: 92vw;
        max-width: 360px;
        padding: 1rem 0.9rem 1rem 0.9rem;
        border-radius: 16px;
    }

    .modal {
        padding: 0.6rem;
    }

    .modal-card h2 {
        font-size: 1.2rem;
    }

    .missed-wrap ul {
        max-height: 145px;
    }

    .leaderboard-wrap ol {
        max-height: 120px;
    }
}

@media (max-width: 360px) {
    .mode-btn {
        flex-basis: 100%;
    }

    .title {
        font-size: clamp(1.35rem, 12vw, 1.8rem);
    }

    .score-row span {
        flex-basis: 100%;
    }

    .action-row button {
        flex-basis: 100%;
    }
}
