/* ==================== Fonts & Reset ==================== */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700;800&display=swap');

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

:root {
  --primary-color: #00D9A6;
  --secondary-color: #00BF91;
  --danger-color: #FF6B6B;
  --warning-color: #FFD93D;
  --text-dark: #2D3436;
  --text-light: #636E72;
  --bg-light: #F8F9FA;
  --snake-color: #00D9A6;
  --snake-head-color: #00BF91;
  --food-color: #FF6B6B;
  --board-bg: #1A1D29;
  --board-grid: #252938;
}

body {
  font-family: 'Poppins', sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
}

/* ==================== Game Header ==================== */
.game-header {
  text-align: center;
  padding: 2rem 1rem;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.game-title {
  font-size: 2.5rem;
  font-weight: 700;
  color: white;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.2);
}

.title-icon {
  font-size: 2.5rem;
}

.game-subtitle {
  font-size: 1.1rem;
  color: rgba(255, 255, 255, 0.9);
  margin: 0.5rem 0 0;
}

/* ==================== Game Container ==================== */
.game-container {
  flex: 1;
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 2rem;
  padding: 2rem 1rem;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
  align-items: start;
}

/* ==================== Sidebar ==================== */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  position: sticky;
  top: 2rem;
}

.difficulty-section,
.stats-section {
  background: rgba(255, 255, 255, 0.95);
  padding: 1.5rem;
  border-radius: 15px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

.section-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-dark);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 1rem;
  text-align: center;
}

/* Difficulty Buttons */
.difficulty-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.difficulty-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.5);
  border: 2px solid var(--text-light);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: 'Poppins', sans-serif;
}

.difficulty-btn:hover {
  transform: translateX(3px);
  border-color: var(--primary-color);
  background: rgba(255, 255, 255, 0.9);
}

.difficulty-btn.active {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  border-color: var(--primary-color);
  box-shadow: 0 4px 15px rgba(0, 217, 166, 0.4);
}

.diff-emoji {
  font-size: 1.8rem;
}

.diff-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-dark);
}

.difficulty-btn.active .diff-name,
.difficulty-btn.active .diff-speed {
  color: white;
}

.diff-speed {
  font-size: 0.8rem;
  color: var(--text-light);
}

/* Statistics */
.stat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem;
  background: var(--bg-light);
  border-radius: 8px;
  margin-bottom: 0.5rem;
}

.stat-item:last-of-type {
  margin-bottom: 1rem;
}

.stat-label {
  font-size: 0.9rem;
  color: var(--text-light);
  font-weight: 500;
}

.stat-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary-color);
}

/* Reset Stats Button */
.reset-stats-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: rgba(255, 107, 107, 0.1);
  color: var(--danger-color);
  border: 2px solid var(--danger-color);
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: 'Poppins', sans-serif;
}

.reset-stats-btn:hover {
  background: var(--danger-color);
  color: white;
  transform: translateX(3px);
}

.reset-stats-btn:active {
  transform: translateX(0);
}

.reset-stats-btn svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
}

/* ==================== Main Game Area ==================== */
.game-main {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  align-items: center;
}

/* Game Info */
.game-info {
  display: flex;
  gap: 1rem;
  width: 100%;
  max-width: 600px;
}

.info-item {
  flex: 1;
  background: rgba(255, 255, 255, 0.95);
  padding: 1rem;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.info-label {
  font-size: 0.85rem;
  color: var(--text-light);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.info-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--primary-color);
}

/* Game Board */
.game-board-container {
  position: relative;
  background: rgba(255, 255, 255, 0.95);
  padding: 1.5rem;
  border-radius: 20px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.play-board {
  width: 600px;
  height: 600px;
  display: grid;
  grid-template: repeat(30, 1fr) / repeat(30, 1fr);
  background: var(--board-bg);
  border-radius: 15px;
  overflow: hidden;
  position: relative;
}

.play-board .food {
  background: var(--food-color);
  border-radius: 50%;
  animation: foodPulse 0.6s ease-in-out infinite;
}

@keyframes foodPulse {
  0%, 100% {

/* Contact: 2952671670@qq.com */

    transform: scale(0.9);
/* Made with love by SinceraXY */
  }
  50% {
    transform: scale(1.1);
  }
}

.play-board .snake {
  background: var(--snake-color);
  border-radius: 3px;
}

.play-board .snake-head {
  background: var(--snake-head-color);
  border-radius: 5px;
  box-shadow: 0 0 10px rgba(0, 217, 166, 0.5);
}

/* Game Overlay */
.game-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 15px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  margin: 1.5rem;
  cursor: pointer;
}

.game-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.game-overlay.active:hover .overlay-content {
  transform: scale(1.05);
}

.overlay-content {
  text-align: center;
  color: white;
  transition: transform 0.3s ease;
}

.overlay-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  animation: pulse 1.5s ease-in-out infinite;
}

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

.overlay-text {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
}

.overlay-hint {
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.7);
  margin: 0;
}

/* Control Buttons */
.control-buttons {
  display: flex;
  gap: 1rem;
}

.control-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.875rem 1.75rem;
  background: rgba(255, 255, 255, 0.95);
  color: var(--text-dark);
  border: 2px solid transparent;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
  font-family: 'Poppins', sans-serif;
}

.control-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.control-btn:active:not(:disabled) {
  transform: translateY(0);
}

.control-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Mobile Controls */
.mobile-controls {
  display: none;
/* Contact: 2952671670@qq.com */
}

.control-dpad {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.95);
  padding: 1.5rem;
  border-radius: 20px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

.dpad-middle {
  display: flex;
  gap: 0.5rem;
}

.dpad-btn {
  width: 60px;
  height: 60px;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 1.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 10px rgba(0, 217, 166, 0.3);
}

.dpad-btn:active {
  transform: scale(0.95);
  box-shadow: 0 2px 5px rgba(0, 217, 166, 0.3);
}

.dpad-center {
  width: 60px;
  height: 60px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 12px;
}

/* ==================== Game Over Modal ==================== */
.game-over-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.game-over-modal.active {
  opacity: 1;
  pointer-events: all;
}

.modal-content {
  background: white;
  padding: 3rem 2.5rem;
  border-radius: 25px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  transform: scale(0.8);
  transition: transform 0.3s ease;
  max-width: 450px;
  width: 90%;
}

.game-over-modal.active .modal-content {
  transform: scale(1);
  animation: modalBounce 0.6s ease;
}

@keyframes modalBounce {
  0% {
    transform: scale(0.3) rotate(-5deg);
  }

/* Author: SinceraXY | China University of Petroleum, Beijing */
  50% {
    transform: scale(1.05) rotate(2deg);
  }
  100% {
    transform: scale(1) rotate(0deg);
  }
}

.modal-icon {
  font-size: 6rem;
  margin-bottom: 1rem;
}

.modal-title {
  font-size: 2.5rem;
  font-weight: 800;
  margin: 0 0 1.5rem;
  color: var(--text-dark);
}

.modal-stats {
  display: flex;
  gap: 2rem;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.modal-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.modal-stat-label {
  font-size: 0.9rem;
  color: var(--text-light);
  margin-bottom: 0.3rem;
}

.modal-stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary-color);
}

.modal-message {
  font-size: 1.1rem;
  color: var(--text-light);
  margin: 0 0 2rem;
}

.play-again-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 2.5rem;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 217, 166, 0.4);
  font-family: 'Poppins', sans-serif;
}

.play-again-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 217, 166, 0.5);
}

.play-again-btn:active {
  transform: translateY(0);
}

/* ==================== Responsive Design ==================== */
@media screen and (max-width: 1024px) {
  .game-container {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .sidebar {
    position: static;
    flex-direction: row;
  }

  .difficulty-section,
  .stats-section {
    flex: 1;
  }

  .play-board {
    width: 500px;
    height: 500px;
  }
}

@media screen and (max-width: 768px) {
  .game-title {
    font-size: 2rem;
  }

  .sidebar {
    flex-direction: column;
  }

  .play-board {
    width: 400px;
    height: 400px;
  }

  .mobile-controls {
    display: block;
  }

  .game-info {
    flex-wrap: wrap;
  }

  .info-item {
    min-width: calc(33.333% - 0.67rem);
  }

/* Developer: SinceraXY */
}

@media screen and (max-width: 480px) {
  .game-header {
    padding: 1.5rem 1rem;
  }

  .game-title {
    font-size: 1.75rem;
    flex-direction: column;
    gap: 0.5rem;
  }

  .game-subtitle {
    font-size: 1rem;
  }

  .play-board {
    width: 320px;
    height: 320px;
  }

  .game-board-container {
    padding: 1rem;
  }

  .info-value {
    font-size: 1.5rem;
  }

  .dpad-btn {
    width: 50px;
    height: 50px;
    font-size: 1.2rem;
  }

  .dpad-center {
    width: 50px;
    height: 50px;
  }
}