/* ==========================================================================
   Five-in-a-row: Canvas 2D wooden board with a fully closed grid.
   gomoku-view.js paints the wood, the 17 x 17 lines (16 x 16 complete
   squares), the star points and the glossy stones. The 225 buttons below are
   transparent hit / keyboard targets only, so the existing click delegation,
   rules, room protocol and aria labels remain untouched.
   Loaded last so it also wins over the legacy light-theme !important rules.
   ========================================================================== */

/* Geometry mirrors gomokuLayout(): the outer two of 17 lines close the grid,
   and the playable 15 x 15 crossings sit on the inner lines. The hit grid is
   inset by half a step plus one full margin square on every side. */
.board.gomoku{
  position:relative;
  display:block;
  aspect-ratio:1;
  height:auto;
  padding:0;
  border:0;
  background:none;
  box-shadow:none;
  border-radius:0;
  overflow:visible;
}
.board.gomoku::after{content:none}
.board.gomoku .gomoku-canvas{
  position:absolute;inset:0;
  display:block;width:100%;height:100%;
  border:0;border-radius:0;pointer-events:none;
}
.board.gomoku .gomoku-hits{
  position:absolute;
  left:10.8125%;top:10.8125%;width:78.375%;height:78.375%;
  display:grid;
  grid-template-columns:repeat(15,1fr);
  grid-template-rows:repeat(15,1fr);
  pointer-events:none;
}
/* Neutralise every legacy CSS gradient / pseudo stone / star point / hover
   square. Everything visible on the board now comes from the canvas. */
.board.gomoku .cell{
  appearance:none;-webkit-appearance:none;
  position:relative;
  margin:0;padding:0;border:0;border-radius:0;
  min-width:0;min-height:0;aspect-ratio:auto;
  background:transparent!important;
  box-shadow:none!important;
  opacity:1!important;
  transform:none!important;
  pointer-events:auto;
}
.board.gomoku button.cell:disabled{opacity:1!important;pointer-events:none;cursor:default}
.board.gomoku .cell::before,
.board.gomoku .cell::after{
  content:none!important;display:none!important;
  background:none!important;box-shadow:none!important;
}
.board.gomoku .cell:focus-visible{outline:2px solid #ffd27a;outline-offset:-2px}

/* The turn card is still forced light by table.css (!important). Keep it on
   the same dark surface as the rest of the in-game sidebar. Four-in-a-row has
   its own themed card, so leave that game alone. */
body:not(.connect-four-game) .table-chat-layout .play-sidebar .turn-panel{
  background:linear-gradient(160deg,#1d2c4b,#141e35)!important;
  border-color:#35486e!important;
  color:#e6edf8;
  box-shadow:none!important;
}
body:not(.connect-four-game) .table-chat-layout .play-sidebar .turn-panel h2,
body:not(.connect-four-game) .table-chat-layout .play-sidebar .turn-panel #status{
  color:#eef3ff!important;
}
body:not(.connect-four-game) .table-chat-layout .play-sidebar .turn-panel .eyebrow,
body:not(.connect-four-game) .table-chat-layout .play-sidebar .turn-panel #turn-instruction,
body:not(.connect-four-game) .table-chat-layout .play-sidebar .turn-panel p,
body:not(.connect-four-game) .table-chat-layout .play-sidebar .turn-panel span{
  color:#a9badd!important;
}
body:not(.connect-four-game) .table-chat-layout .play-sidebar>section{border-radius:11px}

/* The status toast is another light-theme leftover (cream paper on a dark
   play surface). Keep it in the same navy family as the sidebar cards. */
body:not(.connect-four-game) #message:not(:empty){
  background:linear-gradient(160deg,#22324f,#16213a);
  border-color:#3a4d73;color:#d6e3f8;
  box-shadow:0 10px 26px #0008;
}
@media(max-width:760px){
  body:not(.connect-four-game) #message:not(:empty){
    bottom:12px;padding:8px 13px;font-size:11px;
    max-width:min(300px,84vw);white-space:normal;text-align:center;
  }
}

/* A soft pool of light behind the wooden board so it reads as a raised object. */
.table-home-theme[data-screen="play"]:not(.pool-game) .game-panel:has(>.board.gomoku){
  background:radial-gradient(ellipse at 50% 42%,#1c2a47 0%,#0d1528 76%);
}
