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

:root {
  --ocean-blue: #0077be;
  --deep-blue: #003d5c;
  --light-blue: #87ceeb;
  --coral: #ff6b6b;
  --gold: #ffd700;
  --white: #ffffff;
  --dark: #2c3e50;
  --success: #2ecc71;
  --warning: #f39c12;
  --shadow: rgba(0, 0, 0, 0.2);
  --glass: rgba(255, 255, 255, 0.1);
}

body {
  font-family: 'Poppins', sans-serif;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: linear-gradient(180deg, var(--light-blue) 0%, var(--ocean-blue) 50%, var(--deep-blue) 100%);
  position: relative;
}

/* Animated background bubbles */
body::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    radial-gradient(circle at 20% 80%, rgba(255, 255, 255, 0.1) 2px, transparent 2px),
    radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.1) 1px, transparent 1px),
    radial-gradient(circle at 40% 40%, rgba(255, 255, 255, 0.05) 3px, transparent 3px);
  animation: float 25s infinite linear;
  pointer-events: none;
}

@keyframes float {
  0% { transform: translateY(100vh) rotate(0deg) scale(1); }
  50% { transform: translateY(0vh) rotate(180deg) scale(1.1); }
  100% { transform: translateY(-100vh) rotate(360deg) scale(1); }
}

/* Game Canvas */
#gameCanvas {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
  cursor: none;
}

/* Game UI Overlay */
#gameUI {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  pointer-events: none;
}

/* Header */
.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 30px;
  background: linear-gradient(135deg, var(--glass), rgba(255, 255, 255, 0.05));
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 20px var(--shadow);
}

.game-title {
  font-family: 'Fredoka One', cursive;
  font-size: 2rem;
  color: var(--white);
  text-shadow: 2px 2px 4px var(--shadow);
  margin: 0;
}

.header-right {
  display: flex;
  gap: 30px;
}

.stat-item {
  text-align: center;
  color: var(--white);
}

.stat-label {
  display: block;
  font-size: 0.8rem;
  opacity: 0.8;
  margin-bottom: 2px;
}

.stat-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 600;
  text-shadow: 1px 1px 2px var(--shadow);
}

/* Word Display */
.word-display {
  position: absolute;
  top: 120px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, var(--glass), rgba(255, 255, 255, 0.05));
  backdrop-filter: blur(10px);
  padding: 15px 30px;
  border-radius: 25px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 8px 25px var(--shadow);
}

.collected-word {
  text-align: center;
  color: var(--white);
}

.word-label {
  font-size: 0.9rem;
  opacity: 0.8;
  margin-right: 10px;
}

.word-text {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--gold);
  text-shadow: 1px 1px 2px var(--shadow);
  letter-spacing: 2px;
}

/* Game Controls */
.game-controls {
  position: absolute;
  top: 30px;
  right: 30px;
  display: flex;
  gap: 10px;
  pointer-events: auto;
}

.control-btn {
  background: linear-gradient(135deg, var(--coral), #ff5252);
  color: var(--white);
  border: none;
  padding: 10px 15px;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
}

.control-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
}

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

/* Instructions */
.instructions {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, var(--glass), rgba(0, 0, 0, 0.1));
  backdrop-filter: blur(10px);
  padding: 12px 25px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--white);
  font-size: 0.9rem;
  text-align: center;
  opacity: 0.9;
}

/* Modals */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  pointer-events: auto;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: linear-gradient(135deg, var(--white), #f8f9fa);
  padding: 40px;
  border-radius: 20px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  max-width: 400px;
  width: 90%;
  animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-50px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-content h2 {
  font-family: 'Fredoka One', cursive;
  color: var(--ocean-blue);
  margin-bottom: 20px;
  font-size: 1.8rem;
}

.final-stats {
  margin: 20px 0;
  padding: 20px;
  background: linear-gradient(135deg, var(--light-blue), rgba(135, 206, 235, 0.3));
  border-radius: 15px;
  border: 1px solid rgba(0, 119, 190, 0.2);
}

.final-stats p {
  margin: 8px 0;
  font-size: 1.1rem;
  color: var(--dark);
}

.final-stats span {
  font-weight: 600;
  color: var(--ocean-blue);
}

.modal-buttons {
  display: flex;
  gap: 15px;
  justify-content: center;
  margin-top: 25px;
}

.btn-primary, .btn-secondary {
  padding: 12px 25px;
  border: none;
  border-radius: 25px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-block;
}

.btn-primary {
  background: linear-gradient(135deg, var(--ocean-blue), var(--deep-blue));
  color: var(--white);
  box-shadow: 0 4px 15px rgba(0, 119, 190, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 119, 190, 0.4);
}

.btn-secondary {
  background: linear-gradient(135deg, var(--coral), #ff5252);
  color: var(--white);
  box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
}

.btn-secondary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
}

/* Loading Screen */
.loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, var(--light-blue) 0%, var(--ocean-blue) 50%, var(--deep-blue) 100%);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  color: var(--white);
}

.loading-content {
  text-align: center;
}

.fish-loader {
  font-size: 4rem;
  animation: swim 2s ease-in-out infinite;
  margin-bottom: 20px;
}

@keyframes swim {
  0%, 100% { transform: translateX(-20px) rotate(-5deg); }
  50% { transform: translateX(20px) rotate(5deg); }
}

.loading-content h2 {
  font-family: 'Fredoka One', cursive;
  font-size: 2rem;
  margin-bottom: 30px;
  text-shadow: 2px 2px 4px var(--shadow);
}

.loading-bar {
  width: 300px;
  height: 6px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
  overflow: hidden;
  margin: 0 auto;
}

.loading-progress {
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--coral));
  border-radius: 3px;
  animation: loading 3s ease-in-out;
}

@keyframes loading {
  0% { width: 0%; }
  100% { width: 100%; }
}

/* Responsive Design */
@media (max-width: 768px) {
  .game-header {
    padding: 15px 20px;
    flex-direction: column;
    gap: 15px;
  }
  
  .game-title {
    font-size: 1.5rem;
  }
  
  .header-right {
    gap: 20px;
  }
  
  .stat-value {
    font-size: 1.2rem;
  }
  
  .word-display {
    top: 140px;
    left: 20px;
    right: 20px;
    transform: none;
  }
  
  .game-controls {
    position: relative;
    top: auto;
    right: auto;
    justify-content: center;
    margin-top: 10px;
  }
  
  .instructions {
    bottom: 20px;
    left: 20px;
    right: 20px;
    transform: none;
    font-size: 0.8rem;
  }
  
  .modal-content {
    padding: 30px 20px;
    margin: 20px;
  }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* High contrast mode */
@media (prefers-contrast: high) {
  :root {
    --glass: rgba(255, 255, 255, 0.3);
    --shadow: rgba(0, 0, 0, 0.5);
  }
}