/*
 * Shared mobile chess workspace shell.
 *
 * On phones the board, primary navigation and move-navigation strip are one
 * persistent unit. Play / Explore / Explain / Train differ only in the lower
 * workspace mounted after this shell. Portrait has one invariant geometry;
 * only the lower workspace scrolls. Short landscape keeps its compact rail.
 */
@media (max-width:1000px){
  :root{
    --mobile-shell-hit:44px;
    --mobile-shell-gap:.28rem;
    --mobile-shell-rail:44px;
    --mobile-shell-surface:color-mix(in srgb,var(--ai-color-background,#f6f8fc) 97%,transparent);
    --mobile-shell-expanded-board:min(calc(100vw - 1.1rem),calc(100dvh - 7.4rem),46rem);
    --mobile-shell-compact-board:min(calc(100vw - 3.65rem),38dvh,19rem);
    --mobile-shell-landscape-board:min(calc(100vw - 3.65rem),calc(100dvh - 3.25rem),20rem);
  }

  html,body{max-width:100%;overflow:hidden}
  html.mobile-chess-shell-active{
    height:100%!important;
    min-height:100%!important;
    max-height:100%!important;
    overflow:hidden!important;
    overscroll-behavior:none!important;
  }
  html.mobile-chess-shell-active body{
    height:100dvh!important;
    min-height:0!important;
    max-height:100dvh!important;
    overflow:hidden!important;
    overflow-anchor:none!important;
  }
  html.mobile-chess-shell-active .chess-app{
    box-sizing:border-box!important;
    display:flex!important;
    flex-direction:column!important;
    height:100dvh!important;
    min-height:0!important;
    max-height:100dvh!important;
    overflow:hidden!important;
    overflow-anchor:none!important;
  }

  #trainerLayout.mobile-chess-shell{
    display:flex!important;
    flex:1 1 auto!important;
    flex-direction:column!important;
    align-items:start!important;
    gap:.5rem!important;
    width:100%!important;
    max-width:100%!important;
    height:100%!important;
    min-height:0!important;
    max-height:100%!important;
    overflow:hidden!important;
    overflow-anchor:none!important;
  }

  #trainerLayout.mobile-chess-shell>.board-column{
    flex:0 0 auto!important;
    position:relative!important;
    inset:auto!important;
    z-index:20;
    display:grid!important;
    grid-template-columns:minmax(0,1fr)!important;
    grid-template-rows:auto auto auto!important;
    align-items:start!important;
    justify-items:center!important;
    gap:var(--mobile-shell-gap)!important;
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    height:auto!important;
    min-height:0!important;
    margin:0!important;
    padding:0!important;
    overflow:visible!important;
    contain:none!important;
    isolation:isolate;
    overflow-anchor:none;
  }

  /* Play's sticky lower toolbar paints at z-index:35 in a sibling pane.
     The isolated board column normally paints at z-index:20, trapping its
     hamburger menu beneath that toolbar. Lift the parent stacking context
     only while the menu is open; never change board or tab geometry. */
  #trainerLayout.mobile-chess-shell>.board-column:has(#appMenu:not([hidden])){
    z-index:200!important;
  }

  #trainerLayout.mobile-chess-shell>.board-column>.app-header{
    position:relative!important;
    inset:auto!important;
    grid-column:1!important;
    grid-row:1!important;
    display:grid!important;
    grid-template-columns:var(--mobile-shell-hit) minmax(0,1fr)!important;
    align-items:center!important;
    gap:.3rem!important;
    width:100%!important;
    min-width:0!important;
    min-height:var(--mobile-shell-hit)!important;
    height:auto!important;
    margin:0!important;
    padding:0!important;
    border:0!important;
    background:transparent!important;
    box-shadow:none!important;
    backdrop-filter:none!important;
  }
  #trainerLayout.mobile-chess-shell>.board-column>.app-header .header-main{display:contents!important}
  #trainerLayout.mobile-chess-shell>.board-column>.app-header h1,
  #trainerLayout.mobile-chess-shell>.board-column>.app-header .header-summary,
  #trainerLayout.mobile-chess-shell>.board-column>.app-header .save-status{display:none!important}

  #trainerLayout.mobile-chess-shell #mainMenuButton{
    grid-column:1!important;
    grid-row:1!important;
    width:var(--mobile-shell-hit)!important;
    min-width:var(--mobile-shell-hit)!important;
    height:var(--mobile-shell-hit)!important;
    min-height:var(--mobile-shell-hit)!important;
    margin:0!important;
    padding:0!important;
  }
  #trainerLayout.mobile-chess-shell .mobile-primary-nav{
    grid-column:2!important;
    grid-row:1!important;
    display:grid!important;
    grid-template-columns:repeat(4,minmax(0,1fr))!important;
    grid-template-rows:var(--mobile-shell-hit)!important;
    grid-auto-flow:column!important;
    gap:.2rem!important;
    width:100%!important;
    min-width:0!important;
  }
  #trainerLayout.mobile-chess-shell .mobile-primary-tab{
    display:flex!important;
    align-items:center!important;
    justify-content:center!important;
    gap:.28rem!important;
    width:100%!important;
    min-width:0!important;
    height:var(--mobile-shell-hit)!important;
    min-height:var(--mobile-shell-hit)!important;
    padding:.25rem .16rem!important;
    border-radius:9px!important;
    line-height:1!important;
  }
  #trainerLayout.mobile-chess-shell .mobile-tab-label{display:inline;min-width:0;overflow:hidden;text-overflow:ellipsis}
  #trainerLayout.mobile-chess-shell .mobile-tab-icon{display:none}

  #trainerLayout.mobile-chess-shell #board{
    grid-column:1!important;
    grid-row:2!important;
    width:var(--mobile-shell-expanded-board)!important;
    max-width:100%!important;
    min-width:0!important;
    height:auto!important;
    aspect-ratio:1 / 1!important;
    justify-self:center!important;
    margin:0!important;
    position:relative!important;
    inset:auto!important;
  }

  #trainerLayout.mobile-chess-shell>.board-column>.history-navigation{
    grid-column:1!important;
    grid-row:3!important;
    display:grid!important;
    grid-template-columns:var(--mobile-shell-hit) minmax(0,1fr) var(--mobile-shell-hit) var(--mobile-shell-hit)!important;
    grid-template-rows:var(--mobile-shell-hit)!important;
    align-items:center!important;
    gap:.18rem!important;
    width:var(--mobile-shell-expanded-board)!important;
    max-width:100%!important;
    min-width:0!important;
    min-height:var(--mobile-shell-hit)!important;
    height:var(--mobile-shell-hit)!important;
    margin:0!important;
    overflow:hidden!important;
    justify-self:center!important;
  }
  /* This boundary intentionally matches the specificity of historical Play
     rules so the final shared shell remains the only phone geometry owner. */
  html.mobile-chess-shell-active #trainerLayout.mobile-chess-shell>.board-column>.history-navigation{
    grid-template-columns:var(--mobile-shell-hit) minmax(0,1fr) var(--mobile-shell-hit) var(--mobile-shell-hit)!important;
    grid-template-rows:var(--mobile-shell-hit)!important;
    height:var(--mobile-shell-hit)!important;
    min-height:var(--mobile-shell-hit)!important;
  }
  html.mobile-chess-shell-active #trainerLayout.mobile-chess-shell>.board-column>.history-navigation>.history-arrow,
  html.mobile-chess-shell-active #trainerLayout.mobile-chess-shell>.board-column>.history-navigation>#favoritePositionButton{
    display:grid!important;
    place-items:center!important;
    width:var(--mobile-shell-hit)!important;
    min-width:var(--mobile-shell-hit)!important;
    max-width:var(--mobile-shell-hit)!important;
    height:var(--mobile-shell-hit)!important;
    min-height:var(--mobile-shell-hit)!important;
    max-height:var(--mobile-shell-hit)!important;
    align-self:stretch!important;
    margin:0!important;
    padding:0!important;
  }
  #trainerLayout.mobile-chess-shell #backMoveButton{grid-column:1!important;grid-row:1!important}
  #trainerLayout.mobile-chess-shell #forwardMoveButton{grid-column:4!important;grid-row:1!important}
  #trainerLayout.mobile-chess-shell #favoritePositionButton{grid-column:3!important;grid-row:1!important}
  #trainerLayout.mobile-chess-shell #historyPositionText,
  #trainerLayout.mobile-chess-shell #mobileMoveTrail,
  #trainerLayout.mobile-chess-shell #mobileCurrentMoveText,
  #trainerLayout.mobile-chess-shell #playChessClocks{
    grid-column:2!important;
    grid-row:1!important;
    min-width:0!important;
    max-width:100%!important;
    height:var(--mobile-shell-hit)!important;
  }

  /* Play keeps the clocks as the contextual centre of the common arrow strip. */
  html[data-mobile-mode="play"] #trainerLayout.mobile-chess-shell #playChessClocks{
    display:grid!important;
    grid-template-columns:minmax(0,1fr) minmax(0,1fr)!important;
    align-items:stretch!important;
    gap:.12rem!important;
  }
  /* The legacy Play desktop rule also applies to the active mobile class and
     fixes the clock group at 2.45rem. Mobile keeps the shared 44px shell row
     authoritative so clocks reach the same bottom edge as arrows and star. */
  html.mobile-chess-shell-active[data-mobile-mode="play"] #trainerLayout.mobile-chess-shell #playChessClocks{
    height:var(--mobile-shell-hit)!important;
    min-height:var(--mobile-shell-hit)!important;
    align-self:stretch!important;
  }
  html.mobile-chess-shell-active[data-mobile-mode="play"] #trainerLayout.mobile-chess-shell #playChessClocks .play-chess-clock{
    height:var(--mobile-shell-hit)!important;
    min-height:var(--mobile-shell-hit)!important;
    align-self:stretch!important;
  }
  html[data-mobile-mode="play"] #trainerLayout.mobile-chess-shell #historyPositionText,
  html[data-mobile-mode="play"] #trainerLayout.mobile-chess-shell #mobileMoveTrail,
  html[data-mobile-mode="play"] #trainerLayout.mobile-chess-shell #mobileCurrentMoveText,
  html[data-mobile-mode="play"] #trainerLayout.mobile-chess-shell #trainingReplayButton{display:none!important}
  #trainerLayout.mobile-chess-shell .play-chess-clock{min-height:var(--mobile-shell-hit)!important;padding:.18rem .2rem!important}

  /* Explore/Explain use the recent-move trail as contextual text between arrows. */
  html[data-mobile-mode="position"] #trainerLayout.mobile-chess-shell #mobileMoveTrail,
  html[data-mobile-mode="explain"] #trainerLayout.mobile-chess-shell #mobileMoveTrail{display:flex!important;align-items:center!important}
  html[data-mobile-mode="position"] #trainerLayout.mobile-chess-shell #historyPositionText,
  html[data-mobile-mode="explain"] #trainerLayout.mobile-chess-shell #historyPositionText,
  html[data-mobile-mode="position"] #trainerLayout.mobile-chess-shell #mobileCurrentMoveText,
  html[data-mobile-mode="explain"] #trainerLayout.mobile-chess-shell #mobileCurrentMoveText,
  html[data-mobile-mode="position"] #trainerLayout.mobile-chess-shell #playChessClocks,
  html[data-mobile-mode="explain"] #trainerLayout.mobile-chess-shell #playChessClocks{display:none!important}

  /* Training can swap its contextual text, but geometry never changes. */
  html[data-mobile-mode="training"] #trainerLayout.mobile-chess-shell #playChessClocks{display:none!important}

  /* Play owns the mobile lower workspace. The shared Explore pane remains in
     the DOM for the other modes, but must not leak into Play below the board. */
  html[data-mobile-mode="play"] #trainerLayout.mobile-chess-shell>.middle-column{display:none!important}

  /* The lower workspace is always a sibling after the shared board shell. */
  #trainerLayout.mobile-chess-shell>.play-side-column,
  #trainerLayout.mobile-chess-shell>.middle-column,
  #trainerLayout.mobile-chess-shell>.right-column,
  #trainerLayout.mobile-chess-shell>#focusedWorkspace{
    box-sizing:border-box!important;
    flex:1 1 0!important;
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    min-height:0!important;
    max-height:none!important;
    overflow-x:hidden!important;
    overflow-y:auto!important;
    overscroll-behavior:contain!important;
    touch-action:pan-y!important;
    scrollbar-width:none!important;
    -ms-overflow-style:none!important;
  }
  /* responsive-shell.css keeps Play's historical wrapper as display:contents.
     Once the page tabs are moved outside #playModeInfo, that would dissolve
     the very scroll container that should hold the tabs at its top edge. */
  #trainerLayout.mobile-chess-shell>.play-side-column{
    display:flex!important;
    flex-direction:column!important;
    align-self:stretch!important;
    gap:0!important;
  }
  #trainerLayout.mobile-chess-shell>.play-side-column::-webkit-scrollbar,
  #trainerLayout.mobile-chess-shell>.middle-column::-webkit-scrollbar,
  #trainerLayout.mobile-chess-shell>.right-column::-webkit-scrollbar,
  #trainerLayout.mobile-chess-shell>#focusedWorkspace::-webkit-scrollbar{display:none!important;width:0!important;height:0!important}

  /* These mode-specific declarations intentionally outrank older document-flow
     rules. Exactly one visible pane receives the finite remainder of the A55
     viewport and owns vertical scrolling. */
  html.mobile-chess-shell-active[data-mobile-mode="play"] #trainerLayout.mobile-chess-shell.workspace-play>.play-side-column,
  html.mobile-chess-shell-active[data-mobile-mode="position"] #trainerLayout.mobile-chess-shell.workspace-analyze>.middle-column,
  html.mobile-chess-shell-active[data-mobile-mode="explain"][data-mobile-analysis-submode="engine"] #trainerLayout.mobile-chess-shell.workspace-analyze>.middle-column,
  html.mobile-chess-shell-active[data-mobile-mode="explain"][data-mobile-analysis-submode="explain"] #trainerLayout.mobile-chess-shell.workspace-analyze>.right-column,
  html.mobile-chess-shell-active[data-mobile-mode="training"] #trainerLayout.mobile-chess-shell.workspace-training>.middle-column{
    box-sizing:border-box!important;
    flex:1 1 0!important;
    height:0!important;
    min-height:0!important;
    max-height:none!important;
    align-self:stretch!important;
    overflow-x:hidden!important;
    overflow-y:auto!important;
    overscroll-behavior:contain!important;
    touch-action:pan-y!important;
    scrollbar-width:none!important;
    -ms-overflow-style:none!important;
  }

  /* The analysis column is kept in the shared DOM, but it is not a Play pane.
     Its empty flex track otherwise reserves the blank region between the
     board/arrows shell and the Play tabs. */
  html.mobile-chess-shell-active[data-mobile-mode="play"] #trainerLayout.mobile-chess-shell.workspace-play>.right-column{display:none!important}
  html.mobile-chess-shell-active[data-mobile-mode="position"] #trainerLayout.mobile-chess-shell.workspace-analyze>.middle-column{
    display:flex!important;
    flex-direction:column!important;
    gap:0!important;
  }
  html.mobile-chess-shell-active[data-mobile-mode="position"] #trainerLayout.mobile-chess-shell.workspace-analyze>.right-column{display:none!important}

  /* Analyze shares the same full-height phone shell as Navigate. The selected
     numerical or explanatory surface is the only lower workspace. */
  html.mobile-chess-shell-active[data-mobile-mode="explain"],
  html.mobile-chess-shell-active[data-mobile-mode="explain"] body{
    height:100dvh!important;
    min-height:0!important;
    max-height:100dvh!important;
    overflow:hidden!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{
    display:flex!important;
    flex-direction:column!important;
    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>#mobileAnalyzeViewTabs{
    flex:0 0 48px!important;
    width:100%!important;
    min-height:48px!important;
  }
  html.mobile-chess-shell-active[data-mobile-mode="explain"][data-mobile-analysis-submode="engine"] #trainerLayout.mobile-chess-shell.workspace-analyze>.middle-column,
  html.mobile-chess-shell-active[data-mobile-mode="explain"][data-mobile-analysis-submode="explain"] #trainerLayout.mobile-chess-shell.workspace-analyze>.right-column{
    box-sizing:border-box!important;
    display:flex!important;
    flex:1 1 0!important;
    flex-direction:column!important;
    width:100%!important;
    height:0!important;
    min-height:0!important;
    max-height:none!important;
    overflow-x:hidden!important;
    overflow-y:auto!important;
    overscroll-behavior:contain!important;
    touch-action:pan-y!important;
    scrollbar-width:none!important;
    -ms-overflow-style:none!important;
  }
  html.mobile-chess-shell-active[data-mobile-mode="explain"][data-mobile-analysis-submode="engine"] #trainerLayout.mobile-chess-shell.workspace-analyze>.right-column,
  html.mobile-chess-shell-active[data-mobile-mode="explain"][data-mobile-analysis-submode="explain"] #trainerLayout.mobile-chess-shell.workspace-analyze>.middle-column{
    display:none!important;
  }
  /* On the mobile Analysis surface, keep evaluation controls and the depth
     status in one header row. Depth belongs on the right of the controls. */
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #trainerLayout.mobile-chess-shell.workspace-analyze .middle-column>.engine-panel #bestMovesPane>.analysis-pane-header{
    grid-template-columns:auto minmax(0,1fr)!important;
    grid-template-areas:"actions progress"!important;
  }

  #trainerLayout.mobile-chess-shell>#mobileAnalyzeViewTabs{
    flex:0 0 48px!important;
    width:100%!important;
    min-height:48px!important;
    margin:0!important;
  }

  /* Each page keeps its own tab switcher at the top of the lower pane while
     the selected page content scrolls beneath it. */
  html[data-mobile-mode="play"] #trainerLayout.mobile-chess-shell>.play-side-column>#playControlsRow,
  html[data-mobile-mode="position"] #trainerLayout.mobile-chess-shell>.middle-column #exploreViewToolbar,
  html[data-mobile-mode="explain"] #trainerLayout.mobile-chess-shell>.right-column #explainViewSelector,
  html[data-mobile-mode="training"] #trainerLayout.mobile-chess-shell>.middle-column .lvgb-training-mobile-launch{
    position:sticky!important;
    top:0!important;
    z-index:35!important;
    background:var(--mobile-shell-surface)!important;
  }

  /* The final Lichess responsive module used to hide Train's page tabs and
     create a nested session scroller. The shared lower pane now owns both. */
  html.mobile-chess-shell-active[data-mobile-mode="training"] #trainerLayout.mobile-chess-shell.workspace-training .lvgb-app.lvgb-training-active .lvgb-training-mobile-launch{
    display:block!important;
  }
  html.mobile-chess-shell-active[data-mobile-mode="training"] #trainerLayout.mobile-chess-shell.workspace-training .lvgb-app.lvgb-training-active,
  html.mobile-chess-shell-active[data-mobile-mode="training"] #trainerLayout.mobile-chess-shell.workspace-training .lvgb-app.lvgb-training-active>[data-lvgb-view="training"],
  html.mobile-chess-shell-active[data-mobile-mode="training"] #trainerLayout.mobile-chess-shell.workspace-training .lvgb-app.lvgb-training-active .lvgb-training-card{
    height:auto!important;
    min-height:0!important;
    max-height:none!important;
    overflow:visible!important;
  }
  html.mobile-chess-shell-active[data-mobile-mode="training"] #trainerLayout.mobile-chess-shell.workspace-training .lvgb-app.lvgb-training-active>[data-lvgb-view="training"],
  html.mobile-chess-shell-active[data-mobile-mode="training"] #trainerLayout.mobile-chess-shell.workspace-training .lvgb-app.lvgb-training-active .lvgb-training-card{
    grid-template-rows:auto auto!important;
    align-content:start!important;
  }
  html.mobile-chess-shell-active[data-mobile-mode="training"] #trainerLayout.mobile-chess-shell.workspace-training .lvgb-app.lvgb-training-active .lvgb-training-session{
    height:auto!important;
    min-height:0!important;
    max-height:none!important;
    overflow:visible!important;
  }
  #trainerLayout.mobile-chess-shell>#workspaceDivider,
  #trainerLayout.mobile-chess-shell>#analysisDivider,
  #trainerLayout.mobile-chess-shell>.play-divider{display:none!important}

  /* Compact sticky state: menu/tabs become the board's side rail. */
  #trainerLayout.mobile-chess-shell-compact{
    /* Keep the lower workspace below the original shell flow box while the
       visible sticky board becomes smaller. This prevents long Setup content
       from rising underneath the board as the page scrolls. */
    grid-template-rows:minmax(var(--mobile-shell-expanded-height),max-content)!important;
  }
  #trainerLayout.mobile-chess-shell-compact .play-side-column{
    /* Give the sticky Setup panel enough containing flow to stay below the
       board while its own contents are scrolled. */
    padding-bottom:var(--mobile-shell-compact-height,0px)!important;
  }
  /* The extra flow space belongs only to the fixed Setup panel. A normal Play
     score must finish at its last move instead of leaving a blank tail. */
  html[data-mobile-mode="play"] #trainerLayout.mobile-chess-shell-compact:not(.position-setup-open) .play-side-column{
    padding-bottom:0!important;
  }
  #trainerLayout.mobile-chess-shell .play-side-column>.setup-panel.setup-docked{
    scrollbar-width:none;
    -ms-overflow-style:none;
  }
  #trainerLayout.mobile-chess-shell .play-side-column>.setup-panel.setup-docked::-webkit-scrollbar{display:none;width:0;height:0}
  #trainerLayout.mobile-chess-shell-expanded .play-side-column>.setup-panel.setup-docked,
  html.mobile-chess-shell-active #trainerLayout.mobile-chess-shell-expanded .play-side-column>.setup-panel.setup-docked{
    max-height:calc(100dvh - var(--mobile-shell-expanded-height,0px) - .35rem)!important;
    overflow:auto!important;
    /* If the panel fits, a swipe over it must still scroll the page to reveal
       controls below the fold. The panel takes over only once it has its own
       overflow range. */
    overscroll-behavior:auto!important;
    scrollbar-width:none;
    -ms-overflow-style:none;
  }
  #trainerLayout.mobile-chess-shell-expanded .play-side-column>.setup-panel.setup-docked::-webkit-scrollbar,
  html.mobile-chess-shell-active #trainerLayout.mobile-chess-shell-expanded .play-side-column>.setup-panel.setup-docked::-webkit-scrollbar{display:none;width:0;height:0}
  #trainerLayout.mobile-chess-shell-compact .play-side-column>.setup-panel.setup-docked,
  html.mobile-chess-shell-active #trainerLayout.mobile-chess-shell-compact .play-side-column>.setup-panel.setup-docked{
    /* Keep the board shell above this long panel; the panel itself owns the
       remaining mobile scroll area. */
    position:fixed!important;
    top:var(--mobile-shell-compact-height,0px)!important;
    left:max(.35rem,env(safe-area-inset-left))!important;
    right:max(.35rem,env(safe-area-inset-right))!important;
    width:auto!important;
    height:auto!important;
    max-height:calc(100dvh - var(--mobile-shell-compact-height,0px) - .35rem)!important;
    overflow:auto!important;
    overscroll-behavior:contain!important;
    z-index:117!important;
    scrollbar-width:none;
    -ms-overflow-style:none;
  }
  #trainerLayout.mobile-chess-shell-compact .play-side-column>.setup-panel.setup-docked::-webkit-scrollbar,
  html.mobile-chess-shell-active #trainerLayout.mobile-chess-shell-compact .play-side-column>.setup-panel.setup-docked::-webkit-scrollbar{display:none;width:0;height:0}
  #trainerLayout.mobile-chess-shell-compact>.board-column{
    position:sticky!important;
    top:0!important;
    z-index:118!important;
    grid-template-columns:var(--mobile-shell-rail) minmax(0,1fr)!important;
    grid-template-rows:auto var(--mobile-shell-hit)!important;
    column-gap:.22rem!important;
    row-gap:.16rem!important;
    justify-content:center!important;
    align-items:start!important;
    padding:max(.2rem,env(safe-area-inset-top)) max(.2rem,env(safe-area-inset-right)) .24rem max(.2rem,env(safe-area-inset-left))!important;
    background:var(--mobile-shell-surface)!important;
    border-bottom:1px solid color-mix(in srgb,var(--ai-color-border,#cfd8e6) 80%,transparent)!important;
    box-shadow:0 8px 22px rgba(10,18,30,.15)!important;
    backdrop-filter:none!important;
    -webkit-backdrop-filter:none!important;
  }
  #trainerLayout.mobile-chess-shell .mobile-primary-tab[data-mobile-mode="position"] .mobile-tab-icon-single{display:grid!important}
  #trainerLayout.mobile-chess-shell .mobile-primary-tab[data-mobile-mode="position"] .mobile-tab-icon-combined{display:none!important}
  #trainerLayout.mobile-chess-shell-compact>.board-column>.app-header{
    grid-column:1!important;
    grid-row:1 / span 2!important;
    align-self:start!important;
    display:flex!important;
    flex-direction:column!important;
    align-items:stretch!important;
    gap:.2rem!important;
    width:var(--mobile-shell-rail)!important;
    min-width:var(--mobile-shell-rail)!important;
    min-height:0!important;
  }
  #trainerLayout.mobile-chess-shell-compact>.board-column>.app-header .header-main{display:contents!important}
  #trainerLayout.mobile-chess-shell-compact #mainMenuButton{order:0!important;flex:0 0 var(--mobile-shell-hit)!important}
  #trainerLayout.mobile-chess-shell-compact .mobile-primary-nav{
    order:1!important;
    display:grid!important;
    grid-template-columns:1fr!important;
    grid-template-rows:repeat(4,var(--mobile-shell-hit))!important;
    grid-auto-flow:row!important;
    gap:.18rem!important;
    width:var(--mobile-shell-rail)!important;
    min-width:var(--mobile-shell-rail)!important;
  }
  #trainerLayout.mobile-chess-shell-compact .mobile-primary-tab{
    width:var(--mobile-shell-hit)!important;
    min-width:var(--mobile-shell-hit)!important;
    height:var(--mobile-shell-hit)!important;
    min-height:var(--mobile-shell-hit)!important;
    padding:0!important;
  }
  #trainerLayout.mobile-chess-shell-compact .mobile-tab-label{display:none!important}
  #trainerLayout.mobile-chess-shell-compact .mobile-tab-icon{display:grid!important;place-items:center!important}
  #trainerLayout.mobile-chess-shell-compact .mobile-tab-icon svg{width:1.3rem!important;height:1.3rem!important}
  #trainerLayout.mobile-chess-shell-compact #board{
    grid-column:2!important;
    grid-row:1!important;
    width:var(--mobile-shell-compact-board)!important;
    max-width:100%!important;
    aspect-ratio:1 / 1!important;
    justify-self:center!important;
    box-shadow:0 7px 18px rgba(0,0,0,.18)!important;
  }
  html.mobile-chess-shell-active #trainerLayout.mobile-chess-shell-compact>.board-column>.history-navigation{
    grid-column:2!important;
    grid-row:2!important;
    grid-template-columns:var(--mobile-shell-hit) minmax(0,1fr) var(--mobile-shell-hit)!important;
    width:var(--mobile-shell-compact-board)!important;
    height:var(--mobile-shell-hit)!important;
    min-height:var(--mobile-shell-hit)!important;
    margin:0!important;
  }
  #trainerLayout.mobile-chess-shell-compact #favoritePositionButton{display:none!important}
  #trainerLayout.mobile-chess-shell-compact #forwardMoveButton{grid-column:3!important}
  /* Play keeps Favorite visible in compact landscape as part of the shared
     navigation contract; only the middle clock contents are allowed to yield. */
  html[data-mobile-mode="play"] #trainerLayout.mobile-chess-shell-compact>.board-column>.history-navigation{
    grid-template-columns:var(--mobile-shell-hit) minmax(0,1fr) var(--mobile-shell-hit) var(--mobile-shell-hit)!important;
    width:var(--mobile-shell-compact-board)!important;
    max-width:100%!important;
    justify-self:center!important;
  }
  html[data-mobile-mode="play"] #trainerLayout.mobile-chess-shell-compact #favoritePositionButton{
    display:grid!important;
    grid-column:3!important;
    grid-row:1!important;
  }
  html[data-mobile-mode="play"] #trainerLayout.mobile-chess-shell-compact #forwardMoveButton{grid-column:4!important}
  html[data-mobile-mode="play"] #trainerLayout.mobile-chess-shell-landscape>.board-column>.history-navigation{
    width:var(--mobile-shell-landscape-board)!important;
    max-width:100%!important;
    justify-self:center!important;
  }
  #trainerLayout.mobile-chess-shell-compact .play-chess-clock .clock-player-name,
  #trainerLayout.mobile-chess-shell-compact .play-chess-clock .clock-side{display:none!important}
  #trainerLayout.mobile-chess-shell-compact .play-chess-clock strong{font-size:.72rem!important}
  #trainerLayout.mobile-chess-shell-compact .mobile-move-trail button{min-height:0!important;height:1.8rem!important;padding:.08rem .12rem!important}
  #trainerLayout.mobile-chess-shell-compact .app-menu{
    position:fixed!important;
    z-index:150!important;
    top:max(.25rem,env(safe-area-inset-top))!important;
    left:calc(max(.2rem,env(safe-area-inset-left)) + var(--mobile-shell-rail) + .3rem)!important;
    width:min(17rem,calc(100vw - var(--mobile-shell-rail) - .9rem))!important;
    max-height:calc(100dvh - .6rem)!important;
  }

  /* Short landscape starts in the same side-rail composition, height-limited. */
  #trainerLayout.mobile-chess-shell-landscape #board{width:var(--mobile-shell-landscape-board)!important}
  #trainerLayout.mobile-chess-shell-landscape>.board-column>.history-navigation{width:var(--mobile-shell-landscape-board)!important}

  /* P0/P1 touch targets. Visual glyphs may be smaller; hit areas may not. */
  #trainerLayout.mobile-chess-shell .history-arrow,
  #trainerLayout.mobile-chess-shell #favoritePositionButton,
  #trainerLayout.mobile-chess-shell #mainMenuButton,
  #trainerLayout.mobile-chess-shell .mobile-primary-tab{touch-action:manipulation}

  #trainerLayout.mobile-chess-shell .play-game-controls>button{min-height:var(--mobile-shell-hit)!important}
  #trainerLayout.mobile-chess-shell .play-position-tools>button{min-height:var(--mobile-shell-hit)!important}
  html[data-mobile-mode="play"] #trainerLayout.mobile-chess-shell .play-game-controls{
    display:grid!important;
    grid-template-columns:repeat(3,minmax(0,1fr))!important;
    gap:.28rem!important;
    width:100%!important;
    margin:0!important;
  }
  html[data-mobile-mode="play"] #trainerLayout.mobile-chess-shell .play-game-controls>button{
    width:100%!important;
    min-width:0!important;
    height:var(--mobile-shell-hit)!important;
    min-height:var(--mobile-shell-hit)!important;
    padding:0!important;
  }
  #trainerLayout.mobile-chess-shell .setup-position-actions{
    display:grid!important;
    grid-template-columns:repeat(3,minmax(0,1fr))!important;
    gap:.4rem!important;
  }
  #trainerLayout.mobile-chess-shell .setup-position-actions>button{
    width:100%!important;
    min-width:0!important;
    min-height:var(--mobile-shell-hit)!important;
    padding:.25rem .3rem!important;
  }
  #trainerLayout.mobile-chess-shell #explainPositionButton{min-height:var(--mobile-shell-hit)!important;height:auto!important}
  #trainerLayout.mobile-chess-shell #explainSettingsButton{min-height:var(--mobile-shell-hit)!important;height:var(--mobile-shell-hit)!important;min-width:0!important;width:auto!important}
  #trainerLayout.mobile-chess-shell #explainMobileCommentButton{min-height:var(--mobile-shell-hit)!important;height:var(--mobile-shell-hit)!important;min-width:0!important;width:auto!important}
  #trainerLayout.mobile-chess-shell .explore-position-collection-navigation button{min-height:var(--mobile-shell-hit)!important;min-width:var(--mobile-shell-hit)!important;width:var(--mobile-shell-hit)!important;height:var(--mobile-shell-hit)!important}
  #trainerLayout.mobile-chess-shell .explore-view-tab{min-height:var(--mobile-shell-hit)!important}
  #trainerLayout.mobile-chess-shell .lvgb-help{min-height:var(--mobile-shell-hit)!important;min-width:var(--mobile-shell-hit)!important;width:var(--mobile-shell-hit)!important;height:var(--mobile-shell-hit)!important}
  #trainerLayout.mobile-chess-shell .analysis-actions button,
  #trainerLayout.mobile-chess-shell .panel-close,
  #trainerLayout.mobile-chess-shell .engine-settings-close,
  #trainerLayout.mobile-chess-shell .explore-sheet-close{min-height:var(--mobile-shell-hit)!important}

  /* Play's lower tab surface stays in normal document flow, but a long score
     must have a real bounded touch-scroll region. Older mobile rules expand
     .move-list naturally, so this final shell rule is intentionally more
     specific and makes Game moves the only scrolling surface in Play. */
  html.mobile-chess-shell-active[data-mobile-mode="play"] #trainerLayout.mobile-chess-shell>.play-side-column>#playControlsRow{
    flex:0 0 auto!important;
    margin:0!important;
  }
  html.mobile-chess-shell-active[data-mobile-mode="play"] #trainerLayout.mobile-chess-shell>.play-side-column>#playModeInfo{
    flex:0 0 auto!important;
    height:auto!important;
    min-height:0!important;
    margin:0!important;
  }
  /* The controls and settings live outside this frame on mobile. Only the
     open Start chooser needs its container to occupy space. */
  html.mobile-chess-shell-active[data-mobile-mode="play"] #trainerLayout.mobile-chess-shell>.play-side-column>#playModeInfo:not(.start-open){
    display:none!important;
  }
  html.mobile-chess-shell-active[data-mobile-mode="play"] #trainerLayout.mobile-chess-shell>.play-side-column>#playMovesPanel{
    display:flex!important;
    flex:0 0 auto!important;
    flex-direction:column!important;
    width:100%!important;
    max-width:none!important;
    min-width:0!important;
    min-height:0!important;
    max-height:none!important;
    margin:0!important;
    overflow:hidden!important;
  }
  html.mobile-chess-shell-active[data-mobile-mode="play"] #trainerLayout.mobile-chess-shell>.play-side-column>#playMovesPanel[hidden]{
    display:none!important;
  }
  html.mobile-chess-shell-active[data-mobile-mode="play"] #trainerLayout.mobile-chess-shell>.play-side-column>#playMovesPanel #moveList{
    flex:0 1 auto!important;
    grid-template-rows:none!important;
    grid-auto-rows:max-content!important;
    align-content:start!important;
    align-items:start!important;
    min-width:0!important;
    min-height:0!important;
    max-height:max(12rem,calc(100dvh - var(--mobile-shell-compact-height,var(--mobile-shell-expanded-height,0px)) - 7.2rem))!important;
    overflow-x:hidden!important;
    overflow-y:auto!important;
    overscroll-behavior:contain!important;
    scrollbar-width:none!important;
    -ms-overflow-style:none!important;
    touch-action:pan-y!important;
  }
  html.mobile-chess-shell-active[data-mobile-mode="play"] #trainerLayout.mobile-chess-shell>.play-side-column>#playMovesPanel #moveList::-webkit-scrollbar{display:none;width:0;height:0}

  /* Navigate's source strip is fixed at the top of the lower pane. Only the
     selected Setup/Repertoire/Saved surface below it may scroll. */
  html.mobile-chess-shell-active[data-mobile-mode="position"] #trainerLayout.mobile-chess-shell>.middle-column{
    overflow:hidden!important;
  }
  html.mobile-chess-shell-active[data-mobile-mode="position"] #trainerLayout.mobile-chess-shell>.middle-column>#navigateTabContent{
    display:flex!important;
    flex:1 1 0!important;
    flex-direction:column!important;
    width:100%!important;
    min-width:0!important;
    min-height:0!important;
    max-height:none!important;
    overflow-x:hidden!important;
    overflow-y:auto!important;
    overscroll-behavior:contain!important;
    scrollbar-width:none!important;
    -ms-overflow-style:none!important;
    touch-action:pan-y!important;
  }
  html.mobile-chess-shell-active[data-mobile-mode="position"] #trainerLayout.mobile-chess-shell>.middle-column>#navigateTabContent[hidden]{display:none!important}
  html.mobile-chess-shell-active[data-mobile-mode="position"] #trainerLayout.mobile-chess-shell>.middle-column>#navigateTabContent::-webkit-scrollbar{display:none!important;width:0!important;height:0!important}
  html.mobile-chess-shell-active[data-mobile-mode="position"] #navigateTabContent>#setupPanel,
  html.mobile-chess-shell-active[data-mobile-mode="position"] #navigateTabContent>#lichessPanel{
    flex:1 1 0!important;
    align-self:stretch!important;
    width:100%!important;
    min-width:0!important;
    min-height:0!important;
    max-width:none!important;
    max-height:none!important;
    overflow-x:hidden!important;
    overflow-y:auto!important;
    box-sizing:border-box!important;
  }
  html.mobile-chess-shell-active[data-mobile-mode="position"] #navigateTabContent>#setupPanel[hidden],
  html.mobile-chess-shell-active[data-mobile-mode="position"] #navigateTabContent>#lichessPanel[hidden]{
    display:none!important;
  }


  /* Android's navigation bar can occupy the bottom of an installed PWA even
     when env(safe-area-inset-bottom) reports 0. Reserve clearance only inside
     the active lower scroll surface; never resize/reposition the board or the
     shared top navigation. The fallback covers gesture and three-button bars. */
  :root{
    --mobile-shell-bottom-clearance:max(3rem,env(safe-area-inset-bottom,0px));
  }
  html.mobile-chess-shell-active[data-mobile-mode="play"] #trainerLayout.mobile-chess-shell.workspace-play>.play-side-column,
  html.mobile-chess-shell-active[data-mobile-mode="position"] #trainerLayout.mobile-chess-shell.workspace-analyze>.middle-column>#navigateTabContent,
  html.mobile-chess-shell-active[data-mobile-mode="explain"][data-mobile-analysis-submode="engine"] #trainerLayout.mobile-chess-shell.workspace-analyze>.middle-column,
  html.mobile-chess-shell-active[data-mobile-mode="explain"][data-mobile-analysis-submode="explain"] #trainerLayout.mobile-chess-shell.workspace-analyze>.right-column,
  html.mobile-chess-shell-active[data-mobile-mode="training"] #trainerLayout.mobile-chess-shell.workspace-training>.middle-column{
    box-sizing:border-box!important;
    padding-bottom:var(--mobile-shell-bottom-clearance)!important;
    scroll-padding-bottom:var(--mobile-shell-bottom-clearance);
  }

  /* Explain's engine Settings uses its own small inner scroller on phones.
     Keep the action row reachable without letting Android obscure Save. */
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #trainerLayout.mobile-chess-shell #explainSettingsPopover{
    scroll-padding-bottom:var(--mobile-shell-bottom-clearance);
  }
  html.mobile-chess-shell-active[data-mobile-mode="explain"] #trainerLayout.mobile-chess-shell #explainSettingsPopover .explain-settings-actions{
    position:sticky!important;
    bottom:0!important;
    z-index:1!important;
    background:var(--ai-color-surface-1,#fff)!important;
  }

  /* Global settings overlays do not inherit the lower workspace scroll.
     Constrain their own bottom edge when Android reports a zero inset. */
  html.mobile-chess-shell-active .settings-popover.appearance-popover{
    bottom:var(--mobile-shell-bottom-clearance)!important;
  }
  html.mobile-chess-shell-active .engine-settings-popover:not(.explain-settings-popover){
    max-height:calc(100dvh - 2 * var(--mobile-shell-bottom-clearance))!important;
  }

  /* Analyze: the evidence strip and sortable column headers are controls.
     Only continuation rows should scroll; leave the shared board untouched. */
  /* The Analysis continuation table has no Save/Cancel footer. Do not
     spend a fixed 3rem on Android's navigation bar twice when the browser
     already excludes it from the viewport. Preserve the actual inset and
     a small margin; keep full button clearance for the Explain Settings form. */
  html.mobile-chess-shell-active[data-mobile-mode="explain"][data-mobile-analysis-submode="engine"] #trainerLayout.mobile-chess-shell.workspace-analyze>.middle-column{
    overflow:hidden!important;
    padding-bottom:max(.375rem,env(safe-area-inset-bottom,0px))!important;
  }
  html.mobile-chess-shell-active[data-mobile-mode="explain"][data-mobile-analysis-submode="engine"] #trainerLayout.mobile-chess-shell.workspace-analyze>.middle-column>#analysisEvidenceHeader{flex:0 0 44px!important}
  html.mobile-chess-shell-active[data-mobile-mode="explain"][data-mobile-analysis-submode="engine"] #trainerLayout.mobile-chess-shell.workspace-analyze>.middle-column>#lichessPanel{
    display:flex!important;flex:1 1 0!important;flex-direction:column!important;
    height:0!important;min-height:0!important;overflow:hidden!important;
  }
  html.mobile-chess-shell-active[data-mobile-mode="explain"][data-mobile-analysis-submode="engine"] #trainerLayout.mobile-chess-shell.workspace-analyze #lichessPanel #lichessSharedRoot,
  html.mobile-chess-shell-active[data-mobile-mode="explain"][data-mobile-analysis-submode="engine"] #trainerLayout.mobile-chess-shell.workspace-analyze #lichessPanel .lvgb-app,
  html.mobile-chess-shell-active[data-mobile-mode="explain"][data-mobile-analysis-submode="engine"] #trainerLayout.mobile-chess-shell.workspace-analyze #lichessPanel .lvgb-view[data-lvgb-view="trees"],
  html.mobile-chess-shell-active[data-mobile-mode="explain"][data-mobile-analysis-submode="engine"] #trainerLayout.mobile-chess-shell.workspace-analyze #lichessPanel #lichessExplorerPane,
  html.mobile-chess-shell-active[data-mobile-mode="explain"][data-mobile-analysis-submode="engine"] #trainerLayout.mobile-chess-shell.workspace-analyze #lichessPanel .lvgb-tree-workspace,
  html.mobile-chess-shell-active[data-mobile-mode="explain"][data-mobile-analysis-submode="engine"] #trainerLayout.mobile-chess-shell.workspace-analyze #lichessPanel .lvgb-explorer-moves-panel{
    display:flex!important;flex:1 1 0!important;flex-direction:column!important;
    min-height:0!important;max-height:none!important;overflow:hidden!important;
  }
  html.mobile-chess-shell-active[data-mobile-mode="explain"][data-mobile-analysis-submode="engine"] #trainerLayout.mobile-chess-shell.workspace-analyze #lichessPanel #lichessExplorerPane .lvgb-explorer-table-scroll{
    display:block!important;flex:1 1 0!important;height:0!important;min-height:0!important;
    max-height:none!important;overflow-x:hidden!important;overflow-y:auto!important;
    overscroll-behavior:contain!important;touch-action:pan-y!important;
  }
  html.mobile-chess-shell-active[data-mobile-mode="explain"][data-mobile-analysis-submode="engine"] #trainerLayout.mobile-chess-shell.workspace-analyze #lichessPanel #lichessExplorerPane .lvgb-explorer-table-scroll>.lvgb-mobile-explorer-columns{
    position:sticky!important;top:0!important;z-index:3!important;
    background:var(--mobile-shell-surface,var(--ai-color-surface-1,#fff))!important;
  }

  /* Explain Settings: the right lower pane has the Android safe-area padding.
     Avoid trapping the action buttons in a short nested overflow container. */
  html.mobile-chess-shell-active[data-mobile-mode="explain"][data-mobile-analysis-submode="explain"] #trainerLayout.mobile-chess-shell.workspace-analyze>.right-column{
    overflow-x:hidden!important;overflow-y:auto!important;touch-action:pan-y!important;
  }
  html.mobile-chess-shell-active[data-mobile-mode="explain"][data-mobile-analysis-submode="explain"] #trainerLayout.mobile-chess-shell.workspace-analyze #annotationPanel:has(#positionAnalysisPane.explain-settings-open),
  html.mobile-chess-shell-active[data-mobile-mode="explain"][data-mobile-analysis-submode="explain"] #trainerLayout.mobile-chess-shell.workspace-analyze #positionAnalysisPane.explain-settings-open{
    flex:0 0 auto!important;height:auto!important;min-height:0!important;
    max-height:none!important;overflow:visible!important;
  }
  html.mobile-chess-shell-active[data-mobile-mode="explain"][data-mobile-analysis-submode="explain"] #trainerLayout.mobile-chess-shell.workspace-analyze #positionAnalysisPane.explain-settings-open>#explainSettingsPopover{
    flex:none!important;height:auto!important;min-height:0!important;
    max-height:none!important;overflow:visible!important;overscroll-behavior:auto!important;
  }
  html.mobile-chess-shell-active[data-mobile-mode="explain"][data-mobile-analysis-submode="explain"] #trainerLayout.mobile-chess-shell.workspace-analyze #positionAnalysisPane.explain-settings-open #explainSettingsPopover .explain-settings-actions{
    position:static!important;margin-bottom:0!important;
  }

}


/* Train Repertoires: side/color, name and information share one phone row. */
@media(max-width:1000px){
  html.mobile-chess-shell-active[data-mobile-mode="training"] #createRepertoireEditor .create-repertoire-setup-row{
    display:grid!important;grid-template-columns:minmax(7.7rem,9rem) minmax(0,1fr)!important;
    align-items:center!important;gap:.35rem!important;width:100%!important;min-width:0!important;
  }
  html.mobile-chess-shell-active[data-mobile-mode="training"] #createRepertoireEditor .create-repertoire-setup-row>.create-repertoire-side-field{
    display:grid!important;grid-template-columns:max-content minmax(0,1fr)!important;
    align-items:center!important;gap:.22rem!important;min-width:0!important;
  }
  html.mobile-chess-shell-active[data-mobile-mode="training"] #createRepertoireEditor .create-repertoire-setup-row .create-repertoire-side-field select,
  html.mobile-chess-shell-active[data-mobile-mode="training"] #createRepertoireEditor .create-repertoire-setup-row .create-repertoire-name-field input{
    box-sizing:border-box!important;min-width:0!important;width:100%!important;
  }
  html.mobile-chess-shell-active[data-mobile-mode="training"] #createRepertoireEditor .create-repertoire-setup-row>.create-repertoire-name-row{
    display:grid!important;grid-template-columns:minmax(0,1fr) 1.5rem!important;
    align-items:center!important;gap:.24rem!important;min-width:0!important;
  }

  /* Train Manage uses the existing bounded lower-workspace scroller, not a
     competing nested scroller. The column header sticks inside the table for
     the entire continuation list, then releases for actions below it. */
  html.mobile-chess-shell-active[data-mobile-mode="training"] #trainerLayout.mobile-chess-shell #lichessTrainingMoveEditor .lvgb-manage-tree-table{
    height:auto!important;max-height:none!important;
    overflow:visible!important;overscroll-behavior:auto!important;touch-action:pan-y!important;
  }
  html.mobile-chess-shell-active[data-mobile-mode="training"] #trainerLayout.mobile-chess-shell #lichessTrainingMoveEditor .lvgb-manage-tree-table>.lvgb-mobile-explorer-columns{
    position:sticky!important;top:0!important;z-index:3!important;
    background:var(--lvgb-surface,var(--mobile-shell-surface,#fff))!important;
  }
  /* The history reader fills the phone and only its log text scrolls.
     Close remains in the non-scrolling header even for 2,000+ events. */
  html.mobile-chess-shell-active[data-mobile-mode="training"] .lvgb-preparation-log-dialog[open]{
    position:fixed!important;inset:0!important;box-sizing:border-box!important;
    display:flex!important;flex-direction:column!important;gap:.5rem!important;
    width:100vw!important;max-width:100vw!important;height:100dvh!important;max-height:100dvh!important;
    margin:0!important;
    padding:max(.65rem,env(safe-area-inset-top,0px)) .65rem max(1rem,env(safe-area-inset-bottom,0px))!important;
    overflow:hidden!important;border:0!important;border-radius:0!important;
    background:var(--lvgb-surface,var(--mobile-shell-surface,#fff))!important;
    color:var(--lvgb-text,var(--ai-color-text,#152033))!important;z-index:1000!important;
  }
  html.mobile-chess-shell-active[data-mobile-mode="training"] .lvgb-preparation-log-dialog .lvgb-preparation-log{
    flex:1 1 0!important;box-sizing:border-box!important;
    min-height:0!important;height:0!important;max-height:none!important;margin:0!important;
    overflow-x:hidden!important;overflow-y:auto!important;overscroll-behavior:contain!important;
    touch-action:pan-y!important;overflow-wrap:anywhere!important;
  }
}
.lvgb-preparation-log-dialog:not([open]){display:none!important}
.lvgb-preparation-log-dialog::backdrop{background:rgba(12,20,33,.48)}
.lvgb-preparation-log-heading{display:flex;align-items:center;justify-content:space-between;gap:.5rem;flex:0 0 auto;min-height:44px}
.lvgb-preparation-log-heading strong{font-size:1rem}
.lvgb-preparation-log-heading button{min-width:44px!important;min-height:44px!important;padding:.35rem .75rem!important}
.lvgb-preparation-log-dialog .lvgb-preparation-log{max-height:min(65dvh,30rem);overflow:auto}

/* Keep hidden panels hidden whenever the responsive mobile shell is active. */
html.mobile-chess-shell-active[data-mobile-mode="play"] #trainerLayout.mobile-chess-shell>.play-side-column>#playMovesPanel[hidden]{
  display:none!important;
}

/* Very narrow phones keep text labels short before shrinking the board. */
@media (max-width:359px){
  #trainerLayout.mobile-chess-shell .mobile-primary-tab{font-size:.72rem!important}
  #trainerLayout.mobile-chess-shell .mobile-tab-label{letter-spacing:-.015em}
}
