/* =============================================================================
   Live Chess — styles.css  (v20260307g rebuild)
   Loaded after game-shell.css, before fullscreen.css
   game-shell.css owns: .wrap, .shell, .hero, .hero-copy, .eyebrow, .hero h1,
     .hero-summary, .card, .panel-heading, .panel-copy, .status-grid
============================================================================= */

/* ── Hero extras ──────────────────────────────────────────────────────────── */

.hero-copy-wrap {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
}

.hero-back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.9rem;
  color: var(--muted);
  text-decoration: none;
  width: fit-content;
  transition: color 0.15s;
}
.hero-back-link:hover { color: var(--ink); }

.hero-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.6rem;
}

.hero-chip {
  display: inline-flex;
  align-items: center;
  min-height: 1.9rem;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: rgba(255,255,255,0.03);
  font-family: var(--mono);
  font-size: 0.73rem;
  color: var(--muted);
}

/* ── Hero status card ─────────────────────────────────────────────────────── */

.hero-status-card {
  padding: 0.65rem;
}

/* override game-shell .status-grid columns for hero 3-up layout */
.hero-status-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
  padding: 0;
}
.hero-status-grid-wide {
  grid-template-columns: repeat(3, 1fr);
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
  padding: 0.5rem 0.65rem;
  border-radius: 0.6rem;
  background: var(--panel-soft);
  border: 1px solid var(--line);
}
.stat-label {
  font-size: 0.62rem;
  font-family: var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.stat-value {
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Page layout ──────────────────────────────────────────────────────────── */

.live-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: 1.2rem;
  align-items: start;
}

@media (max-width: 1060px) {
  .live-layout { grid-template-columns: 1fr; }
}

/* ── Board card ───────────────────────────────────────────────────────────── */

.board-card {
  padding: 1rem 1.1rem 1.1rem;
}

.board-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
  margin-bottom: 0.9rem;
  flex-wrap: wrap;
}
.toolbar-left {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  min-width: 0;
}
.toolbar-actions {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.last-move-time {
  font-size: 0.7rem;
  font-family: var(--mono);
  color: var(--muted);
}

/* ── Turn badge ───────────────────────────────────────────────────────────── */

.turn-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.26rem 0.6rem;
  border-radius: 999px;
  font-size: 0.71rem;
  font-family: var(--mono);
  font-weight: 600;
  letter-spacing: 0.04em;
  border: 1px solid transparent;
}
.turn-badge-waiting {
  background: var(--panel-soft);
  color: var(--muted);
  border-color: var(--line);
}
.turn-badge-white {
  background: rgba(238,242,247,0.10);
  color: var(--ink);
  border-color: rgba(238,242,247,0.28);
}
.turn-badge-black {
  background: rgba(0,0,0,0.35);
  color: var(--muted);
  border-color: var(--line-strong);
}
.turn-badge-check {
  background: rgba(243,181,176,0.16);
  color: var(--danger);
  border-color: rgba(243,181,176,0.38);
}
.turn-badge-end {
  background: rgba(176,232,196,0.10);
  color: var(--success);
  border-color: rgba(176,232,196,0.28);
}

/* ── Tool buttons ─────────────────────────────────────────────────────────── */

.tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.35rem 0.72rem;
  border-radius: 0.5rem;
  border: 1px solid var(--line-strong);
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 0.76rem;
  font-family: var(--mono);
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.14s, color 0.14s, background 0.14s;
}
.tool-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.tool-btn.ghost { background: transparent; }
.tool-btn.critical {
  border-color: rgba(243,181,176,0.38);
  color: var(--danger);
}
.tool-btn.critical:hover { background: rgba(243,181,176,0.08); }

/* ── Board wrap + overlay ─────────────────────────────────────────────────── */

.board-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  background: rgba(0,0,0,0.25);
  border-radius: 0.7rem;
  padding: 0.85rem;
}

.board-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  background: rgba(12,13,16,0.78);
  border-radius: 0.7rem;
  z-index: 10;
  font-size: 0.82rem;
  font-family: var(--mono);
  color: var(--muted);
}
.overlay-spinner {
  width: 1.5rem;
  height: 1.5rem;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: lc-spin 0.75s linear infinite;
}
@keyframes lc-spin { to { transform: rotate(360deg); } }

/* ── Chess board ──────────────────────────────────────────────────────────── */

.chess-board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  width: min(100%, 540px);
  aspect-ratio: 1;
  border-radius: 0.3rem;
  overflow: hidden;
  box-shadow: 0 6px 28px rgba(0,0,0,0.55);
  user-select: none;
}

.chess-square {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
}
.chess-square.light { background: #c8b89a; }
.chess-square.dark  { background: #6d4c41; }

/* highlights */
.chess-square.sq-selected              { background: #f6f669 !important; }
.chess-square.sq-last-from,
.chess-square.sq-last-to               { background: #cdd66a !important; }
.chess-square.sq-check                 {
  background: radial-gradient(circle at center, #e84040 0%, transparent 72%) !important;
}

/* legal-move dot */
.chess-square.sq-legal { cursor: pointer; }
.chess-square.sq-legal::after {
  content: '';
  position: absolute;
  width: 30%;
  height: 30%;
  background: rgba(0,0,0,0.20);
  border-radius: 50%;
  pointer-events: none;
}
/* capture ring replaces dot */
.chess-square.sq-legal.sq-has-piece::after {
  width: 88%;
  height: 88%;
  background: transparent;
  border: 3px solid rgba(0,0,0,0.22);
  border-radius: 50%;
}

.chess-square[data-clickable="true"] { cursor: pointer; }

/* piece glyph */
.chess-piece {
  font-size: clamp(1.55rem, 4.8vw, 2.6rem);
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 86%;
  height: 86%;
  pointer-events: none;
  transition: transform 0.07s;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.45));
}
.chess-square[data-clickable="true"] .chess-piece { transform: scale(1.04); }
.chess-square.sq-selected .chess-piece             { transform: scale(1.10); }

.piece-white {
  color: #f0e8d0;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.7));
}
.piece-black {
  color: #1a1008;
  filter: drop-shadow(0 1px 2px rgba(255,255,255,0.25)) drop-shadow(0 0 3px rgba(0,0,0,0.9));
}

/* coordinate labels */
.sq-coord {
  position: absolute;
  font-size: 0.52rem;
  font-family: var(--mono);
  font-weight: 700;
  line-height: 1;
  pointer-events: none;
  opacity: 0.68;
}
.sq-coord-file { bottom: 2px; right: 3px; }
.sq-coord-rank { top: 2px;    left: 3px;  }

/* coord color — contrast against square color */
.chess-square.light .sq-coord { color: #6d4c41; }
.chess-square.dark  .sq-coord { color: #c8b89a; }
.chess-square.sq-selected .sq-coord,
.chess-square.sq-last-from .sq-coord,
.chess-square.sq-last-to   .sq-coord { color: rgba(0,0,0,0.45); }

/* ── Board footer ─────────────────────────────────────────────────────────── */

.board-footer {
  margin-top: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

/* extend game-shell .panel-copy for board notes */
.board-note {
  padding: 0.45rem 0.7rem;
  border-radius: 0.5rem;
  font-size: 0.78rem;
  font-family: var(--mono);
  background: var(--panel-soft);
  border: 1px solid var(--line);
}
.board-note-muted { opacity: 0.55; }

/* ── Promotion tray ───────────────────────────────────────────────────────── */

.promotion-tray {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  padding: 0.55rem 0.7rem;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 0.6rem;
}
.promotion-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.7rem;
  height: 2.7rem;
  border-radius: 0.45rem;
  border: 1px solid var(--line-strong);
  background: var(--panel-soft);
  cursor: pointer;
  font-size: 1.55rem;
  line-height: 1;
  color: var(--ink);
  transition: background 0.12s, border-color 0.12s;
}
.promotion-btn:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
}

/* ── Side stack ───────────────────────────────────────────────────────────── */

.side-stack {
  display: grid;
  gap: 0.9rem;
  align-content: start;
}

.detail-card { padding: 1rem 1.1rem; }

/* override game-shell .panel-heading for sidebar card headings */
.detail-card .panel-heading {
  font-size: 0.68rem;
  font-family: var(--mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.detail-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.32rem 0.9rem;
  margin: 0;
  font-size: 0.82rem;
}
.detail-grid dt {
  color: var(--muted);
  font-size: 0.74rem;
  font-family: var(--mono);
  align-self: center;
  white-space: nowrap;
}
.detail-grid dd {
  margin: 0;
  color: var(--ink);
  align-self: center;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Move history ─────────────────────────────────────────────────────────── */

.history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  max-height: 17rem;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
.history-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.28rem 0.42rem;
  border-radius: 0.38rem;
  font-size: 0.78rem;
  font-family: var(--mono);
}
.history-item.history-white { background: rgba(238,242,247,0.05); }
.history-item.history-black { background: rgba(0,0,0,0.18); }
.history-item-num {
  color: var(--muted);
  font-size: 0.68rem;
  min-width: 1.5rem;
}
.history-item-label { color: var(--ink); }

/* ── Rules list ───────────────────────────────────────────────────────────── */

.instruction-list {
  margin: 0;
  padding: 0 0 0 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  font-size: 0.81rem;
  color: var(--muted);
  line-height: 1.55;
}
.compact-list { gap: 0.3rem; }

/* ── Responsive ───────────────────────────────────────────────────────────── */

@media (max-width: 720px) {
  .hero {
    grid-template-columns: 1fr;
  }
  .hero-status-card {
    order: -1;
  }
  .hero-status-grid-wide {
    grid-template-columns: repeat(3, 1fr);
  }
  .board-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }
  .toolbar-actions {
    width: 100%;
  }
  .tool-btn {
    flex: 1 1 7rem;
    justify-content: center;
  }
}
