/* ============================================================
   SlayerX Typing — styles.css
   Modern, Reactive Typing Platform with Day (Light) & Night (Dark) Modes
   Default: Day Mode (Crisp & Clean)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Outfit:wght@500;600;700;800;900&family=JetBrains+Mono:wght@500;700&display=swap');

/* ── Day Mode (Default) ─────────────────────────────────────── */
:root, [data-theme="light"] {
  --bg-body:         #F8FAFC;
  --bg-surface:      #FFFFFF;
  --bg-card:         #FFFFFF;
  --bg-card-hover:   #F1F5F9;
  --bg-input:        #F8FAFC;
  --bg-alt:          #F1F5F9;

  --border-subtle:   #E2E8F0;
  --border-strong:   #CBD5E1;
  --border-active:   #4F46E5;

  --text-main:       #0F172A;
  --text-muted:      #475569;
  --text-dim:        #94A3B8;

  --primary:         #4F46E5;
  --primary-light:   #6366F1;
  --primary-dark:    #3730A3;
  --primary-glow:    rgba(79, 70, 229, 0.15);

  --accent:          #0EA5E9;
  --accent-light:    #38BDF8;

  --success:         #10B981;
  --success-bg:      #ECFDF5;
  --error:           #EF4444;
  --error-bg:        #FEF2F2;

  --char-pending:    #94A3B8;
  --char-active-bg:  rgba(79, 70, 229, 0.1);
  --char-correct:    #059669;
  --char-wrong:      #DC2626;

  --shadow-sm:       0 2px 4px rgba(15, 23, 42, 0.04);
  --shadow-card:     0 8px 24px rgba(15, 23, 42, 0.06);
  --shadow-hover:    0 16px 36px rgba(79, 70, 229, 0.12);
  --shadow-arena:    0 12px 40px rgba(15, 23, 42, 0.06);

  --hero-grad:       linear-gradient(180deg, #FFFFFF 0%, #EEF2FF 100%);
  --hero-border:     #E2E8F0;
  --hero-h1:         #0F172A;
  --hero-sub:        #475569;
  --hero-badge-bg:   #EEF2FF;
  --hero-badge-border: #C7D2FE;
  --hero-badge-text: #4338CA;
  --hero-btn-sec-bg: #FFFFFF;
  --hero-btn-sec-border: #CBD5E1;
  --hero-btn-sec-text: #1E293B;
  --hero-btn-sec-hover: #F8FAFC;

  --app-cta-bg:      linear-gradient(135deg, #EEF2FF 0%, #E0E7FF 100%);
  --app-cta-border:  #C7D2FE;
  --app-cta-h3:      #1E1B4B;
  --app-cta-sub:     #4338CA;
}

/* ── Night Mode (Dark) ──────────────────────────────────────── */
[data-theme="dark"] {
  --bg-body:         #0B0F19;
  --bg-surface:      #131B2E;
  --bg-card:         #131B2E;
  --bg-card-hover:   #1A243B;
  --bg-input:        #0B0F19;
  --bg-alt:          #1E293B;

  --border-subtle:   #1E293B;
  --border-strong:   #334155;
  --border-active:   #818CF8;

  --text-main:       #F8FAFC;
  --text-muted:      #94A3B8;
  --text-dim:        #64748B;

  --primary:         #6366F1;
  --primary-light:   #818CF8;
  --primary-dark:    #4F46E5;
  --primary-glow:    rgba(99, 102, 241, 0.25);

  --accent:          #38BDF8;
  --accent-light:    #7DD3FC;

  --success:         #34D399;
  --success-bg:      rgba(16, 185, 129, 0.15);
  --error:           #F87171;
  --error-bg:        rgba(239, 68, 68, 0.15);

  --char-pending:    #475569;
  --char-active-bg:  rgba(99, 102, 241, 0.2);
  --char-correct:    #34D399;
  --char-wrong:      #F87171;

  --shadow-sm:       0 2px 4px rgba(0, 0, 0, 0.3);
  --shadow-card:     0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-hover:    0 16px 36px rgba(99, 102, 241, 0.25);
  --shadow-arena:    0 12px 40px rgba(0, 0, 0, 0.45);

  --hero-grad:       linear-gradient(180deg, #131B2E 0%, #0B0F19 100%);
  --hero-border:     #1E293B;
  --hero-h1:         #FFFFFF;
  --hero-sub:        #A5B4FC;
  --hero-badge-bg:   rgba(255, 255, 255, 0.08);
  --hero-badge-border: rgba(255, 255, 255, 0.15);
  --hero-badge-text: #FEF08A;
  --hero-btn-sec-bg: rgba(255, 255, 255, 0.1);
  --hero-btn-sec-border: rgba(255, 255, 255, 0.2);
  --hero-btn-sec-text: #FFFFFF;
  --hero-btn-sec-hover: rgba(255, 255, 255, 0.18);

  --app-cta-bg:      linear-gradient(135deg, #1E1B4B 0%, #131B2E 100%);
  --app-cta-border:  #312E81;
  --app-cta-h3:      #FFFFFF;
  --app-cta-sub:     #C7D2FE;
}

/* ── Base Reset ─────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.15s ease;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-body);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Outfit', -apple-system, sans-serif;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  outline: none;
}

/* ── Header & Navigation ────────────────────────────────────── */
.header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: all 0.2s;
}

.header-inner {
  max-width: 1040px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: 'Outfit', sans-serif;
  font-weight: 900;
  font-size: 1.4rem;
  color: var(--text-main);
  letter-spacing: -0.03em;
}

.logo-mark {
  color: #F59E0B;
  font-size: 1.2rem;
}

.logo-accent {
  color: var(--accent);
}

.logo-badge {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  background: var(--primary);
  color: white;
  padding: 2px 7px;
  border-radius: 6px;
  margin-left: 4px;
}

.nav {
  display: flex;
  align-items: center;
  gap: 16px;
}

.nav-link {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 6px 10px;
  border-radius: 8px;
  transition: color 0.15s, background-color 0.15s;
}

.nav-link:hover {
  color: var(--primary);
  background: var(--bg-alt);
}

.theme-toggle {
  background: var(--bg-alt);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  font-size: 16px;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s, background 0.2s;
}

.theme-toggle:hover {
  transform: scale(1.08);
  border-color: var(--border-strong);
}

.nav-cta {
  background: var(--primary);
  color: white !important;
  font-weight: 700;
  font-size: 13px;
  padding: 8px 18px;
  border-radius: 10px;
  box-shadow: 0 4px 12px var(--primary-glow);
  transition: transform 0.15s, box-shadow 0.15s;
}

.nav-cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px var(--primary-glow);
}

/* ── Hero Section ───────────────────────────────────────────── */
.hero {
  background: var(--hero-grad);
  border-bottom: 1px solid var(--hero-border);
  padding: 64px 20px 56px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero-small {
  padding: 40px 20px;
}

.hero-inner {
  max-width: 760px;
  margin: 0 auto;
}

.hero-badge {
  display: inline-block;
  background: var(--hero-badge-bg);
  color: var(--hero-badge-text);
  border: 1px solid var(--hero-badge-border);
  font-size: 12px;
  font-weight: 700;
  padding: 5px 14px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 18px;
}

.hero h1 {
  font-size: clamp(2.4rem, 5vw, 3.8rem);
  line-height: 1.15;
  color: var(--hero-h1);
  margin-bottom: 18px;
}

.hero-sub {
  font-size: clamp(1rem, 2vw, 1.2rem);
  color: var(--hero-sub);
  line-height: 1.6;
  margin-bottom: 28px;
}

.hero-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 14px;
}

.btn-primary {
  background: #0EA5E9;
  color: white;
  font-weight: 700;
  font-size: 15px;
  padding: 12px 28px;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(14, 165, 233, 0.35);
  display: inline-block;
  transition: transform 0.15s, box-shadow 0.15s;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(14, 165, 233, 0.45);
}

.btn-secondary {
  background: var(--hero-btn-sec-bg);
  color: var(--hero-btn-sec-text);
  border: 1px solid var(--hero-btn-sec-border);
  font-weight: 700;
  font-size: 15px;
  padding: 12px 24px;
  border-radius: 12px;
  display: inline-block;
  transition: all 0.15s;
}

.btn-secondary:hover {
  background: var(--hero-btn-sec-hover);
  transform: translateY(-2px);
}

/* ── Stats Bar ──────────────────────────────────────────────── */
.stat-bar {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  padding: 20px 20px;
}

.stat-bar-inner {
  max-width: 1040px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  text-align: center;
}

.stat-num {
  display: block;
  font-family: 'Outfit', sans-serif;
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--primary);
  line-height: 1.2;
}

.stat-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ── Sections ───────────────────────────────────────────────── */
.section {
  max-width: 1040px;
  margin: 48px auto;
  padding: 0 20px;
}

.section-dark {
  background: var(--bg-alt);
  border-radius: 24px;
  padding: 40px 28px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.section-header h2 {
  font-size: 1.8rem;
}

.section-sub {
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 4px;
}

.link-all {
  color: var(--primary);
  font-weight: 700;
  font-size: 14px;
}

.link-all:hover {
  text-decoration: underline;
}

/* ── Lesson Cards Grid ──────────────────────────────────────── */
.lesson-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}

.lesson-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  padding: 20px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  position: relative;
  overflow: hidden;
}

.lesson-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  border-color: var(--border-active);
}

.lesson-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.lesson-num {
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--text-main);
}

.difficulty-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  text-transform: uppercase;
}

.badge-power {
  background: #F3E8FF;
  color: #7E22CE;
}

.badge-hard {
  background: #FEE2E2;
  color: #B91C1C;
}

.badge-medium {
  background: #FFEDD5;
  color: #C2410C;
}

.badge-standard {
  background: #DCFCE7;
  color: #15803D;
}

[data-theme="dark"] .badge-power { background: rgba(168, 85, 247, 0.2); color: #D8B4FE; }
[data-theme="dark"] .badge-hard { background: rgba(239, 68, 68, 0.2); color: #FCA5A5; }
[data-theme="dark"] .badge-medium { background: rgba(249, 115, 22, 0.2); color: #FDBA74; }
[data-theme="dark"] .badge-standard { background: rgba(34, 197, 94, 0.2); color: #86EFAC; }

.lesson-sample {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 16px;
  font-style: italic;
}

.lesson-meta {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
}

/* ── Exam Packs ─────────────────────────────────────────────── */
.pack-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-top: 20px;
}

.pack-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 20px 16px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, box-shadow 0.2s;
}

.pack-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  border-color: var(--border-active);
}

.pack-icon {
  font-size: 2rem;
  display: block;
  margin-bottom: 8px;
}

.pack-name {
  font-weight: 800;
  font-size: 14px;
  color: var(--text-main);
  display: block;
}

/* ── How It Works ───────────────────────────────────────────── */
.how-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  margin-top: 24px;
}

.how-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 28px 24px;
  box-shadow: var(--shadow-sm);
}

.how-num {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--bg-alt);
  color: var(--primary);
  font-family: 'Outfit', sans-serif;
  font-weight: 900;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.how-card h3 {
  font-size: 1.15rem;
  margin-bottom: 8px;
}

.how-card p {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ── App CTA ────────────────────────────────────────────────── */
.app-cta {
  max-width: 1040px;
  margin: 48px auto;
  padding: 0 20px;
}

.app-cta-inner {
  background: var(--app-cta-bg);
  border: 1px solid var(--app-cta-border);
  border-radius: 24px;
  padding: 36px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
  box-shadow: var(--shadow-card);
}

.app-cta-text h3 {
  color: var(--app-cta-h3);
  font-size: 1.5rem;
  margin-bottom: 6px;
}

.app-cta-text p {
  color: var(--app-cta-sub);
  font-size: 14px;
  max-width: 580px;
}

.btn-app {
  background: #0EA5E9;
  color: white;
  font-weight: 800;
  font-size: 14px;
  padding: 12px 24px;
  border-radius: 12px;
  white-space: nowrap;
  box-shadow: 0 8px 20px rgba(14, 165, 233, 0.4);
  transition: transform 0.15s;
}

.btn-app:hover {
  transform: scale(1.04);
}

/* ── Footer ─────────────────────────────────────────────────── */
.footer {
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  padding: 32px 20px;
  text-align: center;
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 50px;
}

.footer a {
  color: var(--primary);
  font-weight: 600;
}

/* ── Tables (Power Words) ───────────────────────────────────── */
.table-wrap {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  overflow-x: auto;
  box-shadow: var(--shadow-card);
}

.pw-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 14px;
}

.pw-table th {
  background: var(--bg-alt);
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.pw-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-main);
}

.pw-word {
  font-weight: 800;
  font-size: 15px;
  color: var(--text-main);
}

.pw-count {
  font-weight: 800;
  color: var(--primary);
}

.pw-mistake {
  color: var(--error);
  font-weight: 600;
}

.pw-exams {
  color: var(--text-dim);
  font-size: 12px;
}

.link-practice {
  color: var(--primary);
  font-weight: 700;
}

/* ── Settings Modal ─────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

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

.modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.25);
  padding: 24px;
  transform: translateY(12px) scale(0.98);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.open .modal-card {
  transform: translateY(0) scale(1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-close {
  background: var(--bg-alt);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.15s;
}

.modal-close:hover {
  color: var(--text-main);
  border-color: var(--border-strong);
}

.setting-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.setting-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.setting-info {
  flex: 1;
}

.setting-label {
  font-weight: 700;
  font-size: 14px;
  color: var(--text-main);
  margin-bottom: 2px;
}

.setting-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

.setting-ctrl {
  display: flex;
  gap: 6px;
}

.setting-btn-group {
  display: inline-flex;
  background: var(--bg-alt);
  padding: 3px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
}

.setting-pill-btn {
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  background: transparent;
  cursor: pointer;
  transition: all 0.15s;
}

.setting-pill-btn.active {
  background: var(--primary);
  color: #FFFFFF;
  box-shadow: 0 2px 8px var(--primary-glow);
}

.btn-danger-outline {
  background: var(--error-bg);
  border: 1px solid var(--error);
  color: var(--error);
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-danger-outline:hover {
  background: var(--error);
  color: #FFFFFF;
}

/* ── Mobile Breakpoints ─────────────────────────────────────── */
@media (max-width: 640px) {
  .stat-bar-inner {
    grid-template-columns: repeat(2, 1fr);
  }
  .header-inner {
    padding: 12px 16px;
  }
  .nav {
    gap: 8px;
  }
  .nav-link {
    font-size: 12px;
    padding: 4px 6px;
  }
  .nav-cta {
    display: none;
  }
}
