:root {
  --primary-color: #6366f1;
  --secondary-color: #4f46e5;
  --accent-color: #8b5cf6;
  --text-color: #1f2937;
  --bg-color: #f3f4f6;
  --card-bg: #ffffff;
  --border-color: #e5e7eb;
  --success-color: #10b981;
  --error-color: #ef4444;
  --warning-color: #f59e0b;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.dark-theme {
  --text-color: #f9fafb;
  --bg-color: #111827;
  --card-bg: #1f2937;
  --border-color: #374151;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
}

.blue-theme {
  --primary-color: #3b82f6;
  --secondary-color: #2563eb;
  --accent-color: #60a5fa;
  --bg-color: #eff6ff;
  --card-bg: #ffffff;
  --text-color: #1e3a8a;
}

.pink-theme {
  --primary-color: #ec4899;
  --secondary-color: #db2777;
  --accent-color: #f472b6;
  --bg-color: #fdf2f8;
  --card-bg: #ffffff;
  --text-color: #831843;
}

.purple-theme {
  --primary-color: #7c3aed;
  --secondary-color: #6d28d9;
  --accent-color: #8b5cf6;
  --bg-color: #faf5ff;
  --card-bg: #ffffff;
  --text-color: #4c1d95;
}

.green-theme {
  --primary-color: #059669;
  --secondary-color: #06d47e;
  --accent-color: #06d455;
  --bg-color: #ecfeff;
  --card-bg: #ffffff;
  --text-color: #164e63;
}

.orange-theme {
  --primary-color: #ea580c;
  --secondary-color: #dc2626;
  --accent-color: #f97316;
  --bg-color: #fff7ed;
  --card-bg: #ffffff;
  --text-color: #9a3412;
}

.cyan-theme {
  --primary-color: #0891b2;
  --secondary-color: #0e7490;
  --accent-color: #06b6d4;
  --bg-color: #ecfeff;
  --card-bg: #ffffff;
  --text-color: #164e63;
}

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

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  line-height: 1.6;
  transition: var(--transition);
  overflow-x: hidden;
  position: relative;
  min-height: 100vh;
}

.topographic-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: linear-gradient(rgba(255, 255, 255, 0.05) 1px,
      transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 20px 20px;
  z-index: -1;
  opacity: 0.3;
}

.dark-theme .topographic-bg {
  background-image: linear-gradient(rgba(0, 0, 0, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.05) 1px, transparent 1px);
}

.container {
  max-width: 1400px;
  width: 90%;
  margin: 0 auto;
  padding: 2rem;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

h1 {
  font-size: 2.5rem;
  background: linear-gradient(135deg,
      var(--primary-color),
      var(--accent-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.user-status {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--card-bg);
  padding: 0.5rem 1rem;
  border-radius: 50px;
  box-shadow: var(--shadow);
}

.user-name {
  font-weight: 500;
  color: var(--text-color);
  font-size: 0.95rem;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg,
      var(--primary-color),
      var(--accent-color));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
  overflow: hidden;
  border: 2px solid white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.help-btn {
  background: var(--card-bg);
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  box-shadow: var(--shadow);
  transition: var(--transition);
}

.help-btn:hover {
  transform: scale(1.1);
  background: var(--primary-color);
  color: white;
}

button {
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition);
  font-weight: 600;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  font-size: 0.95rem;
}

button:hover {
  background: var(--secondary-color);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

button:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

button.secondary {
  background: transparent;
  color: var(--primary-color);
  border: 1px solid var(--primary-color);
}

button.secondary:hover {
  background: var(--primary-color);
  color: white;
}

.settings-panel {
  background: var(--card-bg);
  padding: 1.5rem;
  border-radius: 10px;
  margin-bottom: 2rem;
  box-shadow: var(--shadow);
}

.game-mode-selector {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.game-mode-btn {
  padding: 0.5rem 1rem;
  border-radius: 5px;
  cursor: pointer;
  transition: var(--transition);
  background: var(--bg-color);
  flex: 1;
  text-align: center;
  min-width: 120px;
}

.game-mode-btn.active {
  background: var(--primary-color);
  color: white;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
}

.setting-group {
  margin-bottom: 1rem;
}

label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

label #volume-value {
  color: var(--primary-color);
  font-weight: 600;
}

select,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"] {
  width: 100%;
  padding: 0.5rem;
  border-radius: 5px;
  border: 1px solid var(--border-color);
  background: var(--bg-color);
  color: var(--text-color);
}

input[type="range"] {
  width: 100%;
  height: 6px;
  border-radius: 5px;
  background: var(--border-color);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary-color);
  cursor: pointer;
  transition: var(--transition);
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 0 0 8px rgba(99, 102, 241, 0.1);
}

input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary-color);
  cursor: pointer;
  border: none;
  transition: var(--transition);
}

input[type="range"]::-moz-range-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 0 0 8px rgba(99, 102, 241, 0.1);
}

input[type="range"]::-webkit-slider-runnable-track {
  width: 100%;
  height: 6px;
  cursor: pointer;
  background: linear-gradient(to right, var(--primary-color) 0%, var(--primary-color) var(--value, 70%), var(--border-color) var(--value, 70%), var(--border-color) 100%);
  border-radius: 5px;
}

input[type="range"]::-moz-range-track {
  width: 100%;
  height: 6px;
  cursor: pointer;
  background: var(--border-color);
  border-radius: 5px;
}

.mode-settings {
  display: none;
}

.mode-settings.active {
  display: block;
}

.test-area {
  background: var(--card-bg);
  padding: 2rem;
  border-radius: 10px;
  margin-bottom: 2rem;
  box-shadow: var(--shadow);
  position: relative;
}

.timer {
  position: absolute;
  top: -15px;
  right: -15px;
  background: var(--primary-color);
  color: white;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: bold;
  box-shadow: var(--shadow);
}

.words-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  min-height: 100px;
  align-content: flex-start;
}

.word {
  display: flex;
  background: var(--bg-color);
  padding: 0.5rem;
  border-radius: 5px;
  transition: var(--transition);
}

.word.current {
  background: rgba(67, 97, 238, 0.1);
  outline: 2px solid var(--primary-color);
}

.word span.correct {
  color: var(--success-color);
}

.word span.incorrect {
  color: var(--error-color);
  text-decoration: underline;
}

.word.correct {
  background: rgba(76, 201, 240, 0.1);
}

.word.incorrect {
  background: rgba(247, 37, 133, 0.1);
}

.input-area {
  margin-bottom: 1rem;
  position: relative;
}

#typing-input {
  width: 100%;
  padding: 1rem;
  font-size: 1.2rem;
  border: 2px solid var(--border-color);
  border-radius: 5px;
  background: var(--bg-color);
  color: var(--text-color);
  transition: var(--transition);
}

#typing-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.2);
}

.stats-panel {
  background: var(--card-bg);
  padding: 1.5rem;
  border-radius: 10px;
  margin-bottom: 2rem;
  box-shadow: var(--shadow);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
}

.stat {
  text-align: center;
  padding: 1rem;
  background: var(--bg-color);
  border-radius: 5px;
}

.stat-value {
  font-size: 2rem;
  font-weight: bold;
  color: var(--primary-color);
}

.stat-label {
  font-size: 0.9rem;
  color: var(--text-color);
  opacity: 0.8;
}

.ai-analysis {
  background: var(--card-bg);
  padding: 1.5rem;
  border-radius: 10px;
  margin-bottom: 2rem;
  box-shadow: var(--shadow);
}

.analysis-content {
  margin: 1rem 0;
  padding: 1rem;
  background: var(--bg-color);
  border-radius: 5px;
  min-height: 100px;
}

.heatmap-container,
.error-breakdown {
  margin-top: 1.5rem;
}

.heatmap-title {
  font-weight: bold;
  margin-bottom: 0.5rem;
  color: var(--primary-color);
}

.heatmap-keys {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 1rem;
}

.heatmap-row {
  display: flex;
  gap: 0.25rem;
  justify-content: center;
}

.heatmap-key {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-color);
  border-radius: 5px;
  font-weight: bold;
  transition: var(--transition);
}

.error-item {
  display: flex;
  gap: 0.5rem;
  padding: 0.5rem;
  background: var(--bg-color);
  border-radius: 5px;
  margin-bottom: 0.5rem;
  align-items: center;
}

.error-correct {
  color: var(--success-color);
  font-weight: bold;
}

.error-typed {
  color: var(--error-color);
  font-weight: bold;
}

.error-count {
  margin-left: auto;
  color: var(--text-color);
  opacity: 0.7;
}

footer {
  text-align: center;
  margin-top: 2rem;
  padding: 1rem;
  color: var(--text-color);
  opacity: 0.7;
}

footer a {
  color: var(--primary-color);
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

/* Modal Styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--card-bg);
  border-radius: 10px;
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
  transform: translateY(-20px);
  transition: var(--transition);
}

.modal-overlay.active .modal {
  transform: translateY(0);
}

.modal-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  padding: 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
}

.modal-btn {
  padding: 0.75rem 1.5rem;
}

.modal-close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-color);
}

.results-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.result-item {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border-color);
}

.result-label {
  font-weight: 500;
}

.result-value {
  font-weight: bold;
  color: var(--primary-color);
}

/* Auth Form Styles */
.form-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.form-tab {
  padding: 0.5rem 1rem;
  border-radius: 5px;
  cursor: pointer;
  transition: var(--transition);
  background: var(--bg-color);
  flex: 1;
  text-align: center;
}

.form-tab.active {
  background: var(--primary-color);
  color: white;
}

.password-requirements {
  margin: 1rem 0;
  padding: 1rem;
  background: var(--bg-color);
  border-radius: 5px;
  font-size: 0.9rem;
}

.password-requirements ul {
  margin-top: 0.5rem;
  padding-left: 1.5rem;
}

.requirement-met {
  color: var(--success-color);
}

.requirement-not-met {
  color: var(--error-color);
}

.form-error {
  color: var(--error-color);
  margin: 1rem 0;
  text-align: center;
}

/* New Features Styles */
.on-screen-keyboard {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 1rem;
  padding: 15px;
  background: var(--bg-color);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.keyboard-row {
  display: flex;
  gap: 6px;
  justify-content: center;
}

.keyboard-key {
  min-width: 45px;
  height: 45px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--card-bg);
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  cursor: pointer;
  border: 2px solid var(--border-color);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.keyboard-key:hover {
  background: var(--border-color);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.keyboard-key.active {
  background: var(--primary-color);
  color: white;
  transform: scale(0.95) translateY(2px);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  border-color: var(--primary-color);
}

.keyboard-key.error-prone {
  background: var(--error-color);
  color: white;
}

.keyboard-key.slow {
  background: var(--warning-color);
  color: white;
}

.sound-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
}

.sound-toggle select {
  width: auto;
}

.progress-chart {
  margin: 1rem 0;
  height: 200px;
}

.tutorial-modal .modal-body {
  text-align: center;
}

.tutorial-steps {
  margin: 1rem 0;
}

.tutorial-step {
  margin-bottom: 1rem;
  padding: 1rem;
  background: var(--bg-color);
  border-radius: 8px;
}

.finger-tutor {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 1rem 0;
}

.hand-diagram {
  display: flex;
  gap: 1rem;
  margin: 1rem 0;
}

.hand {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.finger {
  width: 30px;
  height: 40px;
  background: var(--primary-color);
  margin: 2px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
}

.leaderboard {
  margin: 1rem 0;
}

.leaderboard-item {
  display: flex;
  justify-content: space-between;
  padding: 0.75rem;
  border-bottom: 1px solid var(--border-color);
  transition: var(--transition);
  border-radius: 6px;
  margin-bottom: 0.5rem;
}

.leaderboard-item:hover {
  background: var(--bg-color);
  transform: translateX(4px);
}

.leaderboard-item.current-user {
  background: rgba(99, 102, 241, 0.1);
  border: 2px solid var(--primary-color);
  font-weight: 600;
}

.leaderboard-rank {
  font-weight: bold;
  color: var(--primary-color);
  min-width: 40px;
}

.leaderboard-username {
  flex: 1;
  padding: 0 1rem;
}

.leaderboard-wpm {
  font-weight: 600;
  color: var(--success-color);
  min-width: 80px;
  text-align: right;
}

.leaderboard-accuracy {
  font-weight: 600;
  color: var(--accent-color);
  min-width: 60px;
  text-align: right;
}

.achievements {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin: 1rem 0;
}

.achievement {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem;
  background: var(--bg-color);
  border-radius: 8px;
  width: 100px;
}

.achievement-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.achievement.locked {
  opacity: 0.5;
}

.mobile-keyboard {
  display: none;
}

.keyboard-container {
  margin-top: 10px;
  max-height: 300px;
  overflow: hidden;
  transition: max-height 0.3s ease-in-out;
  width: 100%;
}

.keyboard-container.collapsed {
  max-height: 0;
}

.keyboard-container.visible {
  max-height: 300px;
  /* Adjust based on your keyboard height */
}

.toggle-keyboard-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  color: var(--text-color);
  padding: 8px 12px;
  border-radius: 6px;
  margin: 10px 0;
  cursor: pointer;
  width: 100%;
  transition: all 0.2s ease;
}

.toggle-keyboard-btn:hover {
  background: var(--primary-color);
  color: white;
}

.toggle-keyboard-btn i {
  font-size: 1.1em;
}

/* ML Status Indicator */
.ml-status {
  margin-bottom: 20px;
  padding: 10px;
  border-radius: 8px;
  text-align: center;
  font-weight: bold;
}

.ml-status.loading {
  background-color: #fff3cd;
  border: 1px solid #ffeaa7;
  color: #856404;
}

.ml-status.ready {
  background-color: #d4edda;
  border: 1px solid #c3e6cb;
  color: #155724;
}

.ml-status.partial {
  background-color: #d1ecf1;
  border: 1px solid #bee5eb;
  color: #0c5460;
}

.ml-status.minimal {
  background-color: #fff3cd;
  border: 1px solid #ffeaa7;
  color: #856404;
}

.ml-status.error {
  background-color: #f8d7da;
  border: 1px solid #f5c6cb;
  color: #721c24;
}

.prediction-challenge {
  margin: 1rem 0;
  padding: 1rem;
  background: var(--bg-color);
  border-radius: 8px;
}

.prediction-text {
  font-style: italic;
  margin-bottom: 1rem;
}

/* New Features */
.curriculum-container {
  margin: 1rem 0;
}

.curriculum-level {
  margin-bottom: 1rem;
  padding: 1rem;
  background: var(--bg-color);
  border-radius: 8px;
}

.level-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.level-progress {
  height: 8px;
  background: var(--card-bg);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.level-progress-bar {
  height: 100%;
  background: var(--primary-color);
  transition: width 0.5s ease;
}

.level-lessons {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.5rem;
}

.lesson {
  padding: 0.5rem 0.75rem;
  background: var(--card-bg);
  border-radius: 4px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.lesson:hover:not(.locked) {
  background: var(--primary-color);
  color: white;
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.lesson.completed {
  background: var(--success-color);
  color: white;
}

.lesson.locked {
  opacity: 0.5;
  cursor: not-allowed;
}

.lesson.locked:hover {
  transform: none;
}

.lesson-name {
  flex: 1;
  text-align: left;
}

.lesson-status {
  font-size: 1.2rem;
  min-width: 20px;
  text-align: right;
}

.analytics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1rem;
  margin: 1rem 0;
}

.analytics-card {
  background: var(--bg-color);
  padding: 1rem;
  border-radius: 8px;
}

.chart-container {
  height: 200px;
  position: relative;
}

.profile-container {
  display: flex;
  gap: 1rem;
  margin: 1rem 0;
}

.profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 2rem;
  font-weight: bold;
  overflow: hidden;
}

.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.profile-stats {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.5rem;
}

.profile-stat {
  text-align: center;
  padding: 0.5rem;
  background: var(--card-bg);
  border-radius: 4px;
}

.profile-stat-value {
  font-size: 1.2rem;
  font-weight: bold;
  color: var(--primary-color);
}

.profile-stat-label {
  font-size: 0.8rem;
  opacity: 0.8;
}

.numbers-mode {
  font-family: monospace;
  font-size: 1.4rem;
}

.theme-selector {
  display: flex;
  gap: 0.5rem;
  margin: 1rem 0;
}

.theme-option {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
}

.theme-option.active {
  border-color: var(--primary-color);
}

.font-selector {
  display: flex;
  gap: 0.5rem;
  margin: 1rem 0;
}

.font-option {
  padding: 0.5rem;
  border-radius: 4px;
  cursor: pointer;
  background: var(--bg-color);
}

.font-option.active {
  background: var(--primary-color);
  color: white;
}

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

  header {
    flex-direction: column;
    align-items: flex-start;
  }

  .settings-grid {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .results-grid {
    grid-template-columns: 1fr;
  }

  .modal-footer {
    flex-direction: column;
  }

  .on-screen-keyboard {
    grid-template-columns: repeat(5, 1fr);
  }

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

  .analytics-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  h1 {
    font-size: 2rem;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .words-container {
    min-height: 150px;
  }

  .on-screen-keyboard {
    grid-template-columns: repeat(4, 1fr);
  }

  .game-mode-btn {
    min-width: 100px;
    font-size: 0.9rem;
  }
}

/* Tutorial Highlight */
.tutorial-highlight {
  position: relative;
  z-index: 1001;
  box-shadow: 0 0 0 4px rgba(67, 97, 238, 0.5);
  border-radius: 4px;
}

.tutorial-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tutorial-content {
  background: var(--card-bg);
  padding: 2rem;
  border-radius: 10px;
  max-width: 500px;
  text-align: center;
}

/* Google Sign-in Button */
.google-signin {
  background: white;
  color: #757575;
  border: 1px solid #ddd;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 15px;
  border-radius: 4px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s;
  margin: 10px 0;
}

.google-signin:hover {
  background: #f5f5f5;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.google-signin img {
  width: 18px;
  height: 18px;
}

@keyframes pulse {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.1);
  }

  100% {
    transform: scale(1);
  }
}

.timer {
  transition: all 0.3s ease;
}

.timer.danger {
  background: #ef4444 !important;
  animation: pulse-danger 1s ease-in-out infinite;
}

@keyframes pulse-danger {

  0%,
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
  }

  50% {
    transform: scale(1.05);
    box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
  }
}

#confetti-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1001;
}

/* Additional Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes correctChar {
  0% {
    transform: scale(1.2);
  }

  100% {
    transform: scale(1);
  }
}

@keyframes shake {

  0%,
  100% {
    transform: translateX(0);
  }

  25% {
    transform: translateX(-4px);
  }

  75% {
    transform: translateX(4px);
  }
}

@keyframes successPop {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.1);
  }

  100% {
    transform: scale(1);
  }
}

@keyframes countUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}
