.hidden{ display:none !important; }

.chess-wrap{ max-width:1100px; }

.chess-mode-note{
  text-align:center;
  margin:-8px 0 20px;
  color:var(--text-dim);
  font-size:13px;
}

.chess-subhead{ display:block; margin-top:12px; }

/* Fullscreen: let the board claim as much of the screen as it can while
   staying square (matches arcade.css's body.fs-active treatment, which
   already hides the header/sidebar and un-caps .game-wrap for us). */
body.fs-active .chess-view-box{ width:min(92vmin, 92vw); }

/* Shared sizing for both the 2D board and the 3D canvas, so toggling
   between them doesn't jump the layout. Desktop gets a much bigger board;
   arcade.css's generic mobile cap (.board-frame max-width:300px/260px) is
   overridden below so these larger sizes actually take effect on small
   screens too. */
.chess-view-box{
  position:relative;
  width:min(80vw, 640px);
  aspect-ratio:1 / 1;
  margin:0 auto;
}

.chess-board-wrap{
  container-type:inline-size;
}

#chess3dContainer{
  border-radius:10px;
  overflow:hidden;
  background:#05060d;
}
#chess3dContainer canvas{ display:block; width:100%; height:100%; }

.chess-board{
  position:absolute;
  inset:0;
  z-index:1;
  display:grid;
  grid-template-columns:repeat(8, 1fr);
  grid-template-rows:repeat(8, 1fr);
  border-radius:10px;
  overflow:hidden;
  box-shadow:0 18px 50px rgba(0,0,0,.4);
}

.chess-sq{
  position:relative;
  user-select:none;
  -webkit-tap-highlight-color:transparent;
}
.chess-sq.light{ background:#30375c; }
.chess-sq.dark{ background:#171b30; }
.chess-board.interactive .chess-sq{ cursor:pointer; }
.chess-board.interactive .chess-sq:hover{ box-shadow:inset 0 0 0 2px rgba(255,255,255,.22); }

.chess-sq.selected{ box-shadow:inset 0 0 0 3px var(--accent); }
.chess-sq.last-move{ background-color:rgba(126,249,255,.2); }
.chess-sq.in-check{ background-color:rgba(255,93,122,.5); }

/* Pieces + move indicators live in their own absolutely-positioned layer so
   a piece element can be moved (not rebuilt) between squares - that's what
   lets the left/top transition below actually animate a slide instead of
   the piece teleporting on every redraw. */
.chess-pieces{
  position:absolute;
  inset:0;
  z-index:2;
  pointer-events:none;
}

.chess-piece{
  position:absolute;
  width:12.5%;
  height:12.5%;
  display:flex;
  align-items:center;
  justify-content:center;
  line-height:1;
  font-size:clamp(24px, 9.2cqw, 58px);
  filter:drop-shadow(0 2px 2px rgba(0,0,0,.6));
  transition:left .3s cubic-bezier(.3,.7,.2,1), top .3s cubic-bezier(.3,.7,.2,1), opacity .25s ease, transform .25s ease;
  will-change:left, top;
}
.chess-piece.piece-w{ color:#f6f8ff; }
.chess-piece.piece-b{ color:#0a0c16; }
.chess-piece.captured{ opacity:0; transform:scale(.3); }

.board-indicator{
  position:absolute;
  width:12.5%;
  height:12.5%;
  display:flex;
  align-items:center;
  justify-content:center;
  pointer-events:none;
}
.board-indicator.move-dot::before{
  content:"";
  width:28%;
  height:28%;
  border-radius:50%;
  background:rgba(126,249,255,.65);
}
.board-indicator.capture-ring::before{
  content:"";
  width:78%;
  height:78%;
  border-radius:50%;
  border:4px solid rgba(255,93,122,.75);
  box-sizing:border-box;
}

.promo-picker{
  position:absolute;
  inset:10px;
  background:rgba(5,6,13,.92);
  border-radius:10px;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:14px;
  z-index:6;
}
.promo-btn{
  width:64px; height:64px;
  border-radius:10px;
  border:1px solid var(--panel-border);
  background:rgba(255,255,255,.05);
  color:var(--text);
  font-size:36px;
  cursor:pointer;
  transition:border-color .15s;
}
.promo-btn:hover{ border-color:var(--accent); }

.chess-history-panel{ max-height:220px; overflow-y:auto; }
.chess-history{
  margin:0; padding:0 0 0 18px;
  font-size:13px;
  color:var(--text-dim);
  display:flex;
  flex-direction:column;
  gap:3px;
}

@media (max-width:900px){
  .chess-view-box{ width:min(86vw, 480px); }
}
@media (max-width:720px){
  .chess-wrap .board-frame{ width:100%; max-width:460px; }
  .chess-view-box{ width:min(90vw, 420px); }
}
@media (max-width:480px){
  .chess-wrap .board-frame{ max-width:360px; }
  .chess-view-box{ width:min(92vw, 340px); }
  .promo-btn{ width:52px; height:52px; font-size:28px; }
}
