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

:root {
  --bg-dark: #0f0f1a;
  --bg-darker: #080810;
  --accent-purple: #9333ea;
  --accent-orange: #f97316;
  --accent-gold: #fbbf24;
  --light-square: #f5deb3;
  --dark-square: #8b4513;
  --text-light: #e5e5e5;
  --text-muted: #888;
  --move-highlight: rgba(34, 197, 94, 0.5);
  --capture-highlight: rgba(239, 68, 68, 0.5);
  --attack-highlight: rgba(255, 165, 0, 0.6);
}

body {
  font-family: 'Space Grotesk', sans-serif;
  background: linear-gradient(135deg, var(--bg-dark) 0%, var(--bg-darker) 100%);
  min-height: 100vh;
  color: var(--text-light);
}

.app-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.game-header {
  text-align: center;
  padding: 1.5rem 1rem;
  background: linear-gradient(180deg, rgba(147, 51, 234, 0.2) 0%, transparent 100%);
  border-bottom: 1px solid rgba(147, 51, 234, 0.3);
}

.game-title {
  font-family: 'Fredoka', sans-serif;
  font-size: 3rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent-purple) 0%, var(--accent-orange) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 0 40px rgba(147, 51, 234, 0.5);
  cursor: pointer;
}

.game-subtitle {
  color: var(--text-muted);
  margin-top: 0.5rem;
  font-size: 1.1rem;
}

.header-controls {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.btn {
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 500;
  font-size: 0.95rem;
  transition: all 0.2s;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-purple) 0%, var(--accent-orange) 100%);
  color: white;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(147, 51, 234, 0.4);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-light);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* Main game area */
.game-main {
  flex: 1;
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  padding: 1.5rem;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

/* Roster panel */
.roster-panel {
  width: 280px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 12px;
  padding: 1rem;
  border: 1px solid rgba(147, 51, 234, 0.3);
  max-height: 600px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.roster-panel h3 {
  font-family: 'Fredoka', sans-serif;
  color: var(--accent-gold);
  margin-bottom: 0.5rem;
}

.seed-display {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  font-family: monospace;
}

.roster-list {
  overflow-y: auto;
  flex: 1;
}

.roster-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s;
}

.roster-item:hover {
  background: rgba(147, 51, 234, 0.2);
}

.roster-emoji {
  font-size: 1.5rem;
}

.roster-name {
  flex: 1;
  font-size: 0.9rem;
}

.roster-power {
  font-size: 0.7rem;
}

/* Board container */
.board-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

/* Status bar */
.status-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1.5rem;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 50px;
  min-width: 300px;
  justify-content: center;
}

.turn-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
}

.turn-orb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  animation: pulse 1.5s infinite;
}

.turn-indicator.white .turn-orb {
  background: white;
  box-shadow: 0 0 10px white;
}

.turn-indicator.black .turn-orb {
  background: #333;
  border: 2px solid #666;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.1); opacity: 0.8; }
}

.check-alert {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  padding: 0.4rem 1rem;
  border-radius: 20px;
  font-weight: 600;
  animation: flash 0.5s infinite;
}

@keyframes flash {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.game-over-banner {
  background: linear-gradient(135deg, var(--accent-gold), var(--accent-orange));
  padding: 0.5rem 1.5rem;
  border-radius: 20px;
  font-weight: 700;
  color: black;
  font-size: 1.1rem;
}

/* Captured pieces */
.captured-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  min-width: 300px;
  min-height: 44px;
}

.captured-label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.captured-piece {
  font-size: 1.3rem;
}

/* Chess board */
.chess-board {
  display: flex;
  flex-direction: column;
  background: #2a1810;
  padding: 4px;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6), 0 0 60px rgba(147, 51, 234, 0.2);
}

.board-labels-row {
  display: flex;
}

.label-corner {
  width: 24px;
  height: 24px;
}

.col-label {
  width: 52px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.board-row {
  display: flex;
}

.row-label {
  width: 24px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.board-square {
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: all 0.15s;
}

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

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

.board-square.selected {
  box-shadow: inset 0 0 0 3px var(--accent-gold), inset 0 0 20px rgba(251, 191, 36, 0.5);
}

.board-square.move-target {
  background: var(--move-highlight);
}

.board-square.move-target.light {
  background: linear-gradient(135deg, var(--light-square), rgba(34, 197, 94, 0.6));
}

.board-square.move-target.dark {
  background: linear-gradient(135deg, var(--dark-square), rgba(34, 197, 94, 0.6));
}

.board-square.capture-target {
  background: var(--capture-highlight);
}

.board-square.capture-target.light {
  background: linear-gradient(135deg, var(--light-square), rgba(239, 68, 68, 0.6));
}

.board-square.capture-target.dark {
  background: linear-gradient(135deg, var(--dark-square), rgba(239, 68, 68, 0.6));
}

.board-square.under-attack {
  box-shadow: inset 0 0 0 3px rgba(255, 165, 0, 0.9), inset 0 0 15px rgba(255, 165, 0, 0.4);
}

.board-square.under-attack.light {
  background: linear-gradient(135deg, var(--light-square), rgba(255, 165, 0, 0.35));
}

.board-square.under-attack.dark {
  background: linear-gradient(135deg, var(--dark-square), rgba(255, 165, 0, 0.35));
}

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

/* Piece container with background circle */
.piece-container {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 2;
}

.piece-container.white-bg {
  background: radial-gradient(circle, #ffffff 0%, #e8e8e8 70%, #d0d0d0 100%);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3), inset 0 1px 2px rgba(255, 255, 255, 0.8);
}

.piece-container.black-bg {
  background: radial-gradient(circle, #3a3a3a 0%, #1a1a1a 70%, #0a0a0a 100%);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5), inset 0 1px 2px rgba(255, 255, 255, 0.1);
}

.piece {
  font-size: 1.8rem;
  filter: drop-shadow(1px 2px 2px rgba(0, 0, 0, 0.4));
  transition: transform 0.15s;
  user-select: none;
}

.piece-container:hover .piece {
  transform: scale(1.1);
}

.piece.capturable {
  animation: shake 0.3s ease-in-out infinite;
}

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

.white-piece {
  filter: drop-shadow(1px 2px 3px rgba(0, 0, 0, 0.5));
}

.black-piece {
  filter: drop-shadow(1px 2px 3px rgba(0, 0, 0, 0.5));
}

.move-dot {
  position: absolute;
  width: 18px;
  height: 18px;
  background: rgba(34, 197, 94, 0.8);
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.6);
  z-index: 1;
}

.capture-ring {
  position: absolute;
  width: 46px;
  height: 46px;
  border: 4px solid rgba(239, 68, 68, 0.9);
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.5), inset 0 0 10px rgba(239, 68, 68, 0.3);
  animation: pulse-ring 1s ease-in-out infinite;
}

@keyframes pulse-ring {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.05); opacity: 0.8; }
}

/* Difficulty selector */
.difficulty-selector {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
}

.diff-btn {
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: transparent;
  color: var(--text-light);
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s;
}

.diff-btn.active {
  background: var(--accent-purple);
  border-color: var(--accent-purple);
}

.diff-btn:hover:not(.active) {
  background: rgba(255, 255, 255, 0.1);
}

/* Info panel */
.info-panel {
  width: 260px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 12px;
  padding: 1rem;
  border: 1px solid rgba(249, 115, 22, 0.3);
}

.info-panel h3 {
  font-family: 'Fredoka', sans-serif;
  color: var(--accent-orange);
  margin-bottom: 1rem;
}

.piece-card {
  text-align: center;
}

.piece-card-emoji {
  font-size: 4rem;
  margin-bottom: 0.5rem;
}

.piece-card-name {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.4rem;
  color: var(--text-light);
  margin-bottom: 0.5rem;
}

.piece-card-power {
  color: var(--accent-gold);
  margin-bottom: 1rem;
}

.piece-card-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 1rem;
}

.move-badges {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
}

.move-badge {
  width: 36px;
  height: 36px;
  background: rgba(147, 51, 234, 0.3);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.no-selection {
  color: var(--text-muted);
  font-style: italic;
  text-align: center;
}

/* Footer */
.game-footer {
  text-align: center;
  padding: 1rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  display: flex;
  justify-content: center;
  gap: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.game-footer a {
  color: var(--accent-purple);
  text-decoration: none;
}

.game-footer a:hover {
  text-decoration: underline;
}

/* Shuffle overlay */
.shuffle-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.shuffle-text {
  font-family: 'Fredoka', sans-serif;
  font-size: 2rem;
  color: var(--accent-gold);
  margin-bottom: 2rem;
  animation: bounce 0.5s ease infinite alternate;
}

@keyframes bounce {
  from { transform: translateY(-5px); }
  to { transform: translateY(5px); }
}

.shuffle-emojis {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  max-width: 400px;
}

.shuffle-emoji {
  font-size: 2rem;
  animation: spin 0.6s ease-in-out infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(180deg) scale(1.2); }
  100% { transform: rotate(360deg) scale(1); }
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 1rem;
}

.modal-content {
  background: var(--bg-dark);
  border: 1px solid var(--accent-purple);
  border-radius: 16px;
  padding: 2rem;
  max-width: 500px;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-content h2 {
  font-family: 'Fredoka', sans-serif;
  color: var(--accent-gold);
  margin-bottom: 1rem;
}

.modal-content h3 {
  font-family: 'Fredoka', sans-serif;
  color: var(--accent-orange);
  margin: 1.5rem 0 0.75rem;
}

.modal-content ul {
  list-style: none;
  padding-left: 0;
}

.modal-content li {
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  line-height: 1.4;
}

.modal-content .btn {
  margin-top: 1.5rem;
  width: 100%;
}

/* Responsive */
@media (max-width: 1100px) {
  .roster-panel {
    display: none;
  }
}

@media (max-width: 900px) {
  .game-main {
    flex-direction: column;
    align-items: center;
  }
  
  .info-panel {
    width: 100%;
    max-width: 440px;
  }
}

@media (max-width: 500px) {
  .game-title {
    font-size: 2rem;
  }
  
  .board-square {
    width: 40px;
    height: 40px;
  }
  
  .col-label {
    width: 40px;
  }
  
  .row-label {
    height: 40px;
    width: 20px;
  }
  
  .piece-container {
    width: 32px;
    height: 32px;
  }
  
  .piece {
    font-size: 1.4rem;
  }
  
  .header-controls {
    gap: 0.5rem;
  }
  
  .btn {
    padding: 0.5rem 0.8rem;
    font-size: 0.85rem;
  }
  
  .status-bar {
    min-width: unset;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
  }
  
  .captured-row {
    min-width: unset;
    font-size: 0.85rem;
  }
  
  .captured-piece {
    font-size: 1.1rem;
  }
  
  .move-dot {
    width: 12px;
    height: 12px;
  }
  
  .capture-ring {
    width: 34px;
    height: 34px;
    border-width: 3px;
  }
}