* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-dark: #1a1a2e;
  --bg-light: #2a2a3e;
  --text-light: #ffffff;
  --text-dim: #b8b8d1;
  --accent: #4a9eff;
  --board-light: #f0d9b5;
  --board-dark: #b58863;
  --highlight: rgba(255, 255, 0, 0.4);
  --check: rgba(255, 0, 0, 0.5);
  --move-hint: rgba(74, 158, 255, 0.3);
}

body {
  font-family: 'Segoe UI', Arial, sans-serif;
  background: linear-gradient(135deg, var(--bg-dark) 0%, var(--bg-light) 100%);
  color: var(--text-light);
  min-height: 100vh;
  padding: 20px;
  display: flex;
  flex-direction: column;
}

.home-btn {
  position: fixed;
  top: 20px;
  left: 20px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-light);
  padding: 10px 20px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all 0.3s;
  z-index: 100;
}

.home-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.game-container {
  max-width: 1400px;
  margin: 60px auto 40px;
  flex: 1;
}

.header {
  text-align: center;
  margin-bottom: 30px;
}

.header h1 {
  font-size: 3rem;
  margin-bottom: 20px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.info {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 30px;
  flex-wrap: wrap;
}

.player-turn {
  background: rgba(255, 255, 255, 0.1);
  padding: 12px 24px;
  border-radius: 8px;
  backdrop-filter: blur(10px);
  border: 2px solid rgba(255, 255, 255, 0.2);
}

.turn-indicator {
  font-size: 1.2rem;
  font-weight: 700;
}

.btn-restart {
  background: var(--accent);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
}

.btn-restart:hover {
  background: #3a8eef;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(74, 158, 255, 0.4);
}

.game-board-wrapper {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 30px;
  margin-bottom: 30px;
  flex-wrap: wrap;
}

.board-container {
  position: relative;
}

.chess-board {
  display: grid;
  grid-template-columns: repeat(8, 80px);
  grid-template-rows: repeat(8, 80px);
  border: 4px solid #3d3d3d;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
  background: #3d3d3d;
}

.square {
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  cursor: pointer;
  position: relative;
  transition: background-color 0.2s;
  user-select: none;
}

.square.light {
  background-color: var(--board-light);
}

.square.dark {
  background-color: var(--board-dark);
}

.square.selected {
  background-color: var(--highlight) !important;
  box-shadow: inset 0 0 0 3px rgba(255, 255, 0, 0.8);
}

.square.possible-move {
  position: relative;
}

.square.possible-move::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  background: var(--move-hint);
  border-radius: 50%;
  border: 2px solid rgba(74, 158, 255, 0.6);
}

.square.possible-capture::after {
  width: 70px;
  height: 70px;
  background: transparent;
  border: 3px solid rgba(255, 100, 100, 0.6);
  border-radius: 0;
}

.square.in-check {
  background-color: var(--check) !important;
  animation: pulse-check 1s infinite;
}

@keyframes pulse-check {
  0%, 100% {
    box-shadow: inset 0 0 0 3px rgba(255, 0, 0, 0.8);
  }
  50% {
    box-shadow: inset 0 0 0 5px rgba(255, 0, 0, 1);
  }
}

.piece {
  font-size: 48px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}

.piece.black {
  color: #1a1a1a;
  text-shadow: 0 0 2px rgba(255, 255, 255, 0.3);
}

.piece.white {
  color: #ffffff;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

.captured-pieces {
  background: rgba(255, 255, 255, 0.05);
  padding: 20px;
  border-radius: 12px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  min-width: 200px;
  max-width: 250px;
}

.captured-label {
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text-dim);
  font-size: 0.9rem;
}

.captured-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 50px;
}

.captured-piece {
  font-size: 32px;
  opacity: 0.7;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.message {
  text-align: center;
  margin-top: 20px;
  padding: 15px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  font-size: 1.1rem;
  font-weight: 600;
  display: none;
  backdrop-filter: blur(10px);
}

.message.show {
  display: block;
}

.message.checkmate {
  background: rgba(255, 100, 100, 0.2);
  border: 2px solid rgba(255, 100, 100, 0.5);
}

.message.stalemate {
  background: rgba(255, 200, 0, 0.2);
  border: 2px solid rgba(255, 200, 0, 0.5);
}

.controls {
  max-width: 900px;
  margin: 0 auto;
}

.move-history-container {
  background: rgba(255, 255, 255, 0.05);
  padding: 20px;
  border-radius: 12px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.move-history-container h3 {
  margin-bottom: 15px;
  color: var(--text-dim);
}

.move-history {
  max-height: 200px;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}

.move-entry {
  background: rgba(255, 255, 255, 0.05);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.95rem;
}

.move-number {
  font-weight: 700;
  color: var(--accent);
  margin-right: 8px;
}

/* Footer Styles - Unified Design */
.site-footer {
  padding: 0.6rem 0;
  text-align: center;
  border-top: 1px solid rgba(255, 255, 255, 0.03);
  background: linear-gradient(180deg, rgba(2, 6, 23, 0.28), rgba(2, 6, 23, 0.18));
  backdrop-filter: blur(6px) saturate(120%);
  color: rgba(234, 246, 255, 0.86);
  margin-top: auto;
}

.site-footer a {
  color: rgba(0, 212, 255, 1);
  text-decoration: none;
  font-weight: 600;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.footer-inner {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 0.5rem;
}

.footer-left {
  flex: 0 0 auto;
  color: #99b8d1;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.footer-left > a {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.footer-left .powered-logo {
  height: 20px;
  width: auto;
  max-height: 20px;
  max-width: 120px;
  display: inline-block;
  margin-left: 0;
  vertical-align: middle;
  filter: drop-shadow(0 6px 12px rgba(124, 92, 255, 0.06));
  object-fit: contain;
  flex-shrink: 0;
}

.footer-center {
  flex: 1 1 auto;
  display: flex;
  justify-content: center;
  gap: 12px;
}

.footer-center a {
  color: #99b8d1;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  padding-bottom: 2px;
  transition: color 0.18s, border-color 0.18s;
  font-size: 0.95rem;
}

.footer-center a:hover {
  color: rgba(0, 212, 255, 1);
  border-color: rgba(0, 212, 255, 0.25);
}

.footer-right {
  flex: 0 0 auto;
  display: flex;
  gap: 8px;
  align-items: center;
}

.social-icon {
  height: 28px;
  width: 28px;
  display: inline-block;
  object-fit: contain;
  filter: drop-shadow(0 6px 16px rgba(124, 92, 255, 0.1));
}

.logo-footer {
  height: 40px;
  margin-right: 12px;
  filter: drop-shadow(0 8px 22px rgba(124, 92, 255, 0.08));
}

/* Responsive Design */
@media (max-width: 1200px) {
  .game-board-wrapper {
    flex-direction: column;
    align-items: center;
  }

  .captured-pieces {
    max-width: 640px;
    width: 100%;
  }

  .captured-list {
    justify-content: center;
  }
}

@media (max-width: 768px) {
  .chess-board {
    grid-template-columns: repeat(8, 60px);
    grid-template-rows: repeat(8, 60px);
  }

  .square {
    width: 60px;
    height: 60px;
    font-size: 36px;
  }

  .piece {
    font-size: 36px;
  }

  .header h1 {
    font-size: 2rem;
  }

  .home-btn {
    padding: 8px 16px;
    font-size: 0.9rem;
  }
}

@media (max-width: 540px) {
  .chess-board {
    grid-template-columns: repeat(8, 45px);
    grid-template-rows: repeat(8, 45px);
  }

  .square {
    width: 45px;
    height: 45px;
    font-size: 28px;
  }

  .piece {
    font-size: 28px;
  }
}

@media (max-width: 720px) {
  .footer-inner {
    flex-direction: column;
    gap: 8px;
    align-items: center;
    text-align: center;
    padding: 0;
  }

  .footer-center {
    order: 3;
  }

  .footer-left {
    justify-content: center;
  }

  .site-footer {
    padding: 1rem 0;
  }
}
