/* Mobile/touch interaction layer. Loaded last so desktop styles stay intact. */
.mobile-level-browser-content { min-height:0; flex:1 1 auto; display:flex; flex-direction:column; }
.mobile-list-view-switch,
.mobile-leaderboard-view-switch,
.mobile-level-browser-bar,
.mobile-list-info,
.mobile-player-browser-button,
.mobile-row-chevron,
.roulette-mobile-setup-button { display:none; }

@media (max-width: 820px) {
    .page-list {
        display:flex; flex-direction:column; height:100%; min-height:0; overflow:auto;
        scroll-behavior:smooth; scrollbar-gutter:auto;
    }
    .page-list .list-pane {
        flex:0 0 auto; height:min(52dvh,520px); max-height:min(52dvh,520px);
        padding:8px 8px 10px; overflow:hidden; background:var(--md-surface);
        transition:height 280ms cubic-bezier(.2,0,0,1), max-height 280ms cubic-bezier(.2,0,0,1);
    }
    .mobile-level-browser-bar {
        flex:0 0 auto; width:100%; min-height:54px; margin:0 0 7px; padding:6px 8px 6px 12px;
        border:0; border-radius:16px; display:flex; align-items:center; justify-content:space-between; gap:12px;
        background:var(--md-surface-2); color:var(--md-on-surface); text-align:left;
    }
    .mobile-level-browser-bar > span:first-child { min-width:0; display:grid; gap:1px; }
    .mobile-level-browser-bar small { color:var(--md-on-surface-variant); font-size:.7rem; font-weight:750; text-transform:uppercase; letter-spacing:.055em; }
    .mobile-level-browser-bar strong { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:.92rem; }
    .mobile-level-browser-action { flex:0 0 auto; min-height:40px; padding:0 9px 0 12px; border-radius:13px; display:flex; align-items:center; gap:4px; background:var(--md-secondary-container); color:var(--md-on-secondary-container); font-size:.76rem; font-weight:800; }
    .mobile-level-browser-action svg { width:18px; height:18px; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; transition:transform 220ms ease; }
    .page-list:not(.mobile-list-collapsed) .mobile-level-browser-action svg { transform:rotate(90deg); }
    .page-list.mobile-list-collapsed .list-pane {
        position:sticky; z-index:25; top:0; height:64px; max-height:64px; padding:5px 8px;
        border-bottom-color:color-mix(in srgb,var(--md-primary) 22%,var(--md-outline-variant));
        box-shadow:0 5px 18px color-mix(in srgb,var(--md-shadow) 60%,transparent);
    }
    .page-list.mobile-list-collapsed .mobile-level-browser-bar { margin:0; }
    .page-list.mobile-list-collapsed .mobile-level-browser-content { display:none; }
    .page-list.mobile-list-collapsed .level-pane { min-height:calc(100% - 64px); }
    .level-pane[tabindex="-1"], .player-container[tabindex="-1"] { outline:none; }

    .mobile-list-info { flex:0 0 auto; display:block; margin:0 4px 4px 0; padding:0; border:1px solid var(--md-outline-variant); border-radius:16px; overflow:hidden; }
    .mobile-list-info summary { min-height:46px; padding:8px 12px; display:flex; align-items:center; justify-content:space-between; gap:10px; list-style:none; cursor:pointer; font-weight:800; }
    .mobile-list-info summary::-webkit-details-marker { display:none; }
    .mobile-list-info summary > span { color:var(--md-primary); font-size:1.1rem; transition:transform 180ms ease; }
    .mobile-list-info[open] summary > span { transform:rotate(45deg); }
    .mobile-list-info-content { display:grid; gap:14px; padding:4px 13px 15px; border-top:1px solid var(--md-outline-variant); }
    .mobile-list-info-content .public-staff-card { padding-top:12px; }
    .mobile-list-info-content .side-text { margin:0; }

    .page-list.filters-open .list-pane { height:82dvh; max-height:82dvh; }
    .search-filter-menu { max-height:calc(82dvh - 126px); }
    .filter-height-resizer { height:28px; min-height:28px; }
    .filter-height-resizer::before { top:10px; width:92px; }

    .level-pane { flex:0 0 auto; overflow:visible; }
    .level-heading { display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:start; }
    .level-heading-actions { justify-content:flex-end; }
    .level-heading-actions .md-button { min-height:44px; }
    .video-tabs { width:100%; }
    .video-tabs button { flex:1 1 0; min-height:44px; }
}

@media (max-width: 600px) {
    .page-list .list-pane { height:min(55dvh,500px); max-height:min(55dvh,500px); }
    .search-row { gap:8px; padding:0 2px 9px; }
    .search-row .search-box { order:1; flex:1 0 100%; min-height:50px; }
    .search-filter-button { order:2; flex:1 1 auto; min-height:44px; }
    .add-level-button { order:3; min-height:44px; }
    .level-heading { grid-template-columns:1fr; gap:12px; }
    .level-heading-actions { justify-content:flex-start; }
    .level-heading-actions .md-button { flex:1 1 auto; }
    .level-pane { padding:14px 10px 34px; }
    .level-title-line h1 { font-size:clamp(1.45rem,7vw,2rem); }
    .stats-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
    .stat { min-height:70px; }

    .records-table { border:0; display:grid; gap:9px; overflow:visible; background:transparent; }
    .record-row.header { display:none; }
    .record-row:not(.header), .records-table.editable .record-row:not(.header) {
        grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px 14px; padding:13px;
        border:1px solid var(--md-outline-variant); border-radius:16px; background:var(--md-surface-1);
    }
    .record-row:not(.header) > [data-label] { min-width:0; display:grid; justify-items:start; gap:3px; color:var(--md-on-surface); font-size:.86rem; overflow-wrap:anywhere; }
    .record-row:not(.header) > [data-label]::before { content:attr(data-label); color:var(--md-on-surface-variant); font-size:.66rem; font-weight:800; letter-spacing:.055em; text-transform:uppercase; }
    .record-row .record-player { grid-column:1 / -1; }
    .record-mobile-cell { justify-content:flex-start; grid-template-columns:auto 1fr !important; grid-auto-flow:column; align-items:center; gap:6px !important; }
    .record-mobile-cell::before { grid-column:1 / -1; }
    .record-mobile-cell > span { display:inline; }
    .record-row-actions { grid-column:1 / -1; justify-content:flex-start; padding-top:4px; border-top:1px solid var(--md-outline-variant); }
    .record-row-actions .icon-button { width:44px; height:40px; border-radius:13px; background:var(--md-surface-2); }
}

@media (max-width: 360px) {
    .stats-grid { grid-template-columns:1fr; }
}

@media (max-width: 800px) {
    .page-leaderboard-container { padding:8px 8px 20px; scroll-behavior:smooth; }
    .page-leaderboard { grid-template-rows:auto auto minmax(420px,auto); gap:10px; }
    .leaderboard-surface { border-radius:20px; }
    .leaderboard-panel-header { min-height:72px; padding:12px 14px; }
    .leaderboard-search-box { margin:8px; }
    .board-container { height:max(360px,48dvh); opacity:1; transform:translateY(0); transition:height 280ms cubic-bezier(.2,0,0,1), min-height 280ms cubic-bezier(.2,0,0,1), opacity 170ms ease, transform 280ms cubic-bezier(.2,0,0,1), border-width 220ms ease; }
    .board-scroll { padding:4px 4px 10px; }
    .page-leaderboard .board tr { height:60px; }
    .page-leaderboard .board .user button { min-height:52px; display:flex; align-items:center; justify-content:space-between; gap:8px; }
    .mobile-row-chevron { flex:0 0 auto; width:18px; height:18px; display:block; fill:none; stroke:var(--md-on-surface-variant); stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
    .mobile-board-collapsed .board-container { height:0; min-height:0; opacity:0; transform:translateY(-8px); border-width:0; pointer-events:none; }
    .mobile-board-collapsed .player-container { min-height:calc(100dvh - 112px); }
    .mobile-board-collapsed .mobile-player-browser-button { display:inline-flex; align-self:flex-start; min-height:44px; }
    .mobile-player-browser-button svg { width:19px; height:19px; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; }
    .player-scroll { overflow:visible; padding-bottom:28px; }
    .achievement-row { min-height:60px; }
}

@media (max-width: 520px) {
    .page-leaderboard .board .rank { width:48px; }
    .page-leaderboard .board .total { width:72px; }
    .player-header { padding:14px; gap:13px; }
    .player-header-side { gap:9px; }
    .achievement-row { grid-template-columns:42px minmax(0,1fr) 62px; min-height:64px; }
    .achievement-row a { line-height:1.35; }
}

@media (max-width: 780px) {
    .page-roulette { padding:8px 8px 20px; gap:10px; scroll-behavior:smooth; }
    .roulette-sidebar {
        display:flex; max-height:0; min-height:0; padding:0 13px; gap:18px; border-width:0; border-radius:20px;
        overflow:hidden; opacity:0; visibility:hidden; pointer-events:none; transform:translateY(-8px);
        transition:max-height 320ms cubic-bezier(.2,0,0,1), padding 320ms cubic-bezier(.2,0,0,1), border-width 220ms ease, opacity 170ms ease, transform 280ms cubic-bezier(.2,0,0,1), visibility 0s linear 320ms;
    }
    .roulette-sidebar.mobile-open {
        max-height:760px; padding:16px 13px 18px; border-width:1px; overflow:hidden; opacity:1; visibility:visible; pointer-events:auto; transform:translateY(0);
        transition-delay:0s;
    }
    .roulette-mobile-setup-button { display:inline-flex; flex:0 0 auto; min-height:44px; padding-inline:13px; }
    .roulette-mobile-setup-button svg { width:19px; height:19px; fill:none; stroke:currentColor; stroke-width:1.9; stroke-linecap:round; }
    .page-roulette .levels-container { min-height:calc(100dvh - 106px); border-radius:20px; }
    .roulette-page-heading { min-height:78px; padding:13px 14px; }
    .roulette-page-heading h1 { font-size:clamp(1.25rem,5.5vw,1.7rem); }
    .roulette-status { min-width:84px; min-height:50px; padding:7px 10px; }
    .roulette-check { min-height:62px; }
    .page-roulette .options .btn { min-height:48px; }
    .page-roulette .save .btns .btn { min-height:46px; }
    .page-roulette .toasts-container { left:10px; right:10px; bottom:calc(82px + env(safe-area-inset-bottom)); }
    .page-roulette .toast { width:100%; }
}

@media (max-width: 560px) {
    .roulette-page-heading { display:flex; flex-wrap:wrap; gap:10px; }
    .roulette-page-heading > div:first-child { min-width:0; flex:1 1 145px; }
    .roulette-mobile-setup-button { order:3; flex:1 0 100%; }
    .levels-scroll { padding:10px 8px 20px; }
    .page-roulette .levels { gap:10px; }
    .page-roulette .levels .level.completed-level,
    .page-roulette .levels .level.remaining-level { grid-template-columns:112px minmax(0,1fr); }
    .page-roulette .levels .level.completed-level .video,
    .page-roulette .levels .level.remaining-level .video { min-height:96px; }
    .page-roulette .levels .level.current-level { grid-template-columns:1fr; }
    .page-roulette .levels .level.current-level .video { min-height:190px; }
    .page-roulette .levels .level .meta { padding:12px 13px; }
    .page-roulette .levels .level .actions { gap:8px; padding:12px; }
    .page-roulette .levels .level .actions .btn { flex:1 1 calc(50% - 4px); min-height:48px; }
    .roulette-percent-field { flex:1 0 100%; font-size:.78rem; }
    .page-roulette .levels .level .actions input[type="number"] { height:48px; font-size:1rem; }
}

@media (max-width: 720px) {
    #app { padding-bottom:calc(70px + env(safe-area-inset-bottom)); }
    .top-app-bar {
        height:calc(60px + env(safe-area-inset-top)); min-height:calc(60px + env(safe-area-inset-top));
        padding:env(safe-area-inset-top) 10px 0; grid-template-columns:minmax(0,1fr) auto; gap:8px;
    }
    .top-app-bar .logo img { width:36px; height:36px; border-radius:11px; }
    .top-app-bar .logo strong { max-width:128px; }
    .top-app-bar .nav {
        position:fixed; z-index:70; left:8px; right:8px; bottom:max(6px,env(safe-area-inset-bottom));
        width:min(520px,calc(100vw - 16px)); height:60px; margin-inline:auto; padding:4px;
        display:flex; grid-row:auto; grid-column:auto; gap:3px; overflow:visible;
        border:1px solid var(--md-outline-variant); border-radius:22px;
        background:color-mix(in srgb,var(--md-surface-1) 94%,transparent); color:var(--md-on-surface);
        box-shadow:0 8px 28px color-mix(in srgb,var(--md-shadow) 88%,transparent); backdrop-filter:blur(16px);
        transition:opacity 180ms ease, transform 240ms cubic-bezier(.2,0,0,1);
    }
    .nav__tab {
        flex:1 1 0; min-width:0; height:50px; padding:4px 5px; border-radius:17px;
        flex-direction:column; justify-content:center; gap:2px; opacity:.76; font-size:.68rem; line-height:1.05;
    }
    .nav__tab:hover { background:transparent; }
    .nav__tab.router-link-active { background:var(--md-primary-container); color:var(--md-on-primary-container); opacity:1; }
    .nav__tab::after { display:none; }
    .nav__icon { width:22px; height:22px; display:block; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
    .nav__actions { gap:3px; }
    .nav__actions .icon-button, .nav__actions .md-button { width:42px; height:42px; min-width:42px; min-height:42px; padding:0; }
    .nav__actions .action-icon { width:21px; height:21px; display:block; fill:none; stroke:currentColor; stroke-width:1.9; stroke-linecap:round; stroke-linejoin:round; }
    .nav__actions .admin-button span, .nav__actions .submit-record span { display:none; }
    .nav__actions .submit-record { display:inline-flex; }

    input, textarea, select { font-size:16px; }
    .field { font-size:.875rem; }
    .field input, .field textarea, select { min-height:48px; }
    .switch-row { min-height:46px; }
    .switch-row input[type="checkbox"], .device-options input, .roulette-check input { width:20px; height:20px; }
    .md-button, .btn { min-height:44px; }
    .icon-button.tiny { width:40px; height:40px; }
    .single-page { padding:16px 10px 28px; }
    .single-page.wide { padding:10px 8px 24px; }
    .md-card { padding:18px; border-radius:20px; }
    .admin-panel { gap:18px; }
    .form-actions { gap:7px; }
    .transfer-card-grid, .import-kind-grid { grid-template-columns:1fr; }
    .file-drop-shell { align-items:stretch; flex-direction:column; }

    .modal-backdrop { padding:0; place-items:end center; }
    .dialog, .dialog.compact {
        width:100%; max-height:min(94dvh,900px); margin:0; padding:16px 14px max(16px,env(safe-area-inset-bottom));
        border-radius:28px 28px 0 0; gap:18px; box-shadow:0 -12px 46px rgba(0,0,0,.34);
    }
    .dialog > .dialog-title {
        position:sticky; z-index:5; top:-16px; margin:-16px -14px 0; padding:13px 14px 11px;
        background:color-mix(in srgb,var(--md-surface-1) 95%,transparent); border-bottom:1px solid var(--md-outline-variant); backdrop-filter:blur(14px);
    }
    .dialog-title h2 { font-size:clamp(1.25rem,6vw,1.65rem); }
    .dialog .form-actions:last-child { padding-bottom:2px; }
    .modal-window-enter-from .dialog { transform:translateY(100%); }
    .modal-window-leave-to .dialog { transform:translateY(45%); }
    .mobile-keyboard-open #app { padding-bottom:0; }
    .mobile-keyboard-open .top-app-bar .nav { opacity:0; transform:translateY(calc(100% + 18px)); pointer-events:none; }
}

@media (max-width: 400px) {
    .top-app-bar .logo span { display:none; }
}

@media (hover: none), (pointer: coarse) {
    button, a, label, summary { -webkit-tap-highlight-color:transparent; }
    button, a, label, summary, input, select { touch-action:manipulation; }
    .md-button.primary:hover { box-shadow:none; }
    .icon-button:hover, .change-toggle:hover, .queue-select:hover, .queue-changelog-check:hover { background:transparent; }
    .btn:not(:disabled):hover { box-shadow:none; filter:none; }
    .tabs .tab:hover, .roulette-check:hover, .page-leaderboard .board .user button:hover, .achievement-row:hover, .tag-preset-use:hover, .chip:hover, .level-row:hover { background:transparent; }
    .level-row.active:hover { background:var(--md-primary-container); }
    .md-button:active:not(:disabled), .icon-button:active:not(:disabled), .btn:active:not(:disabled), .tabs .tab:active, .roulette-check:active, .level-row:active { transform:scale(.97); filter:none; }
    .md-button:active:not(:disabled), .icon-button:active:not(:disabled), .tabs .tab:active, .roulette-check:active { background:var(--md-focus); }
    .change-toggle { opacity:1; }
    .video-direct, .video-alt-embed { width:44px; height:44px; opacity:.94; transform:scale(1); }
    .video-alt-embed { right:62px; }
    .level-row.has-cover::before { display:none; }
    .level-row.has-cover .level-row-content { display:grid; grid-template-columns:minmax(0,1fr) 74px; align-items:center; gap:7px; padding-right:7px; }
    .level-row.has-cover .level-cover { max-height:none; opacity:1; transform:none; margin:6px 0; border-radius:11px; }
    .level-row.has-cover .level-cover img { width:74px; height:46px; border-radius:11px; }
    .rank-handle.legacy { display:flex; flex-direction:column; justify-content:center; gap:1px; font-size:.66rem; line-height:1.05; }
    .rank-handle.legacy .rank-label-default, .rank-handle.legacy .rank-label-hover { display:inline; }
    .rank-handle.legacy .rank-label-hover { color:var(--md-primary); font-variant-numeric:tabular-nums; }
    .level-row.active .rank-handle.legacy .rank-label-hover { color:inherit; }
    .achievement-row a { color:var(--md-primary); }
    .roulette-check:has(input:checked), .device-options label:has(input:checked) { background:var(--md-secondary-container); color:var(--md-on-secondary-container); box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--md-primary) 42%,transparent); }
}

/* v2.9 — explicit mobile views. A phone shows one task at a time instead of two
   cramped panes; compact landscape keeps a useful master/detail layout. */
@media (max-width:820px) {
    .mobile-list-view-switch {
        flex:0 0 auto; display:grid; grid-template-columns:1fr 1fr; gap:5px;
        min-height:64px; margin:0 0 8px; padding:4px; border:1px solid var(--md-outline-variant);
        border-radius:20px; background:var(--md-surface-1);
    }
    .mobile-list-view-tab {
        min-width:0; min-height:54px; padding:6px 10px; border:0; border-radius:16px;
        display:flex; align-items:center; gap:9px; background:transparent; color:var(--md-on-surface-variant); text-align:left;
    }
    .mobile-list-view-tab.active { background:var(--md-primary-container); color:var(--md-on-primary-container); }
    .mobile-list-view-tab svg { flex:0 0 auto; width:21px; height:21px; fill:none; stroke:currentColor; stroke-width:1.9; stroke-linecap:round; stroke-linejoin:round; }
    .mobile-list-view-tab > span { min-width:0; display:grid; gap:1px; }
    .mobile-list-view-tab strong { font-size:.84rem; }
    .mobile-list-view-tab small { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:.67rem; opacity:.78; }

    .page-list { display:flex; flex-direction:column; height:100%; min-height:0; overflow:hidden; }
    .page-list .list-pane {
        flex:1 1 auto; width:100%; height:100%; max-height:100%; min-height:0; padding:7px 8px 8px;
        border:0; overflow:hidden; box-shadow:none;
    }
    .page-list:not(.mobile-list-collapsed) .level-pane { display:none; }
    .page-list.mobile-list-collapsed .list-pane {
        position:static; flex:0 0 72px; height:72px; max-height:72px; padding:4px 8px;
        border-bottom:1px solid var(--md-outline-variant); box-shadow:0 3px 14px color-mix(in srgb,var(--md-shadow) 48%,transparent);
    }
    .page-list.mobile-list-collapsed .mobile-list-view-switch { min-height:64px; margin:0; }
    .page-list.mobile-list-collapsed .level-pane {
        display:flex; flex:1 1 auto; min-height:0; height:auto; padding:14px 10px 34px; overflow:auto;
    }
    .page-list.filters-open .list-pane,
    .page-list.filters-open:not(.mobile-list-collapsed) .list-pane { height:100%; max-height:100%; }
    .page-list .search-filter-menu { max-height:calc(100dvh - 198px); min-height:220px; }
    .page-list .mobile-level-browser-content { min-height:0; }
}

@media (max-width:820px) {
    .records-table { border:0; display:grid; gap:10px; overflow:visible; background:transparent; }
    .record-row.header { display:none; }
    .record-row:not(.header), .records-table.editable .record-row:not(.header) {
        grid-template-columns:minmax(0,1fr) auto; grid-template-areas:"player progress" "fps device" "actions actions";
        gap:12px 10px; padding:14px; border:1px solid var(--md-outline-variant); border-radius:18px;
        background:var(--md-surface-1); box-shadow:0 1px 2px color-mix(in srgb,var(--md-shadow) 44%,transparent);
    }
    .record-player { grid-area:player; display:grid !important; align-content:center; gap:3px !important; color:var(--md-on-surface) !important; }
    .record-player-name { font-size:.98rem; font-weight:800; line-height:1.25; }
    .record-proof-cue { display:inline; color:var(--md-primary); font-size:.69rem; font-weight:750; text-decoration:none; }
    .record-progress {
        grid-area:progress; align-self:center; min-height:36px; padding:0 11px; border-radius:999px;
        display:inline-flex !important; align-items:center; justify-content:center; background:var(--md-primary-container);
        color:var(--md-on-primary-container) !important; font-size:.9rem !important; font-weight:850;
    }
    .record-fps, .record-mobile-cell {
        min-width:0; min-height:42px; padding:7px 10px; border-radius:13px; background:var(--md-surface-2);
        display:flex !important; align-items:center; justify-content:flex-start; gap:7px !important; color:var(--md-on-surface) !important;
    }
    .record-fps { grid-area:fps; }
    .record-mobile-cell { grid-area:device; }
    .record-fps small, .record-mobile-cell small { display:inline; color:var(--md-on-surface-variant); font-size:.66rem; font-weight:750; text-transform:uppercase; letter-spacing:.04em; }
    .record-fps strong { font-size:.84rem; }
    .record-mobile-cell > span { display:inline; font-size:.8rem; font-weight:750; }
    .record-mobile-cell .mobile-record-icon { width:17px; height:17px; }
    .record-row-actions { grid-area:actions; grid-column:auto; justify-content:flex-end; padding-top:8px; border-top:1px solid var(--md-outline-variant); }
}

@media (max-width:800px) {
    .page-leaderboard-container { height:100%; padding:7px 8px 8px; overflow:hidden; }
    .page-leaderboard { height:100%; min-height:0; display:flex; flex-direction:column; gap:8px; }
    .page-leaderboard .error-container { flex:0 0 auto; }
    .mobile-leaderboard-view-switch {
        flex:0 0 auto; display:grid; grid-template-columns:1fr 1fr; gap:5px; min-height:62px; padding:4px;
        border:1px solid var(--md-outline-variant); border-radius:20px; background:var(--md-surface-1);
    }
    .mobile-leaderboard-view-switch button {
        min-width:0; min-height:52px; padding:5px 12px; border:0; border-radius:16px; display:grid; align-content:center; gap:1px;
        background:transparent; color:var(--md-on-surface-variant); text-align:left;
    }
    .mobile-leaderboard-view-switch button.active { background:var(--md-primary-container); color:var(--md-on-primary-container); }
    .mobile-leaderboard-view-switch span { font-size:.84rem; font-weight:800; }
    .mobile-leaderboard-view-switch small { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:.67rem; opacity:.78; }
    .page-leaderboard .board-container, .page-leaderboard .player-container { flex:1 1 auto; width:100%; height:auto; min-height:0; }
    .page-leaderboard-container:not(.mobile-board-collapsed) .player-container { display:none; }
    .page-leaderboard-container.mobile-board-collapsed .board-container { display:none; }
    .page-leaderboard-container.mobile-board-collapsed .player-container { min-height:0; }
    .board-container { opacity:1; transform:none; }
    .board-scroll, .player-scroll { overflow:auto; }
    .mobile-player-browser-button { display:none !important; }
}

@media (orientation:landscape) and (max-height:600px) and (max-width:1000px) {
    #app { padding:0 0 0 calc(70px + env(safe-area-inset-left)); }
    .top-app-bar {
        height:54px; min-height:54px; padding:5px max(10px,env(safe-area-inset-right)) 5px 10px;
        grid-template-columns:minmax(0,1fr) auto; gap:8px;
    }
    .top-app-bar .logo img { width:36px; height:36px; }
    .top-app-bar .logo small { display:none; }
    .top-app-bar .nav {
        position:fixed; z-index:75; left:max(5px,env(safe-area-inset-left)); right:auto; top:5px; bottom:5px;
        width:60px; height:auto; margin:0; padding:4px; display:flex; flex-direction:column; gap:4px; overflow:hidden;
        border:1px solid var(--md-outline-variant); border-radius:20px; background:color-mix(in srgb,var(--md-surface-1) 94%,transparent);
        color:var(--md-on-surface); box-shadow:0 8px 28px color-mix(in srgb,var(--md-shadow) 82%,transparent); backdrop-filter:blur(16px);
    }
    .top-app-bar .nav__tab {
        flex:1 1 0; min-width:0; width:100%; min-height:0; height:auto; padding:4px 2px; border-radius:15px;
        display:flex; flex-direction:column; align-items:center; justify-content:center; gap:2px; opacity:.76; font-size:.56rem; line-height:1;
    }
    .top-app-bar .nav__tab.router-link-active { opacity:1; background:var(--md-primary-container); color:var(--md-on-primary-container); }
    .top-app-bar .nav__tab::after { display:none; }
    .top-app-bar .nav__tab > span { max-width:52px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
    .top-app-bar .nav__icon { width:21px; height:21px; display:block; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
    .nav__actions .icon-button, .nav__actions .md-button { width:40px; height:40px; min-width:40px; min-height:40px; padding:0; }
    .nav__actions .action-icon { width:20px; height:20px; display:block; fill:none; stroke:currentColor; stroke-width:1.9; stroke-linecap:round; stroke-linejoin:round; }
    .nav__actions .admin-button span, .nav__actions .submit-record span { display:none; }

    .page-list, .page-list.meta-collapsed {
        display:grid; grid-template-columns:minmax(270px,38vw) minmax(0,1fr); grid-template-areas:"list level";
        height:100%; min-height:0; min-width:0; overflow:hidden;
    }
    .page-list .list-pane, .page-list.mobile-list-collapsed .list-pane {
        grid-area:list; width:auto; height:100%; max-height:none; min-height:0; padding:7px 7px 7px 9px;
        border:0; border-right:1px solid var(--md-outline-variant); overflow:hidden; box-shadow:none;
    }
    .page-list .level-pane, .page-list:not(.mobile-list-collapsed) .level-pane, .page-list.mobile-list-collapsed .level-pane {
        grid-area:level; display:flex; height:100%; min-height:0; padding:12px 14px 26px; overflow:auto;
    }
    .page-list .mobile-list-view-switch { display:none; }
    .page-list .mobile-level-browser-content { display:flex !important; min-height:0; }
    .page-list .pane-resizer, .page-list .meta-pane, .page-list .mobile-changelog, .page-list .mobile-list-info { display:none; }
    .page-list .search-row { gap:6px; padding-bottom:7px; }
    .page-list .search-box { min-height:44px; padding-left:12px; }
    .page-list .search-filter-button { width:44px; min-width:44px; min-height:44px; padding:0; }
    .page-list .search-filter-button > span:nth-child(2) { display:none; }
    .page-list .search-filter-button .filter-count { position:absolute; transform:translate(13px,-13px); }
    .page-list .add-level-button { min-width:56px; padding-inline:10px; }
    .page-list .search-filter-menu { min-height:180px; max-height:calc(100dvh - 118px); margin-bottom:7px; padding:10px; }
    .page-list .filter-height-resizer { min-height:22px; height:22px; }
    .level-heading { gap:8px; }
    .level-heading-actions .md-button { min-height:40px; padding-inline:13px; }

    .records-table { border:0; display:grid; gap:8px; overflow:visible; background:transparent; }
    .record-row.header { display:none; }
    .record-row:not(.header), .records-table.editable .record-row:not(.header) {
        grid-template-columns:minmax(0,1fr) auto; grid-template-areas:"player progress" "fps device" "actions actions";
        gap:8px; padding:10px 11px; border:1px solid var(--md-outline-variant); border-radius:15px; background:var(--md-surface-1);
    }
    .record-player { grid-area:player; display:grid; gap:2px; color:var(--md-on-surface) !important; }
    .record-player-name { font-weight:800; }
    .record-proof-cue { display:inline; color:var(--md-primary); font-size:.66rem; }
    .record-progress { grid-area:progress; align-self:center; padding:6px 9px; border-radius:999px; background:var(--md-primary-container); color:var(--md-on-primary-container); }
    .record-fps, .record-mobile-cell { min-height:34px; padding:5px 8px; border-radius:11px; display:flex; align-items:center; justify-content:flex-start; gap:6px; background:var(--md-surface-2); }
    .record-fps { grid-area:fps; }
    .record-mobile-cell { grid-area:device; }
    .record-fps small, .record-mobile-cell small, .record-mobile-cell > span { display:inline; }
    .record-fps small, .record-mobile-cell small { color:var(--md-on-surface-variant); font-size:.62rem; font-weight:750; text-transform:uppercase; }
    .record-row-actions { grid-area:actions; grid-column:auto; padding-top:5px; border-top:1px solid var(--md-outline-variant); }

    .page-leaderboard-container { height:100%; min-height:0; padding:7px; overflow:hidden; }
    .page-leaderboard {
        display:grid; grid-template-columns:minmax(250px,36vw) minmax(0,1fr); grid-template-rows:minmax(0,1fr);
        gap:8px; height:100%; min-height:0;
    }
    .mobile-leaderboard-view-switch { display:none; }
    .page-leaderboard .board-container, .page-leaderboard .player-container,
    .page-leaderboard-container:not(.mobile-board-collapsed) .player-container,
    .page-leaderboard-container.mobile-board-collapsed .board-container {
        display:flex; grid-row:1; min-height:0; height:100%; opacity:1; transform:none; border-width:1px; pointer-events:auto;
    }
    .page-leaderboard .board-container { grid-column:1; }
    .page-leaderboard .player-container { grid-column:2; }
    .page-leaderboard .error-container { position:absolute; z-index:4; left:8px; right:8px; top:8px; }
    .leaderboard-panel-header { min-height:58px; padding:8px 12px; }
    .leaderboard-search-box { min-height:44px; margin:6px; }
    .board-scroll, .player-scroll { min-height:0; overflow:auto; }
    .player-header { min-height:72px; padding:10px 12px; }
    .player-points { min-width:88px; min-height:52px; padding:8px 10px; }
    .player-points strong { font-size:1.15rem; }
    .player-scroll { padding:12px 10px 18px; }
    .mobile-player-browser-button { display:none !important; }

    .page-roulette { height:100%; min-height:0; padding:7px; grid-template-columns:minmax(240px,34vw) minmax(0,1fr); gap:8px; overflow:hidden; }
    .roulette-sidebar, .roulette-sidebar.mobile-open {
        display:flex; max-height:none; min-height:0; height:100%; padding:12px; gap:14px; border-width:1px;
        overflow:auto; opacity:1; visibility:visible; pointer-events:auto; transform:none;
    }
    .roulette-sidebar-heading { gap:3px; }
    .roulette-control-section { gap:7px; padding-top:10px; }
    .roulette-check { min-height:46px; padding:6px 9px; }
    .roulette-credit { display:none; }
    .page-roulette .levels-container { min-height:0; height:100%; overflow:hidden; }
    .roulette-page-heading { min-height:64px; padding:8px 12px; }
    .roulette-mobile-setup-button { display:none; }
    .levels-scroll { min-height:0; overflow:auto; padding:10px; }
    .page-roulette .levels .level { grid-template-columns:135px minmax(0,1fr); }
    .page-roulette .levels .level .video { min-height:92px; }
    .page-roulette .levels .level.current-level { grid-template-columns:145px minmax(0,1fr); }

    .modal-backdrop { padding:7px; place-items:center; }
    .dialog, .dialog.compact { width:min(760px,100%); max-height:100%; margin:0; padding:14px; border-radius:20px; }
    .dialog > .dialog-title { position:static; margin:0; padding:0 0 9px; background:transparent; backdrop-filter:none; }
}
