/* TypingBoost — shared stylesheet (v1)
   Light theme, mobile-first, no framework, no external requests. */

:root {
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --accent-soft: #dbeafe;
  --ink: #1f2937;
  --muted: #6b7280;
  --bg: #f8fafc;
  --card: #ffffff;
  --border: #e5e7eb;
  --good: #15803d;
  --good-soft: #dcfce7;
  --bad: #dc2626;
  --bad-soft: #fee2e2;
  --radius: 12px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans",
    "Noto Sans Devanagari", Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  font-size: 17px;
}

.container { max-width: 920px; margin: 0 auto; padding: 0 16px; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1 { font-size: 1.9rem; line-height: 1.25; margin: 0 0 12px; }
h2 { font-size: 1.4rem; margin: 36px 0 10px; }
h3 { font-size: 1.15rem; margin: 24px 0 8px; }
p { margin: 0 0 14px; }
.lead { font-size: 1.1rem; color: var(--muted); }

/* ---------- Header: top bar + dark nav ---------- */
.topbar { background: var(--card); border-bottom: 1px solid var(--border); }
.topbar-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding-top: 12px;
  padding-bottom: 12px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.02em;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  flex: none;
  background: linear-gradient(135deg, #f97316, #ea580c);
  color: #fff;
  font-size: 1.25rem;
  font-weight: 800;
  box-shadow: 0 2px 6px rgba(234, 88, 12, 0.35);
}
.brand span { color: #ea580c; }
.site-search {
  margin-left: auto;
  position: relative;
  flex: 1 1 220px;
  max-width: 340px;
  display: flex;
}
.site-search input {
  flex: 1;
  min-width: 0;
  font-family: var(--font);
  font-size: 0.95rem;
  padding: 9px 12px;
  border: 2px solid var(--border);
  border-right: none;
  border-radius: 10px 0 0 10px;
  background: var(--bg);
  color: var(--ink);
}
.site-search input:focus { outline: none; border-color: var(--accent); background: #fff; }
.site-search button {
  border: 2px solid var(--accent);
  background: var(--accent);
  color: #fff;
  font-family: var(--font);
  font-weight: 700;
  font-size: 0.95rem;
  padding: 9px 16px;
  border-radius: 0 10px 10px 0;
  cursor: pointer;
}
.site-search button:hover { background: var(--accent-dark); }
.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 30;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.16);
  overflow: hidden;
}
.search-results a { display: block; padding: 10px 12px; color: var(--ink); font-size: 0.95rem; font-weight: 600; }
.search-results a small { display: block; color: var(--muted); font-weight: 400; font-size: 0.85rem; }
.search-results a:hover { background: var(--accent-soft); text-decoration: none; }
.search-results .no-result { padding: 10px 12px; color: var(--muted); font-size: 0.95rem; }
.main-nav-wrap {
  background: #0f172a;
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.25);
}
.main-nav { display: flex; align-items: center; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.main-nav::-webkit-scrollbar { display: none; }
.main-nav a {
  color: #e2e8f0;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 13px 14px;
  white-space: nowrap;
  border-bottom: 3px solid transparent;
}
.main-nav a:hover { color: #fff; background: rgba(255, 255, 255, 0.07); text-decoration: none; }
.main-nav a.active { color: #fff; border-bottom-color: #f97316; background: rgba(255, 255, 255, 0.05); }
.nav-cta {
  margin-left: auto;
  flex: none;
  background: #f97316;
  color: #fff !important;
  font-weight: 700;
  padding: 8px 16px !important;
  border-radius: 999px;
  border-bottom: none !important;
}
.nav-cta:hover { background: #ea580c !important; }

/* ---------- Hero banner (homepage) ---------- */
.hero-banner {
  background:
    radial-gradient(600px 220px at 15% -10%, rgba(255, 255, 255, 0.14), transparent 60%),
    radial-gradient(500px 200px at 85% 110%, rgba(34, 211, 238, 0.25), transparent 60%),
    linear-gradient(115deg, #1e1b4b 0%, #4f46e5 48%, #0e7490 100%);
  color: #fff;
  text-align: center;
  padding: 56px 0 44px;
}
.hero-banner h1 { color: #fff; font-size: 2.4rem; line-height: 1.15; margin-bottom: 14px; }
.hero-banner p { color: #e0e7ff; max-width: 640px; margin: 0 auto 22px; font-size: 1.08rem; }
.hero-banner .hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.btn-light { background: #fff; color: #4338ca; border-color: #fff; }
.btn-light:hover { background: #e0e7ff; }
.btn-outline-light { background: transparent; color: #fff; border-color: rgba(255, 255, 255, 0.7); }
.btn-outline-light:hover { background: rgba(255, 255, 255, 0.12); }
.hero-trust {
  margin-top: 24px;
  font-size: 0.92rem;
  color: #c7d2fe;
  display: flex;
  gap: 8px 20px;
  justify-content: center;
  flex-wrap: wrap;
}
.hero-trust span::before { content: "\2713  "; color: #34d399; font-weight: 800; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin: 24px 0;
}
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.card h2, .card h3 { margin-top: 0; }
.card p { color: var(--muted); font-size: 0.98rem; }

.steps { counter-reset: step; padding-left: 0; list-style: none; }
.steps li {
  counter-increment: step;
  padding: 10px 0 10px 44px;
  position: relative;
}
.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0; top: 10px;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  text-align: center;
  line-height: 30px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  padding: 10px 20px;
  border: 1px solid var(--accent);
  border-radius: 10px;
  cursor: pointer;
  font-family: var(--font);
}
.btn:hover { background: var(--accent-dark); text-decoration: none; }
.btn-ghost {
  background: var(--card);
  color: var(--accent);
  border: 1px solid var(--accent);
}
.btn-ghost:hover { background: var(--accent-soft); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* ---------- Typing tool ---------- */
.tool {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin: 20px 0;
}
.time-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.time-row .label { font-weight: 700; margin-right: 4px; }
.time-btn {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--ink);
  font-weight: 700;
  font-size: 0.95rem;
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  font-family: var(--font);
}
.time-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.passage {
  font-size: 1.25rem;
  line-height: 2;
  background: #f1f5f9;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  margin-bottom: 14px;
  cursor: text;
  user-select: none;
}
.passage .ch { border-radius: 3px; }
.passage .ch.correct { color: var(--good); }
.passage .ch.wrong { color: var(--bad); background: var(--bad-soft); }
.passage .ch.current { background: var(--accent-soft); box-shadow: inset 2px 0 0 var(--accent); }

#typing-input, .typing-input {
  width: 100%;
  min-height: 96px;
  font-family: var(--font);
  font-size: 1.05rem;
  line-height: 1.7;
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: 10px;
  resize: vertical;
  background: #fff;
  color: var(--ink);
}
#typing-input:focus, .typing-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
#typing-input:disabled { background: #f1f5f9; color: var(--muted); }

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 10px;
  margin-top: 16px;
}
.stat {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  text-align: center;
}
.stat .num { font-size: 1.5rem; font-weight: 800; line-height: 1.2; }
.stat .lbl { font-size: 0.82rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.stat .num.good { color: var(--good); }

.results {
  margin-top: 20px;
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  background: #eff6ff;
}
.results h2 { margin-top: 0; }
.results .big-wpm { font-size: 3rem; font-weight: 800; color: var(--accent); line-height: 1; }
.results .verdict { font-weight: 700; margin: 8px 0 16px; }
.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin: 16px 0;
}
.results-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.hidden { display: none !important; }

.note {
  background: #fefce8;
  border: 1px solid #fde68a;
  border-radius: 10px;
  padding: 14px 16px;
  margin: 16px 0;
  font-size: 0.97rem;
}
.note strong { display: block; margin-bottom: 4px; }

/* ---------- Tutor ---------- */
.lesson-btns { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.lesson-btn {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--ink);
  font-weight: 700;
  font-size: 0.95rem;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-family: var(--font);
}
.lesson-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.keys-line {
  background: var(--bg);
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  margin: 12px 0;
  font-size: 1.05rem;
  letter-spacing: 0.06em;
}
.keys-line kbd {
  background: var(--card);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 6px;
  padding: 2px 8px;
  font-family: var(--font);
  font-weight: 700;
  margin: 0 2px;
}
.practice-line {
  font-size: 1.3rem;
  line-height: 2;
  background: #f1f5f9;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  margin: 12px 0;
  letter-spacing: 0.02em;
}
.practice-line .ch.correct { color: var(--good); }
.practice-line .ch.wrong { color: var(--bad); background: var(--bad-soft); }
.practice-line .ch.current { background: var(--accent-soft); box-shadow: inset 2px 0 0 var(--accent); }
.tutor-msg { font-weight: 700; color: var(--good); min-height: 1.5em; }

/* ---------- Article text / prose ---------- */
.article { margin: 32px 0; }
.article ul, .article ol { margin: 0 0 14px; padding-left: 22px; }
.article li { margin-bottom: 6px; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--card);
  margin-top: 48px;
  padding: 24px 0 32px;
  font-size: 0.93rem;
  color: var(--muted);
}
.site-footer nav { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-bottom: 10px; }
.site-footer nav a { color: var(--muted); }
.site-footer nav a:hover { color: var(--accent); }

main { padding-top: 8px; padding-bottom: 8px; }

@media (max-width: 640px) {
  body { font-size: 16px; }
  h1 { font-size: 1.6rem; }
  .site-search { max-width: none; flex-basis: 100%; order: 3; }
  .hero-banner { padding: 40px 0 32px; }
  .hero-banner h1 { font-size: 1.8rem; }
  .passage { font-size: 1.12rem; line-height: 1.9; padding: 12px; }
  .practice-line { font-size: 1.15rem; }
  .results .big-wpm { font-size: 2.4rem; }
}
