/* Custom Styles and Micro-Animations for Live TypeRush */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

:root {
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

body {
  font-family: var(--font-sans);
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Glassmorphism & Custom Shadows */
.glass-panel {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.4);
}

.dark .glass-panel {
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.glass-modal {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.dark .glass-modal {
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

/* Typography & Typing Area */
.typing-box {
  font-family: var(--font-mono);
  font-size: 1.35rem;
  line-height: 2.1rem;
  letter-spacing: 0.02em;
  user-select: none;
  -webkit-user-select: none;
}

@media (max-width: 640px) {
  .typing-box {
    font-size: 1.1rem;
    line-height: 1.8rem;
  }
}

/* Character Styling */
.char {
  position: relative;
  transition: color 0.15s ease, background-color 0.15s ease;
  border-radius: 2px;
}

.char.untyped {
  color: #94a3b8;
  /* slate-400 */
}

.dark .char.untyped {
  color: #475569;
  /* slate-600 */
}

.char.correct {
  color: #10b981;
  /* emerald-500 */
}

.dark .char.correct {
  color: #34d399;
  /* emerald-400 */
}

.char.incorrect {
  color: #ef4444;
  /* red-500 */
  background-color: rgba(239, 68, 68, 0.15);
  text-decoration: underline;
  text-decoration-color: #ef4444;
}

.dark .char.incorrect {
  color: #f87171;
  /* red-400 */
  background-color: rgba(248, 113, 113, 0.2);
}

/* Space Error Highlighting */
.char.incorrect.space-error {
  background-color: rgba(239, 68, 68, 0.25);
  border-bottom: 2px solid #ef4444;
}

/* Advanced Live Character Tracking Styles */

/* Blind Mode - Neutral Error Display during Exam */
.char.blind-mode {
  color: #1e293b !important;
  background-color: rgba(148, 163, 184, 0.15) !important;
  text-decoration: none !important;
}

.dark .char.blind-mode {
  color: #f1f5f9 !important;
  background-color: rgba(148, 163, 184, 0.2) !important;
}

/* Skipped Character */
.char.skipped {
  color: #f59e0b;
  /* amber-500 */
  background-color: rgba(245, 158, 11, 0.15);
  text-decoration: line-through;
}

.dark .char.skipped {
  color: #fbbf24;
  /* amber-400 */
  background-color: rgba(251, 191, 36, 0.2);
}

/* Word States: Active & Locked Word */
.word.active {
  background-color: rgba(99, 102, 241, 0.08);
  border-bottom: 2px solid #6366f1;
  border-radius: 4px;
}

.dark .word.active {
  background-color: rgba(129, 140, 248, 0.1);
  border-bottom: 2px solid #818cf8;
}

.word.locked {
  opacity: 0.65;
  pointer-events: none;
}

/* Smooth Caret Cursor Animation */
.cursor {
  display: inline-block;
  width: 1px;
  background-color: #6366f1;
  /* indigo-500 */
  position: absolute;
  left: 0;
  top: 0;
  border-radius: 2px;
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.8);
  transition: left 0.06s cubic-bezier(0.1, 0, 0.1, 1), top 0.06s cubic-bezier(0.1, 0, 0.1, 1);
  z-index: 10;
  pointer-events: none;
}

.dark .cursor {
  background-color: #818cf8;
  /* indigo-400 */
  box-shadow: 0 0 10px rgba(129, 140, 248, 0.8);
}

.cursor.blink {
  animation: pulseCaret 1s infinite;
}

@keyframes pulseCaret {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0;
  }
}

/* Custom Scrollbar for Text Display */
.typing-scroll::-webkit-scrollbar {
  width: 6px;
}

.typing-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.typing-scroll::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.3);
  border-radius: 9999px;
}

.dark .typing-scroll::-webkit-scrollbar-thumb {
  background: rgba(71, 85, 105, 0.4);
}

/* Timer Progress Bar Smooth Transition */
#progress-bar {
  transition: width 0.2s linear, background-color 0.5s ease;
}

/* Focus Ring Customization */
button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 2px solid #6366f1;
  outline-offset: 2px;
}

/* Modal Fade Animation */
.modal-enter {
  opacity: 0;
  transform: scale(0.95) translateY(10px);
}

.modal-enter-active {
  opacity: 1;
  transform: scale(1) translateY(0);
  transition: opacity 0.3s ease-out, transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Keyboard badge design */
.kbd-badge {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.15rem 0.4rem;
  border-radius: 0.375rem;
  background: rgba(226, 232, 240, 0.8);
  border: 1px solid rgba(203, 213, 225, 0.8);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.dark .kbd-badge {
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(51, 65, 85, 0.8);
  color: #cbd5e1;
}

/* Print Certificate Media Styles */
@media print {
  body * {
    visibility: hidden;
  }

  #exam-cert-modal,
  #exam-cert-modal * {
    visibility: visible;
  }

  #exam-cert-modal {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: white !important;
    padding: 0 !important;
  }

  .print\:hidden {
    display: none !important;
  }
}