/*
 * Chess Trainer Explore / Explain responsive workspace contract.
 *
 * Play is intentionally NOT defined here. The accepted Play layout is isolated
 * in play-layout.css, which is loaded after every other application stylesheet
 * and guarded by tests/frontend/play-layout-freeze.test.mjs.
 *
 * This file owns only the Analyze workspace geometry: board + Explore + Explain.
 * Its contract mirrors Play's accepted behavior:
 *   - board and navigation are one attached visual unit;
 *   - geometry is driven by actual browser width/height, not device names;
 *   - large screens show Board | Explore | Explain with draggable dividers;
 *   - the outer page does not scroll on large/compact-horizontal layouts;
 *   - only the pane that contains excess data scrolls;
 *   - typography scales with the pane that contains it.
 */

#trainerLayout:not(.workspace-analyze) { --analysis-adaptive-density: 1; }

/* ---------- Common Analyze typography ---------- */
#trainerLayout.workspace-analyze .middle-column,
#trainerLayout.workspace-analyze .right-column{min-width:0!important}
#trainerLayout.workspace-analyze .middle-column{container:explore-pane / inline-size}
#trainerLayout.workspace-analyze .right-column{container:explain-pane / inline-size}

#trainerLayout.workspace-analyze .analysis-compact-columns{
  font-size:clamp(.74rem,3.8cqw,.98rem)!important;
  min-height:clamp(1.25rem,5.7cqw,1.7rem)!important
}

/* The compact info/lightning controls are one horizontal action group. Keep
   this override after the generic mobile header-span grid rule above. */
@media(max-width:1000px){
  #trainerLayout.workspace-analyze #lichessPanel #lichessExplorerPane .lvgb-mobile-explorer-columns>.lvgb-explorer-header-actions{
    display:flex!important;
    flex-direction:row!important;
    flex-wrap:nowrap!important;
    align-items:center!important;
    justify-content:flex-end!important;
    min-width:2.15rem!important;
    width:2.15rem!important;
    height:1.1rem!important;
    overflow:visible!important;
    white-space:nowrap!important
  }
}
#trainerLayout.workspace-analyze .analysis-compact-row{
  height:auto!important;
  min-height:clamp(1.72rem,7.6cqw,2.35rem)!important
}
#trainerLayout.workspace-analyze .analysis-compact-row>.analysis-compact-move,
#trainerLayout.workspace-analyze .analysis-compact-row>.analysis-compact-win,
#trainerLayout.workspace-analyze .analysis-compact-row>.analysis-compact-pv-preview{
  height:auto!important;
  min-height:clamp(1.5rem,6.9cqw,2.08rem)!important
}
#trainerLayout.workspace-analyze .analysis-compact-move{font-size:clamp(.9rem,5.8cqw,1.22rem)!important}
#trainerLayout.workspace-analyze .analysis-compact-win,
#trainerLayout.workspace-analyze .analysis-compact-leaf,
#trainerLayout.workspace-analyze .analysis-compact-pv-preview-move,
#trainerLayout.workspace-analyze .analysis-compact-pv-more,
#trainerLayout.workspace-analyze .analysis-compact-pv-move{font-size:clamp(.8rem,5cqw,1.08rem)!important}

#trainerLayout.workspace-analyze #annotationPanel>.explain-view-selector button{
  font-size:clamp(.88rem,4.5cqw,1.14rem)!important;
  min-height:clamp(2.12rem,7.8cqw,2.7rem)!important
}
#trainerLayout.workspace-analyze .annotation-content-view,
#trainerLayout.workspace-analyze .annotation-lead,
#trainerLayout.workspace-analyze .annotation-section,
#trainerLayout.workspace-analyze .annotation-play-row{
  font-size:clamp(.96rem,5.2cqw,1.28rem)!important;
  line-height:1.5!important
}
#trainerLayout.workspace-analyze .annotation-content-view h3{font-size:clamp(1.08rem,5.8cqw,1.42rem)!important}
#trainerLayout.workspace-analyze .annotation-instructions{font-size:clamp(.94rem,5cqw,1.2rem)!important;line-height:1.5!important}

/* ---------- Analyze: normal phone/tablet portrait document flow ---------- */
@media (max-width:1000px){
  #trainerLayout.workspace-analyze>.board-column,
#trainerLayout.workspace-analyze>.middle-column,
#trainerLayout.workspace-analyze>.right-column{
    min-width:0!important;max-width:100%!important
  }

  /* Keep the established portrait phone arrangement. Only typography receives a
     modest width-aware floor so larger phones/tablets do not look miniature. */
  #trainerLayout.workspace-analyze .analysis-pane button,
#trainerLayout.workspace-analyze .lvgb-button,
#trainerLayout.workspace-analyze .lvgb-position-source-button,
#trainerLayout.workspace-analyze select{
    font-size:clamp(.78rem,calc(.38rem + 1.45vw),.98rem)
  }
  #trainerLayout.workspace-analyze .lvgb-explorer-row>span strong,
#trainerLayout.workspace-analyze .lvgb-explorer-row>span.score strong{
    font-size:clamp(.7rem,calc(.34rem + 1.55vw),.9rem)!important;
    line-height:1.14!important
  }
  #trainerLayout.workspace-analyze .lvgb-explorer-row>span.move strong{
    font-size:clamp(.8rem,calc(.34rem + 1.9vw),1rem)!important
  }

  /* Short vertical Analyze keeps the active surface below the board, but moves
     the primary modes to a side rail and reserves viewport height for visible
     Explore/Explain content. */
  
  
  
  
  
  
  
  
  
  
  
  
  
  

  /* Geometry-driven compact horizontal Analyze: rail + complete board on the
     left, current Explore OR Explain surface on the right. This is selected by
     JS only when the window is wide enough to make the side-by-side choice more
     useful than a tiny board stacked above content. */
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  

  /* Every control inside a compact Analyze composition follows the same density
     as the board instead of retaining full-size phone/tablet typography. */
  
  
  
  
  
  
}

/* ---------- Analyze: tablet landscape / laptop / desktop ---------- */
@media (min-width:1001px){
  html.analysis-workspace-active,
html.analysis-workspace-active body{
    width:100%!important;height:100%!important;overflow:hidden!important;overscroll-behavior:none!important
  }
  html.analysis-workspace-active body{background:var(--ai-color-background,#f6f8fc)!important}
  html.analysis-workspace-active .chess-app{
    width:calc(100% - clamp(.8rem,1.5vw,1.5rem))!important;
    max-width:none!important;height:calc(100dvh - clamp(.8rem,1.5vw,1.5rem))!important;max-height:none!important;
    margin:clamp(.4rem,.75vw,.75rem) auto!important;padding:clamp(.35rem,.55vw,.6rem)!important;
    border:1px solid var(--ai-color-border-strong,#9aa9bd)!important;border-radius:10px!important;
    overflow:hidden!important;background:var(--ai-color-background,#f6f8fc)!important
  }
  #trainerLayout.workspace-analyze{
    --analysis-rail-width:clamp(3.65rem,4.4vw,5.1rem);
    display:grid!important;
    grid-template-columns:minmax(23rem,var(--board-pane-percent,40%)) .72rem minmax(17rem,var(--position-pane-track,50fr)) .72rem minmax(17rem,var(--explain-pane-track,50fr))!important;
    grid-template-rows:minmax(0,1fr)!important;
    gap:clamp(.35rem,.55vw,.6rem)!important;
    width:100%!important;height:100%!important;min-height:0!important;overflow:hidden!important;align-items:stretch!important
  }
  #trainerLayout.workspace-analyze>.board-column{
    grid-column:1!important;grid-row:1!important;
    display:grid!important;
    grid-template-columns:var(--analysis-rail-width) minmax(0,1fr)!important;
    grid-template-rows:minmax(0,1fr) auto!important;
    column-gap:clamp(.42rem,.6vw,.68rem)!important;row-gap:clamp(.18rem,.35vh,.32rem)!important;
    width:100%!important;height:100%!important;min-width:0!important;min-height:0!important;
    padding:clamp(.18rem,.3vw,.3rem)!important;overflow:hidden!important;
    align-content:center!important;align-items:center!important;justify-items:center!important
  }
  
  
  
  
  
  
  
  /* Explore + Explain are simultaneously visible on large screens, so the
     combined Explore icon represents both and the separate Explain rail button
     remains hidden as in the established desktop navigation model. */
  

  #trainerLayout.workspace-analyze>.board-column>#board{
    grid-column:2!important;grid-row:1!important;
    width:min(100%,44rem,var(--board-viewport-max,44rem),calc(100dvh - 7.2rem))!important;
    max-width:100%!important;min-width:0!important;justify-self:center!important;align-self:end!important;margin:0!important
  }
  #trainerLayout.workspace-analyze>.board-column>.history-navigation{
    grid-column:2!important;grid-row:2!important;
    width:min(100%,44rem,var(--board-viewport-max,44rem),calc(100dvh - 7.2rem))!important;
    max-width:100%!important;min-width:0!important;justify-self:center!important;align-self:start!important;
    margin:0!important;min-height:clamp(2.8rem,4.8vh,3.5rem)!important;
    gap:clamp(.28rem,.45vw,.45rem)!important
  }
  #trainerLayout.workspace-analyze>.board-column>.history-navigation .history-arrow,
#trainerLayout.workspace-analyze>.board-column>.history-navigation #favoritePositionButton{
    min-height:clamp(2.6rem,4.4vh,3.25rem)!important;height:clamp(2.6rem,4.4vh,3.25rem)!important;
    padding:0!important;font-size:clamp(1.12rem,1.45vw,1.5rem)!important
  }

  #trainerLayout.workspace-analyze>#workspaceDivider{display:block!important;grid-column:2!important;grid-row:1!important;min-height:0!important;cursor:col-resize!important}
  #trainerLayout.workspace-analyze>.middle-column{grid-column:3!important;grid-row:1!important}
  #trainerLayout.workspace-analyze>#analysisDivider{display:block!important;grid-column:4!important;grid-row:1!important;min-height:0!important;cursor:col-resize!important}
  #trainerLayout.workspace-analyze>.right-column{grid-column:5!important;grid-row:1!important}
  #trainerLayout.workspace-analyze>#focusedWorkspace{display:none!important}

  #trainerLayout.workspace-analyze>.middle-column,
#trainerLayout.workspace-analyze>.right-column{
    width:100%!important;height:100%!important;min-width:0!important;min-height:0!important;
    margin:0!important;padding:0!important;overflow:hidden!important
  }
  #trainerLayout.workspace-analyze>.middle-column{
    display:grid!important;grid-template-rows:minmax(0,42fr) minmax(0,58fr)!important;
    gap:clamp(.38rem,.55vh,.55rem)!important
  }
  #trainerLayout.workspace-analyze>.right-column{display:flex!important;flex-direction:column!important}

  #trainerLayout.workspace-analyze .middle-column>.engine-panel,
#trainerLayout.workspace-analyze .middle-column>#lichessPanel,
#trainerLayout.workspace-analyze .right-column>#annotationPanel{
    width:100%!important;height:100%!important;min-width:0!important;min-height:0!important;max-height:none!important;
    margin:0!important;overflow:hidden!important
  }
  #trainerLayout.workspace-analyze .middle-column>.engine-panel{
    display:flex!important;flex-direction:column!important;flex:initial!important;padding:clamp(.35rem,.55vw,.55rem)!important
  }
  #trainerLayout.workspace-analyze .middle-column>.engine-panel .analysis-workspace{
    display:flex!important;flex:1 1 auto!important;flex-direction:column!important;height:auto!important;min-height:0!important;overflow:hidden!important
  }
  #trainerLayout.workspace-analyze .middle-column>.engine-panel #bestMovesPane{
    display:flex!important;flex:1 1 auto!important;flex-direction:column!important;height:auto!important;min-height:0!important;overflow:hidden!important
  }
  #trainerLayout.workspace-analyze .middle-column>.engine-panel #analysisVariations{
    flex:1 1 auto!important;min-height:0!important;max-height:none!important;overflow:auto!important
  }
  #trainerLayout.workspace-analyze .middle-column>#lichessPanel{
    display:flex!important;flex-direction:column!important;flex:initial!important;padding:clamp(.35rem,.55vw,.55rem)!important
  }
  #trainerLayout.workspace-analyze #lichessSharedRoot,
#trainerLayout.workspace-analyze #lichessSharedRoot>.lvgb-app,
#trainerLayout.workspace-analyze #lichessSharedRoot .lvgb-view:not([hidden]),
#trainerLayout.workspace-analyze #lichessExplorerPane{
    flex:1 1 auto!important;width:100%!important;height:100%!important;min-height:0!important;max-height:none!important;overflow:hidden!important
  }
  #trainerLayout.workspace-analyze #lichessExplorerPane{display:flex!important;flex-direction:column!important}
  #trainerLayout.workspace-analyze .lvgb-tree-workspace,
#trainerLayout.workspace-analyze .lvgb-explorer-moves-panel{flex:1 1 auto!important;min-height:0!important;overflow:hidden!important}
  #trainerLayout.workspace-analyze .lvgb-explorer-moves-panel{display:flex!important;flex-direction:column!important}
  #trainerLayout.workspace-analyze .lvgb-explorer-table-scroll{
    flex:1 1 auto!important;min-height:0!important;max-height:none!important;overflow:auto!important;scrollbar-gutter:stable!important
  }

  #trainerLayout.workspace-analyze .right-column>#annotationPanel{
    display:grid!important;grid-template-columns:minmax(0,1fr)!important;grid-template-rows:auto minmax(0,1fr)!important;
    flex:1 1 auto!important;padding:0!important;overflow:hidden!important
  }
  #trainerLayout.workspace-analyze #annotationPanel>.analysis-pane{
    min-height:0!important;height:100%!important;overflow:hidden!important
  }
  #trainerLayout.workspace-analyze #annotationPanel>.analysis-pane>.annotation-content-view{
    flex:1 1 auto!important;min-height:0!important;max-height:none!important;overflow:auto!important;overscroll-behavior:contain!important
  }
  #trainerLayout.workspace-analyze #positionCommentPanel{flex:0 0 auto!important}

  /* Pane-local type scale. The divider changes actual pane width; container units
     therefore make gained space improve readability instead of just adding air. */
  #trainerLayout.workspace-analyze .middle-column>.engine-panel #bestMovesPane .analysis-header-progress{font-size:clamp(.78rem,4.3cqw,1.08rem)!important}
  #trainerLayout.workspace-analyze .middle-column>.engine-panel #bestMovesPane .analysis-depth-label{font-size:clamp(.74rem,4cqw,1rem)!important}
  #trainerLayout.workspace-analyze .middle-column>.engine-panel #bestMovesPane #analysisCurrentDepth{font-size:clamp(.92rem,4.8cqw,1.22rem)!important}
  #trainerLayout.workspace-analyze .middle-column>.engine-panel #bestMovesPane .analysis-pane-actions button{
    font-size:clamp(.78rem,4.15cqw,1.02rem)!important;min-height:clamp(1.9rem,7.2cqw,2.45rem)!important;height:auto!important
  }
  #trainerLayout.workspace-analyze #lichessPanel #lichessExplorerPane .lvgb-position-source-button,
#trainerLayout.workspace-analyze #lichessPanel #lichessExplorerPane #lichessExplorerSourceSelect{
    font-size:clamp(.78rem,3.9cqw,1rem)!important;min-height:clamp(2rem,6.9cqw,2.55rem)!important
  }
  #trainerLayout.workspace-analyze .lvgb-explorer-row{min-height:clamp(1.9rem,7.2cqw,2.55rem)!important}
  #trainerLayout.workspace-analyze .lvgb-explorer-row>span strong,
#trainerLayout.workspace-analyze .lvgb-explorer-row>span.score strong{font-size:clamp(.78rem,4cqw,1.02rem)!important;line-height:1.14!important}
  #trainerLayout.workspace-analyze .lvgb-explorer-row>span.move strong{font-size:clamp(.9rem,4.55cqw,1.16rem)!important}
}

/* Tablet-landscape rail stays proportional rather than inheriting large-desktop
   icon sizes. The pane behavior itself is identical. */
@media (min-width:1001px) and (max-width:1180px){
  #trainerLayout.workspace-analyze{--analysis-rail-width:3.65rem!important}
  
  
  
  
}

/* ---------- Analyze stabilization: fixed board / scrolling content ----------
   The board is the visual reference for Explore/Explain. On every layout it
   stays at the top of its pane; on <=1000px vertical compositions the browser
   page itself is locked and only the active content region below the board can
   scroll. This deliberately replaces the older scroll-triggered floating-board
   behavior for Explore/Explain. */
#trainerLayout.workspace-analyze .middle-column{
  --analysis-control-font:clamp(.78rem,3.9cqw,1rem);
  --analysis-control-height:clamp(2rem,6.9cqw,2.55rem)
}
#trainerLayout.workspace-analyze .analysis-source-mode,
#trainerLayout.workspace-analyze #lichessExplorerPane .lvgb-position-source-mode{
  box-sizing:border-box!important;
  height:var(--analysis-control-height)!important;
  min-height:var(--analysis-control-height)!important;
  padding:.12rem!important
}
#trainerLayout.workspace-analyze .analysis-source-button,
#trainerLayout.workspace-analyze #lichessExplorerPane .lvgb-position-source-button{
  height:100%!important;
  min-height:0!important;
  padding:.12rem .46rem!important;
  font-size:var(--analysis-control-font)!important;
  line-height:1!important;
  font-weight:600!important
}
#trainerLayout.workspace-analyze .explore-more-button,
#trainerLayout.workspace-analyze .explore-help-button,
#trainerLayout.workspace-analyze #lichessExplorerSourceSelect{
  box-sizing:border-box!important;
  height:var(--analysis-control-height)!important;
  min-height:var(--analysis-control-height)!important;
  padding:.18rem .5rem!important;
  font-size:var(--analysis-control-font)!important;
  line-height:1!important;
  font-weight:600!important
}
#trainerLayout.workspace-analyze .explore-help-button{
  width:var(--analysis-control-height)!important;
  min-width:var(--analysis-control-height)!important;
  padding:0!important
}

/* Move notation is data, not a heading. Keep candidate/Explorer moves readable
   but at normal text weight; selection/background is enough to communicate
   emphasis. */
#trainerLayout.workspace-analyze .analysis-compact-move,
#trainerLayout.workspace-analyze .lvgb-explorer-row>span.move strong,
#trainerLayout.workspace-analyze .lvgb-explorer-row.repertoire-move>span.move strong{
  font-weight:500!important
}

@media (max-width:1000px){
  
  
  #trainerLayout.workspace-analyze{
    display:grid!important;
    grid-template-columns:minmax(0,1fr)!important;
    grid-template-rows:auto minmax(0,1fr)!important;
    align-content:stretch!important;
    align-items:stretch!important;
    gap:clamp(.28rem,1.25vh,.55rem)!important;
    width:100%!important;
    height:100%!important;
    min-height:0!important;
    overflow:hidden!important
  }
  #trainerLayout.workspace-analyze>.board-column{
    grid-column:1!important;
    grid-row:1!important;
    align-content:start!important;
    align-items:start!important;
    justify-content:stretch!important;
    min-height:0!important;
    overflow:visible!important
  }
  #trainerLayout.workspace-analyze>.middle-column,
#trainerLayout.workspace-analyze>.right-column{
    grid-column:1!important;
    grid-row:2!important;
    width:100%!important;
    height:100%!important;
    max-height:100%!important;
    min-width:0!important;
    min-height:0!important;
    margin:0!important;
    overflow-x:hidden!important;
    overflow-y:auto!important;
    overscroll-behavior:contain!important;
    scrollbar-gutter:stable!important;
    align-content:start!important
  }

  /* One lower scrolling region per mobile Analyze page. Component-level scroll
     boxes are disabled in the vertical composition so the board never moves and
     users do not encounter nested scroll areas below it. */
  #trainerLayout.workspace-analyze .middle-column>.engine-panel,
#trainerLayout.workspace-analyze .middle-column>#lichessPanel,
#trainerLayout.workspace-analyze .right-column>#annotationPanel,
#trainerLayout.workspace-analyze .middle-column>.engine-panel .analysis-workspace,
#trainerLayout.workspace-analyze .middle-column>.engine-panel #bestMovesPane,
#trainerLayout.workspace-analyze .middle-column>.engine-panel #analysisVariations,
#trainerLayout.workspace-analyze #lichessSharedRoot,
#trainerLayout.workspace-analyze #lichessSharedRoot>.lvgb-app,
#trainerLayout.workspace-analyze #lichessSharedRoot .lvgb-view:not([hidden]),
#trainerLayout.workspace-analyze #lichessExplorerPane,
#trainerLayout.workspace-analyze .lvgb-tree-workspace,
#trainerLayout.workspace-analyze .lvgb-explorer-moves-panel,
#trainerLayout.workspace-analyze .lvgb-explorer-table-scroll,
#trainerLayout.workspace-analyze #annotationPanel>.analysis-pane,
#trainerLayout.workspace-analyze #annotationPanel>.analysis-pane>.annotation-content-view{
    height:auto!important;
    max-height:none!important;
    overflow:visible!important
  }

  /* Resizing must never vertically center the board in a short/landscape Analyze
     pane. The board and its attached navigation always begin at the top. */
  
  
}

@media (min-width:1001px){
  /* The combined Board | Explore | Explain workbench is top-anchored as the
     browser/dividers resize. Empty vertical room belongs below the board. */
  #trainerLayout.workspace-analyze>.board-column{
    align-content:start!important;
    align-items:start!important
  }
  #trainerLayout.workspace-analyze>.board-column>#board,
#trainerLayout.workspace-analyze>.board-column>.history-navigation{
    align-self:start!important
  }
}

/* Specificity bridge: the legacy large-screen analysis selector is intentionally
   strong. Reassert the shared control scale for the source controls. */
#trainerLayout.workspace-analyze .middle-column>.engine-panel #bestMovesPane .analysis-pane-actions .analysis-source-button{
  box-sizing:border-box!important;
  height:var(--analysis-control-height)!important;
  min-height:var(--analysis-control-height)!important;
  font-size:var(--analysis-control-font)!important;
  line-height:1!important;
  font-weight:600!important
}
#trainerLayout.workspace-analyze #lichessPanel #lichessExplorerPane .lvgb-position-source-button,
#trainerLayout.workspace-analyze #lichessPanel #lichessExplorerPane #lichessExplorerSourceSelect{
  box-sizing:border-box!important;
  font-size:var(--analysis-control-font)!important;
  line-height:1!important;
  font-weight:600!important
}
#trainerLayout.workspace-analyze #lichessPanel #lichessExplorerPane .lvgb-position-source-button{
  height:100%!important;
  min-height:0!important
}
#trainerLayout.workspace-analyze #lichessPanel #lichessExplorerPane #lichessExplorerSourceSelect{
  height:var(--analysis-control-height)!important;
  min-height:var(--analysis-control-height)!important
}

/* ---------- Analyze notation polish: 2026-08-21 ----------
   Notation is reading material, not a heading. Keep the compact history,
   live Eval table, and full Position move sheet on one coherent normal-weight
   type scale. This block is Analyze-only so the shared mobile shell remains
   mechanically isolated. */
#trainerLayout.workspace-analyze .mobile-move-trail-token,
#trainerLayout.workspace-analyze .mobile-move-trail-context-token,
#trainerLayout.workspace-analyze .mobile-move-trail-token.current{
  font-weight:500!important
}

html.analysis-workspace-active .move-trail-sheet-list{
  display:grid!important;
  grid-template-columns:minmax(0,1fr)!important;
  gap:.04rem!important;
  padding:.5rem .7rem max(.7rem,env(safe-area-inset-bottom))!important;
  overflow:auto!important;
  overscroll-behavior:contain!important
}
html.analysis-workspace-active .move-trail-sheet-row{
  display:grid;
  grid-template-columns:2.15rem minmax(0,1fr) minmax(0,1fr);
  align-items:baseline;
  column-gap:.5rem;
  min-height:1.55rem;
  padding:.04rem .08rem;
  border-radius:5px
}
html.analysis-workspace-active .move-trail-sheet-row:nth-child(even){
  background:color-mix(in srgb,var(--ai-color-surface-2,#edf2f8) 42%,transparent)
}
html.analysis-workspace-active .move-trail-sheet-number{
  color:var(--ai-color-text-muted,#627086);
  font-size:.78rem;
  font-weight:500;
  line-height:1.35;
  text-align:right;
  font-variant-numeric:tabular-nums
}
html.analysis-workspace-active .move-trail-sheet-token{
  display:block;
  min-width:0;
  padding:.04rem .12rem;
  border-radius:4px;
  color:var(--ai-color-text,#162033);
  font-size:.88rem;
  font-weight:500;
  line-height:1.35;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  font-variant-numeric:tabular-nums
}
html.analysis-workspace-active .move-trail-sheet-token.context{
  color:var(--ai-color-text-muted,#627086);
  font-weight:500
}
html.analysis-workspace-active .move-trail-sheet-token.current{
  color:var(--ai-color-accent,#4267ff);
  background:color-mix(in srgb,var(--ai-color-accent,#4267ff) 12%,transparent);
  font-weight:500
}

@media (max-width:1000px){
  #trainerLayout.workspace-analyze #analysisVariations.analysis-compact-table .analysis-compact-columns,
#trainerLayout.workspace-analyze #analysisVariations.analysis-compact-table .analysis-compact-row{
    grid-template-columns:minmax(3.15rem,.78fr) minmax(2.9rem,.66fr) minmax(0,2.7fr)!important;
    column-gap:.28rem!important
  }
  #trainerLayout.workspace-analyze #analysisVariations.analysis-compact-table.analysis-static-leaf-visible .analysis-compact-columns,
#trainerLayout.workspace-analyze #analysisVariations.analysis-compact-table.analysis-static-leaf-visible .analysis-compact-row{
    grid-template-columns:minmax(3.05rem,.76fr) minmax(2.65rem,.6fr) minmax(2.65rem,.6fr) minmax(0,2.45fr)!important
  }
  #trainerLayout.workspace-analyze #analysisVariations.analysis-compact-table .analysis-compact-columns{
    min-height:1.25rem!important;
    padding:.04rem .1rem .08rem!important;
    font-size:clamp(.64rem,calc(.61rem + .18cqw),.75rem)!important;
    font-weight:600!important;
    line-height:1.15!important;
    letter-spacing:.015em!important
  }
  #trainerLayout.workspace-analyze #analysisVariations.analysis-compact-table .analysis-compact-row{
    min-height:1.55rem!important;
    height:auto!important;
    padding:.05rem .1rem!important;
    line-height:1.2!important
  }
  #trainerLayout.workspace-analyze #analysisVariations.analysis-compact-table .analysis-compact-row>.analysis-compact-move,
#trainerLayout.workspace-analyze #analysisVariations.analysis-compact-table .analysis-compact-row>.analysis-compact-win,
#trainerLayout.workspace-analyze #analysisVariations.analysis-compact-table .analysis-compact-row>.analysis-compact-leaf,
#trainerLayout.workspace-analyze #analysisVariations.analysis-compact-table .analysis-compact-row>.analysis-compact-pv-preview{
    min-height:1.35rem!important;
    height:auto!important;
    line-height:1.2!important
  }
  #trainerLayout.workspace-analyze #analysisVariations.analysis-compact-table .analysis-compact-move,
#trainerLayout.workspace-analyze #analysisVariations.analysis-compact-table .analysis-compact-win,
#trainerLayout.workspace-analyze #analysisVariations.analysis-compact-table .analysis-compact-leaf,
#trainerLayout.workspace-analyze #analysisVariations.analysis-compact-table .analysis-compact-pv-preview-move,
#trainerLayout.workspace-analyze #analysisVariations.analysis-compact-table .analysis-compact-pv-more,
#trainerLayout.workspace-analyze #analysisVariations.analysis-compact-table .analysis-compact-pv-move,
#trainerLayout.workspace-analyze #analysisVariations.analysis-compact-table .mobile-analysis-compact-item.best .analysis-compact-move{
    font-size:clamp(.76rem,calc(.72rem + .22cqw),.9rem)!important;
    font-weight:500!important;
    line-height:1.2!important
  }
  #trainerLayout.workspace-analyze #analysisVariations.analysis-compact-table .analysis-compact-win,
#trainerLayout.workspace-analyze #analysisVariations.analysis-compact-table .analysis-compact-leaf{
    font-weight:550!important;
    font-variant-numeric:tabular-nums
  }
  #trainerLayout.workspace-analyze #analysisVariations.analysis-compact-table .analysis-compact-pv-preview{
    gap:.16rem!important;
    padding:0!important;
    overflow:hidden!important;
    white-space:nowrap!important
  }
  #trainerLayout.workspace-analyze #analysisVariations.analysis-compact-table .analysis-compact-pv-preview-move,
#trainerLayout.workspace-analyze #analysisVariations.analysis-compact-table .analysis-compact-pv-more{
    min-height:0!important;
    height:auto!important;
    padding:.03rem .06rem!important
  }
}


/* ---------- Explore/Explain surface consolidation: 2026-08-21 ----------
   The accepted Play stylesheet remains untouched. Explore uses one visual
   surface for evaluation status + source controls + continuation data, and
   Position setup replaces (rather than stacks beneath) evaluation controls.
   The board/navigation geometry intentionally mirrors the approved Play unit. */
#trainerLayout.workspace-analyze>.middle-column{
  border:1px solid var(--ai-color-border,#cfd8e6)!important;
  border-radius:12px!important;
  background:var(--ai-color-surface-1,#fff)!important;
  box-shadow:none!important;
  padding:clamp(.32rem,.9cqw,.55rem)!important;
  gap:0!important;
  overflow:hidden!important
}
#trainerLayout.workspace-analyze .middle-column>.engine-panel,
#trainerLayout.workspace-analyze .middle-column>#lichessPanel{
  border:0!important;
  border-radius:0!important;
  box-shadow:none!important;
  background:transparent!important;
  margin:0!important
}
#trainerLayout.workspace-analyze .middle-column>.engine-panel{
  padding:0 0 clamp(.28rem,.9cqw,.48rem)!important;
  border-bottom:1px solid color-mix(in srgb,var(--ai-color-border,#cfd8e6) 78%,transparent)!important
}
#trainerLayout.workspace-analyze .middle-column>#lichessPanel{
  padding:clamp(.3rem,.9cqw,.5rem) 0 0!important
}

/* Depth is a status label, not a left-aligned form field. Keep the current /
   target depth centered above its progress rule; live Lichess game/opening
   statistics sit directly below that rule before any Eval variation rows. */
#trainerLayout.workspace-analyze .middle-column>.engine-panel #bestMovesPane{
  border:0!important;
  border-radius:0!important;
  background:transparent!important;
  padding:0!important
}
#trainerLayout.workspace-analyze .middle-column>.engine-panel #bestMovesPane>.analysis-pane-header{
  display:grid!important;
  grid-template-columns:minmax(0,1fr) auto!important;
  grid-template-areas:"progress actions"!important;
  align-items:center!important;
  gap:clamp(.2rem,.8cqw,.42rem)!important;
  margin:0!important;
  padding:0!important
}
#trainerLayout.workspace-analyze .middle-column>.engine-panel #bestMovesPane .analysis-header-progress{
  grid-area:progress!important;
  display:grid!important;
  grid-template-columns:auto auto!important;
  justify-content:center!important;
  align-items:center!important;
  column-gap:.28rem!important;
  row-gap:.12rem!important;
  width:100%!important;
  min-width:0!important;
  margin:0!important;
  text-align:center!important
}
#trainerLayout.workspace-analyze .middle-column>.engine-panel #bestMovesPane .analysis-depth-label{
  text-transform:none!important;
  letter-spacing:0!important;
  font-weight:500!important;
  color:var(--ai-color-text-muted,#627086)!important
}
#trainerLayout.workspace-analyze .middle-column>.engine-panel #bestMovesPane #analysisCurrentDepth{
  font-weight:650!important;
  font-variant-numeric:tabular-nums!important
}
#trainerLayout.workspace-analyze .middle-column>.engine-panel #bestMovesPane #analysisLiveDetails{
  display:none!important
}
#trainerLayout.workspace-analyze .middle-column>.engine-panel #bestMovesPane .analysis-progress-track{
  grid-column:1 / -1!important;
  width:100%!important;
  height:3px!important;
  margin:0!important
}
#trainerLayout.workspace-analyze .middle-column>.engine-panel #bestMovesPane .analysis-pane-actions{
  grid-area:actions!important;
  display:flex!important;
  align-items:center!important;
  justify-content:flex-end!important;
  gap:.16rem!important;
  margin:0!important
}
#trainerLayout.workspace-analyze .middle-column>.engine-panel #analysisLichessStats{
  order:2!important;
  display:block;
  min-height:1.35rem!important;
  margin:.18rem 0 0!important;
  padding:.12rem .08rem 0!important;
  border:0!important;
  background:transparent!important;
  color:var(--ai-color-text-muted,#627086)!important;
  font-size:clamp(.72rem,3.8cqw,.92rem)!important;
  line-height:1.3!important
}
#trainerLayout.workspace-analyze .middle-column>.engine-panel #analysisLichessStats[hidden]{display:none!important}
#trainerLayout.workspace-analyze .middle-column>.engine-panel #analysisLichessStats .analysis-lichess-one-line{
  font-size:inherit!important;
  line-height:inherit!important;
  white-space:normal!important;
  overflow:visible!important;
  text-overflow:clip!important
}

/* The Explorer toolbar and sortable continuation header use one pane-local type
   scale. Every abbreviated heading is a real, comfortably sized sort target. */
#trainerLayout.workspace-analyze #lichessPanel #lichessExplorerPane>.lvgb-unified-explorer-toolbar{
  align-items:center!important;
  gap:clamp(.22rem,.9cqw,.45rem)!important;
  margin:0 0 clamp(.18rem,.7cqw,.34rem)!important
}
#trainerLayout.workspace-analyze #lichessPanel #lichessExplorerPane .lvgb-position-source-button,
#trainerLayout.workspace-analyze #lichessPanel #lichessExplorerPane #lichessExplorerSourceSelect,
#trainerLayout.workspace-analyze #lichessPanel #lichessExplorerPane .lvgb-tree-manage-button{
  font-size:clamp(.78rem,4cqw,1rem)!important;
  font-weight:550!important
}
#trainerLayout.workspace-analyze #lichessPanel #lichessExplorerPane .lvgb-mobile-explorer-columns{
  position:sticky!important;
  top:0!important;
  z-index:5!important;
  min-height:clamp(1.8rem,7cqw,2.25rem)!important;
  padding:.12rem .04rem!important;
  background:var(--ai-color-surface-1,#fff)!important;
  border-bottom:1px solid var(--ai-color-border,#cfd8e6)!important;
  color:var(--ai-color-text-muted,#627086)!important;
  font-size:clamp(.66rem,3.35cqw,.86rem)!important;
  font-weight:600!important;
  line-height:1.08!important;
  letter-spacing:0!important
}
#trainerLayout.workspace-analyze #lichessPanel #lichessExplorerPane .lvgb-mobile-explorer-columns>button,
#trainerLayout.workspace-analyze #lichessPanel #lichessExplorerPane .lvgb-mobile-explorer-columns>span{
  min-height:clamp(1.55rem,6cqw,1.95rem)!important;
  display:grid!important;
  place-items:center!important;
  padding:.12rem .03rem!important;
  border-radius:5px!important;
  font:inherit!important;
  line-height:1.08!important
}
#trainerLayout.workspace-analyze #lichessPanel #lichessExplorerPane .lvgb-mobile-explorer-columns>span:first-child{
  place-items:center start!important;
  padding-left:.08rem!important
}
#trainerLayout.workspace-analyze #lichessPanel #lichessExplorerPane .lvgb-mobile-explorer-columns>button.active,
#trainerLayout.workspace-analyze #lichessPanel #lichessExplorerPane .lvgb-mobile-explorer-columns>button[aria-sort="ascending"],
#trainerLayout.workspace-analyze #lichessPanel #lichessExplorerPane .lvgb-mobile-explorer-columns>button[aria-sort="descending"]{
  color:var(--lvgb-text)!important;
  background:color-mix(in srgb,var(--ai-color-accent,#4267ff) 28%,var(--lvgb-surface))!important;
  border-radius:4px!important;
  box-shadow:inset 0 -2px 0 var(--ai-color-accent,#4267ff)!important
}
#trainerLayout.workspace-analyze #lichessPanel #lichessExplorerPane .lvgb-tree-path{
  font-size:clamp(.76rem,3.7cqw,.96rem)!important;
  line-height:1.25!important
}

/* Position setup is the Explore surface while it is active. Evaluation status,
   Eval/Lich/More and continuation data are not useful during direct setup. */
@media (max-width:1000px){
  #trainerLayout.workspace-analyze.mobile-position-setup-open>.middle-column>.engine-panel{
    display:none!important
  }
  #trainerLayout.workspace-analyze.mobile-position-setup-open>.middle-column{
    padding:clamp(.4rem,1.6vw,.65rem)!important
  }
  #trainerLayout.workspace-analyze.mobile-position-setup-open .middle-column>#lichessPanel{
    padding:0!important
  }
  #trainerLayout.workspace-analyze.mobile-position-setup-open #lichessPanel>.setup-panel.setup-docked{
    border:0!important;
    border-radius:0!important;
    background:transparent!important;
    padding:clamp(.22rem,.9vw,.4rem)!important
  }
  #trainerLayout.workspace-analyze.mobile-position-setup-open .setup-panel.setup-docked .panel-title-row{
    min-height:2rem!important;
    margin:0 0 .18rem!important
  }
  #trainerLayout.workspace-analyze.mobile-position-setup-open .setup-panel.setup-docked .panel-title-row h2{
    font-size:clamp(.92rem,calc(.62rem + 1.35vw),1.08rem)!important;
    font-weight:650!important
  }
  #trainerLayout.workspace-analyze.mobile-position-setup-open .setup-panel.setup-docked .panel-close{
    width:2rem!important;height:2rem!important;min-height:2rem!important;
    padding:0!important;font-size:1rem!important
  }
  #trainerLayout.workspace-analyze.mobile-position-setup-open .setup-panel.setup-docked #setupStatus{
    margin:0 0 .3rem!important;
    font-size:clamp(.76rem,calc(.55rem + .95vw),.9rem)!important;
    line-height:1.3!important;
    white-space:normal!important;
    overflow:visible!important;
    text-overflow:clip!important
  }
  #trainerLayout.workspace-analyze.mobile-position-setup-open .setup-panel.setup-docked .setup-place-hint{
    margin:.18rem 0 .36rem!important;
    font-size:clamp(.72rem,calc(.52rem + .9vw),.86rem)!important;
    line-height:1.35!important
  }
  #trainerLayout.workspace-analyze.mobile-position-setup-open .setup-panel.setup-docked .setup-palette{
    grid-template-columns:repeat(6,minmax(0,1fr))!important;
    gap:clamp(.16rem,.75vw,.3rem)!important;
    margin:.22rem 0 .32rem!important
  }
  #trainerLayout.workspace-analyze.mobile-position-setup-open .setup-panel.setup-docked .setup-piece{
    min-height:clamp(2.55rem,10vw,3.15rem)!important;
    height:auto!important;
    padding:.12rem!important;
    border-radius:7px!important
  }
  #trainerLayout.workspace-analyze.mobile-position-setup-open .setup-panel.setup-docked .setup-piece .piece{
    width:clamp(2rem,8vw,2.65rem)!important;
    height:clamp(2rem,8vw,2.65rem)!important
  }
  #trainerLayout.workspace-analyze.mobile-position-setup-open .setup-panel.setup-docked .setup-options{
    margin:.2rem 0!important
  }
  #trainerLayout.workspace-analyze.mobile-position-setup-open .setup-panel.setup-docked .setup-options label{
    grid-template-columns:auto minmax(7rem,10rem)!important;
    gap:.45rem!important;
    font-size:clamp(.76rem,calc(.55rem + .95vw),.9rem)!important
  }
  #trainerLayout.workspace-analyze.mobile-position-setup-open .setup-panel.setup-docked .setup-options select{
    min-height:2.15rem!important;height:auto!important;
    padding:.28rem .48rem!important;
    font-size:inherit!important
  }
  #trainerLayout.workspace-analyze.mobile-position-setup-open .setup-panel.setup-docked .setup-advanced{
    margin:.25rem 0!important
  }
  #trainerLayout.workspace-analyze.mobile-position-setup-open .setup-panel.setup-docked .setup-advanced>summary{
    min-height:1.9rem!important;
    display:flex!important;align-items:center!important;
    font-size:clamp(.74rem,calc(.54rem + .9vw),.88rem)!important;
    font-weight:600!important
  }
  #trainerLayout.workspace-analyze.mobile-position-setup-open .setup-panel.setup-docked .castling-rights{
    margin:.18rem 0 .3rem!important;padding:.5rem!important
  }
  #trainerLayout.workspace-analyze.mobile-position-setup-open .setup-panel.setup-docked .castling-rights legend,
#trainerLayout.workspace-analyze.mobile-position-setup-open .setup-panel.setup-docked .castling-side strong,
#trainerLayout.workspace-analyze.mobile-position-setup-open .setup-panel.setup-docked .castling-side .inline-check{
    font-size:clamp(.7rem,calc(.5rem + .82vw),.84rem)!important;
    line-height:1.25!important
  }
  #trainerLayout.workspace-analyze.mobile-position-setup-open .setup-panel.setup-docked .castling-side .inline-check input{
    width:1rem!important;height:1rem!important
  }
  #trainerLayout.workspace-analyze.mobile-position-setup-open .setup-panel.setup-docked>.button-row{
    gap:.3rem!important;margin:.32rem 0 0!important
  }
  #trainerLayout.workspace-analyze.mobile-position-setup-open .setup-panel.setup-docked>.button-row button{
    min-height:2.2rem!important;
    padding:.3rem .26rem!important;
    font-size:clamp(.72rem,calc(.52rem + .86vw),.86rem)!important;
    font-weight:600!important
  }

  /* Short Analyze uses the same rail/control proportions as the approved Play
     compact unit so switching modes does not make the board controls jump. */
  
  
  
  
  
  
}

/* Large Analyze uses the same top-anchored rail + square-board + attached
   history geometry as the shared board shell. Only the panes to the right differ. */
@media (min-width:1001px){
  html.analysis-workspace-active .chess-app{
    padding:0!important
  }
  #trainerLayout.workspace-analyze{
    --analysis-page-pad-y:clamp(.62rem,1.3vh,.92rem);
    --analysis-page-pad-x:clamp(.58rem,.85vw,.88rem);
    --analysis-nav-height:clamp(3rem,5.2vh,3.55rem);
    padding:var(--analysis-page-pad-y) var(--analysis-page-pad-x)!important
  }
  #trainerLayout.workspace-analyze>.board-column{
    --analysis-rail-width:var(--mode-rail-width,clamp(3.6rem,5vw,6rem));
    grid-template-columns:var(--analysis-rail-width) minmax(0,1fr)!important;
    grid-template-rows:auto var(--analysis-nav-height) minmax(0,1fr)!important;
    align-content:start!important;align-items:start!important;
    justify-content:stretch!important;justify-items:stretch!important;
    column-gap:clamp(.45rem,.7vw,.75rem)!important;
    row-gap:clamp(.28rem,.5vh,.4rem)!important;
    padding:0!important
  }
  
  
  
  
  
  #trainerLayout.workspace-analyze>.board-column>#board{
    grid-row:1!important;
    width:min(44rem,100%,calc(100dvh - 7rem),var(--board-viewport-max,44rem))!important;
    max-width:100%!important;
    align-self:start!important;justify-self:center!important;margin:0!important
  }
  #trainerLayout.workspace-analyze>.board-column>.history-navigation{
    grid-row:2!important;
    width:min(44rem,100%,calc(100dvh - 7rem),var(--board-viewport-max,44rem))!important;
    max-width:100%!important;
    height:var(--analysis-nav-height)!important;min-height:var(--analysis-nav-height)!important;
    align-self:start!important;justify-self:center!important;
    margin:0!important;padding:0!important;
    grid-template-columns:clamp(3rem,3.6vw,3.55rem) minmax(0,1fr) clamp(2.85rem,3.35vw,3.35rem) clamp(3rem,3.6vw,3.55rem)!important;
    gap:clamp(.32rem,.55vw,.5rem)!important
  }
  #trainerLayout.workspace-analyze>.board-column>.history-navigation .history-arrow,
#trainerLayout.workspace-analyze>.board-column>.history-navigation #favoritePositionButton{
    height:var(--analysis-nav-height)!important;min-height:var(--analysis-nav-height)!important;
    padding:0!important;font-size:clamp(1.18rem,1.55vw,1.48rem)!important;
    border-radius:10px!important
  }

  /* The merged Explore frame gives unused Eval space back to the continuation
     table. Eval variations scroll only when they themselves become tall. */
  #trainerLayout.workspace-analyze>.middle-column{
    display:flex!important;flex-direction:column!important;gap:0!important
  }
  #trainerLayout.workspace-analyze .middle-column>.engine-panel{
    display:flex!important;flex:0 1 auto!important;height:auto!important;max-height:42%!important;min-height:0!important
  }
  #trainerLayout.workspace-analyze .middle-column>.engine-panel .analysis-workspace,
#trainerLayout.workspace-analyze .middle-column>.engine-panel #bestMovesPane{
    height:auto!important;min-height:0!important
  }
  #trainerLayout.workspace-analyze .middle-column>.engine-panel #analysisVariations{
    flex:0 1 auto!important;min-height:0!important;max-height:calc(100dvh * .28)!important;overflow:auto!important
  }
  #trainerLayout.workspace-analyze .middle-column>#lichessPanel{
    display:flex!important;flex:1 1 auto!important;height:auto!important;min-height:0!important
  }
}

/* Explain and continuation-data controls share the same readable pane-local
   density. Avoid one giant tab beside miniature status/table controls. */
#trainerLayout.workspace-analyze>.right-column{
  --explain-ui-font:clamp(.8rem,4cqw,1rem);
  --explain-ui-height:clamp(2rem,7cqw,2.55rem)
}
#trainerLayout.workspace-analyze #annotationPanel>.explain-view-selector button,
#trainerLayout.workspace-analyze #annotationPanel>.analysis-pane>.analysis-pane-header>button,
#trainerLayout.workspace-analyze #annotationPanel .comments-compact-row>button{
  min-height:var(--explain-ui-height)!important;
  height:auto!important;
  padding:.24rem clamp(.42rem,1.8cqw,.68rem)!important;
  font-size:var(--explain-ui-font)!important;
  font-weight:600!important;
  line-height:1.1!important
}
#trainerLayout.workspace-analyze #annotationPanel>.analysis-pane>.analysis-pane-header h2,
#trainerLayout.workspace-analyze #annotationPanel .comments-heading{
  font-size:clamp(.9rem,4.45cqw,1.12rem)!important;
  font-weight:650!important;
  line-height:1.2!important
}
#trainerLayout.workspace-analyze #annotationPanel .annotation-header-progress,
#trainerLayout.workspace-analyze #annotationPanel .annotation-header-progress .analysis-depth-label,
#trainerLayout.workspace-analyze #annotationPanel .annotation-header-progress strong,
#trainerLayout.workspace-analyze #annotationPanel .annotation-header-progress .hint,
#trainerLayout.workspace-analyze #annotationPanel .comment-readonly{
  font-size:clamp(.76rem,3.7cqw,.94rem)!important;
  line-height:1.3!important
}
#trainerLayout.workspace-analyze #lichessPanel #lichessExplorerPane .lvgb-explorer-row>span strong,
#trainerLayout.workspace-analyze #lichessPanel #lichessExplorerPane .lvgb-explorer-row>span.score strong{
  font-weight:550!important
}
#trainerLayout.workspace-analyze #lichessPanel #lichessExplorerPane .lvgb-explorer-row>span.move strong,
#trainerLayout.workspace-analyze #lichessPanel #lichessExplorerPane .lvgb-explorer-row.repertoire-move>span.move strong{
  font-weight:500!important
}

/* ---------- Explore / Explain final interaction polish: 2026-08-21 ----------
   Play remains frozen. These rules keep the combined desktop Explore+Explain
   workspace coherent: one combined mode icon, a centered evaluation ruler,
   and settings/setup as replacement surfaces that never cover the board. */

/* Depth and Lichess statistics straddle the progress rule symmetrically. The
   rule therefore lands on the visual centerline of Eval/Lich/More. */
#trainerLayout.workspace-analyze .middle-column>.engine-panel #bestMovesPane .analysis-header-progress{
  grid-template-columns:minmax(0,1fr)!important;
  grid-template-rows:minmax(1.15rem,auto) 3px minmax(1.15rem,auto)!important;
  justify-items:stretch!important;
  align-items:center!important;
  row-gap:.12rem!important;
  min-height:calc(var(--analysis-control-height) + 1.3rem)!important
}
#trainerLayout.workspace-analyze .middle-column>.engine-panel #bestMovesPane .analysis-depth-row{
  grid-column:1!important;grid-row:1!important;
  display:flex!important;align-items:baseline!important;justify-content:center!important;gap:.28rem!important;
  min-width:0!important;text-align:center!important;white-space:nowrap!important
}
#trainerLayout.workspace-analyze .middle-column>.engine-panel #bestMovesPane .analysis-progress-track{
  grid-column:1!important;grid-row:2!important;
  align-self:center!important;width:100%!important;height:3px!important;margin:0!important
}
#trainerLayout.workspace-analyze .middle-column>.engine-panel #bestMovesPane #analysisLichessStats{
  grid-column:1!important;grid-row:3!important;
  align-self:start!important;justify-self:stretch!important;
  min-height:1.15rem!important;margin:0!important;padding:.08rem 0 0!important;
  text-align:center!important
}
#trainerLayout.workspace-analyze .middle-column>.engine-panel #bestMovesPane #analysisLichessStats .analysis-lichess-one-line{
  text-align:center!important;white-space:nowrap!important;overflow:hidden!important;text-overflow:ellipsis!important
}
#trainerLayout.workspace-analyze .middle-column>.engine-panel #bestMovesPane .analysis-pane-actions{
  align-self:center!important
}

/* Position Setup is an Explore replacement surface on every viewport. It is
   never a floating window and therefore cannot obscure the board or Explain. */
#trainerLayout.workspace-analyze.position-setup-open>.middle-column>.engine-panel{
  display:none!important
}
#trainerLayout.workspace-analyze.position-setup-open .middle-column>#lichessPanel{
  display:flex!important;flex:1 1 auto!important;height:100%!important;min-height:0!important;padding:0!important
}
#trainerLayout.workspace-analyze.position-setup-open #lichessPanel>#lichessSharedRoot{
  display:none!important
}
#trainerLayout.workspace-analyze #lichessPanel>.setup-panel.setup-docked{
  position:static!important;inset:auto!important;transform:none!important;
  display:block;width:100%!important;max-width:none!important;height:100%!important;max-height:none!important;
  margin:0!important;padding:clamp(.58rem,2.4cqw,.95rem)!important;
  overflow:auto!important;overscroll-behavior:contain!important;
  border:0!important;border-radius:0!important;box-shadow:none!important;
  background:transparent!important;z-index:auto!important
}
#trainerLayout.workspace-analyze #lichessPanel>.setup-panel.setup-docked[hidden]{display:none!important}
#trainerLayout.workspace-analyze #lichessPanel>.setup-panel.setup-docked .panel-title-row{
  position:sticky!important;top:0!important;z-index:3!important;
  margin:0 0 .45rem!important;padding:0 0 .42rem!important;
  background:var(--ai-color-surface-1,#fff)!important;
  cursor:default!important
}

/* Navigate owns a real lower tab slot. Setup and the collection workspace are
   siblings inside it, so switching source tabs cannot leave one surface
   contributing height to another. */
#trainerLayout.workspace-analyze>.middle-column>#navigateTabContent{
  display:flex;flex:1 1 auto;flex-direction:column;min-width:0;min-height:0
}
#trainerLayout.workspace-analyze>.middle-column>#navigateTabContent[hidden]{display:none!important}
#trainerLayout.workspace-analyze #navigateTabContent>.setup-panel.setup-docked{
  position:static!important;inset:auto!important;transform:none!important;
  display:block;width:100%!important;max-width:none!important;height:auto!important;max-height:none!important;
  margin:0!important;padding:clamp(.58rem,2.4cqw,.95rem)!important;
  overflow:visible!important;overscroll-behavior:contain!important;
  border:0!important;border-radius:0!important;box-shadow:none!important;
  background:transparent!important;z-index:auto!important
}
#trainerLayout.workspace-analyze #navigateTabContent>.setup-panel.setup-docked[hidden]{display:none!important}
#trainerLayout.workspace-analyze #navigateTabContent>.setup-panel.setup-docked .panel-title-row{
  position:sticky!important;top:0!important;z-index:3!important;
  margin:0 0 .45rem!important;padding:0 0 .42rem!important;
  background:var(--ai-color-surface-1,#fff)!important;
  cursor:default!important
}

/* Explain engine settings replace the explanation body in the right pane.
   The board remains fully inspectable and the profile is transactional. */
#trainerLayout.workspace-analyze #positionAnalysisPane.explain-settings-open{
  display:flex!important;flex-direction:column!important;min-height:0!important;overflow:hidden!important
}
#trainerLayout.workspace-analyze #positionAnalysisPane.explain-settings-open>#annotationPositionContent,
#trainerLayout.workspace-analyze #positionAnalysisPane.explain-settings-open>#positionCommentPanel{
  display:none!important
}
#trainerLayout.workspace-analyze #positionAnalysisPane>#explainSettingsPopover.explain-settings-popover{
  position:static!important;inset:auto!important;transform:none!important;
  width:100%!important;max-width:none!important;height:auto!important;max-height:none!important;
  flex:1 1 auto!important;min-height:0!important;
  margin:.45rem 0 0!important;padding:clamp(.55rem,2.2cqw,.9rem)!important;
  overflow:auto!important;overscroll-behavior:contain!important;
  border:1px solid var(--ai-color-border,#cfd8e6)!important;border-radius:10px!important;
  background:var(--ai-color-surface-1,#fff)!important;box-shadow:none!important;z-index:auto!important
}
#trainerLayout.workspace-analyze #positionAnalysisPane>#explainSettingsPopover.explain-settings-popover[hidden]{display:none!important}
#trainerLayout.workspace-analyze #explainSettingsPopover .engine-settings-heading{
  display:flex!important;align-items:center!important;justify-content:space-between!important;gap:.5rem!important;
  margin:0 0 .55rem!important;cursor:default!important
}
#trainerLayout.workspace-analyze #explainSettingsPopover .engine-settings-form{
  display:grid!important;gap:clamp(.45rem,1.7cqw,.7rem)!important
}
#trainerLayout.workspace-analyze #explainSettingsPopover .engine-field>span,
#trainerLayout.workspace-analyze #explainSettingsPopover .engine-method-note{
  font-size:var(--explain-ui-font)!important;line-height:1.35!important
}
#trainerLayout.workspace-analyze #positionAnalysisPane.explain-comment-open>#annotationPositionContent,
#trainerLayout.workspace-analyze #positionAnalysisPane.explain-comment-open>#explainSettingsPopover{
  display:none!important
}
#trainerLayout.workspace-analyze #positionAnalysisPane.explain-comment-open>#positionCommentPanel{
  display:block!important;flex:1 1 auto!important;min-height:0!important;overflow:auto!important
}
#trainerLayout.workspace-analyze #positionAnalysisPane.explain-comment-open>#positionCommentPanel .comments-compact-row{
  display:flex!important;align-items:flex-start!important
}
#trainerLayout.workspace-analyze #positionAnalysisPane.explain-comment-open>#positionCommentPanel #positionCommentEditor[hidden]{display:none!important}
#trainerLayout.workspace-analyze #positionAnalysisPane.explain-comment-open>#positionCommentPanel #positionCommentEditor:not([hidden]){display:grid!important}
#trainerLayout.workspace-analyze #explainSettingsPopover select,
#trainerLayout.workspace-analyze #explainSettingsPopover input{
  min-height:var(--explain-ui-height)!important;font-size:var(--explain-ui-font)!important
}
#trainerLayout.workspace-analyze #explainSettingsPopover .explain-settings-actions{
  display:flex!important;align-items:center!important;justify-content:flex-end!important;gap:.45rem!important;
  margin-top:.25rem!important
}
#trainerLayout.workspace-analyze #explainSettingsPopover .explain-settings-action-spacer{flex:1 1 auto}
#trainerLayout.workspace-analyze #explainSettingsPopover .explain-settings-actions button{
  min-height:var(--explain-ui-height)!important;font-size:var(--explain-ui-font)!important
}

@media(max-width:1000px){
  #trainerLayout.workspace-analyze #lichessPanel>.setup-panel.setup-docked{
    padding:clamp(.58rem,2.8vw,.9rem)!important
  }
  #trainerLayout.workspace-analyze #positionAnalysisPane>#explainSettingsPopover.explain-settings-popover{
    margin:.35rem 0 0!important;padding:clamp(.5rem,2.6vw,.8rem)!important;
    max-height:max(12rem,calc(100dvh - var(--mobile-shell-expanded-board) - 15rem))!important;
    overflow:auto!important;scrollbar-width:none;-ms-overflow-style:none
  }
  #trainerLayout.workspace-analyze #positionAnalysisPane>#explainSettingsPopover.explain-settings-popover::-webkit-scrollbar{display:none;width:0;height:0}
}

/* The mobile Explain page is a fixed board shell with one internal reading
   surface. This keeps Position, Move, Settings, and Comment in the same frame
   while long Position/Move output scrolls below the unchanged board. */
@media(max-width:760px){
  html.mobile-chess-shell-active[data-mobile-mode="explain"],
  html.mobile-chess-shell-active[data-mobile-mode="explain"] body{
    height:100%!important;min-height:0!important;max-height:100%!important;
    overflow:hidden!important;overscroll-behavior:none!important
  }
  html.mobile-chess-shell-active[data-mobile-mode="explain"] .chess-app{
    height:100dvh!important;min-height:0!important;max-height:100dvh!important;overflow:hidden!important
  }
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #trainerLayout.mobile-chess-shell{
    height:100%!important;min-height:0!important;max-height:100%!important;
    grid-template-rows:auto minmax(0,1fr)!important;overflow:hidden!important
  }
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #trainerLayout.mobile-chess-shell>.right-column{
    grid-row:2!important;height:100%!important;min-height:0!important;max-height:none!important;
    overflow:hidden!important;overscroll-behavior:contain!important
  }
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #annotationPanel{
    display:grid!important;grid-template-rows:auto minmax(0,1fr)!important;
    height:100%!important;min-height:0!important;max-height:none!important;overflow:hidden!important
  }
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #positionAnalysisPane,
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #moveAnalysisPane{
    height:100%!important;min-height:0!important;max-height:none!important;overflow:hidden!important
  }
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #annotationPositionContent,
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #annotationMoveContent{
    flex:1 1 auto!important;min-height:0!important;max-height:none!important;overflow:auto!important;
    overscroll-behavior:contain!important;scrollbar-width:none;-ms-overflow-style:none
  }
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #annotationPositionContent::-webkit-scrollbar,
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #annotationMoveContent::-webkit-scrollbar{display:none;width:0;height:0}
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #positionAnalysisPane.explain-settings-open>.analysis-pane-header,
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #positionAnalysisPane.explain-comment-open>.analysis-pane-header{
    display:none!important
  }
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #positionAnalysisPane.explain-comment-open>#positionCommentPanel{
    display:block!important;flex:1 1 auto!important;min-height:0!important;max-height:none!important;overflow:auto!important;
    overscroll-behavior:contain!important
  }
}

/* Compact mobile/tablet Continuations headers keep the original Lichess score
   and the normalized Lichess score visible. Path and coverage remain in each
   row's expanded details so the primary grid stays readable. */
@media(max-width:1000px){
  #trainerLayout.workspace-analyze #lichessPanel #lichessExplorerPane .lvgb-mobile-explorer-columns{
    grid-template-columns:1.28fr .88fr 1.00fr 1.00fr 1.06fr .94fr 1.00fr .56fr!important;
    font-size:.56rem!important
  }
  #trainerLayout.workspace-analyze #lichessPanel #lichessExplorerPane .lvgb-explorer-table-scroll .lvgb-tree-node-row{
    grid-template-columns:1.28fr .88fr 1.00fr 1.00fr 1.06fr .94fr 1.00fr .56fr!important
  }
  #trainerLayout.workspace-analyze #lichessPanel #lichessExplorerPane .lvgb-explorer-row{
    grid-column:1/8!important;grid-template-columns:subgrid!important
  }
  #trainerLayout.workspace-analyze #lichessPanel #lichessExplorerPane .lvgb-mobile-explorer-columns>button:nth-child(3),
#trainerLayout.workspace-analyze #lichessPanel #lichessExplorerPane .lvgb-mobile-explorer-columns>button:nth-child(4),
#trainerLayout.workspace-analyze #lichessPanel #lichessExplorerPane .lvgb-mobile-explorer-columns>button:nth-child(5),
#trainerLayout.workspace-analyze #lichessPanel #lichessExplorerPane .lvgb-mobile-explorer-columns>button:nth-child(6){display:grid!important}
  #trainerLayout.workspace-analyze #lichessPanel #lichessExplorerPane .lvgb-explorer-row>span:nth-child(3),
#trainerLayout.workspace-analyze #lichessPanel #lichessExplorerPane .lvgb-explorer-row>span:nth-child(4),
#trainerLayout.workspace-analyze #lichessPanel #lichessExplorerPane .lvgb-explorer-row>span:nth-child(5),
#trainerLayout.workspace-analyze #lichessPanel #lichessExplorerPane .lvgb-explorer-row>span:nth-child(6){display:grid!important}
}
html[data-mobile-mode="position"] #trainerLayout.workspace-analyze #lichessPanel #lichessExplorerPane .lvgb-mobile-explorer-columns{
  grid-template-columns:1.28fr .88fr 1.00fr 1.00fr 1.06fr .94fr 1.00fr .56fr!important;
  font-size:.56rem!important
}
html[data-mobile-mode="position"] #trainerLayout.workspace-analyze #lichessPanel #lichessExplorerPane .lvgb-explorer-table-scroll .lvgb-tree-node-row{
  grid-template-columns:1.28fr .88fr 1.00fr 1.00fr 1.06fr .94fr 1.00fr .56fr!important
}
html[data-mobile-mode="position"] #trainerLayout.workspace-analyze #lichessPanel #lichessExplorerPane .lvgb-explorer-row{
  grid-column:1/8!important;grid-template-columns:subgrid!important
}
html[data-mobile-mode="position"] #trainerLayout.workspace-analyze #lichessPanel #lichessExplorerPane .lvgb-mobile-explorer-columns>button:nth-child(3),
html[data-mobile-mode="position"] #trainerLayout.workspace-analyze #lichessPanel #lichessExplorerPane .lvgb-mobile-explorer-columns>button:nth-child(4),
html[data-mobile-mode="position"] #trainerLayout.workspace-analyze #lichessPanel #lichessExplorerPane .lvgb-mobile-explorer-columns>button:nth-child(5),
html[data-mobile-mode="position"] #trainerLayout.workspace-analyze #lichessPanel #lichessExplorerPane .lvgb-mobile-explorer-columns>button:nth-child(6),
html[data-mobile-mode="position"] #trainerLayout.workspace-analyze #lichessPanel #lichessExplorerPane .lvgb-explorer-row>span:nth-child(3),
html[data-mobile-mode="position"] #trainerLayout.workspace-analyze #lichessPanel #lichessExplorerPane .lvgb-explorer-row>span:nth-child(4),
html[data-mobile-mode="position"] #trainerLayout.workspace-analyze #lichessPanel #lichessExplorerPane .lvgb-explorer-row>span:nth-child(5),
html[data-mobile-mode="position"] #trainerLayout.workspace-analyze #lichessPanel #lichessExplorerPane .lvgb-explorer-row>span:nth-child(6){display:grid!important}
}

/* Explore follows the same mobile card language as Play: source first,
then
   the two analysis views,
then one active summary surface. */
#trainerLayout.workspace-analyze>.middle-column>.explore-position-source{
  display:grid!important;gap:.18rem!important;margin:0 0 .42rem!important;padding:.55rem .68rem!important;
  border:1px solid var(--ai-color-border,#cfd8e6)!important;border-radius:10px!important;
  background:var(--ai-color-surface-1,#fff)!important;min-width:0!important
}
#trainerLayout.workspace-analyze .explore-position-source-row{display:block;min-width:0}
#trainerLayout.workspace-analyze .explore-position-source-heading{
  color:var(--ai-color-text-muted,#627086);font-size:.72rem;font-weight:700;line-height:1.1
}
#trainerLayout.workspace-analyze .explore-position-source-button{
  display:flex!important;align-items:center!important;justify-content:space-between!important;gap:.55rem!important;
  width:100%!important;min-width:0!important;min-height:2rem!important;padding:.18rem .1rem!important;
  border:0!important;background:transparent!important;color:var(--ai-color-text,#10213a)!important;
  text-align:left!important;font:inherit!important;cursor:pointer!important
}
#trainerLayout.workspace-analyze .explore-position-source-button strong{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:.9rem}
#trainerLayout.workspace-analyze .explore-position-source-button>span{display:grid;place-items:center;flex:0 0 1.25rem;width:1.25rem;height:1.25rem;color:var(--ai-color-text-muted,#627086)}
#trainerLayout.workspace-analyze .explore-position-source-chevron svg{width:1rem;height:1rem;fill:none;stroke:currentColor;stroke-linecap:round;stroke-linejoin:round;stroke-width:2}
#trainerLayout.workspace-analyze .explore-position-collection-navigation{
  display:grid;grid-template-columns:2rem minmax(0,1fr) 2rem;align-items:center;gap:.35rem;min-width:0;margin-top:.12rem
}
#trainerLayout.workspace-analyze .explore-position-collection-navigation[hidden]{display:none!important}
#trainerLayout.workspace-analyze .explore-position-collection-navigation button{
  display:grid;place-items:center;width:2rem;height:1.8rem;min-height:1.8rem;padding:0;border:1px solid var(--ai-color-border,#cfd8e6);border-radius:9px;background:var(--ai-color-surface-2,#edf2f8);color:var(--ai-color-text,#10213a);cursor:pointer
}
#trainerLayout.workspace-analyze .explore-position-collection-navigation button:disabled{opacity:.45;cursor:default}
#trainerLayout.workspace-analyze .explore-position-collection-navigation svg{width:1rem;height:1rem;fill:none;stroke:currentColor;stroke-linecap:round;stroke-linejoin:round;stroke-width:2}
#trainerLayout.workspace-analyze .explore-position-collection-navigation strong{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--ai-color-text-muted,#627086);font-size:.72rem;text-align:center;font-variant-numeric:tabular-nums}
#trainerLayout.workspace-analyze>.middle-column>.explore-view-toolbar{
  display:flex!important;align-items:center;justify-content:space-between;gap:clamp(.28rem,.8cqw,.5rem);min-width:0;margin:0 0 clamp(.35rem,1cqw,.6rem)
}
#trainerLayout.workspace-analyze>.middle-column>.explore-view-toolbar[hidden]{display:none!important}
#trainerLayout.workspace-analyze .explore-compact-stats{
  display:flex;align-items:center;gap:.35rem;min-width:0;overflow:hidden;color:var(--ai-color-text-muted,#627086);font-size:clamp(.66rem,3.1cqw,.82rem);line-height:1.1;white-space:nowrap
}
#trainerLayout.workspace-analyze .explore-compact-stats>span{min-width:0;overflow:hidden;text-overflow:ellipsis}
#trainerLayout.workspace-analyze .explore-compact-stats #exploreHumanSummary{color:var(--ai-color-text,#10213a);font-variant-numeric:tabular-nums}
#trainerLayout.workspace-analyze .explore-continuations-engine-status{display:block;margin:.2rem 0 .35rem;color:var(--ai-color-text-muted,#627086);font-size:.72rem;line-height:1.2}
#trainerLayout.workspace-analyze:not(.explore-continuations-open):not(.position-setup-open)>.middle-column>#lichessPanel{display:none!important}
#trainerLayout.workspace-analyze.explore-continuations-open #lichessPanel #lichessExplorerPane .lvgb-position-source-mode{display:none!important}
#trainerLayout.workspace-analyze.position-setup-open>.middle-column>.explore-position-source,
#trainerLayout.workspace-analyze.position-setup-open>.middle-column>.explore-view-toolbar{display:none!important}

/* Explore setup uses the same single document-flow surface as Play setup on
   phones. The lower pane must not become a second scroll box with a visible
   scrollbar beside the palette. */
@media(max-width:1000px){
  html.mobile-setup-flow-active,
html.mobile-setup-flow-active body{
    height:auto!important;
    min-height:100%!important;
    overflow-y:auto!important;
    overscroll-behavior-y:auto!important
  }
  html.mobile-setup-flow-active .chess-app{
    height:auto!important;
    min-height:100dvh!important;
    max-height:none!important;
    overflow:visible!important
  }
  #trainerLayout.workspace-analyze.mobile-position-setup-open{
    display:flex!important;
    flex-direction:column!important;
    height:auto!important;
    min-height:100%!important;
    overflow:visible!important;
    gap:0!important
  }
  #trainerLayout.workspace-analyze.mobile-position-setup-open>.board-column,
#trainerLayout.workspace-analyze.mobile-position-setup-open>.middle-column{
    height:auto!important;
    max-height:none!important;
    min-height:0!important;
    overflow:visible!important
  }
  #trainerLayout.workspace-analyze.mobile-position-setup-open>.middle-column{
    width:100%!important;
    margin:0!important;
    padding:0!important;
    scrollbar-width:none!important;
    flex:0 0 auto!important;
    touch-action:pan-y!important
  }
  #trainerLayout.workspace-analyze.mobile-position-setup-open .middle-column>#lichessPanel{
    flex:0 0 auto!important;
    touch-action:pan-y!important
  }
  #trainerLayout.workspace-analyze.mobile-position-setup-open>.board-column{
    position:relative!important;
    z-index:3!important
  }
  #trainerLayout.workspace-analyze.mobile-position-setup-open>.middle-column{
    position:relative!important;
    z-index:2!important
  }
  #trainerLayout.workspace-analyze.mobile-position-setup-open>.middle-column::-webkit-scrollbar{display:none!important}
  #trainerLayout.workspace-analyze.mobile-position-setup-open #lichessPanel>.setup-panel.setup-docked{
    height:auto!important;
    max-height:none!important;
    overflow:visible!important
  }
}

/* Final Analyze density pass: keep the depth readout and its progress rule
   short so the continuation table starts immediately after the status row. */
@media(max-width:1000px){
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #trainerLayout.workspace-analyze .middle-column>.engine-panel #bestMovesPane{
    padding:.08rem .12rem .08rem!important;
  }
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #trainerLayout.workspace-analyze .middle-column>.engine-panel #bestMovesPane>.analysis-pane-header{
    grid-template-columns:minmax(0,1fr) auto!important;
    grid-template-areas:"progress actions"!important;
    gap:.1rem!important;
    min-height:0!important;
    margin:0!important;
    padding:0!important;
  }
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #trainerLayout.workspace-analyze .middle-column>.engine-panel #bestMovesPane .analysis-header-progress{
    grid-area:progress!important;
    grid-template-columns:auto minmax(0,1fr)!important;
    grid-template-rows:auto!important;
    column-gap:.16rem!important;
    row-gap:0!important;
    min-height:0!important;
    margin:0!important;
    line-height:1!important;
  }
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #trainerLayout.workspace-analyze .middle-column>.engine-panel #bestMovesPane .analysis-depth-row{
    grid-column:1!important;
    grid-row:1!important;
    justify-content:flex-start!important;
    min-height:0!important;
    font-size:.64rem!important;
  }
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #trainerLayout.workspace-analyze .middle-column>.engine-panel #bestMovesPane #analysisLiveDetails,
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #trainerLayout.workspace-analyze .middle-column>.engine-panel #bestMovesPane #analysisLichessStats{
    display:none!important;
  }
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #trainerLayout.workspace-analyze .middle-column>.engine-panel #bestMovesPane .analysis-progress-track{
    grid-column:2!important;
    grid-row:1!important;
    height:2px!important;
    margin:0!important;
  }
}

@media(max-width:1000px){
  html[data-mobile-mode="position"] #trainerLayout.workspace-analyze>.middle-column>.explore-position-source{display:flex!important;align-items:center;gap:.35rem;margin:0 0 .38rem!important;padding:.42rem .56rem!important}
  html[data-mobile-mode="position"] #trainerLayout.workspace-analyze .explore-position-source-heading{display:none}
  html[data-mobile-mode="position"] #trainerLayout.workspace-analyze .explore-position-source-row{flex:0 1 11rem;width:11rem;max-width:100%;min-width:0}
  html[data-mobile-mode="position"] #trainerLayout.workspace-analyze .explore-position-source-button{min-height:2.55rem!important;padding:.28rem .45rem!important;border:1px solid var(--ai-color-border,#cfd8e6)!important;border-radius:9px!important;background:var(--ai-color-surface-2,#edf2f8)!important}
  html[data-mobile-mode="position"] #trainerLayout.workspace-analyze .explore-position-source-button strong{font-size:.84rem}
  html[data-mobile-mode="position"] #trainerLayout.workspace-analyze .explore-position-collection-navigation{flex:0 1 10.6rem;width:auto;grid-template-columns:1.8rem minmax(0,1fr) 1.8rem;gap:.28rem;margin-top:0}
  html[data-mobile-mode="position"] #trainerLayout.workspace-analyze .explore-position-collection-navigation button{width:1.8rem;height:2.55rem;min-height:2.55rem;border-radius:9px}
  html[data-mobile-mode="position"] #trainerLayout.workspace-analyze>.middle-column>.engine-panel{display:none!important}
}

.explore-position-source-dialog{width:min(25rem,calc(100vw - 1rem));max-width:none;padding:0;border:1px solid var(--ai-color-border,#cfd8e6);border-radius:12px;background:var(--ai-color-surface-1,#fff);color:var(--ai-color-text,#10213a);box-shadow:0 18px 50px rgb(16 33 58 / .24)}
.explore-position-source-dialog::backdrop{background:rgb(16 33 58 / .34)}
.explore-position-source-dialog .explore-sheet-card{padding:.9rem}
.explore-position-source-options{display:grid;gap:.42rem;margin:.75rem 0 .55rem}
.explore-position-source-option{display:grid;gap:.16rem;width:100%;min-height:3.35rem;padding:.62rem .68rem;border:1px solid var(--ai-color-border,#cfd8e6);border-radius:9px;background:var(--ai-color-surface-2,#edf2f8);color:var(--ai-color-text,#10213a);text-align:left;font:inherit;cursor:pointer}
.explore-position-source-option strong{font-size:.88rem}
.explore-position-source-option small{color:var(--ai-color-text-muted,#627086);font-size:.72rem;line-height:1.25}
.explore-position-source-option.active{border-color:var(--ai-color-accent,#4267ff);box-shadow:inset 0 0 0 1px var(--ai-color-accent,#4267ff);background:color-mix(in srgb,var(--ai-color-accent,#4267ff) 8%,var(--ai-color-surface-1,#fff))}
.explore-position-source-actions{justify-content:flex-end!important;margin-top:.35rem}

/* Final phone Explain cascade: the reading frame owns the scroll, while the
   shared board/history shell remains fixed and visually sharp. */
@media(max-width:760px){
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #trainerLayout.workspace-analyze:not(.explore-continuations-open)>.middle-column>.engine-panel{display:none!important}
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #trainerLayout.workspace-analyze #annotationPanel{
    display:grid!important;grid-template-rows:auto 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>.right-column{
    height:0!important;min-height:0!important;max-height:none!important;flex:1 1 0!important;
    overflow-x:hidden!important;overflow-y:auto!important;overscroll-behavior:contain!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{
    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>#annotationPositionContent,
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #trainerLayout.workspace-analyze #annotationPanel>#moveAnalysisPane>#annotationMoveContent{
    flex:1 1 auto!important;min-height:0!important;max-height:none!important;overflow:visible!important;
    overscroll-behavior:contain!important;scrollbar-width:none;-ms-overflow-style:none
  }
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #trainerLayout.workspace-analyze #annotationPanel>#positionAnalysisPane>#annotationPositionContent::-webkit-scrollbar,
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #trainerLayout.workspace-analyze #annotationPanel>#moveAnalysisPane>#annotationMoveContent::-webkit-scrollbar{display:none;width:0;height:0}
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #trainerLayout.workspace-analyze #annotationPanel>#positionAnalysisPane.explain-settings-open>#explainSettingsPopover,
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #trainerLayout.workspace-analyze #annotationPanel>#positionAnalysisPane.explain-comment-open>#positionCommentPanel{
    flex:0 0 auto!important;height:auto!important;min-height:0!important
  }
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #trainerLayout.workspace-analyze #annotationPanel>#positionAnalysisPane.explain-comment-open>#positionCommentPanel{
    overflow:visible!important
  }
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #trainerLayout.workspace-analyze #annotationPanel>#positionAnalysisPane.explain-settings-open>.analysis-pane-header,
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #trainerLayout.workspace-analyze #annotationPanel>#positionAnalysisPane.explain-comment-open>.analysis-pane-header{
    display:none!important
  }
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #trainerLayout.workspace-analyze #annotationPanel>.explain-view-selector,
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #trainerLayout.workspace-analyze #annotationPanel>.explain-view-selector>button,
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #trainerLayout.workspace-analyze #explainSettingsPopover,
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #trainerLayout.workspace-analyze #explainSettingsPopover *{
    opacity:1!important;filter:none!important;transform:none!important;
    -webkit-font-smoothing:antialiased!important;text-rendering:optimizeLegibility!important;
    font-synthesis:none!important
  }
}

/* Desktop Navigate: present the three source actions as individual source
   cards, not as a mobile-style mutually exclusive tab strip. Their canonical
   content/controller remains single-instance because selecting a new source
   changes the shared board/position context. Engine and Explain stay split. */
@media(min-width:1001px){
  #trainerLayout.workspace-analyze #explorePositionSourceChoices{
    display:grid!important;grid-template-columns:repeat(3,minmax(0,1fr))!important;
    gap:.5rem!important;padding:0!important;border:0!important;
    background:transparent!important;
  }
  #trainerLayout.workspace-analyze #explorePositionSourceChoices>.explore-position-source-option{
    display:flex!important;flex-direction:column!important;align-items:center!important;
    justify-content:center!important;gap:.2rem!important;
    min-height:4rem!important;height:auto!important;width:100%!important;min-width:0!important;
    margin:0!important;padding:.42rem!important;white-space:normal!important;
    border:1px solid var(--ai-color-border,#cfd8e6)!important;
    border-radius:10px!important;line-height:1.2!important;
    background:var(--ai-color-surface-1,#fff)!important;
  }
  #trainerLayout.workspace-analyze #explorePositionSourceChoices>.explore-position-source-option.active{
    border-color:var(--ai-color-accent,#4267ff)!important;
    background:color-mix(in srgb,var(--ai-color-accent,#4267ff) 9%,white)!important;
  }
  #trainerLayout.workspace-analyze #explorePositionSourceChoices>.explore-position-source-option::after{
    display:block;font-size:.66rem;font-weight:400;opacity:.8;
  }
  #trainerLayout.workspace-analyze #explorePositionSourceChoices>[data-explore-position-source="setup-position"]::after{content:"Edit position"}
  #trainerLayout.workspace-analyze #explorePositionSourceChoices>[data-explore-position-source="trees"]::after{content:"Browse openings"}
  #trainerLayout.workspace-analyze #explorePositionSourceChoices>[data-explore-position-source="saved"]::after{content:"Saved positions"}
}

/* Desktop Navigate and Analyze use the same data workspace, but not each
   other's page panels. Mobile tabs and board geometry remain unchanged. */
.desktop-navigate-panel-title,.desktop-navigate-help-label{display:none!important}
@media(min-width:1001px){
  #trainerLayout.workspace-analyze[data-mobile-mode="position"]{
    grid-template-columns:var(--board-lock-zone-px) var(--board-lock-divider-width) minmax(0,1fr)!important;
  }
  #trainerLayout.workspace-analyze[data-mobile-mode="position"]>#analysisDivider,
  #trainerLayout.workspace-analyze[data-mobile-mode="position"]>.right-column{display:none!important}
  #trainerLayout.workspace-analyze[data-mobile-mode="position"]>.middle-column{
    grid-column:3!important;grid-row:1!important;display:flex!important;
    flex-direction:column!important;gap:.5rem!important;min-width:0!important;
    min-height:0!important;overflow:hidden!important;
  }
  #trainerLayout.workspace-analyze[data-mobile-mode="position"]>.middle-column>.engine-panel{display:none!important}
  #trainerLayout.workspace-analyze[data-mobile-mode="position"]>.middle-column>#explorePositionSourceControl{
    display:grid!important;flex:0 0 auto!important;grid-template-columns:minmax(0,1fr)!important;
    height:auto!important;min-width:0!important;margin:0!important;padding:.65rem .75rem!important;
  }
  #trainerLayout.workspace-analyze[data-mobile-mode="position"] #explorePositionSourceControl>.mobile-page-tab-strip{
    display:grid!important;grid-template-columns:minmax(0,1fr) auto!important;
    grid-template-rows:auto auto!important;column-gap:.5rem!important;row-gap:.45rem!important;
    align-items:center!important;min-width:0!important;
  }
  #trainerLayout.workspace-analyze[data-mobile-mode="position"] .desktop-navigate-panel-title{
    display:block!important;grid-column:1!important;grid-row:1!important;
    margin:0!important;font-size:.95rem!important;font-weight:750!important;line-height:1.3!important;
  }
  #trainerLayout.workspace-analyze[data-mobile-mode="position"] #exploreHelpButton{
    grid-column:2!important;grid-row:1!important;
    display:flex!important;align-items:center!important;justify-content:center!important;gap:.35rem!important;
    width:auto!important;min-width:0!important;height:2.25rem!important;min-height:2.25rem!important;
    padding:0 .65rem!important;margin:0!important;justify-self:end!important;
  }
  #trainerLayout.workspace-analyze[data-mobile-mode="position"] #exploreHelpButton .desktop-navigate-help-label{
    display:inline!important;font-size:.82rem!important;font-weight:650!important;
  }
  #trainerLayout.workspace-analyze[data-mobile-mode="position"] #explorePositionSourceChoices{
    grid-column:1/-1!important;grid-row:2!important;
    grid-template-columns:repeat(3,minmax(0,1fr))!important;width:100%!important;max-width:42rem!important;
  }
  #trainerLayout.workspace-analyze[data-mobile-mode="position"]>.middle-column>#navigateTabContent{
    display:flex;flex:1 1 auto;min-height:0;min-width:0;overflow-y:auto!important;
    overscroll-behavior:contain!important;
    background:var(--ai-color-surface-1,#fff);
    border:1px solid var(--ai-color-border,#d4dce6);border-radius:11px;
  }
  #trainerLayout.workspace-analyze[data-mobile-mode="position"]>.middle-column>#navigateTabContent[hidden]{
    display:none!important;
  }
  #trainerLayout.workspace-analyze[data-mobile-mode="position"] #navigateTabContent>.setup-panel.setup-docked{
    max-width:62rem!important;align-self:start!important;
  }
}

/* Desktop Navigate: three independent source cards. Mobile retains its
   mutually exclusive canonical source tabs and untouched phone sizing. */
@media(min-width:1001px){
  #trainerLayout.workspace-analyze[data-mobile-mode="position"]>.middle-column{
    container:desktop-navigate / inline-size;
  }
  #trainerLayout.workspace-analyze[data-mobile-mode="position"] #explorePositionSourceControl>.mobile-page-tab-strip{
    display:grid!important;grid-template-columns:minmax(0,1fr) auto!important;
    grid-template-rows:auto!important;align-items:center!important;min-height:2.25rem!important;
  }
  #trainerLayout.workspace-analyze[data-mobile-mode="position"] #explorePositionSourceChoices{
    display:none!important;
  }
  #trainerLayout.workspace-analyze[data-mobile-mode="position"] #explorePositionCollectionNavigation{
    display:none!important;
  }
  #trainerLayout.workspace-analyze[data-mobile-mode="position"]>.middle-column>#navigateTabContent{
    padding:0!important;border:0!important;background:transparent!important;
    overflow:hidden!important;
  }
  #trainerLayout.workspace-analyze[data-mobile-mode="position"] #desktopNavigatePanels{
    display:grid!important;
    grid-template-columns:minmax(0,1fr) minmax(0,1fr)!important;
    grid-template-rows:minmax(0,1fr)!important;
    width:100%!important;min-width:0!important;min-height:0!important;
    height:100%!important;gap:.65rem!important;
  }
  #trainerLayout.workspace-analyze[data-mobile-mode="position"] #desktopNavigatePanels[hidden]{display:none!important}
  #trainerLayout.workspace-analyze[data-mobile-mode="position"] .desktop-navigate-collections{
    display:grid!important;grid-template-rows:minmax(0,1.2fr) minmax(0,.8fr)!important;
    min-width:0!important;min-height:0!important;gap:.65rem!important;
  }
  #trainerLayout.workspace-analyze[data-mobile-mode="position"] .desktop-navigate-card{
    display:flex!important;flex-direction:column!important;align-items:stretch!important;
    min-height:0!important;min-width:0!important;overflow:auto!important;
    padding:.68rem .75rem!important;border:1px solid var(--ai-color-border,#d4dce6)!important;
    background:var(--ai-color-surface-1,#fff)!important;border-radius:11px!important;
    scrollbar-gutter:stable;
  }
  #trainerLayout.workspace-analyze[data-mobile-mode="position"] .desktop-navigate-card-heading{
    display:flex!important;align-items:center!important;justify-content:space-between!important;
    gap:.5rem!important;margin:0 0 .55rem!important;flex:0 0 auto!important;
  }
  #trainerLayout.workspace-analyze[data-mobile-mode="position"] .desktop-navigate-card-heading h3{
    margin:0!important;font-size:.95rem!important;font-weight:700!important;line-height:1.3!important;
  }
  #trainerLayout.workspace-analyze[data-mobile-mode="position"] .desktop-navigate-card button:not(.setup-piece):not(.setup-toggle){
    box-sizing:border-box!important;border-radius:9px!important;
    font:inherit!important;font-size:.84rem!important;font-weight:650!important;
    line-height:1.2!important;min-height:2.35rem!important;
  }
  #trainerLayout.workspace-analyze[data-mobile-mode="position"] .desktop-navigate-card #desktopNavigateEditButton,
  #trainerLayout.workspace-analyze[data-mobile-mode="position"] .desktop-navigate-item{
    background:var(--ai-color-surface-2,#eaf0f7)!important;
    border:1px solid var(--ai-color-border,#cdd7e5)!important;
    color:var(--ai-color-text,#10213a)!important;
    padding:.42rem .72rem!important;
  }
  #trainerLayout.workspace-analyze[data-mobile-mode="position"] .desktop-navigate-item.active{
    background:var(--ai-color-accent,#4865f5)!important;
    color:#fff!important;border-color:transparent!important;
  }
  #trainerLayout.workspace-analyze[data-mobile-mode="position"] .desktop-navigate-list{
    display:grid!important;grid-template-columns:minmax(0,1fr)!important;gap:.35rem!important;
    min-width:0!important;align-content:start!important;flex:0 0 auto!important;
  }
  #trainerLayout.workspace-analyze[data-mobile-mode="position"] .desktop-navigate-item{
    width:100%!important;text-align:left!important;overflow:hidden!important;
    text-overflow:ellipsis!important;white-space:nowrap!important;
  }
  #trainerLayout.workspace-analyze[data-mobile-mode="position"] .desktop-navigate-empty{
    margin:.45rem 0!important;color:var(--ai-color-text-muted,#65748a)!important;
    font-size:.82rem!important;line-height:1.5!important;
  }
  #trainerLayout.workspace-analyze[data-mobile-mode="position"] .desktop-navigate-signin{
    display:inline-block;width:max-content;font-size:.84rem;font-weight:650;
  }
  #trainerLayout.workspace-analyze[data-mobile-mode="position"] #desktopNavigateSetupSlot{
    min-width:0!important;min-height:0!important;
  }
  #trainerLayout.workspace-analyze[data-mobile-mode="position"] #desktopNavigateSetupSlot>#setupPanel{
    position:static!important;inset:auto!important;transform:none!important;
    display:block!important;width:100%!important;max-width:none!important;height:auto!important;
    max-height:none!important;min-width:0!important;padding:0!important;margin:0!important;
    background:transparent!important;border:0!important;border-radius:0!important;box-shadow:none!important;
    overflow:visible!important;z-index:auto!important;
  }
  #trainerLayout.workspace-analyze[data-mobile-mode="position"] #desktopNavigateSetupSlot>#setupPanel[hidden]{display:none!important}
  #trainerLayout.workspace-analyze[data-mobile-mode="position"] #desktopNavigateRepertoireDetail{
    min-width:0!important;min-height:0!important;flex:1 1 auto!important;overflow:auto!important;
  }
  #trainerLayout.workspace-analyze[data-mobile-mode="position"] #desktopNavigateRepertoireDetail>#lichessPanel{
    position:static!important;display:flex!important;flex-direction:column!important;
    width:100%!important;height:auto!important;min-height:0!important;
    min-width:0!important;max-height:none!important;border:0!important;
    padding:.35rem 0 0!important;margin:0!important;background:transparent!important;
    overflow:visible!important;
  }
  #trainerLayout.workspace-analyze[data-mobile-mode="position"] #desktopNavigateRepertoireDetail>#lichessPanel[hidden]{display:none!important}
  #trainerLayout.workspace-analyze[data-mobile-mode="position"] #desktopNavigateRepertoireDetail>#lichessPanel>.panel-title-row{display:none!important}
  #trainerLayout.workspace-analyze[data-mobile-mode="position"] #desktopNavigateRepertoireDetail #lichessSharedRoot{
    min-height:0!important;height:auto!important;max-height:none!important;overflow:visible!important;
  }
  @container desktop-navigate (max-width:54rem){
    #trainerLayout.workspace-analyze[data-mobile-mode="position"] #desktopNavigatePanels{
      grid-template-columns:minmax(0,1fr)!important;
      grid-template-rows:auto auto!important;
      height:auto!important;min-height:100%!important;
    }
    #trainerLayout.workspace-analyze[data-mobile-mode="position"] .desktop-navigate-collections{
      grid-template-rows:auto auto!important;min-height:0!important;
    }
    #trainerLayout.workspace-analyze[data-mobile-mode="position"] .desktop-navigate-card{
      max-height:none!important;overflow:visible!important;
    }
  }
}

/* Desktop Navigate Setup controls: the mobile-owned button wrapper must not
   occupy one third of a three-column grid. Track sizes adapt to the actual
   card width, and chess piece artwork scales with its tile. */
@media(min-width:1001px){
  #trainerLayout.workspace-analyze[data-mobile-mode="position"] #desktopNavigateEditButton[hidden]{
    display:none!important;
  }
  #trainerLayout.workspace-analyze[data-mobile-mode="position"] #desktopNavigateSetupSlot .setup-position-actions{
    display:block!important;
    grid-template-columns:none!important;
    width:100%!important;
    min-width:0!important;
    margin:.05rem 0 .55rem!important;
  }
  #trainerLayout.workspace-analyze[data-mobile-mode="position"] #desktopNavigateSetupSlot .setup-edit-actions{
    display:grid!important;
    grid-template-columns:repeat(auto-fit,minmax(min(8.25rem,100%),1fr))!important;
    gap:.4rem!important;
    width:100%!important;
    min-width:0!important;
  }
  #trainerLayout.workspace-analyze[data-mobile-mode="position"] #desktopNavigateSetupSlot .setup-edit-actions>button{
    display:flex!important;
    align-items:center!important;
    justify-content:center!important;
    text-align:center!important;
    width:100%!important;
    min-width:0!important;
    max-width:100%!important;
    min-height:2.35rem!important;
    height:auto!important;
    padding:.4rem .55rem!important;
    white-space:normal!important;
  }
  #trainerLayout.workspace-analyze[data-mobile-mode="position"] #desktopNavigateSetupSlot .setup-palette{
    display:grid!important;
    grid-template-columns:repeat(auto-fit,minmax(min(3.35rem,100%),3.9rem))!important;
    justify-content:start!important;
    align-content:start!important;
    gap:.36rem!important;
    width:100%!important;
    min-width:0!important;
    margin:.4rem 0 .6rem!important;
  }
  #trainerLayout.workspace-analyze[data-mobile-mode="position"] #desktopNavigateSetupSlot .setup-piece{
    display:grid!important;
    place-items:center!important;
    box-sizing:border-box!important;
    width:100%!important;
    min-width:0!important;
    max-width:100%!important;
    min-height:0!important;
    height:auto!important;
    aspect-ratio:1 / 1!important;
    padding:.12rem!important;
    overflow:hidden!important;
  }
  #trainerLayout.workspace-analyze[data-mobile-mode="position"] #desktopNavigateSetupSlot .setup-piece .piece{
    display:block!important;
    inline-size:min(2.65rem,85%)!important;
    block-size:min(2.65rem,85%)!important;
    max-inline-size:100%!important;
    max-block-size:100%!important;
    object-fit:contain!important;
    margin:auto!important;
  }
}
