/* Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Light Mode (Default) */
body {
  text-align: center;
  margin: 0;
  padding: 0;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  color: #333;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  transition: all 0.5s ease;
  overflow-x: hidden;
}

.container {
  max-width: 700px;
  width: 90%;
  margin-top: 10rem;
  padding: 30px;
  background: linear-gradient(to bottom, #ffffff, #f0f0f0);
  border-radius: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  transition: all 0.5s ease;
  transform: translateY(0);
  animation: float 6s ease-in-out infinite;
  position: relative;
}

@keyframes float {
  0% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-10px);
  }
  100% {
    transform: translateY(0px);
  }
}

h2 {
  color: #333;
  font-size: 2.5rem;
  margin-bottom: 20px;
  position: relative;
  display: inline-block;
}

h2::after {
  content: '';
  position: absolute;
  width: 50%;
  height: 4px;
  background: linear-gradient(90deg, #4776E6, #8E54E9);
  bottom: -10px;
  left: 25%;
  border-radius: 10px;
  animation: expandWidth 2s ease-in-out;
}

@keyframes expandWidth {
  0% {
    width: 0;
    left: 50%;
  }
  100% {
    width: 50%;
    left: 25%;
  }
}

#text {
  font-size: 1.2rem;
  line-height: 1.6;
  margin: 25px auto;
  padding: 15px;
  border-radius: 12px;
  background-color: rgba(255, 255, 255, 0.7);
  color: #444;
  max-width: 90%;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

#text::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, 
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.8) 50%,
    rgba(255, 255, 255, 0) 100%);
  animation: shine 3s infinite;
}

@keyframes shine {
  to {
    left: 100%;
  }
}

textarea {
  width: 90%;
  height: 120px;
  margin: 20px 0;
  padding: 15px;
  font-size: 1.1rem;
  border: 2px solid #ddd;
  border-radius: 12px;
  outline: none;
  resize: none;
  background: white;
  color: #333;
  transition: all 0.3s ease;
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.05);
}

textarea:focus {
  border-color: #4776E6;
  box-shadow: 0 0 15px rgba(71, 118, 230, 0.3);
  transform: translateY(-2px);
}

.stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 20px;
  margin: 25px 0;
}

.stat-card {
  background: linear-gradient(135deg, #fff 0%, #f9f9f9 100%);
  border-radius: 15px;
  padding: 15px;
  min-width: 130px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
  transition: all 0.3s ease;
}

.stat-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.stat-label {
  font-size: 0.9rem;
  color: #888;
  margin-bottom: 5px;
}

.stat-value {
  font-size: 1.8rem;
  font-weight: bold;
  background: linear-gradient(90deg, #4776E6, #8E54E9);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

button {
  margin: 20px 10px;
  padding: 12px 30px;
  font-size: 1rem;
  font-weight: 600;
  color: white;
  background: linear-gradient(90deg, #4776E6, #8E54E9);
  border: none;
  border-radius: 30px;
  cursor: pointer;
  transition: all 0.3s ease;
  transform: scale(1);
  box-shadow: 0 5px 15px rgba(71, 118, 230, 0.4);
}

button:hover {
  transform: scale(1.05);
  box-shadow: 0 8px 20px rgba(71, 118, 230, 0.5);
}

button:active {
  transform: scale(0.98);
}

.correct {
  color: #4CAF50;
}

.incorrect {
  color: #F44336;
  position: relative;
}

/* Navbar */
.navbar {
  position: fixed;
  top: 0;
  right: 0;
  width: 100%;
  background: linear-gradient(90deg, #4776E6, #8E54E9);
  padding: 15px;
  text-align: right;
  z-index: 1000;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.toggle-dark-mode {
  background: white;
  color: #4776E6;
  border: none;
  padding: 10px 20px;
  cursor: pointer;
  font-size: 1rem;
  border-radius: 30px;
  transition: all 0.3s ease;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.toggle-dark-mode:hover {
  background: rgba(255, 255, 255, 0.8);
  transform: translateY(-2px);
}

.moon-icon {
  display: inline-block;
  transform-origin: center;
  transition: transform 0.5s ease;
}

.toggle-dark-mode:hover .moon-icon {
  transform: rotate(30deg);
}

/* Dark Mode Styles */
.dark-mode {
  background: linear-gradient(135deg, #2b5876 0%, #4e4376 100%);
  color: white;
}

.dark-mode .container {
  background: linear-gradient(to bottom, #2a2a2a, #1a1a1a);
  color: white;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.dark-mode h2 {
  color: white;
}

.dark-mode h2::after {
  background: linear-gradient(90deg, #ff7e5f, #feb47b);
}

.dark-mode #text {
  background-color: rgba(50, 50, 50, 0.7);
  color: #ddd;
}

.dark-mode textarea {
  background: #333;
  color: white;
  border: 2px solid #555;
}

.dark-mode textarea:focus {
  border-color: #ff7e5f;
  box-shadow: 0 0 15px rgba(255, 126, 95, 0.3);
}

.dark-mode .stat-card {
  background: linear-gradient(135deg, #333 0%, #222 100%);
}

.dark-mode .stat-label {
  color: #aaa;
}

.dark-mode .stat-value {
  background: linear-gradient(90deg, #ff7e5f, #feb47b);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.dark-mode button {
  background: linear-gradient(90deg, #ff7e5f, #feb47b);
  box-shadow: 0 5px 15px rgba(255, 126, 95, 0.4);
}

.dark-mode button:hover {
  box-shadow: 0 8px 20px rgba(255, 126, 95, 0.5);
}

.dark-mode .navbar {
  background: linear-gradient(90deg, #2b5876, #4e4376);
}

.dark-mode .toggle-dark-mode {
  background: #333;
  color: #ff7e5f;
}

.dark-mode .toggle-dark-mode:hover {
  background: rgba(51, 51, 51, 0.8);
}

/* Results Animation */
@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

.pulse {
  animation: pulse 1s infinite;
}

/* Responsive Design */
@media (max-width: 768px) {
  .container {
    width: 95%;
    padding: 20px;
  }

  h2 {
    font-size: 2rem;
  }

  .stats {
    flex-direction: column;
    align-items: center;
    gap: 10px;
  }

  .stat-card {
    width: 80%;
  }
}

/* Typing animation for text */
.animated-text {
  position: relative;
  width: fit-content;
  margin: 0 auto;
}

.animated-text::after {
  content: '|';
  position: absolute;
  right: -8px;
  animation: blink 1s infinite;
}

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

/* Success animation */
.success-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
}

.success-message {
  background: white;
  padding: 30px;
  border-radius: 20px;
  text-align: center;
  transform: scale(0.8);
  transition: transform 0.5s ease;
}

.success-overlay.show {
  opacity: 1;
  pointer-events: all;
}

.success-overlay.show .success-message {
  transform: scale(1);
}

.confetti {
  position: absolute;
  width: 10px;
  height: 10px;
  background: #f00;
  border-radius: 50%;
}