/* ───────────────── Board screen — players, board, clock, moves ─────────────── */

.screen-game {
  padding: 6px 0 0;
}

/* Player strips — wrapped in a frame that reads as a "billing line" of a fight card */
.player-strip {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 14px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--rule);
  padding: 12px 16px;
  margin: 0 2px 10px;
  position: relative;
  transition: border-color .35s, background .35s;
}
.player-strip.turn {
  border-color: var(--accent);
  background: var(--bg-tint);
}
.player-strip.turn::before {
  content: ""; position: absolute; left: -1px; top: -1px; bottom: -1px;
  width: 3px; background: var(--accent);
  animation: flicker 1.6s ease-in-out infinite;
}
.player-strip.lost-time { opacity: .5; filter: grayscale(.4); }

.player-avatar {
  width: 44px; height: 44px;
  background: radial-gradient(circle at 30% 25%, var(--accent), var(--accent-deep));
  color: var(--surface);
  font-family: "Fraunces", serif;
  font-weight: 600; font-size: 15px;
  display: grid; place-items: center;
  border-radius: 50%;
  overflow: hidden;
  position: relative;
  box-shadow: 0 0 0 1px var(--accent);
}
.player-avatar.bot {
  background: var(--surface-3);
  color: var(--ink-soft);
  font-family: "Fraunces", serif;
  font-style: italic;
  font-variation-settings: "opsz" 60;
  font-size: 20px;
  box-shadow: 0 0 0 1px var(--rule-strong);
}
.player-info { min-width: 0; }
.player-name {
  font-family: "Fraunces", serif;
  font-variation-settings: "opsz" 36;
  font-weight: 500; font-size: 16.5px;
  letter-spacing: -0.015em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.player-sub {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  color: var(--ink-dim);
  margin-top: 2px;
  letter-spacing: 0;
}

.clock {
  font-family: "JetBrains Mono", monospace;
  font-weight: 700; font-size: 22px;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
  background: var(--bg);
  border: 1px solid var(--rule-strong);
  padding: 8px 14px;
  min-width: 88px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  transition: background .25s, color .25s, border-color .25s;
}
.player-strip.turn .clock {
  background: var(--accent);
  color: #1a0e07;
  border-color: var(--accent);
}
.clock.low { color: var(--lose); }
.player-strip.turn .clock.low { background: var(--lose); color: var(--bg); border-color: var(--lose); }

/* ═══ Board wrap with decorative frame ═══ */
.board-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  margin: 14px 0 18px;
  padding: 10px;
  background: var(--board-frame);
  border: 1px solid var(--rule-strong);
}
.board-wrap::before, .board-wrap::after {
  content: ""; position: absolute;
  width: 18px; height: 18px;
  border: 1px solid var(--accent);
  pointer-events: none;
}
.board-wrap::before { top: 4px; left: 4px;  border-right: 0; border-bottom: 0; }
.board-wrap::after  { bottom: 4px; right: 4px; border-left: 0;  border-top: 0; }

.board {
  position: absolute; inset: 10px;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  border: 1px solid rgba(0,0,0,.4);
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.04), 0 6px 30px rgba(0,0,0,.4);
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}
.square {
  position: relative;
  width: 100%; height: 100%;
}
.square.light { background: var(--board-light); }
.square.dark  { background: var(--board-dark); }

.square.last       { box-shadow: inset 0 0 0 100vmax var(--board-last); }
.square.selected   { box-shadow: inset 0 0 0 100vmax var(--board-highlight); }
.square.check::after {
  content: ''; position: absolute; inset: 3px;
  background: radial-gradient(circle, var(--board-check), transparent 70%);
  pointer-events: none;
  border-radius: 50%;
}

.square .dot {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  pointer-events: none;
}
.square .dot::before {
  content: ''; width: 28%; height: 28%; border-radius: 50%;
  background: var(--board-legal);
}
.square.capture .dot::before {
  width: 84%; height: 84%; background: transparent;
  border: 4px solid var(--board-legal);
  border-radius: 50%;
}

.square .coord {
  position: absolute;
  font-family: "Fraunces", serif;
  font-style: italic;
  font-size: 9.5px; font-weight: 500;
  pointer-events: none;
  letter-spacing: 0;
}
.square.light .coord { color: rgba(0,0,0,.42); }
.square.dark  .coord { color: rgba(255,235,200,.55); }
.square .coord.rank { top: 2px; left: 4px; }
.square .coord.file { bottom: 1px; right: 4px; }

.piece {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  pointer-events: none;
  transition: transform .18s cubic-bezier(.3,.7,.4,1);
}
.piece svg {
  width: 86%; height: 86%;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.35));
}
.piece.dragging {
  z-index: 100;
  transition: none;
  pointer-events: none;
}
.piece.dragging svg {
  width: 100%; height: 100%;
  filter: drop-shadow(0 12px 20px rgba(0,0,0,.6));
  transform: scale(1.16);
}

.board.flipped { transform: rotate(180deg); }
.board.flipped .piece svg,
.board.flipped .coord { transform: rotate(180deg); }

.coords { display: none; }

/* Captured */
.captured {
  position: absolute;
  left: 12px; right: 12px;
  display: flex; gap: 2px;
  font-size: 0;
  pointer-events: none;
  height: 22px;
  align-items: center;
}
.captured.captured-top    { top: -28px; }
.captured.captured-bottom { bottom: -28px; }
.captured .cap-piece {
  width: 18px; height: 18px;
  margin-right: -6px;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.4));
  opacity: .85;
}
.captured .cap-piece svg { width: 100%; height: 100%; }
.captured .cap-balance {
  margin-left: 10px;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  color: var(--ink-soft);
  font-weight: 600;
  align-self: center;
  letter-spacing: 0;
}

/* Game over overlay */
.board-overlay {
  position: absolute; inset: 0; z-index: 50;
  background: rgba(8, 6, 4, .80);
  display: grid; place-items: center;
  backdrop-filter: blur(8px);
  animation: fadeIn .35s ease both;
  padding: 22px; text-align: center;
}
.board-overlay-card {
  position: relative;
  background: var(--surface);
  padding: 28px 30px 24px;
  border: 1px solid var(--accent);
  max-width: 300px;
  animation: pageIn .4s ease both;
}
.board-overlay-card::before, .board-overlay-card::after {
  content: ""; position: absolute;
  width: 18px; height: 18px;
  border: 1px solid var(--accent);
  pointer-events: none;
}
.board-overlay-card::before { top: 6px; left: 6px;     border-right: 0; border-bottom: 0; }
.board-overlay-card::after  { bottom: 6px; right: 6px; border-left: 0;  border-top: 0; }
.board-overlay-emoji {
  font-family: "Fraunces", serif;
  font-style: italic;
  font-variation-settings: "opsz" 144;
  font-weight: 700;
  font-size: 60px;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 8px;
}
.board-overlay-title {
  font-family: "Fraunces", serif;
  font-variation-settings: "opsz" 144, "SOFT" 0;
  font-weight: 700; font-size: 30px;
  letter-spacing: -0.04em;
  line-height: 1;
  margin: 8px 0 6px;
}
.board-overlay-sub {
  color: var(--ink-dim);
  font-style: italic;
  font-size: 13.5px;
  margin-bottom: 6px;
}
.board-overlay-delta {
  font-family: "JetBrains Mono", monospace;
  font-size: 14px;
  font-weight: 700;
  margin: 12px 0;
  letter-spacing: 0.02em;
}
.board-overlay-delta.up   { color: var(--win); }
.board-overlay-delta.down { color: var(--lose); }
.board-overlay-actions { display: grid; gap: 8px; margin-top: 16px; }

/* Moves panel */
.moves-panel { margin: 28px 0 12px; }
.moves-toolbar {
  display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap;
}
.moves-list {
  border-top: 1px solid var(--rule-strong);
  border-bottom: 1px solid var(--rule-strong);
  padding: 10px 4px;
  max-height: 180px;
  overflow-y: auto;
  font-family: "JetBrains Mono", monospace;
  font-size: 12.5px;
  display: grid; grid-template-columns: 36px 1fr 1fr;
  gap: 4px 12px;
  align-content: start;
  background: var(--surface);
}
.moves-list .move-num {
  color: var(--ink-faint);
  font-style: italic;
  font-family: "Fraunces", serif;
  font-size: 13px;
  text-align: right;
  padding-right: 4px;
}
.moves-list .move { padding: 2px 6px; }
.moves-list .move.last {
  color: var(--accent);
  font-weight: 700;
}

/* Draw banner */
.draw-banner {
  border: 1px solid var(--accent);
  background: var(--accent-soft);
  color: var(--ink);
  padding: 14px 16px;
  font-size: 14px;
  margin: 10px 2px;
  display: flex; align-items: center; gap: 12px;
  position: relative;
}
.draw-banner::before {
  content: "❖"; color: var(--accent); font-size: 14px;
}
.draw-banner-text { flex: 1; font-style: italic; }
.draw-banner-actions { display: flex; gap: 6px; }

/* Promotion modal */
.promo {
  background: var(--surface);
  border: 1px solid var(--accent);
  padding: 20px 18px 16px;
  max-width: 300px;
  position: relative;
}
.promo::before, .promo::after {
  content: ""; position: absolute;
  width: 12px; height: 12px;
  border: 1px solid var(--accent);
  pointer-events: none;
}
.promo::before { top: 4px; left: 4px; border-right: 0; border-bottom: 0; }
.promo::after  { bottom: 4px; right: 4px; border-left: 0; border-top: 0; }
.promo-title {
  text-align: center;
  font-family: "Fraunces", serif;
  font-weight: 600;
  font-size: 18px;
  margin-bottom: 14px;
  letter-spacing: -0.02em;
}
.promo-title::after {
  content: ""; display: block;
  width: 28px; height: 1px;
  background: var(--accent);
  margin: 8px auto 0;
}
.promo-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.promo-row button {
  background: var(--bg-tint);
  border: 1px solid var(--rule);
  padding: 12px 4px;
  display: grid; place-items: center;
  transition: transform .15s, background .15s, border-color .15s;
}
.promo-row button:hover {
  background: var(--bg);
  border-color: var(--accent);
}
.promo-row button:active { transform: scale(.92); }
.promo-row button svg { width: 38px; height: 38px; }
