/* ==================== CSS Reset & Base Styles ==================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary-color: #3b82f6;
  --primary-dark: #2563eb;
  --primary-light: #60a5fa;
  --secondary-color: #ec4899;
  --success-color: #10b981;
  --warning-color: #f59e0b;
  --danger-color: #ef4444;
  --text-light: #ffffff;
  --text-dark: #1f2937;
  --text-game: #2d3748;
  --bg-overlay: rgba(255, 255, 255, 0.85);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.15);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.2);
}

body {
  font-family: 'Poppins', sans-serif;
  background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 50%, #7dd3fc 100%);
  min-height: 100vh;
  overflow: hidden;
  color: var(--text-dark);
}

/* ==================== Screen Transitions ==================== */
.screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55), opacity 0.4s ease;
  z-index: 10;
}

.screen.up {
  transform: translateY(-100vh);
  opacity: 0;
  pointer-events: none;
  z-index: 1;
}

.start-screen {
  z-index: 15;
}

.select-screen {
  z-index: 14;
}

.game-screen {
  z-index: 13;
}

.screen-content {
  text-align: center;
  padding: 2rem;
  max-width: 800px;
  animation: fadeInUp 0.8s ease;
  position: relative;
  z-index: 2;
}

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

/* ==================== Start Screen ==================== */
.game-logo {
  margin-bottom: 2rem;
}

/* Author: SinceraXY | China University of Petroleum, Beijing */

.logo-icon {
  font-size: 5rem;
  display: block;
  margin-bottom: 1rem;
  animation: bounce 2s infinite;
}

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

.game-title {
  font-size: 3.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: #1e40af;
  text-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

/* Gradient text effect for modern browsers */
@supports (background-clip: text) or (-webkit-background-clip: text) {
  .game-title {
    background: linear-gradient(135deg, #1e40af, #3b82f6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: transparent;
  }
}

.game-subtitle {
  font-size: 1.25rem;
  margin-bottom: 2.5rem;
  color: #475569;
  opacity: 1;
}

.game-features {
  display: flex;
  gap: 2rem;
  justify-content: center;
  margin-top: 3rem;
}

.feature {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
}

.feature-icon {
  font-size: 2rem;
}

/* ==================== Buttons ==================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1rem 2.5rem;
  font-size: 1.1rem;
  font-weight: 600;
  font-family: 'Poppins', sans-serif;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
/* Made with love by SinceraXY */
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
  z-index: 3;
}

.btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
  width: 300px;
  height: 300px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  color: var(--text-light);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(99, 102, 241, 0.4);
}

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

.btn-secondary {
  background: rgba(255, 255, 255, 0.8);
  color: #475569;
  border: 2px solid rgba(59, 130, 246, 0.3);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 1);
  border-color: rgba(59, 130, 246, 0.5);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(59, 130, 246, 0.3);
}

.btn-icon {
  width: 20px;
  height: 20px;
  position: relative;
  z-index: 1;
  flex-shrink: 0;
  margin-right: 0.5rem;
}

.btn-secondary .btn-icon {
  stroke: #475569;
}

.btn-primary .btn-icon {
  stroke: currentColor;
}

/* ==================== Select Screen ==================== */
.select-title {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  font-weight: 700;
  color: #1e40af;
}

.select-subtitle {
  font-size: 1.1rem;
  color: #475569;
  opacity: 1;
  margin-bottom: 3rem;
}

.insects-list {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.5rem;
  list-style: none;
  max-width: 900px;
  margin: 0 auto;
  flex-wrap: nowrap;
}

.choose-insect-btn {
  background: rgba(255, 255, 255, 0.7);
  border: 3px solid rgba(59, 130, 246, 0.3);
  border-radius: 16px;
  padding: 0;
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.choose-insect-btn:hover {
  transform: translateY(-5px);
  border-color: rgba(59, 130, 246, 0.6);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 10px 30px rgba(59, 130, 246, 0.3);
}

.insect-card {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.insect-emoji {
  font-size: 4rem;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
}

.insect-name {
  font-size: 1.1rem;
  font-weight: 600;
  color: #1e293b;
}

.difficulty {
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.difficulty.easy {
  background: var(--success-color);
  color: white;
}

.difficulty.medium {
  background: var(--warning-color);
  color: white;
}

.difficulty.hard {
  background: var(--danger-color);
  color: white;
}

.difficulty.expert {
  background: var(--secondary-color);
  color: white;
}

/* ==================== Game Screen ==================== */
.game-screen {
  background: transparent;
  position: relative;
}

.game-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 2rem;
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(10px);
  z-index: 10;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.game-stats {
  display: flex;
  gap: 2rem;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.8);
  padding: 0.5rem 1rem;
  border-radius: 10px;
  backdrop-filter: blur(5px);
  color: var(--text-dark);
}

.stat-icon {
  width: 24px;
  height: 24px;
  stroke: #475569;
}

.stat-value {
  font-size: 1.1rem;
  font-weight: 600;
  min-width: 50px;
  text-align: left;
}

.score-stat {
/* Email: 2952671670@qq.com */
  background: linear-gradient(135deg, var(--warning-color), #f97316);
}

.lives-stat {
  background: linear-gradient(135deg, var(--danger-color), #dc2626);
  font-size: 1.2rem;
}

.lives-stat .stat-value {
  font-size: 1rem;
  letter-spacing: 2px;
}

.game-controls {
  display: flex;
  gap: 0.75rem;
}

.control-btn {
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.8);
  border: 2px solid rgba(59, 130, 246, 0.2);
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  backdrop-filter: blur(5px);
}

.control-btn:hover {
  background: rgba(255, 255, 255, 1);
  border-color: rgba(59, 130, 246, 0.4);
  transform: scale(1.1);
}

.control-btn svg {
  width: 20px;
  height: 20px;
  fill: #475569;
  stroke: #475569;
}

/* ==================== Score Popup Animation ==================== */
@keyframes scorePopup {
  0% {
    transform: translate(-50%, -50%) scale(0.5);
    opacity: 1;
  }
  50% {
    transform: translate(-50%, -80%) scale(1.2);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -120%) scale(1);
    opacity: 0;
  }
}

/* ==================== Insects ==================== */
.insect {
  position: absolute;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: crosshair;
  z-index: 5;
  font-size: 3.5rem;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
  user-select: none;
  pointer-events: all;
  animation: insectFloat 3s ease-in-out infinite;
}

@keyframes insectFloat {
  0%, 100% { 
    transform: translate(-50%, -50%) translateY(0) rotate(0deg); 
  }
  25% { 
    transform: translate(-50%, -50%) translateY(-8px) rotate(3deg); 
  }
  50% { 
    transform: translate(-50%, -50%) translateY(0) rotate(0deg); 
  }
  75% { 
    transform: translate(-50%, -50%) translateY(8px) rotate(-3deg); 
  }
}

.insect:hover {
  animation-play-state: paused;
  transform: translate(-50%, -50%) scale(1.2);
  transition: transform 0.2s ease;
}

.insect.caught {
  animation: none;
  transform: translate(-50%, -50%) scale(0) rotate(360deg);
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
}

.insect.escaped {
  animation: escapeAnim 0.3s ease-out forwards;
  pointer-events: none;
}

@keyframes escapeAnim {
  0% {
    transform: translate(-50%, -50%) scale(1);
/* QQ: 2952671670 */
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -150%) scale(0.5);
    opacity: 0;
  }
}

/* ==================== Message Overlay ==================== */
.message {
  position: absolute;
  top: 150px;
  left: 50%;
  transform: translateX(-50%) scale(0);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  border: 2px solid rgba(59, 130, 246, 0.4);
  padding: 1.2rem 2rem;
  border-radius: 16px;
  text-align: center;
  opacity: 0;
  transition: all 0.4s ease;
  z-index: 3;
  box-shadow: 0 4px 20px rgba(59, 130, 246, 0.3);
  pointer-events: none;
  max-width: 90%;
  color: var(--text-dark);
}

.message.visible {
  transform: translateX(-50%) scale(1);
  opacity: 0.95;
}

.message-emoji {
  font-size: 2rem;
  display: block;
  margin-bottom: 0.5rem;
}

.message-title {
  font-size: 1.3rem;
  margin-bottom: 0.5rem;
  font-weight: 600;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.message-text {
  font-size: 0.95rem;
  opacity: 0.95;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* ==================== Pause & Game Over Overlays ==================== */
.pause-overlay,
.gameover-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-overlay);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 100;
}

.pause-overlay.active,
.gameover-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.pause-content,
.gameover-content {
  background: rgba(255, 255, 255, 0.98);
  padding: 3rem 4rem;
  border-radius: 24px;
  text-align: center;
  backdrop-filter: blur(20px);
  border: 2px solid rgba(59, 130, 246, 0.3);
  animation: popIn 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  color: var(--text-dark);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

@keyframes popIn {
  0% {
    transform: scale(0.8);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.pause-content h2,
.gameover-title {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;

/* Made with love */

  color: #1e40af;
}

.gameover-subtitle {
  font-size: 1rem;
  color: #64748b;
  opacity: 1;
  margin-bottom: 1.5rem;
}

.pause-content p {
  font-size: 1.1rem;
  color: #64748b;
  opacity: 1;
  margin-bottom: 2rem;
}

.pause-content .btn,
.gameover-buttons .btn {
  margin: 0.5rem;
}

.final-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  margin: 2rem 0;
  padding-bottom: 1.5rem;
  border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

.final-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.final-stat.highlight {
  transform: scale(1.1);
}

.final-label {
  font-size: 0.9rem;
  color: #64748b;
  opacity: 1;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.final-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--warning-color);
}

.final-stat.highlight .final-value {
  font-size: 2.5rem;
  background: linear-gradient(135deg, var(--warning-color), #fbbf24);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Extra Stats */
.final-stats-extra {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: 1.5rem 0;
  padding: 1.5rem;
  background: rgba(59, 130, 246, 0.08);
  border-radius: 12px;
  border: 1px solid rgba(59, 130, 246, 0.2);
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1.1rem;
}

.stat-label {
  color: #475569;
  opacity: 1;
  font-weight: 500;
}

.stat-number {
  font-weight: 700;
  color: var(--warning-color);
  font-size: 1.2rem;
}

.gameover-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: 2rem;
}

/* Created by SinceraXY */

/* ==================== Responsive Design ==================== */
@media screen and (max-width: 768px) {
  .game-title {
    font-size: 2.5rem;
  }
  
  .game-subtitle {
    font-size: 1rem;
  }
  
  .game-features {
    gap: 1rem;
    font-size: 0.8rem;
  }
  
  .insects-list {
    flex-wrap: wrap;
    gap: 1rem;
  }
  
  .choose-insect-btn {
    flex: 0 1 calc(50% - 0.5rem);
  }
  
  .insect-card {
    padding: 1rem;
  }
  
  .insect-emoji {
    font-size: 3rem;
  }
  
  .game-header {
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
  }
  
  .game-stats {
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
  }
  
  .stat-item {
    padding: 0.4rem 0.8rem;
    font-size: 0.9rem;
  }
  
  .insect {
    width: 60px;
    height: 60px;
    font-size: 2.5rem;
  }
  
  .final-stats {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .final-stats-extra {
    font-size: 1rem;
  }
  
  .pause-content,
  .gameover-content {
    padding: 2rem;
    margin: 1rem;
  }
  
  .gameover-buttons {
    flex-direction: column;
  }
  
  .gameover-buttons .btn {
    width: 100%;
  }
}

@media screen and (max-width: 480px) {
  .game-title {
    font-size: 2rem;
  }
  
  .btn {
    padding: 0.75rem 1.5rem;
    font-size: 0.9rem;
  }
  
  .insects-list {
    flex-direction: column;
    max-width: 300px;
  }
  
  .choose-insect-btn {
    flex: 1 1 100%;
  }
  
  .insect {
    width: 50px;
    height: 50px;
    font-size: 2rem;
  }
}
