/* Cache-safe mobile polish for the Explain strip and Analysis header. */
@media (max-width:1000px){
  /* Navigate Setup follows the source strip as one continuous surface. The
     panel keeps the strip's width while its inner controls use the full
     aligned content track. */
  html[data-mobile-mode="position"] #trainerLayout.workspace-analyze #navigateTabContent{
    margin:0!important;
    gap:0!important;
  }
  html[data-mobile-mode="position"] #trainerLayout.workspace-analyze #navigateTabContent>.setup-panel.setup-docked{
    margin:0!important;
    padding:0 0 .26rem!important;
  }
  html[data-mobile-mode="position"] #trainerLayout.workspace-analyze #navigateTabContent>.setup-panel.setup-docked .setup-position-actions{
    margin:.08rem 0 0!important;
  }

  html.mobile-chess-shell-active[data-mobile-mode="explain"] #annotationPanel>.explain-view-selector #explainSettingsButton,
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #annotationPanel>.explain-view-selector #explainMobileCommentButton{
    min-width:0!important;
    width:auto!important;
  }
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #trainerLayout.mobile-chess-shell.workspace-analyze .middle-column>.engine-panel #bestMovesPane>.analysis-pane-header{
    grid-template-columns:auto minmax(0,1fr)!important;
    grid-template-areas:"actions progress"!important;
  }

  /* Keep the automatic evidence summary compact above the continuation table. */
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #trainerLayout.mobile-chess-shell.workspace-analyze .explore-view-toolbar{
    align-items:center!important;
    gap:.18rem!important;
    min-height:32px!important;
    margin:0 0 .12rem!important;
  }
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #trainerLayout.mobile-chess-shell.workspace-analyze .explore-compact-stats{
    gap:.18rem!important;
    font-family:var(--ai-font-interface,system-ui,-apple-system,"Segoe UI",sans-serif)!important;
    font-size:1rem!important;
    line-height:1.08!important;
  }
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #trainerLayout.mobile-chess-shell.workspace-analyze .middle-column>.engine-panel #bestMovesPane>.analysis-pane-header:has(>.explore-view-toolbar){
    grid-template-columns:minmax(0,1.05fr) minmax(5rem,.75fr) auto!important;
    grid-template-areas:"summary progress actions"!important;
    align-items:center!important;
    column-gap:.28rem!important;
    box-sizing:border-box!important;
    border:1px solid var(--ai-color-border,#cfd8e6)!important;
    border-radius:12px!important;
    background:var(--mobile-shell-surface,var(--ai-color-surface-1,#fff))!important;
    padding:.15rem .35rem!important;
    min-height:44px!important;
    height:44px!important;
    max-height:44px!important;
    margin:0!important;
  }
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #trainerLayout.mobile-chess-shell.workspace-analyze .middle-column>.engine-panel #bestMovesPane>.analysis-pane-header:has(>.explore-view-toolbar)>.explore-view-toolbar{
    grid-area:summary!important;
    display:flex!important;
    align-items:center!important;
    width:100%!important;
    min-width:0!important;
    height:44px!important;
    min-height:44px!important;
    max-height:44px!important;
    margin:0!important;
    padding:0!important;
    border:0!important;
    background:transparent!important;
    position:static!important;
  }
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #trainerLayout.mobile-chess-shell.workspace-analyze .middle-column>.engine-panel #bestMovesPane>.analysis-pane-header:has(>.explore-view-toolbar)>.explore-view-toolbar .explore-compact-stats{
    width:100%!important;
    min-width:0!important;
    flex-wrap:nowrap!important;
    overflow:hidden!important;
    white-space:nowrap!important;
    font-size:1rem!important;
    line-height:1.08!important;
  }
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #trainerLayout.mobile-chess-shell.workspace-analyze .middle-column>.engine-panel #bestMovesPane>.analysis-pane-header:has(>.explore-view-toolbar)>.analysis-header-progress{
    grid-area:progress!important;
    display:grid!important;
    grid-template-columns:auto minmax(3rem,1fr)!important;
    grid-template-rows:1fr!important;
    align-items:center!important;
    gap:.18rem!important;
    min-width:0!important;
    width:100%!important;
    height:44px!important;
    min-height:44px!important;
    margin:0!important;
    font-size:1rem!important;
    line-height:1.08!important;
  }
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #trainerLayout.mobile-chess-shell.workspace-analyze .middle-column>.engine-panel #bestMovesPane>.analysis-pane-header:has(>.explore-view-toolbar) .analysis-depth-row{
    grid-column:1!important;
    grid-row:1!important;
    display:flex!important;
    align-items:baseline!important;
    gap:.18rem!important;
    min-width:0!important;
    white-space:nowrap!important;
    font-size:1rem!important;
    line-height:1.08!important;
  }
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #trainerLayout.mobile-chess-shell.workspace-analyze .middle-column>.engine-panel #bestMovesPane>.analysis-pane-header:has(>.explore-view-toolbar) .analysis-depth-label,
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #trainerLayout.mobile-chess-shell.workspace-analyze .middle-column>.engine-panel #bestMovesPane>.analysis-pane-header:has(>.explore-view-toolbar) #analysisCurrentDepth{
    font-size:1rem!important;
    line-height:1.08!important;
  }
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #trainerLayout.mobile-chess-shell.workspace-analyze .middle-column>.engine-panel #bestMovesPane>.analysis-pane-header:has(>.explore-view-toolbar) .analysis-progress-track{
    grid-column:2!important;
    grid-row:1!important;
    width:100%!important;
    height:2px!important;
    margin:0!important;
  }
}

/* Analyze keeps the evidence strip outside the engine pane so it cannot read
   as a continuation-table header. The engine pane has no mobile content in
   this view; the standalone strip and Explorer table are the two surfaces. */
@media (max-width:1000px){
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #trainerLayout.workspace-analyze>.middle-column{
    border:0!important;
    border-radius:0!important;
    background:transparent!important;
    box-shadow:none!important;
    padding:0!important;
    margin-top:-8px!important;
  }
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #trainerLayout.workspace-analyze>.middle-column>#lichessPanel{
    display:block!important;
    box-sizing:border-box!important;
    width:100%!important;
    min-width:0!important;
    margin:0!important;
    padding:.35rem!important;
    border:1px solid var(--ai-color-border,#cfd8e6)!important;
    border-radius:12px!important;
    background:var(--mobile-shell-surface,var(--ai-color-surface-1,#fff))!important;
    overflow:visible!important;
  }
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #trainerLayout.mobile-chess-shell.workspace-analyze>.middle-column>.engine-panel.mobile-analyze-evidence-hidden{
    display:none!important;
  }
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #trainerLayout.mobile-chess-shell.workspace-analyze>.middle-column>#analysisEvidenceHeader{
    display:grid!important;
    grid-template-columns:minmax(0,1.05fr) minmax(5rem,.75fr)!important;
    grid-template-areas:"summary progress"!important;
    align-items:center!important;
    column-gap:.28rem!important;
    box-sizing:border-box!important;
    width:100%!important;
    min-width:0!important;
    min-height:44px!important;
    height:44px!important;
    max-height:44px!important;
    margin:0!important;
    padding:.15rem .35rem!important;
    border:1px solid var(--ai-color-border,#cfd8e6)!important;
    border-radius:12px!important;
    background:var(--mobile-shell-surface,var(--ai-color-surface-1,#fff))!important;
  }
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #trainerLayout.mobile-chess-shell.workspace-analyze>.middle-column>#analysisEvidenceHeader[hidden]{
    display:none!important;
  }
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #analysisEvidenceHeader>.explore-view-toolbar{
    grid-area:summary!important;
    display:flex!important;
    align-items:center!important;
    width:100%!important;
    min-width:0!important;
    min-height:0!important;
    height:100%!important;
    max-height:100%!important;
    margin:0!important;
    padding:0!important;
    border:0!important;
    background:transparent!important;
    position:static!important;
  }
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #analysisEvidenceHeader>.explore-view-toolbar .explore-compact-stats{
    width:100%!important;
    min-width:0!important;
    justify-content:flex-start!important;
    flex-wrap:nowrap!important;
    overflow:hidden!important;
    white-space:nowrap!important;
    text-align:left!important;
    font-size:1rem!important;
    line-height:1.08!important;
  }
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #analysisEvidenceHeader>.analysis-header-progress{
    grid-area:progress!important;
    display:grid!important;
    grid-template-columns:max-content minmax(0,1fr)!important;
    grid-template-rows:1fr!important;
    align-items:center!important;
    gap:.18rem!important;
    min-width:0!important;
    width:100%!important;
    min-height:0!important;
    height:100%!important;
    max-height:100%!important;
    margin:0!important;
    font-size:1rem!important;
    line-height:1.08!important;
  }
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #analysisEvidenceHeader #analysisLiveDetails{
    display:none!important;
  }
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #analysisEvidenceHeader .analysis-depth-row{
    grid-column:1!important;
    grid-row:1!important;
    display:flex!important;
    align-items:center!important;
    gap:.18rem!important;
    min-width:0!important;
    white-space:nowrap!important;
    text-transform:none!important;
    letter-spacing:normal!important;
    font-size:1rem!important;
    line-height:1.08!important;
  }
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #analysisEvidenceHeader .analysis-depth-label,
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #analysisEvidenceHeader #analysisCurrentDepth{
    text-transform:none!important;
    letter-spacing:normal!important;
    font-size:1rem!important;
    line-height:1.08!important;
  }
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #analysisEvidenceHeader .analysis-progress-track{
    grid-column:2!important;
    grid-row:1!important;
    width:100%!important;
    height:2px!important;
    margin:0!important;
  }
}

/* Navigate shares its first row between collection navigation and the live
   game summary. This is intentionally in the last mobile stylesheet because
   the shell's generic pane rule otherwise restores a column flex layout. */
@media (max-width:1000px){
  html.mobile-chess-shell-active[data-mobile-mode="position"] #trainerLayout.mobile-chess-shell.workspace-analyze>.middle-column>#lichessPanel[hidden],
  html.mobile-chess-shell-active[data-mobile-mode="position"] #trainerLayout.mobile-chess-shell.workspace-analyze>.middle-column>#exploreViewToolbar[hidden]{display:none!important}
  html.mobile-chess-shell-active[data-mobile-mode="position"] #navigateTabContent>.explore-position-collection-navigation{
    flex:0 0 44px!important;
    width:100%!important;
    min-width:0!important;
    min-height:44px!important;
    height:44px!important;
    max-height:44px!important;
    margin:0!important;
  }
}

@media (max-width:1000px){
  html.mobile-chess-shell-active[data-mobile-mode="position"] #trainerLayout.mobile-chess-shell>.middle-column>#navigateTabContent.navigate-evidence-row{
    display:grid!important;
    grid-template-columns:minmax(0,1fr) minmax(0,1fr)!important;
    grid-template-rows:44px minmax(0,1fr)!important;
    align-items:stretch!important;
    row-gap:0!important;
    column-gap:0!important;
    overflow:hidden!important;
  }
  html.mobile-chess-shell-active[data-mobile-mode="position"] #navigateTabContent.navigate-evidence-row>#exploreEvidenceHeader{
    grid-column:1/-1!important;
    grid-row:1!important;
    display:grid!important;
    grid-template-columns:minmax(0,1fr) minmax(0,1fr)!important;
    grid-template-rows:42px!important;
    align-items:stretch!important;
    box-sizing:border-box!important;
    width:100%!important;
    min-width:0!important;
    min-height:44px!important;
    height:44px!important;
    max-height:44px!important;
    margin:0!important;
    padding:0!important;
    border:1px solid var(--ai-color-border,#cfd8e6)!important;
    border-radius:12px!important;
    background:var(--mobile-shell-surface,var(--ai-color-surface-1,#fff))!important;
  }
  html.mobile-chess-shell-active[data-mobile-mode="position"] #trainerLayout.mobile-chess-shell>.middle-column>#navigateTabContent.navigate-evidence-row>#exploreEvidenceHeader[hidden]{
    display:none!important;
  }
  html.mobile-chess-shell-active[data-mobile-mode="position"] #navigateTabContent.navigate-evidence-row>#exploreEvidenceHeader>#explorePositionCollectionNavigation{
    grid-column:2!important;
    grid-row:1!important;
    width:100%!important;
    min-width:0!important;
    min-height:42px!important;
    height:42px!important;
    max-height:42px!important;
    margin:0!important;
  }
  html.mobile-chess-shell-active[data-mobile-mode="position"] #navigateTabContent.navigate-evidence-row>#exploreEvidenceHeader>#explorePositionCollectionNavigation>button{
    min-height:42px!important;
    height:42px!important;
  }
  html.mobile-chess-shell-active[data-mobile-mode="position"] #navigateTabContent.navigate-evidence-row>#exploreEvidenceHeader>.explore-view-toolbar{
    grid-column:1!important;
    grid-row:1!important;
    display:flex!important;
    align-items:center!important;
    justify-content:flex-start!important;
    width:100%!important;
    min-width:0!important;
    min-height:42px!important;
    height:42px!important;
    max-height:42px!important;
    margin:0!important;
    padding:.15rem .35rem!important;
    border:0!important;
    background:transparent!important;
    position:static!important;
  }
  html.mobile-chess-shell-active[data-mobile-mode="position"] #trainerLayout.mobile-chess-shell.workspace-analyze.mobile-position-setup-open #exploreViewToolbar[hidden]{display:none!important}
  html.mobile-chess-shell-active[data-mobile-mode="position"] #navigateTabContent.navigate-evidence-row>#exploreEvidenceHeader>.explore-view-toolbar .explore-compact-stats{
    justify-content:flex-start!important;
    text-align:left!important;
    font-size:1rem!important;
    line-height:1.08!important;
  }
  html.mobile-chess-shell-active[data-mobile-mode="position"] #navigateTabContent.navigate-evidence-row>#lichessPanel{
    grid-column:1/-1!important;
    grid-row:2!important;
    min-width:0!important;
    min-height:0!important;
    width:100%!important;
  }
}

/* Final mobile Explain pane normalization: every active tab owns one
   natural-height content frame; Settings and Comment do not add a second. */
@media(max-width:760px){
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #trainerLayout.workspace-analyze #annotationPanel{
    display:flex!important;
    flex-direction:column!important;
    gap:var(--mobile-ui-gap-sm,.35rem)!important;
    flex:0 0 auto!important;
    height:auto!important;
    min-height:0!important;
    max-height:none!important;
    overflow:visible!important;
  }
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #trainerLayout.workspace-analyze #annotationPanel>#positionAnalysisPane,
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #trainerLayout.workspace-analyze #annotationPanel>#moveAnalysisPane{
    display:block!important;
    flex:0 0 auto!important;
    align-self:stretch!important;
    width:100%!important;
    height:auto!important;
    min-height:0!important;
    max-height:none!important;
    overflow:visible!important;
  }
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #trainerLayout.workspace-analyze #annotationPanel[data-mobile-explain-view="position"]>#moveAnalysisPane,
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #trainerLayout.workspace-analyze #annotationPanel[data-mobile-explain-view="move"]>#positionAnalysisPane{
    display:none!important;
  }
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #trainerLayout.workspace-analyze #annotationPanel>#positionAnalysisPane>.analysis-pane-header,
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #trainerLayout.workspace-analyze #annotationPanel>#moveAnalysisPane>.analysis-pane-header{
    display:grid!important;
    grid-template-columns:minmax(0,1fr) auto!important;
    grid-template-areas:"title action" "status status"!important;
    align-items:center!important;
    gap:.3rem!important;
    margin:0 0 .35rem!important;
  }
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #trainerLayout.workspace-analyze #annotationPanel .analysis-pane-header h2{
    grid-area:title!important;
    margin:0!important;
    white-space:nowrap!important;
  }
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #trainerLayout.workspace-analyze #annotationPanel .analysis-pane-header>.annotation-header-progress{
    grid-area:status!important;
    width:100%!important;
    min-width:0!important;
  }
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #trainerLayout.workspace-analyze #annotationPanel .analysis-pane-header>button{
    grid-area:action!important;
    justify-self:end!important;
  }
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #trainerLayout.workspace-analyze #annotationPanel>#positionAnalysisPane>#annotationPositionContent,
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #trainerLayout.workspace-analyze #annotationPanel>#moveAnalysisPane>#annotationMoveContent{
    display:block!important;
    height:auto!important;
    min-height:0!important;
    max-height:none!important;
    overflow:visible!important;
    flex:none!important;
    padding:0!important;
  }
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #trainerLayout.workspace-analyze #annotationPanel>#positionAnalysisPane.explain-settings-open>#explainSettingsPopover{
    display:block!important;
    flex:none!important;
    width:100%!important;
    height:auto!important;
    min-height:0!important;
    margin:0!important;
    border:0!important;
    border-radius:0!important;
    background:transparent!important;
    box-shadow:none!important;
    overflow:auto!important;
  }
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #trainerLayout.workspace-analyze #annotationPanel>#positionAnalysisPane.explain-settings-open{
    border:0!important;
    border-radius:0!important;
    background:transparent!important;
    box-shadow:none!important;
    padding:0!important;
  }
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #trainerLayout.workspace-analyze #annotationPanel>#positionAnalysisPane.explain-comment-open>#positionCommentPanel{
    display:block!important;
    flex:none!important;
    width:100%!important;
    height:auto!important;
    min-height:0!important;
    margin:0!important;
    padding:0!important;
    border:0!important;
    border-radius:0!important;
    background:transparent!important;
    box-shadow:none!important;
    overflow:visible!important;
  }

  /* Keep the Position action and its depth together on one compact mobile
     row. The shared Settings/Comment tabs live above this pane. */
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #trainerLayout.workspace-analyze #annotationPanel>#positionAnalysisPane>.analysis-pane-header{
    display:grid!important;
    grid-template-columns:auto minmax(0,1fr)!important;
    grid-template-areas:"action status"!important;
    align-items:center!important;
    gap:.34rem!important;
    min-height:2.1rem!important;
    margin:0 0 .28rem!important;
  }
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #trainerLayout.workspace-analyze #positionAnalysisPane>#positionAnalysisHeading{
    display:none!important;
  }
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #trainerLayout.workspace-analyze #positionAnalysisPane>#explainPositionButton{
    grid-area:action!important;
    justify-self:start!important;
    min-width:5.2rem!important;
    height:2rem!important;
    min-height:2rem!important;
    margin:0!important;
    padding:.22rem .52rem!important;
    font-size:var(--mobile-control-font,.78rem)!important;
    line-height:1.1!important;
  }
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #trainerLayout.workspace-analyze #positionAnalysisPane>#positionStatusCell{
    grid-area:status!important;
    display:flex!important;
    justify-content:flex-start!important;
    align-items:center!important;
    width:auto!important;
    min-width:0!important;
    margin:0!important;
  }
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #trainerLayout.workspace-analyze #positionAnalysisPane>#positionStatusCell .analysis-depth-label,
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #trainerLayout.workspace-analyze #positionAnalysisPane>#positionStatusCell .hint,
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #trainerLayout.workspace-analyze #positionAnalysisPane>#positionStatusCell .analysis-progress-track{
    display:none!important;
  }
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #trainerLayout.workspace-analyze #positionAnalysisPane>#positionStatusCell #positionStatusValue{
    font-size:var(--mobile-control-font,.78rem)!important;
    font-weight:700!important;
    line-height:1!important;
    white-space:nowrap!important;
  }
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #trainerLayout.workspace-analyze #annotationPanel #annotationPositionContent,
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #trainerLayout.workspace-analyze #annotationPanel #annotationMoveContent{
    font-size:var(--mobile-body-font,.86rem)!important;
    line-height:1.42!important;
  }
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #trainerLayout.workspace-analyze #annotationPanel #annotationPositionContent .annotation-lead,
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #trainerLayout.workspace-analyze #annotationPanel #annotationMoveContent .annotation-lead{
    font-size:var(--mobile-body-font,.86rem)!important;
    line-height:1.42!important;
  }
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #trainerLayout.workspace-analyze #annotationPanel #annotationPositionContent .annotation-section,
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #trainerLayout.workspace-analyze #annotationPanel #annotationMoveContent .annotation-section,
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #trainerLayout.workspace-analyze #annotationPanel #annotationPositionContent .annotation-instructions,
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #trainerLayout.workspace-analyze #annotationPanel #annotationMoveContent .annotation-instructions{
    font-size:var(--mobile-body-font,.86rem)!important;
    line-height:1.42!important;
  }
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #trainerLayout.workspace-analyze #annotationPanel #annotationPositionContent h3,
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #trainerLayout.workspace-analyze #annotationPanel #annotationMoveContent h3{
    font-size:.94rem!important;
    line-height:1.3!important;
  }
}

/* Final shared phone visual pass: match Navigate's blue/neutral content
   controls and action spacing while preserving mode-specific navigation
   accents, connected tab strips, and analysis-result colors. */
@media (max-width:760px){
  html.mobile-chess-shell-active[data-mobile-mode] #trainerLayout.mobile-chess-shell{
    --mobile-page-flow-gap:2px;
    row-gap:var(--mobile-page-flow-gap)!important;
  }
  html.mobile-chess-shell-active[data-mobile-mode="position"] #trainerLayout.mobile-chess-shell #navigateTabContent>.setup-panel.setup-docked .setup-position-actions{
    margin-top:var(--mobile-page-flow-gap)!important;
  }
  html.mobile-chess-shell-active[data-mobile-mode="position"] #trainerLayout.mobile-chess-shell #navigateTabContent>.setup-panel.setup-docked .setup-palette{
    margin-top:var(--mobile-page-flow-gap)!important;
  }
  html.mobile-chess-shell-active[data-mobile-mode="play"] #trainerLayout.mobile-chess-shell>.play-side-column{
    gap:var(--mobile-page-flow-gap)!important;
  }
  html.mobile-chess-shell-active[data-mobile-mode="play"] #trainerLayout.mobile-chess-shell #playModeInfo>#playStartChoices{
    margin-top:var(--mobile-page-flow-gap)!important;
  }
  html.mobile-chess-shell-active[data-mobile-mode="training"] #trainerLayout.mobile-chess-shell #lichessSharedRoot .lvgb-training-mobile-launch{
    box-sizing:border-box!important;
    width:100%!important;
    max-width:none!important;
    min-height:0!important;
    margin:0!important;
    padding:0!important;
    border:0!important;
    border-radius:0!important;
    background:transparent!important;
    box-shadow:none!important;
    gap:0!important;
  }
  html.mobile-chess-shell-active[data-mobile-mode="training"] #trainerLayout.mobile-chess-shell #lichessSharedRoot .lvgb-training-card{
    box-sizing:border-box!important;
    width:100%!important;
    max-width:none!important;
    gap:var(--mobile-page-flow-gap)!important;
    padding:0!important;
  }

  html.mobile-chess-shell-active[data-mobile-mode] #trainerLayout.mobile-chess-shell input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]):not([type=file]):not([type=hidden]),
  html.mobile-chess-shell-active[data-mobile-mode] #trainerLayout.mobile-chess-shell select,
  html.mobile-chess-shell-active[data-mobile-mode] #trainerLayout.mobile-chess-shell textarea{
    background:var(--ai-color-surface-1,#fff)!important;
    border-color:var(--ai-color-border,#cfd8e6)!important;
    color:var(--ai-color-text,#162033)!important;
    caret-color:var(--ai-color-accent,#4267ff)!important;
  }
  html.mobile-chess-shell-active[data-mobile-mode] #trainerLayout.mobile-chess-shell input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]):not([type=file]):not([type=hidden]):focus-visible,
  html.mobile-chess-shell-active[data-mobile-mode] #trainerLayout.mobile-chess-shell select:focus-visible,
  html.mobile-chess-shell-active[data-mobile-mode] #trainerLayout.mobile-chess-shell textarea:focus-visible{
    border-color:var(--ai-color-accent,#4267ff)!important;
    outline:2px solid color-mix(in srgb,var(--ai-color-accent,#4267ff) 28%,transparent)!important;
    outline-offset:1px!important;
  }

  html.mobile-chess-shell-active[data-mobile-mode] #trainerLayout [class*="actions"],
  html.mobile-chess-shell-active[data-mobile-mode] #trainerLayout [class*="action-row"],
  html.mobile-chess-shell-active[data-mobile-mode] dialog [class*="actions"],
  html.mobile-chess-shell-active[data-mobile-mode] dialog [class*="action-row"]{
    gap:.35rem!important;
  }
  html.mobile-chess-shell-active[data-mobile-mode] dialog form,
  html.mobile-chess-shell-active[data-mobile-mode] #trainerLayout #lichessTrainingConfiguration,
  html.mobile-chess-shell-active[data-mobile-mode] #trainerLayout #explainSettingsPopover,
  html.mobile-chess-shell-active[data-mobile-mode] #trainerLayout #positionCommentPanel,
  html.mobile-chess-shell-active[data-mobile-mode] #trainerLayout .lvgb-training-preparation-settings,
  html.mobile-chess-shell-active[data-mobile-mode] #trainerLayout .lvgb-training-preparation-grid{
    gap:.35rem!important;
  }
}

/* Analyze owns exactly one lower workspace.  This fail-safe deliberately
   keys on the route's mobile-mode/submode data, NOT on the async
   mobile-chess-shell-active class. A late/missed shell activation must never
   reveal Navigate/Explain toolbars underneath the Analysis tab. */
@media (max-width:1000px){
  html[data-mobile-mode="explain"] #trainerLayout.workspace-analyze>.middle-column>#explorePositionSourceControl,
  html[data-mobile-mode="explain"] #trainerLayout.workspace-analyze #workspaceTabs{
    display:none!important;
  }
  html[data-mobile-mode="explain"][data-mobile-analysis-submode="engine"] #trainerLayout.workspace-analyze>.right-column,
  html[data-mobile-mode="explain"][data-mobile-analysis-submode="explain"] #trainerLayout.workspace-analyze>.middle-column{
    display:none!important;
  }
  html[data-mobile-mode="explain"] #trainerLayout.workspace-analyze .mobile-primary-hidden{
    display:none!important;
  }
}
