/**
 * Responsive Styles
 *
 * Three-tier responsive layout:
 *   - ≤1200px: Content stacks (single-column layouts), sidebar still visible
 *   - ≤900px:  Sidebar collapses to hamburger drawer, mobile header appears
 *   - ≤480px:  Phone refinements (tighter padding, single-column cards)
 *
 * Loaded LAST to override desktop styles without modifying them.
 * Organized by section matching the desktop CSS files.
 */

/* =============================================================================
   Wide Tablet Breakpoint (≤1340px)
   Layouts that are too wide to fit beside the sidebar at ~1200-1340px widths
   need to stack earlier than the main tablet breakpoint kicks in.
   ============================================================================= */

@media (max-width: 1340px) {

    /* Stack the score report above the metadata pills so neither overflows
       the card once the viewport drops below the desktop layout threshold. */
    .quiz-score-header {
        flex-direction: column;
        align-items: stretch;
        gap: 24px;
        padding: 24px 20px;
    }

    .quiz-score-report {
        justify-content: center;
        gap: 30px;
        flex-shrink: 1;
        flex-wrap: wrap;
    }

    .quiz-metadata-pills {
        grid-template-columns: repeat(3, 1fr);
        max-width: none;
        width: 100%;
    }

    /* New dashboard's chart (dashboard-v2.css): the bars are narrower here, so
       there is less room between the first bar and the card's edge for its
       rotated name. */
    .dash-first-screen .dash-chart-card {
        --dash-label-width: 104px;
    }

}

/* =============================================================================
   Tablet Content Breakpoint (≤1200px)
   Sidebar remains visible; content layouts switch to single-column stacking.
   ============================================================================= */

@media (max-width: 1200px) {

    /* -------------------------------------------------------------------------
       Main Content Layout
       ------------------------------------------------------------------------- */

    .main-content {
        overflow-x: hidden;
    }

    /* -------------------------------------------------------------------------
       Page Headers
       ------------------------------------------------------------------------- */

    .page-title {
        font-size: 24px;
        line-height: 32px;
    }

    /* -------------------------------------------------------------------------
       Modals
       ------------------------------------------------------------------------- */

    .modal-content {
        padding: 24px 20px;
        margin: 10px;
        max-height: 90vh;
        overflow-y: auto;
    }

    .modal-title {
        font-size: 24px;
        line-height: 32px;
    }

    .modal-buttons {
        /* column-reverse: templates place secondary first, primary second in the DOM;
           on mobile we want the primary action on top (closest to thumb). */
        flex-direction: column-reverse;
        gap: 8px;
    }

    .modal-btn {
        width: 100%;
    }

    .modal-btn-secondary {
        padding: 0 24px;
    }

    /* Quiz builder modal */
    .quiz-builder-modal {
        max-width: 100%;
        margin: 10px;
        padding: 24px 16px;
    }

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

    .category-content {
        flex-direction: column;
    }

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

    .topic-list {
        grid-template-columns: 1fr;
        padding-left: 20px;
    }

    .settings-row {
        flex-direction: column;
    }

    .question-types-row {
        flex-direction: column;
        gap: 16px;
    }

    .auto-quiz-buttons {
        flex-direction: column;
    }

    .preset-btn {
        width: 100%;
    }

    /* Case study complete modal */
    .case-study-complete-modal {
        padding: 30px 20px;
    }

    /* Navigation panel */
    .nav-panel-container {
        max-width: 100%;
        left: 0;
        right: 0;
        transform: none;
        padding: 0 10px;
    }

    .nav-panel-grid {
        grid-template-columns: repeat(10, 1fr);
        gap: 4px;
    }

    .nav-question-btn {
        width: 100%;
        height: 28px;
    }

    .nav-question-btn.current {
        width: 100%;
        height: 31px;
    }

    /* -------------------------------------------------------------------------
       History Rows
       ------------------------------------------------------------------------- */

    .history-row {
        flex-direction: column;
        align-items: flex-start;
        padding: 16px 20px;
        gap: 12px;
    }

    .history-info {
        margin-left: 0;
    }

    .history-title-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .history-meta {
        flex-wrap: wrap;
        gap: 12px;
    }

    .history-actions {
        width: 100%;
        flex-direction: row;
    }

    .history-btn {
        flex: 1;
        min-width: 0;
    }

    /* -------------------------------------------------------------------------
       Pagination
       ------------------------------------------------------------------------- */

    .pagination-footer {
        flex-wrap: wrap;
        gap: 12px;
    }

    .pagination-total {
        order: 1;
        flex: 1 1 100%;
    }

    .pagination-pages {
        order: 2;
        flex: 1 1 100%;
    }

    .pagination-per-page {
        order: 3;
        flex: 1 1 100%;
        justify-content: center;
    }

    /* -------------------------------------------------------------------------
       Dashboard
       ------------------------------------------------------------------------- */

    .dash-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .dash-profile-photo {
        width: 60px;
        height: 60px;
    }

    .dash-greeting {
        font-size: 20px;
        line-height: 24px;
    }

    .dash-cards-row {
        flex-wrap: wrap;
    }

    .dash-cards-row .perf-card {
        flex: 1 1 calc(50% - 8px);
        min-width: 140px;
    }

    .dash-cards-row .history-readiness-badge {
        max-width: 100%;
        width: auto;
        box-sizing: border-box;
    }

    /* The current dashboard's row. These two do nothing (the row is a grid, so
       flex-direction is ignored, and it stays two columns at every width); they
       go with that layout when FEATURE_DASHBOARD_V2 is retired. */
    .dash-columns {
        flex-direction: column;
    }

    .dash-col-left {
        width: 100%;
        flex-shrink: 1;
    }

    /* The new dashboard (dashboard_v2.html). Everything below is scoped under
       .dash-first-screen or .dash-dose-row, which only that page has, so none of
       it reaches the current layout.

       Main row: one column in source order (Learning in Progress, Performance
       Overview, Focus Areas), and no stretching to the sidebar's height. */
    .dash-first-screen {
        min-height: 0;
    }

    .dash-first-screen > .dash-columns {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: auto;
        grid-template-areas:
            "progress"
            "chart"
            "focus";
    }

    /* With no row height to fill, the quiz list is capped as it is on the current
       page, tall enough to show a whole tile with its button. */
    .dash-first-screen .dash-quiz-scroll.has-multiple {
        flex: 0 1 auto;
        min-height: 0;
        max-height: 250px;
    }

    /* The chart is as tall as it needs, with a fixed-height plot. Names hang
       outside the plot, so the card must not clip them (.perf-chart-card scrolls
       sideways at this width for the Performance page's fixed-width bars). */
    .dash-first-screen .perf-chart-card.dash-chart-card {
        min-height: 0;
        overflow-x: visible;
    }

    .dash-first-screen .dash-chart-card .perf-chart-container {
        flex: none;
        height: 260px;
    }

    /* Daily Dose: content beside the type-specific section, "Why it matters"
       across the full width beneath. */
    .dash-dose-row .dd-body {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }

    .dash-dose-row .dd-why {
        grid-column: 1 / -1;
        border-left: 0;
        border-top: 0.5px solid var(--color-dd-divider);
    }

    /* Dashboard tooltips: show on click via Alpine class */
    .dash-tooltip.dash-tooltip-visible {
        opacity: 1;
        pointer-events: auto;
    }

    /* Override left/right positioning for mobile - show below the trigger */
    .dash-tooltip.left,
    .dash-tooltip.right {
        left: 50%;
        right: auto;
        top: calc(100% + 10px);
        transform: translateX(-50%);
    }

    .dash-tooltip.left::before,
    .dash-tooltip.right::before {
        left: 50%;
        right: auto;
        top: auto;
        bottom: 100%;
        transform: translateX(-50%);
        border-color: transparent;
        border-bottom-color: var(--color-dark-grey);
    }

    /* -------------------------------------------------------------------------
       Exam Simulations
       ------------------------------------------------------------------------- */

    .cards-row {
        flex-direction: column;
    }

    .assessment-card.baseline {
        width: 100%;
        height: auto;
        gap: 16px;
    }

    .assessment-card.readiness {
        width: 100%;
    }

    .readiness-exams-grid {
        flex-direction: column;
        gap: 24px;
    }

    .readiness-exam-section {
        width: 100%;
    }

    /* Hide vertical divider between exam sections */
    .readiness-exam-section:first-child::after {
        display: none;
    }

    .exam-description {
        width: 100%;
    }

    .history-empty {
        height: auto;
        padding: 40px 20px;
    }

    /* -------------------------------------------------------------------------
       Exam Simulations: the five-exam page (static/css/exam-simulations.css)
       ------------------------------------------------------------------------- */

    /* The next step stacks above the Score Trend */
    .exam-sim-top {
        grid-template-columns: minmax(0, 1fr);
    }

    .exam-sim-features {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 16px 24px;
    }

    /* A row becomes two lines: the title and its action, then the score and status under the title */
    .exam-sim-row {
        grid-template-columns: 32px minmax(0, 1fr) auto;
        grid-template-areas:
            "marker main actions"
            ". result result";
        column-gap: 16px;
        padding: 16px 20px;
    }

    .exam-sim-marker { grid-area: marker; }
    .exam-sim-row-main { grid-area: main; }
    .exam-sim-row-actions { grid-area: actions; }

    /* Only a row with a score has this element, so the others stay one line (a margin, not a row gap,
       which an empty second line would still take up) */
    .exam-sim-row-result {
        grid-area: result;
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 8px 12px;
        margin-top: 8px;
    }

    .exam-sim-row-heading {
        flex-wrap: wrap;
        gap: 2px 10px;
    }

    /* -------------------------------------------------------------------------
       Quiz Builder
       ------------------------------------------------------------------------- */

    .quiz-builder-card {
        flex-direction: column;
        padding: 20px;
        gap: 20px;
    }

    .quiz-builder-divider {
        width: 100%;
        height: 1px;
    }

    .quiz-builder-right {
        padding: 0;
    }

    .quiz-row {
        flex-wrap: wrap;
        gap: 12px;
    }

    .quiz-info {
        flex: 1 1 100%;
        width: 100%;
    }

    .quiz-info .history-exam-name {
        max-width: none;
    }

    .quiz-tags-container {
        margin-left: 0;
        margin-right: 0;
        flex: 1 1 100%;
    }

    .quiz-actions {
        margin-left: 0;
        min-width: 0;
        flex: 1 1 100%;
    }

    .quiz-actions .history-actions {
        flex-direction: row;
        width: 100%;
    }

    .quiz-actions .history-actions .history-btn {
        flex: 1;
        min-width: 0;
    }

    /* Completed quiz: View Report + Review Quiz side by side, full width */
    .quiz-completed-actions {
        display: flex;
        flex-direction: row;
        gap: 8px;
        width: 100%;
    }

    .quiz-completed-actions .history-btn {
        flex: 1;
        min-width: 0;
    }

    /* Tags tooltip - position below instead of left */
    .quiz-tags-tooltip {
        left: 0;
        transform: none;
        width: 100%;
        max-width: 296px;
    }

    /* -------------------------------------------------------------------------
       Assessment Session
       ------------------------------------------------------------------------- */

    .assessment-container {
        height: auto !important;
        min-height: 100vh !important;
        overflow-y: auto !important;
    }

    html, body {
        overflow: auto !important;
    }

    .assessment-main {
        grid-template-columns: 1fr !important;
        grid-template-rows: auto auto !important;
        grid-template-areas: "left" "right" !important;
        padding: 0 !important;
        gap: 8px !important;
        flex: none !important;
        overflow: visible !important;
    }

    .exhibit-panel {
        padding: 15px !important;
        max-height: none !important;
        overflow-y: visible !important;
        border-right: none !important;
    }

    .question-panel {
        padding: 15px !important;
        overflow-y: visible !important;
        border-right: none !important;
        box-shadow: none !important;
        border-radius: 0 !important;
    }

    /* Prevent wide content (matrices, tables) from overflowing viewport */
    .exhibit-panel,
    .question-panel {
        overflow-x: auto !important;
        max-width: 100vw !important;
    }

    /* Remove Learnosity/Bootstrap internal padding inside question panel so
       content aligns with the exhibit panel (both use panel's 15px padding only) */
    .question-panel .lrn-assess-content {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    .question-panel .lrn-assess-content .row {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    .question-panel .lrn-assess-content .col-xs-12 {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    /* Stimulus: tighten right padding on narrow screens */
    .exhibit-panel .lrn_stimulus,
    .exhibit-panel .lrn-stimulus,
    .question-panel .lrn_stimulus,
    .question-panel .lrn-stimulus,
    #learnosity-assess .lrn_stimulus,
    #learnosity-assess .lrn-stimulus,
    #learnosity-items .lrn_stimulus,
    #learnosity-items .lrn-stimulus {
        padding-right: 10px !important;
    }

    .progress-section {
        width: 100% !important;
    }

    .assessment-header {
        flex-wrap: wrap !important;
        padding: 8px 12px !important;
        gap: 8px !important;
    }

    .header-center {
        gap: 16px !important;
        flex-wrap: wrap !important;
        width: 100% !important;
        order: 3 !important;
    }

    /* Readiness header: compact for narrow screens */
    .readiness-header {
        flex-wrap: wrap !important;
        padding: 8px 12px !important;
        gap: 4px 12px !important;
    }

    .readiness-header-username {
        display: none !important;
    }

    .readiness-header-title {
        font-size: 14px !important;
    }

    .readiness-header-center {
        font-size: 13px !important;
    }

    .readiness-header-right {
        width: 100% !important;
        flex-direction: row !important;
        justify-content: space-between !important;
        gap: 12px !important;
        align-items: center !important;
    }

    .readiness-header-timer,
    .readiness-header-question {
        font-size: 13px !important;
    }

    /* -------------------------------------------------------------------------
       Results
       ------------------------------------------------------------------------- */

    .results-top-row {
        flex-direction: column;
    }

    .results-title-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .results-actions {
        width: 100%;
        flex-wrap: wrap;
        gap: 8px;
    }

    .results-actions .btn-primary,
    .results-actions .btn-secondary {
        flex: 1;
        min-width: 0;
        text-align: center;
    }

    .quiz-metadata-pills {
        grid-template-columns: repeat(2, 1fr);
        max-width: none;
        width: 100%;
    }

    .score-report-card {
        padding: 20px;
    }

    /* Performance controls: wrap legend + toggle on narrow screens */
    .performance-controls {
        flex-wrap: wrap;
        gap: 12px;
    }

    /* Questions table: horizontal scroll when columns exceed viewport */
    .subject-questions-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .report-questions-table {
        min-width: 700px;
    }

    /* -------------------------------------------------------------------------
       Performance
       ------------------------------------------------------------------------- */

    .perf-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .perf-cards-row {
        flex-wrap: wrap;
    }

    .perf-cards-row .perf-card {
        flex: 1 1 calc(50% - 8px);
        min-width: 140px;
    }

    /* Badge overflow fix — same pattern as dashboard */
    .perf-card .history-readiness-badge {
        width: auto;
        max-width: 100%;
        box-sizing: border-box;
    }

    .perf-polar-chart {
        flex-direction: column;
        align-items: center;
        padding-right: 0;
    }

    /* Move threshold legend above the polar chart (it's absolutely positioned at left:428px on desktop) */
    .perf-polar-svg-wrap .perf-threshold-legend {
        position: static;
        align-self: center;
        margin-bottom: 8px;
    }

    .perf-polar-svg-wrap {
        display: flex;
        flex-direction: column;
        align-items: center;
        width: 100%;
    }

    /* Scale down polar SVG to fit mobile viewport */
    .perf-polar-svg {
        width: 100%;
        max-width: 435px;
        height: auto;
    }

    .perf-polar-legend {
        flex-direction: column;
        margin-left: 0;
        width: 100%;
        gap: 8px;
    }

    /* Area chart — use fixed height so chart fills the card instead of shrinking with aspect ratio */
    .perf-area-svg {
        width: auto;
        height: 360px;
    }

    .perf-chart-card {
        overflow-x: auto;
    }

    .perf-section .category-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Performance tooltips: show on click via Alpine class */
    .perf-info-tooltip.perf-info-tooltip-visible {
        opacity: 1;
        pointer-events: auto;
    }

    /* Override right positioning for mobile - show below the trigger */
    .perf-info-tooltip.right {
        left: 50%;
        right: auto;
        top: calc(100% + 10px);
        transform: translateX(-50%);
    }

    .perf-info-tooltip.right::before {
        left: 50%;
        right: auto;
        top: auto;
        bottom: 100%;
        transform: translateX(-50%);
        border-color: transparent;
        border-bottom-color: var(--color-dark-grey);
    }

    /* -------------------------------------------------------------------------
       Settings Page
       ------------------------------------------------------------------------- */

    .settings-sidebar {
        display: none;
    }

    .settings-content {
        position: static;
        transform: none;
        width: 100%;
        padding: 80px 16px 40px;
        box-sizing: border-box;
    }

    .settings-header {
        height: auto;
        min-height: 56px;
        flex-wrap: wrap;
        padding: 12px 16px;
        gap: 8px;
    }

    .settings-back {
        position: static;
    }

    .settings-title {
        position: static;
        font-size: 20px;
        line-height: 28px;
    }

    .settings-input {
        width: 100%;
    }

    .settings-photo-section {
        flex-direction: column;
        height: auto;
        gap: 16px;
    }

    .setting-card-inner {
        flex-direction: column;
    }

    .setting-card-header {
        height: auto;
    }
}

/* =============================================================================
   Mobile Breakpoint (≤900px)
   Sidebar collapses to hamburger drawer; mobile header appears.
   ============================================================================= */

@media (max-width: 900px) {

    /* -------------------------------------------------------------------------
       Mobile Header (hamburger bar)
       ------------------------------------------------------------------------- */

    .mobile-header {
        display: flex;
        align-items: center;
        gap: 12px;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 56px;
        padding: 0 16px;
        background: var(--color-dark-grey);
        z-index: 150;
    }

    .mobile-header-burger {
        background: none;
        border: none;
        color: white;
        cursor: pointer;
        padding: 8px;
        margin: -8px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .mobile-header-burger svg {
        width: 24px;
        height: 24px;
    }

    .mobile-header-logo {
        display: flex;
        align-items: center;
        gap: 8px;
        text-decoration: none;
    }

    .mobile-header-logo svg {
        width: 32px;
        height: 32px;
    }

    .mobile-header-logo-text {
        font-family: 'Public Sans', sans-serif;
        font-weight: 700;
        font-size: 14px;
        color: white;
        line-height: 1;
    }

    .mobile-header-logo-text span {
        display: block;
        font-weight: 500;
        font-size: 12px;
    }

    /* -------------------------------------------------------------------------
       Sidebar → Drawer
       ------------------------------------------------------------------------- */

    .sidebar {
        transform: translateX(-110%);
        transition: transform 0.3s ease;
        z-index: 200;
        margin: 0;
        border-radius: 0 20px 20px 0;
        height: 100vh;
        width: 260px;
    }

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

    .sidebar-bottom-row {
        width: 100%;
    }

    .sidebar-bottom-row > * {
        flex: 1 1 0;
        min-width: 0;
    }

    .sidebar-bottom-btn {
        width: 100%;
    }

    .sidebar-close-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        position: absolute;
        top: 12px;
        right: 12px;
        width: 32px;
        height: 32px;
        background: rgba(255, 255, 255, 0.1);
        border: none;
        border-radius: 8px;
        color: white;
        cursor: pointer;
    }

    .sidebar-close-btn:hover {
        background: rgba(255, 255, 255, 0.2);
    }

    .sidebar-close-btn svg {
        width: 14px;
        height: 14px;
    }

    /* Sidebar overlay/backdrop */
    .sidebar-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 199;
    }

    /* -------------------------------------------------------------------------
       Main Content Layout (with mobile header)
       ------------------------------------------------------------------------- */

    .main-content {
        margin-left: 0;
        padding: 72px 16px 16px 16px;
    }
}

/* =============================================================================
   Narrow Content Breakpoint (≤640px)
   The new dashboard's Daily Dose card (.dash-dose-row) is too narrow for
   sections side by side.
   ============================================================================= */

@media (max-width: 640px) {

    /* Sections stack: content, type-specific section, "Why it matters". */
    .dash-dose-row .dd-body,
    .dash-dose-row .dd-cat-rule .dd-body {
        grid-template-columns: minmax(0, 1fr);
    }

    /* The title and the subject tag no longer fit on one line, so the tag wraps
       under the title instead of running out of the card. */
    .dash-dose-row .dd-header {
        flex-wrap: wrap;
        height: auto;
        padding: 12px 16px;
    }

}

/* =============================================================================
   Phone Breakpoint (≤480px)
   ============================================================================= */

@media (max-width: 480px) {

    /* Main content - tighter padding */
    .main-content {
        padding: 64px 12px 12px 12px;
    }

    /* Modals - tighter padding */
    .modal-content {
        padding: 20px 16px;
        margin: 8px;
    }

    /* Page title */
    .page-title {
        font-size: 20px;
        line-height: 28px;
    }

    /* History - single column actions (except quiz builder which stays row) */
    .history-actions {
        flex-direction: column;
    }

    .quiz-actions.history-actions {
        flex-direction: row;
    }

    /* Dashboard cards - single column */
    .dash-cards-row .perf-card {
        flex: 1 1 100%;
    }

    /* New dashboard's chart: nine bars in a phone's width. Tighter gaps and axis,
       smaller type, and each name on one line at a steeper angle so neighbours
       do not collide and the longest still clears the card's edge. A name longer
       than --dash-label-width is cut with an ellipsis (the chart's aria-label
       has it in full). */
    .dash-first-screen .perf-chart-card.dash-chart-card {
        --dash-bar-gap: 6px;
        --dash-axis-width: 36px;
        --dash-label-width: 140px;
        padding: 16px;
    }

    .dash-first-screen .dash-chart-card .perf-chart-labels-area {
        min-height: 144px;
    }

    .dash-first-screen .dash-chart-card .perf-chart-y-axis span,
    .dash-first-screen .dash-chart-card .perf-chart-bar-value {
        font-size: 11px;
        line-height: 14px;
    }

    .dash-first-screen .dash-chart-card .perf-chart-bar-value {
        padding: 0;
    }

    .dash-first-screen .dash-chart-card .perf-chart-bar-label {
        display: block;
        font-size: 11px;
        line-height: 14px;
        white-space: nowrap;
        text-overflow: ellipsis;
        transform: rotate(-65deg);
    }

    .dash-first-screen .dash-chart-card .perf-chart-legend {
        gap: 8px 24px;
    }

    /* Quiz builder CTA */
    .auto-quiz-buttons {
        gap: 8px;
    }

    .quiz-stats {
        flex-wrap: wrap;
        gap: 12px;
    }

    /* Results - single column metadata */
    .quiz-metadata-pills {
        grid-template-columns: 1fr;
    }

    /* Performance cards - single column */
    .perf-cards-row .perf-card {
        flex: 1 1 100%;
    }

    /* Exam Simulations: the five-exam page */
    .exam-sim {
        gap: 20px;
    }

    .exam-sim-card {
        padding: 22px 18px;
    }

    .exam-sim-status {
        padding: 24px 20px;
    }

    .exam-sim-status-label {
        font-size: 28px;
    }

    .exam-sim-step-title {
        font-size: 20px;
    }

    .exam-sim-cta {
        align-self: stretch;
    }

    /* The legend drops under the card's title instead of squeezing beside it */
    .exam-sim-trend-head {
        flex-wrap: wrap;
        gap: 4px 16px;
    }

    /* Six slots across a phone: narrower gaps, a smaller score, and "#1" for "Exam #1" */
    .exam-sim-bars,
    .exam-sim-bar-labels {
        gap: 8px;
    }

    .exam-sim-bar-value {
        padding: 1px 5px;
        font-size: 11px;
    }

    .exam-sim-bar-label-full {
        display: none;
    }

    .exam-sim-bar-label-short {
        display: inline;
    }

    .exam-sim-section-head {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }

    .exam-sim-features {
        grid-template-columns: minmax(0, 1fr);
        gap: 12px;
        padding: 16px;
    }

    .exam-sim-row {
        column-gap: 12px;
        padding: 14px 16px;
    }
}

/* =============================================================================
   Desktop: hide mobile-only elements (sidebar visible above 900px)
   ============================================================================= */

@media (min-width: 901px) {
    .mobile-header {
        display: none;
    }

    .sidebar-close-btn {
        display: none;
    }

    .sidebar-overlay {
        display: none;
    }
}
