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

body {
  font-family: 'Segoe UI', sans-serif;
  background-image: url("https://img.pikbest.com/photo/20240608/a-person-hands-typing-on-a-laptop-keyboard-in-dark-moody-environment_10603724.jpg!w700wp");
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center center;
  background-attachment: fixed;
  min-height: 100vh;
  display: flex; flex-direction: column; align-items: center;
  padding-top: 80px;
  color: #fff;
}

.menu {
  font-size: medium; position: fixed; top: 0; width: 100%;
  background: #18293b; color: white;
  display: flex; justify-content: space-between; align-items: center;
  padding: 15px 40px; box-shadow: 0 2px 10px rgba(0,0,0,0.2); z-index: 10;
}

.menu ul { list-style: none; display: flex; gap: 20px; }
.menu a {
  color: #ecf0f1; text-decoration: none; padding: 8px 12px; border-radius: 4px;
  transition: background-color 0.3s, color 0.3s;
}
.menu a:hover { background-color: #ffffff22; color: #ffd700; transform: scale(1.1); }

/* Typing Test Section */
#typing-section { min-height: 100vh; display: flex; align-items: center; justify-content: center; }

/* FAQ Section */
#faq-section {
  opacity: 0; transform: translateY(50px);
  transition: opacity 1s ease, transform 1s ease;
  padding: 100px 20px; width: 50%;
}
#faq-section.visible { opacity: 1; transform: translateY(0); }

.card {
  background: rgb(35, 58, 84);
  border-radius: 12px; padding: 30px; width: 680px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.1); text-align: center;
  transition: all 0.3s ease; animation: fadeIn 0.5s ease forwards;
}
.card h1 { color: #e0d9ca; }
.hidden { display: none !important; }

#app { color: antiquewhite; padding: 40px; font-size: 20px;
  display: flex; flex-direction: column; justify-content: center; gap: 20px; }
#app h1 { font-size: 40px; }

.controls { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.level-group, .action-group { display: flex; gap: 10px; flex-wrap: wrap; }

.level-btn.active { outline: 2px solid #fff; box-shadow: 0 0 0 3px #27ae60 inset; }

.quote {
  font-size: 1.25rem; line-height: 1.75rem;
  background: rgba(0,0,0,0.25); border-radius: 10px; padding: 16px;
  text-align: left; min-height: 72px; position: relative;
  user-select: none;
}

.quote .char { opacity: 0.9; }
.quote .char.correct { color: #9be7a9; }
.quote .char.incorrect { color: #ff8a8a; text-decoration: underline; }
.quote .char.pending { color: #eaefef; opacity: 0.65; }

.caret {
  display: inline-block; width: 2px; height: 1.2em; vertical-align: bottom;
  background: #fff; animation: blink 1s step-end infinite;
  margin-left: 1px;
}
@keyframes blink { 50% { opacity: 0; } }

textarea {
  width: 100%; height: 120px; padding: 15px; font-size: 1.05rem;
  border: 2px solid #ccc; border-radius: 8px; resize: none;
  outline: none;
}

.stats { display: flex; justify-content: space-around; margin: 20px 0; flex-wrap: wrap; }
.stat-box { text-align: center; margin: 10px; }
.stat-box p { font-size: 1.1rem; }
.stat-box span { font-size: 1.3rem; }

.btn {
  background: #27ae60; color: white; border: none; padding: 10px 18px;
  border-radius: 8px; cursor: pointer; font-size: 0.95rem; transition: background 0.3s, transform 0.1s;
}
.btn:hover { background: #1e8449; }
.btn:active { transform: scale(0.98); }

.loader { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 15px; padding: 50px; }
.spinner {
  border: 4px solid #f3f3f3; border-top: 4px solid #2980b9; border-radius: 50%;
  width: 40px; height: 40px; animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

.glow-box { display: inline-block; padding: 10px; border-radius: 16px; position: relative; z-index: 0; }
.glow-box::before {
  content: ''; position: absolute; top: -2px; left: -2px; right: -2px; bottom: -2px;
  background: linear-gradient(270deg, #00bfff, #ffffff, #1e90ff, #00bfff);
  background-size: 400% 400%; border-radius: 18px; z-index: -1; filter: blur(5px); animation: glow 4s ease infinite;
}
@keyframes glow { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }

/* Nav Button */
.nav-btn {
  position: relative; display: inline-block; padding: 10px 20px; color: white; text-decoration: none;
  font-weight: bold; border-radius: 10px; overflow: hidden; transition: color 0.3s ease;
  background: linear-gradient(to right, #00bfff, #0077ff);
}
.nav-btn::before {
  content: ''; position: absolute; top: 0; left: -100%; width: 100%; height: 100%;
  background: rgba(255, 255, 255, 0.2); transition: left 0.4s;
}
.nav-btn:hover::before { left: 100%; }
.nav-btn:hover { color: #ffffff; box-shadow: 0 0 10px #00bfff, 0 0 20px #0077ff; transform: scale(1.05); }

/* FAQ */
.modern-faq-section { background-color: #0f0f0f; padding: 20px; color: #fff; font-family: 'Poppins', sans-serif; text-align: center; }
.faq-title {
  font-size: 2.2rem; font-weight: bold;
  background: linear-gradient(90deg, #5b6eff, #ff5f6d, #a855f7);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; margin-bottom: 28px;
}
.faq-container { max-width: 520px; margin: auto; }
.faq-item { margin-bottom: 16px; background: #5a85c6; border-radius: 15px; box-shadow: 0 0 20px rgba(255, 255, 255, 0.05); overflow: hidden; transition: 0.3s ease; }
.faq-question { width: 100%; text-align: left; padding: 16px 20px; font-size: 18px; font-weight: 600; background: none; border: none; color: #fff; cursor: pointer; outline: none; }
.faq-question:hover { background: linear-gradient(90deg, #5b6eff, #a855f7); color: white; }
.faq-answer { max-height: 0; overflow: hidden; padding: 0 20px; background-color: #251545; transition: max-height 0.4s ease, padding 0.4s ease; }
.faq-answer p { margin: 12px 0; font-size: 18px; line-height: 1.6; }
.faq-item.active .faq-answer { max-height: 220px; padding: 16px 20px; }

.faq-glow-container {
  position: relative; padding: 2px; border-radius: 20px;
  background: linear-gradient(270deg, #ff7300, #ff00c8, #00ffe7, #00ff00, #ff7300);
  background-size: 800% 800%; animation: borderGlow 8s ease infinite;
  box-shadow: 0 0 30px rgba(0, 255, 150, 0.3), 0 0 60px rgba(0, 200, 255, 0.2);
  transition: transform 0.5s ease;
}
.faq-inner { border-radius: 18px; background: #0e0e0e; padding: 2rem; color: #fff; }
@keyframes borderGlow { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }

footer { margin: 40px 0; color: white; font-size: 14px; }

/* Leaderboard Container */
.leaderboard {
  width: 400px;
  max-height: 500px;
  margin: 30px auto;
  padding: 20px;
  background: #111;
  color: #fff;
  border-radius: 16px;
  box-shadow: 0 0 15px rgba(255, 0, 0, 0.6);
  text-align: center;
  overflow-y: auto;
}

/* Leaderboard Heading */
.leaderboard h2 {
  font-size: 24px;
  margin-bottom: 15px;
  color: #ff4444;
  text-shadow: 0 0 8px rgba(255, 68, 68, 0.8);
}

/* Leaderboard List */
.leaderboard ol {
  list-style: none;
  padding: 0;
  margin: 0;
}

.leaderboard li {
  font-size: 18px;
  padding: 10px;
  margin: 6px 0;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  transition: transform 0.2s ease-in-out, background 0.2s;
}

.leaderboard li:hover {
  transform: scale(1.05);
  background: rgba(255, 68, 68, 0.3);
}

/* Top 3 Highlight */
.leaderboard li:nth-child(1) {
  background: gold;
  color: black;
  font-weight: bold;
}
.leaderboard li:nth-child(2) {
  background: silver;
  color: black;
  font-weight: bold;
}
.leaderboard li:nth-child(3) {
  background: #cd7f32; /* bronze */
  color: black;
  font-weight: bold;
}
.toast {
  position: fixed;
  bottom: 30px;
  right: 30px;
  background: #111;
  color: #fff;
  padding: 12px 20px;
  border-radius: 8px;
  box-shadow: 0 0 10px rgba(255,0,0,0.7);
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s ease-in-out;
  z-index: 9999;
}
.toast.show {
  opacity: 1;
  transform: translateY(0);
}
