/* ====================
   CSS VARIABLES & RESET
   ==================== */

:root {
  /* Colors - Light Mode */
  --color-gray-50: #f9fafb;
  --color-gray-100: #f3f4f6;
  --color-gray-200: #e5e7eb;
  --color-gray-300: #bfc4cd;
  --color-gray-400: #9ca3af;
  --color-gray-500: #6b7280;
  --color-gray-600: #4b5563;
  --color-gray-700: #374151;
  --color-gray-800: #1f2937;
  --color-gray-900: #111827;

  --color-violet-400: #9c8cff;
  --color-violet-500: #8470ff;
  --color-violet-600: #755ff8;
  --color-violet-700: #5d47de;

  --color-pink-400: #f472b6;
  --color-pink-500: #ec4899;

  --color-green-400: #4bd37d;
  --color-green-500: #3ec972;
  --color-green-600: #34bd68;

  --color-red-400: #ff7474;
  --color-red-500: #ff5656;
  --color-red-600: #fa4949;

  /* Semantic Colors */
  --bg-primary: var(--color-gray-50);
  --bg-secondary: white;
  --text-primary: var(--color-gray-800);
  --text-secondary: var(--color-gray-600);
  --text-tertiary: var(--color-gray-400);
  --border-color: var(--color-gray-300);

  /* Font */
  --font-family: 'Inter', sans-serif;
}

html.dark {
  --bg-primary: var(--color-gray-900);
  --bg-secondary: var(--color-gray-800);
  --text-primary: var(--color-gray-100);
  --text-secondary: var(--color-gray-400);
  --text-tertiary: var(--color-gray-500);
  --border-color: var(--color-gray-600);
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* ====================
   LAYOUT
   ==================== */

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.5rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
}

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

.title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.theme-toggle {
  background: var(--bg-secondary);
  border: 2px solid var(--border-color);
  border-radius: 0.75rem;
  padding: 0.5rem 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 1.25rem;
}

.theme-toggle:hover {
  border-color: var(--color-violet-500);
  transform: translateY(-2px);
}

/* ====================
   GAME CONTAINER
   ==================== */

#game-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 1rem 0;
}

/* ====================
   GAME LAYOUT (3-Column Grid)
   ==================== */

.game-layout {
  display: grid;
  grid-template-columns: 240px 1fr 240px;
  gap: 2rem;
  width: 100%;
  height: 100%;
  min-height: 550px;
  align-items: start;
}

/* ====================
   LEFT SIDEBAR (Stats + Start Button)
   ==================== */

.game-sidebar-left {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Stat Cards */
.stat-card {
  background: linear-gradient(135deg, var(--color-pink-400), var(--color-pink-500));
  border-radius: 1.25rem;
  padding: 1.25rem;
  box-shadow: 0 4px 12px rgba(244, 114, 182, 0.3);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  text-align: center;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(244, 114, 182, 0.4);
}

.stat-icon {
  font-size: 1.75rem;
  margin-bottom: 0.5rem;
  display: block;
}

.stat-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.85);
  margin-bottom: 0.75rem;
}

.stat-value {
  font-size: 2.5rem;
  font-weight: 700;
  color: white;
  line-height: 1;
}

/* Timer warning state */
#timer-display.warning {
  animation: pulse 1s ease-in-out infinite;
}

/* Start Button */
.start-game-btn {
  width: 100%;
  background: linear-gradient(135deg, var(--color-violet-500), var(--color-violet-700));
  color: white;
  font-size: 1.125rem;
  font-weight: 700;
  padding: 1.25rem;
  border: none;
  border-radius: 1.25rem;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(132, 112, 255, 0.4);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: var(--font-family);
}

.start-game-btn:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(132, 112, 255, 0.5);
}

.start-game-btn:active {
  transform: translateY(-2px);
}

.start-game-btn.hidden {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.95);
}

/* ====================
   CENTER (Typing Area)
   ==================== */

.game-main {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
}

/* ====================
   RIGHT SIDEBAR (High Scores)
   ==================== */

.game-sidebar-right {
  display: flex;
  flex-direction: column;
}

.high-scores-card {
  background: var(--bg-secondary);
  border: 2px solid var(--color-violet-400);
  border-radius: 1.25rem;
  padding: 1.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  opacity: 0.95;
}

.high-scores-title {
  font-size: 0.875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-violet-600);
  text-align: center;
  margin-bottom: 0.75rem;
}

html.dark .high-scores-title {
  color: var(--color-violet-400);
}

.high-scores-divider {
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg,
    transparent,
    var(--color-violet-400),
    transparent);
  margin-bottom: 1rem;
}

.high-scores-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.high-score-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: rgba(132, 112, 255, 0.05);
  border-radius: 0.75rem;
  transition: all 0.2s ease;
}

.high-score-item:hover {
  background: rgba(132, 112, 255, 0.1);
  transform: translateX(4px);
}

.high-score-medal {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.high-score-value {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  font-family: 'Courier New', monospace;
}

.high-score-empty {
  text-align: center;
  color: var(--text-tertiary);
  font-size: 0.875rem;
  font-style: italic;
  padding: 1.5rem 0.5rem;
}

/* ====================
   3-LAYER INPUT SYSTEM
   ==================== */

.target-container {
  position: relative;
  background: var(--bg-secondary);
  border-radius: 1.5rem;
  padding: 1.5rem;
  width: 100%;
  min-height: 400px;
  height: fit-content;
  display: block;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  font-family: 'Courier New', monospace;
  font-size: 1.5rem;
  line-height: 1.5;
  overflow: hidden;
  transition: filter 0.6s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Inactive (pre-game) state - blurred */
.target-container.inactive {
  filter: blur(3px);
  opacity: 0.75;
  pointer-events: none;
}

/* Active (playing) state - clear */
.target-container.active {
  filter: blur(0);
  opacity: 1;
  pointer-events: auto;
}

/* Item Label: Symbol name or phrase description */
.item-label {
  text-align: center;
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-violet-600);
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid rgba(132, 112, 255, 0.2);
  font-family: 'Inter', sans-serif;
}

html.dark .item-label {
  color: var(--color-violet-400);
}

/* Hide item label for Level 3 (code blocks don't need labels) */
body[data-level="3"] .item-label {
  display: none;
}

/* Layer 1: Target text (gray - shows what to type) */
.target-text {
  position: absolute;
  top: 1.5rem;
  left: 1.5rem;
  right: 1.5rem;
  bottom: 1.5rem;
  z-index: 1;
  color: var(--text-tertiary);
  white-space: pre;
  word-wrap: normal;
  overflow-wrap: normal;
  margin: 0;
  padding: 0;
  pointer-events: none;
  font-family: 'Courier New', monospace;
  font-size: 1.5rem;
  line-height: 1.5;
  letter-spacing: 0;
  text-align: left;
}

/* Level 1 & 2: Adjust top position for item label */
body[data-level="1"] .target-text,
body[data-level="2"] .target-text {
  top: 4.5rem; /* Account for label space */
}

/* Layer 2: Colored feedback (green/red - shows typed characters) */
.colored-feedback {
  position: absolute;
  top: 1.5rem;
  left: 1.5rem;
  right: 1.5rem;
  bottom: 1.5rem;
  z-index: 2;
  white-space: pre;
  word-wrap: normal;
  overflow-wrap: normal;
  margin: 0;
  padding: 0;
  pointer-events: none;
  font-family: 'Courier New', monospace;
  font-size: 1.5rem;
  line-height: 1.5;
  letter-spacing: 0;
  text-align: left;
}

/* Level 1 & 2: Adjust top position for item label */
body[data-level="1"] .colored-feedback,
body[data-level="2"] .colored-feedback {
  top: 4.5rem; /* Account for label space */
}

/* Layer 3: Visible textarea (transparent text, visible cursor) */
.typing-textarea-visible {
  position: absolute;
  top: 1.5rem;
  left: 1.5rem;
  right: 1.5rem;
  bottom: 1.5rem;
  z-index: 3;

  /* Text invisible, cursor visible */
  color: transparent;
  caret-color: var(--color-violet-500);

  /* Remove all default styling */
  background: transparent;
  border: none;
  outline: none;
  resize: none;

  /* Match typography exactly with other layers */
  font-family: 'Courier New', monospace;
  font-size: 1.5rem;
  line-height: 1.5;
  letter-spacing: 0;
  white-space: pre;
  word-wrap: normal;
  overflow-wrap: normal;
  overflow: auto;

  margin: 0;
  padding: 0;
}

/* Level 1 & 2: Adjust top position for item label */
body[data-level="1"] .typing-textarea-visible,
body[data-level="2"] .typing-textarea-visible {
  top: 4.5rem; /* Account for label space */
}

html.dark .typing-textarea-visible {
  caret-color: var(--color-violet-400);
}

/* Character color feedback */
.char-correct {
  color: var(--color-green-500);
}

.char-error {
  color: var(--color-red-500);
  animation: shake 0.3s ease;
}

/* Red dot for wrong spaces */
.char-error-space {
  font-weight: bold;
  font-size: 1.2em;
}

/* ====================
   LEVEL 2 & 3 SPECIFIC STYLES
   ==================== */

/* Smaller font and scrolling for Level 2 phrases and Level 3 code blocks */
body[data-level="2"] .target-container,
body[data-level="3"] .target-container {
  font-size: 1rem;
  line-height: 1.4;
  max-height: 500px;
  overflow-y: auto;
  overflow-x: hidden;
}

body[data-level="2"] .target-text,
body[data-level="3"] .target-text {
  font-size: 1rem;
  line-height: 1.4;
}

body[data-level="2"] .colored-feedback,
body[data-level="3"] .colored-feedback {
  font-size: 1rem;
  line-height: 1.4;
}

body[data-level="2"] .typing-textarea-visible,
body[data-level="3"] .typing-textarea-visible {
  font-size: 1rem;
  line-height: 1.4;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Red dot sizing for Level 2 & 3 */
body[data-level="2"] .char-error-space,
body[data-level="3"] .char-error-space {
  font-size: 1.2rem;
}

/* Custom scrollbar styling for Level 2 & 3 */
body[data-level="2"] .target-container::-webkit-scrollbar,
body[data-level="3"] .target-container::-webkit-scrollbar {
  width: 8px;
}

body[data-level="2"] .target-container::-webkit-scrollbar-track,
body[data-level="3"] .target-container::-webkit-scrollbar-track {
  background: var(--bg-primary);
  border-radius: 4px;
  margin: 1rem 0;
}

body[data-level="2"] .target-container::-webkit-scrollbar-thumb,
body[data-level="3"] .target-container::-webkit-scrollbar-thumb {
  background: var(--color-violet-400);
  border-radius: 4px;
  transition: background 0.2s ease;
}

body[data-level="2"] .target-container::-webkit-scrollbar-thumb:hover,
body[data-level="3"] .target-container::-webkit-scrollbar-thumb:hover {
  background: var(--color-violet-500);
}

html.dark body[data-level="2"] .target-container::-webkit-scrollbar-thumb,
html.dark body[data-level="3"] .target-container::-webkit-scrollbar-thumb {
  background: var(--color-violet-500);
}

html.dark body[data-level="2"] .target-container::-webkit-scrollbar-thumb:hover,
html.dark body[data-level="3"] .target-container::-webkit-scrollbar-thumb:hover {
  background: var(--color-violet-400);
}

/* Scrollbar for textarea */
body[data-level="2"] .typing-textarea-visible::-webkit-scrollbar,
body[data-level="3"] .typing-textarea-visible::-webkit-scrollbar {
  width: 8px;
}

body[data-level="2"] .typing-textarea-visible::-webkit-scrollbar-track,
body[data-level="3"] .typing-textarea-visible::-webkit-scrollbar-track {
  background: transparent;
}

body[data-level="2"] .typing-textarea-visible::-webkit-scrollbar-thumb,
body[data-level="3"] .typing-textarea-visible::-webkit-scrollbar-thumb {
  background: transparent;
}


/* ====================
   COMPLETION MODAL
   ==================== */

.completion-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
}

.completion-modal.active {
  display: flex;
}

.completion-modal-content {
  background: var(--bg-primary);
  border-radius: 2rem;
  padding: 3rem;
  max-width: 500px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  animation: slideInUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: center;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(40px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.completion-emoji {
  font-size: 4rem;
  margin-bottom: 1rem;
  animation: bounce 1s ease-in-out;
}

.completion-title {
  font-size: 2.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}

.completion-subtitle {
  font-size: 1.125rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

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

.final-stat {
  background: var(--bg-secondary);
  border-radius: 1rem;
  padding: 1.5rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.final-stat-icon {
  font-size: 2rem;
  margin-bottom: 0.75rem;
}

.final-stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--color-green-500);
  margin-bottom: 0.25rem;
}

.final-stat-label {
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-weight: 500;
}


.new-record-badge {
  display: inline-block;
  background: linear-gradient(135deg, #FFD700, #FFA500);
  color: #1f2937;
  font-size: 1.25rem;
  font-weight: 700;
  padding: 0.75rem 2rem;
  border-radius: 2rem;
  margin-bottom: 1rem;
  box-shadow: 0 4px 12px rgba(255, 215, 0, 0.4);
  animation: recordBadge 0.6s ease-in-out;
  letter-spacing: 0.05em;
}

@keyframes recordBadge {
  0% {
    transform: scale(0);
    opacity: 0;
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Speed Tier Badges */
.speed-tier-badge {
  display: inline-block;
  font-size: 1.5rem;
  font-weight: 700;
  padding: 0.75rem 2rem;
  border-radius: 2rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  animation: tierBadge 0.5s ease-in-out;
  letter-spacing: 0.05em;
}

.speed-tier-badge.tier-blazing {
  background: linear-gradient(135deg, #ff6b35, #f7931e);
  color: white;
  box-shadow: 0 4px 16px rgba(255, 107, 53, 0.5);
}

.speed-tier-badge.tier-fast {
  background: linear-gradient(135deg, #8470ff, #5d47de);
  color: white;
  box-shadow: 0 4px 16px rgba(132, 112, 255, 0.5);
}

.speed-tier-badge.tier-complete {
  background: linear-gradient(135deg, #4bd37d, #34bd68);
  color: white;
  box-shadow: 0 4px 16px rgba(75, 211, 125, 0.5);
}

@keyframes tierBadge {
  0% {
    transform: scale(0) rotate(-10deg);
    opacity: 0;
  }
  50% {
    transform: scale(1.1) rotate(5deg);
  }
  100% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
}

/* ====================
   BUTTONS
   ==================== */

.btn {
  font-family: var(--font-family);
  font-weight: 600;
  border: none;
  border-radius: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: var(--color-pink-400);
  color: white;
  padding: 1.25rem 2.5rem;
  font-size: 1.25rem;
}

.btn-primary:hover {
  background: var(--color-pink-500);
}

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border: 2px solid var(--border-color);
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
}

.btn-secondary:hover {
  border-color: var(--color-violet-500);
  color: var(--text-primary);
}

.btn-large {
  padding: 1.5rem 3rem;
  font-size: 1.5rem;
}

/* ====================
   INSTRUCTIONS
   ==================== */

.instructions-toggle {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
}

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

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--bg-primary);
  border-radius: 1.5rem;
  width: 90%;
  max-width: 600px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  animation: slideIn 0.3s ease;
}

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

.modal-header h3 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.close-btn {
  background: none;
  border: none;
  font-size: 2rem;
  color: var(--text-secondary);
  cursor: pointer;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.5rem;
  transition: all 0.2s ease;
}

.close-btn:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.modal-body {
  padding: 2rem;
}

.instructions-list {
  list-style: decimal;
  padding-left: 1.5rem;
  margin-bottom: 1.5rem;
}

.instructions-list li {
  margin-bottom: 1rem;
  color: var(--text-primary);
  line-height: 1.6;
}

.text-green {
  color: var(--color-green-500);
  font-weight: 600;
}

.text-red {
  color: var(--color-red-500);
  font-weight: 600;
}

.tip-box {
  background: rgba(132, 112, 255, 0.1);
  border-left: 4px solid var(--color-violet-500);
  border-radius: 0.5rem;
  padding: 1.5rem;
  display: flex;
  gap: 1rem;
}

.tip-icon {
  font-size: 2rem;
}

.tip-box h4 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-violet-600);
  margin-bottom: 0.5rem;
}

html.dark .tip-box h4 {
  color: var(--color-violet-400);
}

.tip-box p {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* ====================
   ANIMATIONS
   ==================== */

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

@keyframes bounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-20px);
  }
}

@keyframes shake {
  0%, 100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-10px);
  }
  75% {
    transform: translateX(10px);
  }
}

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

/* ====================
   RESPONSIVE
   ==================== */

/* Tablet: Stack vertically but keep sidebars */
@media (max-width: 1024px) {
  .game-layout {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .game-sidebar-left,
  .game-sidebar-right {
    width: 100%;
  }

  /* Stats side by side on tablet */
  .game-sidebar-left {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1rem;
  }

  /* High scores horizontal */
  .high-scores-list {
    flex-direction: row;
    justify-content: center;
  }

  .high-score-item {
    flex: 1;
    min-width: 0;
  }
}

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

  .title {
    font-size: 1.125rem;
  }

  .header {
    margin-bottom: 1rem;
  }

  #game-container {
    padding: 0;
  }

  .game-layout {
    grid-template-columns: 1fr;
    gap: 1rem;
    min-height: auto;
  }

  /* Compact stats in 2x2 grid + start button */
  .game-sidebar-left {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
  }

  .start-game-btn {
    grid-column: 1 / -1;
    font-size: 1.125rem;
    padding: 1.25rem;
  }

  .stat-card {
    padding: 1rem;
  }

  .stat-icon {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
  }

  .stat-label {
    font-size: 0.625rem;
  }

  .stat-value {
    font-size: 2rem;
  }

  /* High scores compact */
  .high-scores-card {
    padding: 1rem;
  }

  .high-scores-list {
    flex-direction: row;
    gap: 0.5rem;
    overflow-x: auto;
  }

  .high-score-item {
    flex-direction: column;
    padding: 0.5rem;
    min-width: 80px;
    text-align: center;
  }

  .high-score-medal {
    font-size: 1.25rem;
  }

  .high-score-value {
    font-size: 0.75rem;
  }

  /* Typing area */
  .target-container {
    min-height: 300px;
    padding: 1rem;
  }

  .target-text,
  .colored-feedback,
  .typing-textarea-visible {
    font-size: 1.125rem;
  }

  /* Level 2: Even smaller on mobile */
  body[data-level="2"] .target-container {
    max-height: 400px;
  }

  body[data-level="2"] .target-text,
  body[data-level="2"] .colored-feedback,
  body[data-level="2"] .typing-textarea-visible {
    font-size: 0.875rem;
    line-height: 1.4;
  }

  /* Completion modal */
  .completion-modal-content {
    padding: 2rem;
  }

  .completion-title {
    font-size: 1.75rem;
  }

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