/* ============================================================
   features.css — New Feature Section Styles
   Uses CSS custom properties (var(--*)) for light/dark mode
   compatibility. Dark defaults in :root, light overrides via
   [data-theme="light"] are in style.css.
   ============================================================ */

/* ── Extend CSS vars for features if not in style.css ──────── */
:root {
  --feat-bg:     #0f172a;
  --feat-card:   #1e293b;
  --feat-border: #334155;
  --feat-text:   #e2e8f0;
  --feat-muted:  #64748b;
  --feat-muted2: #94a3b8;
  --feat-input:  #0f172a;
  --feat-accent: #6c63ff;
  --feat-green:  #34d399;
  --feat-amber:  #f59e0b;
  --feat-red:    #ef4444;
}
[data-theme="light"] {
  --feat-bg:     #f4f4f8;
  --feat-card:   #ffffff;
  --feat-border: #e2e8ef;
  --feat-text:   #1e293b;
  --feat-muted:  #64748b;
  --feat-muted2: #475569;
  --feat-input:  #f8f9fc;
  --feat-accent: #5b52e0;
  --feat-green:  #059669;
  --feat-amber:  #d97706;
  --feat-red:    #dc2626;
}

/* ============================================================
   TYPING TUTOR
   ============================================================ */
.tutor-section {
  padding: 70px 0;
  background: var(--feat-bg);
  border-top: 1px solid var(--feat-border);
}
.tutor-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 24px;
}
@media (max-width: 900px) { .tutor-layout { grid-template-columns: 1fr; } }

/* Sidebar */
.tutor-sidebar {
  background: var(--feat-card);
  border-radius: 16px;
  padding: 16px;
  border: 1px solid var(--feat-border);
  overflow-y: auto;
  max-height: 620px;
}
.tutor-progress-header {
  font-size: 13px;
  color: var(--feat-muted);
  margin-bottom: 12px;
  border-bottom: 1px solid var(--feat-border);
  padding-bottom: 8px;
}
.tutor-lesson-list { display: flex; flex-direction: column; gap: 4px; }
.tutor-lesson-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.2s, border-color 0.2s;
}
.tutor-lesson-item:hover {
  background: rgba(108,99,255,0.08);
  border-color: rgba(108,99,255,0.2);
}
.tutor-lesson-item--active {
  background: rgba(108,99,255,0.12);
  border-color: var(--feat-accent);
}
.tutor-lesson-item--done { border-color: rgba(5,150,105,0.25); }
.tutor-lesson-number {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--feat-border);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
  color: var(--feat-muted);
  flex-shrink: 0;
}
.tutor-lesson-item--done .tutor-lesson-number { background: #065f46; color: var(--feat-green); }
.tutor-lesson-item--active .tutor-lesson-number { background: var(--feat-accent); color: #fff; }
.tutor-lesson-info { flex: 1; min-width: 0; }
.tutor-lesson-title {
  font-size: 13px; font-weight: 600;
  color: var(--feat-text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tutor-lesson-sub {
  font-size: 11px; color: var(--feat-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tutor-lesson-score { font-size: 11px; color: var(--feat-green); white-space: nowrap; }

/* Main */
.tutor-main {
  background: var(--feat-card);
  border-radius: 16px;
  padding: 24px;
  border: 1px solid var(--feat-border);
  display: flex; flex-direction: column; gap: 16px;
}
.tutor-lesson-header { display: flex; flex-direction: column; gap: 4px; }
.tutor-lesson-badge {
  background: rgba(108,99,255,0.12);
  color: var(--feat-accent);
  font-size: 12px; padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid rgba(108,99,255,0.25);
  align-self: flex-start;
}
.tutor-lesson-heading { font-size: 22px; font-weight: 700; color: var(--feat-text); margin: 4px 0 0; }
.tutor-lesson-desc { font-size: 14px; color: var(--feat-muted); margin: 0; }

.tutor-finger-guide {
  background: var(--feat-input);
  border-radius: 10px; padding: 12px 16px;
  border: 1px solid var(--feat-border);
}
.tutor-finger-label { font-size: 16px; font-weight: 700; color: var(--feat-accent); letter-spacing: 4px; font-family: 'Courier New', monospace; }
.tutor-finger-hint { font-size: 12px; color: var(--feat-muted); margin-top: 4px; }

.tutor-text-display {
  background: var(--feat-input);
  border-radius: 10px; padding: 16px 20px;
  font-family: 'Courier New', monospace;
  font-size: 18px; line-height: 2; letter-spacing: 1px;
  border: 1px solid var(--feat-border);
  display: block;
  min-height: 60px; cursor: text;
  word-break: break-word;
  white-space: pre-wrap;
}
.tutor-char { display: inline; color: var(--feat-muted); transition: color 0.1s; }
.tutor-char--correct { color: var(--feat-green); }
.tutor-char--error { color: var(--feat-red); background: rgba(239,68,68,0.1); border-radius: 2px; }
.tutor-char--cursor { border-left: 2px solid var(--feat-accent); animation: tutorBlink 1s step-end infinite; color: var(--feat-text); }
@keyframes tutorBlink { 0%,100% { border-color: var(--feat-accent); } 50% { border-color: transparent; } }
/* KrutiDev mode font */
.tutor-text-display.krutidev { font-family: 'Kruti Dev 010', 'Kruti_Dev_010', 'KrutiDev010', monospace; }
.tutor-input.krutidev { font-family: 'Kruti Dev 010', 'Kruti_Dev_010', 'KrutiDev010', monospace; }


.tutor-input {
  width: 100%; padding: 12px 16px;
  background: var(--feat-input);
  border: 1px solid var(--feat-border);
  border-radius: 10px;
  color: var(--feat-text);
  font-size: 16px; font-family: 'Courier New', monospace;
  outline: none; transition: border-color 0.2s; box-sizing: border-box;
}
.tutor-input:focus { border-color: var(--feat-accent); box-shadow: 0 0 0 3px rgba(108,99,255,0.15); }

.tutor-stats { display: flex; gap: 12px; flex-wrap: wrap; }
.tutor-stat {
  background: var(--feat-input);
  border-radius: 10px; padding: 10px 16px;
  border: 1px solid var(--feat-border);
  text-align: center; flex: 1; min-width: 70px;
}
.tutor-stat-val { display: block; font-size: 20px; font-weight: 700; color: var(--feat-accent); line-height: 1.3; }
.tutor-stat-lbl { font-size: 11px; color: var(--feat-muted); }

.tutor-progress-bar-wrap { height: 6px; background: var(--feat-border); border-radius: 3px; overflow: hidden; }
.tutor-progress-bar { height: 100%; background: linear-gradient(90deg, var(--feat-accent), #a78bfa); border-radius: 3px; transition: width 0.3s ease; width: 0%; }

.tutor-tip {
  background: var(--feat-card);
  border-left: 3px solid var(--feat-amber);
  padding: 10px 16px; border-radius: 0 8px 8px 0;
  font-size: 13px; color: var(--feat-muted2); font-style: italic; line-height: 1.5;
}
.tutor-complete-banner {
  background: linear-gradient(135deg, #065f46, #047857);
  border-radius: 12px; padding: 20px 24px;
  color: white; font-size: 16px; text-align: center;
  border: 1px solid rgba(52,211,153,0.4);
}
.tutor-complete-actions { display: flex; gap: 12px; justify-content: center; margin-top: 12px; flex-wrap: wrap; }
.tutor-nav { display: flex; gap: 12px; justify-content: space-between; padding-top: 4px; }

/* ============================================================
   TYPING GAME
   ============================================================ */
.game-section {
  padding: 70px 0;
  background: var(--feat-bg);
  border-top: 1px solid var(--feat-border);
}
.game-wrapper { display: flex; flex-direction: column; gap: 16px; }
.game-controls { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.game-stats-bar { display: flex; gap: 16px; flex-wrap: wrap; }
.game-stat {
  background: var(--feat-card);
  border-radius: 10px; padding: 10px 20px;
  border: 1px solid var(--feat-border);
  text-align: center; flex: 1; min-width: 80px;
}
.game-stat-val { display: block; font-size: 24px; font-weight: 700; color: var(--feat-accent); line-height: 1.3; }
.game-stat-lbl { font-size: 11px; color: var(--feat-muted); }
.game-canvas-wrapper {
  position: relative; width: 100%;
  background: #0a0d14;
  border-radius: 16px; overflow: hidden;
  border: 1px solid var(--feat-border);
}
#gameCanvas { display: block; width: 100%; height: auto; min-height: 300px; background: #0a0d14; }
.game-overlay, .game-over-overlay {
  position: absolute; inset: 0;
  background: rgba(10,13,20,0.92);
  display: flex; align-items: center; justify-content: center; z-index: 5;
}
.game-overlay-content { text-align: center; padding: 32px; }
.game-overlay-icon { font-size: 64px; margin-bottom: 16px; line-height: 1; }
.game-overlay-content h3 { font-size: 28px; font-weight: 700; color: #f1f5f9; margin-bottom: 8px; }
.game-overlay-content p { color: #94a3b8; margin-bottom: 0; }
.game-input-wrapper { display: flex; justify-content: center; }
.game-input {
  width: 100%; max-width: 480px;
  padding: 14px 20px;
  background: var(--feat-card);
  border: 2px solid var(--feat-border);
  border-radius: 12px; color: var(--feat-text);
  font-size: 18px; font-family: 'Courier New', monospace;
  text-align: center; outline: none; transition: border-color 0.2s;
}
.game-input:not(:disabled):focus { border-color: var(--feat-accent); box-shadow: 0 0 0 3px rgba(108,99,255,0.18); }
.game-input:disabled { opacity: 0.5; cursor: not-allowed; }

/* ============================================================
   FONT CONVERTER
   ============================================================ */
.converter-section {
  padding: 70px 0;
  background: var(--feat-bg);
  border-top: 1px solid var(--feat-border);
}
.converter-mode { display: flex; gap: 8px; margin-bottom: 24px; flex-wrap: wrap; }
.converter-panels {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 16px; align-items: start;
}
@media (max-width: 768px) {
  .converter-panels { grid-template-columns: 1fr; }
  .converter-arrow { text-align: center; font-size: 28px; display: block; }
}
.converter-panel {
  background: var(--feat-card);
  border-radius: 16px; padding: 20px;
  border: 1px solid var(--feat-border);
}
.converter-panel-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.converter-label { font-size: 14px; font-weight: 600; color: var(--feat-muted2); }
.converter-textarea {
  width: 100%;
  background: var(--feat-input);
  border: 1px solid var(--feat-border);
  border-radius: 10px; padding: 12px;
  color: var(--feat-text); font-size: 15px;
  font-family: 'Noto Sans Devanagari', 'Mangal', 'Courier New', monospace;
  resize: vertical; outline: none; transition: border-color 0.2s;
  box-sizing: border-box; line-height: 1.8;
}
.converter-textarea:focus { border-color: var(--feat-accent); box-shadow: 0 0 0 3px rgba(108,99,255,0.12); }
.converter-arrow {
  display: flex; align-items: center; justify-content: center;
  font-size: 32px; color: var(--feat-accent); font-weight: 700; padding-top: 48px;
}
.converter-note {
  background: rgba(108,99,255,0.06);
  border-radius: 10px; padding: 12px 16px;
  font-size: 13px; color: var(--feat-muted2);
  margin-top: 20px; border: 1px solid rgba(108,99,255,0.15); line-height: 1.6;
}

/* ============================================================
   PARAGRAPH CHOOSER
   ============================================================ */
.paragraph-chooser {
  background: var(--feat-input);
  border-radius: 10px; padding: 16px;
  border: 1px solid var(--feat-border); margin-top: 12px;
}
.paragraph-chooser-inner { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.paragraph-select {
  background: var(--feat-card);
  border: 1px solid var(--feat-border);
  border-radius: 8px; color: var(--feat-text);
  padding: 8px 12px; font-size: 13px;
  outline: none; flex: 1; min-width: 200px; transition: border-color 0.2s;
}
.paragraph-select:focus { border-color: var(--feat-accent); }
.custom-text-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; align-items: center; }

/* ============================================================
   HISTORY TABLE
   ============================================================ */
.exam-tag {
  background: rgba(108,99,255,0.12);
  color: var(--feat-accent); font-size: 10px;
  padding: 1px 6px; border-radius: 4px;
  border: 1px solid rgba(108,99,255,0.25);
  margin-left: 4px; vertical-align: middle;
}
.table-empty { text-align: center; color: var(--feat-muted); padding: 32px !important; font-size: 14px; }
.wpm-highlight small { font-size: 10px; color: var(--feat-muted); font-weight: 400; }

/* ============================================================
   EXAM SECTION — active state fix
   ============================================================ */
.exam-card__btn.active, .exam-card__btn:focus {
  outline: 2px solid var(--feat-accent);
  outline-offset: 2px;
}

/* ============================================================
   DARK/LIGHT SMOOTH TRANSITION
   ============================================================ */
* { transition: background-color 0.2s ease, color 0.15s ease, border-color 0.15s ease; }
/* Exclude elements where transitions cause jank */
.tutor-char, .heatmap-key, canvas, video, input[type="range"] {
  transition: none !important;
}
