@media (max-width: 768px) {
    :root {
        --mobile-vh: 100dvh;
        --mobile-offset-top: 0px;
        --mobile-keyboard-inset: 0px;
        --mobile-topbar-height: 64px;
        --mobile-bottomtray-height: 84px;
    }

    html,
    body {
        overflow: hidden;
    }

    .sidebar-mobile-header {
        display: none;
    }
    
    .layout {
        display: block;
        width: 100%;
        height: 100%;
        z-index: auto;
    }

    #cesiumContainer {
        position: fixed;
        top: calc(var(--mobile-offset-top) + var(--mobile-topbar-height));
        left: 0;
        width: 100vw;
        height: calc(var(--mobile-vh) - var(--mobile-topbar-height) - var(--mobile-bottomtray-height));
    }

    .sidebar {
        position: fixed;
        top: var(--mobile-offset-top);
        left: 0;
        width: min(92vw, 420px);
        height: var(--mobile-vh);
        transform: translateX(-100%);
        transition: transform 0.22s ease;
        z-index: 200;
        display: flex;
        flex-direction: column;
        padding: 20px;
        box-sizing: border-box;
        overflow-y: auto;
        overflow-x: hidden;
        background: #151922;
        border-right: 1px solid #262b34;
    }

    .sidebar.mobile-open {
        transform: translateX(0);
    }

    .sidebar-mobile-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 14px;
    }

    .mobile-drawer-close-btn {
        border: 1px solid #3a4352;
        background: #1c2230;
        color: #fff;
        border-radius: 8px;
        padding: 6px 10px;
        cursor: pointer;
    }

    .sidebar h1,
    .sidebar #guessBox,
    .sidebar #guessFeedback,
    .sidebar #nextBtn {
        display: none;
    }

    .sidebar #meta {
        margin-top: 0;
    }

    .sidebar .desktop-meta-only {
        display: none;
    }

    .sidebar #meta + .sidebar-divider,
    .sidebar #roundTable + .sidebar-divider {
        display: none;
    }

    .sidebar .sidebar-divider {
        display: none;
    }

    .sidebar .sidebar-attribution::before {
        content: '';
        display: block;
        height: 1px;
        margin: 16px 0;
        background: #262b34;
    }
    .mobile-drawer-scrim {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.45);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s ease;
        z-index: 190;
    }

    .mobile-drawer-scrim.mobile-open {
        opacity: 1;
        pointer-events: auto;
    }

    .mobile-topbar {
        position: fixed;
        top: var(--mobile-offset-top);
        left: 0;
        right: 0;
        height: var(--mobile-topbar-height);
        display: grid;
        grid-template-columns: auto 1fr auto;
        align-items: center;
        gap: 10px;
        padding: 10px 12px;
        box-sizing: border-box;
        background: #151922;
        border-bottom: 1px solid #262b34;
        z-index: 120;
    }

    .mobile-menu-btn {
        border: 1px solid #3a4352;
        background: #1c2230;
        color: #fff;
        border-radius: 8px;
        padding: 8px 10px;
        cursor: pointer;
        font: inherit;
    }

    .mobile-title {
        font-size: 18px;
        font-weight: 700;
        text-align: right;
        white-space: nowrap;
    }

    .mobile-bottomtray {
        position: fixed;
        left: 0;
        right: 0;
        bottom: var(--mobile-keyboard-inset);
        min-height: calc(var(--mobile-bottomtray-height) + 44px);
        padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
        box-sizing: border-box;
        background: #151922;
        border-top: 1px solid #262b34;
        z-index: 120;
    }

    .mobile-bottomtray #guessBox {
        margin: 0;
    }

    .mobile-bottomtray #guessControls {
        display: grid;
        grid-template-columns: 1fr auto auto;
        gap: 8px;
        align-items: center;
    }

    .mobile-bottomtray #guessInput {
        width: 100%;
        height: 40px;
        min-width: 0;
        font-size: 16px;
    }

    .mobile-bottomtray #guessBtn,
    .mobile-bottomtray #passBtn,
    .mobile-bottomtray #nextBtn {
        height: 40px;
        white-space: nowrap;
    }

    .mobile-bottomtray #guessFeedback {
        display: block !important;
        margin: 8px 0 0 0;
        font-size: 13px;
        line-height: 1.35;
        min-height: 18px;
    }

    .mobile-bottomtray #nextBtn {
        width: 100%;
        margin: 8px 0 0 0;
    }

    .mobile-topbar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
    }

    .mobile-hero-stats {
        display: flex;
        align-items: center;
        gap: 16px;
        margin-left: auto;
    }

    .mobile-hero-stat {
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        line-height: 1.1;
    }

    .mobile-hero-stat-label {
        font-size: 11px;
        color: #9aa3b2;
        text-transform: uppercase;
    }

    .mobile-hero-stat-value {
        font-size: 18px;
        font-weight: 700;
        color: #ffffff;
    }
    .stats-modal {
        width: min(92vw, 560px);
        max-height: calc(var(--mobile-vh) - 24px);
        overflow-y: auto;
        box-sizing: border-box;
    }

    .stats-grid {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
        align-items: stretch;
    }

    .stats-card {
        min-width: 0;
        height: auto;
    }

    .stats-card-value,
    .stats-card-subvalue,
    .stats-today-score,
    .stats-today-secondary {
        overflow-wrap: anywhere;
    }

}