/* Mobile pages share the shell scroll area so fixed navigation never hides content. */
@media (max-width: 767px) {
  main.mars-canvas:has(.mars-panel.mh),
  main.mars-canvas:has(.attendance-sheet.is-open) {
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior-y: contain;
    scroll-padding-block-end: 124px;
  }

  main.mars-canvas:has(.mars-panel.mh) > div,
  main.mars-canvas:has(.attendance-sheet.is-open) > div {
    padding-bottom: max(116px, calc(100px + env(safe-area-inset-bottom))) !important;
  }

  main.mars-canvas .mars-panel.mh,
  main.mars-canvas .mh .mh-body {
    height: auto;
    min-height: 0;
    flex: none;
    overflow: visible;
  }

  main.mars-canvas .mh .mh-tiles {
    flex: none;
    height: auto;
    grid-auto-rows: minmax(64px, auto);
    gap: 5px;
    align-content: start;
    overflow: visible;
  }

  main.mars-canvas .mh .mh-tiles .mh-tile {
    min-height: 64px;
    padding: 4px 2px;
    gap: 3px;
  }

  main.mars-canvas .mh .mh-tile-icon {
    flex: none;
    width: 29px;
    height: 29px;
    border-radius: 9px;
  }

  main.mars-canvas .mh .mh-tile-icon svg { width: 16px; height: 16px; }

  main.mars-canvas .mh .mh-tile-text b {
    display: block;
    font-size: 10px;
    line-height: 1.3;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  main.mars-canvas .attendance-sheet.is-open {
    height: auto !important;
    min-height: 0;
    overflow: visible !important;
  }

  main.mars-canvas .attendance-sheet.is-open .attendance-original-refined {
    flex: none;
    height: auto;
    min-height: 0;
    max-height: none;
    overflow: visible !important;
  }

  main.mars-canvas .attendance-sheet.is-open .atm-head {
    top: 0;
  }
}

@media (max-width: 767px) {
  dialog.dm-dialog:has(.pulse-tuition) {
    width: calc(100% - 12px);
    max-width: calc(100% - 12px);
    box-sizing: border-box;
  }
  dialog.dm-dialog .pulse-tuition table {
    min-width: 0;
    width: 100%;
    table-layout: fixed;
  }
  dialog.dm-dialog .pulse-tuition table :is(th, td) {
    padding: 2px 4px;
    min-width: 0;
    line-height: 1.25;
  }
  dialog.dm-dialog .pulse-tuition tbody tr { height: auto; }
  dialog.dm-dialog .pulse-tuition-cell { flex-flow: row wrap; gap: 2px; align-items: center; }
  dialog.dm-dialog .pulse-tuition-details { flex: 1 1 68px; }
  dialog.dm-dialog .pulse-tuition .pulse-tuition-receive { min-height: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  .mars-panel.mh *, .daily-monitor *, .ms-logo, .ms-best,
  header img, nav a, dialog::backdrop {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
@media (max-width: 767px) {
  .mars-panel.mh .mh-tile-text b { overflow: visible; line-height: 1.5; }
  .dm-dialog .pulse-tuition table :is(td, th) { padding-block: 2px; }
}