/* Desktop Web UI shell. Mobile keeps the existing single-column app. */
#desktop-sidebar,
#desktop-context-panel {
    display: none;
}

.desktop-shell-card {
    background: rgba(255, 255, 255, 0.86);
    border: 1px solid rgba(255, 255, 255, 0.72);
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.14);
}

.desktop-nav-button {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    width: 100%;
    padding: 0.95rem 1rem;
    border-radius: 1rem;
    color: #cbd5e1;
    font-weight: 900;
    text-align: left;
    transition: background-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.desktop-nav-button:hover,
.desktop-nav-button:focus-visible {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    outline: 2px solid rgba(245, 158, 11, 0.45);
    outline-offset: 2px;
}

.desktop-nav-button.is-active {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #ffffff;
    box-shadow: 0 16px 30px rgba(37, 99, 235, 0.28);
}

.desktop-nav-button i {
    width: 1.25rem;
    text-align: center;
}

.desktop-plan-card {
    margin-top: auto;
    display: grid;
    gap: 0.9rem;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 1.45rem;
    padding: 1.35rem;
    color: #0f172a;
    box-shadow: 0 18px 38px rgba(15, 23, 42, 0.16);
}

.desktop-plan-card .mt-3 {
    margin-top: 0.45rem !important;
}

.desktop-plan-card .desktop-context-button {
    margin-top: 0 !important;
    min-height: 3.25rem;
    border-radius: 1.15rem;
}

.desktop-kicker {
    color: #f97316;
    font-size: 0.7rem;
    font-weight: 900;
    letter-spacing: 0.24em;
    text-transform: uppercase;
}

.desktop-context-card {
    border-radius: 1.35rem;
    padding: 1.45rem;
}

.desktop-context-title {
    color: #0f172a;
    font-family: Oswald, sans-serif;
    font-size: 1.45rem;
    font-weight: 900;
    line-height: 1.08;
    text-transform: uppercase;
}

.desktop-context-copy {
    color: #64748b;
    font-size: 0.95rem;
    font-weight: 800;
    line-height: 1.55;
}

.desktop-context-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    width: 100%;
    min-height: 3.5rem;
    border-radius: 999px;
    background: linear-gradient(135deg, #f97316, #fb923c);
    color: #ffffff;
    font-weight: 900;
    box-shadow: 0 14px 28px rgba(249, 115, 22, 0.22);
}

.desktop-stat-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    border-radius: 1rem;
    background: #f8fafc;
    padding: 1rem 1.1rem;
    color: #64748b;
    font-weight: 900;
}

.desktop-stat-row strong {
    color: #0f172a;
    font-size: 1.05rem;
}

.desktop-progress-track {
    height: 0.65rem;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.1);
}

.desktop-progress-fill {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #f59e0b, #f97316);
}

/* 1280px, not 1024px: below this the three columns squeeze the content track
   narrower than the mobile layout's own content width, so small desktops get
   the single-column mobile shell instead. */
@media (min-width: 1280px) and (hover: hover) and (pointer: fine) {
    html {
        height: 100%;
        min-height: 100%;
        overflow: hidden;
    }

    body {
        display: grid !important;
        /* Middle track is capped so the shell stops stretching on ultrawide
           displays; justify-content keeps the three columns centred as one
           unit. No-op at or below 1920px, where the middle track is narrower
           than the cap anyway. */
        grid-template-columns: clamp(16.2rem, 20vw, 21rem) minmax(0, 64rem) clamp(19rem, 23vw, 24.5rem);
        justify-content: center;
        gap: clamp(1.35rem, 2vw, 2.25rem);
        align-items: stretch;
        height: 100vh;
        min-height: 100vh;
        isolation: isolate;
        overflow: hidden;
        background:
            radial-gradient(circle at 8% 8%, rgba(37, 99, 235, 0.2), transparent 34rem),
            linear-gradient(135deg, #dbeafe 0%, #f8fafc 52%, #f3e7df 100%) !important;
        padding: clamp(1.7rem, 2.5vw, 2.55rem) clamp(2.15rem, 3.2vw, 3.45rem);
    }

    body::before {
        content: "";
        position: fixed;
        inset: clamp(0.85rem, 1.25vw, 1.25rem);
        z-index: 0;
        pointer-events: none;
        border: 1px solid rgba(255, 255, 255, 0.78);
        border-radius: 2.45rem;
        background:
            radial-gradient(circle at 18% 8%, rgba(96, 165, 250, 0.16), transparent 22rem),
            radial-gradient(circle at 88% 96%, rgba(245, 158, 11, 0.12), transparent 24rem),
            rgba(255, 255, 255, 0.58);
        box-shadow:
            inset 0 1px 0 rgba(255, 255, 255, 0.78),
            0 28px 80px rgba(15, 23, 42, 0.12);
    }

    body > header {
        display: none !important;
    }

    #desktop-sidebar {
        position: relative;
        z-index: 2;
        display: flex;
        height: calc(100vh - clamp(1.7rem, 2.5vw, 2.55rem) - clamp(1.7rem, 2.5vw, 2.55rem));
        min-height: 0;
        max-height: none;
        min-width: 0;
        flex-direction: column;
        overflow: hidden;
        border-radius: 1.9rem;
        background: linear-gradient(180deg, #0f172a, #1e293b);
        padding: clamp(1.1rem, 1.6vw, 1.45rem);
        color: #ffffff;
        box-shadow: 0 26px 60px rgba(15, 23, 42, 0.28);
    }

    #desktop-context-panel {
        position: relative;
        z-index: 2;
        display: flex;
        min-width: 0;
        height: calc(100vh - clamp(1.7rem, 2.5vw, 2.55rem) - clamp(1.7rem, 2.5vw, 2.55rem));
        min-height: 0;
        max-height: none;
        flex-direction: column;
        gap: clamp(1.15rem, 1.75vw, 1.8rem);
        overflow-y: auto;
        padding-left: clamp(0.55rem, 0.9vw, 1rem);
        padding-right: 0;
        border-left: 1px solid rgba(203, 213, 225, 0.42);
    }

    #desktop-context-panel .desktop-shell-card {
        background: #ffffff;
        border-color: rgba(226, 232, 240, 0.9);
        box-shadow: 0 22px 48px rgba(15, 23, 42, 0.1);
    }

    #main-content {
        position: relative;
        z-index: 2;
        min-width: 0;
        height: calc(100vh - clamp(1.7rem, 2.5vw, 2.55rem) - clamp(1.7rem, 2.5vw, 2.55rem));
        min-height: 0;
        overflow-y: auto;
        overflow-x: hidden;
        border-radius: 1.9rem;
        background: transparent !important;
        padding: 0 clamp(0.35rem, 0.7vw, 0.75rem) 0 0 !important;
        scrollbar-gutter: stable;
    }

    #bottom-nav {
        display: none !important;
    }

    #side-menu {
        display: none !important;
    }

    #home-screen,
    #view-exam,
    #view-profile,
    #view-upgrade-screen,
    #view-upgrade-legacy,
    #results-screen,
    #quiz-screen,
    #exam-screen {
        max-width: 100% !important;
        width: 100%;
        margin-left: auto !important;
        margin-right: auto !important;
        padding-bottom: 0 !important;
    }

    #home-screen > #view-study > .max-w-md,
    #view-exam > .max-w-md,
    #view-profile > .max-w-md,
    #view-upgrade-screen > .max-w-md,
    #view-upgrade-legacy > .max-w-md {
        max-width: none !important;
        width: 100%;
        padding-left: 0 !important;
        padding-right: 0 !important;
        padding-top: 0 !important;
    }

    #quiz-screen,
    #exam-screen,
    #results-screen {
        max-width: min(100%, 56rem) !important;
        padding: 0 !important;
    }

    #exam-screen {
        position: relative !important;
        inset: auto !important;
        z-index: 2;
        border-radius: 1.9rem;
        background: #ffffff !important;
        box-shadow: 0 24px 60px rgba(15, 23, 42, 0.12);
        min-height: 100%;
        overflow-y: auto;
        padding: 2rem !important;
    }

    #exam-screen.hidden {
        display: none !important;
    }

    #main-content:has(#exam-screen:not(.hidden)) #home-screen,
    #main-content:has(#exam-screen:not(.hidden)) #view-exam,
    #main-content:has(#exam-screen:not(.hidden)) #quiz-screen,
    #main-content:has(#exam-screen:not(.hidden)) #results-screen {
        display: none !important;
    }

    #exam-body {
        min-height: 100%;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        padding-top: 0 !important;
        padding-bottom: 0 !important;
    }

    #exam-body .max-w-md {
        max-width: 52rem !important;
        width: 100%;
        margin-left: auto !important;
        margin-right: auto !important;
    }

    .study-home-shell,
    .app-panel-shell,
    .result-summary-card {
        border-radius: 1.9rem !important;
    }

    .study-home-shell {
        min-height: 100%;
        overflow: hidden;
        background: linear-gradient(150deg, #2563eb 0%, #1d4ed8 58%, #0f172a 100%);
        box-shadow: 0 26px 60px rgba(37, 99, 235, 0.22);
    }

    .study-dashboard {
        padding: clamp(1.35rem, 2.3vw, 2.1rem) !important;
    }

    .study-dashboard-title {
        max-width: 100%;
        overflow-wrap: anywhere;
        font-size: clamp(2.15rem, 4.2vw, 4rem) !important;
        line-height: 0.95 !important;
    }

    .study-dashboard-card {
        margin-top: 1.35rem;
        border-color: rgba(255, 255, 255, 0.26) !important;
        background: rgba(255, 255, 255, 0.14) !important;
        backdrop-filter: blur(18px);
    }

    .study-dashboard-card .flex.items-center.gap-4 {
        align-items: center;
        gap: 1.65rem !important;
    }

    .study-progress-ring {
        width: 5.35rem !important;
        height: 5.35rem !important;
        flex: 0 0 5.35rem !important;
        box-shadow: 0 0 0 0.55rem rgba(255, 255, 255, 0.10);
    }

    .study-progress-ring::before {
        width: 3.55rem !important;
        height: 3.55rem !important;
        background: rgba(15, 23, 42, 0.98) !important;
    }

    .study-ring-label {
        display: block;
        font-size: 0.48rem !important;
        letter-spacing: 0.03em !important;
        line-height: 1 !important;
        max-width: 3rem;
        margin: 0 auto;
    }

    .study-ring-value {
        display: block;
        font-size: 0.92rem !important;
        line-height: 1 !important;
        margin-top: 0.14rem !important;
    }

    #study-card-title {
        overflow-wrap: normal;
        word-break: normal;
        font-size: clamp(1.05rem, 1.55vw, 1.35rem) !important;
        line-height: 1.18 !important;
    }

    .study-modules-header,
    .study-modules-surface,
    .study-collection-grid {
        padding-left: clamp(1.35rem, 2.3vw, 2.1rem);
        padding-right: clamp(1.35rem, 2.3vw, 2.1rem);
    }

    .study-modules-surface > .grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-auto-rows: minmax(7.25rem, auto);
        align-items: stretch;
    }

    .study-module-card {
        min-height: 7.25rem;
        transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease, background-color 180ms ease;
        will-change: transform, box-shadow;
    }

    .study-module-card:hover {
        transform: translateY(-4px);
        box-shadow: 0 18px 34px rgba(15, 23, 42, 0.15) !important;
    }

    .study-module-card:active {
        transform: translateY(-1px) scale(0.985);
    }

    /* Desktop reading order: primary first, banner promoted above the compact
       cards, wide row last. Unmodified cards share one order band so they keep
       their DOM order — add or reorder cards freely without touching this. */
    .study-modules-surface > .grid > .study-module-card {
        order: 5;
    }

    .study-modules-surface > .grid > .study-module-card.module-card-primary {
        order: 1;
    }

    .study-modules-surface > .grid > .study-module-card.module-card-banner {
        order: 2;
    }

    .study-modules-surface > .grid > .study-module-card.module-card-row {
        order: 9;
    }

    .study-module-card.module-card-primary,
    .study-module-card.module-card-wide {
        grid-column: 1 / -1;
        min-height: 7.75rem;
        width: 100%;
    }

    .study-module-card:not(.module-card-primary):not(.module-card-wide).col-span-2 {
        grid-column: auto !important;
    }

    .study-module-card:not(.module-card-primary):not(.module-card-wide) {
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 0.5rem !important;
        padding: 1rem !important;
        text-align: center !important;
        width: 100%;
    }

    .study-module-card:not(.module-card-primary):not(.module-card-wide) .p-5 {
        padding: 0 !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        gap: 0.55rem !important;
    }

    .study-module-card:not(.module-card-primary):not(.module-card-wide) .absolute.top-0.right-0 {
        border-bottom-left-radius: 0.8rem !important;
        padding: 0.25rem 0.65rem !important;
    }

    .study-module-card:not(.module-card-primary):not(.module-card-wide) .module-chevron,
    .study-module-card:not(.module-card-primary):not(.module-card-wide) .ml-auto {
        display: none !important;
    }

    .study-module-card:not(.module-card-primary):not(.module-card-wide) .text-left,
    .study-module-card:not(.module-card-primary):not(.module-card-wide) div:not(.absolute) {
        text-align: center !important;
    }

    .study-modules-surface > .grid > .study-module-card.module-card-wide {
        flex-direction: row !important;
        align-items: center !important;
        justify-content: flex-start !important;
        text-align: left !important;
    }

    /* Banner variant carries its own inner .p-5 wrapper, so the card itself
       has no padding. The row variant pads the card directly. */
    .study-modules-surface > .grid > .study-module-card.module-card-banner {
        padding: 0 !important;
    }

    .study-modules-surface > .grid > .study-module-card.module-card-row {
        gap: 1rem !important;
        padding: 1.25rem 1.5rem !important;
    }

    .study-modules-surface > .grid > .study-module-card.module-card-row > i {
        width: 3.5rem;
        height: 3.5rem;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex: 0 0 3.5rem;
        border-radius: 999px;
        background: #eff6ff;
        font-size: 1.45rem !important;
        color: #2563eb !important;
    }

    .study-modules-surface > .grid > .study-module-card.module-card-row > div {
        min-width: 0;
        text-align: left !important;
    }

    .study-modules-surface > .grid > .study-module-card.module-card-row h3 {
        font-size: 1.1rem !important;
    }

    .study-modules-surface > .grid > .study-module-card.module-card-row p {
        font-size: 0.78rem !important;
    }

    .study-modules-surface > .grid > .study-module-card.module-card-wide .p-5 {
        display: flex !important;
        width: 100%;
        align-items: center !important;
        gap: 1rem !important;
        padding: 1.25rem 1.5rem !important;
        text-align: left !important;
    }

    .study-modules-surface > .grid > .study-module-card.module-card-wide .module-chevron,
    .study-modules-surface > .grid > .study-module-card.module-card-wide .ml-auto {
        display: inline-flex !important;
        margin-left: auto !important;
    }

    .study-collection-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        padding-bottom: 2.25rem;
    }

    .study-dashboard .upgrade-highlight-card {
        display: none !important;
    }

    .upgrade-highlight-card {
        max-width: none;
    }

    .app-panel-shell {
        display: grid;
        grid-template-columns: minmax(13rem, 0.7fr) minmax(0, 1.3fr);
        align-items: stretch;
        overflow: hidden;
        background: #ffffff;
        box-shadow: 0 24px 60px rgba(15, 23, 42, 0.12);
    }

    .app-panel-head {
        min-height: 100%;
        padding: 2rem !important;
        background: linear-gradient(180deg, #ffffff, #f8fafc);
    }

    .app-panel-kicker {
        color: #f59e0b !important;
    }

    .app-panel-copy {
        color: #475569 !important;
        font-weight: 800 !important;
        line-height: 1.55 !important;
    }

    .app-panel-title {
        display: block !important;
        color: #0f172a !important;
        font-size: clamp(2.2rem, 3.1vw, 3.6rem) !important;
        line-height: 0.95 !important;
    }

    .app-panel-surface {
        border-radius: 0 !important;
        box-shadow: none !important;
    }

    #view-exam .app-panel-shell,
    .upgrade-screen-view .app-panel-shell {
        min-height: 100%;
    }

    #view-exam .app-panel-surface {
        display: flex;
        flex-direction: column;
        justify-content: center;
        gap: 1.15rem;
    }

    #view-exam .promo-cta-btn {
        margin-top: 1.1rem !important;
    }

    .upgrade-screen-view .app-panel-shell {
        grid-template-columns: minmax(12rem, 0.58fr) minmax(0, 1.42fr);
    }

    .upgrade-screen-view .app-panel-surface {
        display: flex;
        flex-direction: column;
        justify-content: center;
        gap: 0.9rem;
        padding: clamp(1.1rem, 1.5vw, 1.45rem) !important;
    }

    .upgrade-screen-view .upgrade-price-card {
        padding: 1rem 1.1rem !important;
        border-radius: 1.05rem !important;
    }

    .upgrade-screen-view .upgrade-feature-item {
        padding: 0.75rem 0 !important;
        gap: 0.8rem !important;
    }

    .upgrade-screen-view .upgrade-feature-icon {
        width: 2.5rem !important;
        height: 2.5rem !important;
        flex: 0 0 2.5rem !important;
    }

    .upgrade-screen-view .upgrade-primary-btn {
        margin-top: 0.8rem !important;
        padding-top: 1rem !important;
        padding-bottom: 1rem !important;
    }

    .upgrade-screen-view .upgrade-helper-box,
    .upgrade-screen-view .upgrade-secondary-btn,
    .upgrade-screen-view .app-panel-surface > button[onclick="switchTab('profile')"] {
        display: none !important;
    }

    #view-profile .app-panel-shell {
        display: grid;
        grid-template-columns: minmax(20rem, 0.95fr) minmax(0, 1.35fr);
        gap: clamp(1rem, 1.45vw, 1.45rem);
        min-height: 100%;
        align-items: stretch;
        overflow: visible;
        padding: clamp(1.25rem, 1.8vw, 1.75rem);
        background: rgba(255, 255, 255, 0.78);
        border: 1px solid rgba(226, 232, 240, 0.92);
        box-shadow: 0 24px 60px rgba(15, 23, 42, 0.10);
    }

    #view-profile .app-panel-head {
        min-height: 18rem;
        border-radius: 1.45rem;
        padding: clamp(1.25rem, 1.7vw, 1.65rem) !important;
        background:
            radial-gradient(circle at 100% 0%, rgba(245, 158, 11, 0.18), transparent 38%),
            linear-gradient(180deg, #0f172a, #17233b);
        box-shadow: 0 18px 36px rgba(15, 23, 42, 0.22);
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
    }

    #view-profile .app-panel-head .app-panel-kicker {
        color: #f59e0b !important;
    }

    #view-profile .app-panel-head .bg-brand-blue {
        margin-top: 1.6rem !important;
        padding: 0 !important;
        background: transparent !important;
        border-radius: 0 !important;
        box-shadow: none !important;
    }

    #view-profile .app-panel-head .absolute {
        display: none !important;
    }

    #view-profile .app-panel-head .flex.items-center.gap-4 {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 1.25rem !important;
        text-align: center !important;
    }

    #view-profile .app-panel-head .w-16 {
        width: 5.6rem !important;
        height: 5.6rem !important;
        background: rgba(255, 255, 255, 0.12) !important;
        border-color: rgba(255, 255, 255, 0.28) !important;
        font-size: 2.1rem !important;
    }

    #view-profile .app-panel-head .w-16 + div {
        width: 100%;
        text-align: center !important;
    }

    #view-profile #profile-name {
        font-family: Oswald, sans-serif;
        font-size: clamp(1.75rem, 2.25vw, 2.35rem) !important;
        line-height: 1 !important;
        text-transform: uppercase;
        margin-top: 0.15rem;
        text-align: center !important;
    }

    #view-profile #profile-status {
        background: rgba(245, 158, 11, 0.14) !important;
        border: 1px solid rgba(245, 158, 11, 0.28);
        color: #fbbf24 !important;
        margin-top: 0.85rem !important;
        padding: 0.45rem 0.75rem !important;
        min-width: 10.5rem;
        text-align: center;
        margin-left: auto !important;
        margin-right: auto !important;
    }

    #view-profile .app-panel-surface {
        display: grid;
        gap: 1rem;
        padding: 0 !important;
        background: transparent !important;
    }

    #view-profile #profile-action-area,
    #view-profile #profile-upgrade-entry {
        margin: 0 !important;
    }

    #view-profile #profile-action-area > div {
        min-height: 5.2rem;
        border: 1px solid #e2e8f0 !important;
        border-left: 0 !important;
        border-radius: 1.2rem !important;
        padding: 1.15rem 1.25rem !important;
        box-shadow: 0 12px 28px rgba(15, 23, 42, 0.07);
    }

    #view-profile #profile-upgrade-entry .upgrade-highlight-card {
        width: 100%;
        min-height: 5.7rem;
        justify-content: stretch;
        border-radius: 1.2rem;
        margin: 0;
        padding: 1rem 1.1rem;
    }

    #view-profile #profile-upgrade-entry .upgrade-highlight-title {
        font-size: 1.05rem;
    }

    #view-profile #profile-upgrade-entry .upgrade-highlight-copy {
        max-width: none;
        font-size: 0.82rem;
    }

    #view-profile .app-panel-surface > h4 {
        margin: 0.15rem 0 -0.35rem !important;
        padding-left: 0 !important;
    }

    #view-profile .app-panel-surface > .bg-white {
        border: 1px solid #e2e8f0 !important;
        border-radius: 1.2rem !important;
        box-shadow: 0 12px 28px rgba(15, 23, 42, 0.06) !important;
    }

    #view-profile #btn-signout {
        margin-top: 0 !important;
    }

    #view-profile .app-panel-surface > .text-center {
        margin-top: 0.75rem !important;
        margin-bottom: 0 !important;
    }

    #quiz-screen {
        border-radius: 1.9rem;
        background: #ffffff;
        box-shadow: 0 24px 60px rgba(15, 23, 42, 0.12);
        padding: 2rem !important;
    }

    #question-text,
    #exam-q-text {
        font-size: clamp(1.6rem, 2.3vw, 2.3rem) !important;
    }

    #options-container,
    #exam-options {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        gap: 0.9rem;
    }

    #options-container button,
    #exam-options button {
        height: 4.35rem;
        min-height: 4.35rem;
        display: flex;
        align-items: center;
        margin: 0 !important;
        transition: transform 170ms ease, box-shadow 170ms ease, border-color 170ms ease, background-color 170ms ease;
        will-change: transform, box-shadow;
    }

    #options-container button > *,
    #exam-options button > * {
        margin-top: 0 !important;
        margin-bottom: 0 !important;
    }

    #options-container button:hover,
    #exam-options button:hover {
        transform: none;
        border-color: #bfdbfe !important;
        box-shadow: 0 14px 26px rgba(15, 23, 42, 0.12);
        background: #f8fafc;
    }

    #options-container button:active,
    #exam-options button:active {
        transform: translateY(-1px) scale(0.99);
    }

    #results-screen {
        display: grid;
        grid-template-columns: minmax(17rem, 0.78fr) minmax(0, 1.22fr);
        gap: 1.25rem;
        align-items: start;
    }

    #results-screen.hidden {
        display: none !important;
    }

    #results-screen .space-y-4 {
        grid-column: 1 / -1;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
    }

    #results-screen .space-y-4 > :not([hidden]) ~ :not([hidden]) {
        margin-top: 0 !important;
    }

    #result-dynamic-content {
        min-width: 0;
    }

    #results-screen.free-diagnostic-result {
        position: fixed !important;
        inset: 0 !important;
        z-index: 9990 !important;
        width: 100vw !important;
        max-width: none !important;
        min-height: 100vh !important;
        padding: clamp(1rem, 3vw, 2.4rem) !important;
        display: grid;
        grid-template-columns: minmax(18rem, 22rem) minmax(0, 39rem);
        grid-template-rows: minmax(0, auto) auto;
        gap: 0;
        place-content: center;
        align-items: stretch;
        border-radius: 0;
        overflow: auto;
        background: rgba(15, 23, 42, 0.72) !important;
        backdrop-filter: blur(14px);
        -webkit-backdrop-filter: blur(14px);
        box-shadow: none;
    }

    #results-screen.free-diagnostic-result.hidden {
        display: none !important;
    }

    body:has(#results-screen.free-diagnostic-result:not(.hidden)) #desktop-context-panel {
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
    }

    #results-screen.free-diagnostic-result .result-summary-card {
        grid-column: 1;
        grid-row: 1 / span 2;
        min-height: 100%;
        margin: 0 !important;
        border-radius: 1.6rem 0 0 1.6rem !important;
        display: flex;
        flex-direction: column;
        justify-content: center;
        padding: clamp(1.2rem, 2vw, 2rem) !important;
        box-shadow: 0 32px 80px rgba(0, 0, 0, 0.35) !important;
    }

    #results-screen.free-diagnostic-result .result-summary-card #result-header-bar {
        display: none;
    }

    #results-screen.free-diagnostic-result .result-report-title {
        font-size: clamp(1.75rem, 2.6vw, 2.45rem) !important;
        text-align: center;
        line-height: 1 !important;
        margin-top: 0 !important;
    }

    #results-screen.free-diagnostic-result #test-date {
        margin-left: auto;
        margin-right: auto;
    }

    #results-screen.free-diagnostic-result .result-summary-card .w-32 {
        width: clamp(7rem, 10vw, 8.5rem) !important;
        height: clamp(7rem, 10vw, 8.5rem) !important;
        margin-top: 0.9rem !important;
        margin-bottom: 0.9rem !important;
    }

    #results-screen.free-diagnostic-result #result-percent {
        font-size: clamp(1.8rem, 2.7vw, 2.55rem) !important;
        color: #ffffff !important;
    }

    #results-screen.free-diagnostic-result #badge-title {
        color: #cbd5e1 !important;
    }

    #results-screen.free-diagnostic-result #result-dynamic-content {
        display: flex;
        flex-direction: column;
        justify-content: stretch;
        gap: 0;
        background: #f8fafc;
        padding: clamp(1rem, 1.65vw, 1.35rem);
        border-radius: 0 1.6rem 0 0;
        box-shadow: 0 32px 80px rgba(0, 0, 0, 0.20);
    }

    #results-screen.free-diagnostic-result .free-result-report {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(9.5rem, 0.46fr);
        gap: 0.85rem;
        align-items: stretch;
        order: 0;
        height: 100%;
    }

    #results-screen.free-diagnostic-result .free-result-main,
    #results-screen.free-diagnostic-result .free-result-stats {
        margin: 0 !important;
    }

    #results-screen.free-diagnostic-result .free-result-main {
        padding: clamp(1rem, 1.55vw, 1.35rem);
    }

    #results-screen.free-diagnostic-result .free-result-main h3 {
        font-size: clamp(1.18rem, 1.55vw, 1.5rem);
        max-width: 17rem;
    }

    #results-screen.free-diagnostic-result .free-result-copy {
        font-size: 0.86rem;
        line-height: 1.38;
        max-width: 25rem;
    }

    #results-screen.free-diagnostic-result .free-result-stats {
        grid-template-columns: 1fr;
        padding: 0;
        background: transparent;
        border: 0;
        box-shadow: none;
    }

    #results-screen.free-diagnostic-result .free-result-stat {
        min-height: 5.9rem;
        box-shadow: 0 12px 26px rgba(15, 23, 42, 0.06);
    }

    #results-screen.free-diagnostic-result .free-result-focus-grid {
        gap: 0.55rem;
        margin-top: 0.7rem;
    }

    #results-screen.free-diagnostic-result .free-result-focus-card {
        padding: 0.72rem;
    }

    #results-screen.free-diagnostic-result .free-result-next-step {
        margin-top: 0.65rem;
        padding: 0.78rem;
    }

    #results-screen.free-diagnostic-result .free-result-next-step p {
        font-size: 0.82rem;
        line-height: 1.36;
        margin-top: 0.35rem;
    }

    #results-screen.free-diagnostic-result .result-premium-includes {
        margin-top: 0.75rem;
        padding: 0.82rem;
        border-radius: 1rem;
    }

    #results-screen.free-diagnostic-result .result-premium-includes ul {
        gap: 0.36rem;
        margin-top: 0.52rem;
        font-size: 0.68rem;
    }

    #results-screen.free-diagnostic-result .result-premium-trust {
        margin-top: 0.6rem;
        padding-top: 0.55rem;
        font-size: 0.62rem;
        gap: 0.35rem 0.55rem;
    }

    #results-screen.free-diagnostic-result #result-dynamic-content > h4,
    #results-screen.free-diagnostic-result #result-dynamic-content > .space-y-3,
    #results-screen.free-diagnostic-result #result-dynamic-content > .bg-blue-50 {
        display: none !important;
    }

    #results-screen.free-diagnostic-result .space-y-4 {
        grid-column: 2;
        grid-row: 2;
        display: grid;
        grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
        gap: 1rem;
        background: #f8fafc;
        border-radius: 0 0 1.6rem 0;
        padding: 0 clamp(1rem, 1.65vw, 1.35rem) clamp(1rem, 1.65vw, 1.35rem);
        margin-top: 0 !important;
        box-shadow: 0 32px 80px rgba(0, 0, 0, 0.20);
    }

    #results-screen.free-diagnostic-result .space-y-4 button {
        min-height: 3.6rem;
        border-radius: 0.95rem !important;
        transform: translateY(0);
        transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;
    }

    #results-screen.free-diagnostic-result .space-y-4 button:hover {
        transform: translateY(-2px);
    }

    #results-screen.free-diagnostic-result #btn-result-retry {
        background: linear-gradient(135deg, #f97316, #fb923c) !important;
        color: #ffffff !important;
        border-bottom-color: #ea580c !important;
        box-shadow: 0 18px 34px rgba(249, 115, 22, 0.35) !important;
    }

    #results-screen.free-diagnostic-result .space-y-4 button:not(#btn-result-retry) {
        background: #ffffff !important;
        border: 1px solid #d9e2ef !important;
        color: #64748b !important;
        box-shadow: 0 12px 28px rgba(15, 23, 42, 0.10) !important;
    }

    #results-screen.free-diagnostic-result .space-y-4 button:not(#btn-result-retry):hover {
        color: #0f172a !important;
        border-color: #bfdbfe !important;
        box-shadow: 0 16px 34px rgba(15, 23, 42, 0.14) !important;
    }

    #auth-modal > .bg-white,
    #global-modal > .bg-white,
    #stats-modal > .bg-white {
        max-width: 28rem !important;
    }
}

@media (min-width: 1440px) and (hover: hover) and (pointer: fine) {
    #options-container,
    #exam-options {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        column-gap: 1.15rem;
        row-gap: 1.15rem;
    }
}
