/* ============================================================
   RiskyChess — Dark strategic war-room aesthetic
   Font: Cinzel (display) + Roboto Mono (data)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;700;900&family=Roboto+Mono:wght@400;600&display=swap');

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

body {
  background: #060d18;
  color: #c8d8e8;
  font-family: 'Roboto Mono', monospace;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ── Header ────────────────────────────────────────────────── */
header {
  width: 100%;
  max-width: 1040px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  border-bottom: 1px solid #1c3050;
}

.rc-logo {
  font-family: 'Cinzel', serif;
  font-size: 1.6rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  color: #c9a84c;
  text-shadow: 0 0 20px rgba(201,168,76,0.4);
}

.rc-logo span { color: #e0e8f0; }

.rc-controls {
  display: flex;
  gap: 10px;
  align-items: center;
}

.rc-btn {
  font-family: 'Roboto Mono', monospace;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  background: #0f2035;
  color: #c9a84c;
  border: 1px solid #c9a84c44;
  padding: 6px 14px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.rc-btn:hover { background: #1a3050; border-color: #c9a84c99; }
.rc-btn.danger { color: #e74c3c; border-color: #e74c3c44; }
.rc-btn.danger:hover { background: #1f1010; border-color: #e74c3c99; }

.rc-select {
  font-family: 'Roboto Mono', monospace;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  background: #0f2035;
  color: #c9a84c;
  border: 1px solid #c9a84c44;
  padding: 6px 10px;
  cursor: pointer;
  outline: none;
}
.rc-select:hover { border-color: #c9a84c99; }

.rc-speed-label {
  font-size: 0.7rem;
  color: #6b8099;
  margin-right: -4px;
}

/* ── Game layout ────────────────────────────────────────────── */
.rc-game-wrap {
  display: flex;
  gap: 16px;
  padding: 16px;
  align-items: flex-start;
  max-width: 1040px;
  width: 100%;
}

/* ── Canvas ─────────────────────────────────────────────────── */
.rc-canvas-wrap {
  flex-shrink: 0;
  border: 2px solid #1c3050;
  box-shadow: 0 0 30px rgba(0,0,0,0.6), inset 0 0 60px rgba(0,0,0,0.3);
}

#gameCanvas {
  display: block;
  cursor: crosshair;
  max-width: 100%;
}

/* ── Sidebar ─────────────────────────────────────────────────── */
.rc-sidebar {
  flex: 1;
  min-width: 220px;
  max-width: 280px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rc-round {
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  color: #6b8099;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.rc-turn {
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  font-weight: 700;
  padding: 8px 10px;
  background: #0a1a2e;
  border: 1px solid #1c3050;
  letter-spacing: 0.05em;
}

.rc-players { display: flex; flex-direction: column; gap: 6px; }

.rc-player-card {
  background: #0a1a2e;
  border: 1px solid #1c3050;
  border-left-width: 4px;
  padding: 7px 10px;
  opacity: 0.65;
  transition: opacity 0.2s;
}
.rc-player-card.active { opacity: 1; background: #0f2035; }

.rc-player-name {
  font-family: 'Cinzel', serif;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}

.rc-player-stats {
  display: flex;
  gap: 12px;
  font-size: 0.7rem;
  color: #8899aa;
}

.rc-log-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid #1c3050;
  padding-top: 8px;
}

.rc-log-title {
  font-family: 'Cinzel', serif;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #4a6070;
}

.rc-copy-btn {
  font-size: 0.65rem;
  padding: 3px 8px;
  letter-spacing: 0.03em;
}

.rc-log {
  background: #060d18;
  border: 1px solid #1c3050;
  padding: 8px;
  max-height: 280px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.rc-log::-webkit-scrollbar { width: 4px; }
.rc-log::-webkit-scrollbar-track { background: #060d18; }
.rc-log::-webkit-scrollbar-thumb { background: #1c3050; }

.rc-log-entry {
  font-size: 0.65rem;
  color: #7a9ab0;
  border-bottom: 1px solid #0d1f30;
  padding-bottom: 3px;
  line-height: 1.4;
}
.rc-log-entry:first-child { color: #c0d0e0; }

.rc-winner {
  font-family: 'Cinzel', serif;
  font-size: 1.1rem;
  font-weight: 900;
  text-align: center;
  padding: 12px;
  background: #0a1a2e;
  border: 1px solid currentColor;
  letter-spacing: 0.1em;
  margin-bottom: 4px;
  animation: pulse 1.5s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.7; }
}

/* ── Legend ─────────────────────────────────────────────────── */
.rc-legend {
  width: 100%;
  max-width: 1040px;
  padding: 0 16px 16px;
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  font-size: 0.65rem;
  color: #4a6070;
}
.rc-legend span { display: flex; align-items: center; gap: 5px; }
.rc-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 780px) {
  .rc-game-wrap { flex-direction: column; }
  .rc-sidebar { max-width: 100%; }
}

/* ── Placement phase sidebar ───────────────────────────────── */
.rc-placement-header {
  font-family: 'Cinzel', serif;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  padding: 8px 10px;
  background: #0a1a2e;
  border: 1px solid #1c3050;
  color: #c9a84c;
  margin-bottom: 8px;
}

.rc-placement-info {
  background: #0a1a2e;
  border: 1px solid #1c3050;
  padding: 10px;
  margin-bottom: 8px;
}

.rc-next-piece {
  font-size: 0.85rem;
  color: #c0d0e0;
  margin-bottom: 4px;
}

.rc-next-piece strong { color: #f0c040; }

.rc-piece-progress {
  font-size: 0.7rem;
  color: #6b8099;
}

.rc-start-btn {
  color: #4fc870 !important;
  border-color: #4fc87044 !important;
  font-size: 0.85rem !important;
  padding: 8px 14px !important;
}
.rc-start-btn:hover { border-color: #4fc870aa !important; background: #0a2010 !important; }

.rc-placement-tip {
  font-size: 0.65rem;
  color: #4a6070;
  margin-top: 10px;
  padding: 6px;
  border: 1px solid #1c3050;
  line-height: 1.5;
}

/* ── Name input ─────────────────────────────────────────────── */
.rc-input {
  font-family: 'Roboto Mono', monospace;
  font-size: 0.75rem;
  background: #0f2035;
  color: #e8dcc8;
  border: 1px solid #c9a84c44;
  padding: 6px 10px;
  width: 110px;
  outline: none;
}
.rc-input:focus { border-color: #c9a84c99; }
.rc-input::placeholder { color: #4a6070; }

/* ── Leaderboard ─────────────────────────────────────────────── */
.rc-leaderboard {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 6px;
}
.rc-lb-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.65rem;
  padding: 4px 6px;
  background: #0a1a2e;
  border: 1px solid #1c3050;
}
.rc-lb-row:first-child { border-color: #c9a84c55; }
.rc-lb-rank  { color: #c9a84c; width: 14px; text-align: right; font-weight: 700; }
.rc-lb-name  { flex: 1; color: #c0d0e0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rc-lb-stats { color: #6b8099; white-space: nowrap; }

/* ── Mobile responsive ──────────────────────────────────────── */
#gameCanvas { touch-action: none; }

@media (max-width: 680px) {
  header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 12px;
  }

  .rc-controls {
    flex-wrap: wrap;
    gap: 6px;
    width: 100%;
  }

  .rc-select, .rc-btn {
    font-size: 0.8rem;
    padding: 7px 10px;
  }

  .rc-input {
    font-size: 0.8rem;
    padding: 7px 10px;
    width: 100px;
  }

  .rc-speed-label { display: none; }

  .rc-game-wrap {
    flex-direction: column;
    padding: 8px;
    gap: 10px;
  }

  .rc-canvas-wrap {
    width: 100%;
    border-width: 1px;
  }

  #gameCanvas {
    width: 100% !important;
    height: auto !important;
    display: block;
  }

  .rc-sidebar {
    max-width: 100%;
    min-width: unset;
  }

  .rc-log { max-height: 160px; }

  .rc-legend {
    font-size: 0.6rem;
    padding: 0 10px 12px;
    gap: 8px;
  }
}
