/* TJK-Chess v15.1.243 — responsive/layout/performance audit layer. */

/* Header: primary navigation may shrink, but must never paint under the actions. */
@media (min-width:981px){
  .site-header,.opp-site-header{
    grid-template-columns:max-content minmax(0,1fr) max-content!important;
    column-gap:clamp(8px,1.15vw,22px)!important;
    padding-inline:clamp(14px,2.7vw,52px)!important;
  }
  .site-header .site-nav,.opp-site-header .site-nav{
    width:100%!important;max-width:none!important;min-width:0!important;
    justify-self:stretch!important;justify-content:space-between!important;
    gap:0!important;overflow:visible!important;
  }
  .site-header .site-nav>*,.opp-site-header .site-nav>*{min-width:0!important}
  .site-header .site-nav>button,.site-header .site-nav>.site-nav-link,.site-header .site-nav>.site-nav-top-link,
  .site-header .site-nav>.site-nav-item>button,.site-header .site-nav>.site-nav-item>.site-nav-top-link,
  .opp-site-header .site-nav>button,.opp-site-header .site-nav>.site-nav-link,.opp-site-header .site-nav>.site-nav-top-link,
  .opp-site-header .site-nav>.site-nav-item>button,.opp-site-header .site-nav>.site-nav-item>.site-nav-top-link{
    padding-inline:clamp(5px,.62vw,13px)!important;
    font-size:clamp(.73rem,.74vw,.90rem)!important;
  }
  .site-header .site-actions,.opp-site-header .site-actions{gap:clamp(6px,.72vw,13px)!important}
  .site-header .site-language,.opp-site-header .site-language{width:clamp(116px,8.4vw,168px)!important;min-width:0!important}
}
@media (min-width:981px) and (max-width:1320px){
  .site-header .site-brand,.opp-site-header .site-brand{font-size:1.05rem!important}
  .site-header .site-brand-mark,.opp-site-header .site-brand-mark{width:30px!important;height:30px!important}
  .site-header .site-nav>button,.site-header .site-nav>.site-nav-link,.site-header .site-nav>.site-nav-top-link,
  .site-header .site-nav>.site-nav-item>button,.site-header .site-nav>.site-nav-item>.site-nav-top-link,
  .opp-site-header .site-nav>button,.opp-site-header .site-nav>.site-nav-link,.opp-site-header .site-nav>.site-nav-top-link,
  .opp-site-header .site-nav>.site-nav-item>button,.opp-site-header .site-nav>.site-nav-item>.site-nav-top-link{
    padding-inline:4px!important;font-size:.71rem!important
  }
  .site-header .site-actions,.opp-site-header .site-actions{gap:5px!important}
  .site-header .site-language,.opp-site-header .site-language{width:112px!important}
}

/* Video editor: the right tool column must not stretch the preview row and create a large empty band. */
.course-video-editor-workspace-v163{align-items:start!important;min-height:0!important}
.course-video-editor-workspace-v163>.course-editor-live-preview{align-self:start!important}
.course-video-editor-workspace-v163>.course-video-editor-tools{align-self:start!important;height:auto!important;min-height:0!important}
.course-video-editor-panel>.course-editor-timeline{padding-top:10px!important}
.course-editor-live-preview.has-board-video{margin:0!important}

/* Database: denser information without sacrificing click/touch targets. */
.analysis-db-row{min-height:38px!important;padding:5px 7px!important;gap:6px!important}
.analysis-db-game-row{min-height:44px!important;padding:5px 7px!important;row-gap:1px!important}
.analysis-db-topgames-scroll{gap:1px!important}
.analysis-db-topgames{margin-top:8px!important;padding-top:7px!important}

/* Tactics: remove oversized vertical padding and dead space from secondary controls. */
.puzzle-actions{gap:6px!important}
.puzzle-actions button{min-height:36px!important;padding:7px 11px!important}
.puzzle-engine-buttons{gap:5px!important;margin-top:6px!important}
.puzzle-engine button{min-height:30px!important;padding:4px 8px!important}

/* Boards on phones: use the full available width and never round chessboard corners. */
@media (max-width:760px){
  .analysis-board-stage,.study-board-wrap,.puzzle-board-wrap,.position-play-board-wrap,
  .broadcast-board-wrap,.training-position-board,.plan-position-preview,
  .game-review-board-wrap,.game-review-board.analysis-chessboard{
    border-radius:0!important;box-shadow:none!important
  }
  .analysis-board-stage,.study-board-shell,.puzzle-board-wrap,.position-play-board-wrap,
  .broadcast-board-analysis,.training-position-board,.plan-position-preview{
    max-width:none!important;width:100%!important
  }
  .analysis-board-column,.study-board-column,.puzzle-board-column{min-width:0!important;width:100%!important}
  .analysis-layout,.study-content,.puzzle-layout{column-gap:0!important}
  .puzzle-actions button{min-height:34px!important;padding:6px 9px!important}
  .analysis-db-game-row{min-height:42px!important}
}

/* Current dark-mode gaps found in the late-added editor/player/database UI. */
html[data-theme="dark"] .course-video-editor-head,
html[data-theme="dark"] .course-video-editor-tools,
html[data-theme="dark"] .course-editor-timeline,
html[data-theme="dark"] .course-cut-list,
html[data-theme="dark"] .course-video-library-bar,
html[data-theme="dark"] .game-review-loading-card{
  background:#121a26!important;color:#eef4fb!important;border-color:#344257!important
}
html[data-theme="dark"] .course-video-editor-tools button,
html[data-theme="dark"] .course-video-library-bar button,
html[data-theme="dark"] .course-video-library-bar select{
  background:#192534!important;color:#eef4fb!important;border-color:#435268!important
}
html[data-theme="dark"] .game-review-loading-card{box-shadow:0 18px 45px rgba(0,0,0,.32)!important}
html[data-theme="dark"] .game-review-loading-copy h3,
html[data-theme="dark"] .game-review-loading-percent{color:#dceaff!important}
html[data-theme="dark"] .game-review-loading-status{color:#c8d6e8!important}
html[data-theme="dark"] .game-review-loading-detail,
html[data-theme="dark"] .game-review-loading-note{color:#aeb9ca!important}

/* Avoid visible layout movement while the large local database is booting. */
.analysis-database-card .analysis-db-moves{contain:layout paint;min-height:140px}
