/* Reading belongs to the document; media cropping and canvas gestures stay local. */
html:has(.profile-shell) { height:auto; overflow:visible; }
body:not(:has(#chatSidebar,.chat-view)) { overflow:visible; }
body:has(:is(.teacher-shell,.student-shell,.admin-shell,.profile-shell)) { height:auto; min-height:100dvh; overflow:visible; }
:is(.teacher-shell,.student-shell,.admin-shell,.profile-shell,.profile-layout) { height:auto; min-height:0; overflow:visible; align-items:start; }
.auth-view { height:auto; max-height:none; overflow:visible; }
:is(.teacher-shell,.student-shell,.admin-shell) { min-height:100dvh; }
:is(.teacher-shell,.student-shell,.admin-shell) .page-header { min-height:0; margin-bottom:12px; }
:is(.teacher-shell,.student-shell,.admin-shell) .page-header h1 { margin:0 0 4px; line-height:1.15; }
:is(.teacher-shell,.student-shell,.admin-shell) .page-header > div > small { display:none; }
@media (min-width:1101px) { :is(.teacher-shell,.student-shell,.admin-shell) > main { padding-top:12px; } }
:is(.teacher-sidebar,.student-sidebar,.admin-sidebar) { position:static; height:auto; min-height:100dvh; overflow:visible; align-self:start; }
#chatSidebar { height:100dvh; min-height:0; overflow-y:auto; align-self:start; }
#chatSidebar .conversation-list { min-height:80px; overscroll-behavior:contain; }
:is(.teacher-shell,.student-shell,.admin-shell) > main { height:auto; min-height:0; overflow:visible; }
:is(#workspaceView,#aiView,#lessonsView,#classrooms,#wordBlocksView,#profileAccountView,#profileSettingsView,.profile-workspace,.profile-nav,.settings-content,.settings-categories,.risk-alerts,.chart-card,.attention-card,.chat-transcripts,.request-list,#knowledgeReaderBody,#referenceEditor,.table-container,.notification-list,.learning-questions) { height:auto; max-height:none; overflow:visible; overscroll-behavior:auto; }
#overviewView { flex:none; grid-template-rows:auto auto auto; overflow:visible; }
:is(.profile-panel,.profile-identity,.profile-identity strong,.profile-identity div span,.profile-topbar h1) { overflow:visible; white-space:normal; text-overflow:clip; overflow-wrap:anywhere; }
html.profile-route :is(body,.profile-shell,.profile-layout,.profile-workspace,#profileAccountView,#profileSettingsView,#settingsDialog,.settings-content) { height:auto; min-height:0; max-height:none; overflow:visible; }
html.profile-route #settingsDialog { display:flex; flex:1; flex-direction:column; overflow:clip; }
:is(.settings-form,#settingsForm) { height:auto; min-height:0; grid-template-rows:auto; }
html.profile-route #profileShell { min-height:100dvh; grid-template-rows:auto 1fr; align-items:stretch; }
.profile-layout { align-items:stretch; }
html.profile-route .profile-workspace { display:flex; flex-direction:column; }
html.profile-route #profileAccountView { width:100%; }
html.profile-route #profileSettingsView { flex:1; width:100%; }
html.profile-route #profileSettingsMount { display:flex; flex-direction:column; }
html.profile-route #settingsForm { flex:1; }
.profile-topbar,.settings-heading { position:static; }
.profile-settings-actions { position:static; }
.teacher-sidebar nav,.student-sidebar nav,.admin-sidebar nav,.sidebar-footer,.settings-categories { flex-wrap:wrap; overflow:visible; }
.account-area .account-menu { position:absolute; margin-block:0; }
:is(.classroom-chat,.classroom-chat-history,.classroom-chat .message-form:has(details[open])) { flex:none; height:auto; max-height:none; overflow:visible; }
body:has(.nav-item[data-view="messages"][aria-current="page"]):has(#workspaceView:not([hidden]) .classroom-chat) { height:auto; overflow:visible;
  :is(.teacher-shell,.student-shell,main,#workspaceView,#classrooms,#classrooms > .classroom) { height:auto; min-height:0; overflow:visible; }
  .workspace-toolbar { max-height:none; overflow:visible; }
}
:is(.ai-output-body,.error-body,.payload pre,#repairCaseError,#deleteRepairNames,.repair-result pre,.draft-status) { height:auto; max-height:none; overflow:visible; white-space:pre-wrap; overflow-wrap:anywhere; }
:is(.markdown-content pre,.knowledge-section-body pre,.markdown-content code,pre code,.scratchblocks-source) { white-space:pre-wrap; overflow-wrap:anywhere; word-break:normal; max-height:none; overflow:visible; }
:is(.markdown-table-scroll,.knowledge-section-body .markdown-table-scroll,.markdown-content .katex-display,.scratchblocks-rendered,.scratchblocks-view,.preset-guide-body .scratchblocks-view,.preset-guide-body pre.scratchblocks) { max-height:none; overflow:visible; }
:is(.scratchblocks-rendered,.scratchblocks-view) > svg { max-width:100%; height:auto; }
.scratch-source-details pre { padding:12px; white-space:pre-wrap; overflow-wrap:anywhere; }
.scratch-source-details summary { cursor:pointer; min-height:44px; padding:10px 0; }
.asset-carousel-cards { overflow:visible; scroll-snap-type:none; }
.asset-carousel-cards > [hidden] { display:none; }
body .sp-user-name[aria-label],body .sp-user-name[aria-label] > span { flex-wrap:wrap; white-space:normal; overflow:visible; text-overflow:clip; overflow-wrap:anywhere; }
:is(.classroom-card > h2,.classroom > h2,.assignment > h3,.roster-heading h2,.risk-row strong,.activity-name,.classroom h2,.student-info strong,.student-info small,.assignment-navigation-card > strong,.assignment-navigation-card > span,.assignment-navigation-card > small,.assignment-title,.attachment-link,#attachedSb3Name,.preset-card-v1) { white-space:normal; overflow:visible; text-overflow:clip; overflow-wrap:anywhere; }
:is(.teacher-profile,.student-profile) :is(strong,small) { white-space:normal; overflow:visible; overflow-wrap:anywhere; }
.file-control-name { white-space:normal; overflow:visible; text-overflow:clip; overflow-wrap:anywhere; }
.field-meta .field-error { height:auto !important; max-height:none !important; overflow:visible !important; }
#presetChainList small { display:block; -webkit-line-clamp:unset; max-height:none; white-space:normal; overflow:visible; }
.sparky-toast-region { max-height:none; overflow:visible; }
.sparky-toast-card > p { display:-webkit-box; -webkit-box-orient:vertical; -webkit-line-clamp:3; overflow:hidden; }
@media (max-height:360px) { .sparky-toast-card > p { -webkit-line-clamp:1; } }
:is(.message,.markdown-content,.knowledge-section-body,.user-identity,.user-actions,td,th) { min-width:0; overflow-wrap:anywhere; }
textarea:not(form.composer textarea),.classroom-chat .message-form textarea { max-height:none; overflow-y:hidden; resize:vertical; }
.message :is(.import-scratch,.import-blocks,.request-game-answer,.lesson-next,.next-guide-step,.download-game-answer,.download-project-btn,.generate-asset,.preview-asset,.import-costume) { white-space:normal; text-overflow:clip; overflow:visible; overflow-wrap:anywhere; }
.user-filters label { margin-top:0; }
.history-load-older { display:block; width:fit-content; margin:12px auto; }
.history-load-older[hidden] { display:none; }
.flow-pagination { display:flex; flex-wrap:wrap; align-items:center; justify-content:flex-end; gap:10px; margin-block:16px; max-width:100%; }
.flow-pagination[hidden] { display:none; }
.flow-pagination > span { min-width:0; overflow-wrap:anywhere; }
.flow-pagination button { width:auto; min-height:44px; max-width:100%; margin:0; padding:8px 12px; border:1px solid var(--sp-line-strong,#bdccdc); border-radius:var(--sp-radius-control,10px); color:var(--sp-primary,#0a63cb); background:var(--sp-surface,#fff); font:inherit; cursor:pointer; white-space:normal; }
.flow-pagination button:disabled { cursor:not-allowed; color:var(--sp-text-muted,#607089); background:var(--sp-surface-subtle,#f0f5fb); }
.flow-off-page { display:none !important; }
.flow-selected-value { display:block; margin-top:6px; color:var(--sp-text-muted,#607089); overflow-wrap:anywhere; }
table { width:100%; min-width:0; max-width:100%; table-layout:fixed; }
.markdown-content .markdown-table-card table { width:100%; min-width:0; max-width:100%; table-layout:fixed; }
.markdown-table-card :is(th,td) { overflow-wrap:anywhere; }
.game-idea-card > strong,.chat-group-header .group-toggle span { white-space:normal; overflow:visible; text-overflow:clip; overflow-wrap:anywhere; }
button:not(.conversation-title) { white-space:normal !important; overflow-wrap:anywhere; max-width:100%; }
td,th { white-space:normal; overflow-wrap:anywhere; }
td > :is(button,a,input,select) { max-width:100%; }
@media (max-width:1100px) {
  #chatSidebar { position:fixed; }
  .has-dashboard-sidebar #dashboardSidebar { position:static; width:100%; height:auto; min-height:0; overflow:visible; grid-column:1 / -1; }
  .sidebar-backdrop:not([hidden]) { display:none; }
  .has-dashboard-sidebar.dashboard-sidebar-open #dashboardSidebar { display:flex; }
}
@media (max-width:760px) {
  :is(.teacher-sidebar,.student-sidebar,.admin-sidebar) { min-height:0; }
  .settings-categories { display:flex; flex-wrap:wrap; }
  table[data-flow-table] thead { position:absolute; width:1px; height:1px; padding:0; overflow:hidden; clip-path:inset(50%); }
  table[data-flow-table] :is(tbody,tr,td) { display:block; width:100%; min-width:0; }
  table[data-flow-table] tbody tr { margin-block:12px; padding:12px; border:1px solid var(--sp-line,#dbe4ef); border-radius:10px; }
  table[data-flow-table] td { padding:7px 0; border:0; text-align:start; }
  table[data-flow-table] td[data-label]:not([data-label=""])::before { content:attr(data-label); display:block; margin-bottom:3px; color:var(--sp-text-muted,#607089); font-weight:650; }
  .profile-layout { grid-template-columns:minmax(0,1fr); }
  .profile-nav { display:flex; flex-wrap:wrap; }
}
