/* Explainables Exam Mode — dedicated mobile presentation owner (2026-08-13)
   This file is loaded only by /m/exam and intentionally comes after the shared
   Exam Mode styles. Shared state/API/teaching runtimes remain unchanged. */

@media (max-width: 900px) {
  html[data-explainables-surface="mobile"] {
    --ex-mobile-gutter: 16px;
    --ex-mobile-radius: 18px;
    --ex-mobile-bar: rgba(18,18,20,.94);
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  html[data-explainables-surface="mobile"] body,
  html[data-explainables-surface="mobile"] .ex-app {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: hidden !important;
    background: #000 !important;
  }

  html[data-explainables-surface="mobile"] .ex-screen {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    padding-left: var(--ex-mobile-gutter) !important;
    padding-right: var(--ex-mobile-gutter) !important;
  }

  html[data-explainables-surface="mobile"] img,
  html[data-explainables-surface="mobile"] svg,
  html[data-explainables-surface="mobile"] video,
  html[data-explainables-surface="mobile"] canvas {
    max-width: 100%;
  }

  /* hidden must always beat mobile display overrides */
  html[data-explainables-surface="mobile"] [hidden],
  html[data-explainables-surface="mobile"] .ex-entry-actions[hidden] {
    display: none !important;
  }

  /* ---------- Entry / landing ---------- */
  html[data-explainables-surface="mobile"] #examEntry {
    min-height: 100dvh !important;
    padding: max(12px, env(safe-area-inset-top)) var(--ex-mobile-gutter) 28px !important;
    background: #000 !important;
  }

  html[data-explainables-surface="mobile"] #examEntry .ex-topline {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 46px;
    padding: 0 !important;
    gap: 10px !important;
  }

  html[data-explainables-surface="mobile"] #examEntry .ex-brand {
    min-width: 0;
    gap: 9px !important;
  }

  html[data-explainables-surface="mobile"] #examEntry .ex-brand img {
    width: 34px !important;
    height: 34px !important;
    flex: 0 0 34px;
    border-radius: 9px !important;
  }

  html[data-explainables-surface="mobile"] #examEntry .ex-brand-copy {
    min-width: 0;
  }

  html[data-explainables-surface="mobile"] #examEntry .ex-brand-copy span {
    font-size: 8px !important;
    line-height: 1.15 !important;
    letter-spacing: .04em !important;
  }

  html[data-explainables-surface="mobile"] #examEntry .ex-brand-copy strong {
    font-size: 15px !important;
    line-height: 1.05 !important;
  }

  html[data-explainables-surface="mobile"] #examEntry .ex-home {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 0 13px !important;
    flex: 0 0 auto;
    border-radius: 999px !important;
    border: 1px solid rgba(255,255,255,.14) !important;
    background: rgba(255,255,255,.055) !important;
    color: rgba(255,255,255,.88) !important;
    font-size: 12px;
    font-weight: 650;
  }

  html[data-explainables-surface="mobile"] #examEntry .ex-entry-hero {
    display: block !important;
    flex: none !important;
    width: 100% !important;
    min-width: 0 !important;
    padding: clamp(48px, 9vh, 78px) 0 0 !important;
    text-align: left !important;
  }

  html[data-explainables-surface="mobile"] #examEntry .ex-entry-inner {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
  }

  html[data-explainables-surface="mobile"] #examEntry .ex-kicker {
    margin: 0 0 11px !important;
    color: #b5b5ba !important;
    font-size: 10px !important;
    line-height: 1.25 !important;
    letter-spacing: .075em !important;
    text-align: left !important;
  }

  html[data-explainables-surface="mobile"] #examEntry h1 {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    color: #fff !important;
    font-size: clamp(37px, 10.4vw, 48px) !important;
    line-height: .98 !important;
    letter-spacing: -.055em !important;
    font-weight: 735 !important;
    text-align: left !important;
    white-space: normal !important;
    overflow-wrap: normal !important;
    word-break: normal !important;
  }

  html[data-explainables-surface="mobile"] #examEntry .ex-entry-lead {
    width: 100% !important;
    max-width: 34rem !important;
    margin: 18px 0 0 !important;
    color: #a1a1a6 !important;
    font-size: 15px !important;
    line-height: 1.5 !important;
    text-align: left !important;
  }

  html[data-explainables-surface="mobile"] #examEntry .ex-entry-actions {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 9px !important;
    width: 100% !important;
    margin: 26px 0 0 !important;
  }

  html[data-explainables-surface="mobile"] #examEntry .ex-entry-actions[hidden] {
    display: none !important;
  }

  html[data-explainables-surface="mobile"] #examEntry .ex-entry-actions .ex-btn {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 50px !important;
    padding: 0 16px !important;
    border-radius: 15px !important;
    font-size: 14px !important;
    font-weight: 700 !important;
  }

  html[data-explainables-surface="mobile"] #examEntry .ex-entry-actions .ex-btn.primary {
    background: #f5f5f7 !important;
    border-color: #f5f5f7 !important;
    color: #111 !important;
    box-shadow: none !important;
  }

  html[data-explainables-surface="mobile"] #examEntry .ex-entry-note {
    margin: 17px 0 0 !important;
    color: #6e6e73 !important;
    font-size: 11px !important;
    line-height: 1.45 !important;
    text-align: left !important;
  }

  html[data-explainables-surface="mobile"] #examEntry .ex-room-strip {
    width: 100% !important;
    max-width: 100% !important;
    margin: 34px 0 0 !important;
    padding: 18px 0 0 !important;
    border: 0 !important;
    border-top: 1px solid rgba(255,255,255,.12) !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  html[data-explainables-surface="mobile"] #examEntry .ex-room-strip h2 {
    margin: 0 0 12px !important;
    color: #f5f5f7 !important;
    font-size: 17px !important;
    line-height: 1.25 !important;
  }

  html[data-explainables-surface="mobile"] #examEntry #examRecentRoomList {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 10px !important;
    width: 100% !important;
    padding: 0 !important;
    overflow: visible !important;
  }

  html[data-explainables-surface="mobile"] #examEntry #examRecentRoomList > .ex-room-mini,
  html[data-explainables-surface="mobile"] #examEntry #examRecentRoomList > .ex-recent-room {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    align-items: center !important;
    gap: 7px 12px !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    padding: 14px !important;
    flex: none !important;
    border: 1px solid rgba(255,255,255,.11) !important;
    border-radius: 16px !important;
    background: #151516 !important;
    overflow: hidden !important;
  }

  html[data-explainables-surface="mobile"] #examEntry .ex-recent-room h3,
  html[data-explainables-surface="mobile"] #examEntry .ex-room-mini strong {
    min-width: 0;
    margin: 0 !important;
    color: #f5f5f7 !important;
    font-size: 15px !important;
    line-height: 1.25 !important;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  html[data-explainables-surface="mobile"] #examEntry .ex-recent-room p,
  html[data-explainables-surface="mobile"] #examEntry .ex-room-mini span {
    grid-column: 1 !important;
    min-width: 0;
    margin: 0 !important;
    color: #8e8e93 !important;
    font-size: 12px !important;
    line-height: 1.35 !important;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  html[data-explainables-surface="mobile"] #examEntry .ex-recent-room .ex-btn,
  html[data-explainables-surface="mobile"] #examEntry .ex-room-mini .ex-btn {
    grid-column: 2 !important;
    grid-row: 1 / span 2 !important;
    min-width: 76px !important;
    width: auto !important;
    min-height: 38px !important;
    padding: 0 12px !important;
    border-radius: 12px !important;
    font-size: 11px !important;
  }

  /* ---------- Setup wizard ---------- */
  html[data-explainables-surface="mobile"] #examWizard {
    min-height: 100dvh !important;
    padding: max(12px, env(safe-area-inset-top)) var(--ex-mobile-gutter) 132px !important;
    background: #000 !important;
  }

  html[data-explainables-surface="mobile"] #examWizard .ex-wizard-head {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 13px !important;
    width: 100% !important;
    padding: 0 !important;
  }

  html[data-explainables-surface="mobile"] #examWizard .ex-brand img,
  html[data-explainables-surface="mobile"] #examTimetable .ex-brand img {
    width: 32px !important;
    height: 32px !important;
    border-radius: 8px !important;
  }

  html[data-explainables-surface="mobile"] #examWizard .ex-brand-copy span,
  html[data-explainables-surface="mobile"] #examTimetable .ex-brand-copy span {
    font-size: 8px !important;
  }

  html[data-explainables-surface="mobile"] #examWizard .ex-brand-copy strong,
  html[data-explainables-surface="mobile"] #examTimetable .ex-brand-copy strong {
    font-size: 14px !important;
  }

  html[data-explainables-surface="mobile"] #examWizard .ex-progress-wrap {
    width: 100% !important;
    max-width: none !important;
  }

  html[data-explainables-surface="mobile"] #examWizard .ex-progress {
    height: 4px !important;
  }

  html[data-explainables-surface="mobile"] #examWizard .ex-wizard-stage {
    width: 100% !important;
    max-width: 100% !important;
    margin: 38px 0 0 !important;
    padding: 0 !important;
    text-align: left !important;
  }

  html[data-explainables-surface="mobile"] #examWizard .ex-wizard-stage .ex-kicker {
    font-size: 10px !important;
    line-height: 1.35 !important;
    text-align: left !important;
  }

  html[data-explainables-surface="mobile"] #examWizard .ex-wizard-title {
    margin: 10px 0 12px !important;
    color: #f5f5f7 !important;
    font-size: clamp(31px, 9vw, 40px) !important;
    line-height: 1.02 !important;
    letter-spacing: -.045em !important;
    text-align: left !important;
  }

  html[data-explainables-surface="mobile"] #examWizard .ex-wizard-copy {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 0 24px !important;
    color: #a1a1a6 !important;
    font-size: 14px !important;
    line-height: 1.5 !important;
    text-align: left !important;
  }

  html[data-explainables-surface="mobile"] #examWizard .ex-step-content,
  html[data-explainables-surface="mobile"] #examWizard .ex-grid,
  html[data-explainables-surface="mobile"] #examWizard .ex-grid.two,
  html[data-explainables-surface="mobile"] #examWizard .ex-grid.three,
  html[data-explainables-surface="mobile"] #examWizard .ex-grid.four,
  html[data-explainables-surface="mobile"] #examWizard .ex-form-grid,
  html[data-explainables-surface="mobile"] #examWizard .ex-review-grid {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }

  html[data-explainables-surface="mobile"] #examWizard .ex-card-button,
  html[data-explainables-surface="mobile"] #examWizard .ex-choice-section,
  html[data-explainables-surface="mobile"] #examWizard .ex-review-card {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    padding: 15px !important;
    border-radius: 16px !important;
    background: #151516 !important;
  }

  html[data-explainables-surface="mobile"] #examWizard .ex-card-button strong {
    font-size: 16px !important;
    line-height: 1.25 !important;
  }

  html[data-explainables-surface="mobile"] #examWizard .ex-card-button > span:not(.ex-check) {
    font-size: 12px !important;
    line-height: 1.4 !important;
  }

  html[data-explainables-surface="mobile"] #examWizard .ex-input,
  html[data-explainables-surface="mobile"] #examWizard .ex-select,
  html[data-explainables-surface="mobile"] #examWizard .ex-textarea {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 50px !important;
    border-radius: 14px !important;
    font-size: 16px !important; /* prevents iOS zoom */
  }

  html[data-explainables-surface="mobile"] #examWizard .ex-dropzone {
    min-height: 156px !important;
    padding: 20px 14px !important;
    border-radius: 18px !important;
  }

  html[data-explainables-surface="mobile"] #examWizard .ex-file-card {
    width: 100% !important;
    min-width: 0 !important;
    border-radius: 15px !important;
  }

  html[data-explainables-surface="mobile"] #examWizard .ex-wizard-nav {
    z-index: 80 !important;
    padding: 10px var(--ex-mobile-gutter) calc(10px + env(safe-area-inset-bottom)) !important;
    background: linear-gradient(180deg, rgba(0,0,0,0), rgba(0,0,0,.94) 20%, #000 52%) !important;
  }

  html[data-explainables-surface="mobile"] #examWizard .ex-wizard-nav-inner {
    display: grid !important;
    grid-template-columns: 92px minmax(0,1fr) !important;
    grid-template-areas: "back continue" "skip skip" !important;
    gap: 7px !important;
    width: 100% !important;
    max-width: 560px !important;
    margin: 0 auto !important;
  }

  html[data-explainables-surface="mobile"] #examWizard #examWizardBack {
    grid-area: back !important;
    width: 92px !important;
    min-width: 0 !important;
    justify-self: stretch !important;
  }

  html[data-explainables-surface="mobile"] #examWizard #examWizardContinue {
    grid-area: continue !important;
    width: 100% !important;
    min-width: 0 !important;
  }

  html[data-explainables-surface="mobile"] #examWizard #examWizardSkip {
    grid-area: skip !important;
    width: 100% !important;
    min-width: 0 !important;
    min-height: 34px !important;
    justify-self: stretch !important;
    border-color: transparent !important;
    background: transparent !important;
    color: #8e8e93 !important;
  }

  /* ---------- Generation ---------- */
  html[data-explainables-surface="mobile"] #examGenerating {
    width: 100% !important;
    min-height: 100dvh !important;
    padding: max(18px, env(safe-area-inset-top)) var(--ex-mobile-gutter) max(18px, env(safe-area-inset-bottom)) !important;
    background: #000 !important;
  }

  html[data-explainables-surface="mobile"] #examGenerating .ex-generating-card {
    width: 100% !important;
    max-width: 520px !important;
    min-width: 0 !important;
    padding: 24px 18px !important;
    border-radius: 22px !important;
    background: #151516 !important;
    box-shadow: none !important;
  }

  html[data-explainables-surface="mobile"] #examGenerating .ex-generating-orbit {
    width: 82px !important;
    height: 82px !important;
    margin-bottom: 20px !important;
  }

  html[data-explainables-surface="mobile"] #examGenerating h1 {
    font-size: clamp(30px, 8.5vw, 38px) !important;
  }

  html[data-explainables-surface="mobile"] #examGenerating .ex-generation-item {
    gap: 10px !important;
    padding: 12px !important;
    border-radius: 14px !important;
    font-size: 12px !important;
  }

  html[data-explainables-surface="mobile"] #examGenerating .ex-generation-item span {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  /* ---------- Timetable ---------- */
  html[data-explainables-surface="mobile"] #examTimetable {
    width: 100% !important;
    min-height: 100dvh !important;
    padding: max(12px, env(safe-area-inset-top)) var(--ex-mobile-gutter) 154px !important;
    background: #000 !important;
  }

  html[data-explainables-surface="mobile"] #examTimetable .ex-topline {
    width: 100% !important;
    min-width: 0 !important;
    padding: 0 !important;
    gap: 10px !important;
  }

  html[data-explainables-surface="mobile"] #examTimetable .ex-save-state {
    flex: 0 1 auto;
    max-width: 42vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 10px !important;
  }

  html[data-explainables-surface="mobile"] #examTimetable .ex-width {
    width: 100% !important;
    max-width: 100% !important;
  }

  html[data-explainables-surface="mobile"] #examTimetable .ex-timetable-head {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 16px !important;
    width: 100% !important;
    margin: 40px 0 0 !important;
  }

  html[data-explainables-surface="mobile"] #examTimetable .ex-timetable-head h1 {
    margin: 8px 0 !important;
    font-size: clamp(31px, 9vw, 40px) !important;
    line-height: 1.02 !important;
  }

  html[data-explainables-surface="mobile"] #examTimetable .ex-timetable-summary {
    width: 100% !important;
    gap: 7px !important;
  }

  html[data-explainables-surface="mobile"] #examTimetable .ex-timetable-list {
    width: 100% !important;
    min-width: 0 !important;
    margin: 22px 0 0 !important;
    gap: 10px !important;
  }

  html[data-explainables-surface="mobile"] #examTimetable .ex-time-block {
    display: grid !important;
    grid-template-columns: 22px minmax(0,1fr) !important;
    gap: 9px !important;
    width: 100% !important;
    min-width: 0 !important;
    padding: 14px !important;
    border-radius: 16px !important;
    background: #151516 !important;
  }

  html[data-explainables-surface="mobile"] #examTimetable .ex-time-block > *:not(.ex-drag) {
    min-width: 0 !important;
    max-width: 100% !important;
  }

  html[data-explainables-surface="mobile"] #examTimetable .ex-timetable-actions {
    z-index: 80 !important;
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 7px !important;
    padding: 10px var(--ex-mobile-gutter) calc(10px + env(safe-area-inset-bottom)) !important;
    background: linear-gradient(180deg, rgba(0,0,0,0), rgba(0,0,0,.95) 20%, #000 52%) !important;
  }

  html[data-explainables-surface="mobile"] #examTimetable .ex-timetable-actions .ex-btn {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 46px !important;
    padding: 0 10px !important;
    border-radius: 14px !important;
    font-size: 12px !important;
  }

  html[data-explainables-surface="mobile"] #examTimetable #examAcceptTimetable {
    grid-column: 1 / -1 !important;
    grid-row: 1 !important;
  }

  /* ---------- Welcome ---------- */
  html[data-explainables-surface="mobile"] #examWelcome {
    width: 100% !important;
    min-height: 100dvh !important;
    padding: max(24px, env(safe-area-inset-top)) var(--ex-mobile-gutter) max(24px, env(safe-area-inset-bottom)) !important;
    background: #000 !important;
    text-align: left !important;
  }

  html[data-explainables-surface="mobile"] #examWelcome .ex-welcome-inner {
    width: 100% !important;
    max-width: 520px !important;
  }

  html[data-explainables-surface="mobile"] #examWelcome h1 {
    margin: 10px 0 12px !important;
    font-size: clamp(36px, 10vw, 46px) !important;
    text-align: left !important;
  }

  html[data-explainables-surface="mobile"] #examWelcome p {
    margin: 0 !important;
    font-size: 15px !important;
    text-align: left !important;
  }

  html[data-explainables-surface="mobile"] #examWelcome .ex-welcome-actions {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 8px !important;
    margin-top: 24px !important;
  }

  /* ---------- Dashboard ---------- */
  html[data-explainables-surface="mobile"] #examDashboard.ex-dashboard:not([hidden]) {
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100dvh !important;
    padding: 0 !important;
    background: #000 !important;
    overflow: hidden !important;
  }

  html[data-explainables-surface="mobile"] #examDashboard .ex-dash-shell {
    position: absolute !important;
    inset: 0 !important;
    display: grid !important;
    grid-template-columns: 1fr !important;
    grid-template-rows: minmax(0,1fr) auto !important;
    width: 100% !important;
    height: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    padding: 0 !important;
  }

  html[data-explainables-surface="mobile"] #examDashboard .ex-dash-main {
    grid-row: 1 !important;
    display: grid !important;
    grid-template-rows: auto minmax(0,1fr) !important;
    width: 100% !important;
    height: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }

  html[data-explainables-surface="mobile"] #examDashboard .ex-dash-topbar {
    display: grid !important;
    grid-template-columns: minmax(0,1fr) auto !important;
    min-height: 62px !important;
    padding: max(9px, env(safe-area-inset-top)) 12px 9px !important;
    gap: 8px !important;
    border-bottom: 1px solid rgba(255,255,255,.09) !important;
    background: rgba(0,0,0,.94) !important;
    backdrop-filter: blur(18px) !important;
    -webkit-backdrop-filter: blur(18px) !important;
  }

  html[data-explainables-surface="mobile"] #examDashboard .ex-dash-sidebar-toggle,
  html[data-explainables-surface="mobile"] #examDashboard .ex-dash-global-search {
    display: none !important;
  }

  html[data-explainables-surface="mobile"] #examDashboard .ex-dash-greeting {
    min-width: 0 !important;
    gap: 2px !important;
  }

  html[data-explainables-surface="mobile"] #examDashboard .ex-dash-greeting strong {
    font-size: 14px !important;
  }

  html[data-explainables-surface="mobile"] #examDashboard .ex-dash-greeting > span {
    font-size: 10px !important;
  }

  html[data-explainables-surface="mobile"] #examDashboard .ex-dash-metrics {
    display: flex !important;
    gap: 5px !important;
    max-width: 48vw !important;
    overflow-x: auto !important;
    scrollbar-width: none !important;
  }

  html[data-explainables-surface="mobile"] #examDashboard .ex-dash-metrics::-webkit-scrollbar { display: none !important; }

  html[data-explainables-surface="mobile"] #examDashboard .ex-metric-pill,
  html[data-explainables-surface="mobile"] #examDashboard .ex-icon-label-btn {
    flex: 0 0 auto !important;
    min-height: 34px !important;
    padding: 4px 7px !important;
    border-radius: 11px !important;
  }

  html[data-explainables-surface="mobile"] #examDashboard .ex-icon-label-btn strong { display: none !important; }

  html[data-explainables-surface="mobile"] #examDashboard .ex-dash-panel {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    padding: 15px 14px 18px !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
  }

  html[data-explainables-surface="mobile"] #examDashboard .ex-dash-panel > * {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }

  html[data-explainables-surface="mobile"] #examDashboard .ex-room-grid,
  html[data-explainables-surface="mobile"] #examDashboard .ex-project-grid,
  html[data-explainables-surface="mobile"] #examDashboard .ex-library-grid,
  html[data-explainables-surface="mobile"] #examDashboard .ex-settings-grid,
  html[data-explainables-surface="mobile"] #examDashboard .ex-dashboard-stats,
  html[data-explainables-surface="mobile"] #examDashboard .ex-dashboard-room-grid {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }

  html[data-explainables-surface="mobile"] #examDashboard .ex-room-card,
  html[data-explainables-surface="mobile"] #examDashboard .ex-project-card,
  html[data-explainables-surface="mobile"] #examDashboard .ex-library-card,
  html[data-explainables-surface="mobile"] #examDashboard .ex-dash-card,
  html[data-explainables-surface="mobile"] #examDashboard .ex-settings-card,
  html[data-explainables-surface="mobile"] #examDashboard .ex-current-learning,
  html[data-explainables-surface="mobile"] #examDashboard .ex-identity-card {
    border-radius: 16px !important;
    background: #151516 !important;
    box-shadow: none !important;
  }

  html[data-explainables-surface="mobile"] #examDashboard .ex-dash-sidebar,
  html[data-exam-dash-sidebar="collapsed"] #examDashboard .ex-dash-sidebar {
    position: relative !important;
    inset: auto !important;
    grid-row: 2 !important;
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    height: calc(64px + env(safe-area-inset-bottom)) !important;
    min-height: calc(64px + env(safe-area-inset-bottom)) !important;
    padding: 5px 6px env(safe-area-inset-bottom) !important;
    margin: 0 !important;
    border: 0 !important;
    border-top: 1px solid rgba(255,255,255,.12) !important;
    border-radius: 0 !important;
    background: rgba(9,9,10,.98) !important;
    box-shadow: none !important;
    overflow: hidden !important;
  }

  html[data-explainables-surface="mobile"] #examDashboard .ex-dash-brand,
  html[data-explainables-surface="mobile"] #examDashboard .ex-dash-private {
    display: none !important;
  }

  html[data-explainables-surface="mobile"] #examDashboard .ex-dash-nav {
    display: grid !important;
    grid-template-columns: repeat(6, minmax(0,1fr)) !important;
    gap: 1px !important;
    width: 100% !important;
    height: 58px !important;
    padding: 0 !important;
  }

  html[data-explainables-surface="mobile"] #examDashboard .ex-dash-nav button,
  html[data-exam-dash-sidebar="collapsed"] #examDashboard .ex-dash-nav button {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 3px !important;
    width: 100% !important;
    min-width: 0 !important;
    height: 56px !important;
    min-height: 0 !important;
    padding: 4px 1px !important;
    border-radius: 10px !important;
    font-size: 7.5px !important;
    line-height: 1 !important;
    white-space: nowrap !important;
  }

  html[data-explainables-surface="mobile"] #examDashboard .ex-dash-nav .ex-svg {
    width: 18px !important;
    height: 18px !important;
  }

  /* ---------- Classroom ---------- */
  html[data-explainables-surface="mobile"] #examClassroom {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    min-height: 100dvh !important;
    overflow-x: hidden !important;
    background: #000 !important;
  }

  html[data-explainables-surface="mobile"] #examClassroom .ex-class-header {
    grid-template-columns: minmax(0,1fr) auto !important;
    min-height: 66px !important;
    padding: max(8px, env(safe-area-inset-top)) 10px 8px !important;
    gap: 7px !important;
    background: rgba(0,0,0,.94) !important;
  }

  html[data-explainables-surface="mobile"] #examClassroom .ex-class-header > .ex-brand { display: none !important; }

  html[data-explainables-surface="mobile"] #examClassroom .ex-header-progress,
  html[data-explainables-surface="mobile"] #examClassroom .ex-header-progress-top {
    min-width: 0 !important;
  }

  html[data-explainables-surface="mobile"] #examClassroom .ex-current-block {
    max-width: calc(100vw - 154px) !important;
    min-width: 0 !important;
  }

  html[data-explainables-surface="mobile"] #examClassroom .ex-current-block strong {
    max-width: 100% !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    font-size: 11px !important;
  }

  html[data-explainables-surface="mobile"] #examClassroom .ex-progress-number {
    min-width: 34px !important;
    font-size: 10px !important;
  }

  html[data-explainables-surface="mobile"] #examClassroom .ex-header-chips {
    display: flex !important;
    min-width: 0 !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    flex-wrap: nowrap !important;
    scrollbar-width: none !important;
  }

  html[data-explainables-surface="mobile"] #examClassroom .ex-header-chips::-webkit-scrollbar { display: none !important; }

  html[data-explainables-surface="mobile"] #examClassroom .ex-header-chip {
    flex: 0 0 auto !important;
    max-width: 120px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    font-size: 8px !important;
  }

  html[data-explainables-surface="mobile"] #examClassroom .ex-menu-exam-countdown {
    max-width: 94px !important;
    font-size: 9px !important;
  }

  html[data-explainables-surface="mobile"] #examClassroom .ex-teacher-wrap {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    min-height: calc(100dvh - 66px) !important;
    padding: 13px 12px 104px !important;
  }

  html[data-explainables-surface="mobile"] #examClassroom .ex-teacher-stage,
  html[data-explainables-surface="mobile"] #examClassroom .ex-stage-body,
  html[data-explainables-surface="mobile"] #examClassroom .ex-teach-slide,
  html[data-explainables-surface="mobile"] #examClassroom .ex-rich-content {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }

  html[data-explainables-surface="mobile"] #examClassroom .ex-stage-header h1,
  html[data-explainables-surface="mobile"] #examClassroom .ex-teach-slide > h2 {
    max-width: 100% !important;
    font-size: clamp(29px, 8.7vw, 38px) !important;
    line-height: 1.08 !important;
    overflow-wrap: break-word !important;
  }

  html[data-explainables-surface="mobile"] #examClassroom .ex-stage-body {
    padding: 14px 0 !important;
    overflow-x: hidden !important;
  }

  html[data-explainables-surface="mobile"] #examClassroom .ex-rich-content pre,
  html[data-explainables-surface="mobile"] #examClassroom .ex-rich-content table,
  html[data-explainables-surface="mobile"] #examClassroom .ex-rich-content .ex-math-display,
  html[data-explainables-surface="mobile"] #examClassroom .ex-formula {
    max-width: 100% !important;
    overflow-x: auto !important;
    overscroll-behavior-x: contain;
  }

  html[data-explainables-surface="mobile"] #examClassroom .ex-stage-nav {
    left: 12px !important;
    right: 12px !important;
    bottom: max(10px, env(safe-area-inset-bottom)) !important;
    width: auto !important;
    max-width: none !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
  }

  html[data-explainables-surface="mobile"] #examClassroom .ex-stage-nav .ex-stage-dots { display: none !important; }

  html[data-explainables-surface="mobile"] #examClassroom .ex-stage-nav .ex-btn {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 48px !important;
    padding: 0 10px !important;
    border-radius: 14px !important;
    font-size: 12px !important;
  }

  html[data-explainables-surface="mobile"] #examClassroom .ex-question-actions,
  html[data-explainables-surface="mobile"] #examClassroom .ex-check-choices {
    grid-template-columns: 1fr !important;
  }

  html[data-explainables-surface="mobile"] #examClassroom .ex-question-actions [data-question-mentor] {
    grid-column: auto !important;
  }

  html[data-explainables-surface="mobile"] #examClassroom .ex-question-option {
    grid-template-columns: 22px minmax(0,1fr) !important;
    gap: 10px !important;
    padding: 12px !important;
    border-radius: 14px !important;
  }

  /* ---------- Drawers, sheets, modals, overlays ---------- */
  html[data-explainables-surface="mobile"] .ex-drawer.right,
  html[data-explainables-surface="mobile"] .ex-drawer.helper,
  html[data-explainables-surface="mobile"] .ex-drawer.floating,
  html[data-explainables-surface="mobile"] #examNotesDrawer,
  html[data-explainables-surface="mobile"] #examMentorDrawer {
    left: 8px !important;
    right: 8px !important;
    top: auto !important;
    bottom: max(8px, env(safe-area-inset-bottom)) !important;
    width: auto !important;
    max-width: none !important;
    min-width: 0 !important;
    height: min(84dvh, 720px) !important;
    max-height: calc(100dvh - 16px) !important;
    border-radius: 22px !important;
    overflow: hidden !important;
  }

  html[data-explainables-surface="mobile"] .ex-dashboard-modal,
  html[data-explainables-surface="mobile"] .ex-decision-overlay,
  html[data-explainables-surface="mobile"] .ex-question-skip-modal,
  html[data-explainables-surface="mobile"] .ex-complete-overlay {
    padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom)) !important;
  }

  html[data-explainables-surface="mobile"] .ex-dashboard-modal-card,
  html[data-explainables-surface="mobile"] .ex-dashboard-modal-card.wide,
  html[data-explainables-surface="mobile"] .ex-decision-card,
  html[data-explainables-surface="mobile"] .ex-question-skip-card {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    max-height: calc(100dvh - 24px) !important;
    padding: 18px !important;
    border-radius: 20px !important;
  }

  html[data-explainables-surface="mobile"] .ex-modal-fields,
  html[data-explainables-surface="mobile"] .ex-share-link,
  html[data-explainables-surface="mobile"] .ex-source-row {
    min-width: 0 !important;
    max-width: 100% !important;
  }

  html[data-explainables-surface="mobile"] .ex-share-link {
    display: grid !important;
    grid-template-columns: minmax(0,1fr) auto !important;
  }

  html[data-explainables-surface="mobile"] .ex-share-targets {
    grid-template-columns: 1fr 1fr !important;
  }

  html[data-explainables-surface="mobile"] .ex-tutorial-card {
    width: calc(100vw - 20px) !important;
    max-width: 520px !important;
    max-height: calc(100dvh - 20px) !important;
    padding: 17px !important;
    border-radius: 20px !important;
  }
}

@media (max-width: 380px) {
  html[data-explainables-surface="mobile"] { --ex-mobile-gutter: 13px; }

  html[data-explainables-surface="mobile"] #examEntry h1 {
    font-size: 36px !important;
  }

  html[data-explainables-surface="mobile"] #examDashboard .ex-dash-nav button,
  html[data-exam-dash-sidebar="collapsed"] #examDashboard .ex-dash-nav button {
    font-size: 6.5px !important;
  }

  html[data-explainables-surface="mobile"] #examDashboard .ex-dash-nav .ex-svg {
    width: 16px !important;
    height: 16px !important;
  }

  html[data-explainables-surface="mobile"] #examClassroom .ex-menu-exam-countdown {
    max-width: 78px !important;
  }
}


/* ==========================================================================
   PRE-CLASSROOM INTERACTION FIREWALL — mobile Exam only
   Entry, setup, generation, timetable, welcome and dashboard must never be
   blocked by classroom-only drawers or overlays.
   ========================================================================== */
html[data-explainables-surface="mobile"] #examApp [hidden] {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

html[data-explainables-surface="mobile"] #examApp #examClassroom[hidden] {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
  contain: layout style paint !important;
}

html[data-explainables-surface="mobile"]:not([data-exam-active-screen="examClassroom"]) #examApp #examDrawerBackdrop,
html[data-explainables-surface="mobile"]:not([data-exam-active-screen="examClassroom"]) #examApp #examControlsDrawer,
html[data-explainables-surface="mobile"]:not([data-exam-active-screen="examClassroom"]) #examApp #examNotesDrawer,
html[data-explainables-surface="mobile"]:not([data-exam-active-screen="examClassroom"]) #examApp #examMentorDrawer,
html[data-explainables-surface="mobile"]:not([data-exam-active-screen="examClassroom"]) #examApp #examSelectionToolbar,
html[data-explainables-surface="mobile"]:not([data-exam-active-screen="examClassroom"]) #examApp #examPrerequisiteGate,
html[data-explainables-surface="mobile"]:not([data-exam-active-screen="examClassroom"]) #examApp #examDwellNudge,
html[data-explainables-surface="mobile"]:not([data-exam-active-screen="examClassroom"]) #examApp #examShortcutPanel,
html[data-explainables-surface="mobile"]:not([data-exam-active-screen="examClassroom"]) #examApp #examTutorialChoice,
html[data-explainables-surface="mobile"]:not([data-exam-active-screen="examClassroom"]) #examApp #examSamplePaperPrompt,
html[data-explainables-surface="mobile"]:not([data-exam-active-screen="examClassroom"]) #examApp #examTutorial,
html[data-explainables-surface="mobile"]:not([data-exam-active-screen="examClassroom"]) #examApp #examClassroomSourcesModal,
html[data-explainables-surface="mobile"]:not([data-exam-active-screen="examClassroom"]) #examApp #examComplete {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
  touch-action: none !important;
}

html[data-explainables-surface="mobile"] #examApp #examControlsDrawer[hidden] .ex-drawer-body,
html[data-explainables-surface="mobile"] #examApp #examNotesDrawer[hidden] .ex-drawer-body,
html[data-explainables-surface="mobile"] #examApp #examMentorDrawer[hidden] .ex-drawer-body,
html[data-explainables-surface="mobile"][data-exam-mobile-preclassroom] #examApp #examControlsDrawer .ex-drawer-body,
html[data-explainables-surface="mobile"][data-exam-mobile-preclassroom] #examApp #examNotesDrawer .ex-drawer-body,
html[data-explainables-surface="mobile"][data-exam-mobile-preclassroom] #examApp #examMentorDrawer .ex-drawer-body {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* ==========================================================================\n   MOBILE EXAM GEOMETRY + CENTERING V1 — 20260814\n   Final mobile-only owner for setup, dashboard and classroom fit.\n   ========================================================================== */
@media (max-width: 900px) {
  /* Setup wizard: centered visual hierarchy on every step. */
  html[data-explainables-surface="mobile"] #examWizard .ex-wizard-stage,
  html[data-explainables-surface="mobile"] #examWizard .ex-wizard-stage .ex-kicker,
  html[data-explainables-surface="mobile"] #examWizard .ex-wizard-title,
  html[data-explainables-surface="mobile"] #examWizard .ex-wizard-copy {
    text-align: center !important;
  }

  html[data-explainables-surface="mobile"] #examWizard .ex-wizard-stage .ex-kicker,
  html[data-explainables-surface="mobile"] #examWizard .ex-wizard-title,
  html[data-explainables-surface="mobile"] #examWizard .ex-wizard-copy {
    margin-left: auto !important;
    margin-right: auto !important;
  }

  html[data-explainables-surface="mobile"] #examWizard .ex-wizard-copy {
    max-width: 500px !important;
  }

  html[data-explainables-surface="mobile"] #examWizard .ex-card-button,
  html[data-explainables-surface="mobile"] #examWizard .ex-choice-section,
  html[data-explainables-surface="mobile"] #examWizard .ex-review-card,
  html[data-explainables-surface="mobile"] #examWizard .ex-flow-note,
  html[data-explainables-surface="mobile"] #examWizard .ex-empty-mapping,
  html[data-explainables-surface="mobile"] #examWizard .ex-rescue-summary,
  html[data-explainables-surface="mobile"] #examWizard .ex-topic-custom-panel,
  html[data-explainables-surface="mobile"] #examWizard .ex-time-reality {
    text-align: center !important;
  }

  html[data-explainables-surface="mobile"] #examWizard .ex-card-button {
    padding-left: 44px !important;
    padding-right: 44px !important;
  }

  html[data-explainables-surface="mobile"] #examWizard .ex-card-button strong,
  html[data-explainables-surface="mobile"] #examWizard .ex-card-button > span:not(.ex-check),
  html[data-explainables-surface="mobile"] #examWizard .ex-review-card h3,
  html[data-explainables-surface="mobile"] #examWizard .ex-review-card p {
    display: block !important;
    width: 100% !important;
    text-align: center !important;
  }

  html[data-explainables-surface="mobile"] #examWizard .ex-choice-heading,
  html[data-explainables-surface="mobile"] #examWizard .ex-subject-group-head {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    text-align: center !important;
  }

  html[data-explainables-surface="mobile"] #examWizard .ex-quick-pills,
  html[data-explainables-surface="mobile"] #examWizard .ex-selected-subjects,
  html[data-explainables-surface="mobile"] #examWizard .ex-fast-selected-subjects,
  html[data-explainables-surface="mobile"] #examWizard .ex-fast-topic-list {
    justify-content: center !important;
  }

  html[data-explainables-surface="mobile"] #examWizard .ex-field > span,
  html[data-explainables-surface="mobile"] #examWizard .ex-topic-custom-panel > div:first-child,
  html[data-explainables-surface="mobile"] #examWizard .ex-muted {
    text-align: center !important;
  }

  html[data-explainables-surface="mobile"] #examWizard .ex-wizard-search,
  html[data-explainables-surface="mobile"] #examWizard .ex-wizard-search-tools {
    width: 100% !important;
    max-width: 520px !important;
    margin-left: auto !important;
    margin-right: auto !important;
  }

  html[data-explainables-surface="mobile"] #examWizard .ex-wizard-search-tools {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
  }

  html[data-explainables-surface="mobile"] #examWizard .ex-wizard-search-tools #examTopicSearch {
    grid-column: 1 / -1 !important;
    min-width: 0 !important;
  }

  html[data-explainables-surface="mobile"] #examWizard[data-wizard-nav="continue-only"] .ex-wizard-nav-inner {
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-areas: "continue" !important;
    max-width: 430px !important;
    justify-items: center !important;
  }

  html[data-explainables-surface="mobile"] #examWizard[data-wizard-nav="continue-only"] #examWizardContinue {
    width: min(100%, 396px) !important;
    justify-self: center !important;
  }

  /* Dashboard: everything must remain inside the phone canvas. */
  html[data-explainables-surface="mobile"] #examDashboard .ex-dash-topbar {
    grid-template-columns: minmax(0,1fr) !important;
    grid-template-rows: auto auto !important;
    gap: 7px !important;
  }

  html[data-explainables-surface="mobile"] #examDashboard .ex-dash-greeting {
    width: 100% !important;
    max-width: 100% !important;
  }

  html[data-explainables-surface="mobile"] #examDashboard .ex-dash-metrics {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0,1fr)) !important;
    gap: 6px !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow: visible !important;
  }

  html[data-explainables-surface="mobile"] #examDashboard .ex-metric-pill,
  html[data-explainables-surface="mobile"] #examDashboard .ex-icon-label-btn {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    padding: 4px 5px !important;
    justify-content: center !important;
    overflow: hidden !important;
  }

  html[data-explainables-surface="mobile"] #examDashboard .ex-metric-pill strong {
    min-width: 0 !important;
    max-width: 100% !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    font-size: 9px !important;
  }

  html[data-explainables-surface="mobile"] #examDashboard .ex-minimal-welcome {
    display: grid !important;
    grid-template-columns: minmax(0,1fr) !important;
    gap: 16px !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    padding: 18px !important;
    overflow: hidden !important;
  }

  html[data-explainables-surface="mobile"] #examDashboard .ex-minimal-welcome-copy,
  html[data-explainables-surface="mobile"] #examDashboard .ex-current-learning,
  html[data-explainables-surface="mobile"] #examDashboard .ex-dash-actions {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }

  html[data-explainables-surface="mobile"] #examDashboard .ex-dash-actions {
    display: grid !important;
    grid-template-columns: minmax(0,1fr) !important;
    gap: 9px !important;
  }

  html[data-explainables-surface="mobile"] #examDashboard .ex-dash-actions .ex-btn {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    margin: 0 !important;
    justify-content: center !important;
  }

  html[data-explainables-surface="mobile"] #examDashboard .ex-identity-strip {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0,1fr)) !important;
    gap: 8px !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow: visible !important;
  }

  html[data-explainables-surface="mobile"] #examDashboard .ex-identity-card {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    min-height: 106px !important;
    padding: 12px 6px !important;
    flex-direction: column !important;
    justify-content: center !important;
    gap: 5px !important;
    text-align: center !important;
    overflow: hidden !important;
  }

  html[data-explainables-surface="mobile"] #examDashboard .ex-identity-icon {
    width: 34px !important;
    height: 34px !important;
    flex: 0 0 34px !important;
  }

  html[data-explainables-surface="mobile"] #examDashboard .ex-identity-copy {
    width: 100% !important;
    min-width: 0 !important;
    place-items: center !important;
  }

  html[data-explainables-surface="mobile"] #examDashboard .ex-identity-copy strong {
    max-width: 100% !important;
    font-size: 16px !important;
    line-height: 1.02 !important;
    overflow-wrap: anywhere !important;
  }

  html[data-explainables-surface="mobile"] #examDashboard .ex-identity-copy small {
    max-width: 100% !important;
    font-size: 8px !important;
    line-height: 1.15 !important;
    white-space: normal !important;
  }

  html[data-explainables-surface="mobile"] #examDashboard .ex-exam-leaderboard,
  html[data-explainables-surface="mobile"] #examDashboard .ex-exam-lb-summary,
  html[data-explainables-surface="mobile"] #examDashboard .ex-exam-lb-board {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }

  /* Classroom: force both slide navigation buttons inside the content width. */
  html[data-explainables-surface="mobile"] #examClassroom .ex-stage-nav {
    position: relative !important;
    inset: auto !important;
    transform: none !important;
    display: grid !important;
    grid-template-columns: minmax(0,1fr) minmax(0,1fr) !important;
    align-items: stretch !important;
    gap: 8px !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin: 46px 0 72px !important;
    padding: 30px 0 0 !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
  }

  html[data-explainables-surface="mobile"] #examClassroom .ex-stage-nav #examSlidePrevious,
  html[data-explainables-surface="mobile"] #examClassroom .ex-stage-nav #examSlideNext {
    position: relative !important;
    inset: auto !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    height: 48px !important;
    min-height: 48px !important;
    margin: 0 !important;
    padding: 0 8px !important;
    justify-self: stretch !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }
}

@media (max-width: 360px) {
  html[data-explainables-surface="mobile"] #examDashboard .ex-dash-metrics { gap: 4px !important; }
  html[data-explainables-surface="mobile"] #examDashboard .ex-metric-pill,
  html[data-explainables-surface="mobile"] #examDashboard .ex-icon-label-btn { padding-inline: 3px !important; }
  html[data-explainables-surface="mobile"] #examDashboard .ex-identity-strip { gap: 6px !important; }
  html[data-explainables-surface="mobile"] #examDashboard .ex-identity-card { padding-inline: 4px !important; }
}
