/* ==========================================================================
   SpeedTyper Design System & Styling
   ========================================================================== */

/* Theme Definitions */
.theme-cyberpunk-dark {
  --bg-primary: #070913;
  --bg-secondary: #0c0f1e;
  --bg-glass: rgba(12, 17, 34, 0.7);
  --border-color: rgba(0, 242, 254, 0.18);
  --border-glow: rgba(0, 242, 254, 0.4);
  --accent: #00f2fe;
  --accent-secondary: #00ff87;
  --text-main: #e2e8f0;
  --text-muted: #64748b;
  --success: #00ff87;
  --error: #ff0055;
  --error-bg: rgba(255, 0, 85, 0.15);
  --warning: #ffae00;
  --shadow-glow: 0 0 15px rgba(0, 242, 254, 0.35);
  --shadow-success: 0 0 15px rgba(0, 255, 135, 0.35);
}

.theme-cyberpunk-light {
  --bg-primary: #f0f4f8;
  --bg-secondary: #ffffff;
  --bg-glass: rgba(255, 255, 255, 0.75);
  --border-color: rgba(14, 165, 233, 0.2);
  --border-glow: rgba(14, 165, 233, 0.5);
  --accent: #0ea5e9;
  --accent-secondary: #10b981;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --success: #10b981;
  --error: #ef4444;
  --error-bg: rgba(239, 68, 68, 0.15);
  --warning: #f59e0b;
  --shadow-glow: 0 4px 20px rgba(14, 165, 233, 0.15);
  --shadow-success: 0 4px 20px rgba(16, 105, 129, 0.15);
}

.theme-matrix {
  --bg-primary: #020502;
  --bg-secondary: #050d04;
  --bg-glass: rgba(3, 10, 3, 0.8);
  --border-color: rgba(57, 255, 20, 0.2);
  --border-glow: rgba(57, 255, 20, 0.5);
  --accent: #39ff14;
  --accent-secondary: #00ff87;
  --text-main: #bfffbf;
  --text-muted: #2e692e;
  --success: #39ff14;
  --error: #ff3b30;
  --error-bg: rgba(255, 59, 48, 0.2);
  --warning: #ffd60a;
  --shadow-glow: 0 0 15px rgba(57, 255, 20, 0.4);
  --shadow-success: 0 0 15px rgba(0, 255, 135, 0.4);
}

.theme-vaporwave {
  --bg-primary: #1a0b2e;
  --bg-secondary: #271042;
  --bg-glass: rgba(30, 12, 54, 0.7);
  --border-color: rgba(255, 0, 127, 0.25);
  --border-glow: rgba(255, 0, 127, 0.6);
  --accent: #ff007f;
  --accent-secondary: #00f3ff;
  --text-main: #ffd9f1;
  --text-muted: #805099;
  --success: #00f3ff;
  --error: #ff3b8b;
  --error-bg: rgba(255, 59, 139, 0.18);
  --warning: #ffae00;
  --shadow-glow: 0 0 18px rgba(255, 0, 127, 0.4);
  --shadow-success: 0 0 18px rgba(0, 243, 255, 0.4);
}

/* Base resets & typography */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: 'Inter', sans-serif;
  overflow-x: hidden;
  transition: background-color 0.4s ease, color 0.4s ease;
  min-height: 100vh;
}

/* Main Grid Layout */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 20px;
  max-width: 1200px;
  margin: 0 auto;
}

/* Glassmorphism utility card */
.glass {
  background: var(--bg-glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.hover-glow:hover {
  border-color: var(--border-glow);
  box-shadow: var(--shadow-glow);
}

/* Header style */
.main-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 25px;
  margin-bottom: 25px;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 15px;
}

.logo-icon {
  font-size: 2rem;
  text-shadow: 0 0 8px var(--accent);
}

.logo-text {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-family: 'Outfit', sans-serif;
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.accent-text {
  color: var(--accent);
  text-shadow: 0 0 5px var(--accent);
}

.tagline {
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 1px;
  text-transform: uppercase;
}

/* Navigation tabs */
.nav-menu {
  display: flex;
  gap: 10px;
}

.nav-tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 10px 18px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.25s ease;
}

.nav-tab:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.nav-tab.active {
  color: var(--accent);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 -2px 0 var(--accent);
}

/* Player badge & XP */
.player-badge {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 15px;
  background: rgba(255, 255, 255, 0.02);
}

.level-circle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--bg-secondary);
  border: 2px solid var(--accent);
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: 800;
  color: var(--accent);
  text-shadow: 0 0 3px var(--accent);
  box-shadow: var(--shadow-glow);
}

.xp-bar-container {
  display: flex;
  flex-direction: column;
  width: 130px;
}

.xp-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  margin-bottom: 4px;
}

.username {
  font-weight: 600;
  max-width: 70px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.xp-bar-bg {
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

.xp-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-secondary));
  border-radius: 3px;
  width: 0%;
  transition: width 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Main Viewport & Screen Transitions */
.viewport {
  flex-grow: 1;
  position: relative;
  min-height: 480px;
}

.screen {
  display: none;
  opacity: 0;
  transform: translateY(15px);
  transition: opacity 0.35s ease, transform 0.35s ease;
  width: 100%;
}

.screen.active {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

/* Typography styles */
.section-title {
  font-family: 'Outfit', sans-serif;
  font-size: 2.2rem;
  font-weight: 800;
  margin-bottom: 5px;
  text-transform: uppercase;
}

.section-subtitle {
  color: var(--text-muted);
  font-size: 1rem;
  margin-bottom: 30px;
}

/* HOME SCREEN SPECIFIC */
.hero-section {
  text-align: center;
  margin: 40px 0 50px;
}

.hero-title {
  font-family: 'Outfit', sans-serif;
  font-size: 3.2rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 15px;
  text-transform: uppercase;
}

.hero-subtitle {
  font-size: 1.15rem;
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.6;
}

/* Grid of modes */
.modes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.mode-card {
  padding: 30px 25px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  height: 100%;
}

.mode-icon {
  font-size: 3rem;
  margin-bottom: 15px;
}

.mode-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.4rem;
  font-weight: 600;
  margin-bottom: 12px;
  text-transform: uppercase;
}

.mode-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 25px;
  flex-grow: 1;
}

.lang-select-wrapper {
  margin-bottom: 20px;
  width: 100%;
}

.glass-select {
  width: 100%;
  padding: 10px;
  border-radius: 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  outline: none;
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}

.daily-status {
  margin-bottom: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  background: rgba(255, 174, 0, 0.1);
  color: var(--warning);
  border: 1px solid rgba(255, 174, 0, 0.2);
}

.daily-status.completed {
  background: rgba(0, 255, 135, 0.1);
  color: var(--success);
  border: 1px solid rgba(0, 255, 135, 0.2);
}

/* Home quick stats footer */
.home-footer-stats {
  display: flex;
  justify-content: space-around;
  padding: 20px;
  text-align: center;
}

.quick-stat {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.qs-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.qs-value {
  font-family: 'Outfit', sans-serif;
  font-size: 1.8rem;
  font-weight: 800;
}

/* PLAY SCREEN SPECIFIC */
.game-dashboard {
  display: flex;
  flex-direction: column;
  gap: 25px;
  max-width: 900px;
  margin: 0 auto;
}

.dashboard-stats {
  display: flex;
  justify-content: space-between;
  padding: 15px 30px;
}

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

.db-stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 1px;
  margin-bottom: 5px;
}

.db-stat-value {
  font-family: 'Outfit', sans-serif;
  font-size: 2.2rem;
  font-weight: 800;
}

/* Typing Box Container */
.typing-container {
  padding: 30px;
  position: relative;
  min-height: 220px;
  outline: none;
  cursor: text;
  overflow: hidden;
}

.focus-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(7, 9, 19, 0.85);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10;
  opacity: 1;
  transition: opacity 0.25s ease;
  border-radius: 15px;
}

.focus-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.overlay-msg {
  font-size: 1.15rem;
  color: var(--accent);
  text-shadow: var(--shadow-glow);
  font-weight: 600;
  animation: pulse 1.8s infinite;
}

.typing-header {
  position: absolute;
  top: 12px;
  right: 20px;
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 1.5px;
  font-weight: 700;
}

/* Typing Scroller and Letters */
.text-display-scroller {
  overflow-y: auto;
  max-height: 180px;
  padding-right: 10px;
}

/* Custom scrollbar */
.text-display-scroller::-webkit-scrollbar {
  width: 6px;
}

.text-display-scroller::-webkit-scrollbar-track {
  background: transparent;
}

.text-display-scroller::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

.text-display {
  font-family: 'Fira Code', monospace;
  font-size: var(--typing-font-size, 21px);
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  user-select: none;
  -webkit-user-select: none;
}

/* Individual letter states */
.char {
  position: relative;
  color: var(--text-muted);
  transition: color 0.1s ease, background-color 0.1s ease;
}

.char.correct {
  color: var(--success);
  text-shadow: 0 0 2px rgba(57, 255, 20, 0.3);
}

.char.incorrect {
  color: var(--error);
  background: var(--error-bg);
  border-radius: 2px;
}

.char.current {
  color: var(--text-main);
}

/* Blinking typing cursor */
.char.current::before {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: 2px;
  height: 1.1em;
  background-color: var(--accent);
  box-shadow: var(--shadow-glow);
  animation: cursor-blink 1s infinite;
}

/* Indent spacer indicators in programming code blocks */
.char.indent-guide {
  color: rgba(255, 255, 255, 0.04);
}

.hidden-input {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0.01;
  font-size: 16px; /* Prevents auto-zoom on iOS Safari */
  border: none;
  background: transparent;
  outline: none;
  z-index: -9999;
}


/* Keyboard Visualizer */
.virtual-keyboard-wrapper {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 15px;
  background: rgba(0, 0, 0, 0.2);
  margin-top: 10px;
}

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

.key {
  height: 38px;
  min-width: 34px;
  padding: 0 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-family: inherit;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  transition: all 0.08s ease;
}

.key.wide-key {
  min-width: 60px;
  flex-grow: 1;
}

.key.extra-wide-key {
  min-width: 80px;
  flex-grow: 2;
}

.key.spacebar {
  width: 320px;
}

/* Pressed dynamic highlights */
.key.active-press {
  background: var(--accent);
  color: var(--bg-primary);
  border-color: var(--accent);
  box-shadow: var(--shadow-glow);
  transform: scale(0.95);
}

.key.active-error {
  background: var(--error);
  color: #fff;
  border-color: var(--error);
  box-shadow: 0 0 10px var(--error);
  transform: scale(0.95);
}

/* General Buttons */
.btn {
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 12px 24px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  transition: all 0.25s ease;
  outline: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-cyan {
  background: #00f2fe;
  color: #070913;
}
.btn-green {
  background: #00ff87;
  color: #070913;
}
.btn-purple {
  background: #bb00ff;
  color: #fff;
}
.btn-orange {
  background: #ffaa00;
  color: #070913;
}
.btn-primary {
  background: var(--accent);
  color: var(--bg-primary);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--accent);
  border-color: var(--accent);
}

.btn-glow:hover {
  box-shadow: var(--shadow-glow);
  transform: translateY(-2px);
}

.btn-danger {
  background: rgba(255, 0, 85, 0.1);
  border: 1px solid var(--error);
  color: var(--error);
}

.btn-danger:hover {
  background: var(--error);
  color: #fff;
  box-shadow: 0 0 12px var(--error);
}

.play-controls {
  display: flex;
  justify-content: center;
  gap: 20px;
}

/* MODALS / SUMMARY SYSTEM */
.overlay, .modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(5, 7, 14, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.overlay.hidden, .modal-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.overlay-card, .modal-card {
  padding: 35px;
  width: 90%;
  max-width: 520px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.overlay-buttons {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-top: 10px;
}

.stats-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
  margin-bottom: 10px;
}

.summary-stat {
  padding: 15px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: 12px;
}

.stat-lbl {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 5px;
}

.stat-val {
  font-family: 'Outfit', sans-serif;
  font-size: 2rem;
  font-weight: 800;
}

.xp-award-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 15px 20px;
  background: rgba(0, 0, 0, 0.2);
}

.xp-earned-banner {
  font-weight: 700;
  font-size: 1.1rem;
}

.xp-level-up-alert {
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--warning);
  text-shadow: 0 0 8px rgba(255, 174, 0, 0.5);
  animation: levelup-shimmer 2s infinite alternate;
}

.xp-modal-text {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.unlocked-items-container {
  text-align: left;
  border-top: 1px solid var(--border-color);
  padding-top: 15px;
}

.unlocked-items-container h4 {
  font-family: 'Outfit', sans-serif;
  font-size: 0.95rem;
  text-transform: uppercase;
  color: var(--text-main);
  margin-bottom: 10px;
}

.unlocks-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.unlock-badge {
  background: rgba(0, 242, 254, 0.08);
  border: 1px solid var(--accent);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  box-shadow: 0 0 5px rgba(0, 242, 254, 0.2);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* STATISTICS PAGE SPECIFIC */
.stats-panels-grid {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 20px;
  margin-bottom: 25px;
}

.stats-big-panel {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  padding: 25px;
}

.big-metric {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 0;
}

.big-metric:not(:last-child) {
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.bm-value {
  font-family: 'Outfit', sans-serif;
  font-size: 2.5rem;
  font-weight: 800;
}

.bm-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stats-list-panel {
  padding: 25px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 15px;
}

.stat-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.sli-label {
  font-size: 0.95rem;
  color: var(--text-muted);
}

.sli-val {
  font-weight: 700;
  font-size: 1.15rem;
}

/* Charts styling */
.chart-container {
  padding: 25px;
  margin-bottom: 30px;
}

.chart-container h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.15rem;
  margin-bottom: 20px;
  text-transform: uppercase;
  color: var(--text-main);
}

.custom-bar-chart {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  height: 180px;
  border-bottom: 2px solid var(--border-color);
  padding: 10px 20px 0;
}

.chart-empty-state {
  width: 100%;
  text-align: center;
  color: var(--text-muted);
  font-style: italic;
  font-size: 0.9rem;
  align-self: center;
}

.chart-bar-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 8%;
  gap: 6px;
}

.chart-bar {
  width: 100%;
  background: linear-gradient(0deg, rgba(0, 242, 254, 0.2) 0%, var(--accent) 100%);
  border-radius: 4px 4px 0 0;
  transition: height 0.6s ease;
  position: relative;
}

.chart-bar:hover {
  background: linear-gradient(0deg, rgba(0, 242, 254, 0.4) 0%, var(--accent-secondary) 100%);
  box-shadow: var(--shadow-glow);
}

.bar-val {
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--accent);
}

.bar-lbl {
  font-size: 0.65rem;
  color: var(--text-muted);
}

.danger-zone-container {
  display: flex;
  justify-content: flex-end;
}

/* ACHIEVEMENTS GRID SPECIFIC */
.achievements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.achiev-card {
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 15px;
  position: relative;
  overflow: hidden;
}

.achiev-icon-box {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.5rem;
  transition: all 0.3s ease;
}

.achiev-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.achiev-name {
  font-family: 'Outfit', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-muted);
}

.achiev-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Locked vs Unlocked status on Achievements page */
.achiev-card.locked {
  opacity: 0.55;
  filter: grayscale(1);
}

.achiev-card.unlocked {
  border-color: var(--border-glow);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.achiev-card.unlocked .achiev-icon-box {
  background: rgba(0, 242, 254, 0.05);
  border-color: var(--accent);
  box-shadow: var(--shadow-glow);
  transform: rotate(-5deg);
}

.achiev-card.unlocked .achiev-name {
  color: var(--accent);
  text-shadow: 0 0 3px rgba(0, 242, 254, 0.3);
}

.achiev-reward-tag {
  position: absolute;
  top: 8px;
  right: 10px;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--accent-secondary);
}

/* SETTINGS PAGE SPECIFIC */
.settings-form {
  padding: 30px;
  max-width: 700px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 35px;
}

.settings-group {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.settings-group h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.15rem;
  text-transform: uppercase;
  color: var(--accent);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 8px;
  letter-spacing: 0.5px;
}

.setting-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: -8px;
}

.setting-control-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

/* Toggle Switch */
.toggle-switch-wrapper {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 26px;
}

.toggle-switch-input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-switch-label {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--border-color);
  border-radius: 34px;
  transition: .3s;
}

.toggle-switch-label:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: var(--text-muted);
  border-radius: 50%;
  transition: .3s;
}

.toggle-switch-input:checked + .toggle-switch-label {
  background-color: rgba(0, 242, 254, 0.1);
  border-color: var(--accent);
}

.toggle-switch-input:checked + .toggle-switch-label:before {
  transform: translateX(24px);
  background-color: var(--accent);
  box-shadow: var(--shadow-glow);
}

/* Slider */
.neon-slider {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.1);
  outline: none;
  flex-grow: 1;
}

.neon-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: var(--shadow-glow);
  cursor: pointer;
  transition: transform 0.1s ease;
}

.neon-slider::-webkit-slider-thumb:hover {
  transform: scale(1.25);
}

.slider-display {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent);
  min-width: 40px;
  text-align: right;
}

/* Themes grid in Settings */
.themes-selector-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
}

.theme-opt-card {
  padding: 15px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(255, 255, 255, 0.01);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.25s ease;
}

.theme-opt-card.locked {
  opacity: 0.45;
  cursor: not-allowed;
}

.theme-opt-card:not(.locked):hover {
  border-color: rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.03);
}

.theme-opt-card.active-theme {
  border-color: var(--accent);
  background: rgba(0, 242, 254, 0.04);
  box-shadow: var(--shadow-glow);
}

.theme-opt-name {
  font-weight: 600;
  font-size: 0.9rem;
}

.theme-lock-badge {
  font-size: 0.7rem;
  font-weight: 700;
  background: rgba(255, 174, 0, 0.15);
  color: var(--warning);
  padding: 2px 8px;
  border-radius: 10px;
  border: 1px solid rgba(255, 174, 0, 0.2);
}

.theme-active-lbl {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--accent-secondary);
}

/* Radio button group */
.radio-btn-group {
  display: flex;
  gap: 10px;
}

.radio-btn-group input[type="radio"] {
  display: none;
}

.btn-radio {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 8px 16px;
  font-size: 0.85rem;
  border-radius: 8px;
  font-weight: 500;
}

.radio-btn-group input[type="radio"]:checked + .btn-radio {
  background: rgba(0, 242, 254, 0.08);
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: var(--shadow-glow);
}

/* Footer Styling */
.app-footer {
  text-align: center;
  padding: 30px 0 10px;
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-top: 40px;
  border-top: 1px solid rgba(255, 255, 255, 0.03);
}

/* ==========================================================================
   Animations & Keyframes
   ========================================================================== */
@keyframes cursor-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

@keyframes pulse {
  0% { transform: scale(1); opacity: 0.9; }
  50% { transform: scale(1.02); opacity: 1; text-shadow: 0 0 15px var(--accent); }
  100% { transform: scale(1); opacity: 0.9; }
}

@keyframes levelup-shimmer {
  0% { color: var(--warning); text-shadow: 0 0 5px rgba(255, 174, 0, 0.3); }
  100% { color: #fff; text-shadow: 0 0 15px var(--warning), 0 0 30px rgba(255, 174, 0, 0.8); }
}

.animate-fade-in {
  animation: fadeIn 0.4s ease-out forwards;
}

.animate-scale-up {
  animation: scaleUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes scaleUp {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

/* Glitch animation utility */
.animate-glitch {
  position: relative;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */
@media (max-width: 900px) {
  .main-header {
    flex-direction: column;
    gap: 15px;
    padding: 15px;
  }
  
  .nav-menu {
    width: 100%;
    justify-content: center;
    overflow-x: auto;
    padding-bottom: 5px;
  }

  .player-badge {
    width: 100%;
    justify-content: center;
  }

  .stats-panels-grid {
    grid-template-columns: 1fr;
  }
  
  .modes-grid {
    grid-template-columns: 1fr;
  }
  
  .custom-bar-chart {
    height: 140px;
  }
}

@media (max-width: 768px) {
  /* Hide virtual keyboard on smaller touch devices/mobiles to give room */
  #virtual-keyboard-container {
    display: none !important;
  }
  
  .hero-title {
    font-size: 2.2rem;
  }
  
  .stats-summary-grid {
    grid-template-columns: 1fr;
  }
  
  .themes-selector-grid {
    grid-template-columns: 1fr;
  }
}

/* Tablet & Mobile tweaks (< 600px) */
@media (max-width: 600px) {
  body {
    padding: 10px;
  }
  
  .app-container {
    padding: 5px;
  }

  .main-header {
    padding: 12px;
    margin-bottom: 15px;
    border-radius: 12px;
  }

  .nav-menu {
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
  }

  .nav-tab {
    padding: 6px 12px;
    font-size: 0.85rem;
    border-radius: 6px;
  }

  .hero-section {
    margin: 20px 0 30px;
  }

  .hero-title {
    font-size: 1.8rem;
  }

  .hero-subtitle {
    font-size: 0.95rem;
    line-height: 1.5;
  }

  .dashboard-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding: 12px;
    border-radius: 12px;
  }

  .db-stat-value {
    font-size: 1.6rem;
  }

  .typing-container {
    padding: 15px;
    min-height: 180px;
    border-radius: 12px;
  }

  .text-display {
    font-size: clamp(15px, 4.5vw, 19px) !important;
    line-height: 1.5;
  }

  .play-controls {
    flex-direction: column;
    gap: 10px;
    width: 100%;
  }

  .play-controls .btn {
    width: 100%;
  }

  /* Stats Screen Scrollable Chart */
  .custom-bar-chart {
    overflow-x: auto;
    justify-content: flex-start;
    gap: 15px;
    padding: 10px 10px 0;
  }

  .chart-bar-wrapper {
    min-width: 32px;
    flex-shrink: 0;
  }

  .stats-big-panel, .stats-list-panel {
    padding: 15px;
  }

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

  .sli-val {
    font-size: 1rem;
  }

  /* Achievements list cards alignment */
  .achiev-card {
    padding: 12px;
    gap: 10px;
  }

  .achiev-icon-box {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    font-size: 1.25rem;
  }

  .achiev-name {
    font-size: 0.9rem;
  }

  .achiev-desc {
    font-size: 0.75rem;
  }

  /* Modals formatting */
  .modal-card, .overlay-card {
    padding: 20px;
    width: 95%;
  }

  .stats-summary-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .summary-stat {
    padding: 10px;
  }

  .stat-val {
    font-size: 1.6rem;
  }

  .modal-footer {
    flex-direction: column;
    gap: 10px;
  }

  .modal-footer .btn {
    width: 100%;
  }

  /* Settings form */
  .settings-form {
    padding: 15px;
  }

  .setting-control-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .setting-control-row label {
    font-size: 0.9rem;
    font-weight: 600;
  }

  .radio-btn-group, .neon-slider {
    width: 100%;
  }
}

/* Color & Text Utilities */
.text-cyan {
  color: var(--accent);
  text-shadow: 0 0 5px rgba(0, 242, 254, 0.3);
}

.text-green {
  color: var(--accent-secondary);
  text-shadow: 0 0 5px rgba(0, 255, 135, 0.3);
}

.text-purple {
  color: #bb00ff;
  text-shadow: 0 0 5px rgba(187, 0, 255, 0.3);
}

.text-orange {
  color: var(--warning);
  text-shadow: 0 0 5px rgba(255, 174, 0, 0.3);
}

.text-yellow {
  color: #ffd60a;
  text-shadow: 0 0 5px rgba(255, 214, 10, 0.3);
}

.text-error {
  color: var(--error);
  text-shadow: 0 0 5px rgba(255, 0, 85, 0.3);
}

.font-bold {
  font-weight: 700;
}

.font-sm {
  font-size: 0.8rem;
}

/* Shake Animation on Typos */
.shake-error {
  animation: shake 0.2s ease-in-out;
  border-color: var(--error) !important;
  box-shadow: 0 0 10px rgba(255, 0, 85, 0.4) !important;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-5px); }
  40%, 80% { transform: translateX(5px); }
}

/* Google AdSense Placeholder Styles */
.adsense-placeholder {
  margin-top: 30px;
  padding: 15px 25px;
  position: relative;
  overflow: hidden;
  border-color: rgba(255, 255, 255, 0.05);
  background: rgba(0, 0, 0, 0.2);
}

.ad-badge {
  position: absolute;
  top: 4px;
  left: 10px;
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-weight: 700;
}

.ad-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 80px;
}

.ad-fallback-box {
  display: flex;
  align-items: center;
  gap: 20px;
  width: 100%;
  padding-top: 8px;
}

.ad-fallback-icon {
  font-size: 2.2rem;
  text-shadow: 0 0 10px var(--accent);
}

.ad-fallback-text {
  flex-grow: 1;
  text-align: left;
}

.ad-fallback-text h4 {
  font-family: 'Outfit', sans-serif;
  font-size: 1rem;
  text-transform: uppercase;
  color: var(--text-main);
  margin-bottom: 4px;
}

.ad-fallback-text p {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.coupon-code {
  font-family: 'Fira Code', monospace;
  background: rgba(0, 242, 254, 0.1);
  color: var(--accent);
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px dashed var(--border-color);
  font-weight: 700;
}

/* Adjust size on smaller screens */
@media (max-width: 768px) {
  .ad-fallback-box {
    flex-direction: column;
    text-align: center;
    gap: 12px;
  }
  .ad-fallback-text {
    text-align: center;
  }
}

/* SEO Content Block Styles */
.seo-info-block {
  margin-top: 50px;
  padding: 30px;
  text-align: left;
  border-color: rgba(255, 255, 255, 0.04);
}

.seo-info-block h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.6rem;
  font-weight: 800;
  text-transform: uppercase;
  margin-bottom: 20px;
  color: var(--accent);
  text-shadow: 0 0 5px rgba(0, 242, 254, 0.2);
}

.seo-text-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 25px;
}

.seo-column {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.seo-column h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-main);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 6px;
}

.seo-column p {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
}

@media (max-width: 600px) {
  .seo-info-block {
    padding: 20px;
    margin-top: 35px;
  }
  .seo-info-block h2 {
    font-size: 1.3rem;
  }
}



