/* Tablet landscape/layout hotfix — 2026-09-21.
 * Loaded after the generated bundles so it can be removed independently.
 */

.tablet-landscape-guard {
  display: none;
}

@media (orientation: portrait) and (pointer: coarse) {
  html:not(.tablet-page-teacher-route),
  html:not(.tablet-page-teacher-route) body {
    width: 100%;
    height: 100%;
    overflow: hidden !important;
    overscroll-behavior: none;
  }

  .tablet-landscape-guard {
    position: fixed;
    inset: 0;
    z-index: 2147483647;
    display: grid;
    place-items: center;
    padding: max(24px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right))
      max(24px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
    color: #132d67;
    background:
      radial-gradient(circle at 18% 12%, rgba(99, 226, 255, 0.24), transparent 42%),
      radial-gradient(circle at 82% 88%, rgba(116, 87, 245, 0.2), transparent 46%),
      linear-gradient(145deg, #f8fbff, #e5edff);
    font-family: "Plus Jakarta Sans", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  }

  .tablet-landscape-guard__panel {
    width: min(520px, 92vw);
    padding: 34px 30px 28px;
    border: 1px solid rgba(151, 198, 255, 0.7);
    border-radius: 28px;
    text-align: center;
    background: rgba(255, 255, 255, 0.86);
    box-shadow: 0 24px 64px rgba(47, 78, 167, 0.22);
    backdrop-filter: blur(18px) saturate(1.1);
  }

  .tablet-landscape-guard__icon {
    display: block;
    margin-bottom: 12px;
    font-size: 54px;
    line-height: 1;
  }

  .tablet-landscape-guard h2 {
    margin: 0 0 8px;
    font-size: clamp(24px, 5vw, 34px);
  }

  .tablet-landscape-guard p {
    margin: 0 0 20px;
    color: #657da8;
    font-size: clamp(15px, 2.8vw, 18px);
    line-height: 1.6;
  }

  .tablet-landscape-guard button {
    min-width: 190px;
    min-height: 50px;
    padding: 0 24px;
    border: 0;
    border-radius: 999px;
    color: #fff;
    background: linear-gradient(108deg, #7457f5, #24c2ef);
    box-shadow: 0 10px 24px rgba(47, 90, 199, 0.28);
    font: inherit;
    font-weight: 800;
  }

  .tablet-landscape-guard__status {
    min-height: 1.5em;
    margin-top: 12px !important;
    margin-bottom: 0 !important;
    font-size: 13px !important;
  }
}

/* A landscape tablet is a fixed application shell. The page itself never
 * scrolls; navigation and content own their scroll positions independently. */
@media (orientation: landscape) and (pointer: coarse) and (min-width: 720px) {
  /* Keep every role/public route inside the physical viewport. Route bundles
   * are loaded lazily after this file, so these shell constraints must win
   * the cascade as well as support older WebViews without dvh. */
  html,
  body,
  #app,
  #app > * {
    width: 100% !important;
    height: 100vh !important;
    height: 100dvh !important;
    min-height: 0 !important;
    max-height: 100vh !important;
    max-height: 100dvh !important;
    overflow: hidden !important;
    overscroll-behavior: none;
  }

  html:has(.student-layout-root),
  body:has(.student-layout-root),
  #app.app-root:has(.student-layout-root) {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    max-height: 100dvh;
    overflow: hidden !important;
    overscroll-behavior: none;
  }

  .student-layout-root,
  .student-layout-root.admin-shell-tint {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100vh !important;
    height: 100dvh !important;
    min-height: 0 !important;
    max-height: 100vh !important;
    max-height: 100dvh !important;
    overflow: hidden !important;
  }

  .student-layout-root > .student-layout-topbar {
    position: relative;
    z-index: 560;
    flex: 0 0 auto;
  }

  .student-layout-root > .student-layout-body {
    flex: 1 1 0 !important;
    min-height: 0 !important;
    height: auto !important;
    max-height: none !important;
    align-items: stretch;
    overflow: hidden !important;
    overscroll-behavior: none;
  }

  .student-layout-root:not(.student-layout--mode-hub) .student-sidebar {
    position: relative;
    top: auto;
    align-self: stretch;
    height: 100%;
    min-height: 0;
    max-height: none;
    overflow: hidden;
  }

  .student-layout-root:not(.student-layout--mode-hub) .student-sidebar-inner {
    min-height: 0;
    overflow: hidden;
  }

  .student-layout-root:not(.student-layout--mode-hub) .student-nav-inner {
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
  }

  .student-layout-root:not(.student-layout--mode-hub) .student-main,
  .student-layout-root:not(.student-layout--mode-hub) .student-main.student-main--full {
    align-self: stretch;
    min-height: 0;
    height: 100%;
    max-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
  }

  /* Admin: keep the left navigation in place even when the CSS viewport is
   * below the old 961px desktop breakpoint. */
  .student-layout-root.admin-shell-tint > .student-layout-body,
  .student-layout-root.admin-shell-tint.student-layout--collapsed > .student-layout-body {
    grid-template-columns: minmax(220px, 260px) minmax(0, 1fr) !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }

  .student-layout-root.admin-shell-tint .student-menu-toggle {
    display: none !important;
  }

  .student-layout-root.admin-shell-tint .student-sidebar-collapse {
    display: flex;
  }

  .student-layout-root.admin-shell-tint .student-main {
    align-self: stretch !important;
    height: 100% !important;
    min-height: 0 !important;
    max-height: 100% !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    padding-bottom: 32px;
    overscroll-behavior: contain;
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
  }

  .student-layout-root.admin-shell-tint .student-sidebar,
  .student-layout-root.admin-shell-tint .student-sidebar-inner {
    align-self: stretch !important;
    height: 100% !important;
    min-height: 0 !important;
    max-height: 100% !important;
    overflow: hidden !important;
  }

  .student-layout-root.admin-shell-tint .student-nav-inner {
    height: 100% !important;
    min-height: 0 !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    touch-action: pan-y;
  }

  /* Classroom/notes: only the lesson list and reading pane scroll. */
  .student-layout-root:has(.note-center--study) .student-main,
  .student-layout-root:has(.note-center--study) .student-main.student-main--full {
    display: flex;
    flex-direction: column;
    padding: 8px 16px 10px;
    overflow: hidden !important;
    touch-action: none;
  }

  .student-layout-root:has(.note-center--study) .student-main > *,
  .student-layout-root:has(.note-center--study) .note-center--study,
  .student-layout-root:has(.note-center--study) .notes-shell.study-shell,
  .student-layout-root:has(.note-center--study) .study-main-col,
  .student-layout-root:has(.note-center--study) .study-content-card {
    min-height: 0;
    height: 100%;
    max-height: 100%;
  }

  .student-layout-root:has(.note-center--study) .notes-shell.study-shell {
    flex: 1 1 auto;
    grid-template-columns: minmax(220px, 290px) minmax(0, 1fr) 78px !important;
    grid-template-rows: minmax(0, 1fr);
    gap: 12px;
    overflow: hidden;
  }

  .student-layout-root:has(.note-center--study) .study-shell .note-library,
  .student-layout-root:has(.note-center--study) .study-main-col,
  .student-layout-root:has(.note-center--study) .study-content-card,
  .student-layout-root:has(.note-center--study) .study-tab-panel.active,
  .student-layout-root:has(.note-center--study) .hero-note,
  .student-layout-root:has(.note-center--study) .hero-note-inner {
    min-height: 0;
    overflow: hidden;
  }

  .student-layout-root:has(.note-center--study) .study-tab-panel.active,
  .student-layout-root:has(.note-center--study) .hero-note,
  .student-layout-root:has(.note-center--study) .hero-note-inner {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
  }

  .student-layout-root:has(.note-center--study) .study-shell .lesson-list-panel {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
  }

  .student-layout-root:has(.note-center--study) .study-shell .lesson-list-scroll,
  .student-layout-root:has(.note-center--study) .note-reading-scroll {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none !important;
    overflow-x: hidden;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    touch-action: pan-y !important;
    -webkit-overflow-scrolling: touch;
  }

  .student-layout-root:has(.note-center--study) .study-shell .hist-pagination {
    flex: 0 0 auto;
    margin-top: 8px;
  }

  /* Student add-class/upload inbox: keep the surrounding classroom shell
   * fixed and give scrolling only to the record list, detail and device panes. */
  .student-layout-root:has(.note-center--upload) > .student-layout-body,
  .student-layout-root:has(.note-center--upload) .student-main,
  .student-layout-root:has(.note-center--upload) .student-main.student-main--full,
  .student-layout-root:has(.note-center--upload) .note-center--upload,
  .student-layout-root:has(.note-center--upload) .mobile-upload-inbox--study-shell,
  .student-layout-root:has(.note-center--upload) .notes-shell.study-shell,
  .student-layout-root:has(.note-center--upload) .study-main-col,
  .student-layout-root:has(.note-center--upload) .inbox-detail-card,
  .student-layout-root:has(.note-center--upload) .inbox-detail-panel {
    min-height: 0 !important;
    height: 100% !important;
    max-height: 100% !important;
    overflow: hidden !important;
  }

  .student-layout-root:has(.note-center--upload) .note-center--upload,
  .student-layout-root:has(.note-center--upload) .mobile-upload-inbox--study-shell,
  .student-layout-root:has(.note-center--upload) .inbox-detail-panel {
    display: flex !important;
    flex: 1 1 auto;
    flex-direction: column;
  }

  .student-layout-root:has(.note-center--upload) .notes-shell.study-shell {
    flex: 1 1 auto;
    grid-template-rows: minmax(0, 1fr) !important;
  }

  .student-layout-root:has(.note-center--upload) .lesson-list-scroll,
  .student-layout-root:has(.note-center--upload) .inbox-detail-scroll,
  .student-layout-root:has(.note-center--upload) .inbox-device-panel,
  .student-layout-root:has(.note-center--upload) .inbox-side-list,
  .student-layout-root:has(.note-center--upload) .inbox-detail-body {
    min-height: 0 !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    touch-action: pan-y !important;
    -webkit-overflow-scrolling: touch;
  }

  /* Android System WebView compatibility: page marker classes are added by
   * tablet-layout-fix-20260921.js because these builds do not support :has(). */
  html.tablet-page-student-upload .student-main.student-main--full {
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
    min-height: 0 !important;
    max-height: 100% !important;
    padding: 8px 96px 10px 16px !important;
    overflow: hidden !important;
    touch-action: none !important;
    box-sizing: border-box !important;
  }

  html.tablet-page-student-upload .student-main.student-main--full > .note-center--upload,
  html.tablet-page-student-upload .note-center--upload,
  html.tablet-page-student-upload .mobile-upload-inbox--study-shell,
  html.tablet-page-student-upload .notes-shell.study-shell,
  html.tablet-page-student-upload .study-main-col,
  html.tablet-page-student-upload .inbox-detail-card,
  html.tablet-page-student-upload .inbox-detail-panel {
    min-height: 0 !important;
    height: 100% !important;
    max-height: 100% !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
  }

  html.tablet-page-student-upload .note-center--upload,
  html.tablet-page-student-upload .mobile-upload-inbox--study-shell,
  html.tablet-page-student-upload .inbox-detail-panel {
    display: flex !important;
    flex: 1 1 0 !important;
    flex-direction: column !important;
  }

  html.tablet-page-student-upload .notes-shell.study-shell {
    flex: 1 1 0 !important;
    grid-template-columns: minmax(220px, 290px) minmax(0, 1fr) !important;
    grid-template-rows: minmax(0, 1fr) !important;
    gap: 12px !important;
  }

  html.tablet-page-student-upload .note-library,
  html.tablet-page-student-upload .lesson-list-panel {
    min-height: 0 !important;
    max-height: 100% !important;
    overflow: hidden !important;
  }

  html.tablet-page-student-upload .lesson-list-panel {
    display: flex !important;
    flex: 1 1 0 !important;
    flex-direction: column !important;
  }

  html.tablet-page-student-upload .lesson-list-scroll,
  html.tablet-page-student-upload .inbox-detail-scroll,
  html.tablet-page-student-upload .inbox-device-panel,
  html.tablet-page-student-upload .inbox-side-list,
  html.tablet-page-student-upload .inbox-detail-body {
    min-height: 0 !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    touch-action: pan-y !important;
    -webkit-overflow-scrolling: touch;
  }

  html.tablet-page-student-study .student-main,
  html.tablet-page-student-study .student-main.student-main--full {
    display: flex !important;
    flex-direction: column !important;
    padding: 8px 16px 10px !important;
    overflow: hidden !important;
    touch-action: none !important;
  }

  /* Classroom study top pills — Chrome 99 WebView has NO :has() and the
   * html.tablet-page-* class hook may be wiped by other scripts. Target
   * .note-center--study directly so shrink/wrap always applies. */
  .note-center--study .study-shell,
  html.tablet-page-student-study .study-shell,
  .student-layout-root:has(.note-center--study) .study-shell {
    --study-row-h: 28px;
    --study-row-pad-x: 6px;
    --study-row-font: 0.68rem;
  }

  .note-center--study .study-shell .study-subnav,
  html.tablet-page-student-study .study-shell .study-subnav,
  .student-layout-root:has(.note-center--study) .study-shell .study-subnav {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 6px 4px !important;
    height: auto !important;
    min-height: 28px !important;
    max-height: none !important;
    overflow: visible !important;
    box-sizing: border-box !important;
  }

  .note-center--study .study-shell .study-subnav-tabs,
  .note-center--study .study-shell .study-subnav-actions,
  html.tablet-page-student-study .study-shell .study-subnav-tabs,
  html.tablet-page-student-study .study-shell .study-subnav-actions,
  .student-layout-root:has(.note-center--study) .study-shell .study-subnav-tabs,
  .student-layout-root:has(.note-center--study) .study-shell .study-subnav-actions {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 3px !important;
    height: auto !important;
    min-height: 28px !important;
    margin: 0 !important;
    overflow: visible !important;
  }

  .note-center--study .study-shell .study-subnav-tabs,
  html.tablet-page-student-study .study-shell .study-subnav-tabs,
  .student-layout-root:has(.note-center--study) .study-shell .study-subnav-tabs {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }

  .note-center--study .study-shell .study-subnav-actions,
  html.tablet-page-student-study .study-shell .study-subnav-actions,
  .student-layout-root:has(.note-center--study) .study-shell .study-subnav-actions {
    flex: 0 1 auto !important;
    flex-shrink: 1 !important;
    margin-left: 0 !important;
  }

  .note-center--study .study-shell .study-tab,
  .note-center--study .study-shell .study-subnav .btn-sm,
  .note-center--study .study-shell .note-variant-actions .note-variant-tab,
  .note-center--study .study-shell .note-print-btn,
  html.tablet-page-student-study .study-shell .study-tab,
  html.tablet-page-student-study .study-shell .study-subnav .btn-sm,
  html.tablet-page-student-study .study-shell .note-variant-actions .note-variant-tab,
  html.tablet-page-student-study .study-shell .note-print-btn,
  .student-layout-root:has(.note-center--study) .study-shell .study-tab,
  .student-layout-root:has(.note-center--study) .study-shell .study-subnav .btn-sm,
  .student-layout-root:has(.note-center--study) .study-shell .note-variant-actions .note-variant-tab,
  .student-layout-root:has(.note-center--study) .study-shell .note-print-btn {
    height: 28px !important;
    min-height: 28px !important;
    max-height: 28px !important;
    padding: 0 6px !important;
    font-size: 0.68rem !important;
    font-weight: 650 !important;
    line-height: 1 !important;
    white-space: nowrap !important;
    flex: 0 0 auto !important;
    position: relative !important;
    z-index: 1 !important;
  }

  html.tablet-page-student-study .student-main > *,
  html.tablet-page-student-study .note-center--study,
  html.tablet-page-student-study .notes-shell.study-shell,
  html.tablet-page-student-study .study-main-col,
  html.tablet-page-student-study .study-content-card {
    min-height: 0 !important;
    height: 100% !important;
    max-height: 100% !important;
  }

  html.tablet-page-student-study .notes-shell.study-shell {
    flex: 1 1 auto;
    grid-template-columns: minmax(220px, 290px) minmax(0, 1fr) 78px !important;
    grid-template-rows: minmax(0, 1fr) !important;
    gap: 12px !important;
    overflow: hidden !important;
  }

  html.tablet-page-student-study .study-shell .note-library,
  html.tablet-page-student-study .study-main-col,
  html.tablet-page-student-study .study-content-card,
  html.tablet-page-student-study .study-tab-panel.active,
  html.tablet-page-student-study .hero-note,
  html.tablet-page-student-study .hero-note-inner,
  html.tablet-page-student-study .study-shell .lesson-list-panel {
    min-height: 0 !important;
    overflow: hidden !important;
  }

  html.tablet-page-student-study .study-shell .lesson-list-scroll,
  html.tablet-page-student-study .note-reading-scroll {
    flex: 1 1 auto;
    min-height: 0 !important;
    max-height: none !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    touch-action: pan-y !important;
    -webkit-overflow-scrolling: touch;
  }

  html.tablet-page-homework .student-main,
  html.tablet-page-homework .student-main.student-main--full {
    display: flex !important;
    flex-direction: column !important;
    min-height: 0 !important;
    overflow: hidden !important;
    padding: 8px 112px 10px 26px !important;
  }

  /* Homework tutor landing: it only exceeded this tablet by a small amount.
   * Reclaim decorative outer spacing and let the two cards use the remaining
   * viewport, preserving every control without a pointless page-level scroll. */
  .student-layout-root:has(.cabin-panel) .student-main,
  .student-layout-root:has(.cabin-panel) .student-main.student-main--full {
    display: flex !important;
    flex-direction: column;
    min-height: 0 !important;
    overflow: hidden !important;
    padding: 8px 112px 10px 26px !important;
  }

  .student-layout-root .student-main .cabin-panel:not(.cabin-panel--session) {
    display: flex !important;
    flex: 1 1 auto;
    flex-direction: column;
    width: 100%;
    height: 100% !important;
    min-height: 0 !important;
    max-height: 100% !important;
    padding: 8px 12px 10px !important;
    overflow: hidden !important;
    box-sizing: border-box;
  }

  .student-layout-root .cabin-panel:not(.cabin-panel--session) .cabin-head {
    flex: 0 0 auto;
    margin-bottom: 8px !important;
  }

  .student-layout-root .cabin-panel:not(.cabin-panel--session) .cabin-stage {
    flex: 1 1 0;
    min-height: 0 !important;
    height: auto !important;
    overflow: hidden;
  }

  .student-layout-root .cabin-panel:not(.cabin-panel--session) .cabin-upload-card,
  .student-layout-root .cabin-panel:not(.cabin-panel--session) .cabin-guide {
    height: 100% !important;
    min-height: 0 !important;
    max-height: 100% !important;
    padding: 14px 16px;
    overflow: hidden;
    box-sizing: border-box;
  }

  .student-layout-root .cabin-panel:not(.cabin-panel--session) .cabin-dropzone {
    min-height: 0 !important;
    padding: 18px !important;
  }

  .student-layout-root .cabin-panel:not(.cabin-panel--session) .cabin-guide,
  .student-layout-root .cabin-panel:not(.cabin-panel--session) .cabin-guide__steps {
    gap: 10px;
  }

  .student-layout-root .cabin-panel:not(.cabin-panel--session) .cabin-guide__modes {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .student-layout-root .cabin-panel:not(.cabin-panel--session) .cabin-guide__modes span {
    padding: 8px 6px;
  }

  /* Ready phase (mode picker): cabin-workspace replaces cabin-stage; fill remaining height. */
  .student-layout-root .cabin-panel:not(.cabin-panel--session) .cabin-workspace {
    flex: 1 1 0 !important;
    min-height: 0 !important;
    height: auto !important;
    max-height: 100% !important;
    overflow: hidden !important;
  }

  .student-layout-root .cabin-panel:not(.cabin-panel--session) .cabin-workspace .cabin-modes,
  .student-layout-root .cabin-panel:not(.cabin-panel--session) .cabin-workspace .cabin-left,
  .student-layout-root .cabin-panel:not(.cabin-panel--session) .cabin-workspace .cabin-right {
    min-height: 0 !important;
    max-height: 100% !important;
    overflow: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  /* Session phase (after picking a tutoring mode): previous rules used
   * :not(.cabin-panel--session) only, so the panel lost flex height and the
   * component's 100dvh calc overflowed the shell → blank chat pane.
   * Force fill of student-main and kill the 100dvh session height. */
  .student-layout-root .student-main .cabin-panel.cabin-panel--session,
  html.tablet-page-homework .student-main .cabin-panel.cabin-panel--session {
    display: flex !important;
    flex: 1 1 auto !important;
    flex-direction: column !important;
    width: 100% !important;
    height: 100% !important;
    max-height: 100% !important;
    min-height: 0 !important;
    --cabin-session-vh: 100%;
    padding: 8px 12px 10px !important;
    overflow: hidden !important;
    box-sizing: border-box;
  }

  .student-layout-root .cabin-panel--session .cabin-head {
    flex: 0 0 auto !important;
    margin-bottom: 6px !important;
  }

  .student-layout-root .cabin-panel--session .cabin-workspace {
    flex: 1 1 0 !important;
    min-height: 0 !important;
    height: auto !important;
    max-height: 100% !important;
    overflow: hidden !important;
    align-items: stretch !important;
    grid-template-columns: minmax(200px, 28%) minmax(0, 1fr) !important;
    grid-template-rows: minmax(0, 1fr) !important;
    gap: 10px !important;
  }

  .student-layout-root .cabin-panel--session .cabin-left,
  .student-layout-root .cabin-panel--session .cabin-right,
  .student-layout-root .cabin-panel--session .cabin-session,
  .student-layout-root .cabin-panel--session .explain-chain-card,
  .student-layout-root .cabin-panel--session .cabin-session-interactive,
  .student-layout-root .cabin-panel--session .cabin-session-interactive__scroll,
  .student-layout-root .cabin-panel--session .cabin-chat-area {
    min-height: 0 !important;
    max-height: none !important;
  }

  .student-layout-root .cabin-panel--session .cabin-left {
    overflow: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  .student-layout-root .cabin-panel--session .cabin-right,
  .student-layout-root .cabin-panel--session .cabin-session,
  .student-layout-root .cabin-panel--session .explain-chain-card,
  .student-layout-root .cabin-panel--session .cabin-session-interactive {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 0 !important;
    overflow: hidden !important;
  }

  .student-layout-root .cabin-panel--session .cabin-session-interactive__scroll,
  .student-layout-root .cabin-panel--session .cabin-chat-area {
    flex: 1 1 0 !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
  }

  .student-layout-root .cabin-panel--session .cabin-step-actions {
    flex: 0 0 auto !important;
  }

  /* Home hub: preserve the three-card landscape composition and reserve room
   * for the shortcut rail without letting the cards feel cramped. */
  .student-layout-root.student-layout--mode-hub,
  .student-layout-root.student-layout--mode-hub .student-layout-body,
  .student-layout-root.student-layout--mode-hub .student-main,
  .student-layout-root.student-layout--mode-hub .home-wrap.mode-hub-wrap,
  .student-layout-root.student-layout--mode-hub .mode-hub-center {
    height: 100%;
    min-height: 0;
    max-height: 100%;
    overflow: hidden !important;
  }

  .student-layout-root.student-layout--mode-hub .home-wrap.mode-hub-wrap.universe-home-page {
    padding: 10px 18px 8px;
  }

  .student-layout-root.student-layout--mode-hub .mode-hub-center {
    gap: clamp(6px, 1.2vh, 14px);
    padding: 0 8px 1vh;
  }

  .student-layout-root.student-layout--mode-hub .replica-hero {
    margin-top: 0;
    margin-bottom: 4px;
  }

  .student-layout-root.student-layout--mode-hub .replica-deck {
    width: calc(100% - 112px);
    max-width: 1180px;
    margin: clamp(2px, 0.6vh, 8px) auto clamp(54px, 8vh, 84px);
    gap: clamp(12px, 1.1vw, 20px);
    overflow: visible;
    transform: none;
  }

  .student-layout-root.student-layout--mode-hub .replica-card {
    width: min(39vh, calc((100vw - 220px) / 3));
    height: auto;
    max-height: calc(100dvh - 176px);
    aspect-ratio: 405 / 572;
  }

  .student-layout-root.student-layout--mode-hub .mode-hub-floating-chrome .replica-main {
    --quick-rail-width: 76px;
  }

  .student-layout-root.student-layout--mode-hub .quick-launch-buttons {
    min-height: 0;
    gap: 10px;
  }

  .student-layout-root.student-layout--mode-hub .quick-launch-buttons button {
    width: 76px;
    height: 84px;
    grid-template-rows: 60px 20px;
  }

  .student-layout-root.student-layout--mode-hub .quick-icon-frame {
    width: 60px;
    height: 60px;
    border-radius: 18px;
  }

  /* The signed-out landing page is rendered outside StudentLayout. Apply the
   * same landscape proportions directly to its shared universe components so
   * guest and signed-in students see one stable composition. */
  #app .universe-home-page {
    height: 100% !important;
    min-height: 0 !important;
    max-height: 100% !important;
    overflow: hidden !important;
    padding: 10px 18px 8px !important;
  }

  #app .universe-home-page .replica-main {
    height: 100% !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }

  #app .universe-home-page .replica-hero {
    flex: 0 0 auto;
    margin-top: 0 !important;
    margin-bottom: 4px !important;
  }

  #app .universe-home-page .replica-deck {
    width: calc(100% - 112px) !important;
    max-width: 1180px !important;
    margin: clamp(2px, 0.6vh, 8px) auto clamp(54px, 8vh, 84px) !important;
    gap: clamp(12px, 1.1vw, 20px) !important;
    overflow: visible;
    transform: none !important;
  }

  #app .universe-home-page .replica-card {
    width: min(39vh, calc((100vw - 220px) / 3)) !important;
    height: auto !important;
    max-height: calc(100vh - 176px) !important;
    max-height: calc(100dvh - 176px) !important;
    aspect-ratio: 405 / 572;
  }

  .mode-hub-floating-chrome .replica-main {
    --quick-rail-width: 76px;
  }

  .mode-hub-floating-chrome .quick-launch-buttons {
    min-height: 0;
    gap: 10px !important;
  }

  .mode-hub-floating-chrome .quick-launch-buttons button {
    width: 76px !important;
    height: 84px !important;
    grid-template-rows: 60px 20px;
  }

  .mode-hub-floating-chrome .quick-icon-frame {
    width: 60px !important;
    height: 60px !important;
    border-radius: 18px;
  }

  /* Teacher portal ships its own nested app shell and loads its route CSS
   * asynchronously. Strong, scoped overrides keep that shell inside the
   * viewport while preserving independent sidebar/main scrolling. */
  html:has(.teacher-portal-host),
  body:has(.teacher-portal-host),
  #app.app-root:has(.teacher-portal-host),
  .app-main:has(.teacher-portal-host) {
    width: 100%;
    height: 100vh !important;
    height: 100dvh !important;
    min-height: 0 !important;
    max-height: 100dvh !important;
    overflow: hidden !important;
    overscroll-behavior: none;
  }

  html .teacher-portal-host.teacher-portal-host,
  html .teacher-portal-host.teacher-portal-host #teacher-app {
    width: 100%;
    height: 100% !important;
    min-height: 0 !important;
    max-height: 100% !important;
    overflow: hidden !important;
  }

  html .teacher-portal-host.teacher-portal-host {
    display: block !important;
  }

  html .teacher-portal-host.teacher-portal-host #teacher-app {
    display: flex !important;
    flex: none !important;
    flex-direction: column;
    height: 100vh !important;
    height: 100dvh !important;
    max-height: 100vh !important;
    max-height: 100dvh !important;
  }

  html .teacher-portal-host #teacher-app > .topbar {
    position: relative;
    top: auto;
    flex: 0 0 auto;
  }

  html .teacher-portal-host #teacher-app > .app-body {
    display: flex;
    flex: 1 1 0;
    min-height: 0 !important;
    height: auto !important;
    max-height: none !important;
    overflow: hidden !important;
  }

  html .teacher-portal-host #teacher-app > .app-body > .sidebar,
  html .teacher-portal-host #teacher-app > .app-body > .main {
    align-self: stretch;
    height: 100% !important;
    min-height: 0 !important;
    max-height: 100% !important;
    overflow-x: hidden;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
  }

  html .teacher-portal-host #teacher-app > .app-body > .sidebar {
    position: relative;
    top: auto;
    flex: 0 0 var(--sidebar-width, 248px);
    display: block;
  }

  html .teacher-portal-host #teacher-app > .app-body > .main {
    flex: 1 1 auto;
    padding-bottom: 40px;
  }

  html .teacher-portal-host #teacher-app .menu-mobile {
    display: none !important;
  }

  /* The teacher lesson workbench changes to a single-column layout below
   * 1200px. On a landscape tablet that stacks two full-height regions and
   * collapses their scroll bodies to zero. Preserve the desktop two-pane
   * workbench and scroll only the lesson list/detail body. */
  html .teacher-portal-host #teacher-app.is-lessons-workbench > .app-body > .main {
    overflow: hidden !important;
    padding-bottom: 22px !important;
  }

  html .teacher-portal-host #teacher-app.is-lessons-workbench #panel-lessons {
    min-height: 0 !important;
    overflow: hidden !important;
  }

  html .teacher-portal-host #teacher-app.is-lessons-workbench .teaching-workbench {
    grid-template-columns: minmax(0, 1fr) minmax(240px, 270px) !important;
    grid-template-rows: minmax(0, 1fr) !important;
    padding-right: 0 !important;
    overflow: hidden !important;
  }

  html .teacher-portal-host #teacher-app.is-lessons-workbench .teaching-workbench-side,
  html .teacher-portal-host #teacher-app.is-lessons-workbench .teaching-workbench-main {
    order: 0 !important;
    height: 100% !important;
    min-height: 0 !important;
    max-height: 100% !important;
    padding-bottom: 0 !important;
    overflow: hidden !important;
  }

  html .teacher-portal-host #teacher-app.is-lessons-workbench .lesson-library,
  html .teacher-portal-host #teacher-app.is-lessons-workbench .lesson-workbench-card,
  html .teacher-portal-host #teacher-app.is-lessons-workbench .lesson-student-inline {
    min-height: 0 !important;
    max-height: none !important;
    overflow: hidden !important;
  }

  html .teacher-portal-host #teacher-app.is-lessons-workbench .lesson-list-scroll,
  html .teacher-portal-host #teacher-app.is-lessons-workbench .lesson-student-modal-body,
  html .teacher-portal-host #teacher-app.is-lessons-workbench .lesson-record-body,
  html .teacher-portal-host #teacher-app.is-lessons-workbench .teaching-center-pane {
    min-height: 0 !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    touch-action: pan-y !important;
    -webkit-overflow-scrolling: touch;
  }
}
