/* ════════ TYPING SPEED TEST CUSTOM STYLES ════════ */

:root {
  --tool-indigo: #6366f1;
  --tool-indigo-hover: #4f46e5;
  --tool-indigo-soft: rgba(99, 102, 241, 0.08);
  --tool-indigo-glow: rgba(99, 102, 241, 0.2);
}

/* Light Mode Variables Override */
body.light {
  --tool-indigo: #4f46e5;
  --tool-indigo-hover: #3730a3;
  --tool-indigo-soft: rgba(79, 70, 229, 0.08);
  --tool-indigo-glow: rgba(79, 70, 229, 0.2);
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px 100px;
  position: relative;
  z-index: 1;
  box-sizing: border-box;
}

/* ─── PREMIUM CTA BUTTONS (Indigo) ─── */
.rb-btn-primary {
  background: var(--tool-indigo-soft) !important;
  border-color: var(--tool-indigo-glow) !important;
  color: var(--tool-indigo) !important;
}

.rb-btn-primary:hover {
  background: rgba(99, 102, 241, 0.18) !important;
  border-color: rgba(99, 102, 241, 0.35) !important;
  color: var(--tool-indigo-hover) !important;
}

body.light .rb-btn-primary {
  background: var(--tool-indigo-soft) !important;
  border-color: var(--tool-indigo-glow) !important;
  color: var(--tool-indigo) !important;
}

body.light .rb-btn-primary:hover {
  background: rgba(79, 70, 229, 0.12) !important;
  color: var(--tool-indigo-hover) !important;
}

/* ─── METRIC CARDS ─── */
.metric-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 6px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  box-sizing: border-box;
  text-align: center;
}

.metric-title {
  font-family: 'Outfit', sans-serif;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 2px;
}

.metric-value {
  font-family: 'Outfit', sans-serif;
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
}

body.light .metric-card {
  background: rgba(0, 0, 0, 0.015);
  border-color: rgba(0, 0, 0, 0.06);
}

/* ─── TYPING CONSOLE DISPLAY ─── */
.typing-text-wrapper {
  position: relative;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  background: rgba(0, 0, 0, 0.2);
  padding: 16px 20px;
  min-height: 160px;
  max-height: 220px;
  overflow-y: auto;
  user-select: none;
  -webkit-user-select: none;
  box-sizing: border-box;
  cursor: text;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.typing-text-wrapper:focus-within {
  border-color: var(--tool-indigo-glow);
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.1);
}

.typing-text-content {
  font-family: 'JetBrains Mono', 'Courier New', Courier, monospace;
  font-size: 19.5px;
  font-weight: 400;
  line-height: 1.65;
  word-break: break-word;
  outline: none;
  letter-spacing: 0.5px;
  color: var(--text-3);
  text-align: left;
}

/* Character states styles */
.char-unread {
  color: var(--text-3);
  opacity: 0.45;
  transition: opacity 0.15s ease;
}

.char-correct {
  color: #10b981;
  opacity: 1;
  text-shadow: 0 0 2px rgba(16, 185, 129, 0.2);
}

.char-error {
  color: #ef4444;
  opacity: 1;
  background: rgba(239, 68, 68, 0.15);
  border-radius: 3px;
  text-shadow: 0 0 2px rgba(239, 68, 68, 0.2);
}

/* Glowing flashing caret cursor */
.char-caret {
  position: relative;
  z-index: 2;
  border-left: 2.5px solid var(--tool-indigo);
  margin-left: -2.5px;
  animation: caretBlink 1s infinite steps(2, start);
}

@keyframes caretBlink {
  0%, 100% { border-color: var(--tool-indigo); }
  50% { border-color: transparent; }
}

body.light .typing-text-wrapper {
  background: rgba(255, 255, 255, 0.7);
}
body.light .char-unread {
  color: #475569;
  opacity: 0.5;
}
body.light .char-correct {
  color: #047857;
}
body.light .char-error {
  color: #b91c1c;
  background: rgba(220, 38, 38, 0.12);
}

/* ─── BLUR OVERLAY PROMPT ─── */
.focus-overlay-prompt {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(6, 5, 10, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 11px;
  z-index: 10;
  opacity: 1;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  cursor: pointer;
}

.focus-overlay-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-family: 'Figtree', sans-serif;
  font-size: 13.5px;
  font-weight: 500;
  text-align: center;
  padding: 16px 24px;
}

.focus-icon {
  font-size: 28px;
  animation: pulseIcon 2s infinite ease-in-out;
}

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

body.light .focus-overlay-prompt {
  background: rgba(255, 255, 255, 0.6);
}
body.light .focus-overlay-box {
  color: #1e293b;
}

/* ─── VIRTUAL KEYBOARD GUIDE ─── */
.keyboard {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  padding: 12px;
  box-sizing: border-box;
}

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

.key {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  height: 38px;
  min-width: 32px;
  flex-grow: 1;
  font-family: 'Figtree', sans-serif;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-2);
  cursor: default;
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
  text-transform: uppercase;
}

.key.wide-key {
  flex-grow: 2.2;
}

.key.extra-wide-key {
  flex-grow: 3.5;
}

.key.space-key {
  flex-grow: 12;
  max-width: 320px;
}

.key.ctrl-key {
  flex-grow: 1.5;
}

/* Active guidance key state */
.key.active {
  background: var(--tool-indigo-soft) !important;
  border-color: var(--tool-indigo-glow) !important;
  color: var(--tool-indigo) !important;
  transform: scale(0.96);
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.2);
}

body.light .keyboard {
  background: rgba(0, 0, 0, 0.02);
  border-color: rgba(0, 0, 0, 0.04);
}

body.light .key {
  background: rgba(255, 255, 255, 0.8);
  border-color: rgba(0, 0, 0, 0.08);
  color: #475569;
}

body.light .key.active {
  background: #ffffff !important;
  border-color: var(--tool-indigo) !important;
  color: var(--tool-indigo) !important;
  box-shadow: 0 4px 10px rgba(99, 102, 241, 0.15);
}

/* ─── FILTER GRID FOR DIFFICULTY ─── */
.filter-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.filter-card {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.015);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 11.5px;
  font-family: 'Figtree', sans-serif;
  font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  text-align: center;
}

.filter-card:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.1);
  transform: translateY(-1px);
  color: var(--text);
}

body.light .filter-card {
  background: rgba(0, 0, 0, 0.015);
  border-color: rgba(0, 0, 0, 0.06);
  color: #334155;
}

body.light .filter-card:hover {
  background: rgba(0, 0, 0, 0.03);
  color: #0f172a;
}

.filter-card.active {
  background: var(--tool-indigo-soft) !important;
  border: 1.5px solid var(--tool-indigo-glow) !important;
  color: var(--tool-indigo) !important;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.12), inset 0 1px 1px rgba(255, 255, 255, 0.1);
}

body.light .filter-card.active {
  background: rgba(99, 102, 241, 0.08) !important;
  border-color: var(--tool-indigo) !important;
  color: var(--tool-indigo-hover) !important;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
}

/* ─── CUSTOM LAYOUT GRID BALANCE ─── */
.tool-layout {
  grid-template-columns: 320px 1fr !important;
}

@media (max-width: 1024px) {
  .tool-layout {
    grid-template-columns: 1fr !important;
  }
}

/* ─── NATIVE DROPDOWN SELECT OVERRIDES ─── */
.inp-box select {
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  appearance: none !important;
  border: none !important;
  background-color: transparent !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='rgba(255,255,255,0.3)' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 14px center !important;
  padding-right: 36px !important;
  cursor: pointer;
}

body.light .inp-box select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='rgba(15,23,42,0.4)' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") !important;
}

/* ─── TOGGLE SLIDER STYLES ─── */
.switch, .fg label.switch {
  position: relative;
  display: inline-block !important;
  width: 44px !important;
  height: 24px !important;
  flex-shrink: 0 !important;
  margin-bottom: 0 !important;
}

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

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

.switch-slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

.switch input:checked + .switch-slider {
  background-color: var(--tool-indigo) !important;
  border-color: var(--tool-indigo-glow) !important;
}

.switch input:checked + .switch-slider:before {
  transform: translateX(20px);
}

body.light .switch-slider {
  background-color: rgba(0, 0, 0, 0.08);
  border-color: rgba(0, 0, 0, 0.08);
}

/* ─── RESPONSIVE KEYBOARD LABELS & SCALING ─── */
.kbd-short-label {
  display: none;
}

@media (max-width: 768px) {
  .kbd-long-label {
    display: none;
  }
  .kbd-short-label {
    display: inline;
  }
  .key {
    min-width: 0 !important;
    font-size: 9px !important;
    height: 32px !important;
    border-radius: 4px !important;
  }
  .keyboard {
    padding: 8px !important;
    gap: 4px !important;
    border-radius: 8px !important;
  }
  .kbd-row {
    gap: 3px !important;
  }
}

@media (max-width: 576px) {
  #keyboard-guide-panel {
    display: none !important;
  }
}

/* ─── EDUCATIONAL METRICS CARD GRID ─── */
.metrics-explain-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.metric-explain-card {
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.015);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 14px;
  padding: 20px;
  box-sizing: border-box;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.25s, box-shadow 0.25s;
}

.metric-explain-card:hover {
  transform: translateY(-3px);
  border-color: var(--tool-indigo-glow);
  box-shadow: 0 8px 30px rgba(99, 102, 241, 0.08);
}

.metric-explain-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.metric-explain-header h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.metric-info-icon {
  color: var(--tool-indigo);
  flex-shrink: 0;
}

.metric-explain-body {
  font-family: 'Figtree', sans-serif;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--text-2);
  margin-bottom: 16px;
  flex-grow: 1;
}

.metric-explain-formula {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(99, 102, 241, 0.04);
  border: 1px dashed var(--tool-indigo-glow);
  color: var(--tool-indigo);
  word-break: break-all;
  box-sizing: border-box;
}

body.light .metric-explain-card {
  background: rgba(0, 0, 0, 0.01);
  border-color: rgba(0, 0, 0, 0.06);
}

body.light .metric-explain-card:hover {
  border-color: rgba(99, 102, 241, 0.2);
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.06);
}

body.light .metric-explain-formula {
  background: rgba(79, 70, 229, 0.03);
  color: var(--tool-indigo-hover);
}

/* ─── LIVE WPM SPEEDOMETER GAUGE ─── */
.speedometer-gauge-wrapper {
  position: relative;
  width: 68px;
  height: 68px;
  margin: 6px auto 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gauge-svg {
  width: 100%;
  height: 100%;
}

.gauge-bg {
  stroke: rgba(255, 255, 255, 0.06);
}

body.light .gauge-bg {
  stroke: rgba(15, 23, 42, 0.08);
}

.gauge-fill {
  stroke: var(--tool-indigo);
  filter: drop-shadow(0 0 3px rgba(99, 102, 241, 0.5));
  transition: stroke-dasharray 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

body.light .gauge-fill {
  filter: drop-shadow(0 0 2px rgba(79, 70, 229, 0.4));
}

.speedometer-gauge-wrapper .metric-value {
  position: absolute;
  font-size: 17px !important;
  font-weight: 800;
  margin: 0 !important;
  top: 52%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: 'Figtree', sans-serif;
}

/* ─── KEY ERROR HEATMAP BADGES ─── */
.key-badge {
  position: absolute;
  top: 2px;
  right: 3px;
  font-size: 7.5px;
  font-weight: 800;
  color: #ef4444;
  pointer-events: none;
  line-height: 1;
  background: rgba(239, 68, 68, 0.12);
  padding: 1px 3px;
  border-radius: 3px;
}

body.light .key-badge {
  color: #dc2626;
  background: rgba(220, 38, 38, 0.1);
}

/* ─── VOLUME SLIDER INPUT CUSTOM STYLING ─── */
#input-volume::-webkit-slider-runnable-track {
  width: 100%;
  height: 5px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 99px;
}

body.light #input-volume::-webkit-slider-runnable-track {
  background: rgba(0, 0, 0, 0.08);
}

#input-volume::-webkit-slider-thumb {
  height: 13px;
  width: 13px;
  border-radius: 99px;
  background: var(--tool-indigo);
  cursor: pointer;
  -webkit-appearance: none;
  margin-top: -4px;
  box-shadow: 0 0 6px var(--tool-indigo-glow);
  transition: transform 0.15s, background-color 0.15s;
}

#input-volume::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  background: var(--tool-indigo-hover);
}

/* ─── OPTIONS SIDEBAR TYPOGRAPHY STANDARD ─── */
.switch-row,
.switch-row span,
.fg label,
.lbl-text,
#volume-label,
select,
option {
  font-family: 'Figtree', sans-serif !important;
}
