/* ==========================================================================
   Grandmaster Chess – Premium Dark Theme
   True black background, glassmorphism cards, emerald board, off-white accents
   ========================================================================== */

:root {
  /* ── Color Palette ── */
  --bg-main: #050505;
  --bg-surface: rgba(14, 14, 14, 0.9);
  --bg-card: rgba(18, 18, 18, 0.82);
  --bg-card-solid: #141414;
  --bg-elevated: rgba(28, 28, 28, 0.65);
  --bg-pill-inactive: rgba(255, 255, 255, 0.05);

  --border-card: rgba(255, 255, 255, 0.07);
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-hover: rgba(255, 255, 255, 0.14);
  --border-glow: rgba(232, 228, 223, 0.2);

  --text-primary: #f0f0f0;
  --text-secondary: #b8b8b8;
  --text-muted: #787878;

  --accent: #e8e4df;
  --accent-soft: rgba(232, 228, 223, 0.1);
  --accent-glow: rgba(232, 228, 223, 0.2);

  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f97316;

  /* ── Board ── */
  --board-light: #ebecd0;
  --board-dark: #739552;
  --square-selected: rgba(232, 228, 223, 0.45);
  --square-legal-dot: rgba(34, 197, 94, 0.7);
  --square-capture-ring: rgba(239, 68, 68, 0.75);
  --square-hint: rgba(249, 115, 22, 0.45);
  --square-check: rgba(239, 68, 68, 0.5);

  /* ── Typography ── */
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* ── Geometry ── */
  --radius-xl: 18px;
  --radius-lg: 14px;
  --radius-md: 10px;
  --radius-sm: 6px;
  --radius-pill: 9999px;

  /* ── Shadows ── */
  --shadow-card:
    0 8px 32px rgba(0, 0, 0, 0.45),
    0 2px 8px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.03);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.35);
  --shadow-glow: 0 0 20px rgba(255, 255, 255, 0.04);
}

/* ────────────────────── Reset ────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ────────────────────── Body ────────────────────── */
body {
  font-family: var(--font-main);
  background-color: var(--bg-main);
  background-image:
    radial-gradient(ellipse at 15% 5%, rgba(255, 255, 255, 0.02) 0%, transparent 55%),
    radial-gradient(ellipse at 85% 10%, rgba(255, 255, 255, 0.015) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 95%, rgba(255, 255, 255, 0.01) 0%, transparent 55%);
  background-attachment: fixed;
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 16px;
  overflow-x: hidden;
}

/* ────────────────────── App Container ────────────────────── */
.app-container {
  width: 100%;
  max-width: 1100px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ────────────────────── Glass Card Base ────────────────────── */
.card,
.app-header,
.player-hud,
.board-controls-bar {
  background: var(--bg-card);
  backdrop-filter: blur(20px) saturate(1.3);
  -webkit-backdrop-filter: blur(20px) saturate(1.3);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
  position: relative;
}

/* ────────────────────── Header ────────────────────── */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 1;
}

.brand-icon {
  width: 40px;
  height: 40px;
  background: var(--accent);
  color: #0a0a0a;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  box-shadow: 0 4px 14px rgba(255, 255, 255, 0.1);
}

.brand-text h1 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
  line-height: 1.2;
}

.sub-title {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 400;
  letter-spacing: 0.02em;
}

/* ── Status Badge ── */
.header-status {
  z-index: 1;
}

.status-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 16px;
  border-radius: var(--radius-pill);
  font-weight: 600;
  font-size: 0.82rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  background: var(--text-muted);
  transition: all 0.35s ease;
}

.status-badge.turn-white .status-dot {
  background: #fff;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
}

.status-badge.turn-black .status-dot {
  background: #71717a;
  box-shadow: 0 0 6px rgba(113, 113, 122, 0.3);
}

.status-badge.status-check {
  background: rgba(249, 115, 22, 0.12);
  border-color: rgba(249, 115, 22, 0.3);
  color: #fb923c;
}

.status-badge.status-check .status-dot {
  background: #f97316;
  box-shadow: 0 0 8px rgba(249, 115, 22, 0.5);
  animation: pulse-dot 1.2s ease-in-out infinite;
}

.status-badge.status-checkmate {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.3);
  color: #f87171;
}

.status-badge.status-checkmate .status-dot {
  background: #ef4444;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.4); }
}

/* ── Header Actions ── */
.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  z-index: 1;
}

.btn-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border-hover);
  color: var(--text-primary);
  transform: translateY(-1px);
}

.btn-secondary {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  font-weight: 600;
  font-size: 0.8rem;
  font-family: var(--font-main);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border-hover);
  color: var(--text-primary);
  transform: translateY(-1px);
}

.btn-primary {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 18px;
  background: var(--accent);
  color: #0a0a0a;
  border: none;
  border-radius: var(--radius-pill);
  font-weight: 700;
  font-size: 0.82rem;
  font-family: var(--font-main);
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(255, 255, 255, 0.08);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 255, 255, 0.12);
  filter: brightness(1.05);
}

/* ────────────────────── Hint Toast (floating, no layout shift) ──── */
.hint-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 20px;
  background: rgba(20, 20, 20, 0.92);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(249, 115, 22, 0.3);
  border-radius: var(--radius-pill);
  color: #fb923c;
  font-size: 0.82rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 90;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
  animation: toastIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  white-space: nowrap;
}

.hint-toast.hidden {
  display: none;
}

.hint-toast-close {
  background: none;
  border: none;
  color: #fb923c;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 2px;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.hint-toast-close:hover {
  opacity: 1;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(16px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ────────────────────── Main Grid ────────────────────── */
.game-layout {
  display: grid;
  grid-template-columns: minmax(0, 480px) minmax(280px, 1fr);
  gap: 18px;
  align-items: start;
}

/* ────────────────────── Board Section ────────────────────── */
.board-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ── Player HUD ── */
.player-hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 14px;
  border-radius: var(--radius-lg);
}

.player-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}

.avatar-human {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: rgba(232, 228, 223, 0.15);
}

.name-details {
  display: flex;
  flex-direction: column;
}

.player-name {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-primary);
}

.player-role {
  font-size: 0.68rem;
  color: var(--text-muted);
  font-weight: 500;
}

.hud-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.captured-pieces {
  display: flex;
  align-items: center;
  gap: 1px;
  min-height: 18px;
}

.captured-pieces img {
  width: 16px;
  height: 16px;
  object-fit: contain;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

.score-advantage {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--success);
  background: rgba(34, 197, 94, 0.1);
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(34, 197, 94, 0.2);
}

.score-advantage:empty {
  display: none;
}

/* ── Board Wrapper ── */
.board-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06),
    0 20px 50px -12px rgba(0, 0, 0, 0.6),
    0 0 30px rgba(255, 255, 255, 0.02);
  border: 2px solid rgba(255, 255, 255, 0.05);
}

.chess-board {
  width: 100%;
  height: 100%;
}

/* Piece visibility on dark board squares */
.chess-board img[data-piece],
.chess-board .piece-417db,
.chess-board img {
  filter: drop-shadow(0 1px 3px rgba(255, 255, 255, 0.15)) drop-shadow(0 0 1px rgba(255, 255, 255, 0.1));
}

/* ── Board Controls Bar ── */
.board-controls-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 5px;
  border-radius: var(--radius-pill);
}

.btn-board-action {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  font-family: var(--font-main);
  font-weight: 600;
  font-size: 0.78rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 1;
}

.btn-board-action:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  transform: translateY(-1px);
  border-color: var(--border-hover);
}

.btn-board-undo {
  background: var(--accent);
  color: #0a0a0a;
  border: none;
  font-weight: 700;
}

.btn-board-undo:hover {
  filter: brightness(1.05);
  color: #0a0a0a;
}

.btn-board-hint {
  background: rgba(249, 115, 22, 0.08);
  border-color: rgba(249, 115, 22, 0.2);
  color: #fb923c;
}

.btn-board-hint:hover {
  background: rgba(249, 115, 22, 0.14);
}

/* ── Thinking Overlay ── */
.thinking-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(5, 5, 5, 0.75);
  backdrop-filter: blur(6px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  z-index: 50;
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.9rem;
  transition: opacity 0.25s ease;
}

.thinking-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ────────────────────── Square Highlights ────────────────────── */
.square-highlight-selected {
  background-color: var(--square-selected) !important;
}

.square-highlight-legal {
  position: relative;
}

.square-highlight-legal::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 26%;
  height: 26%;
  background-color: var(--square-legal-dot);
  border-radius: 50%;
  pointer-events: none;
  z-index: 5;
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.3);
}

.square-highlight-capture {
  position: relative;
}

.square-highlight-capture::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80%;
  height: 80%;
  border: 4px solid var(--square-capture-ring);
  border-radius: 50%;
  pointer-events: none;
  z-index: 5;
}

.square-highlight-hint {
  background-color: var(--square-hint) !important;
  box-shadow: inset 0 0 0 3px #f97316 !important;
}

.square-highlight-check {
  background-color: var(--square-check) !important;
  box-shadow: inset 0 0 0 3px #ef4444 !important;
  animation: check-pulse 1s ease-in-out infinite;
}

@keyframes check-pulse {
  0%, 100% { box-shadow: inset 0 0 0 3px #ef4444 !important; }
  50% { box-shadow: inset 0 0 12px 2px rgba(239, 68, 68, 0.4) !important; }
}

.square-highlight-illegal {
  background-color: rgba(239, 68, 68, 0.5) !important;
  box-shadow: inset 0 0 0 3px #ef4444 !important;
  animation: illegal-flash 0.5s ease-out forwards;
}

@keyframes illegal-flash {
  0% { background-color: rgba(239, 68, 68, 0.6) !important; }
  100% { background-color: rgba(239, 68, 68, 0) !important; }
}

/* ────────────────────── Sidebar ────────────────────── */
.sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-subtle);
  z-index: 1;
}

.card-header i {
  color: var(--accent);
  font-size: 0.9rem;
}

.card-header h2 {
  font-size: 0.9rem;
  font-weight: 700;
  flex: 1;
  color: var(--text-primary);
  letter-spacing: -0.2px;
}

.btn-text-icon {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.7rem;
  font-family: var(--font-mono);
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 1;
}

.btn-text-icon:hover {
  color: var(--text-primary);
  border-color: var(--border-hover);
  background: rgba(255, 255, 255, 0.06);
}

.card-body {
  padding: 16px;
  z-index: 1;
}

/* ── Segmented Control ── */
.segmented-control {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--bg-pill-inactive);
  padding: 3px;
  border-radius: var(--radius-pill);
  gap: 3px;
  border: 1px solid var(--border-subtle);
}

.segment-btn {
  padding: 8px 12px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-main);
  font-weight: 600;
  font-size: 0.8rem;
  border-radius: var(--radius-pill);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.segment-btn:hover {
  color: var(--text-secondary);
}

.segment-btn.active {
  background: var(--accent);
  color: #0a0a0a;
  box-shadow: 0 2px 10px rgba(255, 255, 255, 0.06);
}

/* ── AI Settings ── */
.ai-settings {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: fadeIn 0.25s ease;
}

.ai-settings.hidden {
  display: none;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.setting-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.setting-group label {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.side-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.side-btn {
  padding: 8px 12px;
  background: var(--bg-pill-inactive);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  border-radius: var(--radius-pill);
  font-family: var(--font-main);
  font-weight: 600;
  font-size: 0.78rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.side-btn.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.custom-select {
  padding: 9px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  font-family: var(--font-main);
  font-size: 0.8rem;
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s ease;
}

.custom-select:focus {
  border-color: var(--accent);
}

.custom-select option {
  background: var(--bg-card-solid);
  color: var(--text-primary);
}

/* ── Move History ── */
.move-history-body {
  padding: 0;
  max-height: 260px;
  overflow-y: auto;
}

.move-history-body::-webkit-scrollbar {
  width: 5px;
}

.move-history-body::-webkit-scrollbar-track {
  background: transparent;
}

.move-history-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
}

.move-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.move-table th {
  position: sticky;
  top: 0;
  background: var(--bg-card-solid);
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.68rem;
  padding: 8px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
  letter-spacing: 0.04em;
}

.move-table td {
  padding: 7px 14px;
  color: var(--text-secondary);
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.move-table tr:hover td {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-primary);
}

.empty-row td {
  text-align: center;
  font-style: italic;
  padding: 24px 14px;
  color: var(--text-muted);
  font-family: var(--font-main);
}

/* ────────────────────── Modals ────────────────────── */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 1;
  transition: opacity 0.25s ease;
}

.modal-backdrop.hidden {
  opacity: 0;
  pointer-events: none;
}

.modal-card {
  background: var(--bg-card-solid);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-xl);
  padding: 24px;
  width: 90%;
  max-width: 360px;
  text-align: center;
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.4);
  animation: modalPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalPop {
  from { opacity: 0; transform: scale(0.9) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-card h3 {
  font-size: 1.1rem;
  margin-bottom: 4px;
  color: var(--text-primary);
}

.modal-card p {
  color: var(--text-secondary);
  font-size: 0.82rem;
  margin-bottom: 16px;
}

/* ── Promotion Choices ── */
.promotion-choices {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.promo-btn {
  background: rgba(60, 60, 60, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 12px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.promo-btn:hover {
  background: rgba(80, 80, 80, 0.7);
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 255, 255, 0.06);
}

.promo-btn img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  filter: drop-shadow(0 1px 4px rgba(255, 255, 255, 0.25)) brightness(1.2);
}

.promo-btn span {
  font-size: 0.7rem;
  color: var(--text-primary);
  font-family: var(--font-main);
  font-weight: 600;
}

/* ── Game Over Modal ── */
.game-over-card {
  padding: 32px 24px;
}

.game-over-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  background: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  color: #0a0a0a;
  box-shadow: 0 0 30px rgba(255, 255, 255, 0.12);
  animation: crown-glow 2s ease-in-out infinite;
}

@keyframes crown-glow {
  0%, 100% { box-shadow: 0 0 20px rgba(255, 255, 255, 0.08); }
  50% { box-shadow: 0 0 40px rgba(255, 255, 255, 0.18); }
}

.game-over-card h3 {
  font-size: 1.35rem;
  font-weight: 800;
  margin-bottom: 4px;
  letter-spacing: -0.3px;
}

.game-over-card p {
  margin-bottom: 20px;
}

.btn-play-again {
  width: 100%;
  justify-content: center;
  padding: 12px 20px;
  font-size: 0.88rem;
}

/* ────────────────────── Board Theme Presets ────────────────────── */
.theme-presets {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.theme-swatch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 6px;
  background: var(--bg-elevated);
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
}

.theme-swatch:hover {
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-1px);
}

.theme-swatch.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.theme-swatch .swatch-light,
.theme-swatch .swatch-dark {
  width: 100%;
  height: 14px;
  border-radius: 3px;
}

.swatch-label {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-top: 2px;
}

.theme-swatch.active .swatch-label {
  color: var(--text-primary);
}

/* ────────────────────── Touch & Drag ────────────────────── */
.chess-board,
.board-wrapper,
img {
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

/* ────────────────────── Responsive ────────────────────── */
@media (max-width: 900px) {
  body {
    padding: 10px 6px;
    align-items: flex-start;
  }

  .game-layout {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .app-header {
    flex-direction: column;
    align-items: stretch;
    padding: 12px 14px;
    gap: 8px;
  }

  .header-status {
    order: 3;
    display: flex;
    justify-content: center;
  }

  .status-badge {
    width: 100%;
    justify-content: center;
  }

  .header-actions {
    justify-content: space-between;
    width: 100%;
    gap: 4px;
  }

  .btn-icon {
    width: 36px;
    height: 36px;
  }

  .btn-primary {
    flex: 1;
    justify-content: center;
  }

  .board-controls-bar {
    gap: 4px;
  }

  .btn-board-action {
    padding: 8px 6px;
    font-size: 0.75rem;
  }
}

@media (max-width: 500px) {
  body {
    padding: 6px 4px;
  }

  .app-header {
    border-radius: var(--radius-lg);
    padding: 10px;
  }

  .brand-icon {
    width: 34px;
    height: 34px;
    font-size: 1rem;
  }

  .brand-text h1 {
    font-size: 1rem;
  }

  .sub-title {
    font-size: 0.65rem;
  }

  .btn-board-action {
    font-size: 0.7rem;
    padding: 7px 4px;
    gap: 4px;
  }
}
