:root {
  --bg: #0b0f19;
  --bg-2: #121a2b;
  --card: rgba(16, 24, 40, 0.9);
  --text: #e6edf7;
  --muted: rgba(230, 237, 247, 0.68);
  --line: rgba(230, 237, 247, 0.12);
  --accent: #22c55e;
  --danger: #ef4444;
  --board-size: min(92vw, 600px);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(900px 600px at 15% 0%, #1b2a4f 0%, transparent 55%),
    radial-gradient(900px 700px at 85% 10%, #15223f 0%, transparent 60%),
    linear-gradient(180deg, var(--bg-2), var(--bg));
}

.app {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px 14px 40px;
}

.card {
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 18px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(10px);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-title {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.3px;
}

.brand-subtitle {
  font-size: 13px;
  color: var(--muted);
}

.status {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.pill {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  font-size: 13px;
  color: var(--text);
}

.btn {
  padding: 9px 16px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  background: linear-gradient(135deg, #24324f, #1a2440);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn:hover { transform: translateY(-1px); box-shadow: 0 8px 18px rgba(0, 0, 0, 0.25); }

.layout {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}

.board-card {
  padding: 14px;
}

.board {
  width: var(--board-size);
  height: var(--board-size);
  margin: 0 auto;
}

.highlight {
  box-shadow: inset 0 0 0 4px rgba(34, 197, 94, 0.65);
}

.side {
  width: 260px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.side-title {
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  color: var(--muted);
}

.side-text {
  font-size: 13px;
  color: var(--text);
  line-height: 1.4;
}

.side-row { display: flex; gap: 10px; flex-wrap: wrap; }

.chip {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-size: 12px;
}

.chip.white { background: rgba(255, 255, 255, 0.15); }
.chip.black { background: rgba(0, 0, 0, 0.35); }

@media (max-width: 960px) {
  .layout { flex-direction: column; align-items: center; }
  .side { width: min(92vw, 520px); }
}

@media (max-width: 640px) {
  :root { --board-size: min(96vw, 560px); }
  .topbar { justify-content: center; text-align: center; }
  .status { justify-content: center; }
}

body[data-game="dama"] .board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  touch-action: manipulation;
}

body[data-game="dama"] .cell {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 1px solid rgba(0, 0, 0, 0.15);
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

body[data-game="dama"] .cell.light { background: #1b253a; }
body[data-game="dama"] .cell.dark { background: #131b2a; }

body[data-game="dama"] .cell.selected {
  outline: 2px solid rgba(255, 255, 255, 0.7);
  outline-offset: -2px;
}

body[data-game="dama"] .cell.selectable {
  box-shadow: inset 0 0 0 2px rgba(34, 197, 94, 0.35);
}

body[data-game="dama"] .cell.last {
  box-shadow: inset 0 0 0 2px rgba(125, 211, 252, 0.6);
}

body[data-game="dama"] .cell.move::after,
body[data-game="dama"] .cell.capture::after {
  content: "";
  width: 34%;
  height: 34%;
  border-radius: 50%;
  display: block;
}

body[data-game="dama"] .cell.move::after {
  background: rgba(34, 197, 94, 0.65);
  box-shadow: 0 0 0 6px rgba(34, 197, 94, 0.2);
}

body[data-game="dama"] .cell.capture::after {
  background: rgba(239, 68, 68, 0.7);
  box-shadow: 0 0 0 6px rgba(239, 68, 68, 0.2);
}

body[data-game="dama"] .cell.capture-flash {
  animation: captureFlash 0.35s ease;
}

@keyframes captureFlash {
  0% { box-shadow: inset 0 0 0 0 rgba(239, 68, 68, 0.0); }
  50% { box-shadow: inset 0 0 0 4px rgba(239, 68, 68, 0.8); }
  100% { box-shadow: inset 0 0 0 0 rgba(239, 68, 68, 0.0); }
}

body[data-game="dama"] .piece {
  width: 72%;
  height: 72%;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 18px;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  box-shadow: 0 10px 16px rgba(0, 0, 0, 0.35);
  transition: transform 0.15s ease;
  pointer-events: none;
}

body[data-game="dama"] .piece.white {
  background: radial-gradient(circle at 30% 30%, #fdfdfd, #cfd8ea);
  color: #1b2233;
}

body[data-game="dama"] .piece.black {
  background: radial-gradient(circle at 30% 30%, #4b5568, #111827);
  color: #f3f4f6;
}

body[data-game="dama"] .piece.king {
  border: 2px solid rgba(255, 255, 255, 0.65);
}

body[data-game="dama"] .board.disabled .cell {
  cursor: default;
  opacity: 0.85;
}
