/* ================================================================ C140: a bigger board on every board screen
   User (Nov 21): "make the board a little bigger, when im using it its small".
   Only this file changes sizes. js/board.js sizes each board as min(its column width, 800px, window height minus the space the page keeps
   free above (page padding / header rows) and below it (--cb-below)), rounded down to a multiple of 8 so the squares stay crisp. So the
   board grows by (1) giving it more column width and (2) taking space away from the page chrome above and below it. Nothing else changes:
   the eval bar, coordinates, side column (Hint / main action / Tools) keep their sizes and stay beside / under the board.
   Remove the one <link> line for this file in index.html to get the old sizes back.
   Screens covered: Today's training, Openings drills / Explore / Learn a line / Game plans, Middlegame puzzles, Endgame lessons / drills /
   reviews (all share .op-boardwrap / .mg-boardwrap / .eg-boardwrap), and the Analysis / game review board. */

/* ---------------------------------------------------------------- desktop and laptop (>= 900px): the board is as tall as the window allows */
@media (min-width: 900px) {
  /* less empty space above the board while a board screen is open (page padding 26 -> 10, screen padding 12 -> 2) */
  :root .app-main:has(.op-boardwrap .cb-board, .mg-boardwrap .cb-board, .eg-boardwrap .cb-board) { padding-top: 10px; }
  :root .op-root.op-bgrid:has(.op-boardwrap .cb-board), :root .mg-root:has(.mg-boardwrap .cb-board), :root .eg-root:has(.eg-boardwrap .cb-board) { padding-top: 2px; }
  /* Endgame: the back button ("Today") sits on the same line as the title (saves one 44px row above the board) */
  :root .eg-root:has(.eg-boardwrap .cb-board) > .eg-back { float: left; margin: 0 12px 0 0; }
  /* less kept free under the board (18 -> 10px; the board's own 6px edge still shows) */
  :root .mg-split .bt-main, :root .eg-split .bt-main, :root .op-bgrid > .op-main > .op-stage > .op-boardwrap { --cb-below: 10px; }
}

/* laptops and wider (>= 1200px): the page column may be 1280px wide while a board is open (it was 1120px below 1500px) */
@media (min-width: 1200px) {
  html.drill-focus .app-main-inner:has(.mg-play), html.drill-focus .app-main-inner:has(.eg-split), html.drill-focus .app-main-inner:has(.op-bgrid) { max-width: 1280px; }
}
/* Openings board screens drop their extra 16px side padding (Middlegame / Endgame have none), so the column is not what stops the board */
@media (min-width: 900px) {
  :root .op-root.op-bgrid:has(.op-boardwrap .cb-board) { padding-left: 0; padding-right: 0; }
  /* the sub-tab chip row (Today / Missed tactics / ...) keeps its size but loses 16px of empty space around it while a board is open */
  :root .app-panel:has(.op-boardwrap .cb-board, .mg-boardwrap .cb-board, .eg-boardwrap .cb-board) .sbt-bar { padding-top: 0; }
  :root .app-panel:has(.op-boardwrap .cb-board, .mg-boardwrap .cb-board, .eg-boardwrap .cb-board) .sbt-scroll { padding-bottom: 4px; }
  /* Endgame: tighter gaps between the title, the move-count chips and the board */
  :root .eg-root:has(.eg-boardwrap .cb-board) > .eg-title { margin-bottom: 4px; }
  :root .eg-root:has(.eg-boardwrap .cb-board) .eg-meta { margin-bottom: 4px; }
}
/* ---------------------------------------------------------------- tablets / small windows (< 900px, one column): the board fills the column */
@media (max-width: 899px) {
  /* Openings boards stopped at 540px (and at window height - 300px): the column is the only limit now */
  :root .op-root .op-boardwrap { max-width: 100%; }
  /* Middlegame / Endgame board screens sat in a 640-680px reading column on tablets: they use the page width now */
  :root .mg-root:has(.mg-boardwrap .cb-board), :root .eg-root:has(.eg-boardwrap .cb-board) { max-width: none; }
}

/* ---------------------------------------------------------------- phones (< 600px): the board uses almost the whole screen width.
   The page keeps its 16px gutter for text and cards; the board (with its eval bar) reaches 6px from the screen edge */
@media (max-width: 599px) {
  :root .mg-boardwrap, :root .eg-boardwrap, :root .op-root .op-boardwrap {
    width: calc(100% + 20px); max-width: none; margin-left: -10px; margin-right: -10px;
  }
  /* Analysis board / game replay: same bleed (its page has a 16px gutter) */
  :root .an-center .an-boardwrap { margin-left: -10px; margin-right: -10px; }
  /* Openings board screens had a second 12px gutter inside the page's 16px one (Middlegame / Endgame already dropped theirs) */
  :root .op-root.op-bgrid:has(.op-boardwrap .cb-board) { padding-left: 0; padding-right: 0; }
}

