/* Chesster - Modern Chess Platform Styling */
:root {
  --bg-dark: #0a0e17;
  --bg-surface: #111827;
  --bg-surface-elevated: #1f293d;
  --bg-surface-card: #182234;
  --border-color: #27354f;
  --border-highlight: #3b82f6;

  --accent-gold: #fbbf24;
  --accent-gold-hover: #f59e0b;
  --accent-emerald: #10b981;
  --accent-emerald-dark: #059669;
  --accent-ruby: #ef4444;
  --accent-cyan: #06b6d4;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --board-light: #ece3d1;
  --board-dark: #739552;
  --board-highlight: rgba(247, 247, 105, 0.55);
  --board-move-hint: rgba(16, 185, 129, 0.7);
  --board-check-red: rgba(239, 68, 68, 0.75);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;

  --shadow-main: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 25px rgba(251, 191, 36, 0.25);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-dark);
}
::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-dim);
}

/* Navbar */
.navbar {
  background-color: rgba(17, 24, 39, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}

.brand-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #0f172a;
  font-weight: bold;
  font-size: 1.25rem;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.35);
}

.brand-name {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(to right, #fff, #fbbf24);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-user-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.user-elo-badge {
  background: linear-gradient(135deg, #1e293b, #0f172a);
  border: 1px solid var(--accent-gold);
  border-radius: var(--radius-md);
  padding: 0.35rem 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 2px 10px rgba(251, 191, 36, 0.15);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.user-elo-badge:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(251, 191, 36, 0.3);
}

.elo-star {
  color: var(--accent-gold);
  font-size: 1.1rem;
}

.elo-number {
  font-weight: 800;
  font-size: 1.1rem;
  color: #fef08a;
}

.elo-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.nav-coach-pill {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  padding: 0.35rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.85rem;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.2s;
}

.nav-coach-pill:hover {
  border-color: var(--accent-gold);
  background: rgba(251, 191, 36, 0.1);
}

.nav-profile {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.user-avatar-circle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2px solid var(--border-color);
  background: var(--bg-surface-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  overflow: hidden;
}

.btn-icon {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  border-radius: var(--radius-sm);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-icon:hover {
  background: var(--border-color);
}

/* Main Container */
.main-wrapper {
  flex: 1;
  max-width: 1300px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
}

/* Home View */
.view-section {
  display: none;
}
.view-section.active {
  display: block;
}

.hero-dashboard {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

@media (max-width: 960px) {
  .hero-dashboard {
    grid-template-columns: 1fr;
  }
}

.hero-welcome-card {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.9), rgba(15, 23, 42, 0.95));
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 2rem;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-main);
}

.hero-welcome-card::after {
  display: none;
}

.hero-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.25rem;
}

.welcome-title {
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
}

.welcome-subtitle {
  color: var(--text-muted);
  font-size: 1rem;
  max-width: 580px;
  line-height: 1.5;
}

.elo-info-banner {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.2rem;
  margin: 1.25rem 0;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.elo-info-banner .icon {
  font-size: 1.5rem;
}

.elo-info-banner .text {
  font-size: 0.9rem;
  color: #a7f3d0;
  line-height: 1.4;
}

.action-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.action-card {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
}

.action-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent-gold);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.4);
}

.action-card.primary {
  background: linear-gradient(135deg, #15803d, #166534);
  border-color: #22c55e;
}

.action-card.primary:hover {
  box-shadow: 0 12px 28px rgba(34, 197, 94, 0.35);
}

.action-card.training {
  background: linear-gradient(135deg, #1e1b4b, #312e81);
  border-color: #6366f1;
}

.action-card.training:hover {
  box-shadow: 0 12px 28px rgba(99, 102, 241, 0.35);
}

.action-card-icon {
  font-size: 2.2rem;
  margin-bottom: 0.75rem;
}

.action-card-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.action-card-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.action-card.primary .action-card-desc {
  color: #dcfce7;
}

.action-card.training .action-card-desc {
  color: #e0e7ff;
}

/* Side Coach Widget on Home */
.home-coach-widget {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: var(--shadow-main);
}

.coach-widget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.coach-widget-title {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent-gold);
  font-weight: 700;
}

.coach-avatar-large {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  margin: 0 auto 1rem;
  border: 3px solid var(--accent-gold);
  box-shadow: 0 0 20px rgba(251, 191, 36, 0.25);
  overflow: hidden;
  background: var(--bg-surface-elevated);
}

.coach-widget-name {
  text-align: center;
  font-size: 1.3rem;
  font-weight: 800;
  margin-bottom: 0.25rem;
}

.coach-widget-title-text {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.coach-quote-bubble {
  background: rgba(255, 255, 255, 0.04);
  border-left: 3px solid var(--accent-gold);
  padding: 0.85rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-style: italic;
  font-size: 0.85rem;
  line-height: 1.45;
  color: #e2e8f0;
  margin-bottom: 1.25rem;
}

.btn-change-coach {
  background: transparent;
  border: 1px dashed var(--border-color);
  color: var(--text-muted);
  border-radius: var(--radius-md);
  padding: 0.6rem;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  margin-top: auto;
}

.btn-change-coach:hover {
  border-color: var(--accent-gold);
  color: var(--accent-gold);
  background: rgba(251, 191, 36, 0.05);
}

/* Live Stats & Match History Section */
.history-section {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  margin-top: 1.5rem;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.section-title {
  font-size: 1.2rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.stats-pill-group {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.stat-pill {
  background: var(--bg-surface-elevated);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  border: 1px solid var(--border-color);
}

.stat-pill .val {
  font-weight: 700;
  color: var(--text-main);
}
.stat-pill.wins .val { color: var(--accent-emerald); }
.stat-pill.losses .val { color: var(--accent-ruby); }
.stat-pill.draws .val { color: var(--accent-gold); }

.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.history-table th {
  text-align: left;
  padding: 0.75rem 1rem;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border-color);
  font-weight: 600;
}

.history-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.history-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.badge-result {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
}

.badge-win { background: rgba(16, 185, 129, 0.2); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.3); }
.badge-loss { background: rgba(239, 68, 68, 0.2); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.3); }
.badge-draw { background: rgba(251, 191, 36, 0.2); color: #fcd34d; border: 1px solid rgba(251, 191, 36, 0.3); }

.elo-delta-pos { color: #34d399; font-weight: 700; }
.elo-delta-neg { color: #f87171; font-weight: 700; }
.elo-delta-zero { color: #94a3b8; }

/* Arena Section (Playing Chess) */
.arena-view {
  display: none;
}
.arena-view.active {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 1024px) {
  .arena-view.active {
    grid-template-columns: 1fr;
  }
}

.board-container-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: var(--shadow-main);
}

.player-strip {
  width: 100%;
  max-width: 600px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.75rem;
  background: var(--bg-surface-elevated);
  border-radius: var(--radius-md);
  margin-bottom: 0.5rem;
  border: 1px solid var(--border-color);
}

.player-strip.player-me {
  margin-top: 0.5rem;
  margin-bottom: 0;
}

.player-info-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.player-avatar-small {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--border-color);
  background: var(--bg-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  overflow: hidden;
}

.player-name-wrapper {
  display: flex;
  flex-direction: column;
}

.player-name-line {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 700;
  font-size: 0.95rem;
}

.title-badge-gm {
  background: #dc2626;
  color: #fff;
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.5px;
}
.title-badge-im {
  background: #d97706;
  color: #fff;
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 0.7rem;
  font-weight: 800;
}
.title-badge-fm {
  background: #2563eb;
  color: #fff;
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 0.7rem;
  font-weight: 800;
}
.title-badge-cm {
  background: #8b5cf6;
  color: #fff;
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 0.7rem;
  font-weight: 800;
}

.player-elo-sub {
  font-size: 0.75rem;
  color: var(--accent-gold);
  font-weight: 600;
}

.player-clock-box {
  background: #000;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.85rem;
  font-family: monospace;
  font-size: 1.15rem;
  font-weight: 800;
  color: #f1f5f9;
  letter-spacing: 1px;
}

.player-clock-box.active {
  border-color: var(--accent-emerald);
  color: #34d399;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.3);
}

.bot-thinking-badge {
  font-size: 0.75rem;
  color: var(--accent-cyan);
  font-style: italic;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* The Chessboard Grid */
.chessboard-wrapper {
  position: relative;
  width: 100%;
  max-width: 600px;
  aspect-ratio: 1 / 1;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
  border-radius: 6px;
  overflow: hidden;
  user-select: none;
}

.chessboard {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  width: 100%;
  height: 100%;
}

.square {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.square.light {
  background-color: var(--board-light);
}

.square.dark {
  background-color: var(--board-dark);
}

.square.selected {
  background-color: #f6f669 !important;
}

.square.last-move {
  background-color: rgba(247, 247, 105, 0.5) !important;
}

.square.in-check {
  background-color: var(--board-check-red) !important;
  animation: checkPulse 1s infinite alternate;
}

@keyframes checkPulse {
  from { background-color: rgba(239, 68, 68, 0.65); }
  to { background-color: rgba(239, 68, 68, 0.95); }
}

.square-coord {
  position: absolute;
  font-size: 0.65rem;
  font-weight: 700;
  pointer-events: none;
  opacity: 0.85;
}

.square.light .square-coord { color: var(--board-dark); }
.square.dark .square-coord { color: var(--board-light); }

.coord-file { bottom: 2px; right: 4px; }
.coord-rank { top: 2px; left: 4px; }

/* Move hint dots */
.hint-dot {
  width: 24%;
  height: 24%;
  background-color: rgba(16, 185, 129, 0.6);
  border-radius: 50%;
  pointer-events: none;
}

.hint-capture {
  width: 80%;
  height: 80%;
  border: 4px solid rgba(239, 68, 68, 0.65);
  border-radius: 50%;
  pointer-events: none;
}

/* Chess Pieces */
.chess-piece-svg {
  width: 85%;
  height: 85%;
  pointer-events: none;
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.3));
  transition: transform 0.1s ease;
}

.square:hover .chess-piece-svg {
  transform: scale(1.05);
}

/* Arena Sidebar */
.arena-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.coach-live-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  position: relative;
  overflow: hidden;
}

.coach-live-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.coach-live-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--accent-gold);
  overflow: hidden;
}

.coach-live-speech {
  background: var(--bg-surface-elevated);
  border-left: 3px solid var(--accent-gold);
  padding: 0.85rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.88rem;
  line-height: 1.45;
  color: #f1f5f9;
  min-height: 60px;
}

.notation-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  max-height: 280px;
}

.notation-header {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.5rem;
}

.moves-list {
  flex: 1;
  overflow-y: auto;
  font-family: monospace;
  font-size: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.move-row {
  display: grid;
  grid-template-columns: 32px 1fr 1fr;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
}

.move-row:nth-child(even) {
  background: rgba(255, 255, 255, 0.02);
}

.move-num { color: var(--text-dim); }
.move-white { font-weight: 600; color: #f8fafc; }
.move-black { font-weight: 600; color: #cbd5e1; }

.arena-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid var(--accent-ruby);
  color: #fca5a5;
  padding: 0.65rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-danger:hover {
  background: var(--accent-ruby);
  color: #fff;
}

.btn-secondary {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.65rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-secondary:hover {
  border-color: var(--text-dim);
}

/* Matchmaking Modal Overlay */
.matchmaking-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 14, 23, 0.88);
  backdrop-filter: blur(10px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
}

.matchmaking-overlay.active {
  display: flex;
}

.matchmaking-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 2.5rem;
  text-align: center;
  max-width: 440px;
  width: 90%;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
  animation: scaleUp 0.3s ease-out;
}

@keyframes scaleUp {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.radar-spinner {
  width: 80px;
  height: 80px;
  border: 4px solid var(--border-color);
  border-top-color: var(--accent-gold);
  border-radius: 50%;
  margin: 0 auto 1.5rem;
  animation: spin 1s linear infinite;
}

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

.matchmaking-title {
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
}

.matchmaking-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  z-index: 120;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-overlay.active {
  display: flex;
}

.modal-content {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 2rem;
  max-width: 850px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.85);
  animation: modalIn 0.25s ease-out;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.modal-title {
  font-size: 1.5rem;
  font-weight: 800;
}

/* Coach Grid Selection */
.coaches-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.25rem;
  margin-top: 1rem;
}

.coach-select-card {
  background: var(--bg-surface-elevated);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.coach-select-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent-gold);
  box-shadow: 0 10px 25px rgba(251, 191, 36, 0.2);
}

.coach-select-card.selected {
  border-color: var(--accent-gold);
  background: rgba(251, 191, 36, 0.08);
}

.coach-avatar-card {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  margin-bottom: 0.75rem;
  overflow: hidden;
  border: 2px solid var(--border-color);
  background: var(--bg-dark);
}

.coach-name-card {
  font-size: 1.1rem;
  font-weight: 800;
  margin-bottom: 0.2rem;
}

.coach-title-card {
  font-size: 0.75rem;
  color: var(--accent-gold);
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.coach-tagline-card {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.35;
  margin-bottom: 0.75rem;
}

.coach-stats-row {
  display: flex;
  justify-content: space-between;
  width: 100%;
  font-size: 0.75rem;
  color: var(--text-dim);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 0.5rem;
  margin-top: auto;
}

.btn-primary {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border: none;
  color: #0f172a;
  font-weight: 800;
  padding: 0.85rem 1.75rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 1rem;
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.35);
  transition: transform 0.15s, box-shadow 0.15s;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.5);
}

/* Registration Form */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--text-muted);
}

.form-input {
  width: 100%;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  color: var(--text-main);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}

.form-input:focus {
  border-color: var(--accent-gold);
}

.avatar-selector-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
}

.avatar-option {
  background: var(--bg-surface-elevated);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.65rem;
  font-size: 1.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.avatar-option:hover {
  border-color: var(--accent-gold);
}

.avatar-option.selected {
  border-color: var(--accent-gold);
  background: rgba(251, 191, 36, 0.15);
}

/* Game Over Dialog */
.gameover-box {
  text-align: center;
  max-width: 480px;
}

.gameover-icon {
  font-size: 3.5rem;
  margin-bottom: 0.5rem;
}

.gameover-title {
  font-size: 2rem;
  font-weight: 900;
  margin-bottom: 0.5rem;
}

.gameover-reason {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
}

.elo-change-card {
  background: var(--bg-surface-elevated);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.elo-score-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 0.5rem;
}

.elo-old {
  font-size: 1.2rem;
  color: var(--text-dim);
  text-decoration: line-through;
}

.elo-new {
  font-size: 2rem;
  font-weight: 900;
  color: #fef08a;
}

.elo-diff-pill {
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  font-weight: 800;
  font-size: 1rem;
}

/* Training Section */
.training-view {
  display: none;
}
.training-view.active {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 1.5rem;
}

@media (max-width: 1024px) {
  .training-view.active {
    grid-template-columns: 1fr;
  }
}

.training-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.training-coach-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  text-align: center;
}

.training-puzzle-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
}

.training-tip-box {
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: var(--radius-md);
  padding: 1rem;
  color: #c7d2fe;
  font-size: 0.9rem;
  line-height: 1.45;
  margin-top: 1rem;
}

/* Pawn Promotion Modal */
.promotion-dialog {
  display: flex;
  gap: 1rem;
  justify-content: center;
  padding: 1rem 0;
}

.promotion-piece-btn {
  background: var(--bg-surface-elevated);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  width: 70px;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.promotion-piece-btn:hover {
  border-color: var(--accent-gold);
  transform: scale(1.1);
}

.promotion-piece-btn svg {
  width: 50px;
  height: 50px;
}

/* Move Quality Badges on Board */
.move-quality-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 28px;
  height: 28px;
  z-index: 15;
  pointer-events: none;
  animation: badgePop 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

@keyframes badgePop {
  0% { transform: scale(0) rotate(-20deg); opacity: 0; }
  60% { transform: scale(1.3) rotate(5deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

.badge-brilliant-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.badge-blunder-svg, .badge-best-svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* Notation Tags */
.move-tag-brilliant {
  color: #14b8a6;
  font-weight: 800;
  text-shadow: 0 0 6px rgba(20, 184, 166, 0.4);
}
.move-tag-best {
  color: #81b64c;
  font-weight: 700;
  text-shadow: 0 0 6px rgba(129, 182, 76, 0.4);
}
.move-tag-blunder {
  color: #ef4444;
  font-weight: 800;
  text-shadow: 0 0 6px rgba(239, 68, 68, 0.4);
}

/* Coach Live Speech Highlights */
.coach-live-speech.speech-brilliant {
  border-left-color: #14b8a6;
  background: rgba(20, 184, 166, 0.12);
  box-shadow: 0 0 15px rgba(20, 184, 166, 0.25);
  animation: pulseSpeech 1.5s ease-in-out;
}

.coach-live-speech.speech-best {
  border-left-color: #81b64c;
  background: rgba(129, 182, 76, 0.15);
  box-shadow: 0 0 12px rgba(129, 182, 76, 0.25);
}

.coach-live-speech.speech-blunder {
  border-left-color: #ef4444;
  background: rgba(239, 68, 68, 0.14);
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.25);
  animation: shakeSpeech 0.4s ease-in-out;
}

@keyframes pulseSpeech {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}

@keyframes shakeSpeech {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}
