/* Mobile product surfaces. Never target the administration shell or print output.
   Loaded after the legacy styles so each user journey has one mobile contract. */
.mk-filter-trigger, .mk-filter-close, .mk-filter-done, .mk-drawer-close, .mk-reorder, .qset-index-toggle { display: none; }
.mk-sheet-backdrop[hidden] { display: none !important; }
@media screen and (max-width: 820px), screen and (max-height: 520px) and (pointer: coarse) {
  body.mk-user-ui {
    --mk-paper: #fffdfa;
    --mk-ground: #f6f5f1;
    --mk-line: #e8e4dc;
    --mk-accent: #b84c13;
    --mk-radius: 20px;
    --m-bar-h: calc(58px + env(safe-area-inset-top, 0px));
    --m-tab-h: 66px;
    --mk-bottom: calc(var(--m-tab-h) + env(safe-area-inset-bottom, 0px));
    background: var(--mk-ground);
    -webkit-text-size-adjust: 100%;
    scroll-padding-block: calc(var(--m-bar-h) + 14px) calc(var(--mk-bottom) + 16px);
  }
  body.mk-user-ui.mk-overlay-open {
    position: fixed; top: var(--mk-scroll-y); left: 0; right: 0;
    width: 100%; overflow: hidden;
  }
  body.mk-user-ui :is(button, a, summary, label) { -webkit-tap-highlight-color: transparent; }
  body.mk-user-ui :is(button, a, summary) { touch-action: manipulation; }
  body.mk-user-ui :is(button, a, input, select, textarea, summary):focus-visible { outline: 3px solid #167d8d; outline-offset: 3px; }
  body.mk-user-ui :is(input:not([type=checkbox]):not([type=radio]):not([type=range]), select, textarea) { font-size: 16px; }
  body.mk-user-ui :is(.primary-button, .secondary-button, .ghost-button, .icon-button, .modal-close, .auth-submit) { min-height: 48px; }
  body.mk-user-ui :is(.icon-button, .modal-close) { min-width: 44px; }
  body.mk-user-ui :is(.student-shell, .student-shell .main, #studentContent) { min-width: 0; max-width: 100%; }
  body.mk-user-ui .student-shell { background: var(--mk-ground); }
  body.mk-user-ui .student-shell .main { padding-inline: 0; margin-inline: 0; }
  body.mk-user-ui .student-shell .content { padding: 18px 16px calc(var(--mk-bottom) + 28px); }
  body.mk-user-ui .student-shell .topbar {
    position: sticky; top: 0; z-index: 55; height: var(--m-bar-h);
    padding: env(safe-area-inset-top, 0px) max(16px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px));
    background: rgba(255, 253, 250, .98); border-bottom: 1px solid var(--mk-line);
    transform: none !important; box-shadow: none;
  }
  body.mk-user-ui .m-topbar-title { font-size: 17px; font-weight: 850; }
  body.mk-user-ui .student-shell :is(.topbar-icon, .topbar-profile) { min-width: 44px; min-height: 44px; }
  body.mk-user-ui .student-shell .topbar-tools { gap: 2px; }
  body.mk-user-ui .student-shell :is(#stWalletChip, #stPrintCreditChip) { display: none; }
  body.mk-user-ui .m-tabbar {
    display: grid !important; transform: none !important; height: var(--mk-bottom);
    padding: 7px max(8px, env(safe-area-inset-right, 0px)) env(safe-area-inset-bottom, 0px) max(8px, env(safe-area-inset-left, 0px));
    background: rgba(255,253,250,.98); border-color: var(--mk-line); box-shadow: 0 -4px 20px #342a1910;
  }
  body.mk-user-ui .m-tab { min-height: 52px; font-size: 11px; color: #746c61; gap: 2px; }
  body.mk-user-ui .m-tab.active { color: var(--mk-accent); }
  body.mk-user-ui .m-tab.active .m-tab-icon { background: #ffead8; }
  body.mk-user-ui .m-tab-icon { width: 23px; height: 23px; padding: 4px 15px; }
  body.mk-user-ui:is(.exam-open, .pstudio-open, .mk-keyboard) .m-tabbar { display: none !important; }
  body.mk-user-ui.mk-keyboard { --mk-bottom: 0px; }
  body.mk-user-ui .student-shell :is(.sp-tabbar, .exam-pick-mode) { top: var(--m-bar-h); }
  body.mk-user-ui .student-shell .page-head { margin-bottom: 18px; gap: 12px; align-items: stretch; }
  body.mk-user-ui .student-shell .page-head h1 { font-size: 26px; line-height: 1.6; letter-spacing: -.5px; }
  body.mk-user-ui .student-shell .page-head p { font-size: 13px; line-height: 1.9; }
  body.mk-user-ui .student-shell :is(.page-head, .exam-panel-head, .exam-wizard-head) { flex-wrap: wrap; }
  body.mk-user-ui :is(.student-shell .page-head, .exam-wizard-head) { scroll-margin-top: calc(var(--m-bar-h) + 12px); }

  /* The full navigation slides in from the right, with its own scroll area. */
  body.mk-user-ui .student-shell .sidebar {
    position: fixed; inset: 0 0 0 auto !important; width: min(268px, calc(100vw - 64px)) !important;
    height: var(--mk-viewport, 100dvh); max-height: var(--mk-viewport, 100dvh);
    padding: calc(14px + env(safe-area-inset-top, 0px)) max(12px, env(safe-area-inset-right, 0px)) calc(14px + env(safe-area-inset-bottom, 0px)) 12px;
    border: 1px solid var(--mk-line); border-radius: 24px 0 0 24px;
    background: var(--mk-paper); transform: translateX(105%) !important;
    visibility: hidden; box-shadow: -20px 0 80px #241b2430; z-index: 100;
    transition: transform .25s ease, visibility 0s linear .25s;
    overflow-y: auto; overscroll-behavior: contain;
  }
  body.mk-user-ui .student-shell .sidebar.open { transform: none !important; visibility: visible; transition-delay: 0s; }
  body.mk-user-ui .student-shell .sidebar .brand { margin-bottom: 12px; padding-inline-end: 45px; }
  body.mk-user-ui .student-shell .sidebar .brand-copy { display: flex !important; opacity: 1 !important; width: auto !important; }
  body.mk-user-ui .student-shell .sidebar .nav-section { display: grid; grid-template-columns: minmax(0, 1fr); gap: 5px; }
  body.mk-user-ui .student-shell .sidebar .nav-label { grid-column: 1 / -1; margin: 12px 0 2px; }
  body.mk-user-ui .student-shell .sidebar .nav-item {
    width: 100%; min-height: 44px; padding: 8px 10px; border-radius: 12px;
    display: flex; gap: 9px; white-space: normal; background: #f2f0e9;
  }
  body.mk-user-ui .student-shell .sidebar .nav-item.active { background: #ffead8; color: #9c3d0b; }
  body.mk-user-ui .student-shell .sidebar .nav-item > span { display: inline !important; opacity: 1 !important; visibility: visible; font-size: 12px; }
  body.mk-user-ui .student-shell .sidebar .nav-count { margin-inline-start: auto; }
  body.mk-user-ui .student-shell .sidebar-backdrop { inset: 0; z-index: 95; background: #201a2559; }
  body.mk-user-ui .mk-drawer-close { display: grid; place-items: center; position: absolute; top: calc(16px + env(safe-area-inset-top, 0px)); left: 16px; width: 44px; height: 44px; border: 1px solid var(--mk-line); border-radius: 50%; background: #fff; }

  /* Filters retain their real inputs and bindings inside an accessible sheet. */
  body.mk-user-ui .mk-filter-trigger {
    display: flex; align-items: center; gap: 10px; order: 2; width: 100%; min-height: 52px;
    margin: 0 0 14px; padding: 12px 16px; border: 1px solid #ded8cb; border-radius: 16px;
    color: #4e4435; background: var(--mk-paper); font: inherit; font-size: 14px; font-weight: 750;
  }
  body.mk-user-ui .mk-filter-count { margin-inline-start: auto; color: var(--mk-accent); font-size: 11px; }
  body.mk-user-ui .mk-filter-sheet {
    display: none !important; position: fixed !important; inset: auto 0 0 !important;
    width: 100% !important; min-width: 0 !important; max-width: none !important;
    max-height: calc(var(--mk-viewport, 100dvh) - 24px) !important; margin: 0 !important;
    padding: 20px 18px 0 !important; border-radius: 26px 26px 0 0 !important;
    background: var(--mk-paper) !important; overflow-y: auto !important;
    overscroll-behavior: contain; z-index: 100;
  }
  body.mk-user-ui .mk-filter-sheet.mk-sheet-open { display: block !important; }
  /* Exam facets need a layout container: block flow discards the sidebar gap. */
  body.mk-user-ui .exam-filter-side.mk-filter-sheet.mk-sheet-open {
    display: grid !important;
    gap: 12px;
    align-content: start;
  }
  body.mk-user-ui .exam-filter-side.mk-filter-sheet > :is(.exam-filter-title, .qset-search, .sd-section, .qset-filter-clear) {
    margin: 0;
    min-width: 0;
  }
  body.mk-user-ui .exam-filter-side.mk-filter-sheet > .exam-filter-title {
    min-height: 44px;
    padding: 0 0 0 56px;
    border: 0;
    background: transparent;
  }
  body.mk-user-ui .exam-filter-side.mk-filter-sheet > .mk-filter-close {
    position: absolute;
    top: 20px;
    left: 18px;
    margin: 0;
  }
  body.mk-user-ui .exam-filter-side.mk-filter-sheet > .mk-filter-done {
    margin-top: 4px;
  }
  body.mk-user-ui .mk-filter-sheet.mk-sheet-open > * { display: revert !important; }
  body.mk-user-ui .mk-filter-sheet > .mk-filter-close {
    display: grid !important; place-items: center; position: sticky; top: 0; z-index: 4;
    width: 44px; height: 44px; margin: 0 auto -44px 0; padding: 0;
    border: 1px solid var(--mk-line); border-radius: 50%; color: #554d42; background: var(--mk-paper);
    box-shadow: 0 4px 14px #342a1912;
  }
  body.mk-user-ui .mk-filter-sheet > .mk-filter-close .ui-icon { width: 20px; height: 20px; }
  body.mk-user-ui .mk-filter-sheet.mk-sheet-open > :is(.qset-search, .exam-filter-title, .sd-summary-head) { display: flex !important; }
  body.mk-user-ui .mk-filter-sheet :is(.exam-filter-title, .sd-summary-head) { pointer-events: none; font-size: 17px; margin-bottom: 14px; }
  body.mk-user-ui .mk-filter-sheet :is(.exam-filter-title, .sd-summary-head)::after { content: none; }
  body.mk-user-ui .mk-filter-sheet :is(summary, .emf-opt, .sd-option) { min-height: 44px; }
  body.mk-user-ui .mk-filter-sheet > .mk-filter-done {
    display: flex !important; align-items: center; justify-content: center; position: sticky; bottom: 0;
    width: 100%; margin-top: 18px; min-height: 56px; padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)); border-radius: 16px 16px 0 0; z-index: 2;
  }
  body.mk-user-ui .mk-sheet-backdrop { display: block; position: fixed; inset: 0; border: 0; padding: 0; background: #211b2559; z-index: 96; }
  body.mk-user-ui .exam-manage-layout { grid-template-columns: minmax(0, 1fr); gap: 0; }

  /* Exam hub: a compact horizontal section switch, with the active task below. */
  body.mk-user-ui .student-shell .exam-hub-tabs {
    display: flex; flex-wrap: nowrap; overflow-x: auto; width: auto; max-width: none;
    gap: 8px; margin: 0 -16px 18px; padding: 2px 16px 8px;
    scrollbar-width: thin; overscroll-behavior-inline: contain;
  }
  body.mk-user-ui .student-shell .exam-hub-tab { flex: 0 0 auto; min-height: 48px; padding: 10px 15px; border-radius: 16px; font-size: 13px; }
  body.mk-user-ui .student-shell .exam-panel { padding: 16px; border-radius: var(--mk-radius); }
  body.mk-user-ui .student-shell .exam-head-btns { display: flex; width: 100%; gap: 8px; flex-wrap: wrap; }
  body.mk-user-ui .student-shell .exam-head-btns > button { flex: 1 1 130px; justify-content: center; font-size: 12px; }
  body.mk-user-ui .student-shell .exam-table .exam-tr { padding: 16px; border-radius: 20px; box-shadow: none; gap: 12px; }
  body.mk-user-ui .student-shell .exam-table .exam-td-name .exam-name-line > b { font-size: 16px; line-height: 1.8; }
  body.mk-user-ui .student-shell .exam-table .exam-td-actions :is(button, .exam-iconbtn, .exam-report-btn) { min-height: 46px; min-width: 46px; height: auto; }
  body.mk-user-ui .student-shell .exam-table .exam-td-actions :is(.primary-button, .exam-report-btn) { flex: 1; justify-content: center; }
  body.mk-user-ui .student-shell .exam-wizard-head p { font-size: 13px; line-height: 1.9; }
  body.mk-user-ui .student-shell .exam-wizard-progress { padding: 7px 12px; background: #ffead8; color: #974115; border-radius: 10px; }
  body.mk-user-ui .student-shell .exam-stepper { gap: 7px; justify-content: flex-start; margin: 18px 0; padding: 12px 0; }
  body.mk-user-ui .student-shell .exam-step { flex: 0 0 auto; gap: 6px; }
  body.mk-user-ui .student-shell .exam-step:not(.on) .exam-step-label { display: none; }
  body.mk-user-ui .student-shell .exam-step-label { font-size: 13px; }
  body.mk-user-ui .student-shell .exam-step-num { width: 28px; height: 28px; font-size: 12px; }
  body.mk-user-ui .student-shell .exam-step-line { flex: 1 1 8px; min-width: 3px; max-width: 18px; }
  body.mk-user-ui .student-shell .exam-wizard-body { padding: 16px; }
  body.mk-user-ui .student-shell .ew-step { gap: 18px; }
  body.mk-user-ui .student-shell :is(.ew-type-cards, .ew-review-meta) { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
  body.mk-user-ui .student-shell .ew-type { padding: 16px; border-radius: 16px; }
  body.mk-user-ui .student-shell .ew-type span { line-height: 1.9; font-size: 13px; }
  body.mk-user-ui .student-shell .exam-wizard-body [data-ctx-group="grade"] {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }
  body.mk-user-ui .student-shell .exam-wizard-body [data-ctx-group="grade"] .ctx-choice {
    min-width: 0;
    padding-inline: 4px;
  }
  body.mk-user-ui .student-shell .ew-nav {
    position: sticky; bottom: var(--mk-bottom); z-index: 40; display: flex;
    gap: 10px; margin: 18px -8px -8px; padding: 12px 8px; background: var(--mk-paper);
    border-top: 1px solid var(--mk-line); box-shadow: 0 -10px 22px #fffdfaee;
  }
  body.mk-user-ui .student-shell .ew-nav > button { flex: 1; min-height: 50px; justify-content: center; font-size: 13px; padding-inline: 8px; }
  body.mk-user-ui .student-shell .ew-nav > span:empty { display: none; }
  body.mk-user-ui .student-shell .ew-booklet { padding: 12px; border-radius: 18px; }
  body.mk-user-ui .student-shell .ew-bk-head { display: flex; flex-wrap: wrap; gap: 10px; }
  body.mk-user-ui .student-shell .ew-bk-name-wrap { flex: 1 1 160px; }
  body.mk-user-ui .student-shell .ew-lesson-row {
    display: grid; grid-template-columns: minmax(0, 1fr) 48px;
    grid-template-areas: "lesson lesson" "time time" "order delete";
    align-items: end; gap: 12px; padding: 12px;
    border: 1px solid var(--mk-line); border-radius: 16px; margin-block: 10px;
  }
  body.mk-user-ui .student-shell .ew-lesson-row:has(.ew-ls-coef) {
    grid-template-areas: "lesson lesson" "time time" "coef coef" "order delete";
  }
  body.mk-user-ui .student-shell .ew-ls-field { grid-area: lesson; grid-column: 1 / -1; grid-row: 1; min-width: 0; }
  body.mk-user-ui .student-shell .ew-ls-time { grid-area: time; grid-column: 1 / -1; grid-row: 2; min-width: 0; width: 100%; }
  body.mk-user-ui .student-shell .ew-ls-coef { grid-area: coef; grid-column: 1 / -1; grid-row: 3; min-width: 0; width: 100%; }
  body.mk-user-ui .student-shell :is(.ew-ls-time, .ew-ls-coef) .ew-time-input { width: 100%; min-height: 46px; }
  body.mk-user-ui .student-shell .ew-ls-order {
    grid-area: order; grid-column: 1; grid-row: 3;
    display: flex; flex-direction: row; align-items: center; gap: 6px; min-width: 0;
  }
  body.mk-user-ui .student-shell .ew-lesson-row:has(.ew-ls-coef) .ew-ls-order { grid-row: 4; }
  body.mk-user-ui .student-shell .ew-ls-order .ew-ls-ord { width: 44px; height: 44px; flex: 0 0 44px; }
  body.mk-user-ui .student-shell .ew-drag-handle { display: none; }
  body.mk-user-ui .student-shell .mk-reorder { display: flex; gap: 6px; }
  body.mk-user-ui .mk-reorder button { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--mk-line); background: white; display: grid; place-items: center; }
  body.mk-user-ui .mk-reorder button:disabled { opacity: .3; }
  body.mk-user-ui .student-shell .ew-lesson-row > .ew-mini {
    grid-area: delete; grid-column: 2; grid-row: 3;
    min-height: 44px; min-width: 44px; justify-self: end;
  }
  body.mk-user-ui .student-shell .ew-lesson-row:has(.ew-ls-coef) > .ew-mini { grid-row: 4; }
  body.mk-user-ui .student-shell .ew-q-lesson { display: flex; flex-wrap: wrap; gap: 10px; padding: 14px; }
  body.mk-user-ui .student-shell .ew-q-ls-actions { width: 100%; display: flex; gap: 8px; }
  body.mk-user-ui .student-shell .ew-q-ls-actions .ew-pick-button { flex: 1; justify-content: center; }
  body.mk-user-ui .student-shell :is(.ew-add-lesson, .ew-add-booklet) { min-height: 50px; }
  body.mk-user-ui .student-shell .ew-review-row { grid-template-columns: 1fr 1fr; padding: 12px; gap: 8px; }
  body.mk-user-ui .student-shell .ew-review-row.head { display: none; }
  body.mk-user-ui .student-shell .ew-review-row > :nth-child(3)::before { content: 'تعداد سؤال: '; color: #817767; }

  /* Plan: a single chronological agenda instead of a zigzag desktop canvas. */
  body.mk-user-ui :is(.pl-head-actions, .pl-modebar, .pl-mode-tools) { flex-wrap: wrap; gap: 10px; }
  body.mk-user-ui .pl-mode-tabs { display: flex; width: 100%; }
  body.mk-user-ui .pl-mode-tab { flex: 1; min-height: 48px; justify-content: center; }
  body.mk-user-ui .pl-brandbar { display: flex; flex-wrap: wrap; padding: 14px; gap: 12px; }
  body.mk-user-ui .pl-brand-chips { display: flex; overflow-x: auto; flex-wrap: nowrap; width: 100%; gap: 8px; padding-bottom: 6px; }
  body.mk-user-ui .pl-brand-chip { min-height: 46px; flex: 0 0 auto; }
  body.mk-user-ui .pl-save-btn { min-height: 44px; }
  body.mk-user-ui .pl-roadmap { padding: 0; }
  body.mk-user-ui .pl-rm-rail { display: none; }
  body.mk-user-ui .pl-rm-month { position: static; margin: 24px 0 12px; justify-content: flex-start; }
  body.mk-user-ui .pl-rm-month-label { font-size: 18px; }
  body.mk-user-ui .pl-rm-day { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; margin: 0 0 20px; }
  body.mk-user-ui .pl-rm-date { position: static; transform: none; width: auto; display: flex; align-items: center; justify-content: flex-start; gap: 8px; padding: 8px 4px; }
  body.mk-user-ui .pl-rm-date > b { font-size: 21px; }
  body.mk-user-ui .pl-rm-date > span { font-size: 14px; }
  body.mk-user-ui .pl-rm-date > small { font-size: 12px; }
  body.mk-user-ui .pl-rm-compare { margin-inline-start: auto; min-height: 44px; font-size: 12px; }
  body.mk-user-ui .pl-rm-day-list { gap: 12px; }
  body.mk-user-ui .pl-rm-item { display: block; min-height: 0; padding: 0; }
  body.mk-user-ui .pl-rm-item .pl-rm-node { display: none; }
  body.mk-user-ui .pl-rm-item .pl-rm-card { margin: 0; width: 100%; max-width: none; border-radius: 18px; padding: 14px; box-shadow: none; opacity: 1; filter: none; }
  body.mk-user-ui .pl-rm-card::before { display: none; }
  body.mk-user-ui .pl-rm-card-main { min-height: 64px; width: 100%; }
  body.mk-user-ui .pl-rm-summary { display: flex; flex-wrap: wrap; gap: 8px; text-align: right; }
  body.mk-user-ui .pl-rm-summary b { flex-basis: 100%; font-size: 16px; white-space: normal; order: -1; }
  body.mk-user-ui .pl-rm-summary :is(i, em), body.mk-user-ui .pl-rm-expand small { font-size: 12px; }
  body.mk-user-ui .pl-rm-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
  body.mk-user-ui .pl-rm-actions > button { min-height: 46px; flex: 1 1 auto; font-size: 12px; justify-content: center; }
  body.mk-user-ui .pl-rm-today { position: static; transform: none; margin: 14px 0; justify-content: flex-start; }
  body.mk-user-ui .pl-cal-grid { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  body.mk-user-ui .pl-cal-month { padding: 12px 8px; }
  body.mk-user-ui .pl-cal-cell { min-width: 0; min-height: 66px; }
  body.mk-user-ui .pl-ws { display: grid; grid-template-columns: minmax(0, 1fr); }
  body.mk-user-ui .pl-ws-side { position: static; order: -1; width: auto; }
  body.mk-user-ui .pl-ws-cta { display: flex; gap: 8px; flex-wrap: wrap; }
  body.mk-user-ui .pl-ws-cta > button { flex: 1 1 140px; justify-content: center; }

  /* Reading, reports, collections, and educators share generous touch targets. */
  body.mk-user-ui .student-shell :is(.sq-item, .mn-card, .qset-card, .sp-command-card, .edu-card) { border-radius: 20px; }
  body.mk-user-ui .student-shell :is(.sq-ans-opt, .sq-info-act, .sq-note-act, .sq-show-answer, .sq-dunno, .mn-card-open) { min-height: 46px; }
  body.mk-user-ui .student-shell .sq-info-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body.mk-user-ui .student-shell .sq-info-act { font-size: 12px; white-space: normal; }
  body.mk-user-ui .student-shell .sq-info-act.qset-add-card { grid-column: 1 / -1; }
  body.mk-user-ui .student-shell .sq-answer-options { gap: 10px; }
  body.mk-user-ui .student-shell :is(.sq-text, .sq-answer-content) { line-height: 1.95; }
  body.mk-user-ui .student-shell :is(.sp-tabbar [role=tab], .sp-refresh) { min-height: 46px; }
  body.mk-user-ui .student-shell :is(.orgm-toolbar, .orgm-filters, .edu-toolbar) { flex-wrap: wrap; gap: 10px; }
  body.mk-user-ui .student-shell .orgm-table { overflow: visible; min-width: 0; background: transparent; border: 0; }
  body.mk-user-ui .student-shell .orgm-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-width: 0; gap: 12px; padding: 16px; margin-bottom: 12px; background: var(--mk-paper); border: 1px solid var(--mk-line); border-radius: 18px; }
  body.mk-user-ui .student-shell .orgm-row.orgm-head { display: none; }
  body.mk-user-ui .student-shell .orgm-name { grid-column: 1 / -1; white-space: normal; }
  body.mk-user-ui .student-shell .orgm-rowacts { grid-column: 1 / -1; justify-content: flex-start; gap: 8px; flex-wrap: wrap; }
  body.mk-user-ui .student-shell .orgm-rowacts button { min-width: 44px; min-height: 44px; }
  body.mk-user-ui .mk-record-table { display: block; width: 100%; min-width: 0 !important; border: 0; }
  body.mk-user-ui .mk-record-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  body.mk-user-ui .mk-record-table tbody { display: grid; gap: 12px; }
  body.mk-user-ui .mk-record-table tbody tr { display: grid; grid-template-columns: minmax(0, 1fr); padding: 12px; border: 1px solid var(--mk-line); border-radius: 16px; background: var(--mk-paper); }
  body.mk-user-ui .mk-record-table td { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 9px 4px; white-space: normal; min-width: 0; }
  body.mk-user-ui .mk-record-table td::before { content: attr(data-mk-label); color: #817767; font-size: 12px; margin-inline-end: auto; }

  /* Sheets for short decisions; long forms remain scrollable above the keyboard. */
  body.mk-user-ui #modalRoot .modal-backdrop { align-items: flex-end; padding: 0; }
  body.mk-user-ui #modalRoot .modal {
    width: 100%; max-width: 100%; max-height: calc(var(--mk-viewport, 100dvh) - 16px);
    border-radius: 26px 26px 0 0; padding-bottom: env(safe-area-inset-bottom, 0px);
    overscroll-behavior: contain;
  }
  body.mk-user-ui #modalRoot :is(.modal-head, .modal-header) { position: sticky; top: 0; z-index: 5; background: var(--mk-paper); padding: 16px; }
  body.mk-user-ui #modalRoot :is(.modal-foot, .modal-footer) { position: sticky; bottom: 0; z-index: 4; background: var(--mk-paper); padding: 12px 16px; gap: 10px; flex-wrap: wrap; }
  body.mk-user-ui #modalRoot :is(.modal-foot, .modal-footer) > button { flex: 1 1 120px; justify-content: center; }
  body.mk-user-ui #modalRoot .modal-body { padding: 16px; }
  body.mk-user-ui #examRunner :is(.er-opt, .er-answer-opt, .er-nav-btn, .er-sheet-toggle) { min-height: 48px; }
  body.mk-user-ui #examRunner .er-top { padding-top: max(8px, env(safe-area-inset-top, 0px)); }
  body.mk-user-ui #examRunner .er-main { scroll-padding-bottom: calc(90px + env(safe-area-inset-bottom, 0px)); }
  body.mk-user-ui .toast-stack { max-width: calc(100vw - 24px); bottom: calc(var(--mk-bottom) + 12px); }

  /* Public journeys: focused entry, reading, and buying on a phone. */
  body.mk-user-ui #landingRoot .lp2-hero-shell { display: flex; flex-direction: column; padding: 26px 20px 20px; gap: 16px; }
  body.mk-user-ui #landingRoot .lp2-hero-copy { text-align: right; width: 100%; }
  body.mk-user-ui #landingRoot .lp2-hero h1 { font-size: clamp(30px, 8.4vw, 40px); line-height: 1.6; }
  body.mk-user-ui #landingRoot .lp2-hero-visual { width: 100%; max-height: 260px; overflow: hidden; margin: 0; border-radius: 24px; }
  body.mk-user-ui #landingRoot .lp2-hero-art { width: 100%; height: 260px; object-fit: cover; object-position: center 35%; }
  body.mk-user-ui #landingRoot .lp-hero-cta { display: flex; flex-wrap: wrap; gap: 10px; }
  body.mk-user-ui #landingRoot .lp-hero-cta > a { flex: 1 1 140px; min-height: 50px; justify-content: center; }
  body.mk-user-ui #landingRoot .lp-sec { padding-inline: 20px; padding-block: 32px; }
  body.mk-user-ui #landingRoot :is(.lp2-product-tabs, .lp-pack-tabs) { display: flex; flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; padding-bottom: 8px; }
  body.mk-user-ui #landingRoot :is(.lp2-product-tabs button, .lp-pack-tabs button) { flex: 0 0 auto; min-height: 46px; }
  body.mk-user-ui #landingRoot .lp-faq-item summary { min-height: 56px; line-height: 1.8; }
  body.mk-user-ui #authGate.auth-paper { min-height: 100dvh; padding: max(20px, env(safe-area-inset-top, 0px)) 16px max(24px, env(safe-area-inset-bottom, 0px)); }
  body.mk-user-ui #authGate :is(.auth-card, .auth-box) { width: 100%; max-width: 460px; border-radius: 24px; padding: 24px 20px; }
  body.mk-user-ui #authGate .auth-form { gap: 18px; }
  body.mk-user-ui #authGate .auth-form input { min-height: 52px; border-radius: 14px; }
  body.mk-user-ui #authGate .auth-remember { align-items: flex-start; line-height: 1.9; font-size: 13px; }
  body.mk-user-ui #authGate .auth-remember input { min-height: 22px; width: 22px; flex-shrink: 0; }
  body.mk-user-ui .store-public-bar { flex-wrap: wrap; padding: 12px 16px; gap: 12px; }
  body.mk-user-ui .store-public-actions { display: flex; width: 100%; gap: 8px; }
  body.mk-user-ui .store-public-actions > a { flex: 1; min-height: 44px; padding-inline: 6px; justify-content: center; font-size: 12px; }
  body.mk-user-ui :is(#storeRoot, #planRoot) > .store-public > .content { padding-inline: 16px; }
  body.mk-user-ui #docsRoot :is(article, .docs-article) { font-size: 16px; line-height: 2; overflow-wrap: anywhere; }
  body.mk-user-ui #docsRoot :is(input, summary, .docs-nav-link) { min-height: 46px; }
}
@media screen and (max-width: 370px) {
  body.mk-user-ui .student-shell .content { padding-inline: 12px; }
  body.mk-user-ui .student-shell .exam-panel { padding: 12px; }
  body.mk-user-ui .student-shell .exam-stepper { gap: 4px; }
  body.mk-user-ui .student-shell .exam-step-num { width: 24px; height: 24px; }
  body.mk-user-ui .m-tab-icon { padding-inline: 10px; }
  body.mk-user-ui .student-shell .sidebar .nav-section { gap: 6px; }
}
@media screen and (max-height: 520px) and (orientation: landscape) and (pointer: coarse) {
  body.mk-user-ui { --m-bar-h: 48px; --m-tab-h: 56px; }
  body.mk-user-ui .student-shell .topbar { height: var(--m-bar-h); }
  body.mk-user-ui .m-tab { flex-direction: row; min-height: 44px; gap: 5px; }
  body.mk-user-ui .m-tab-icon { padding: 3px; width: 20px; height: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  body.mk-user-ui *, body.mk-user-ui *::before, body.mk-user-ui *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
@media screen and (max-width: 820px), screen and (max-height: 520px) and (pointer: coarse) {
  body.mk-user-ui .student-shell .sidebar .brand { min-height: 70px; height: auto; padding-block: 0; }
  body.mk-user-ui .student-shell .sidebar .nav-label { padding: 0 4px; min-height: 20px; max-height: none; opacity: 1; }
  body.mk-user-ui .student-shell .exam-stepper { display: flex; align-items: center; padding: 12px 10px; }
  body.mk-user-ui .student-shell .exam-step { flex-direction: row; }
  body.mk-user-ui .student-shell .exam-step::before { display: none; }
  body.mk-user-ui .student-shell .exam-step-line { display: block; }
  body.mk-user-ui .student-shell .exam-wizard-progress { display: inline-block; font-size: 11px; }
  body.mk-user-ui .exam-manage-layout > .mk-filter-trigger { order: 0; }
  body.mk-user-ui .exam-manage-layout > .exam-rows { order: 1; }
  body.mk-user-ui .student-shell .sdash-charts { display: contents; }
  body.mk-user-ui .student-shell .sdash-chart-stack { order: -1; }
  body.mk-user-ui .student-shell #sdashQuotaCard { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 12px; align-items: center; padding: 16px; order: 3; }
  body.mk-user-ui .student-shell #sdashQuotaCard > header { grid-column: 1 / -1; }
  body.mk-user-ui .student-shell #sdashQuotaCard .sdash-ring { width: 92px; height: 92px; margin: 0; }
  body.mk-user-ui .student-shell #sdashQuotaCard .sdash-ring-core b { font-size: 18px; }
  body.mk-user-ui .student-shell #sdashQuotaCard .sdash-quota-rows { min-width: 0; margin: 0; }
  body.mk-user-ui .student-shell #sdashQuotaCard .sdash-quota-rows li { font-size: 11px; }
  body.mk-user-ui #landingRoot .lp-hero-cta > a { padding: 12px 16px; min-height: 54px; font-size: 15px; white-space: nowrap; }
}
@media screen and (max-width: 820px), screen and (max-height: 520px) and (pointer: coarse) {
  body.mk-user-ui .mk-list-reorder { display: flex; flex: 0 0 auto; gap: 4px; margin-inline-start: auto; }
  body.mk-user-ui :is(.ew-prio-row, .pro-question-row, .eb-stage-row, .pl-join-row) { flex-wrap: wrap; gap: 8px; }
  body.mk-user-ui #modalRoot .modal { height: auto; }
  body.mk-user-ui .student-shell .sdash-quick-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body.mk-user-ui .student-shell .sdash-quick-actions > button { padding-inline: 6px; font-size: 13px; min-height: 52px; }
}
@media screen and (max-width: 820px), screen and (max-height: 520px) and (pointer: coarse) {
  body.mk-user-ui .student-shell .ew-ls-order { height: auto; min-height: 0; align-self: end; justify-content: flex-start; border: 0; background: transparent; padding: 0; }
  body.mk-user-ui .student-shell .ew-ls-time { grid-row: 2; }
  body.mk-user-ui .student-shell .ew-ls-coef { grid-row: 3; }
  body.mk-user-ui .student-shell .ew-lesson-row > .ew-mini { grid-row: 3; grid-column: 2; }
  body.mk-user-ui .student-shell .ew-lesson-row:has(.ew-ls-coef) .ew-ls-order,
  body.mk-user-ui .student-shell .ew-lesson-row:has(.ew-ls-coef) > .ew-mini { grid-row: 4; }
  body.mk-user-ui .student-shell .ew-booklet .ew-lesson-list { padding-inline: 0; }
}
@media screen and (max-width: 820px), screen and (max-height: 520px) and (pointer: coarse) {
  body.mk-user-ui.mk-keyboard #modalRoot .modal-backdrop {
    top: var(--mk-viewport-top, 0px); bottom: auto; height: var(--mk-viewport, 100dvh);
  }
  body.mk-user-ui.mk-keyboard .mk-filter-sheet {
    bottom: max(0px, calc(100dvh - var(--mk-viewport) - var(--mk-viewport-top))) !important;
  }
}
@media screen and (max-width: 820px), screen and (max-height: 520px) and (pointer: coarse) {
  body.mk-user-ui .student-shell { grid-template-columns: minmax(0, 1fr); }
  body.mk-user-ui .m-topbar-title { display: block; flex: 1; min-width: 0; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
  body.mk-user-ui .student-shell :is(#stHelpDocs, #stSupportTickets, #stSupportIdea, #sMenuToggle) { display: none; }
  body.mk-user-ui .student-shell .topbar-profile { padding: 0; width: 44px; justify-content: center; }
  body.mk-user-ui .student-shell .topbar-profile > :is(span:not(.avatar), .chevron) { display: none; }
  body.mk-user-ui .m-tabbar { position: fixed; inset-inline: 0; bottom: 0; z-index: 50; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); border-top: 1px solid var(--mk-line); }
  body.mk-user-ui .m-tab { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 0; border: 0; border-radius: 14px; background: transparent; font-family: inherit; font-weight: 800; padding: 0; }
  body.mk-user-ui .m-tab-icon { box-sizing: content-box; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; border-radius: 999px; }
}
@media screen and (max-width: 820px), screen and (max-height: 520px) and (pointer: coarse) {
  body.mk-user-ui .student-shell .exam-stepper { flex-wrap: nowrap; }
  body.mk-user-ui .student-shell .pro-stepper { gap: 3px; }
  body.mk-user-ui .student-shell .pro-stepper .exam-step { gap: 4px; }
  body.mk-user-ui .student-shell .pro-stepper .exam-step-num { width: 22px; height: 22px; font-size: 11px; }
  body.mk-user-ui .student-shell .pro-stepper .exam-step-label { max-width: 64px; font-size: 11px; line-height: 1.6; }
  body.mk-user-ui .student-shell .pro-stepper .exam-step-line { min-width: 1px; max-width: 5px; }
}
@media screen and (max-width: 820px), screen and (max-height: 520px) and (pointer: coarse) {
  body.mk-user-ui .student-shell .sidebar-backdrop { display: block; position: fixed; inset: 0; opacity: 0; visibility: hidden; }
  body.mk-user-ui .student-shell .sidebar-backdrop.open { opacity: 1; visibility: visible; }
  body.mk-user-ui .student-shell .orgm-row { grid-template-columns: 32px minmax(0, 1fr) 44px; }
  body.mk-user-ui .student-shell .orgm-row .orgm-name { grid-column: 2; grid-row: 1; font-size: 15px; }
  body.mk-user-ui .student-shell .orgm-row .orgm-check { grid-column: 1; grid-row: 1; min-height: 44px; display: flex; align-items: center; }
  body.mk-user-ui .student-shell .orgm-row > [data-org-label]:not(.orgm-name) { grid-column: 1 / -1; font-size: 13px; }
  body.mk-user-ui .student-shell .orgm-row > [data-org-label]::before { font-size: 12px; }
  body.mk-user-ui .student-shell .orgm-row .orgm-rowacts { grid-column: 3; grid-row: 1; }
  body.mk-user-ui .student-shell .orgm-row-class .orgm-name,
  body.mk-user-ui .student-shell .orgm-row-member .orgm-name { grid-column: 1 / 3; }
  body.mk-user-ui .student-shell .orgm-action-menu summary { min-width: 44px; min-height: 44px; display: grid; place-items: center; }
  body.mk-user-ui .student-shell .orgm-head:has(input[type=checkbox]) { display: flex; align-items: center; gap: 10px; }
  body.mk-user-ui .student-shell .orgm-head:has(input[type=checkbox]) > :not(.orgm-check) { display: none; }
  body.mk-user-ui .student-shell .orgm-head:has(input[type=checkbox])::after { content: 'انتخاب همهٔ این صفحه'; font-size: 13px; }
}

/* Screenshot follow-up: resolve the remaining narrow-phone collisions without
   changing desktop geometry or the application's render/data paths. */
@media screen and (max-width: 820px), screen and (max-height: 520px) and (pointer: coarse) {
  /* Fit the actual day-cell width, including narrow phones. Extra exams grow
     the row; button minimum sizes must never exceed their grid tracks. */
  body.mk-user-ui .pl-cal-marks {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 28px), 28px));
    gap: 3px;
    width: 100%;
    min-height: 0;
    place-content: start center;
  }
  body.mk-user-ui .pl-cal-marks .pl-cal-mark {
    width: 100%; min-width: 0; min-height: 0; aspect-ratio: 1;
  }
  body.mk-user-ui .pl-cal-marks .pl-cal-logo {
    width: 100%; height: 100%; max-width: 28px; max-height: 28px;
  }

  body.mk-user-ui #modalRoot .pl-modal-head { padding: 12px; gap: 8px; }
  body.mk-user-ui #modalRoot .pl-modal-logo { width: 36px; height: 36px; flex: 0 0 36px; }
  body.mk-user-ui #modalRoot .pl-modal-head h2 { min-width: 0; font-size: 14px; line-height: 1.7; }
  body.mk-user-ui #modalRoot .pl-modal-head h2 small { font-size: 11px; }
  body.mk-user-ui #modalRoot .pl-modal-body { padding: 12px; }
  body.mk-user-ui #modalRoot .pl-modal-body .pl-budget { gap: 6px; }
  body.mk-user-ui #modalRoot .pl-modal-body .pl-budget > li { padding: 6px; gap: 4px; }
  body.mk-user-ui #modalRoot .pl-modal-body .pl-budget-book { font-size: 12px; }
  body.mk-user-ui #modalRoot .pl-modal-body .pl-budget-all { font-size: 11px; }
  body.mk-user-ui #modalRoot .pl-modal-body .pl-budget-chip {
    min-width: 0; max-width: 100%; padding: 3px 6px;
    font-size: 11px; line-height: 1.7; overflow-wrap: anywhere;
  }
  body.mk-user-ui #modalRoot .pl-modal-body .pl-budget-chip i { font-size: 10.5px; }
  body.mk-user-ui #modalRoot .pl-modal-footer {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
    padding: 10px 12px; gap: 8px;
  }
  body.mk-user-ui #modalRoot .pl-modal-footer > button { min-width: 0; padding: 8px; font-size: 12px; }
  body.mk-user-ui #modalRoot #plModalGo .ui-icon { display: none; }

  /* Personal-exam picker: three long mode labels must form one deliberate row,
     not a 2+1 wrapped flex layout with a large empty cell. */
  body.mk-user-ui #modalRoot .exam-picker .ep-mode {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
    width: 100%;
  }
  body.mk-user-ui #modalRoot .exam-picker .ep-mode:has([data-ep-mode="direct"]) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  body.mk-user-ui #modalRoot .exam-picker .ep-mode .seg {
    min-width: 0;
    min-height: 58px;
    padding: 7px 4px;
    white-space: normal;
    line-height: 1.65;
    text-align: center;
    justify-content: center;
  }

  /* The comparison action used to live inside one oversized date pill. A
     plain day header gives both the date and action their own usable space. */
  body.mk-user-ui .pl-rm-date {
    width: 100%;
    min-height: 44px;
    margin: 0 0 8px;
    padding: 2px 4px;
    gap: 6px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }
  body.mk-user-ui .pl-rm-date > b { font-size: 19px; }
  body.mk-user-ui .pl-rm-date > span { font-size: 13px; }
  body.mk-user-ui .pl-rm-date > small {
    padding: 4px 8px;
    border: 0;
    border-radius: 999px;
    background: #f2eee8;
    color: #a84a13;
    font-size: 10px;
  }
  body.mk-user-ui .pl-rm-date .pl-rm-compare {
    flex: 0 0 auto;
    min-height: 40px;
    margin-inline-start: auto;
    padding-inline: 12px;
    border-radius: 12px;
    background: #fff;
    white-space: nowrap;
  }

  /* Exam section switch: a bounded grid is more useful than a clipped RTL
     scroller and keeps every destination visible. */
  body.mk-user-ui .student-shell .exam-head + .exam-hub-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
    margin: 0 0 18px;
    padding: 5px;
    gap: 5px;
    overflow: visible;
  }
  body.mk-user-ui .student-shell .exam-head + .exam-hub-tabs .exam-hub-tab {
    min-width: 0;
    min-height: 48px;
    padding: 8px 5px;
    gap: 5px;
    border-radius: 12px;
    font-size: 11px;
    line-height: 1.45;
    white-space: normal;
  }
  body.mk-user-ui .student-shell .exam-head + .exam-hub-tabs .exam-hub-tab svg {
    width: 15px;
    height: 15px;
    flex: 0 0 auto;
  }

  /* Exam cards: header, three equal stats, organizer, result/date, then actions. */
  body.mk-user-ui .student-shell .exam-table .exam-tr,
  body.mk-user-ui .student-shell .exam-table .exam-tr:nth-child(odd) {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    grid-template-areas:
      "name name name name status status"
      "questions questions duration duration booklets booklets"
      "org org org org org org"
      "metric metric metric date date date"
      "actions actions actions actions actions actions";
    gap: 12px 8px;
    padding: 16px;
    border: 1px solid var(--mk-line);
    background: #fff;
    box-shadow: 0 4px 16px #342a1906;
    align-items: start;
  }
  body.mk-user-ui .student-shell .exam-table { gap: 14px; }
  body.mk-user-ui .student-shell .exam-table .exam-tr.pinned {
    border-color: #edc5a4;
    box-shadow: inset 0 3px #efac78;
  }
  body.mk-user-ui .student-shell .exam-table .exam-td-name {
    align-content: start;
    gap: 5px;
  }
  body.mk-user-ui .student-shell .exam-table .exam-name-line > b {
    overflow-wrap: anywhere;
    line-height: 1.65;
  }
  body.mk-user-ui .student-shell .exam-table .exam-name-sub { flex-wrap: wrap; }
  body.mk-user-ui .student-shell .exam-table .exam-name-sub > small {
    padding: 2px 7px;
    border-radius: 6px;
    background: #f5f4f0;
    font-size: 10px;
    line-height: 1.6;
  }
  body.mk-user-ui .student-shell .exam-table .exam-td-status .exam-state {
    max-width: 100%;
    padding: 5px 8px;
    font-size: 10px;
    white-space: normal;
    text-align: center;
    line-height: 1.6;
  }
  body.mk-user-ui .student-shell .exam-table :is(.exam-td-questions, .exam-td-duration, .exam-td-booklets) {
    padding: 10px 4px;
    border: 1px solid #f0ede6;
    border-radius: 12px;
    background: #faf9f6;
    text-align: center;
    gap: 4px;
    font-size: 12px;
    line-height: 1.7;
    align-self: stretch;
  }
  body.mk-user-ui .student-shell .exam-table .exam-td-org {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 8px;
    font-size: 12px;
    overflow-wrap: anywhere;
  }
  body.mk-user-ui .student-shell .exam-table .exam-td-date,
  body.mk-user-ui .student-shell .exam-table .exam-td-metric {
    min-width: 0;
    align-self: stretch;
    padding: 10px;
    border-radius: 12px;
    background: #f8f9f9;
    gap: 6px;
    line-height: 1.6;
  }
  body.mk-user-ui .student-shell .exam-table .exam-td .exam-cwb {
    justify-content: flex-start;
    font-size: 13px;
    gap: 4px;
  }
  body.mk-user-ui .student-shell .exam-table .exam-run-date {
    display: flex;
    flex-direction: row-reverse;
    align-items: baseline;
    justify-content: flex-start;
    gap: 5px;
    text-align: right;
    white-space: nowrap;
    font-size: 11px;
    line-height: 1.55;
  }
  body.mk-user-ui .student-shell .exam-table .exam-run-date small { font-size: 10px; }
  body.mk-user-ui .student-shell .exam-table .exam-td-actions {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    align-items: stretch;
    white-space: normal;
    gap: 7px;
  }
  body.mk-user-ui .student-shell .exam-table .exam-td-actions > .exam-window-state {
    grid-column: 1 / -1;
    order: -2;
    display: block;
    width: 100%;
    max-width: none;
    padding: 9px 10px;
    border-radius: 10px;
    background: #faf6ed;
    white-space: normal;
    overflow-wrap: anywhere;
    font-size: 11px;
    line-height: 1.8;
  }
  body.mk-user-ui .student-shell .exam-table .exam-td-actions > .exam-window-state.closed {
    background: #fcf1ef;
  }
  body.mk-user-ui .student-shell .exam-table .exam-td-actions :is(.exam-iconbtn, button) {
    width: 100%;
    min-width: 0;
    min-height: 46px;
    margin: 0;
  }
  body.mk-user-ui .student-shell .exam-table .exam-td-actions :is(.primary-button, .exam-report-btn) {
    grid-column: span 2;
    order: -1;
    white-space: normal;
    line-height: 1.7;
    padding: 8px;
  }

  /* Question-bank controls: remove the redundant outer card and use a stable
     two-column form; long-range and search controls own a complete row. */
  body.mk-user-ui .student-shell .sbank-topbar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 12px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
  }
  body.mk-user-ui .student-shell .sbank-topbar > .seg-group {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
  }
  body.mk-user-ui .student-shell .sbank-topbar > .seg-group .seg {
    min-width: 0;
    min-height: 44px;
    padding-inline: 5px;
    justify-content: center;
  }
  body.mk-user-ui .student-shell .sbank-topbar > :is(.sbank-chip, .sbank-year-wrap, .arc-range-wrap, .sbank-search) { min-width: 0; }
  body.mk-user-ui .student-shell .sbank-topbar > :is(.sbank-year-wrap, .arc-range-wrap, .sbank-search) { grid-column: 1 / -1; width: 100%; }
  body.mk-user-ui .student-shell .sbank-topbar :is(.sbank-chip, .sbank-year-wrap > .sbank-chip, .arc-range-wrap > .sbank-chip) {
    width: 100%;
    min-height: 46px;
    justify-content: flex-start;
    padding-inline: 12px;
  }
  body.mk-user-ui .student-shell .sbank-topbar .sbank-search input { min-height: 50px; }

  /* Filter sheet footer: keep the main action fully inside the sheet and away
     from browser/home indicators instead of merging it into the screen edge. */
  body.mk-user-ui .mk-filter-sheet { padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)) !important; }
  body.mk-user-ui .mk-filter-sheet > .mk-filter-done {
    bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    min-height: 54px;
    margin: 18px 0 0;
    padding: 10px 16px;
    border-radius: 15px;
    box-shadow: 0 8px 24px rgba(184, 76, 19, .2);
  }

  /* Subscription summary: stop grid rows from stretching to the height of the
     surrounding panel. The renewal action remains a full-width touch target. */
  body.mk-user-ui .shop-mine .shop-mine-rows {
    display: grid;
    grid-auto-flow: row;
    grid-auto-columns: auto;
    gap: 10px;
    overflow: visible;
  }
  body.mk-user-ui .shop-mine-row {
    grid-template-columns: 52px minmax(0, 1fr) auto;
    grid-template-areas: "cover info days" "cta cta cta";
    align-content: start;
    align-items: center;
    min-height: 0;
    gap: 10px;
    padding: 12px;
  }
  body.mk-user-ui .shop-mine-row > :is(.shop-cover, .shop-mine-dot) { grid-area: cover; }
  body.mk-user-ui .shop-mine-row .shop-mine-info { grid-area: info; }
  body.mk-user-ui .shop-mine-row .shop-mine-info > b { white-space: normal; line-height: 1.65; }
  body.mk-user-ui .shop-mine-row .shop-mine-left {
    grid-area: days;
    display: grid;
    justify-items: center;
    padding: 0;
  }
  body.mk-user-ui .shop-mine-row .shop-mine-cta {
    grid-area: cta;
    width: 100%;
    min-height: 46px;
    justify-content: center;
  }
}

@media screen and (max-width: 370px) {
  body.mk-user-ui .student-shell .exam-head + .exam-hub-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body.mk-user-ui .student-shell .exam-table .exam-td-date { padding-inline: 8px; }
  body.mk-user-ui .student-shell .exam-table .exam-run-date { font-size: 10px; gap: 4px; }
  body.mk-user-ui .student-shell .exam-table .exam-td-actions { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  body.mk-user-ui .student-shell .exam-table .exam-td-actions :is(.primary-button, .exam-report-btn) { grid-column: 1 / -1; }
  body.mk-user-ui .shop-mine-row {
    grid-template-columns: 48px minmax(0, 1fr);
    grid-template-areas: "cover info" "days days" "cta cta";
  }
  body.mk-user-ui .shop-mine-row .shop-mine-left { display: flex; justify-content: flex-start; gap: 6px; }
}

/* Mobile report layouts: totals, nested analysis and answer sheets use the
   available width instead of retaining desktop table/column dimensions. */
@media screen and (max-width: 820px), screen and (max-height: 520px) and (pointer: coarse) {
  body.mk-user-ui .student-shell .sidebar .brand { min-height: 58px; gap: 7px; margin-bottom: 6px; padding-inline-end: 38px; }
  body.mk-user-ui .student-shell .sidebar .brand-mark { width: 38px; height: 32px; flex-basis: 38px; }
  body.mk-user-ui .student-shell .sidebar .brand-copy { min-width: 0; }
  body.mk-user-ui .student-shell .sidebar .brand-type { max-width: 104px; height: auto; }
  body.mk-user-ui .student-shell .sidebar .brand-copy span { font-size: 10px; }
  body.mk-user-ui .student-shell .sidebar .mk-drawer-close { top: calc(14px + env(safe-area-inset-top, 0px)); left: 10px; width: 36px; height: 36px; border-radius: 12px; }

  body.mk-user-ui .student-shell .rr-report-page { gap: 12px; }
  body.mk-user-ui .student-shell .rr-report-page-body { padding: 0; border: 0; background: transparent; box-shadow: none; }
  body.mk-user-ui .student-shell .rr-report-page-tabs { top: var(--m-bar-h); padding: 5px; gap: 5px; }
  body.mk-user-ui .student-shell .rr-report-page-tabs button { min-width: max-content; min-height: 44px; padding: 8px 12px; font-size: 12px; }
  body.mk-user-ui .student-shell .rr-section-head { flex-wrap: wrap; align-items: flex-start; padding: 12px; gap: 10px; }
  body.mk-user-ui .student-shell .rr-section-head > div:first-child { flex: 1 1 100%; min-width: 0; }
  body.mk-user-ui .student-shell .rr-section-head h3 { font-size: 15px; }
  body.mk-user-ui .student-shell .rr-section-head p { font-size: 12px; line-height: 1.85; }
  body.mk-user-ui .student-shell :is(.rr-legend, .rr-sheet-legend) { flex-wrap: wrap; gap: 6px; }
  body.mk-user-ui .student-shell :is(.rr-legend, .rr-sheet-legend) > span { font-size: 10px; padding: 4px 8px; }
  body.mk-user-ui .student-shell .rr-ov-info { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  body.mk-user-ui .student-shell .rr-ov-info article { padding: 10px; gap: 7px; min-height: 64px; flex-wrap: wrap; }
  body.mk-user-ui .student-shell .rr-ov-info article > i { width: 28px; height: 28px; }
  body.mk-user-ui .student-shell .rr-ov-info article > div { flex: 1 1 80px; }
  body.mk-user-ui .student-shell .rr-ov-info article :is(b, span) { white-space: normal; overflow-wrap: anywhere; }
  body.mk-user-ui .student-shell .rr-ov-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body.mk-user-ui .student-shell .rr-booklet-result > header { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px; }
  body.mk-user-ui .student-shell .rr-booklet-result > header .rr-booklet-summary { flex-wrap: wrap; }
  body.mk-user-ui .student-shell .rr-lt-wrap { overflow: visible; }
  body.mk-user-ui .student-shell .rr-lt.mk-record-table { font-size: 12px; }
  body.mk-user-ui .student-shell .rr-lt.mk-record-table :is(tbody, tfoot) { display: grid; gap: 8px; padding: 8px; }
  body.mk-user-ui .student-shell .rr-lt.mk-record-table :is(tbody, tfoot) tr {
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px 4px;
    padding: 10px; margin: 0; border: 1px solid var(--mk-line); border-radius: 12px;
  }
  body.mk-user-ui .student-shell .rr-lt.mk-record-table tfoot tr { background: #faf5ec; }
  body.mk-user-ui .student-shell .rr-lt.mk-record-table td {
    display: grid; justify-items: center; align-content: start; gap: 4px;
    min-width: 0; padding: 3px 0; border: 0; background: transparent; white-space: normal; text-align: center;
  }
  body.mk-user-ui .student-shell .rr-lt.mk-record-table td::before { margin: 0; font-size: 10px; font-weight: 700; }
  body.mk-user-ui .student-shell .rr-lt.mk-record-table td.lesson { grid-column: 1 / -1; justify-items: start; padding-bottom: 5px; }
  body.mk-user-ui .student-shell .rr-lt.mk-record-table td.lesson::before { display: none; }
  body.mk-user-ui .student-shell .rr-lt.mk-record-table td.percent { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; padding: 6px 0; }
  body.mk-user-ui .student-shell .rr-lt.mk-record-table :is(td.time, td.rank) { grid-column: span 2; }
  body.mk-user-ui .student-shell .rr-lt-num { min-width: 28px; padding: 3px 7px; font-size: 12px; }
  body.mk-user-ui .student-shell .rr-lt-percent { width: 40%; min-width: 0; }

  body.mk-user-ui .student-shell .rr-analysis-tree { overflow: visible; padding: 6px; }
  body.mk-user-ui .student-shell .rra-row { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 8px 4px; padding: 10px 4px; }
  body.mk-user-ui .student-shell .rra-name b { white-space: normal; overflow-wrap: anywhere; font-size: 12px; }
  body.mk-user-ui .student-shell .rra-name small { font-size: 10px; }
  body.mk-user-ui .student-shell .rra-row .rr-tree-metrics {
    grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-auto-flow: row; grid-auto-columns: auto; gap: 5px; width: 100%; margin: 0;
  }
  body.mk-user-ui .student-shell .rra-row .rr-metric { min-width: 0; padding: 6px 3px; white-space: normal; overflow: visible; font-size: 10px; }
  body.mk-user-ui .student-shell .rra-row .rr-metric b { font-size: 11px; }
  body.mk-user-ui .student-shell .rra-kids { margin-inline-start: 4px; padding-inline-start: 5px; }
  body.mk-user-ui .student-shell .rr-answer-ctx { flex-wrap: wrap; gap: 6px; }
  body.mk-user-ui .student-shell .rr-answer-ctx small { font-size: 11px; }
  body.mk-user-ui .student-shell .rr-answers .sq-item { padding: 10px; border-radius: 16px; }

  body.mk-user-ui .student-shell .rr-sheet-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  body.mk-user-ui .student-shell .rr-sheet-summary > span { min-width: 0; padding: 8px; }
  body.mk-user-ui .student-shell .rr-answer-sheet { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 8px; padding: 0; width: 100%; }
  /* Keep each existing ten-question group together; two groups share a row. */
  body.mk-user-ui .student-shell .rr-sheet-column { display: grid; min-width: 0; border-radius: 10px; }
  body.mk-user-ui .student-shell .rr-sheet-question {
    grid-template-columns: 20px repeat(4, minmax(0, 1fr)); gap: 3px; min-height: 44px;
    padding: 6px 4px; border: 0; border-top: 1px dashed #e3ddd2; border-radius: 0;
  }
  body.mk-user-ui .student-shell .rr-sheet-question:first-child { border-top: 0; }
  body.mk-user-ui .student-shell .rr-sheet-question > b { font-size: 11px; }
  body.mk-user-ui .student-shell .rr-sheet-question > i { width: min(22px, 100%); height: 24px; font-size: 10px; }
}

/* Keep the doubt choice above the question on both native and rotated phones. */
body.mk-user-ui .exam-runner.er-phone .er-qhead { order: -2; }
body.mk-user-ui .exam-runner.er-phone .er-doubt-row { order: -1; display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; padding: 8px 10px; }
body.mk-user-ui .exam-runner.er-phone .er-doubt-row > small { flex-basis: 100%; }
body.mk-user-ui .exam-runner.er-phone .er-doubt-opts { gap: 5px; }
body.mk-user-ui .exam-runner.er-phone .er-doubt-opt { min-width: 36px; min-height: 36px; padding-inline: 9px; }
body.mk-user-ui .exam-runner.er-phone .er-timer-mini { font-size: 12px; padding: 4px 7px; }
body.mk-user-ui .exam-runner.er-phone .er-sheet-toggle { gap: 4px; padding-inline: 7px; font-size: 11px; }

/* Exam discovery: readable hall cards and bank branches without desktop widths. */
@media screen and (max-width: 820px), screen and (max-height: 520px) and (pointer: coarse) {
  body.mk-user-ui .student-shell :is(.hall-panel, .exam-bank) { padding: 12px; }
  body.mk-user-ui .student-shell :is(.hall-panel, .exam-bank) .exam-panel-head { gap: 10px; }
  body.mk-user-ui .student-shell :is(.hall-panel, .exam-bank) .exam-panel-head p { font-size: 12px; line-height: 1.85; }
  body.mk-user-ui .student-shell .hall-toolbar { display: grid; grid-template-columns: minmax(0, 1fr); padding: 12px 0; gap: 12px; }
  body.mk-user-ui .student-shell .hall-toolbar-filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; align-items: stretch; }
  body.mk-user-ui .student-shell .hall-toolbar-filters > button { grid-column: 1 / -1; grid-row: 2; justify-content: center; }
  body.mk-user-ui .student-shell .hall-toolbar :is(label, select) { min-width: 0; width: 100%; }
  body.mk-user-ui .student-shell .hall-toolbar select { height: 44px; padding-inline: 8px; }
  body.mk-user-ui .student-shell .hall-toolbar-rankings { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  body.mk-user-ui .student-shell .hall-toolbar-rankings button { min-width: 0; justify-content: center; white-space: normal; font-size: 11px; padding: 8px; }
  body.mk-user-ui .student-shell :is(.hall-active-filters, .hall-demo-note) { margin: 0 0 12px; }
  body.mk-user-ui .student-shell .hall-filter-chip { max-width: 100%; white-space: normal; }
  body.mk-user-ui .student-shell .hall-filter-chip button { flex: none; min-width: 28px; min-height: 28px; }
  body.mk-user-ui .student-shell .hall-results-head { padding: 4px 0 12px; }
  body.mk-user-ui .student-shell .hall-scroll-hint { display: none; }
  body.mk-user-ui .student-shell .hall-exam-scroll { margin: 0; border: 0; overflow: visible; background: transparent; }
  body.mk-user-ui .student-shell .hall-exam-table colgroup { display: none; }
  body.mk-user-ui .student-shell .hall-exam-table.mk-record-table tbody { gap: 12px; }
  body.mk-user-ui .student-shell .hall-exam-table.mk-record-table tbody tr {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    grid-template-areas: "name name name name name name" "org org org org org org" "questions questions time time participants participants" "rating rating difficulty difficulty match match" "date date date date date date" "join join join join join join";
    gap: 8px; padding: 14px; border-radius: 18px; background: #fff;
  }
  body.mk-user-ui .student-shell .hall-exam-table.mk-record-table td {
    position: static; display: grid; align-content: start; justify-items: center; gap: 4px;
    min-width: 0; padding: 9px 3px; border: 0; border-radius: 10px;
    background: #f7f6f3; text-align: center; white-space: normal; overflow-wrap: anywhere; box-shadow: none;
  }
  body.mk-user-ui .student-shell .hall-exam-table.mk-record-table td::before { margin: 0; font-size: 10px; line-height: 1.65; }
  body.mk-user-ui .student-shell .hall-exam-table.mk-record-table td:nth-child(1) { grid-area: name; display: block; padding: 0; background: transparent; text-align: start; font-size: 15px; line-height: 1.8; }
  body.mk-user-ui .student-shell .hall-exam-table.mk-record-table td:nth-child(1)::before,
  body.mk-user-ui .student-shell .hall-exam-table.mk-record-table td:last-child::before { display: none; }
  body.mk-user-ui .student-shell .hall-exam-table.mk-record-table td:nth-child(2) { grid-area: org; display: flex; align-items: baseline; gap: 6px; padding: 0 0 4px; background: transparent; text-align: start; }
  body.mk-user-ui .student-shell .hall-exam-table.mk-record-table .hall-text-button { min-width: 0; white-space: normal; text-align: start; overflow-wrap: anywhere; }
  body.mk-user-ui .student-shell .hall-exam-table.mk-record-table td:nth-child(3) { grid-area: questions; }
  body.mk-user-ui .student-shell .hall-exam-table.mk-record-table td:nth-child(4) { grid-area: time; }
  body.mk-user-ui .student-shell .hall-exam-table.mk-record-table td:nth-child(5) { grid-area: date; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px; padding: 6px 0; background: transparent; font-size: 11px; }
  body.mk-user-ui .student-shell .hall-exam-table.mk-record-table td:nth-child(6) { grid-area: rating; background: #fff8eb; }
  body.mk-user-ui .student-shell .hall-exam-table.mk-record-table td:nth-child(7) { grid-area: participants; }
  body.mk-user-ui .student-shell .hall-exam-table.mk-record-table td:nth-child(8) { grid-area: difficulty; }
  body.mk-user-ui .student-shell .hall-exam-table.mk-record-table td:nth-child(9) { grid-area: match; background: #f1f8f5; }
  body.mk-user-ui .student-shell .hall-exam-table.mk-record-table td:last-child { grid-area: join; display: block; padding: 0; background: transparent; }
  body.mk-user-ui .student-shell .hall-join-button { width: 100%; min-height: 46px; border-radius: 12px; font-size: 12px; }

  body.mk-user-ui .hall-ranking-scroll { overflow: visible; }
  body.mk-user-ui .hall-ranking table.mk-record-table { display: block; width: 100%; min-width: 0; }
  body.mk-user-ui .hall-ranking table.mk-record-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  body.mk-user-ui .hall-ranking table.mk-record-table tbody { display: grid; gap: 10px; }
  body.mk-user-ui .hall-ranking table.mk-record-table tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 12px; border: 1px solid var(--mk-line); border-radius: 14px; background: #fff; }
  body.mk-user-ui .hall-ranking table.mk-record-table td { display: grid; gap: 4px; min-width: 0; padding: 6px 3px; border: 0; text-align: center; white-space: normal; overflow-wrap: anywhere; }
  body.mk-user-ui .hall-ranking table.mk-record-table td::before { content: attr(data-mk-label); font-size: 10px; color: var(--muted); }
  body.mk-user-ui .hall-ranking table.mk-record-table td:first-child { grid-column: 1; grid-row: 1; justify-items: center; }
  body.mk-user-ui .hall-ranking table.mk-record-table td:nth-child(2) { grid-column: 2 / -1; grid-row: 1; align-content: center; text-align: start; }
  body.mk-user-ui .hall-ranking table.mk-record-table td:nth-child(-n+2)::before { display: none; }
  body.mk-user-ui .hall-ranking-organizer table.mk-record-table td:last-child { grid-column: 1 / -1; }
  body.mk-user-ui .hall-ranking-organizer table.mk-record-table td:last-child::before { display: none; }
  body.mk-user-ui .hall-ranking .hall-text-button { min-height: 44px; white-space: normal; }

  body.mk-user-ui .student-shell .exam-bank .eb-layout { gap: 14px; }
  body.mk-user-ui .student-shell .exam-bank .eb-side { position: static; display: grid; gap: 10px; padding: 12px; border-radius: 16px; }
  body.mk-user-ui .student-shell .exam-bank .eb-side .exam-filter-title { padding: 0; border: 0; background: transparent; }
  body.mk-user-ui .student-shell .exam-bank .eb-view-switch { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
  body.mk-user-ui .student-shell .exam-bank .eb-view-btn { justify-content: center; min-height: 44px; padding: 8px; }
  body.mk-user-ui .student-shell .exam-bank .eb-topic-btn { width: 100%; justify-content: center; }
  body.mk-user-ui .student-shell .exam-bank .eb-topic-chip { max-width: 100%; white-space: normal; }
  body.mk-user-ui .student-shell .exam-bank .eb-main { min-width: 0; }
  body.mk-user-ui .student-shell .exam-bank .eb-tree { padding: 8px; border-radius: 16px; }
  body.mk-user-ui .student-shell .exam-bank .eb-children { margin-inline-start: 3px; padding-inline-start: 5px; }
  body.mk-user-ui .student-shell .exam-bank .eb-row { display: grid; grid-template-columns: 32px minmax(0, 1fr) 32px; gap: 8px 4px; padding: 10px 8px; margin-block: 5px; border-radius: 12px; }
  body.mk-user-ui .student-shell .exam-bank .eb-row > .eb-caret { grid-column: 1; grid-row: 1; width: 32px; height: 44px; }
  body.mk-user-ui .student-shell .exam-bank .eb-row > :is(.eb-caret-sp, .eb-check-sp) { display: none; }
  body.mk-user-ui .student-shell .exam-bank .eb-row > .eb-check { grid-column: 3; grid-row: 1; }
  body.mk-user-ui .student-shell .exam-bank .eb-check { display: grid; place-items: center; width: 32px; min-height: 44px; padding: 0; }
  body.mk-user-ui .student-shell .exam-bank .eb-check input { width: 20px; height: 20px; }
  body.mk-user-ui .student-shell .exam-bank .eb-row > .eb-name { grid-column: 2; grid-row: 1; min-width: 0; }
  body.mk-user-ui .student-shell .exam-bank .eb-branch > .eb-name { grid-column: 2 / -1; }
  body.mk-user-ui .student-shell .exam-bank .eb-row:not(:has(.eb-caret)) > .eb-name { grid-column: 1 / 3; }
  body.mk-user-ui .student-shell .exam-bank .eb-title-line { display: grid; gap: 5px; min-width: 0; }
  body.mk-user-ui .student-shell .exam-bank .eb-title-line > b { white-space: normal; overflow-wrap: anywhere; font-size: 13px; line-height: 1.8; }
  body.mk-user-ui .student-shell .exam-bank .eb-path { display: flex; flex-wrap: wrap; min-width: 0; max-width: 100%; white-space: normal; overflow: visible; line-height: 1.8; font-size: 10px; }
  body.mk-user-ui .student-shell .exam-bank .eb-path > * { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
  body.mk-user-ui .student-shell .exam-bank .eb-badges { grid-column: 1 / -1; grid-row: 2; width: auto; padding: 0; margin: 0; justify-content: flex-start; flex-wrap: wrap; }
  body.mk-user-ui .student-shell .exam-bank .eb-join { grid-column: 1 / -1; grid-row: 3; width: 100%; min-height: 44px; margin: 0; justify-content: center; font-size: 12px; }
  body.mk-user-ui .student-shell .exam-bank :is(.eb-row.picked, .eb-result.picked) { background: #fff5eb; border-color: #edbc94; }
  body.mk-user-ui .student-shell .exam-bank .eb-result { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 8px; padding: 12px; }
  body.mk-user-ui .student-shell .exam-bank .eb-result > .eb-check { grid-column: 1; grid-row: 1; }
  body.mk-user-ui .student-shell .exam-bank .eb-result-main { grid-column: 2; grid-row: 1; min-width: 0; }
  body.mk-user-ui .student-shell .exam-bank .eb-result-lessons { display: flex; flex-wrap: wrap; white-space: normal; }
  body.mk-user-ui .student-shell .exam-bank .eb-summary { padding: 10px; }
  body.mk-user-ui .student-shell .exam-bank .eb-summary-head { align-items: start; flex-wrap: wrap; gap: 8px; }
  body.mk-user-ui .student-shell .exam-bank .eb-summary-head b { font-size: 12px; line-height: 1.8; }
  body.mk-user-ui .student-shell .exam-bank .eb-clear { min-height: 36px; }
  body.mk-user-ui .student-shell .exam-bank .eb-pick-row { grid-template-columns: 24px minmax(0, 1fr) 36px; gap: 5px; padding: 8px; }
  body.mk-user-ui .student-shell .exam-bank .eb-pick-title { display: grid; gap: 4px; }
  body.mk-user-ui .student-shell .exam-bank .eb-pick-name { max-width: 100%; white-space: normal; }
  body.mk-user-ui .student-shell .exam-bank .eb-pick-count { grid-column: 2; white-space: normal; font-size: 10px; }
  body.mk-user-ui .student-shell .exam-bank .eb-pick-row > button { grid-column: 3; grid-row: 1 / 3; width: 36px; height: 44px; }
  body.mk-user-ui .student-shell .exam-bank .eb-pick-lessons { padding: 8px; }
  body.mk-user-ui .student-shell .exam-bank .eb-pick-lesson { max-width: 100%; flex-wrap: wrap; }
  body.mk-user-ui .student-shell .exam-bank .eb-pick-lesson button { width: 28px; height: 32px; }
  body.mk-user-ui .student-shell .exam-bank .eb-budget { padding: 10px; }
  body.mk-user-ui .student-shell .exam-bank .eb-budget-title { flex-wrap: wrap; }
  body.mk-user-ui .student-shell .exam-bank .eb-budget-row { grid-template-columns: minmax(0, 1fr) auto 36px; gap: 8px; padding-block: 12px; }
  body.mk-user-ui .student-shell .exam-bank .eb-budget-main { grid-column: 1 / -1; grid-row: 1; display: grid; gap: 4px; }
  body.mk-user-ui .student-shell .exam-bank .eb-budget-path { flex-wrap: wrap; white-space: normal; }
  body.mk-user-ui .student-shell .exam-bank .eb-budget-path i { max-width: 100%; white-space: normal; }
  /* Put the controls and expanded details on separate rows of the same grid. */
  body.mk-user-ui .student-shell .exam-bank :is(.eb-budget-actions, .eb-budget-detail-wrap) { display: contents; }
  body.mk-user-ui .student-shell .exam-bank .eb-budget-detail-btn { grid-column: 1; grid-row: 2; min-height: 44px; white-space: normal; }
  body.mk-user-ui .student-shell .exam-bank .eb-budget-count { grid-column: 2; grid-row: 2; width: auto; font-size: 11px; }
  body.mk-user-ui .student-shell .exam-bank .eb-budget-remove { grid-column: 3; grid-row: 2; width: 36px; height: 44px; }
  body.mk-user-ui .student-shell .exam-bank .eb-budget-popover {
    grid-column: 1 / -1; grid-row: 3; position: static; width: 100%; min-width: 0;
    margin: 0; max-height: none; overflow: visible; gap: 0; padding: 10px; box-shadow: none; white-space: normal;
  }
  body.mk-user-ui .student-shell .exam-bank .eb-budget-popover::before { display: none; }
  body.mk-user-ui .student-shell .exam-bank .eb-budget-popover-head { padding-bottom: 8px; }
  body.mk-user-ui .student-shell .exam-bank .eb-budget-popover-head button { flex: none; width: 36px; height: 44px; }
  body.mk-user-ui .student-shell .exam-bank .eb-budget-section {
    grid-template-columns: minmax(0, 1fr) 36px; gap: 5px 8px; padding: 10px 0;
    border-bottom: 1px solid #f0e9dd;
  }
  body.mk-user-ui .student-shell .exam-bank .eb-budget-section:last-child { border-bottom: 0; padding-bottom: 0; }
  body.mk-user-ui .student-shell .exam-bank .eb-budget-section i { grid-column: 1; grid-row: 1; white-space: normal; overflow: visible; overflow-wrap: anywhere; line-height: 1.85; }
  body.mk-user-ui .student-shell .exam-bank .eb-budget-section b { grid-column: 1; grid-row: 2; justify-self: start; }
  body.mk-user-ui .student-shell .exam-bank .eb-budget-section-remove { grid-column: 2; grid-row: 1 / 3; width: 36px; height: 44px; }
  body.mk-user-ui .student-shell .exam-bank .eb-build { white-space: normal; font-size: 12px; }

  body.mk-user-ui .exam-bank-build .eb-booklet-card { grid-template-columns: 28px minmax(0, 1fr) 36px; gap: 8px; }
  body.mk-user-ui .exam-bank-build .eb-booklet-card .field { min-width: 0; }
  body.mk-user-ui .exam-bank-build .eb-booklet-time { grid-column: 2; grid-row: 2; }
  body.mk-user-ui .exam-bank-build .eb-booklet-card > .row-action { grid-column: 3; grid-row: 1 / 3; width: 36px; min-height: 44px; }
  body.mk-user-ui .exam-bank-build .eb-stage-row { grid-template-columns: 20px 28px minmax(0, 1fr); gap: 8px; }
  body.mk-user-ui .exam-bank-build .eb-stage-name { grid-column: 3; }
  body.mk-user-ui .exam-bank-build :is(.eb-stage-paths, .eb-stage-booklet) { grid-column: 1 / -1; }
  body.mk-user-ui .exam-bank-build .eb-stage-paths > small { white-space: normal; }
  body.mk-user-ui .exam-bank-build .eb-stage-booklet select { width: 100%; min-height: 44px; }
}

/* Monthly questions, collection navigation and profile charts on small screens. */
@media screen and (max-width: 820px), screen and (max-height: 520px) and (pointer: coarse) {
  body.mk-user-ui .student-shell .mn-tabs {
    position: sticky; top: var(--m-bar-h); z-index: 44;
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-auto-flow: row; width: 100%; margin: 0 0 14px; padding: 5px;
    gap: 4px; overflow: visible; background: var(--mk-paper); border-radius: 14px;
  }
  body.mk-user-ui .student-shell .mn-tabs .exam-hub-tab {
    min-width: 0; min-height: 44px; padding: 8px 3px; font-size: 11px; white-space: normal;
  }
  body.mk-user-ui .mn-detail-head { gap: 8px; }
  body.mk-user-ui .mn-picked-list .sq-item { flex-direction: column; min-width: 0; }
  body.mk-user-ui .mn-picked-list .sq-rail {
    width: 100%; min-width: 0; flex-direction: row;
    border-inline-start: 0; border-top: 1px solid var(--mk-line);
  }
  body.mk-user-ui .mn-picked-list .sq-rail-cell {
    flex: 1 1 0; min-width: 0; min-height: 0; padding: 8px 4px; gap: 3px;
  }
  body.mk-user-ui .mn-picked-list .sq-rail-cell + .sq-rail-cell { border-top: 0; border-inline-start: 1px solid var(--mk-line); }
  body.mk-user-ui .mn-picked-list .sq-src-icon {
    width: 32px !important; height: 32px !important; min-width: 32px; min-height: 32px;
    max-width: 32px; max-height: 32px; margin: 0 auto;
  }
  body.mk-user-ui .mn-picked-list .sq-rail-cell b { font-size: 12px; }
  body.mk-user-ui .mn-picked-list .sq-rail-cell small { font-size: 10px; }
  body.mk-user-ui .mn-picked-list .sq-item { scroll-margin-top: calc(var(--m-bar-h) + 68px); }

  body.mk-user-ui .student-shell .qset-page-head { gap: 10px; }
  body.mk-user-ui .student-shell .qset-page-head h1 { font-size: 22px; }
  body.mk-user-ui .qset-page-head .head-actions {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; width: 100%;
  }
  body.mk-user-ui .qset-page-head .head-actions > button {
    min-width: 0; min-height: 44px; padding: 7px 8px; gap: 5px; justify-content: center; font-size: 11px;
  }
  body.mk-user-ui .qset-page-head .head-actions > button:last-child:nth-child(odd) { grid-column: 1 / -1; }
  body.mk-user-ui .qset-page-head .head-actions svg { width: 16px; height: 16px; flex: none; }
  body.mk-user-ui .qset-index-panel { position: static; max-height: none; padding: 12px; }
  body.mk-user-ui .qset-index-panel .qset-detail-head { margin-bottom: 8px; }
  body.mk-user-ui .qset-index-panel .qset-detail-head strong { font-size: 13px; }
  body.mk-user-ui .qset-index-panel #qsetDelete { padding: 5px; font-size: 11px; }
  body.mk-user-ui .qset-index-toggle {
    display: flex; width: 100%; align-items: center; justify-content: space-between;
    min-height: 44px; padding: 8px 10px; gap: 8px; border: 1px solid var(--mk-line);
    border-radius: 10px; background: #fff; font: inherit; font-size: 12px; font-weight: 800;
  }
  body.mk-user-ui .qset-index-panel:not(.is-expanded) .qset-index-tools { display: none; }
  body.mk-user-ui .qset-index-panel.is-expanded .qset-index-toggle svg { transform: rotate(180deg); }
  body.mk-user-ui .qset-index-tools { margin-top: 10px; }
  body.mk-user-ui .qset-index-panel .qset-question-list {
    max-height: min(320px, 45dvh); overflow-y: auto; overscroll-behavior-y: contain; gap: 5px;
  }
  body.mk-user-ui .qset-index-panel .qset-question-row {
    grid-template-columns: 28px minmax(0, 1fr) 36px; min-height: 52px; padding: 6px; gap: 6px;
  }
  body.mk-user-ui .qset-index-panel .qset-row-no { width: 28px; height: 28px; font-size: 12px; }
  body.mk-user-ui .qset-index-panel .qset-row-actions { grid-column: 3; grid-row: 1; }
  body.mk-user-ui .qset-index-panel .qset-row-actions button { min-width: 36px; width: 36px; min-height: 44px; }
  body.mk-user-ui .qset-index-panel .qset-row-main small { font-size: 10px; }

  body.mk-user-ui .sp-level-help summary { min-height: 36px; font-size: 12px; }
  body.mk-user-ui .sp-level-help[open] { margin-inline-start: 0; }
  body.mk-user-ui .sp-level-tip { padding: 8px; }
  body.mk-user-ui .sp-bell-caption { display: grid; grid-template-columns: minmax(0, 1fr); gap: 5px; padding: 0 0 14px; }
  body.mk-user-ui .sp-bell-caption > span { justify-content: center; font-size: 12px; }
  body.mk-user-ui .sp-bell-tick text { fill: #655c50; font-weight: 800; }
  body.mk-user-ui .sp-subject-score-grid strong,
  body.mk-user-ui .sat-summary strong { font-size: 20px; }
  body.mk-user-ui .sp-subject-score-grid small,
  body.mk-user-ui .sat-summary small { font-size: 11px; white-space: normal; }
  body.mk-user-ui .sat-grid text,
  body.mk-user-ui .sp-exam-trend-grid text { font-size: 12px; fill: #655c50; }
  body.mk-user-ui .sat-x text.count { font-size: 12px; fill: #716657; }
}
