/* 1.14.5: distinguish browser dimensions with terse inline labels, not subtitle-style microcopy. */

html body #quiz-browser #qb-library-tabs {
    gap: 18px;
    padding-bottom: 2px;
}

html body #quiz-browser .qb-library-tab {
    color: #555;
}

html body #quiz-browser .qb-library-tab[aria-selected="true"] {
    color: #075f9e;
}

html body #quiz-browser .qb-library-count {
    color: #858585 !important;
    font-weight: 500;
}

html body #quiz-browser #qb-category-tabs,
html body #quiz-browser #qb-mode-tabs,
html body #quiz-browser #qb-family-tabs {
    align-items: baseline;
    gap: 16px;
    margin-top: 4px !important;
    padding: 5px 0 2px !important;
    border-top: 0 !important;
    border-bottom: 0 !important;
    overflow-x: auto;
    overflow-y: hidden;
}

html body #quiz-browser #qb-category-tabs {
    margin-top: 10px !important;
}

html body #quiz-browser #qb-category-tabs::before,
html body #quiz-browser #qb-mode-tabs::before,
html body #quiz-browser #qb-family-tabs::before {
    position: sticky;
    left: 0;
    z-index: 1;
    flex: 0 0 48px;
    align-self: baseline;
    background: #fff;
    color: #777;
    font-size: 12px;
    font-weight: 400;
    line-height: 1;
    white-space: nowrap;
}

html body #quiz-browser #qb-category-tabs::before {
    content: "Quiz";
}

html body #quiz-browser #qb-mode-tabs::before {
    content: "Mode";
}

html body #quiz-browser #qb-family-tabs::before {
    content: "Places";
}

html body #quiz-browser .qb-category-tab,
html body #quiz-browser .qb-mode-tab,
html body #quiz-browser .qb-family-tab {
    min-height: 31px;
    padding: 5px 0 6px;
    color: #666;
}

html body #quiz-browser .qb-category-tab[aria-selected="true"],
html body #quiz-browser .qb-mode-tab[aria-selected="true"],
html body #quiz-browser .qb-family-tab[aria-selected="true"] {
    border-bottom-width: 2px;
    color: #075f9e;
}

html body #quiz-browser #qb-search {
    margin-top: 7px;
    border-top: 1px solid #e6e6e6;
}

html body #quiz-browser:has(.qb-library-tab[data-library-view="favorites"][aria-selected="true"]) #qb-search,
html body #quiz-browser:has(.qb-library-tab[data-library-view="recent"][aria-selected="true"]) #qb-search {
    border-top: 0 !important;
}

html body #quiz-browser #qb-directory-links {
    text-align: center;
}

html body #quiz-browser .qb-directory-primary {
    display: block !important;
    width: fit-content !important;
    margin: 0 auto;
    text-align: center;
}

@media (max-width: 700px) {
    html body #quiz-browser #qb-category-tabs,
    html body #quiz-browser #qb-mode-tabs,
    html body #quiz-browser #qb-family-tabs {
        gap: 14px;
        margin-top: 3px !important;
        padding-top: 4px !important;
    }

    html body #quiz-browser #qb-category-tabs {
        margin-top: 9px !important;
    }

    html body #quiz-browser #qb-category-tabs::before,
    html body #quiz-browser #qb-mode-tabs::before,
    html body #quiz-browser #qb-family-tabs::before {
        flex-basis: 44px;
        font-size: 12px;
    }
}

/* 1.14.6 surface balance: the browser is a floating map surface, its controls are not cards. */
html body #quiz-browser {
    border-radius: 10px !important;
    box-shadow: 0 3px 12px rgba(0, 0, 0, .12) !important;
}

html body #quiz-browser #qb-library-tabs {
    padding-bottom: 4px;
}

html body #quiz-browser #qb-category-tabs {
    margin-top: 12px !important;
}


#qb-curtain-body,
#qb-mobile-tools {
    display: contents;
}

.smurdy-theme-toggle--mobile-browser {
    display: none !important;
}

/* 1.16.19 mobile quiz browser: fixed header with retractable body. */
@media (max-width: 700px) {
    html body #quiz-browser {
        position: fixed !important;
        inset: 0 0 auto 0 !important;
        width: 100% !important;
        max-width: none !important;
        height: auto !important;
        max-height: min(76dvh, 700px) !important;
        margin: 0 !important;
        padding: max(8px, env(safe-area-inset-top)) 12px 0 !important;
        transform: none !important;
        overflow: hidden !important;
        border-width: 0 0 1px !important;
        border-radius: 0 0 12px 12px !important;
        box-shadow: 0 4px 14px rgba(0,0,0,.16) !important;
        will-change: auto !important;
    }

    html body #quiz-browser #qb-header {
        display: flex !important;
        min-height: 44px !important;
        padding: 2px 0 7px !important;
        align-items: center !important;
        gap: 7px !important;
    }

    html body #quiz-browser #qb-mobile-brand {
        order: 1;
        margin: 0 !important;
    }

    html body #quiz-browser #qb-mobile-brand img {
        width: 38px !important;
        height: 38px !important;
    }

    html body #quiz-browser #qb-mobile-brand span {
        font-size: 18px !important;
    }

    html body #quiz-browser #qb-header > .smurdy-page-share-trigger {
        order: 2;
        margin-left: auto !important;
    }

    html body #quiz-browser #qb-header > .smurdy-theme-toggle--mobile-browser {
        display: inline-flex !important;
        order: 3;
    }

    html body #quiz-browser #qb-header > :is(.smurdy-page-share-trigger,.smurdy-theme-toggle--mobile-browser) {
        width: 36px !important;
        height: 36px !important;
        min-width: 36px !important;
        min-height: 36px !important;
        margin-top: 0 !important;
        border-radius: 6px !important;
        align-items: center !important;
        justify-content: center !important;
    }

    html body #quiz-browser #qb-curtain-body {
        display: flex;
        min-height: 0;
        max-height: 620px;
        flex: 1 1 auto;
        flex-direction: column;
        overflow: hidden;
        opacity: 1;
        transition:
            max-height 260ms cubic-bezier(.22,.8,.25,1),
            opacity 180ms ease;
    }

    html body #quiz-browser #qb-library-tabs {
        gap: 18px !important;
        margin: 0 !important;
        padding: 3px 0 6px !important;
    }

    html body #quiz-browser .qb-library-tab {
        min-height: 31px !important;
        padding: 5px 0 4px !important;
        font-size: 12px !important;
    }

    html body #quiz-browser #qb-category-tabs,
    html body #quiz-browser #qb-mode-tabs,
    html body #quiz-browser #qb-family-tabs {
        gap: 11px !important;
        min-height: 37px;
        margin: 0 !important;
        padding: 3px 0 !important;
        align-items: center !important;
    }

    html body #quiz-browser #qb-category-tabs {
        margin-top: 4px !important;
    }

    html body #quiz-browser #qb-category-tabs::before,
    html body #quiz-browser #qb-mode-tabs::before,
    html body #quiz-browser #qb-family-tabs::before {
        flex: 0 0 42px !important;
        align-self: center !important;
        font-size: 12px !important;
        line-height: 31px !important;
    }

    html body #quiz-browser :is(.qb-category-tab,.qb-mode-tab,.qb-family-tab) {
        min-height: 31px !important;
        padding: 5px 0 4px !important;
        font-size: 12px !important;
        line-height: 22px !important;
    }

    html body #quiz-browser #qb-mobile-tools {
        display: grid !important;
        grid-template-columns: minmax(0, 1.7fr) minmax(126px, 1fr);
        gap: 7px !important;
        margin: 5px 0 0 !important;
        align-items: stretch;
    }

    html body #quiz-browser #qb-search {
        display: block !important;
        min-width: 0;
        margin: 0 !important;
        padding: 0 !important;
        border-bottom: 0 !important;
    }

    html body #quiz-browser #qb-search input {
        width: 100% !important;
        min-height: 38px !important;
        padding: 7px 10px !important;
        border-radius: 6px !important;
        font-size: 14px !important;
    }

    html body #quiz-browser #qb-mobile-weak-spots {
        display: flex !important;
        min-width: 0;
        min-height: 38px !important;
        margin: 0 !important;
        padding: 7px 9px !important;
        justify-content: center !important;
        gap: 6px !important;
        border-radius: 6px !important;
        font-size: 12px !important;
        white-space: nowrap;
    }

    html body #quiz-browser #qb-mobile-weak-spots::before {
        width: 18px !important;
        height: 18px !important;
    }

    html body #quiz-browser .qb-size-filter {
        display: none !important;
    }

    html body #quiz-browser #qb-list {
        flex: 1 1 auto !important;
        min-height: 0 !important;
        max-height: none !important;
        gap: 0 !important;
        overflow-y: auto !important;
    }

    html body #quiz-browser .qb-card {
        min-height: 54px;
        margin: 0 !important;
        padding: 7px 2px !important;
        gap: 2px !important;
        border-radius: 0 !important;
        background: transparent !important;
    }

    html body #quiz-browser .qb-card-layout {
        grid-template-columns: minmax(0,1fr) auto !important;
        align-items: center !important;
        gap: 7px !important;
    }

    html body #quiz-browser .qb-title {
        margin-bottom: 1px !important;
        font-size: 14px !important;
    }

    html body #quiz-browser .qb-sub,
    html body #quiz-browser .qb-card-context {
        font-size: 11px !important;
        line-height: 1.2 !important;
    }

    html body #quiz-browser .qb-card-actions {
        gap: 5px !important;
        align-items: center !important;
    }

    html body #quiz-browser .qb-favorite {
        width: 32px !important;
        height: 32px !important;
        min-width: 32px !important;
        min-height: 32px !important;
    }

    html body #quiz-browser .qb-play {
        min-width: 58px !important;
        min-height: 32px !important;
        padding: 6px 9px !important;
        border-radius: 6px !important;
        font-size: 13px !important;
    }

    html body #quiz-browser #qb-directory-links {
        display: flex !important;
        justify-content: center;
        margin-top: 1px !important;
        padding: 6px 0 5px !important;
        background: transparent !important;
    }

    html body #quiz-browser .qb-directory-primary,
    html body #quiz-browser .qb-directory-popular {
        display: none !important;
    }

    html body #quiz-browser .qb-mobile-info-links {
        display: flex !important;
        justify-content: center;
        gap: 14px;
        margin: 0;
        font-size: 11px;
        white-space: nowrap;
    }

    html body #quiz-browser .qb-mobile-info-links a {
        color: inherit;
        text-decoration: underline;
        text-underline-offset: 2px;
    }

    html body #quiz-browser #qb-mobile-collapse {
        flex: 0 0 30px !important;
        width: calc(100% + 24px) !important;
        height: 30px !important;
        min-height: 30px !important;
        margin: 3px -12px 0 !important;
        border-radius: 0 0 12px 12px !important;
    }

    html body #quiz-browser #qb-mobile-collapse-arrow {
        width: 18px !important;
        height: 18px !important;
    }

    html body #quiz-browser.qb-mobile-collapsed {
        max-height: none !important;
        height: auto !important;
        transform: none !important;
        box-shadow: 0 3px 10px rgba(0,0,0,.14) !important;
    }

    html body #quiz-browser.qb-mobile-collapsed #qb-curtain-body {
        max-height: 0 !important;
        opacity: 0;
        pointer-events: none;
    }

    html body #quiz-browser.qb-mobile-collapsed #qb-header {
        border-bottom: 0 !important;
    }

    html body #quiz-browser.qb-mobile-collapsed #qb-mobile-collapse {
        margin-top: 0 !important;
    }

    #app-version {
        display: none !important;
    }
}

@media (min-width: 701px) {
    .qb-mobile-info-links {
        display: none !important;
    }
}
