@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&family=JetBrains+Mono:wght@400;500&family=Space+Grotesk:wght@400;500;600;700&family=Doto:wght@200;300;400;500;600;700;800;900&display=swap');
/* 
▪▪ */
:root {
  /* Dark mode colors */
  --bg-primary: #000000;
  --bg-secondary: #000000;
  --bg-tertiary: #000000;
  --text-primary: #ffffff;
  --text-secondary: #a0a0a0;
  --accent-primary: #3b82f6;
  --accent-secondary: #60a5fa;
  --border-color: #475569;
  --hover-bg: #1a1a1a;
  --code-bg: #1e1e1e;
  --code-text: #d4d4d4;
  --code-comment: #6a9955;
  --code-keyword: #569cd6;
  --code-string: #ce9178;
  --code-function: #dcdcaa;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --grad-start: #60a7fa;
  --grad-end: #23d1ee;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

*::-webkit-scrollbar {
  display: none;
}

body {
  font-family: 'Space Grotesk', 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 1rem;
  line-height: 1.5;
}

/* Headings to match homepage */
h1, h2, h3, h4, h5, h6, .title {
  font-family: 'Doto', sans-serif;
}

/* Code font for typing text area */
pre, code, .text-display, .text-display * {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

/* Hide content by default to prevent FOUC */
body:not(.authenticated) .container {
  display: none;
}

/* Show loading state while checking authentication */
body:not(.authenticated)::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--bg-primary);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

body:not(.authenticated)::after {
  content: '';
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80px;
  height: 80px;
  background: url('../assets/images/logo circle .svg') no-repeat center;
  background-size: contain;
  z-index: 10000;
  animation: logoLoader 2s infinite ease-in-out;
}

@keyframes logoLoader {
  0% {
    transform: translate(-50%, -50%) scale(0.8) rotate(0deg);
    opacity: 0.3;
  }
  50% {
    transform: translate(-50%, -50%) scale(1.2) rotate(180deg);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) scale(0.8) rotate(360deg);
    opacity: 0.3;
  }
}

/* Show content when authenticated */
body.authenticated .container {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 64rem;
  padding: 0 1rem;
  padding-top: 84px; /* spacer for fixed nav */
  margin: 0 auto;
  position: relative;
  min-height: 100vh;
}

.container {
  width: 100%;
  max-width: 64rem;
  padding: 0 1rem;
  padding-top: 84px; /* spacer for fixed nav */
  margin: 0 auto;
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.top-nav {
  background: rgba(17, 25, 40, 0.55);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: 0 8px 32px rgba(0,0,0,0.35);
}

/* Light theme variables and global styles to match other pages */
[data-theme="light"] {
  --background-color: #ffffff;
  --card-background: rgba(255, 255, 255, 0.8);
  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --border-color: rgba(209, 213, 219, 0.5);
  --shadow-color: rgba(0, 0, 0, 0.1);
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(209, 213, 219, 0.3);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  --card-hover-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
  --accent-primary: #3b82f6;
  --accent-secondary: #1d4ed8;
  --hover-bg: rgba(59, 130, 246, 0.1);
  --bg-primary: #ffffff;
  --bg-secondary: rgba(249, 250, 251, 0.8);
  --bg-tertiary: rgba(243, 244, 246, 0.6);
}

/* Light mode body background */
[data-theme="light"] body,
body.light {
  background-color: #ffffff !important;
  color: #1f2937 !important;
}

/* Light mode nav */
body.light .top-nav,
[data-theme="light"] nav {
  background: rgba(255, 255, 255, 0.75) !important;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border: none;
}

/* Remove borders from sections (panels, headers, categories) */
.snippet-sidebar,
.controls-sidebar,
.snippet-sidebar .sidebar-header,
.category,
.zoom-buttons,
.mode-selector button,
.stat,
.result-popup .popup-content,
.text-display {
  border: none !important;
}

/* Ensure light-mode overrides don't reintroduce borders */
html[data-theme="light"] .typing-area,
html[data-theme="light"] .snippet-sidebar,
html[data-theme="light"] .controls-sidebar,
html[data-theme="light"] .snippet-sidebar .sidebar-header,
html[data-theme="light"] .category {
  border: none !important;
}

/* Ensure light mode text colors and element styling */
[data-theme="light"] .typing-area,
[data-theme="light"] .snippet-sidebar,
[data-theme="light"] .controls-sidebar {
  color: var(--text-primary);
}

[data-theme="light"] .snippet-sidebar .sidebar-header h3,
[data-theme="light"] .controls-sidebar .sidebar-header h3,
[data-theme="light"] .category h4,
[data-theme="light"] .controls-content h4 {
  color: var(--text-primary);
}

[data-theme="light"] .category li,
[data-theme="light"] .mode-selector button,
[data-theme="light"] .timer-buttons button,
[data-theme="light"] .zoom-buttons button,
[data-theme="light"] .reset-btn {
  color: var(--text-secondary);
}

[data-theme="light"] .category li:hover,
[data-theme="light"] .mode-selector button:hover,
[data-theme="light"] .timer-buttons button:hover,
[data-theme="light"] .zoom-buttons button:hover,
[data-theme="light"] .reset-btn:hover {
  color: var(--text-primary);
}

[data-theme="light"] .stat {
  color: var(--text-primary);
}

[data-theme="light"] #zoomLevel {
  color: var(--text-primary);
}

/* Comprehensive Light Theme Styling */

/* Main containers and layout */
[data-theme="light"] .typing-area,
[data-theme="light"] .snippet-sidebar,
[data-theme="light"] .controls-sidebar {
  color: var(--text-primary);
  box-shadow: none;
}

/* Headers and titles */
[data-theme="light"] .snippet-sidebar .sidebar-header,
[data-theme="light"] .controls-sidebar .sidebar-header {
  background: transparent !important;
  border-bottom: none;
}

[data-theme="light"] .snippet-sidebar .sidebar-header h3,
[data-theme="light"] .controls-sidebar .sidebar-header h3,
[data-theme="light"] .category h4,
[data-theme="light"] .controls-content h4 {
  color: var(--text-primary);
  font-weight: 600;
}

/* Category sections */
[data-theme="light"] .category {
  background: transparent !important;
  border: none;
  box-shadow: none;
}

/* Interactive elements - buttons and list items */
[data-theme="light"] .category li {
  background: transparent !important;
  color: var(--text-secondary);
  border: none;
  box-shadow: none;
}

[data-theme="light"] .category li:hover {
  background: rgba(59, 130, 246, 0.1) !important;
  color: var(--accent-primary);
  border-color: var(--accent-primary);
  transform: translateX(4px);
}

[data-theme="light"] .category li.active {
  background: var(--accent-primary) !important;
  color: white;
  border-color: var(--accent-primary);
  font-weight: 600;
}

/* Mode selector buttons */
[data-theme="light"] .mode-selector button {
  background: transparent !important;
  background-image: none !important;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  box-shadow: none;
  -webkit-background-clip: border-box !important;
  background-clip: border-box !important;
}

[data-theme="light"] .mode-selector button:hover {
  background: rgba(59, 130, 246, 0.1) !important;
  background-image: none !important;
  color: var(--accent-primary);
  border-color: var(--accent-primary);
  transform: translateY(-2px);
  -webkit-background-clip: border-box !important;
  background-clip: border-box !important;
}

[data-theme="light"] .mode-selector button.active {
  background: var(--accent-primary) !important;
  background-image: none !important;
  color: white;
  border-color: var(--accent-primary);
  font-weight: 600;
  -webkit-background-clip: border-box !important;
  background-clip: border-box !important;
}

/* Timer buttons */
[data-theme="light"] .timer-buttons {
  background: transparent !important;
  border: 1px solid var(--border-color);
  box-shadow: none;
}

[data-theme="light"] .timer-buttons button {
  background: transparent !important;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  font-size: 0.75rem;
  padding: 0.4rem 0.3rem;
  min-width: 36px;
  text-align: center;
}

[data-theme="light"] .timer-buttons button:hover {
  background: rgba(59, 130, 246, 0.1) !important;
  color: var(--accent-primary);
  border-color: var (--accent-primary);
  transform: translateY(-2px);
}

[data-theme="light"] .timer-buttons button.active {
  background: var(--accent-primary) !important;
  color: white;
  border-color: var(--accent-primary);
  font-weight: 600;
}

/* Zoom controls */
[data-theme="light"] .zoom-buttons {
  background: transparent !important;
  border: 1px solid var(--border-color);
  box-shadow: none;
}

[data-theme="light"] .zoom-buttons button {
  background: transparent !important;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

[data-theme="light"] .zoom-buttons button:hover {
  background: rgba(59, 130, 246, 0.1) !important;
  color: var(--accent-primary);
  border-color: var(--accent-primary);
  transform: scale(1.1);
}

[data-theme="light"] #zoomLevel {
  color: var(--text-primary);
  font-weight: 600;
}

/* Reset button */
[data-theme="light"] .reset-btn {
  background: transparent !important;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  box-shadow: none;
}

[data-theme="light"] .reset-btn:hover {
  background: rgba(59, 130, 246, 0.1) !important;
  color: var(--accent-primary);
  border-color: var(--accent-primary);
}

/* Stats display */
[data-theme="light"] .stat {
  color: var(--text-primary);
  background: transparent !important;
  border: none;
  box-shadow: none;
  border-radius: 6px;
  padding: 0.75rem;
}

/* Controls content sections */
[data-theme="light"] .controls-content > div {
  background: transparent !important;
  border: 1px solid var(--border-color);
  box-shadow: none;
}

/* Text display and typing area */
[data-theme="light"] .text-display {
  background: transparent !important;
  color: var(--text-primary);
  border-radius: 8px;
}

/* Result popup styling */
[data-theme="light"] .result-popup {
  background-color: rgba(0, 0, 0, 0.3);
}

[data-theme="light"] .popup-content {
  background: rgba(255, 255, 255, 0.75) !important;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  color: #111827; /* gray-900 for readability */
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
}

/* Light mode: Improve contrast for selected/active controls */
[data-theme="light"] .mode-selector button.active,
[data-theme="light"] .timer-buttons button.active,
[data-theme="light"] .zoom-buttons button.active,
[data-theme="light"] .hud-btn.active {
  background-color: rgba(59, 130, 246, 0.18) !important; /* light blue */
  background-image: none !important;
  color: #111827 !important; /* dark text for readability */
  border: 1px solid rgba(59, 130, 246, 0.50) !important;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.18) !important;
  -webkit-background-clip: border-box !important;
  background-clip: border-box !important;
}

[data-theme="light"] .mode-selector button.active:hover,
[data-theme="light"] .timer-buttons button.active:hover,
[data-theme="light"] .zoom-buttons button.active:hover,
[data-theme="light"] .hud-btn.active:hover {
  background-color: rgba(59, 130, 246, 0.24) !important;
}

/* Light mode: Active list items (categories/snippets) */
[data-theme="light"] .category li.active {
  background-color: rgba(59, 130, 246, 0.18) !important;
  color: #111827 !important;
  border: 1px solid rgba(59, 130, 246, 0.35) !important;
}

[data-theme="light"] .result-stat {
  background: transparent !important;
  color: var(--text-primary);
  border: none;
  box-shadow: none;
}

/* Light mode: result text colors and buttons */
[data-theme="light"] .popup-content h2 { color: #111827; }
[data-theme="light"] .stat-label { color: #374151; }
[data-theme="light"] .stat-value { color: #111827; }
[data-theme="light"] .retry-btn { background-color: #3b82f6; color: #fff; }
[data-theme="light"] .retry-btn:hover { background-color: #2563eb; }
[data-theme="light"] .close-btn { color: #374151; }
[data-theme="light"] .close-btn:hover { background-color: rgba(0,0,0,0.06); color: #111827; }

/* Light mode: HUD readability */
body.light .hud,
[data-theme="light"] .hud {
  background: rgba(255, 255, 255, 0.75) !important;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(0, 0, 0, 0.08) !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12) !important;
  color: #111827;
}

/* Light mode: Controls bar and contents readability */
body.light .controls-bar,
[data-theme="light"] .controls-bar { color: #111827; }
[data-theme="light"] .controls-bar svg { color: #374151; }
[data-theme="light"] .controls-content { color: #111827; }
[data-theme="light"] .controls-content p,
[data-theme="light"] .controls-content label,
[data-theme="light"] .controls-content small { color: #374151; }
[data-theme="light"] .mode-selector button,
[data-theme="light"] .timer-buttons button,
[data-theme="light"] .zoom-buttons button { color: #111827; }
[data-theme="light"] .zoom-buttons #zoomLevel { color: #111827; }

/* Light mode: flatten all controls sidebar buttons (no gradients) */
[data-theme="light"] .controls-sidebar button {
  background: var(--bg-secondary) !important;
  background-image: none !important;
  color: #111827 !important;
  border: 1px solid var(--border-color);
  box-shadow: none !important;
  -webkit-background-clip: border-box !important;
  background-clip: border-box !important;
}

[data-theme="light"] .controls-sidebar button:hover,
[data-theme="light"] .controls-sidebar button:focus {
  background: var(--hover-bg) !important;
  background-image: none !important;
  color: #111827 !important;
  border-color: var(--accent-primary);
}

[data-theme="light"] .controls-sidebar button.active,
[data-theme="light"] .controls-sidebar button[aria-pressed="true"] {
  background: rgba(59, 130, 246, 0.12) !important;
  background-image: none !important;
  color: #111827 !important;
  border-color: rgba(59, 130, 246, 0.35);
}

/* Light mode: Ensure flat, non-gradient buttons for Text/Code mode selector */
[data-theme="light"] .mode-selector button {
  background: var(--bg-secondary) !important;
  background-image: none !important;
  color: #111827;
  border: 1px solid var(--border-color);
  box-shadow: none;
}

[data-theme="light"] .mode-selector button:hover,
[data-theme="light"] .mode-selector button:focus {
  background: var(--hover-bg) !important;
  background-image: none !important;
  color: #111827;
  border-color: var(--accent-primary);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .mode-selector button.active,
[data-theme="light"] .mode-selector button[aria-pressed="true"] {
  background: rgba(59, 130, 246, 0.12) !important;
  background-image: none !important;
  border-color: rgba(59, 130, 246, 0.35);
  color: #111827;
}

/* Light mode: Typing feedback colors */
[data-theme="light"] .text-display,
[data-theme="light"] .text-display { color: #111827; }
[data-theme="light"] .text-display span { color: #6b7280; }
[data-theme="light"] .text-display span.correct { color: #111827; }
[data-theme="light"] .text-display span.incorrect { color: #b91c1c; text-decoration-color: #b91c1c; }
[data-theme="light"] .text-display span.current { border-bottom-color: #2563eb; }

/* Sidebar toggle buttons */
[data-theme="light"] .sidebar-toggle {
  background: var(--bg-secondary) !important;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  box-shadow: var(--glass-shadow);
}

[data-theme="light"] .sidebar-toggle:hover {
  background: var(--accent-primary) !important;
  color: white;
  border-color: var(--accent-primary);
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.3);
}

[data-theme="light"] .sidebar-toggle::after {
  background: var(--bg-primary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  box-shadow: 0 2px 8px var(--shadow-color);
}

/* Navigation back button light theme */
[data-theme="light"] nav a[href="index.html"] {
  background: var(--bg-secondary) !important;
  border-color: var(--border-color) !important;
}

[data-theme="light"] nav a[href="index.html"]:hover {
  background: var(--hover-bg) !important;
  border-color: var(--accent-primary) !important;
}

[data-theme="light"] nav a[href="index.html"] svg {
  color: var(--text-secondary);
}

[data-theme="light"] nav a[href="index.html"]:hover svg {
  color: var(--accent-primary);
}

/* Theme toggle button */
[data-theme="light"] #theme-toggle {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
}

[data-theme="light"] #theme-toggle:hover {
  background: var(--hover-bg);
  border-color: var(--accent-primary);
}

/* Logo styling */
[data-theme="light"] #logo-toggle img {
  filter: brightness(0.2) saturate(1.5);
}

[data-theme="light"] #logo-toggle img:hover {
  filter: brightness(0.1) saturate(2);
}

/* Mode Mismatch Notification */
.mode-mismatch-notification {
  position: fixed;
  top: 80px;
  right: 20px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 1001;
  opacity: 0;
  transform: translateX(100%);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  max-width: 320px;
  pointer-events: none;
}

.mode-mismatch-notification.show {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

.notification-content {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
}

.notification-icon {
  color: #f59e0b;
  flex-shrink: 0;
  margin-top: 2px;
}

.notification-text {
  flex: 1;
  font-size: 0.875rem;
  line-height: 1.4;
}

.notification-text strong {
  display: block;
  color: var(--text-primary);
  margin-bottom: 4px;
  font-weight: 600;
}

.notification-text span {
  color: var(--text-secondary);
}

.notification-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.notification-close:hover {
  background: var(--hover-bg);
  color: var(--text-primary);
}

/* Light theme notification */
[data-theme="light"] .mode-mismatch-notification {
  background: white;
  border-color: var(--border-color);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .notification-close:hover {
  background: rgba(59, 130, 246, 0.1);
  color: var(--accent-primary);
}

.back-btn {
  color: var(--text-secondary);
  text-decoration: none;
  display: flex;
  align-items: center;
  padding: 0.5rem;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.back-btn:hover {
  background-color: var(--hover-bg);
  color: var(--text-primary);
}

.title {
  margin: 0;
  flex-grow: 1;
  text-align: center;
}

.title img {
  filter: brightness(0) invert(1);
}

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 0.25rem 1rem;
  height: calc(100vh - 72px);
  position: relative;
  background-color: var(--bg-primary);
}

.typing-area {
  flex: 0 0 auto;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background: transparent;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  border: none;
  margin: 0;
  margin-top: auto;
  margin-bottom: auto;
  min-height: 50vh;
  transform: translateY(-40px);
  will-change: transform;
  border-radius: 0;
  box-shadow: none;
}

/* Inline timer badge at top-left of typing area */
.typing-timer-badge {
  position: absolute;
  top: 18px;
  left: 12px;
  z-index: 5;
  padding: 8px 12px;
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1;
  color: var(--text-primary);
  background: rgba(17, 25, 40, 0.55);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border: none;
  border-radius: 8px;
  box-shadow: none !important;
}

/* Light theme adjustments for badge */
body.light .typing-timer-badge {
  background: rgba(255, 255, 255, 0.6);
  border: none;
  box-shadow: none !important;
}

body.light .typing-area {
  background: transparent !important;
  border: none !important;
}

.progress-wrap{ height: 6px; background: rgba(255,255,255,0.08); border-radius: 9999px; overflow: hidden; margin-bottom: 8px; border: 1px solid rgba(255,255,255,0.08);} 
.progress-bar{ height: 100%; width: 0%; background: linear-gradient(90deg,var(--grad-start),var(--grad-end)); transition: width 0.15s ease; }

.controls-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.75rem;
  padding: 0.75rem;
  background: rgba(17, 25, 40, 0.45);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 8px 32px rgba(0,0,0,0.35);
}

body.light .controls-bar {
  background: rgba(255, 255, 255, 0.15) !important;
  border: 1px solid rgba(0, 0, 0, 0.1) !important;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1) !important;
}

.mode-selector {
  display: flex;
  gap: 0.35rem;
  background: none !important;
  padding: 0 !important;
  margin-bottom: 0.5rem;
}

.timer-options, .zoom-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.timer-buttons, .zoom-buttons {
  display: flex;
  gap: 0.25rem;
  align-items: center;
}

button,
input,
select,
textarea {
  border: none;
  outline: none;
}

button:focus,
input:focus,
select:focus,
textarea:focus {
  outline: none;
}

button {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
}

button:hover {
  background-color: var(--hover-bg);
  color: var(--text-primary);
}

button.active {
  background-color: var(--accent-primary);
  border-color: var(--accent-primary);
  color: white;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  background: none !important;
  padding: 0 !important;
  margin-bottom: 0.5rem;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.75rem;
  background-color: var(--bg-secondary);
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 0.85rem;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.stat:hover {
  background-color: var(--hover-bg);
  transform: translateY(-2px);
  border-color: var(--accent-primary);
}

.stat span:first-child {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.25rem;
}

.stat span:last-child {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--accent-primary);
  transition: color 0.2s ease;
}

#timeLeft {
  transition: color 0.2s ease;
}

#timeLeft.warning {
  color: #ef4444;
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0% { opacity: 1; }
  50% { opacity: 0.7; }
  100% { opacity: 1; }
}

.text-display {
  max-width: 1100px;
  width: 100%;
  min-height: 220px;
  max-height: 34vh;
  font-family: 'JetBrains Mono', monospace;
  font-size: 2rem;
  line-height: 2.6rem;
  padding: 12px;
  padding-top: 34px;
  padding-left: 20px;
  border-radius: 0;
  outline: none;
  overflow: auto;
  white-space: pre-wrap;
  background: transparent;
  color: var(--text-primary);
  border: none;
}

/* Responsive adjustments for text area height */
@media (max-height: 730px) {
  .text-display { max-height: 32vh; }
}

@media (min-width: 1280px) and (min-height: 900px) {
  .text-display { max-height: 42vh; }
}

.text-display::-webkit-scrollbar{ width: 10px; }
.text-display::-webkit-scrollbar-thumb{ background: linear-gradient(180deg,var(--grad-start),var(--grad-end)); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
.text-display::-webkit-scrollbar-track{ background: rgba(255,255,255,0.05); }
.text-display{ scrollbar-width: thin; scrollbar-color: rgba(96,167,250,0.8) transparent; }

.text-display.code {
  font-family: 'JetBrains Mono', monospace;
}

.text-display.code .indent-1 { padding-left: 2rem; }
.text-display.code .indent-2 { padding-left: 4rem; }
.text-display.code .indent-3 { padding-left: 6rem; }
.text-display.code .indent-4 { padding-left: 8rem; }

.text-display.code .keyword { color: var(--code-keyword); }
.text-display.code .string { color: var(--code-string); }
.text-display.code .function { color: var(--code-function); }
.text-display.code .comment { color: var(--code-comment); }

.text-display:focus {
  border: none;
  box-shadow: none;
}

.text-display span {
  position: relative;
}

.text-display span { color: #6b7280; }
.text-display span.correct { color: #e5e7eb; }

.text-display span.incorrect {
  color: #ef4444;
  text-decoration: underline;
}

.text-display span.current { color: transparent; background: linear-gradient(90deg,var(--grad-start),var(--grad-end)); -webkit-background-clip: text; background-clip: text; border-bottom: 2px solid; border-image: linear-gradient(90deg,var(--grad-start),var(--grad-end)) 1; }

/* Monkeytype-like HUD */
.hud { width: 100%; max-width: 1100px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 6px 12px; padding-top: 16px; background: rgba(17,25,40,0.45); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border-radius: var(--radius-lg); border: none; box-shadow: 0 8px 32px rgba(0,0,0,0.35); transition: opacity 0.3s ease, transform 0.3s ease; }

/* Smart HUD visibility states */
.hud.typing-mode {
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
}

.hud.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.hud .left, .hud .center, .hud .right { display: flex; align-items: center; gap: 10px; }
.hud .right { justify-content: flex-end; }
.hud .group { display: flex; align-items: center; gap: 10px; }
.hud .label { color: var(--text-secondary); font-size: 0.9rem; }
.hud-btn { background: transparent; color: var(--text-secondary); padding: 6px 10px; border-radius: 6px; border: 1px solid transparent; transition: 120ms ease; text-transform: lowercase; }
.hud-btn:hover { color: var(--text-primary); background: var(--hover-bg); }
.hud-btn.active { color: transparent; background: linear-gradient(90deg,var(--grad-start),var(--grad-end)); -webkit-background-clip: text; background-clip: text; border-color: rgba(255,255,255,0.14); }
/* Inline stats inside HUD */
.stats-inline { display: inline-flex; align-items: center; gap: 14px; margin-right: 8px; }
.stats-inline .stat { padding: 2px 6px; border-radius: 6px; background: transparent; border: 1px solid rgba(255,255,255,0.06); }
.stats-inline .stat span { color: var(--text-secondary); font-size: 0.75rem; margin-right: 6px; }
.stats-inline .stat strong { color: #e5e7eb; font-size: 0.95rem; }
.hud-icon { width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; background: transparent; border: 1px solid rgba(255,255,255,0.08); color: var(--text-secondary); transition: 150ms ease; }
.hud-icon:hover { background: var(--hover-bg); color: var(--text-primary); }

/* HUD timer overrides */
.hud .timer-buttons { display: inline-flex; gap: 6px; padding: 0; border: none; }
.hud .timer-buttons button { background: transparent; color: var(--text-secondary); padding: 4px 8px; border-radius: 6px; border: 1px solid transparent; min-width: 36px; }
.hud .timer-buttons button:hover { background: var(--hover-bg); color: var(--text-primary); }
.hud .timer-buttons button.active { color: transparent; background: linear-gradient(90deg,var(--grad-start),var(--grad-end)); -webkit-background-clip: text; background-clip: text; border-color: rgba(255,255,255,0.18); box-shadow: 0 2px 8px rgba(59,131,246,0.18); }

/* Bottom stats */
.bottom-stats { display: flex; gap: 24px; align-items: center; justify-content: center; opacity: 0.95; padding: 10px 12px; background: rgba(17,25,40,0.45); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border-radius: var(--radius-lg); border: 1px solid rgba(255,255,255,0.08); box-shadow: 0 8px 32px rgba(0,0,0,0.35); }
.bottom-stats .stat { background: transparent; border: none; padding: 6px 10px; }
.bottom-stats .stat span { color: var(--text-secondary); font-size: 0.8rem; }
.bottom-stats .stat strong { color: #e5e7eb; font-size: 1.1rem; }

/* Light theme alignment with homepage */
[data-theme="light"] .hud, body.light .hud,
[data-theme="light"] .bottom-stats, body.light .bottom-stats {
  background: rgba(255,255,255,0.75) !important;
  border: 1px solid rgba(0,0,0,0.08) !important;
  box-shadow: 0 8px 32px rgba(0,0,0,0.1) !important;
}
[data-theme="light"] .hud-btn,
[data-theme="light"] .hud .timer-buttons button { color: #6b7280; }
[data-theme="light"] .stats-inline .stat { border-color: rgba(0,0,0,0.08); }
[data-theme="light"] .hud-icon { border-color: rgba(0,0,0,0.12); }
[data-theme="light"] .hud-btn:hover,
[data-theme="light"] .hud .timer-buttons button:hover { color: #111; }
[data-theme="light"] .text-display span { color: #6b7280; }
[data-theme="light"] .text-display span.correct { color: #111; }

.snippet-sidebar,
.controls-sidebar {
  background: transparent;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  width: 280px;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  height: 100%;
  position: fixed;
  top: 72px;
  z-index: 100;
  box-shadow: none;
  padding: 1rem;
  margin-right: 0;
  right: 20px;
}

body.light .snippet-sidebar,
body.light .controls-sidebar {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

.snippet-sidebar {
  left: 0;
  transform: translateX(0);
}

.controls-sidebar {
  right: 0;
  transform: translateX(0);
}

.snippet-sidebar .sidebar-header {
  padding: 0.75rem;
  background-color: transparent;
}

.snippet-sidebar .sidebar-header h3 {
  font-size: 0.95rem;
  font-weight: 500;
}

.snippet-categories {
  padding: 0.75rem;
  overflow-y: auto;
  height: calc(100% - 48px);
}

.category {
  margin-bottom: 1rem;
  background-color: transparent;
  border-radius: 6px;
  padding: 0.75rem;
}

.category:last-child {
  margin-bottom: 0;
}

.category h4 {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.category ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.category li {
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s ease;
  color: var(--text-secondary);
  background-color: transparent;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.category li:hover {
  background-color: var(--hover-bg);
  color: var(--text-primary);
  transform: translateX(4px);
}

.category li.active {
  background-color: var(--accent-primary);
  color: var(--text-primary);
  font-weight: 500;
}

.category li::before {
  width: 14px;
  height: 14px;
  opacity: 0.7;
}

#textSnippets li:nth-child(1)::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6h16M4 12h16M4 18h7'/%3E%3C/svg%3E");
}

#textSnippets li:nth-child(2)::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 2L2 7l10 5 10-5-10-5zM2 17l10 5 10-5M2 12l10 5 10-5'/%3E%3C/svg%3E");
}

#textSnippets li:nth-child(3)::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 2L2 7l10 5 10-5-10-5zM2 17l10 5 10-5M2 12l10 5 10-5'/%3E%3C/svg%3E");
}

#textSnippets li:nth-child(4)::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 19.5A2.5 2.5 0 0 1 6.5 17H20'/%3E%3Cpath d='M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z'/%3E%3C/svg%3E");
}

#textSnippets li:nth-child(5)::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 16v-4M12 8h.01'/%3E%3C/svg%3E");
}

#codeSnippets li:nth-child(1)::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M16 18l6-6-6-6M8 6l-6 6 6 6'/%3E%3C/svg%3E");
}

#codeSnippets li:nth-child(2)::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M16 18l6-6-6-6M8 6l-6 6 6 6'/%3E%3C/svg%3E");
}

#codeSnippets li:nth-child(3)::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M16 18l6-6-6-6M8 6l-6 6 6 6'/%3E%3C/svg%3E");
}

#codeSnippets li:nth-child(4)::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M16 18l6-6-6-6M8 6l-6 6 6 6'/%3E%3C/svg%3E");
}

#codeSnippets li:nth-child(5)::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M16 18l6-6-6-6M8 6l-6 6 6 6'/%3E%3C/svg%3E");
}

/* Right Sidebar (Controls) */
.controls-sidebar .sidebar-header {
  padding: 0.75rem;
  background-color: var(--bg-tertiary);
}

.controls-sidebar .sidebar-header h3 {
  font-size: 0.95rem;
  font-weight: 500;
}

.controls-content {
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  overflow-y: auto;
  height: 100%;
}

.controls-content > div {
  background-color: transparent;
  border-radius: 6px;
  padding: 0.75rem;
}

.controls-content h4 {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Mode Selector */
.mode-selector button {
  flex: 1;
  padding: 0.6rem;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-weight: 500;
  color: var(--text-secondary);
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.mode-selector button:hover {
  background-color: var(--hover-bg);
  color: var(--text-primary);
  transform: translateY(-2px);
}

.mode-selector button.active {
  background-color: var(--accent-primary);
  color: var(--text-primary);
  box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

/* Timer Options */
.timer-options {
  background: none !important;
  padding: 0 !important;
  margin-bottom: 0.5rem;
}

.timer-buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.35rem;
  background-color: transparent;
  border-radius: 6px;
  padding: 0.5rem;
}

.timer-buttons button {
  padding: 0.5rem;
  background: transparent;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 500;
  color: var(--text-secondary);
  font-size: 0.85rem;
  transition: all 0.2s ease;
  text-align: center;
  border: 1px solid transparent;
}

.timer-buttons button:hover {
  background-color: var(--hover-bg);
  color: var(--text-primary);
  transform: translateY(-2px);
  border-color: var(--accent-primary);
}

.timer-buttons button.active {
  background-color: var(--accent-primary);
  color: var(--text-primary);
  box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
  border-color: var(--accent-primary);
}

/* Zoom Controls */
.zoom-controls {
  background: none !important;
  padding: 0 !important;
}

.zoom-buttons {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background-color: transparent;
  border-radius: 6px;
  padding: 0.5rem;
}

.zoom-buttons button {
  width: 32px;
  height: 32px;
  background: transparent;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: var(--text-secondary);
  transition: all 0.2s ease;
}

.zoom-buttons button:hover {
  background-color: var(--hover-bg);
  color: var(--text-primary);
  transform: scale(1.1);
}

#zoomLevel {
  min-width: 60px;
  text-align: center;
  font-weight: 500;
  color: var(--text-primary);
  font-size: 0.9rem;
  padding: 0 0.5rem;
}

/* Reset Button */
.reset-btn {
  width: 100%;
  padding: 0.5rem;
  background: var(--bg-secondary);
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.85rem;
  transition: all 0.2s ease;
  margin-top: 0.5rem;
}

.reset-btn:hover {
  background-color: var(--hover-bg);
  color: var(--text-primary);
}

/* Collapsed state */
.snippet-sidebar.collapsed {
  transform: translateX(-100%);
}

.controls-sidebar.collapsed {
  transform: translateX(100%);
}

.result-popup {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.6);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  will-change: backdrop-filter, opacity;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.result-popup.active {
  display: flex;
  opacity: 1;
}

.popup-content {
  background: rgba(17, 17, 17, 0.45);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  padding: 2rem;
  border-radius: 12px;
  min-width: 300px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transform: translateY(20px);
  transition: transform 0.3s ease;
}

.result-popup.active .popup-content {
  transform: translateY(0);
}

.popup-content h2 {
  margin-bottom: 1.5rem;
  text-align: center;
  color: var(--text-primary);
}

.result-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.result-stat {
  text-align: center;
  background-color: transparent;
  padding: 1rem;
  border-radius: 6px;
}

.stat-label {
  display: block;
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--accent-primary);
}

.popup-buttons {
  display: flex;
  gap: 1rem;
}

.popup-buttons button {
  flex: 1;
  padding: 0.75rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s ease;
}

.retry-btn {
  background-color: var(--accent-primary);
  color: white;
}

.retry-btn:hover {
  background-color: var(--accent-secondary);
}

.close-btn {
  background-color: transparent;
  color: var(--text-secondary);
}

.close-btn:hover {
  background-color: var(--hover-bg);
  color: var(--text-primary);
}

/* Responsive adjustments for collapsed states */
.snippet-sidebar.collapsed + .typing-area {
  margin-left: 0;
}

.typing-area + .controls-sidebar.collapsed {
  margin-right: 0;
}

/* Mobile Restriction Styles - Simplified & Theme Matching */
.mobile-restriction {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  background: #000000;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
  box-sizing: border-box;
  font-family: 'Space Grotesk', sans-serif;
}

.mobile-restriction.hidden {
  display: none;
}

.mobile-restriction-content {
  background: rgba(15, 15, 15, 0.95);
  backdrop-filter: blur(20px);
  border-radius: 16px;
  padding: 32px;
  max-width: 380px;
  width: 100%;
  text-align: center;
  border: 1px solid rgba(96, 167, 250, 0.2);
  box-shadow: 0 0 40px rgba(96, 167, 250, 0.1);
}

.mobile-restriction-icon {
  margin-bottom: 16px;
}

.mobile-restriction-icon svg {
  color: #60a7fa;
  filter: drop-shadow(0 0 8px rgba(96, 167, 250, 0.3));
}

.mobile-restriction h2 {
  color: #ffffff;
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 12px;
  font-family: 'Doto', sans-serif;
}

.mobile-restriction p {
  color: #a1a1aa;
  font-size: 16px;
  line-height: 1.5;
  margin-bottom: 20px;
}

.mobile-suggestion {
  background: rgba(96, 167, 250, 0.1);
  border: 1px solid rgba(96, 167, 250, 0.2);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 24px;
}

.mobile-suggestion p {
  margin: 0;
  color: #60a7fa;
  font-size: 14px;
  font-weight: 500;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #60a7fa;
  color: #000000;
  text-decoration: none;
  padding: 12px 20px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.3s ease;
  box-shadow: 0 0 20px rgba(96, 167, 250, 0.3);
}

.back-btn:hover {
  background: #3b82f6;
  transform: translateY(-1px);
  box-shadow: 0 0 30px rgba(96, 167, 250, 0.5);
}

.back-btn svg {
  transition: transform 0.3s ease;
}

.back-btn:hover svg {
  transform: translateX(-2px);
}

/* Responsive Design */
@media (max-width: 1200px) {
  .main-content {
    padding: 0.5rem;
  }
  
  .snippet-sidebar,
  .controls-sidebar {
    width: 180px;
  }
  
  .typing-area {
    margin: 0 180px;
  }
}

@media (max-width: 768px) {
  .main-content {
    flex-direction: column;
  }
  
  .snippet-sidebar,
  .controls-sidebar {
    position: relative;
    top: 0;
    width: 100%;
    height: auto;
    transform: none;
  }
  
  .typing-area {
    margin: 0;
  }
  
  .snippet-sidebar.collapsed,
  .controls-sidebar.collapsed {
    display: none;
  }
}

@media screen and (max-width: 480px) {
  .container {
    padding: 0 0.5rem;
  }
  
  .controls-bar {
    padding: 0.5rem;
  }
  
  button {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
  }
  
  .text-display {
    padding: 1rem;
    font-size: 1rem;
  }
}

/* Floating Toggle Buttons */
.sidebar-toggle {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  background-color: var(--bg-tertiary);
  color: var(--text-secondary);
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 101;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: none;
}

.sidebar-toggle:hover {
  background-color: var(--accent-primary);
  color: var(--text-primary);
  transform: translateY(-50%) scale(1.1);
  box-shadow: none;
}

.sidebar-toggle:active {
  transform: translateY(-50%) scale(0.95);
}

.sidebar-toggle svg {
  width: 20px;
  height: 20px;
  transition: transform 0.3s ease;
}

.sidebar-toggle:hover svg {
  transform: scale(1.1);
}

.sidebar-toggle.left {
  left: 0;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  padding-left: 4px;
}

.sidebar-toggle.right {
  right: 0;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  padding-right: 4px;
}

/* Hide toggle buttons when sidebars are visible */
.snippet-sidebar:not(.collapsed) ~ .sidebar-toggle.left,
.controls-sidebar:not(.collapsed) ~ .sidebar-toggle.right {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-50%) translateX(-100%);
}

/* Show toggle buttons when sidebars are collapsed */
.snippet-sidebar.collapsed ~ .sidebar-toggle.left,
.controls-sidebar.collapsed ~ .sidebar-toggle.right {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(-50%) translateX(0);
}

/* Adjust toggle button positions */
.sidebar-toggle.left {
  left: 0;
}

.sidebar-toggle.right {
  right: 0;
}

/* Add tooltip */
.sidebar-toggle::after {
  content: attr(data-tooltip);
  position: absolute;
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 0.8rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s ease;
  box-shadow: none;
}

.sidebar-toggle.left::after {
  left: 100%;
  top: 50%;
  transform: translateY(-50%) translateX(8px);
}

.sidebar-toggle.right::after {
  right: 100%;
  top: 50%;
  transform: translateY(-50%) translateX(-8px);
}

.sidebar-toggle:hover::after {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .sidebar-toggle {
    display: none !important;
  }
}

/* High Score Badge */
.high-score-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: rgba(255, 215, 0, 0.1);
  border: 1px solid rgba(255, 215, 0, 0.3);
  border-radius: 8px;
  margin-right: 12px;
  transition: all 0.3s ease;
  position: relative;
  overflow: visible;
}

.high-score-badge:hover {
  background: rgba(255, 215, 0, 0.15);
  border-color: rgba(255, 215, 0, 0.5);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 215, 0, 0.2);
}

.trophy-icon {
  color: #fbbf24;
  filter: drop-shadow(0 0 6px rgba(251, 191, 36, 0.4));
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-4px);
  }
}

.high-score-value {
  color: #fbbf24;
  font-weight: 700;
  font-size: 1.1rem;
  text-shadow: 0 0 10px rgba(251, 191, 36, 0.3);
  min-width: 32px;
  text-align: center;
}

/* New Record Celebration Animation */
.high-score-badge.new-record {
  animation: celebrate 1s ease-out;
}

@keyframes celebrate {
  0% {
    transform: scale(1) rotate(0deg);
  }
  25% {
    transform: scale(1.2) rotate(-5deg);
  }
  50% {
    transform: scale(1.3) rotate(5deg);
  }
  75% {
    transform: scale(1.2) rotate(-3deg);
  }
  100% {
    transform: scale(1) rotate(0deg);
  }
}

.high-score-badge.new-record .trophy-icon {
  animation: spin 0.6s ease-in-out, glow 1s ease-out;
}

@keyframes spin {
  0% {
    transform: rotate(0deg) scale(1);
  }
  50% {
    transform: rotate(180deg) scale(1.3);
  }
  100% {
    transform: rotate(360deg) scale(1);
  }
}

@keyframes glow {
  0%, 100% {
    filter: drop-shadow(0 0 6px rgba(251, 191, 36, 0.4));
  }
  50% {
    filter: drop-shadow(0 0 20px rgba(251, 191, 36, 0.8));
  }
}

.high-score-badge.new-record::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, rgba(251, 191, 36, 0.3) 0%, transparent 70%);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: ripple 1s ease-out;
  pointer-events: none;
}

@keyframes ripple {
  0% {
    width: 100%;
    height: 100%;
    opacity: 1;
  }
  100% {
    width: 300%;
    height: 300%;
    opacity: 0;
  }
}

/* Light Theme High Score Badge */
[data-theme="light"] .high-score-badge {
  background: rgba(251, 191, 36, 0.15);
  border-color: rgba(251, 191, 36, 0.4);
}

[data-theme="light"] .high-score-badge:hover {
  background: rgba(251, 191, 36, 0.25);
  border-color: rgba(251, 191, 36, 0.6);
  box-shadow: 0 4px 12px rgba(251, 191, 36, 0.3);
}

[data-theme="light"] .trophy-icon {
  color: #d97706;
  filter: drop-shadow(0 0 6px rgba(217, 119, 6, 0.4));
}

[data-theme="light"] .high-score-value {
  color: #d97706;
  text-shadow: 0 0 10px rgba(217, 119, 6, 0.2);
}

/* ============================================
   MOBILE MODE - PROFESSIONAL PREMIUM UI/UX
   ============================================ */

/* Mobile Layout Base */
.mobile-layout {
  width: 100%;
  height: 100vh;
  height: 100dvh; /* Dynamic viewport height for mobile browsers */
  background: var(--bg-primary);
  overflow: hidden;
  position: fixed;
  top: 0;
  left: 0;
  display: flex;
  flex-direction: column;
}

/* Desktop layout - hide on mobile */
@media (max-width: 768px) {
  .desktop-layout {
    display: none !important;
  }
}

/* Mobile Header */
.mobile-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  z-index: 1000;
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.3);
}

.mobile-header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  padding: 0 16px;
}

.mobile-back-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(96, 167, 250, 0.1);
  border: 1px solid rgba(96, 167, 250, 0.2);
  border-radius: 12px;
  color: #60a7fa;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
}

.mobile-back-btn:active {
  transform: scale(0.95);
  background: rgba(96, 167, 250, 0.15);
}

.mobile-logo {
  flex: 1;
  display: flex;
  justify-content: center;
  margin: 0 16px;
}

.mobile-logo img {
  height: 28px;
  filter: brightness(0) invert(1);
}

.mobile-menu-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(96, 167, 250, 0.1);
  border: 1px solid rgba(96, 167, 250, 0.2);
  border-radius: 12px;
  color: #60a7fa;
  border: none;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-menu-btn:active {
  transform: scale(0.95);
  background: rgba(96, 167, 250, 0.15);
}

/* Mobile Stats Bar */
.mobile-stats-bar {
  position: fixed;
  top: 56px;
  left: 0;
  right: 0;
  height: 70px;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 20px;
  z-index: 999;
}

.mobile-stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: 1;
  padding: 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  transition: all 0.3s ease;
}

.mobile-stat-item.highlight {
  background: rgba(96, 167, 250, 0.1);
  border: 1px solid rgba(96, 167, 250, 0.2);
}

.mobile-stat-value {
  font-size: 24px;
  font-weight: 700;
  color: #60a7fa;
  font-family: 'Doto', sans-serif;
  line-height: 1;
  letter-spacing: -0.5px;
}

.mobile-stat-item.highlight .mobile-stat-value {
  color: #60a7fa;
}

/* Mobile Typing Container */
.mobile-typing-container {
  position: fixed;
  top: 126px;
  left: 0;
  right: 0;
  bottom: 80px;
  padding: 20px;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

.mobile-typing-area {
  width: 100%;
  min-height: calc(100vh - 226px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
}

/* Timer Overlay - Shows during typing */
.mobile-timer-overlay {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 10;
  opacity: 0;
  visibility: hidden;
  transform: scale(0.8);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-timer-overlay.visible {
  opacity: 1;
  visibility: visible;
  transform: scale(1);
}

.mobile-timer-circle {
  position: relative;
  width: 120px;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 50%;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  border: 2px solid rgba(96, 167, 250, 0.3);
}

.mobile-timer-ring {
  position: absolute;
  top: 0;
  left: 0;
  transform: rotate(-90deg);
}

.mobile-timer-ring circle {
  fill: none;
  stroke: #60a7fa;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 339.292;
  stroke-dashoffset: 0;
  animation: timerPulse 1s ease-in-out infinite;
}

@keyframes timerPulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.6;
  }
}

.mobile-timer-circle.warning {
  border-color: rgba(239, 68, 68, 0.5);
  animation: warningShake 0.5s ease-in-out infinite;
}

.mobile-timer-circle.warning .mobile-timer-ring circle {
  stroke: #ef4444;
  animation: timerWarning 0.5s ease-in-out infinite;
}

@keyframes warningShake {
  0%, 100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-2px);
  }
  75% {
    transform: translateX(2px);
  }
}

@keyframes timerWarning {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.3;
  }
}

.mobile-timer-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  z-index: 1;
}

.mobile-overlay-seconds {
  font-size: 36px;
  font-weight: 700;
  color: #60a7fa;
  font-family: 'Doto', sans-serif;
  line-height: 1;
}

.mobile-timer-circle.warning .mobile-overlay-seconds {
  color: #ef4444;
}

.mobile-overlay-label {
  font-size: 12px;
  font-weight: 600;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* New Record Badge */
.mobile-new-record-badge {
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  color: #000;
  padding: 8px 20px;
  border-radius: 50px;
  font-weight: 700;
  font-size: 14px;
  box-shadow: 0 4px 20px rgba(251, 191, 36, 0.6);
  animation: badgeBounce 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  z-index: 10;
}

@keyframes badgeBounce {
  0% {
    transform: translateX(-50%) translateY(-100px) scale(0);
    opacity: 0;
  }
  50% {
    transform: translateX(-50%) translateY(5px) scale(1.1);
  }
  100% {
    transform: translateX(-50%) translateY(0) scale(1);
    opacity: 1;
  }
}

.badge-sparkle {
  font-size: 18px;
  animation: sparkleRotate 2s linear infinite;
}

@keyframes sparkleRotate {
  0%, 100% {
    transform: rotate(0deg) scale(1);
  }
  50% {
    transform: rotate(180deg) scale(1.2);
  }
}

/* Performance Rating */
.mobile-performance-rating {
  font-size: 18px;
  font-weight: 700;
  margin-top: 12px;
  padding: 8px 16px;
  border-radius: 20px;
  display: inline-block;
}

.mobile-performance-rating.excellent {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}

.mobile-performance-rating.great {
  background: rgba(96, 167, 250, 0.15);
  color: #60a7fa;
}

.mobile-performance-rating.good {
  background: rgba(251, 191, 36, 0.15);
  color: #fbbf24;
}

.mobile-performance-rating.fair {
  background: rgba(249, 115, 22, 0.15);
  color: #f97316;
}

.mobile-performance-rating.practice {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

/* Mobile Results Grid - Enhanced */
.mobile-results-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 24px;
}

.mobile-result-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 20px 16px;
  text-align: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.mobile-result-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(96, 167, 250, 0.3);
  transform: scaleX(0);
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-panel.active .mobile-result-card::before {
  transform: scaleX(1);
}

.mobile-result-card:nth-child(1)::before {
  transition-delay: 0.1s;
}

.mobile-result-card:nth-child(2)::before {
  transition-delay: 0.2s;
}

.mobile-result-card:nth-child(3)::before {
  transition-delay: 0.3s;
}

.mobile-result-card:nth-child(4)::before {
  transition-delay: 0.4s;
}

.mobile-result-card:nth-child(5)::before {
  transition-delay: 0.5s;
}

.mobile-result-card.primary {
  background: rgba(96, 167, 250, 0.08);
  border-color: rgba(96, 167, 250, 0.2);
}

.mobile-result-card.primary::before {
  background: #60a7fa;
}

.mobile-result-card.highlight {
  background: rgba(251, 191, 36, 0.08);
  border-color: rgba(251, 191, 36, 0.2);
  grid-column: span 2;
}

.mobile-result-card.highlight::before {
  background: #fbbf24;
}

.mobile-result-icon {
  font-size: 28px;
  margin-bottom: 8px;
  display: block;
  animation: iconBounce 0.6s ease-out;
}

@keyframes iconBounce {
  0% {
    transform: scale(0) rotate(-180deg);
    opacity: 0;
  }
  50% {
    transform: scale(1.2) rotate(10deg);
  }
  100% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
}

.mobile-result-value {
  font-size: 32px;
  font-weight: 700;
  color: #60a7fa;
  font-family: 'Doto', sans-serif;
  line-height: 1;
  margin-bottom: 8px;
  animation: numberCount 0.8s ease-out;
}

@keyframes numberCount {
  0% {
    opacity: 0;
    transform: translateY(20px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.mobile-result-card.primary .mobile-result-value {
  font-size: 40px;
  color: #60a7fa;
}

.mobile-result-card.highlight .mobile-result-value {
  color: #fbbf24;
}

.mobile-result-label {
  font-size: 11px;
  font-weight: 600;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Confetti Animation */
.confetti {
  position: fixed;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  animation: confettiFall 3s linear forwards;
  pointer-events: none;
  z-index: 9999;
}

@keyframes confettiFall {
  0% {
    top: -10px;
    transform: translateX(0) rotate(0deg);
    opacity: 1;
  }
  100% {
    top: 100vh;
    transform: translateX(100px) rotate(720deg);
    opacity: 0;
  }
}

/* Mobile Results Actions - Enhanced */
.mobile-results-actions {
  display: flex;
  gap: 12px;
  padding: 0 24px 32px;
}

.mobile-action-btn {
  flex: 1;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 16px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: none;
  position: relative;
  overflow: hidden;
}

.mobile-action-btn::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.mobile-action-btn:active::after {
  width: 300px;
  height: 300px;
}

.mobile-action-btn.primary {
  background: #60a7fa;
  color: white;
  box-shadow: 0 4px 20px rgba(96, 167, 250, 0.4);
}

.mobile-action-btn.primary:active {
  transform: scale(0.96);
  box-shadow: 0 2px 12px rgba(96, 167, 250, 0.3);
}

.mobile-action-btn.secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #e5e7eb;
}

.mobile-action-btn.secondary:active {
  transform: scale(0.96);
  background: rgba(255, 255, 255, 0.08);
}

/* Light Theme Adjustments */
[data-theme="light"] .mobile-timer-circle {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(37, 99, 235, 0.3);
}

[data-theme="light"] .mobile-overlay-seconds {
  color: #2563eb;
}

[data-theme="light"] .mobile-timer-circle.warning {
  border-color: rgba(220, 38, 38, 0.5);
}

[data-theme="light"] .mobile-timer-circle.warning .mobile-overlay-seconds {
  color: #dc2626;
}

[data-theme="light"] .mobile-result-card {
  background: rgba(0, 0, 0, 0.02);
  border-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .mobile-result-card.primary {
  background: rgba(37, 99, 235, 0.05);
  border-color: rgba(37, 99, 235, 0.2);
}

[data-theme="light"] .mobile-result-value {
  color: #2563eb;
}

[data-theme="light"] .mobile-result-card.highlight .mobile-result-value {
  color: #d97706;
}

/* Mobile Native Input - Hidden but functional */
.mobile-native-input {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  z-index: 2;
  font-size: 16px; /* Prevent zoom on iOS */
  background: transparent;
  border: none;
  outline: none;
  color: transparent;
  caret-color: transparent;
  pointer-events: auto;
}

/* Visual Text Display */
.mobile-text-display {
  font-family: 'JetBrains Mono', 'Space Grotesk', monospace;
  font-size: 18px;
  line-height: 1.8;
  color: #e5e7eb;
  white-space: pre-wrap;
  word-wrap: break-word;
  padding: 24px;
  background: rgba(255, 255, 255, 0.02);
  border: 2px solid rgba(96, 167, 250, 0.15);
  border-radius: 20px;
  min-height: 200px;
  position: relative;
  z-index: 1;
  pointer-events: none;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
}

.mobile-text-display.focused {
  border-color: rgba(96, 167, 250, 0.4);
  background: rgba(255, 255, 255, 0.03);
  box-shadow: 0 8px 32px rgba(96, 167, 250, 0.1);
}

.mobile-text-display .char {
  position: relative;
  transition: color 0.15s ease;
}

.mobile-text-display .char.correct {
  color: #10b981;
}

.mobile-text-display .char.incorrect {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.15);
  border-radius: 4px;
  padding: 0 2px;
}

.mobile-text-display .char.current {
  color: #60a7fa;
  animation: mobileBlink 1s infinite;
}

.mobile-text-display .char.current::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 2px;
  background: #60a7fa;
  animation: mobileCaretPulse 1.5s ease-in-out infinite;
}

@keyframes mobileBlink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0.7; }
}

@keyframes mobileCaretPulse {
  0%, 100% { opacity: 1; transform: scaleX(1); }
  50% { opacity: 0.5; transform: scaleX(0.8); }
}

/* Mobile Progress Bar */
.mobile-progress-container {
  margin-top: 20px;
  height: 6px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.mobile-progress-bar {
  height: 100%;
  width: 0%;
  background: #60a7fa;
  border-radius: 10px;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 10px rgba(96, 167, 250, 0.5);
}

/* Mobile Controls */
.mobile-controls {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 80px;
  background: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 12px 20px;
  gap: 12px;
  z-index: 1000;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
}

.mobile-control-btn {
  flex: 1;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  color: #e5e7eb;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.mobile-control-btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.mobile-control-btn:active::before {
  width: 300px;
  height: 300px;
}

.mobile-control-btn:active {
  transform: scale(0.96);
}

.mobile-control-btn.primary {
  background: #60a7fa;
  border: none;
  color: white;
  box-shadow: 0 4px 20px rgba(96, 167, 250, 0.4);
}

.mobile-control-btn.primary:active {
  box-shadow: 0 2px 12px rgba(96, 167, 250, 0.3);
}

.mobile-control-btn svg {
  width: 20px;
  height: 20px;
}

/* Mobile Panel Base */
.mobile-panel {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2000;
  display: none;
  animation: mobilePanelSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-panel.active {
  display: block;
}

@keyframes mobilePanelSlideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.mobile-panel-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.mobile-panel-content {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  max-height: 85vh;
  background: rgba(17, 24, 39, 0.98);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border-top-left-radius: 24px;
  border-top-right-radius: 24px;
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  animation: mobilePanelContentSlideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes mobilePanelContentSlideUp {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

/* Mobile Panel Header */
.mobile-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.02);
}

.mobile-panel-header h3 {
  font-size: 20px;
  font-weight: 700;
  color: #f9fafb;
  font-family: 'Doto', sans-serif;
}

.mobile-panel-close {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  color: #9ca3af;
  cursor: pointer;
  transition: all 0.3s ease;
}

.mobile-panel-close:active {
  transform: scale(0.9);
  background: rgba(255, 255, 255, 0.1);
  color: #f9fafb;
}

/* Mobile Panel Body */
.mobile-panel-body {
  padding: 24px;
  max-height: calc(85vh - 81px);
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

/* Mobile Setting Groups */
.mobile-setting-group {
  margin-bottom: 28px;
}

.mobile-setting-group:last-child {
  margin-bottom: 0;
}

.mobile-setting-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
}

/* Mobile Toggle Group */
.mobile-toggle-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.mobile-toggle-btn {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  color: #9ca3af;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-toggle-btn span {
  font-size: 18px;
}

.mobile-toggle-btn:active {
  transform: scale(0.97);
}

.mobile-toggle-btn.active {
  background: rgba(96, 167, 250, 0.15);
  border-color: rgba(96, 167, 250, 0.4);
  color: #60a7fa;
  box-shadow: 0 4px 16px rgba(96, 167, 250, 0.2);
}

/* Mobile Timer Grid */
.mobile-timer-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.mobile-timer-btn {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  color: #9ca3af;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: 'Doto', sans-serif;
}

.mobile-timer-btn:active {
  transform: scale(0.97);
}

.mobile-timer-btn.active {
  background: rgba(96, 167, 250, 0.15);
  border-color: rgba(96, 167, 250, 0.4);
  color: #60a7fa;
  box-shadow: 0 4px 16px rgba(96, 167, 250, 0.2);
}

/* Mobile Theme Button */
.mobile-theme-btn {
  width: 100%;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  color: #e5e7eb;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-theme-btn:active {
  transform: scale(0.97);
  background: rgba(255, 255, 255, 0.05);
}

/* Mobile Results Panel */
.mobile-panel-content.results {
  max-height: 90vh;
}

.mobile-results-header {
  text-align: center;
  padding: 32px 24px 24px;
  background: rgba(96, 167, 250, 0.05);
}

.mobile-results-icon {
  display: inline-flex;
  width: 80px;
  height: 80px;
  align-items: center;
  justify-content: center;
  background: rgba(96, 167, 250, 0.15);
  border: 2px solid rgba(96, 167, 250, 0.3);
  border-radius: 50%;
  color: #60a7fa;
  margin-bottom: 16px;
  animation: mobileResultsIconPulse 2s ease-in-out infinite;
}

@keyframes mobileResultsIconPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(96, 167, 250, 0.4); }
  50% { transform: scale(1.05); box-shadow: 0 0 0 10px rgba(96, 167, 250, 0); }
}

.mobile-results-header h2 {
  font-size: 24px;
  font-weight: 700;
  color: #f9fafb;
  font-family: 'Doto', sans-serif;
  margin: 0;
}

/* Mobile Results Grid */
.mobile-results-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  padding: 24px;
}

.mobile-result-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 20px;
  text-align: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-result-card.highlight {
  background: rgba(96, 167, 250, 0.1);
  border-color: rgba(96, 167, 250, 0.3);
  grid-column: span 2;
}

.mobile-result-icon {
  font-size: 32px;
  margin-bottom: 12px;
  display: block;
}

.mobile-result-value {
  font-size: 32px;
  font-weight: 700;
  color: #60a7fa;
  font-family: 'Doto', sans-serif;
  line-height: 1;
  margin-bottom: 8px;
}

.mobile-result-label {
  font-size: 12px;
  font-weight: 600;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Mobile Results Actions */
.mobile-results-actions {
  display: flex;
  gap: 12px;
  padding: 0 24px 24px;
}

.mobile-action-btn {
  flex: 1;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 16px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: none;
}

.mobile-action-btn.primary {
  background: #60a7fa;
  color: white;
  box-shadow: 0 4px 20px rgba(96, 167, 250, 0.4);
}

.mobile-action-btn.primary:active {
  transform: scale(0.96);
  box-shadow: 0 2px 12px rgba(96, 167, 250, 0.3);
}

.mobile-action-btn.secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #e5e7eb;
}

.mobile-action-btn.secondary:active {
  transform: scale(0.96);
  background: rgba(255, 255, 255, 0.08);
}

/* Light Theme for Mobile */
[data-theme="light"] .mobile-layout,
[data-theme="light"] .mobile-header,
[data-theme="light"] .mobile-stats-bar,
[data-theme="light"] .mobile-controls,
[data-theme="light"] .mobile-panel-content {
  background: rgba(255, 255, 255, 0.98);
}

[data-theme="light"] .mobile-logo img {
  filter: brightness(1) invert(0);
}

[data-theme="light"] .mobile-stat-value,
[data-theme="light"] .mobile-result-value {
  color: #2563eb;
}

[data-theme="light"] .mobile-text-display {
  background: rgba(0, 0, 0, 0.02);
  border-color: rgba(37, 99, 235, 0.15);
  color: #1f2937;
}

[data-theme="light"] .mobile-text-display.focused {
  border-color: rgba(37, 99, 235, 0.3);
  background: rgba(0, 0, 0, 0.03);
}

/* Haptic Feedback Animation */
@keyframes mobileHapticPulse {
  0% { transform: scale(1); }
  50% { transform: scale(0.97); }
  100% { transform: scale(1); }
}

.mobile-haptic-feedback {
  animation: mobileHapticPulse 0.15s ease;
}

/* Safe Area Insets for Notched Devices */
@supports (padding: max(0px)) {
  .mobile-header {
    padding-top: max(env(safe-area-inset-top), 0px);
    height: calc(56px + max(env(safe-area-inset-top), 0px));
  }
  
  .mobile-stats-bar {
    top: calc(56px + max(env(safe-area-inset-top), 0px));
  }
  
  .mobile-typing-container {
    top: calc(126px + max(env(safe-area-inset-top), 0px));
    bottom: calc(80px + max(env(safe-area-inset-bottom), 0px));
  }
  
  .mobile-controls {
    padding-bottom: max(env(safe-area-inset-bottom), 12px);
    height: calc(80px + max(env(safe-area-inset-bottom), 0px));
  }
}

/* Performance Optimizations */
.mobile-layout * {
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.mobile-text-display,
.mobile-native-input {
  -webkit-user-select: text;
  user-select: text;
}

/* Smooth scrolling for mobile panels */
.mobile-panel-body {
  scroll-behavior: smooth;
}