/* Exam, Saved and Feedback reproduce the existing 75% browser reference.
 * All measurements are actual CSS values. Fluid viewport coefficients stay
 * fluid; no root sizing or shell/sidebar changes are involved. */
@media (min-width: 1080px) and (max-width: 1599px) {
  #app[data-learner-density] {
    --spacing-xs: 3px;
    --spacing-sm: 6px;
    --spacing-md: clamp(9px, 7.2px + 0.35vw, 12px);
    --spacing-lg: clamp(12px, 9px + 0.75vw, 18px);
    --spacing-xl: clamp(15px, 12px + 1vw, 24px);
    --spacing-2xl: clamp(21px, 15px + 1.5vw, 36px);
    --radius-sm: 7.5px;
    --radius-md: 13.5px;
    --radius-lg: 21px;
    font-size: 12px;

    .container { max-width: min(96vw, 1272px); }
    .page-header { margin-bottom: calc(var(--spacing-xl) + 3px); }
    .page-header-row { gap: 9px; }
    h1 { font-size: clamp(26.4px, 4vw, 46.8px); }
    h2 { font-size: clamp(18.6px, 2.4vw, 28.2px); }
    h3 { font-size: 14.04px; }
    h4 { font-size: 12px; }
    .text-sm { font-size: 10.2px; }
    .btn { font-size: 11.04px; padding: 8.25px 12px; min-height: 31.5px; gap: 6px; }
    .btn-sm { font-size: 10.2px; padding: 3px var(--spacing-md); min-height: 24px; }
    .btn-lg { font-size: 12.6px; padding: var(--spacing-md) var(--spacing-xl); }
    input, textarea, select { font-size: 12px; min-width: 0; min-height: 24px; }
    .filter-pills { gap: 6px; }
    .filter-pill { font-size: 10.2px; padding: 3px 12px; min-height: 24px; }
    .badge { font-size: 9px; padding: 2.25px 6px; }
    .chip-yield { font-size: 8.4px; padding: 1.5px 4.5px; white-space: nowrap; }
    .card { padding: var(--spacing-lg); }
    .empty-state { padding: 36px 18px; }
    .empty-state h3 { margin-bottom: 9px; }
    .spinner { width: 24px; height: 24px; }
    .progress-bar { height: 6px; }
    .manage-tabs { gap: 1.5px; }
    .manage-tab { font-size: 10.8px; padding: 6px 18px; min-height: 27.75px; }

    /* Setup retains its taxonomy order and three columns next to the rail. */
    .exam-shell-header { gap: var(--spacing-lg); }
    .exam-shell-header__kicker { font-size: 8.64px; margin-bottom: 7.5px; }
    .exam-shell-header .text-muted { font-size: 10.2px; }
    .dash-toggle { padding: 2.25px; gap: 3px; border-radius: 7.5px; }
    .dash-toggle .filter-pill { padding: 4.5px 10.5px; font-size: 9.6px; gap: 3px; border-radius: 6px; }
    .exam-setup-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .exam-setup-summary__item { padding: 7.5px 9px; border-radius: 9px; }
    .exam-setup-summary__item span { font-size: 8.64px; }
    .exam-setup-summary__item strong { font-size: 13.8px; margin: 3px 0 1.5px; }
    .setup-grid { grid-template-columns: minmax(0, 1fr) clamp(168px, 18vw, 204px); gap: var(--spacing-lg); }
    .category-cards-grid { columns: 3; column-gap: var(--spacing-md); }
    .category-card-header { padding: var(--spacing-md) var(--spacing-lg); gap: var(--spacing-md); min-height: 54px; }
    .category-card-title { font-size: 12px; }
    .category-card-count { font-size: 9.6px; margin-top: 1.5px; }
    .category-card-icon svg { width: 24px; height: 24px; }
    .category-chevron { width: 15px; height: 15px; }
    .topic-row:not(tr) { padding: 6px var(--spacing-lg); gap: 6px; min-height: 29px; }
    .topic-row-name { font-size: 10.56px; }
    .topic-row-count { font-size: 9.36px; min-width: 21px; }
    .setup-config-panel { padding: var(--spacing-md); gap: var(--spacing-md); max-height: calc(100dvh - 24px); }
    .setup-config-panel h3 { font-size: 11.76px; }
    .setup-config-panel .config-label { font-size: 9.12px; }
    .setup-config-panel .filter-pills { gap: 3px; }
    .question-limit input[type="number"] { width: 48px; font-size: 10.8px; }
    .question-limit input[type="range"] { min-height: 24px; width: 0; flex: 1; margin: 0; background-size: 100% 4.5px !important; background-repeat: no-repeat !important; background-position: center !important; }
    #q-count { width: 75px !important; }
    .selected-count-title { font-size: 8.16px; }
    .selected-count-number { font-size: 15.6px; }
    .selected-count-label { font-size: 8.4px; }
    #exam-order-pills svg { width: 10.5px !important; height: 10.5px !important; }

    /* Active Exam and its shared question presenters, results and review. */
    .question-stem { font-size: 12px; }
    .question-header { margin-bottom: var(--spacing-md); }
    .question-actions { margin-top: var(--spacing-lg); }
    .option-btn { font-size: 11.4px; border-width: 1.5px; min-height: 36px; }
    .option-btn .option-letter { font-size: 10.2px; min-width: 21px; height: 21px; }
    .case-vignette { font-size: 11.4px; }
    .case-indicator { font-size: 9.6px; }
    .lab-table { font-size: 10.56px; }
    .lab-table-title { font-size: 10.8px; }
    .lab-table th { font-size: 9.84px; }
    .lab-table td, .lab-table th { padding: 4.5px 9px; }
    .flag-btn { font-size: 10.2px; min-height: 24px; padding: 3.75px 7.5px; }
    .flag-btn svg { width: 12px !important; height: 12px !important; }
    #exam-calculator-btn, #pause-timer-btn { padding: 3px 7.5px !important; min-height: 24px; }
    #submit-early-btn { padding: 4.5px 10.5px !important; }
    .feedback-body, .feedback-header, .feedback-explanation { font-size: 12px; }
    .score-summary { padding: 24px; }
    .big-score { font-size: 42px; }
    .score-label { font-size: 13.2px; }
    .score-message { font-size: 12px; }
    .analytics-table { font-size: 10.2px; }
    .analytics-table th, .analytics-table td { padding: 6.75px 9px; }

    /* Saved Questions: the available content width stays useful at laptops. */
    .saved-page { max-width: min(96vw, 1272px); }
    .saved-title { margin: var(--spacing-sm) 0 3px; }
    .saved-subtitle { font-size: 10.8px; }
    .saved-toolbar-row--meta { font-size: 10.2px; }
    .saved-search-wrap { flex-basis: 195px; min-width: 165px; }
    .saved-search-icon { left: 9px; width: 12px; height: 12px; }
    .saved-search-input { padding: 7.5px 9px 7.5px 27px; font-size: 10.8px; }
    .saved-select { padding: 7.5px 9px; font-size: 10.8px; }
    .saved-bulk-actions { gap: 4.5px; }
    .saved-list { gap: 6px; }
    .saved-row { grid-template-columns: 24px minmax(0, 1fr) 24px; }
    .saved-row-check { width: 24px; height: 24px; }
    .saved-row-checkbox { width: 24px; height: 24px; border: none; background: none; }
    .saved-row-checkbox::before { content: ''; position: absolute; width: 12px; height: 12px; inset: 6px; border: 1px solid var(--border); border-radius: 2.25px; background: var(--bg-card); }
    .saved-row-checkbox:checked { background: none; }
    .saved-row-checkbox:checked::before { background: var(--accent); border-color: var(--accent); }
    .saved-row-checkbox:checked::after { left: 10px; top: 7px; width: 3px; height: 7px; }
    .saved-row-open { min-height: 24px; }
    .saved-row-head { gap: 6px; margin-bottom: 3px; }
    .saved-row-topic { font-size: 8.64px; padding: 1.5px 6px; }
    .saved-row-lane, .saved-row-date { font-size: 9px; }
    .saved-row-stem { font-size: 10.8px; }
    .saved-row-remove { font-size: 15px; width: 24px; height: 24px; }

    /* Both feedback views use the same compact geometry, retaining roles. */
    .feedback-summary { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
    .feedback-stat, .feedback-section, .feedback-filter-bar { border-radius: 9px; }
    .feedback-stat-value { font-size: 21px; }
    .feedback-stat-suffix { font-size: 12px; margin-left: 1.5px; }
    .feedback-stat-value-text { font-size: 11.4px; }
    .feedback-stat-label { font-size: 9px; margin-top: 6px; }
    .feedback-filter-active { font-size: 10.2px; }
    .feedback-filter-search { flex-basis: 180px; min-width: 150px; }
    .feedback-filter-search-icon { left: 9px; width: 12px; height: 12px; }
    .feedback-filter-search input { padding: 6px 9px 6px 27px; font-size: 10.8px; border-radius: 6px; }
    .feedback-filter-select { font-size: 10.2px; padding: 6px 7.5px; border-radius: 6px; }
    .feedback-filter-reset { font-size: 9.6px; padding: 6px 10.5px; min-height: 24px; border-radius: 6px; }
    .feedback-tab { min-height: 28px; }
    .feedback-section-header { padding: 10.5px 15px 10.5px 16.5px; min-height: 32px; }
    .feedback-section-caret { width: 15px; height: 15px; }
    .feedback-section-title { font-size: 12.24px; }
    .feedback-section-count { font-size: 9.36px; padding: 2.25px 6.75px; }
    .feedback-section-stats { gap: 4.5px; }
    .feedback-table { font-size: 10.56px; }
    .feedback-table th, .feedback-table td { padding: 7.5px var(--spacing-md); }
    .feedback-chip { padding: 2.25px 7.5px; font-size: 8.64px; }
    .feedback-cell-user, .feedback-cell-topic { width: 97.5px; font-size: 9.6px; }
    .feedback-cell-caret { width: 27px; }
    .feedback-row-expand { min-width: 24px; min-height: 24px; align-items: center; justify-content: center; }
    .feedback-cell-stem { font-size: 10.8px; }
    .feedback-cell-note { font-size: 10.44px; max-width: 225px; }
    .feedback-cell-severity, .feedback-cell-status { width: 82.5px; }
    .feedback-cell-date { width: 67.5px; font-size: 9.36px; }
    .feedback-cell-pattern { width: 120px; }
    .feedback-cell-actions { width: 112.5px; }
    .feedback-cell-empty { font-size: 9.6px; }
    .feedback-pattern-select { font-size: 9.36px; padding: 3px 6px; max-width: 112.5px; border-radius: 4.5px; }
    .feedback-action { font-size: 9px; padding: 3px 7.5px; min-height: 24px; margin-right: 3px; }
    .feedback-action-danger { padding: 3px 6.75px; min-width: 24px; }

    /* Inline helper sizes are limited to these three route subtrees. */
    [style*="font-size:0.75rem"], [style*="font-size: 0.75rem"] { font-size: 9px !important; }
    [style*="font-size:0.8rem"], [style*="font-size: 0.8rem"] { font-size: 9.6px !important; }
    [style*="font-size:0.85rem"], [style*="font-size: 0.85rem"] { font-size: 10.2px !important; }
    [style*="font-size:0.9rem"], [style*="font-size: 0.9rem"] { font-size: 10.8px !important; }
    [style*="font-size:0.95rem"], [style*="font-size: 0.95rem"] { font-size: 11.4px !important; }
    [style*="font-size:1.1rem"], [style*="font-size: 1.1rem"] { font-size: 13.2px !important; }
    [style*="font-size:1rem"], [style*="font-size: 1rem"] { font-size: 12px !important; }
    [style*="font-size:1.2rem"], [style*="font-size: 1.2rem"] { font-size: 14.4px !important; }
    [role="button"]:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
    input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
  }

  /* Exam overlays and the floating calculator live outside #app. */
  body:has(#app[data-learner-density]) .aura-confirm {
    width: 390px;
    border-radius: 18px;
    .aura-confirm__card { padding: 31.5px; }
    .aura-confirm__icon { width: 40.5px; height: 40.5px; margin-bottom: 13.5px; font-size: 15px; }
    h2 { font-size: 26.4px; }
    .aura-confirm__card > p:not(.aura-confirm__status) { margin-top: 9px; font-size: 11.28px; }
    .aura-confirm__status { margin-top: 19.5px; padding-top: 15px; font-size: 10.32px; }
    .aura-confirm__actions { gap: 9px; margin-top: 16.5px; }
    .aura-confirm__button { min-height: 36px; padding: 8.25px 13.5px; font-size: 10.8px; border-radius: 10.5px; }
  }
  body:has(#app[data-learner-density]) #exam-modal-overlay {
    font-size: 12px;
    > div { max-width: 300px !important; padding: 24px !important; border-radius: 12px !important; }
    h2 { font-size: 28.2px; }
    p { font-size: 12px; }
    .btn { font-size: 11.04px; min-height: 32px; padding: 8px 12px; }
  }
  body:has(#app[data-learner-density]) .aura-chat-root {
    .aura-chat-fab { width: 42px; height: 42px; right: 18px; bottom: 18px; }
    .aura-chat-fab svg { width: 21px; height: 21px; }
    .aura-chat-panel { width: 285px; height: 390px; right: 18px; bottom: 18px; max-height: calc(100dvh - 36px); border-radius: 13.5px; }
    .aura-chat-panel--maximized { width: 570px; height: min(615px, calc(100dvh - 36px)); }
    .aura-chat-panel:has(.aura-tab-view--active[data-view="calc"]):not(.aura-chat-panel--maximized) { width: 366px; }
    .aura-chat-header { padding: 10.5px 12px; }
    .aura-chat-header-title { font-size: 10.5px; }
    .aura-chat-header-actions button { min-width: 24px; min-height: 24px; padding: 3px; }
    .aura-chat-header-actions button svg { width: 13.5px; height: 13.5px; }
    .aura-chat-messages { padding: 12px; gap: 9px; }
    .aura-chat-msg { font-size: 9.75px; padding: 7.5px 10.5px; }
    .aura-chat-footer { padding: 9px 12px; }
    .aura-chat-input { padding: 6px 9px; font-size: 9.75px; }
    .aura-chat-send { width: 27px; height: 27px; }
    .aura-chat-tabs { padding: 3px; }
    .aura-chat-tab-btn { font-size: 9.75px; min-height: 24px; }
    .aura-notepad-wrap { padding: 9px; }
    .aura-notepad { font-size: 9.75px; padding: 9px; }
    .aura-pebc-calc-host { padding: 7.5px; }
    .pebc-calc-window--compact { width: 339.75px; }
    .pebc-calc-window--compact .pebc-calc-titlebar { height: 27px; }
    .pebc-calc-window--compact .pebc-calc-titlebar h1 { font-size: 10.5px; }
    .pebc-calc-window--compact .pebc-calc-body { padding: 6px; }
    .pebc-calc-window--compact .pebc-calc-tabs { min-height: 24px; }
    .pebc-calc-window--compact .pebc-calc-tab { height: 24px; padding: 0 4px; font-size: 10.5px; }
    .pebc-calc-window--compact .pebc-calc-digit-grouping { height: 24px; min-width: 78px; padding: 0 6px; font-size: 9px; }
    .pebc-calc-window--compact .pebc-calc-panel { padding: 7.5px; }
    .pebc-calc-window--compact .pebc-calc-screen { height: 31.5px; margin-bottom: 6px; font-size: 15px; }
    .pebc-calc-window--compact .pebc-calc-keyboard { gap: 3px; }
    .pebc-calc-window--compact .pebc-calc-row { grid-template-columns: repeat(10, minmax(24px, 1fr)); gap: 4.5px; }
    .pebc-calc-window--compact .pebc-calc-key { height: 24px; font-size: 9px; padding: 0; }
    .pebc-calc-window--compact .pebc-calc-key--copy { height: 24px; }
  }
}

@media (min-width: 1080px) and (max-width: 1599px) and (pointer: coarse) {
  #app[data-learner-density] {
    button, [role="button"], .filter-pill, input, select, .saved-row-check { min-height: 44px !important; min-width: 44px; }
    .saved-row { grid-template-columns: 44px minmax(0, 1fr) 44px; }
    .saved-row-checkbox, .saved-row-check, .saved-row-remove { width: 44px; height: 44px; }
    .saved-row-checkbox::before { inset: 16px; }
    .saved-row-checkbox:checked::after { left: 20px; top: 17px; }
    .feedback-row-expand, .feedback-action-danger { min-width: 44px; }
  }
  body:has(#app[data-learner-density]) :is(.aura-chat-root, #exam-modal-overlay, .aura-confirm) {
    button, .btn, .pebc-calc-key { min-width: 44px; min-height: 44px; }
    .aura-chat-fab, .aura-chat-send { width: 44px; height: 44px; }
    .aura-chat-panel { width: 420px; }
    .aura-chat-panel:has(.aura-tab-view--active[data-view="calc"]):not(.aura-chat-panel--maximized) { width: 510px; }
    .pebc-calc-window--compact { width: 480px; }
    .pebc-calc-window--compact .pebc-calc-titlebar { height: 44px; }
    .pebc-calc-window--compact .pebc-calc-row { gap: 1px; }
  }
}
