:root {
  --color-a-1: #ef4444;
  --color-a-2: #dc2626;
  --color-a-3: #7f1d1d;
  --color-b-1: #3f3f46;
  --color-b-2: #18181b;
  --color-b-3: #52525b;
  --board-light: #ffffff;
  --board-dark: #9ca3af;
  --bg: #14171c;
  --panel-bg: #1d222b;
  --text: #eef1f6;
  --text-muted: #9aa4b2;
  --accent: #7c5cff;
  --danger: #ef4444;
  --highlight-move: rgba(124, 92, 255, 0.55);
  --highlight-capture: rgba(239, 68, 68, 0.55);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 1024px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  border-bottom: 1px solid #2a2f3a;
}

.topbar h1 {
  margin: 0;
  font-size: 22px;
  letter-spacing: 0.5px;
}

.topbar-actions {
  display: flex;
  gap: 12px;
}

.mini-tag {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
  border: 1px solid #3a4150;
  border-radius: 999px;
  padding: 2px 8px;
  margin-left: 6px;
  vertical-align: middle;
}

.layout {
  display: flex;
  justify-content: center;
  padding: 32px;
}

.board-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.status-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.status-chip {
  background: var(--panel-bg);
  border: 1px solid #2a2f3a;
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 14px;
  color: var(--text-muted);
}

.status-chip strong {
  color: var(--text);
}

.status-chip--muted {
  opacity: 0.75;
}

.board-wrap {
  width: 560px;
  height: 560px;
  background: var(--panel-bg);
  border-radius: 12px;
  padding: 40px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.35);
}

#board {
  width: 100%;
  height: 100%;
  display: block;
}

.cell {
  transition: fill 0.15s ease;
}

.cell--light { fill: var(--board-light); }
.cell--dark { fill: var(--board-dark); }

.cell-label {
  font-size: 8px;
  fill: rgba(0,0,0,0.35);
  pointer-events: none;
  font-family: monospace;
}

.reach-marker {
  cursor: pointer;
}

.reach-marker--move { fill: var(--highlight-move); }
.reach-marker--capture { fill: var(--highlight-capture); }

.piece {
  cursor: pointer;
}

.piece--selected {
  filter: drop-shadow(0 0 4px #fff);
}

.piece--a-fill { fill: var(--color-a-2); stroke: var(--color-a-3); }
.piece--b-fill { fill: var(--color-b-2); stroke: var(--color-b-3); }

.legend {
  display: flex;
  gap: 20px;
  align-items: center;
  font-size: 13px;
  color: var(--text-muted);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-swatch {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  display: inline-block;
  border: 1px solid #3a4150;
}

.legend-swatch--a { background: var(--color-a-2); }
.legend-swatch--b { background: var(--color-b-2); border-color: var(--color-b-3); }

.legend-item--hint {
  border-left: 1px solid #2a2f3a;
  padding-left: 20px;
}

.btn {
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-primary:hover { background: #6a4bef; }

.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1px solid #3a4150;
}

.btn-outline:hover { border-color: var(--accent); }

.btn-block { width: 100%; margin-top: 8px; }

.hidden { display: none !important; }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal {
  background: var(--panel-bg);
  border-radius: 14px;
  padding: 32px;
  width: 360px;
  max-width: 90vw;
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.modal--rules {
  width: 460px;
}

.modal h2 {
  margin: 0 0 12px;
  font-size: 20px;
}

.modal-sub {
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 0;
}

.welcome-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.welcome-actions .btn {
  flex: 1;
}

.rules-list {
  margin: 0;
  padding-left: 20px;
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

.rules-list li {
  margin-bottom: 12px;
}

.rules-list li:last-child {
  margin-bottom: 0;
}

.modal-badge {
  display: inline-block;
  background: var(--accent);
  color: white;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 14px;
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
}

.modal-close:hover { color: var(--text); }

.field {
  display: block;
  margin-bottom: 14px;
  font-size: 13px;
  color: var(--text-muted);
}

.field span {
  display: block;
  margin-bottom: 6px;
}

.field input,
.field textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #3a4150;
  background: #12151b;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
}

.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.submission-id code {
  background: #12151b;
  padding: 4px 8px;
  border-radius: 6px;
  color: var(--accent);
}

.turn-toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  border: 1px solid #6a4bef;
  border-radius: 999px;
  padding: 12px 30px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: white;
  box-shadow: 0 12px 30px rgba(0,0,0,0.5);
  z-index: 150;
  pointer-events: none;
}

.easter-egg {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  background: rgba(0,0,0,0.15);
}

.easter-egg svg {
  width: 260px;
  height: 260px;
}

.saber-blade {
  filter: drop-shadow(0 0 10px #7CFC9A) drop-shadow(0 0 20px #7CFC9A);
}

.easter-egg-text {
  margin-top: 8px;
  font-size: 22px;
  font-weight: 700;
  color: #eafff0;
  text-shadow: 0 0 12px #7CFC9A, 0 0 4px #fff;
  letter-spacing: 0.5px;
}
