:root {
  --bg-deep: #0a0a12;
  --bg-panel: #12121e;
  --bg-card: #1a1a2e;
  --gold: #C9A84C;
  --gold-dim: #8a7333;
  --gold-bright: #e8c94a;
  --light-sq: #F0D9B5;
  --dark-sq: #B58863;
  --light-sq-blue: #DEE3E6;
  --dark-sq-blue: #8CA2AD;
  --light-sq-green: #FFFFDD;
  --dark-sq-green: #86A666;
  --light-sq-dark: #4a4a5a;
  --dark-sq-dark: #2a2a3a;
  --text-primary: #e8e6e3;
  --text-secondary: #8a8a9a;
  --red-check: #ff4444;
  --move-dot: rgba(0, 0, 0, 0.25);
  --highlight-selected: rgba(255, 255, 50, 0.4);
  --highlight-last: rgba(155, 135, 255, 0.3);
}

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

body {
  background: var(--bg-deep);
  color: var(--text-primary);
  font-family: 'JetBrains Mono', monospace;
  min-height: 100vh;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: 
    radial-gradient(ellipse at 20% 50%, rgba(201, 168, 76, 0.03) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(201, 168, 76, 0.02) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 80%, rgba(100, 80, 200, 0.02) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

#root { position: relative; z-index: 1; }

.font-display { font-family: 'Crimson Pro', serif; }
.font-mono { font-family: 'JetBrains Mono', monospace; }

@keyframes pulseCheck {
  0%, 100% { box-shadow: inset 0 0 20px rgba(255, 50, 50, 0.6); }
  50% { box-shadow: inset 0 0 35px rgba(255, 50, 50, 0.9); }
}

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

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

@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 15px rgba(201, 168, 76, 0.3); }
  50% { box-shadow: 0 0 25px rgba(201, 168, 76, 0.6); }
}

@keyframes confetti {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(300px) rotate(720deg); opacity: 0; }
}

@keyframes heroFloat {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-8px); }
}

.animate-fadeInUp { animation: fadeInUp 0.5s ease-out forwards; }
.animate-slideIn { animation: slideIn 0.3s ease-out forwards; }
.pulse-check { animation: pulseCheck 0.8s ease-in-out infinite; }
.glow-pulse { animation: glowPulse 2s ease-in-out infinite; }
.hero-float { animation: heroFloat 3s ease-in-out infinite; }

.chess-square {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  user-select: none;
  -webkit-user-select: none;
  transition: all 0.1s ease;
}

.chess-square:hover { filter: brightness(1.1); }

.chess-piece {
  font-size: clamp(28px, 5.5vw, 54px);
  line-height: 1;
  cursor: grab;
  transition: transform 0.1s ease;
  filter: drop-shadow(1px 1px 2px rgba(0,0,0,0.5));
  z-index: 2;
}

.chess-piece:active { cursor: grabbing; }

.chess-piece.white-piece {
  color: #fff;
  filter: drop-shadow(0 0 1px rgba(0,0,0,0.8)) drop-shadow(1px 1px 2px rgba(0,0,0,0.5));
}

.chess-piece.black-piece {
  color: #1a1a1a;
  filter: drop-shadow(0 0 1px rgba(255,255,255,0.3)) drop-shadow(1px 1px 2px rgba(0,0,0,0.5));
}

.move-dot {
  width: 28%;
  height: 28%;
  border-radius: 50%;
  background: var(--move-dot);
  position: absolute;
  z-index: 1;
}

.capture-ring {
  width: 85%;
  height: 85%;
  border-radius: 50%;
  border: 3px solid var(--move-dot);
  position: absolute;
  z-index: 1;
}

.mode-card {
  background: var(--bg-card);
  border: 1px solid rgba(201, 168, 76, 0.15);
  border-radius: 12px;
  padding: 28px 24px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
  flex: 1;
  min-width: 200px;
  max-width: 300px;
}

.mode-card:hover {
  transform: translateY(-4px) scale(1.02);
  border-color: var(--gold);
  box-shadow: 0 8px 30px rgba(201, 168, 76, 0.15), 0 0 60px rgba(201, 168, 76, 0.05);
}

.chat-bubble {
  max-width: 85%;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.4;
  word-wrap: break-word;
}

.chat-bubble.ai {
  background: rgba(201, 168, 76, 0.15);
  border: 1px solid rgba(201, 168, 76, 0.25);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.chat-bubble.user {
  background: rgba(100, 120, 200, 0.2);
  border: 1px solid rgba(100, 120, 200, 0.3);
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.move-list {
  font-size: 12px;
  line-height: 1.8;
}

.move-list span {
  cursor: pointer;
  padding: 1px 4px;
  border-radius: 3px;
  transition: background 0.15s;
}

.move-list span:hover {
  background: rgba(201, 168, 76, 0.2);
}

.btn-gold {
  background: linear-gradient(135deg, var(--gold), var(--gold-dim));
  color: #0a0a12;
  font-weight: 700;
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  transition: all 0.2s ease;
}

.btn-gold:hover {
  background: linear-gradient(135deg, var(--gold-bright), var(--gold));
  transform: translateY(-1px);
}

.btn-dark {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid rgba(201, 168, 76, 0.3);
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  transition: all 0.2s ease;
}

.btn-dark:hover {
  border-color: var(--gold);
  background: rgba(201, 168, 76, 0.1);
}

.scrollbar-thin::-webkit-scrollbar { width: 4px; }
.scrollbar-thin::-webkit-scrollbar-track { background: transparent; }
.scrollbar-thin::-webkit-scrollbar-thumb { background: var(--gold-dim); border-radius: 2px; }

@media (max-width: 768px) {
  .mode-card { min-width: 100%; max-width: 100%; padding: 20px 16px; }
}