/*
 * TABLET_MOBILE_SHARED_V1_BEGIN
 * Shared tablet controls, reading scale and dialogs for BOTH orientations.
 * Only index opts in. Geometry unique to landscape lives in tablet-landscape-v1.css.
 * Phone, desktop and industrial styles do not inherit these rules.
 *
 * Layout contract (classification remains in js/common/layout-mode.js):
 * - Desktop / industrial: no matching selectors; no changes here.
 * - Phone: mobile/index.css + mobile/learning-board.css own the base UI.
 * - Tablet: this shared layer owns controls and a one-pixel reading lift;
 *   landscape changes geometry without changing that shared scale.
 * A 320px minimum card track yields two columns at 800px and three at 1280px.
 * At 1000px header actions fit inline and inquiry settings use 34% of width.
 * Below that, the same controls stack; no duplicate DOM or login lifecycle.
 * Catalog internals stay in components/catalog-select.css (44px controls).
 */

html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) {
  --tablet-vh: 1vh;
  /* TABLET_COMPOSER_V1: JS consumes these tokens, without another breakpoint. */
  --tablet-composer-control-size: 52px;
  --tablet-composer-send-width: 112px;
  --tablet-composer-text-min-height: 52px;
  --tablet-composer-text-max-height: 108px;
  --tablet-composer-vertical-padding: 20px;
  --mobile-composer-control-inset: calc(var(--tablet-composer-vertical-padding) / 2 + 1px);
  --tablet-composer-min-height: 72px;
  --tablet-composer-toolbar-control-size: 44px;
  --tablet-composer-camera-icon-size: 21px;
  /* Assistant replies and their follow-up controls share one visual rail in
     either orientation. Landscape changes only this rail's available width. */
  --tablet-assistant-rail-width: min(94%, 900px);
  --learning-board-mobile-card-width: 320px;
  --learning-board-mobile-shell-pad: 20px;
  --tablet-edge: clamp(16px, 2.8vw, 32px);
  --tablet-reading-increment: 1px;
  --tablet-body-font-size: calc(clamp(16px, 2.25vmin, 19px) + var(--tablet-reading-increment));
  --tablet-secondary-font-size: calc(clamp(14px, 2vmin, 17px) + var(--tablet-reading-increment));
  --tablet-action-font-size: calc(clamp(15px, 2.125vmin, 18px) + var(--tablet-reading-increment));
  --mobile-edge-gap: var(--tablet-edge);
  --mobile-topbar-pad-x: clamp(16px, 2.5vw, 28px);
  --mobile-title-side-reserve: 205px;
  --mobile-topbar-height-runtime: calc(var(--mobile-topbar-content-top) + var(--mobile-topbar-control-size) + 9px);
  --mobile-input-btn-size: var(--tablet-composer-control-size);
  --mobile-input-height-runtime: var(--tablet-composer-min-height);
  --mobile-input-bar-height-runtime: var(--tablet-composer-min-height);
  --mobile-chat-bottom-padding: clamp(10px, calc(2 * var(--tablet-vh)), 18px);
}

/* Tablet owns its shell geometry. Desktop and industrial header deductions
   must not reduce the space underneath this fixed mobile header a second time. */
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) .main-container {
  max-height: none !important;
}

/* The drawer owns these actions even when :is() is unavailable. */
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) .input-area #interactiveInquiryBtn,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) .input-area #learningBoardToggleBtn {
  display: none !important;
  visibility: hidden !important;
}

html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) .top-bar {
  min-height: calc(var(--mobile-topbar-content-top) + var(--mobile-topbar-control-size) + 9px) !important;
}

/* Anchor the close mark when the shared :where() positioning is unsupported. */
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) .modal-overlay:not(.learning-board-modal) .modal-header > .modal-close-btn.ui-close-button {
  position: relative;
}

/* Center only when there is spare height. On a short landscape screen these
   spacers collapse, so the welcome heading stays below the header and scrolls. */
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) .chat-panel.is-mobile-empty #chatArea {
  justify-content: flex-start !important;
  padding-top: 12px !important;
}

html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) .chat-panel.is-mobile-empty #chatArea::before,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) .chat-panel.is-mobile-empty #chatArea::after {
  content: '';
  flex: 1 0 0;
}

html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) .chat-panel.is-mobile-empty #mobileWelcomePanel,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) .chat-panel.is-mobile-empty #recommendQuestionsPanel.is-visible {
  flex: 0 0 auto;
  transform: none !important;
}

@media (max-width: 640px) {
  html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) {
    --mobile-title-side-reserve: 180px;
  }
  html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) .top-bar.has-homework-entry {
    min-height: calc(var(--mobile-topbar-content-top) + var(--mobile-topbar-control-size) + 34px) !important;
  }
  html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) .top-bar.has-homework-entry > .title {
    top: calc(var(--mobile-topbar-content-top) + var(--mobile-topbar-control-size) + 5px) !important;
    left: 12px !important;
    width: calc(100vw - 24px) !important;
    max-width: calc(100vw - 24px) !important;
    transform: none !important;
  }
}

html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #chatArea {
  padding-right: var(--tablet-edge) !important;
  padding-left: var(--tablet-edge) !important;
}

/* TABLET_ASSISTANT_RAIL_V1: Keep assistant replies, their controls, and the
   guidance launcher on one centered reading rail. The base mobile renderer
   intentionally starts these at the left edge for phones; that is too loose
   on a tablet and made the controls drift from the answer after rotation. */
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #chatArea > .message.assistant-message {
  align-self: center !important;
  width: var(--tablet-assistant-rail-width) !important;
  max-width: var(--tablet-assistant-rail-width) !important;
  margin-right: auto !important;
  margin-left: auto !important;
}

html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #chatArea > .assistant-message + .controls {
  align-self: center !important;
  width: var(--tablet-assistant-rail-width) !important;
  max-width: var(--tablet-assistant-rail-width) !important;
  margin: 10px auto 16px !important;
  padding-left: 0 !important;
}

html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #chatArea > .assistant-message + .controls > .next-step-host--compact {
  /* The host stays in normal flow, but now starts at the centered controls
     rail instead of the full chat column. */
  margin-inline: 0 !important;
}

/* A tablet is held further from the eyes than a phone. Scale text by the
   short edge in either orientation instead of applying a page-wide transform. */
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) .title {
  font-size: calc(clamp(20px, 2.75vmin, 24px) + var(--tablet-reading-increment)) !important;
}

html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) .top-bar .left-aligned-group > #openImageStrategyBtn {
  font-size: var(--tablet-secondary-font-size) !important;
  /* Tablet text must not inherit the phone's 118px cap or flex shrink. */
  flex: 0 0 auto !important;
  width: max-content !important;
  max-width: none !important;
  padding: 0 13px !important;
}

html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) .top-bar .left-aligned-group > #openImageStrategyBtn .btn-text {
  /* A 600px tablet must not inherit the phone's icon-only portrait rule. */
  display: inline !important;
  flex: 0 0 auto;
  overflow: visible;
  text-overflow: clip;
}

html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #chatArea .message,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #chatArea .message p,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #chatArea .message li {
  font-size: var(--tablet-body-font-size) !important;
  line-height: 1.58 !important;
}


html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #mobileBottomActionRow .mobile-menu-slot {
  min-height: 50px !important;
}

html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #mobileBottomActionRow .mobile-menu-slot-label {
  font-size: var(--tablet-action-font-size) !important;
}

/* Drawers stay overlay-based so this remains a mobile layout and never steals
   a permanent desktop column from the conversation. */
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #mobileRightDrawer,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #mobileLeftDrawer {
  width: min(368px, calc(100vw - 32px));
  padding-right: clamp(18px, 2.1vw, 26px) !important;
  padding-left: clamp(18px, 2.1vw, 26px) !important;
  height: calc(100 * var(--tablet-vh));
}

/* Preserve the drawer overlay while giving hidden actions tablet-readable
   labels and touch targets. Close controls use the shared dialog style. */
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #mobileRightDrawer .mobile-drawer-header,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #mobileLeftDrawer .mobile-drawer-header {
  min-height: 46px;
  margin-bottom: clamp(10px, calc(1.7 * var(--tablet-vh)), 14px);
}

html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #mobileRightDrawer .mobile-menu-slot,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #mobileLeftDrawer .mobile-menu-slot {
  min-height: 54px !important;
  padding-top: 7px !important;
  padding-bottom: 7px !important;
}

html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #mobileRightDrawer .mobile-menu-slot-label,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #mobileLeftDrawer .mobile-menu-slot-label {
  font-size: var(--tablet-action-font-size) !important;
  line-height: 1.28 !important;
}

/* Formula editors are hidden until a tool is opened. They already use the
   right full-screen mobile structure; only their dense control typography
   needs a tablet-specific lift. */
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #mathFormulaModal .math-editor-label,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #chemistryFormulaModal .chemistry-editor-label,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #physicsFormulaModal .physics-editor-label,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) .chat-panel.is-mobile-empty #recommendQuestionsPanel .recommend-questions-label {
  font-size: var(--tablet-secondary-font-size) !important;
}

html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #mathFormulaModal .math-input-area,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #mathFormulaModal .math-preview-content,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #chemistryFormulaModal .chemistry-input-area,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #chemistryFormulaModal .chemistry-preview-content,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #physicsFormulaModal .physics-input-area,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #physicsFormulaModal .physics-preview-content,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #studentInfoModal .preference-label,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #studentInfoModal .full-width-input,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #studentInfoModal .full-width-select,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #learningPreferencesModal .preference-label,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #learningPreferencesModal .full-width-input,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #learningPreferencesModal .full-width-select {
  font-size: var(--tablet-body-font-size) !important;
}

html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #mathFormulaModal .grade-btn,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #mathFormulaModal .math-tab-btn,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #mathFormulaModal .math-action-btn,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #chemistryFormulaModal .grade-btn,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #chemistryFormulaModal .chemistry-tab-btn,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #chemistryFormulaModal .chemistry-action-btn,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #physicsFormulaModal .grade-btn,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #physicsFormulaModal .physics-tab-btn,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #physicsFormulaModal .physics-action-btn {
  min-height: 44px !important;
  font-size: var(--tablet-action-font-size) !important;
}

html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #mathFormulaModal .grade-switch,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #chemistryFormulaModal .grade-switch,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #physicsFormulaModal .grade-switch {
  height: auto !important;
  min-height: 52px !important;
}

html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #mathFormulaModal .formula-symbol-main,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #chemistryFormulaModal .formula-symbol-main,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #physicsFormulaModal .formula-symbol-main {
  font-size: clamp(18px, 2.5vmin, 22px) !important;
}

html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #mathFormulaModal .formula-symbol-label,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #chemistryFormulaModal .formula-symbol-label,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #physicsFormulaModal .formula-symbol-label {
  font-size: calc(clamp(12px, 1.75vmin, 14px) + var(--tablet-reading-increment)) !important;
}

/* Lightweight configuration dialogs have form-like content, not a working
   canvas. Keep their mobile components but cap the reading line on landscape
   tablets. Library, drawing, records and formula tools intentionally remain
   full-screen because their primary content benefits from the whole surface. */
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #studentInfoModal:not(#mathFormulaModal):not(#chemistryFormulaModal):not(#physicsFormulaModal),
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #studentSkillTagModal:not(#mathFormulaModal):not(#chemistryFormulaModal):not(#physicsFormulaModal),
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #ttsVoiceModal:not(#mathFormulaModal):not(#chemistryFormulaModal):not(#physicsFormulaModal),
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #learningPreferencesModal:not(#mathFormulaModal):not(#chemistryFormulaModal):not(#physicsFormulaModal),
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #imageStrategyModal:not(#mathFormulaModal):not(#chemistryFormulaModal):not(#physicsFormulaModal),
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #myPetModal:not(#mathFormulaModal):not(#chemistryFormulaModal):not(#physicsFormulaModal) {
  align-items: center !important;
}

html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #studentInfoModal:not(#mathFormulaModal):not(#chemistryFormulaModal):not(#physicsFormulaModal) .modal-content,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #studentSkillTagModal:not(#mathFormulaModal):not(#chemistryFormulaModal):not(#physicsFormulaModal) .modal-content,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #ttsVoiceModal:not(#mathFormulaModal):not(#chemistryFormulaModal):not(#physicsFormulaModal) .modal-content,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #learningPreferencesModal:not(#mathFormulaModal):not(#chemistryFormulaModal):not(#physicsFormulaModal) .modal-content,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #imageStrategyModal:not(#mathFormulaModal):not(#chemistryFormulaModal):not(#physicsFormulaModal) .modal-content,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #myPetModal:not(#mathFormulaModal):not(#chemistryFormulaModal):not(#physicsFormulaModal) .modal-content {
  width: min(720px, calc(100vw - (var(--tablet-edge) * 2))) !important;
  max-width: min(720px, calc(100vw - (var(--tablet-edge) * 2))) !important;
  max-height: min(720px, calc(100 * var(--tablet-vh) - 32px)) !important;
  border-radius: 20px !important;
}

html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #studentInfoModal:not(#mathFormulaModal):not(#chemistryFormulaModal):not(#physicsFormulaModal) .modal-header,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #studentSkillTagModal:not(#mathFormulaModal):not(#chemistryFormulaModal):not(#physicsFormulaModal) .modal-header,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #ttsVoiceModal:not(#mathFormulaModal):not(#chemistryFormulaModal):not(#physicsFormulaModal) .modal-header,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #learningPreferencesModal:not(#mathFormulaModal):not(#chemistryFormulaModal):not(#physicsFormulaModal) .modal-header,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #imageStrategyModal:not(#mathFormulaModal):not(#chemistryFormulaModal):not(#physicsFormulaModal) .modal-header,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #myPetModal:not(#mathFormulaModal):not(#chemistryFormulaModal):not(#physicsFormulaModal) .modal-header {
  min-height: 64px !important;
  padding: 12px 20px !important;
}

html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #studentInfoModal:not(#mathFormulaModal):not(#chemistryFormulaModal):not(#physicsFormulaModal) .modal-title,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #studentSkillTagModal:not(#mathFormulaModal):not(#chemistryFormulaModal):not(#physicsFormulaModal) .modal-title,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #ttsVoiceModal:not(#mathFormulaModal):not(#chemistryFormulaModal):not(#physicsFormulaModal) .modal-title,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #learningPreferencesModal:not(#mathFormulaModal):not(#chemistryFormulaModal):not(#physicsFormulaModal) .modal-title,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #imageStrategyModal:not(#mathFormulaModal):not(#chemistryFormulaModal):not(#physicsFormulaModal) .modal-title,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #myPetModal:not(#mathFormulaModal):not(#chemistryFormulaModal):not(#physicsFormulaModal) .modal-title {
  font-size: calc(clamp(20px, 2.75vmin, 23px) + var(--tablet-reading-increment)) !important;
}

html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #studentInfoModal:not(#mathFormulaModal):not(#chemistryFormulaModal):not(#physicsFormulaModal) .modal-body,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #studentSkillTagModal:not(#mathFormulaModal):not(#chemistryFormulaModal):not(#physicsFormulaModal) .modal-body,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #ttsVoiceModal:not(#mathFormulaModal):not(#chemistryFormulaModal):not(#physicsFormulaModal) .modal-body,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #learningPreferencesModal:not(#mathFormulaModal):not(#chemistryFormulaModal):not(#physicsFormulaModal) .modal-body,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #imageStrategyModal:not(#mathFormulaModal):not(#chemistryFormulaModal):not(#physicsFormulaModal) .modal-body,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #myPetModal:not(#mathFormulaModal):not(#chemistryFormulaModal):not(#physicsFormulaModal) .modal-body {
  padding: 18px 22px !important;
}

html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #studentInfoModal:not(#mathFormulaModal):not(#chemistryFormulaModal):not(#physicsFormulaModal) .preferences-modal-footer,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #studentSkillTagModal:not(#mathFormulaModal):not(#chemistryFormulaModal):not(#physicsFormulaModal) .preferences-modal-footer,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #ttsVoiceModal:not(#mathFormulaModal):not(#chemistryFormulaModal):not(#physicsFormulaModal) .preferences-modal-footer,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #learningPreferencesModal:not(#mathFormulaModal):not(#chemistryFormulaModal):not(#physicsFormulaModal) .preferences-modal-footer,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #imageStrategyModal:not(#mathFormulaModal):not(#chemistryFormulaModal):not(#physicsFormulaModal) .preferences-modal-footer,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #myPetModal:not(#mathFormulaModal):not(#chemistryFormulaModal):not(#physicsFormulaModal) .preferences-modal-footer {
  padding: 12px 20px calc(env(safe-area-inset-bottom) + 12px) !important;
}

html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #studentInfoModal:not(#mathFormulaModal):not(#chemistryFormulaModal):not(#physicsFormulaModal) .preferences-modal-footer .btn,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #studentInfoModal:not(#mathFormulaModal):not(#chemistryFormulaModal):not(#physicsFormulaModal) .preferences-modal-footer .btn-filled,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #studentSkillTagModal:not(#mathFormulaModal):not(#chemistryFormulaModal):not(#physicsFormulaModal) .preferences-modal-footer .btn,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #studentSkillTagModal:not(#mathFormulaModal):not(#chemistryFormulaModal):not(#physicsFormulaModal) .preferences-modal-footer .btn-filled,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #ttsVoiceModal:not(#mathFormulaModal):not(#chemistryFormulaModal):not(#physicsFormulaModal) .preferences-modal-footer .btn,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #ttsVoiceModal:not(#mathFormulaModal):not(#chemistryFormulaModal):not(#physicsFormulaModal) .preferences-modal-footer .btn-filled,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #learningPreferencesModal:not(#mathFormulaModal):not(#chemistryFormulaModal):not(#physicsFormulaModal) .preferences-modal-footer .btn,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #learningPreferencesModal:not(#mathFormulaModal):not(#chemistryFormulaModal):not(#physicsFormulaModal) .preferences-modal-footer .btn-filled,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #imageStrategyModal:not(#mathFormulaModal):not(#chemistryFormulaModal):not(#physicsFormulaModal) .preferences-modal-footer .btn,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #imageStrategyModal:not(#mathFormulaModal):not(#chemistryFormulaModal):not(#physicsFormulaModal) .preferences-modal-footer .btn-filled,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #myPetModal:not(#mathFormulaModal):not(#chemistryFormulaModal):not(#physicsFormulaModal) .preferences-modal-footer .btn,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #myPetModal:not(#mathFormulaModal):not(#chemistryFormulaModal):not(#physicsFormulaModal) .preferences-modal-footer .btn-filled {
  min-height: 48px !important;
  font-size: var(--tablet-action-font-size) !important;
}

html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) .chat-panel.is-mobile-empty #recommendQuestionsPanel .recommend-questions-btn {
  min-height: clamp(58px, calc(9.4 * var(--tablet-vh)), 70px);
  font-size: var(--tablet-body-font-size) !important;
}

html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #editorToolsFloat #scienceToolsToggle,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #editorToolsFloat #interactiveInquiryBtn {
  width: 48px !important;
  height: 48px !important;
  min-width: 48px !important;
  min-height: 48px !important;
}

html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) .input-area #mobileQuickPlusBtn {
  width: var(--tablet-composer-control-size) !important;
  height: var(--tablet-composer-control-size) !important;
  min-width: var(--tablet-composer-control-size) !important;
  min-height: var(--tablet-composer-control-size) !important;
  border: 1px solid rgba(37, 99, 235, 0.14) !important;
  border-radius: 16px !important;
  background: #ffffff !important;
  color: #2563eb !important;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08) !important;
}

/* The tablet keeps its 52px controls and shared centre line; only these two
   upload glyphs grow so they remain legible beside the larger text field. */
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) .input-area #mobileQuickPlusBtn i {
  font-size: 22px !important;
}

html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #mobileComposerBar #openCameraBtn i {
  font-size: var(--tablet-composer-camera-icon-size) !important;
}

html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial).student-tablet-chat {
  --tablet-composer-camera-scale: 1.15;
  --tablet-composer-camera-size: calc(var(--tablet-composer-control-size) * var(--tablet-composer-camera-scale));
  /* 59.8px camera + 20px padding + 2px border, rounded up for JS sizing. */
  --tablet-composer-min-height: 82px;
}

html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial).student-tablet-chat #mobileComposerBar #openCameraBtn {
  flex: 0 0 var(--tablet-composer-camera-size) !important;
  width: var(--tablet-composer-camera-size) !important;
  min-width: var(--tablet-composer-camera-size) !important;
  height: var(--tablet-composer-camera-size) !important;
}

html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial).student-tablet-chat #mobileComposerBar #openCameraBtn i {
  font-size: calc(var(--tablet-composer-camera-icon-size) * var(--tablet-composer-camera-scale)) !important;
}

html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial).student-tablet-chat #mobileComposerBar #userInput::placeholder {
  color: #546579 !important;
}

html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #mobileComposerBar {
  gap: 10px !important;
  min-height: var(--tablet-composer-min-height) !important;
  padding: 10px 12px 10px 10px !important;
  border: 1px solid rgba(37, 99, 235, 0.18) !important;
  border-radius: 20px !important;
  background: #ffffff !important;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.09) !important;
}

html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #mobileComposerBar:focus-within {
  border-color: rgba(37, 99, 235, 0.48) !important;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1), 0 8px 22px rgba(15, 23, 42, 0.1) !important;
}

html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #mobileComposerBar #userInput {
  min-height: var(--tablet-composer-text-min-height) !important;
  padding: 13px 4px !important;
  color: #1f2937 !important;
  font-size: var(--tablet-body-font-size) !important;
  line-height: 1.42 !important;
}

html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #mobileComposerBar #userInput::placeholder {
  color: #9aa4b2 !important;
  font-size: var(--tablet-secondary-font-size) !important;
}

html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #mobileInputToolbar {
  gap: 2px !important;
  min-height: var(--tablet-composer-control-size) !important;
  padding: 0 4px !important;
  border-radius: 16px !important;
  background: #f3f6fb !important;
}

html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #mobileComposerBar #mobileInputToolbar .mobile-quick-btn {
  align-self: center !important;
  width: var(--tablet-composer-toolbar-control-size) !important;
  height: var(--tablet-composer-toolbar-control-size) !important;
  min-width: var(--tablet-composer-toolbar-control-size) !important;
  min-height: var(--tablet-composer-toolbar-control-size) !important;
  border-radius: 13px !important;
  color: #2563eb !important;
}

html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #mobileComposerBar #sendBtn {
  flex: 0 0 auto;
  white-space: nowrap;
  width: var(--tablet-composer-send-width) !important;
  min-width: var(--tablet-composer-send-width) !important;
  max-width: var(--tablet-composer-send-width) !important;
  height: var(--tablet-composer-control-size) !important;
  min-height: var(--tablet-composer-control-size) !important;
  max-height: var(--tablet-composer-control-size) !important;
  margin-left: 0 !important;
  padding: 0 18px !important;
  border: 0 !important;
  border-radius: 16px !important;
  background: #2563eb !important;
  color: #ffffff !important;
  box-shadow: 0 6px 14px rgba(37, 99, 235, 0.24) !important;
  font-size: calc(17px + var(--tablet-reading-increment)) !important;
  font-weight: 700 !important;
  gap: 8px !important;
}

html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #mobileComposerBar #sendBtn i {
  font-size: 16px !important;
}

html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #mobileComposerBar #sendBtn span {
  display: inline !important;
  flex: 0 0 auto;
  white-space: nowrap;
}

html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #mobileComposerBar #sendBtn[disabled],
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #mobileComposerBar #sendBtn.is-disabled,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #mobileComposerBar #sendBtn.is-mobile-send-disabled,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #mobileComposerBar #sendBtn[data-mobile-send-visual="disabled"] {
  background: #e9eef5 !important;
  color: #94a3b8 !important;
  box-shadow: none !important;
}


html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) .mobile-welcome-title {
  font-size: clamp(38px, 5.8vmin, 46px) !important;
}

html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) .mobile-welcome-subtitle {
  font-size: clamp(18px, 2.8vmin, 22px) !important;
  margin: clamp(10px, 3vw, 16px) 0 clamp(22px, calc(5 * var(--tablet-vh)), 42px);
}

/* Tablet learning workspace: one control scale; only available width affects
   card columns and the placement of the header actions. */
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #mindmapTopicModal .mindmap-topic-header,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #flashcardQuestionModal .flashcard-question-header,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #quizPracticeModal .quiz-practice-header,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #quizPracticeHistoryModal .quiz-practice-history-header,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #practiceGeneratorModal .practice-generator-header,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #mediaModal .media-modal-header,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #podcastModal .podcast-modal-header,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #knowledgeGraphModal .knowledge-graph-header,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #knowledgeChartModal .knowledge-chart-header {
  grid-template-columns: 44px minmax(0, 1fr) !important;
  padding: calc(env(safe-area-inset-top) + 10px) 20px 10px !important;
  gap: 8px 12px !important;
  align-items: center !important;
}

html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #mindmapTopicModal .mindmap-topic-back-btn,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #flashcardQuestionModal .flashcard-question-back-btn,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #quizPracticeModal .quiz-practice-back-btn,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #quizPracticeHistoryModal .quiz-practice-history-back-btn,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #practiceGeneratorModal .practice-generator-back-btn,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #mediaModal .media-modal-back-btn,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #podcastModal .podcast-modal-back-btn,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #knowledgeGraphModal .knowledge-graph-back-btn,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #knowledgeChartModal .knowledge-chart-back-btn {
  box-sizing: border-box !important;
  padding: 0 !important;
  width: 44px !important;
  height: 44px !important;
  min-width: 44px !important;
  min-height: 44px !important;
  border-radius: 12px !important;
}

html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #mindmapTopicModal .mindmap-topic-title,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #flashcardQuestionModal .flashcard-question-title,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #quizPracticeModal .quiz-practice-title,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #quizPracticeHistoryModal .quiz-practice-history-title,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #practiceGeneratorModal .practice-generator-title,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #mediaModal .media-modal-title,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #podcastModal .podcast-modal-title,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #knowledgeGraphModal .knowledge-graph-title,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #knowledgeChartModal .knowledge-chart-title {
  font-size: calc(22px + var(--tablet-reading-increment)) !important;
  line-height: 1.3 !important;
}

html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #mindmapTopicModal .mindmap-topic-subtitle,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #flashcardQuestionModal .flashcard-question-subtitle,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #quizPracticeModal .quiz-practice-subtitle,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #quizPracticeHistoryModal .quiz-practice-history-subtitle,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #practiceGeneratorModal .practice-generator-subtitle,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #mediaModal .media-modal-subtitle,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #podcastModal .podcast-modal-subtitle,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #knowledgeGraphModal .knowledge-graph-subtitle,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #knowledgeChartModal .knowledge-chart-subtitle {
  font-size: calc(14px + var(--tablet-reading-increment)) !important;
  line-height: 1.4 !important;
}

html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #mindmapTopicModal .mindmap-topic-header-actions,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #flashcardQuestionModal .flashcard-question-header-actions,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #quizPracticeModal .quiz-practice-header-actions,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #quizPracticeHistoryModal .quiz-practice-history-header-actions,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #practiceGeneratorModal .practice-generator-header-actions,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #mediaModal .media-modal-header-actions,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #podcastModal .podcast-modal-header-actions,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #knowledgeGraphModal .knowledge-graph-header-actions,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #knowledgeChartModal .knowledge-chart-header-actions {
  gap: 8px !important;
}

html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) .learning-board-header-switch-btn,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #mindmapTopicModal .mindmap-topic-mode-btn,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #flashcardQuestionModal .flashcard-question-mode-btn,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #practiceGeneratorModal .practice-generator-mode-btn,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #practiceGeneratorModal .practice-generator-question-type-btn,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #practiceGeneratorModal .practice-generator-difficulty-btn,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #practiceGeneratorModal .practice-generator-count-btn,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #podcastModal .podcast-mode-btn,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #knowledgeGraphModal .knowledge-graph-mode-btn,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #knowledgeChartModal .knowledge-chart-header-actions .lb-btn,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #subjectReasoningModal .subject-reasoning-view-tabs .lb-btn,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #subjectStatsModal .subject-stats-range-tab,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #subjectStatsModal .subject-stats-history-toggle-btn,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #subjectStatsModal .subject-stats-regenerate-btn {
  min-height: 44px !important;
  padding: 8px 12px !important;
  border-radius: 12px !important;
  font-size: calc(15px + var(--tablet-reading-increment)) !important;
  line-height: 1.3 !important;
  gap: 6px !important;
  box-shadow: none !important;
}

/* Secondary preview controls share the tablet touch minimum too. */
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) .learning-board-showcase-back-btn,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #knowledgeGraphModal .kg-explorer__viewport-tools .lb-btn,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #chatRecordsModal .chat-records-admin__actions .admin-btn,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #chatRecordsModal .chat-records-admin__detail-actions .admin-btn,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #chatRecordsModal .personal-chat-calendar__nav,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #myLibraryModal .library-tab-btn,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #myLibraryModal .library-notes-drawing-btn,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #drawingBoardModal .drawing-controls button {
  min-width: 44px !important;
  min-height: 44px !important;
}

html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) .learning-board-showcase-stage-head {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(0, 560px);
  gap: 16px;
  align-items: center;
}

html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) .learning-board-showcase-stage-title {
  font-size: calc(18px + var(--tablet-reading-increment));
}

/* Mobile-family graph creation has one type. The existing AI creation tab
   remains the entry, so a second full-width single-choice row is redundant. */
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #knowledgeGraphModal .knowledge-graph-view-type-toggle {
  display: none !important;
}

/* Tablet graph detail must sit on an opaque surface so the selected concept
   remains readable above the network canvas, matching the desktop behavior. */
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #knowledgeGraphModal .kg-explorer__node-popover {
  background: #fff !important;
  background-color: #fff !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) .learning-board-showcase-catalog-filter {
  min-width: 0;
}

/* Wider tablet workspaces put settings beside the live preview. No nodes
   are recreated: rotating preserves forms, previews and the active view. */
@media (min-width: 1000px) {
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #mindmapTopicModal .mindmap-topic-header,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #flashcardQuestionModal .flashcard-question-header,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #quizPracticeModal .quiz-practice-header,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #quizPracticeHistoryModal .quiz-practice-history-header,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #practiceGeneratorModal .practice-generator-header,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #mediaModal .media-modal-header,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #podcastModal .podcast-modal-header,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #knowledgeGraphModal .knowledge-graph-header,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #knowledgeChartModal .knowledge-chart-header {
  grid-template-columns: 44px minmax(0, 1fr) minmax(420px, auto) !important;
}

html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #mindmapTopicModal .mindmap-topic-header-actions,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #flashcardQuestionModal .flashcard-question-header-actions,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #quizPracticeModal .quiz-practice-header-actions,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #quizPracticeHistoryModal .quiz-practice-history-header-actions,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #practiceGeneratorModal .practice-generator-header-actions,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #mediaModal .media-modal-header-actions,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #podcastModal .podcast-modal-header-actions,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #knowledgeGraphModal .knowledge-graph-header-actions,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #knowledgeChartModal .knowledge-chart-header-actions {
  grid-column: 3 !important;
  grid-row: 1 !important;
  width: auto !important;
}

html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #knowledgeChartModal .knowledge-chart-modal-view--ai:not([hidden]) {
  display: grid !important;
  grid-template-columns: minmax(300px, 34%) minmax(0, 1fr) !important;
  min-height: 100% !important;
  align-items: start !important;
}

html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #knowledgeChartModal .knowledge-chart-modal-view--ai.is-left-collapsed:not([hidden]) {
  grid-template-columns: minmax(0, 1fr) !important;
}

html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #knowledgeChartModal .knowledge-chart-controls,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #knowledgeChartModal .knowledge-chart-stage {
  width: auto !important;
  min-width: 0 !important;
}
}

/* Viewport limits below apply only to tablets, including old WebViews. */

html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial).mobile-keyboard-open {
  --mobile-chat-bottom-padding-runtime: clamp(8px, calc(2.2 * var(--tablet-vh)), 14px);
}

html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) .model-panel,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) .workflow-panel {
  max-height: min(calc(58 * var(--tablet-vh)), 520px) !important;
}

html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) .model-panel .model-panel__list {
  max-height: min(calc(54 * var(--tablet-vh)), 420px) !important;
}

html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) .workflow-panel .workflow-panel__grid {
  max-height: min(calc(46 * var(--tablet-vh)), 360px) !important;
}

html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) .learning-board-mount--floating {
  height: calc(100 * var(--tablet-vh)) !important;
}

html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) body.layout-mobile,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #mathFormulaModal .modal-content,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #chemistryFormulaModal .modal-content,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #physicsFormulaModal .modal-content {
  height: calc(100 * var(--tablet-vh)) !important;
  min-height: calc(100 * var(--tablet-vh)) !important;
  max-height: calc(100 * var(--tablet-vh)) !important;
}

html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) .modal-overlay:not(.learning-board-modal):not(#mathFormulaModal):not(#chemistryFormulaModal):not(#physicsFormulaModal) .modal-content,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #intelligentDialog .modal-content {
  max-height: calc(100 * var(--tablet-vh) - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 16px) !important;
}

html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) .modal-overlay#drawingBoardModal:not(.learning-board-modal):not(#mathFormulaModal):not(#chemistryFormulaModal):not(#physicsFormulaModal) .modal-content.drawing-modal-content,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #mindmapModal .mindmap-modal-content,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #chatRecordsModal .chat-records-modal {
  height: calc(100 * var(--tablet-vh) - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 16px) !important;
  max-height: calc(100 * var(--tablet-vh) - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 16px) !important;
}

/* A fixed 180px canvas track can push the save/upload row off a short screen. */
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) .modal-overlay#drawingBoardModal:not(.learning-board-modal):not(#mathFormulaModal):not(#chemistryFormulaModal):not(#physicsFormulaModal) > .drawing-modal-content {
  grid-template-rows: auto minmax(0, 1fr) auto !important;
}

html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #attachmentPreviewModal .attachment-preview-card {
  max-height: calc(100 * var(--tablet-vh) - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 20px) !important;
}

html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #attachmentPreviewModal .attachment-preview-body,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #attachmentPreviewModal .attachment-preview-media {
  max-height: calc(100 * var(--tablet-vh) - 180px) !important;
}

html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #studentInfoModal .preferences-modal-content,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #learningPreferencesModal .preferences-modal-content,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #studentSkillTagModal .preferences-modal-content,
html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #ttsVoiceModal .preferences-modal-content {
  max-height: calc(100 * var(--tablet-vh) - 12px) !important;
}

html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #mindmapModal.modal-overlay:not(.learning-board-modal):not(#mathFormulaModal):not(#chemistryFormulaModal):not(#physicsFormulaModal) .mindmap-modal-content {
  height: calc(100 * var(--tablet-vh)) !important;
  min-height: calc(100 * var(--tablet-vh)) !important;
}

/* Short landscape devices keep their readable controls. Scroll conversation
   content above the fixed dock instead of letting recommendations hide under it. */
@media (orientation: landscape) and (max-height: 500px) {
  html.layout-mobile.device-tablet[data-layout-page="index"]:not(.layout-industrial) #chatArea {
    flex: none !important;
    height: calc(100 * var(--tablet-vh) - var(--mobile-topbar-height-runtime) - var(--mobile-input-height-runtime) - 18px) !important;
    max-height: calc(100 * var(--tablet-vh) - var(--mobile-topbar-height-runtime) - var(--mobile-input-height-runtime) - 18px) !important;
    padding-bottom: 12px !important;
  }
}

/* TABLET_MOBILE_SHARED_V1_END */
