/* ==========================================================
   TYPING SPEED CHALLENGE GAME - MODERN GLASSMORPHIC STYLESHEET
   ========================================================== */

:root {
  /* Default Cyberpunk Neon Theme */
  --bg-color: #0b0f19;
  --bg-gradient: radial-gradient(circle at 50% 20%, #1e1b4b 0%, #0f172a 60%, #090d16 100%);
  --panel-bg: rgba(15, 23, 42, 0.65);
  --panel-border: rgba(99, 102, 241, 0.25);
  --panel-glow: rgba(99, 102, 241, 0.15);
  --option-bg: #0f172a;
  
  --text-main: #f8fafc;
  --text-muted: #64748b;
  
  --accent-primary: #818cf8;
  --accent-secondary: #06b6d4;
  --accent-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 50%, #ec4899 100%);
  
  /* Typing status colors */
  --char-correct: #34d399;
  --char-incorrect: #f87171;
  --char-incorrect-bg: rgba(239, 68, 68, 0.25);
  --char-upcoming: #475569;
  --caret-color: #38bdf8;
  
  --font-ui: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

/* Theme Options */
[data-theme="dark-glass"] {
  --bg-color: #05070a;
  --bg-gradient: radial-gradient(circle at 50% 0%, #064e3b 0%, #022c22 40%, #05070a 100%);
  --panel-bg: rgba(6, 78, 59, 0.15);
  --panel-border: rgba(16, 185, 129, 0.25);
  --panel-glow: rgba(16, 185, 129, 0.15);
  --option-bg: #022c22;
  --accent-primary: #34d399;
  --accent-secondary: #10b981;
  --accent-gradient: linear-gradient(135deg, #10b981 0%, #14b8a6 100%);
  --char-correct: #10b981;
  --caret-color: #34d399;
}

[data-theme="oled-minimal"] {
  --bg-color: #000000;
  --bg-gradient: none;
  --panel-bg: rgba(24, 24, 27, 0.8);
  --panel-border: rgba(255, 255, 255, 0.12);
  --panel-glow: none;
  --option-bg: #18181b;
  --accent-primary: #eab308;
  --accent-secondary: #f59e0b;
  --accent-gradient: linear-gradient(135deg, #eab308 0%, #ca8a04 100%);
  --char-correct: #facc15;
  --char-upcoming: #3f3f46;
  --caret-color: #facc15;
}

[data-theme="synthwave"] {
  --bg-color: #0f0728;
  --bg-gradient: radial-gradient(circle at 50% 30%, #581c87 0%, #2e1065 50%, #0f0728 100%);
  --panel-bg: rgba(88, 28, 135, 0.25);
  --panel-border: rgba(236, 72, 153, 0.35);
  --panel-glow: rgba(236, 72, 153, 0.2);
  --option-bg: #1e0a38;
  --accent-primary: #f472b6;
  --accent-secondary: #fb923c;
  --accent-gradient: linear-gradient(135deg, #ec4899 0%, #f97316 100%);
  --char-correct: #fb923c;
  --caret-color: #f472b6;
}

[data-theme="blazing-fire"] {
  --bg-color: #0a0a0a;
  --bg-gradient: radial-gradient(circle at 50% 0%, #4a0c0c 0%, #1f0404 45%, #0a0a0a 100%);
  --panel-bg: rgba(40, 10, 10, 0.85);
  --panel-border: rgba(255, 77, 0, 0.4);
  --panel-glow: rgba(255, 77, 0, 0.25);
  --option-bg: #1f0505;
  --text-main: #ffffff;
  --text-muted: #94a3b8;
  --accent-primary: #ff4d00;
  --accent-secondary: #ffcc00;
  --accent-gradient: linear-gradient(135deg, #ff4d00 0%, #ffcc00 100%);
  --char-correct: #ffcc00;
  --char-incorrect: #ff2a2a;
  --char-incorrect-bg: rgba(255, 42, 42, 0.3);
  --char-upcoming: #64748b;
  --caret-color: #ff4d00;
}

[data-theme="blazing-fire"] .logo-title {
  font-family: 'Orbitron', var(--font-ui);
  background: linear-gradient(180deg, #ffffff 0%, #ffcc00 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 12px rgba(255, 77, 0, 0.6));
}

/* ==========================================
   CRT MONITOR THEME (Pincushion & Scanlines)
   ========================================== */
[data-theme="crt"] {
  --bg-color: #040d04;
  --bg-gradient: radial-gradient(circle at 50% 50%, #0c2b0c 0%, #040e04 65%, #010401 100%);
  --panel-bg: rgba(6, 26, 6, 0.85);
  --panel-border: rgba(51, 255, 102, 0.45);
  --panel-glow: rgba(51, 255, 102, 0.25);
  --option-bg: #061c06;
  
  --text-main: #33ff66;
  --text-muted: #1e7030;
  
  --accent-primary: #33ff66;
  --accent-secondary: #00ff41;
  --accent-gradient: linear-gradient(135deg, #33ff66 0%, #00ff41 100%);
  
  --char-correct: #33ff66;
  --char-incorrect: #ff3333;
  --char-incorrect-bg: rgba(255, 51, 51, 0.35);
  --char-upcoming: #144f23;
  --caret-color: #33ff66;

  --font-ui: 'VT323', 'JetBrains Mono', monospace;
  --font-mono: 'VT323', 'JetBrains Mono', monospace;
}

html[data-theme="crt"] body {
  position: relative;
  animation: crt-flicker 0.2s infinite alternate;
}

/* CRT Screen Panels (Clean Retro Display) */
html[data-theme="crt"] .app-header,
html[data-theme="crt"] .main-content {
  border-radius: 12px;
  border: 1px solid rgba(51, 255, 102, 0.35);
  box-shadow: 
    0 0 20px rgba(51, 255, 102, 0.12),
    inset 0 0 30px rgba(0, 0, 0, 0.6);
}

/* Clean Phosphor Text Glow */
html[data-theme="crt"] .logo-title,
html[data-theme="crt"] .wpm-value,
html[data-theme="crt"] .metric-val,
html[data-theme="crt"] .word-display,
html[data-theme="crt"] .single-word,
html[data-theme="crt"] .res-val-primary,
html[data-theme="crt"] .res-val-correct {
  text-shadow: 0 0 5px #33ff66, 0 0 12px rgba(51, 255, 102, 0.5);
  font-family: 'VT323', monospace;
  letter-spacing: 1px;
}

html[data-theme="crt"] .logo-title {
  color: #33ff66;
  background: none;
  -webkit-text-fill-color: #33ff66;
}

/* Subtle Scanline Texture Overlay */
html[data-theme="crt"]::before {
  content: " ";
  display: block;
  position: fixed;
  top: 0; left: 0; bottom: 0; right: 0;
  background: 
    linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.35) 50%),
    linear-gradient(90deg, rgba(255, 0, 0, 0.02), rgba(0, 255, 0, 0.01), rgba(0, 0, 255, 0.02));
  z-index: 9990;
  background-size: 100% 3px, 6px 100%;
  pointer-events: none;
}

/* Rolling Scan Beam */
html[data-theme="crt"]::after {
  content: " ";
  display: block;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 90px;
  background: linear-gradient(0deg, transparent 0%, rgba(51, 255, 102, 0.06) 50%, transparent 100%);
  z-index: 9991;
  opacity: 0.6;
  pointer-events: none;
  animation: crt-scanline-sweep 8s linear infinite;
}

/* CRT Screen Corner Vignette & Lens Sheen */
html[data-theme="crt"] .main-content::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 18px;
  background: radial-gradient(ellipse at center, transparent 65%, rgba(0, 0, 0, 0.5) 90%, rgba(0, 0, 0, 0.85) 100%);
  pointer-events: none;
  z-index: 10;
}

/* CRT Animations */
@keyframes crt-flicker {
  0% { opacity: 0.99; }
  50% { opacity: 1; }
  52% { opacity: 0.98; }
  54% { opacity: 1; }
  80% { opacity: 0.99; }
  100% { opacity: 1; }
}

@keyframes crt-scanline-sweep {
  0% { transform: translateY(-100%); }
  100% { transform: translateY(100vh); }
}

/* CRT Isolated Glitch Effects */


/* Isolated Effect 1: Shake & Displacement Only (50% Intensity) */
html[data-theme="crt"].crt-glitch-shake-only body {
  animation: crt-body-glitch 0.12s steps(2, end) infinite !important;
}
html[data-theme="crt"].crt-glitch-shake-only .main-content,
html[data-theme="crt"].crt-glitch-shake-only .app-header {
  animation: crt-panel-glitch 0.15s steps(3, end) infinite !important;
}
html[data-theme="crt"].crt-glitch-shake-only .typing-arena-container,
html[data-theme="crt"].crt-glitch-shake-only .metrics-grid {
  animation: crt-slice-glitch 0.12s steps(2, end) infinite !important;
}

/* Isolated Effect 2: Horizontal Tear Line Only (50% Intensity) */
html[data-theme="crt"].crt-glitch-tear-only::after {
  content: " ";
  display: block;
  position: fixed;
  left: 0; right: 0;
  top: 35%;
  height: 22px;
  background: linear-gradient(90deg, rgba(51, 255, 102, 0.35) 0%, rgba(255, 0, 85, 0.4) 50%, rgba(0, 255, 255, 0.4) 100%);
  box-shadow: 0 0 12px rgba(51, 255, 102, 0.5), 0 0 25px rgba(0, 255, 255, 0.4);
  mix-blend-mode: hard-light;
  z-index: 9999;
  pointer-events: none;
  animation: crt-tear-bar 0.1s steps(2, end) infinite !important;
}

/* Isolated Effect 3: RGB Chromatic Text Split Only (50% Intensity, 3x Slower 0.45s Animation) */
html[data-theme="crt"].crt-glitch-rgb-only .logo-title,
html[data-theme="crt"].crt-glitch-rgb-only .metric-value,
html[data-theme="crt"].crt-glitch-rgb-only .metric-label,
html[data-theme="crt"].crt-glitch-rgb-only .metric-sub,
html[data-theme="crt"].crt-glitch-rgb-only .streak-pill,
html[data-theme="crt"].crt-glitch-rgb-only .char-current,
html[data-theme="crt"].crt-glitch-rgb-only .char-correct,
html[data-theme="crt"].crt-glitch-rgb-only .char-incorrect,
html[data-theme="crt"].crt-glitch-rgb-only .char-upcoming,
html[data-theme="crt"].crt-glitch-rgb-only .single-word-target,
html[data-theme="crt"].crt-glitch-rgb-only .single-word-input,
html[data-theme="crt"].crt-glitch-rgb-only .control-btn,
html[data-theme="crt"].crt-glitch-rgb-only .select-input {
  animation: crt-rgb-glitch 0.45s ease-in-out infinite alternate !important;
}


@keyframes crt-body-glitch {
  0% { transform: translate(-4px, 2px) skewX(-1deg); }
  50% { transform: translate(4px, -2px) skewX(1.2deg); }
  100% { transform: translate(-2px, 2px) skewX(-0.5deg); }
}

@keyframes crt-panel-glitch {
  0% { transform: translate(5px, -2px) skewY(0.4deg); }
  33% { transform: translate(-6px, 2px) skewY(-0.5deg); }
  66% { transform: translate(3px, -2px) skewX(-1deg); }
  100% { transform: translate(-4px, 1px) skewX(0.8deg); }
}

@keyframes crt-slice-glitch {
  0% { clip-path: inset(15% 0 50% 0); transform: translateX(-7px) scaleY(1.01); }
  50% { clip-path: inset(60% 0 20% 0); transform: translateX(7px) scaleY(0.99); }
  100% { clip-path: inset(30% 0 65% 0); transform: translateX(-4px); }
}

@keyframes crt-tear-bar {
  0% { top: 20%; height: 18px; transform: translateX(-15px); opacity: 0.6; }
  50% { top: 60%; height: 28px; transform: translateX(20px); opacity: 0.65; }
  100% { top: 40%; height: 12px; transform: translateX(-7px); opacity: 0.55; }
}

/* 3x Slower RGB Chromatic Aberration Oscillating Keyframes */
@keyframes crt-rgb-glitch {
  0% {
    text-shadow: -3.5px 0 1px #ff0055, 3.5px 0 1px #00ffff, 0 0 8px #33ff66;
  }
  50% {
    text-shadow: 3.5px 0 1.5px #ff0055, -3.5px 0 1.5px #00ffff, 0 0 12px #33ff66;
  }
  100% {
    text-shadow: -1.5px 0 1px #ff0055, 1.5px 0 1px #00ffff, 0 0 6px #33ff66;
  }
}


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

body {
  font-family: var(--font-ui);
  background: var(--bg-color);
  background-image: var(--bg-gradient);
  color: var(--text-main);
  height: 100vh;
  max-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  overflow: hidden;
  user-select: none;
}

/* Header & Top Bar */
.app-header {
  width: 100%;
  max-width: 1100px;
  padding: 0.65rem 1.5rem 0.35rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.logo-icon {
  width: 34px;
  height: 34px;
  background: var(--accent-gradient);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  box-shadow: 0 0 15px var(--panel-glow);
}

.logo-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #ffffff 0%, var(--text-muted) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.version-badge {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--accent-primary);
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  margin-left: 0.4rem;
  letter-spacing: 0.05em;
  display: inline-block;
  box-shadow: 0 0 10px var(--panel-glow);
}

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

.control-btn, .select-input {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  color: var(--text-main);
  padding: 0.35rem 0.75rem;
  border-radius: 8px;
  font-family: var(--font-ui);
  font-size: 0.825rem;
  font-weight: 500;
  cursor: pointer;
  backdrop-filter: blur(12px);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.control-btn:hover, .select-input:hover {
  border-color: var(--accent-primary);
  box-shadow: 0 0 15px var(--panel-glow);
  transform: translateY(-1px);
}

.select-input option {
  background: var(--option-bg, #0f172a);
  color: var(--text-main);
  padding: 0.4rem;
}

/* Multi-Select Category Dropdown */
.multi-select-container {
  position: relative;
  display: inline-block;
}

.category-dropdown-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  min-width: 140px;
}

.dropdown-arrow {
  font-size: 0.7rem;
  opacity: 0.7;
  transition: transform 0.2s ease;
}

.multi-select-container.open .dropdown-arrow {
  transform: rotate(180deg);
}

.multi-select-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: 190px;
  background: var(--option-bg, #0f172a);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 0.5rem;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7), 0 0 15px var(--panel-glow);
  z-index: 100;
  display: none;
  flex-direction: column;
  gap: 0.3rem;
}

.multi-select-container.open .multi-select-menu {
  display: flex;
}

.multi-select-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-main);
  cursor: pointer;
  transition: background 0.15s ease;
}

.multi-select-option:hover {
  background: rgba(255, 255, 255, 0.08);
}

.category-checkbox {
  accent-color: var(--accent-primary);
  width: 15px;
  height: 15px;
  cursor: pointer;
}

/* Main Container */
.main-content {
  width: 100%;
  max-width: 1100px;
  padding: 0.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
  gap: 0.75rem;
  flex: 1;
  overflow-y: auto;
}

/* Custom Scrollbar for Main Content on short viewports */
.main-content::-webkit-scrollbar {
  width: 6px;
}
.main-content::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

/* HUD Metrics Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.75rem;
  flex-shrink: 0;
}

.metric-card {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 0.65rem 0.9rem;
  backdrop-filter: blur(16px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  position: relative;
  overflow: visible;
  transition: transform 0.2s ease;
}

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

/* Metric Tooltips & Info Badges */
[data-tooltip] {
  position: relative;
  cursor: help;
}

[data-tooltip]::before {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  padding: 6px 10px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid var(--panel-border);
  color: var(--text-main);
  font-size: 0.725rem;
  font-weight: 500;
  line-height: 1.35;
  text-transform: none;
  letter-spacing: normal;
  white-space: normal;
  width: max-content;
  max-width: 220px;
  border-radius: 6px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  z-index: 9000;
  text-align: center;
}

[data-tooltip]:hover::before {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.metric-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.metric-value {
  font-size: 1.65rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--text-main);
  line-height: 1.1;
}

.metric-sub {
  font-size: 0.7rem;
  color: var(--accent-primary);
}

.card-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.streak-pills-container,
.streak-value-container {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
  padding: 0.15rem 0;
}

.streak-pill {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.18rem 0.5rem;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  letter-spacing: 0.02em;
}

.streak-pill.char-pill {
  background: rgba(234, 179, 8, 0.15);
  border: 1px solid rgba(234, 179, 8, 0.35);
  color: #facc15;
  box-shadow: 0 0 10px rgba(234, 179, 8, 0.15);
}

.streak-pill.word-pill {
  background: rgba(249, 115, 22, 0.15);
  border: 1px solid rgba(249, 115, 22, 0.35);
  color: #fb923c;
  box-shadow: 0 0 10px rgba(249, 115, 22, 0.15);
}

.streak-side-by-side {
  display: flex;
  align-items: center;
  justify-content: space-around;
  margin-top: 0.25rem;
  width: 100%;
}

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

.streak-sub-lbl {
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

.streak-v-divider {
  width: 1px;
  height: 26px;
  background: rgba(255, 255, 255, 0.12);
}

/* Infinite Horizontal Typing Arena */
.typing-arena-container {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 1.25rem 1rem;
  backdrop-filter: blur(20px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4), 0 0 30px var(--panel-glow);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 130px;
  flex-shrink: 0;
}

/* Central Target Focus Line */
.focus-line {
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(35% + 3px); /* Shifted right by line width (3px) */
  width: 3px;
  background: var(--caret-color);
  box-shadow: 0 0 15px var(--caret-color), 0 0 30px var(--caret-color);
  z-index: 5;
  border-radius: 2px;
  animation: caretPulse 1.2s infinite ease-in-out;
  pointer-events: none;
}

@keyframes caretPulse {
  0%, 100% { opacity: 1; transform: scaleY(1); }
  50% { opacity: 0.4; transform: scaleY(0.9); }
}

/* Horizontal Track Wrapper */
.typing-viewport {
  width: 100%;
  overflow: hidden;
  position: relative;
  height: 55px;
  display: flex;
  align-items: center;
}

.typing-track {
  display: flex;
  align-items: center;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  position: absolute;
  left: 35%; /* Aligned with focus line */
  transform: translateX(0px);
  transition: transform 0.08s cubic-bezier(0.1, 0.9, 0.2, 1);
  will-change: transform;
}

/* Individual Character Styles */
.char-span {
  display: inline-block;
  padding: 0 1px;
  position: relative;
  transition: color 0.1s ease, transform 0.1s ease;
}

.char-correct {
  color: var(--char-correct);
  text-shadow: 0 0 12px rgba(52, 211, 153, 0.4);
}

.char-incorrect {
  color: var(--char-incorrect);
  background: var(--char-incorrect-bg);
  border-radius: 4px;
  text-decoration: underline;
  text-shadow: 0 0 12px rgba(248, 113, 113, 0.5);
  animation: shake 0.2s ease-in-out;
}

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

.char-upcoming {
  color: var(--char-upcoming);
}

.char-space {
  margin: 0 0.3em;
}

.char-space.char-incorrect {
  background: rgba(239, 68, 68, 0.4);
  min-width: 0.6em;
  display: inline-block;
}

/* Single Word Mode Arena */
.single-word-arena {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.25rem 0;
}

.single-target-word {
  font-family: var(--font-mono);
  font-size: 2.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-main);
  text-shadow: 0 0 25px var(--panel-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.05em;
  min-height: 3.5rem;
}

.single-typed-word {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  min-height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.05em;
  background: rgba(255, 255, 255, 0.03);
  border: 1px dashed var(--panel-border);
  padding: 0.25rem 1.25rem;
  border-radius: 10px;
  width: fit-content;
  min-width: 200px;
}

.enter-hint-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid var(--accent-primary);
  color: var(--accent-primary);
  padding: 0.25rem 0.65rem;
  border-radius: 6px;
  font-size: 0.775rem;
  font-weight: 600;
  animation: bounceHint 1.5s infinite ease-in-out;
}

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

/* Floating Input Focus Catch */
#hidden-input {
  position: absolute;
  opacity: 0;
  top: -9999px;
  left: -9999px;
}

/* Realtime Chart Section */
.chart-container {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 0.65rem 1rem;
  backdrop-filter: blur(16px);
  width: 100%;
  flex-shrink: 0;
}

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

.chart-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.chart-legend {
  font-size: 0.75rem;
  display: flex;
  gap: 0.8rem;
  font-weight: 600;
}

.legend-avg {
  color: var(--accent-secondary);
}

.legend-instant {
  color: var(--accent-primary);
}

/* Footer */
.app-footer {
  width: 100%;
  max-width: 1100px;
  padding: 1.5rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.shortcut-hints {
  display: flex;
  gap: 1.25rem;
}

.shortcut-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

kbd {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  padding: 0.15rem 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-main);
}

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.results-modal {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 40px var(--panel-glow);
  border-radius: 24px;
  padding: 2.5rem;
  width: 90%;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  text-align: center;
  transform: scale(0.9);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.active .results-modal {
  transform: scale(1);
}

.results-title {
  font-size: 1.8rem;
  font-weight: 800;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.tier-badge {
  align-self: center;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid var(--accent-primary);
  color: var(--accent-primary);
  padding: 0.4rem 1.2rem;
  border-radius: 20px;
  font-weight: 700;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.results-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.summary-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 1rem;
}

.summary-card .val {
  font-size: 2rem;
  font-weight: 800;
  font-family: var(--font-mono);
}

.scroll-arena {
  width: 100%;
}

.version-text {
  opacity: 0.6;
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.res-val-primary {
  color: var(--accent-primary);
}

.res-val-correct {
  color: var(--char-correct);
}

.res-val-char-streak {
  color: var(--accent-secondary);
}

.res-val-word-streak {
  color: var(--accent-primary);
}

.btn-primary {
  background: var(--accent-gradient);
  border: none;
  color: #fff;
  padding: 0.85rem 1.75rem;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 20px var(--panel-glow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px var(--panel-glow);
}

/* Responsive adjustments */
@media (max-width: 1100px) {
  .metrics-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .typing-track {
    font-size: 1.8rem;
  }
  .virtual-keyboard {
    display: none;
  }
}
