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

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

body {
  font-family: "Poppins", sans-serif;
  background: linear-gradient(135deg, #7dd3fc, #38bdf8);
  color: #1a1a1a;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Navigation Bar */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  background-color: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.logo {
  display: flex;
  align-items: center;
  font-weight: 700;
  font-size: 1.2rem;
}

.logo i {
  margin-right: 0.5rem;
  font-size: 1.4rem;
}

.nav-links {
  display: flex;
  gap: 1.5rem;
}

.nav-links a {
  color: #1a1a1a;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.3s;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.nav-links a:hover,
.nav-links a.active {
  color: #0369a1;
}

.theme-toggle {
  cursor: pointer;
  font-size: 1.2rem;
}

/* Hero Section */
.hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
}

h1 {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  color: #0c4a6e;
  text-align: center;
}

.subtitle {
  font-size: 1.2rem;
  margin-bottom: 2.5rem;
  max-width: 600px;
  color: #0c4a6e;
}

/* Action Buttons */
.action-buttons {
  display: flex;
  gap: 1rem;
  margin-bottom: 3rem;
}

.btn {
  padding: 0.8rem 1.5rem;
  border-radius: 0.5rem;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: transform 0.3s, box-shadow 0.3s;
  cursor: pointer;
  border: none;
}

.btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.primary {
  background-color: #0c4a6e;
  color: white;
}

.secondary {
  background-color: white;
  color: #0c4a6e;
}

/* Feature Cards */
.feature-cards {
  display: flex;
  gap: 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

.card {
  background-color: rgba(255, 255, 255, 0.8);
  padding: 2rem;
  border-radius: 1rem;
  text-align: center;
  flex: 1;
  position: relative;
  overflow: hidden;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s;
}

.card:hover {
  transform: translateY(-5px);
}

.card h3 {
  margin-bottom: 1rem;
  color: #0c4a6e;
}

.card p {
  color: #555;
  margin-bottom: 1rem;
}

.feature-icon {
  font-size: 2rem;
  color: #0c4a6e;
  opacity: 0.8;
}

/* Footer */
footer {
  text-align: center;
  padding: 1.5rem;
  background-color: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  color: #0c4a6e;
  margin-top: auto;
}

/* Content Container - Layout */
.content-container {
  display: flex;
  flex: 1;
}

/* Sidebar */
.sidebar {
  width: 250px;
  background-color: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  padding: 20px 0;
  flex-shrink: 0;
  border-right: 1px solid rgba(255, 255, 255, 0.2);
}

/* Scoreboard */
.scoreboard {
  padding: 15px;
  border-radius: 0;
  margin-bottom: 20px;
}

.scoreboard h3 {
  margin: 0;
  font-size: 20px;
  color: #0c4a6e;
  text-align: left;
  padding-left: 10px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.scoreboard ul {
  list-style: none;
  padding: 0;
  margin: 15px 0;
  text-align: left;
}

.scoreboard li {
  padding: 10px 15px;
  font-size: 16px;
  color: #1a1a1a;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.scoreboard li:last-child {
  border-bottom: none;
}

/* Game Area */
.game-area {
  flex-grow: 1;
  padding: 2rem;
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Rocket Container */
.rocket-container {
  position: relative;
  height: 150px;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  overflow: hidden;
  margin: 1.5rem 0;
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 1rem;
  backdrop-filter: blur(5px);
}

/* Rocket Image */
#rocket {
  width: 50px;
  position: absolute;
  bottom: 0;
  transition: bottom 0.2s ease-in-out;
}

/* Progress Bar Section */
.progress-section {
  margin: 1.5rem 0;
  width: 100%;
  background-color: rgba(255, 255, 255, 0.2);
  padding: 1rem;
  border-radius: 1rem;
  backdrop-filter: blur(5px);
}

.progress-info {
  display: flex;
  justify-content: space-between;
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
  color: #0c4a6e;
  font-weight: 500;
}

.progress-info i {
  margin-right: 0.3rem;
}

.progress-bar-container {
  width: 100%;
  height: 10px;
  background-color: rgba(255, 255, 255, 0.5);
  border-radius: 5px;
  overflow: hidden;
}

#progressBar {
  width: 0%;
  height: 100%;
  background-color: #0c4a6e;
  transition: width 0.2s ease-in-out;
}

/* Sentence Container */
.sentence-container {
  font-size: 1.3rem;
  margin: 1.5rem 0;
  padding: 1.5rem;
  background-color: rgba(255, 255, 255, 0.2);
  border-radius: 1rem;
  width: 100%;
  min-height: 100px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  backdrop-filter: blur(5px);
}

#sentenceContainer span {
  padding: 2px;
}

.correct {
  color: #0c4a6e;
  font-weight: 600;
}

.incorrect {
  color: #e11d48;
  text-decoration: underline;
}

/* Input Field */
#userInput {
  width: 100%;
  height: 100px;
  font-size: 1.1rem;
  padding: 1rem;
  margin: 1rem 0;
  border-radius: 0.5rem;
  border: 2px solid rgba(255, 255, 255, 0.3);
  background-color: rgba(255, 255, 255, 0.2);
  color: #0c4a6e;
  font-family: "Poppins", sans-serif;
  resize: none;
  backdrop-filter: blur(5px);
}

#userInput:focus {
  outline: none;
  border-color: #0c4a6e;
}

/* Restart Button */
#restartBtn {
  margin-top: 1rem;
}

/* Leaderboard Styles */
.leaderboard-container {
  max-width: 900px;
  margin: 2rem auto;
  padding: 0 1.5rem;
  flex: 1;
}

.time-tabs {
  display: flex;
  justify-content: center;
  margin: 2rem 0;
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 0.5rem;
  padding: 0.3rem;
  backdrop-filter: blur(5px);
}

.tab-btn {
  padding: 0.8rem 1.5rem;
  background: none;
  border: none;
  font-family: "Poppins", sans-serif;
  font-weight: 500;
  font-size: 1rem;
  color: #0c4a6e;
  cursor: pointer;
  border-radius: 0.3rem;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tab-btn:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

.tab-btn.active {
  background-color: rgba(255, 255, 255, 0.3);
  font-weight: 600;
}

.leaderboard-content {
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 1rem;
  padding: 2rem;
  backdrop-filter: blur(5px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.leaderboard-header {
  margin-bottom: 1.5rem;
}

.leaderboard-header h2 {
  color: #0c4a6e;
  font-size: 1.5rem;
  margin-bottom: 0.3rem;
}

.leaderboard-header p {
  color: #0c4a6e;
  opacity: 0.8;
}

.leaderboard-table-container {
  overflow-x: auto;
  margin-bottom: 2rem;
}

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.leaderboard-table th {
  background-color: rgba(255, 255, 255, 0.2);
  padding: 1rem;
  font-weight: 600;
  color: #0c4a6e;
}

.leaderboard-table th:first-child {
  border-top-left-radius: 0.5rem;
}

.leaderboard-table th:last-child {
  border-top-right-radius: 0.5rem;
}

.leaderboard-table td {
  padding: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.leaderboard-table tr:last-child td {
  border-bottom: none;
}

.leaderboard-table tr:hover td {
  background-color: rgba(255, 255, 255, 0.1);
}

.rank-1,
.rank-2,
.rank-3 {
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.rank-1 i {
  color: gold;
}

.rank-2 i {
  color: silver;
}

.rank-3 i {
  color: #cd7f32; /* bronze */
}

.your-position {
  margin-top: 2rem;
}

.your-position h3 {
  color: #0c4a6e;
  margin-bottom: 1rem;
}

.position-card {
  background-color: rgba(255, 255, 255, 0.2);
  border-radius: 0.8rem;
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.position-rank {
  font-size: 2rem;
  font-weight: 700;
  color: #0c4a6e;
  min-width: 60px;
  text-align: center;
}

.position-details {
  flex: 1;
}

.position-name {
  font-weight: 600;
  font-size: 1.2rem;
  color: #0c4a6e;
  display: block;
  margin-bottom: 0.5rem;
}

.position-stats {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.position-stats span {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  color: #0c4a6e;
}

.position-btn {
  padding: 0.6rem 1rem;
}

/* Highlight animation for new entries */
@keyframes highlight {
  0% {
    background-color: rgba(255, 255, 255, 0.4);
  }
  100% {
    background-color: transparent;
  }
}

.highlight {
  animation: highlight 2s ease-out;
}

/* Responsive Design */
@media (max-width: 900px) {
  .feature-cards {
    flex-direction: column;
    padding: 0 1rem;
  }

  h1 {
    font-size: 2rem;
  }

  .position-card {
    flex-direction: column;
    text-align: center;
  }

  .position-stats {
    justify-content: center;
    margin-bottom: 1rem;
  }
}

@media (max-width: 768px) {
  .navbar {
    flex-direction: column;
    gap: 1rem;
  }

  .nav-links {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
  }

  .action-buttons {
    flex-direction: column;
  }

  .content-container {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  }

  .game-area {
    padding: 1rem;
  }

  .time-tabs {
    flex-direction: column;
    gap: 0.5rem;
  }
}

/* Dark Mode */
body.dark {
  background: linear-gradient(135deg, #0f172a, #1e293b);
  color: #f1f5f9;
}

body.dark .navbar,
body.dark footer,
body.dark .sidebar {
  background-color: rgba(15, 23, 42, 0.3);
  border-color: rgba(255, 255, 255, 0.1);
}

body.dark .nav-links a {
  color: #f1f5f9;
}

body.dark .nav-links a:hover,
body.dark .nav-links a.active {
  color: #38bdf8;
}

body.dark h1,
body.dark .subtitle,
body.dark .scoreboard h3,
body.dark .progress-info {
  color: #f1f5f9;
}

body.dark .scoreboard li {
  color: #e2e8f0;
  border-color: rgba(255, 255, 255, 0.1);
}

body.dark .primary {
  background-color: #38bdf8;
  color: #0f172a;
}

body.dark .secondary {
  background-color: #1e293b;
  color: #f1f5f9;
  border: 1px solid #38bdf8;
}

body.dark .rocket-container,
body.dark .progress-section,
body.dark .sentence-container,
body.dark #userInput {
  background-color: rgba(15, 23, 42, 0.5);
}

body.dark #progressBar {
  background-color: #38bdf8;
}

body.dark .correct {
  color: #38bdf8;
}

body.dark .incorrect {
  color: #f43f5e;
}

body.dark #userInput {
  color: #f1f5f9;
  border-color: rgba(255, 255, 255, 0.1);
}

body.dark #userInput:focus {
  border-color: #38bdf8;
}

body.dark footer {
  color: #cbd5e1;
}

body.dark .time-tabs,
body.dark .leaderboard-content,
body.dark .position-card {
  background-color: rgba(15, 23, 42, 0.5);
}

body.dark .tab-btn,
body.dark .leaderboard-header h2,
body.dark .leaderboard-header p,
body.dark .leaderboard-table th,
body.dark .position-rank,
body.dark .position-name,
body.dark .position-stats span,
body.dark .your-position h3 {
  color: #f1f5f9;
}

body.dark .tab-btn:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

body.dark .tab-btn.active {
  background-color: rgba(255, 255, 255, 0.15);
}

body.dark .leaderboard-table th {
  background-color: rgba(255, 255, 255, 0.1);
}

body.dark .leaderboard-table td {
  border-color: rgba(255, 255, 255, 0.1);
}

body.dark .leaderboard-table tr:hover td {
  background-color: rgba(255, 255, 255, 0.05);
}

