/* ── Layout ── */
body {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  padding-bottom: 28px;
  overflow-x: hidden;
}

.arcade-title, .subtitle { position: relative; z-index: 1; }

/* ── Three-column layout ── */
.chess-layout {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 20px;
  width: 100%;
  max-width: 780px;
  padding: 14px 12px 0;
  box-sizing: border-box;
  position: relative;
  z-index: 1;
}

/* ── Side panels ── */
.c-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
  width: 120px;
  flex-shrink: 0;
}

.c-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.c-label {
  font-size: 6px;
  color: var(--muted);
  letter-spacing: 2px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  padding-bottom: 4px;
  margin-bottom: 2px;
}

/* Difficulty tabs — stacked */
.level-tabs {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.ltab {
  font-family: 'Press Start 2P', monospace;
  font-size: 7px;
  padding: 7px 8px;
  border: 1px solid rgba(255,0,204,0.2);
  background: #0d0820;
  color: #8877aa;
  transition: all .15s;
  letter-spacing: 1px;
  text-align: left;
}
.ltab:hover { background: #1a1030; color: #cc88ff; }
.ltab.lv1.active { background: #0a1f17; color: #00f5aa; border-color: #00f5aa; text-shadow: 0 0 8px #00f5aa; }
.ltab.lv2.active { background: #0a1525; color: #00aaff; border-color: #00aaff; text-shadow: 0 0 8px #00aaff; }
.ltab.lv3.active { background: #1f1600; color: #ffe600; border-color: #ffe600; text-shadow: 0 0 8px #ffe600; }
.ltab.lv4.active { background: #200a00; color: #ff8c00; border-color: #ff8c00; text-shadow: 0 0 8px #ff8c00; }

.diff-desc {
  font-size: 5px;
  color: #444;
  letter-spacing: 1px;
  line-height: 1.8;
  margin-top: 2px;
}

/* Status */
.status-bar {
  font-size: 7px;
  padding: 8px 6px;
  background: #0d0820;
  border: 1px solid rgba(0,245,255,0.2);
  color: #00f5ff;
  text-shadow: 0 0 8px #00f5ff66;
  letter-spacing: 1px;
  text-align: center;
  line-height: 1.6;
  transition: color 0.2s;
}

/* Action buttons */
.c-btn {
  font-family: 'Press Start 2P', monospace;
  font-size: 7px;
  padding: 9px 8px;
  border: 1px solid rgba(255,0,204,0.25);
  background: transparent;
  color: var(--pink);
  transition: all .15s;
  letter-spacing: 1px;
  text-align: left;
  width: 100%;
}
.c-btn:hover {
  background: rgba(255,0,204,0.12);
  border-color: var(--pink);
  box-shadow: 0 0 10px rgba(255,0,204,0.2);
  color: #fff;
}
.c-btn.primary-btn {
  border-color: rgba(0,245,255,0.3);
  color: var(--cyan);
}
.c-btn.primary-btn:hover {
  background: rgba(0,245,255,0.1);
  border-color: var(--cyan);
  box-shadow: 0 0 10px rgba(0,245,255,0.2);
}

/* Rules */
.rules-box {
  font-size: 5px;
  color: #444;
  line-height: 2;
  letter-spacing: 1px;
}

/* Turn badge */
.turn-badge {
  font-size: 7px;
  color: var(--yellow);
  text-shadow: 0 0 8px var(--yellow);
  border: 1px solid rgba(255,204,0,0.3);
  padding: 8px 6px;
  text-align: center;
  letter-spacing: 1px;
  line-height: 1.6;
  transition: color 0.2s, text-shadow 0.2s, border-color 0.2s;
}

/* Move count */
.c-moves {
  font-size: 22px;
  color: var(--muted);
  letter-spacing: 1px;
}

/* ── Center board ── */
.c-board-wrap {
  flex: 1;
  min-width: 0;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.player-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 7px;
}

.ptag-label {
  color: var(--cyan);
  letter-spacing: 1px;
  white-space: nowrap;
  flex-shrink: 0;
}
.ptag-captures {
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 2px;
  line-height: 1;
  min-height: 16px;
}

.board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(5, 1fr);
  gap: 4px;
  padding: 10px;
  background: #08060f;
  border: 1px solid rgba(0,245,255,0.2);
  box-shadow: 0 0 30px rgba(0,245,255,0.08), 0 0 80px rgba(255,0,204,0.05), inset 0 0 40px rgba(0,0,0,0.4);
  width: 100%;
  aspect-ratio: 4 / 5;
  box-sizing: border-box;
}

.sq {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  transition: background 0.1s, border-color 0.1s, box-shadow 0.1s;
  user-select: none;
  position: relative;
  border-radius: 2px;
  padding: 5%;
}

/* SVG pieces fill the square */
.sq svg { width: 100%; height: 100%; display: block; pointer-events: none; }

.sq.light { background: #1e1e3a; }
.sq.dark  { background: #0a0a16; }
.sq:hover { border-color: rgba(0,245,255,0.25); }

.sq.selected {
  background: rgba(0,245,255,0.18) !important;
  border-color: #00f5ff !important;
  box-shadow: inset 0 0 12px rgba(0,245,255,0.25);
}

.sq.legal-move::after {
  content: '';
  position: absolute;
  width: 32%; height: 32%;
  border-radius: 50%;
  background: rgba(0,245,255,0.4);
  box-shadow: 0 0 8px rgba(0,245,255,0.5);
  pointer-events: none;
}

.sq.legal-capture::after {
  content: '';
  position: absolute;
  inset: 4px;
  border-radius: 2px;
  background: transparent;
  border: 2px solid rgba(255,0,204,0.65);
  box-shadow: 0 0 10px rgba(255,0,204,0.35);
  pointer-events: none;
}

.sq.last-from { background: rgba(255,204,0,0.07) !important; }
.sq.last-to   { background: rgba(255,204,0,0.13) !important; }

.sq.in-check {
  background: rgba(255,30,30,0.22) !important;
  border-color: #ff2244 !important;
  box-shadow: inset 0 0 12px rgba(255,34,68,0.3);
}

.piece-w svg { filter: drop-shadow(0 0 4px rgba(255,255,255,0.6)); }
.piece-b svg { filter: drop-shadow(0 0 4px rgba(180,100,255,0.7)); }

/* File labels */
.board-labels { width: 100%; }
.file-labels {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 0 10px;
  box-sizing: border-box;
}
.file-label {
  text-align: center;
  font-size: 6px;
  color: var(--muted);
  letter-spacing: 1px;
}

/* ── Promotion modal ── */
.promo-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  animation: fadeIn 0.15s ease;
}
.promo-box {
  background: #0d0d1f;
  border: 1px solid var(--pink);
  padding: 28px 32px;
  text-align: center;
  box-shadow: 0 0 40px rgba(255,0,204,0.35);
  animation: popIn 0.2s ease;
}
.promo-title {
  font-size: 9px;
  color: var(--pink);
  margin-bottom: 20px;
  letter-spacing: 2px;
  text-shadow: 0 0 10px var(--pink);
}
.promo-pieces { display: flex; gap: 16px; justify-content: center; }
.promo-piece {
  width: 72px;
  height: 84px;
  padding: 8px;
  border: 1px solid #333;
  background: #0d0d1f;
  transition: all 0.15s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.promo-piece svg { width: 44px; height: 44px; display: block; }
.promo-piece-label { font-size: 5px; color: var(--muted); letter-spacing: 1px; }
.promo-piece:hover {
  border-color: var(--pink);
  background: rgba(255,0,204,0.12);
  box-shadow: 0 0 14px rgba(255,0,204,0.35);
  transform: scale(1.08);
}

/* ── Animations ── */
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }
@keyframes popIn  { from { transform:scale(0.8); opacity:0; } to { transform:scale(1); opacity:1; } }
@keyframes iconPulse {
  0%,100% { transform:scale(1);    filter:drop-shadow(0 0 8px currentColor); }
  50%      { transform:scale(1.12); filter:drop-shadow(0 0 20px currentColor); }
}

/* ── Responsive ── */
@media (max-width: 600px) {
  .chess-layout {
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 10px 10px 0;
  }
  .c-panel {
    flex-direction: row;
    width: 100%;
    max-width: 420px;
    flex-wrap: wrap;
    gap: 10px;
  }
  .c-section { flex: 1; min-width: 90px; }
  .level-tabs { flex-direction: row; flex-wrap: wrap; }
  .ltab { text-align: center; flex: 1; min-width: 40px; }
  .c-board-wrap { width: 100%; max-width: 420px; }
  .c-panel-right { order: 3; }
  .status-bar { font-size: 6px; }
}
