/* CodeSprint v1 — shared styles */
:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --indigo: #4f46e5;
  --teal: #14b8a6;
  --gradient: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #14b8a6 100%);
  --easy: #16a34a;
  --easy-bg: #dcfce7;
  --medium: #d97706;
  --medium-bg: #fef3c7;
  --hard: #dc2626;
  --hard-bg: #fee2e2;
  --radius: 12px;
  --shadow: 0 4px 24px rgba(15, 23, 42, 0.08);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}
a { color: var(--indigo); text-decoration: none; }
a:hover { text-decoration: underline; }
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 0.9em;
}
pre {
  background: #0f172a;
  color: #e2e8f0;
  padding: 14px 16px;
  border-radius: 10px;
  overflow-x: auto;
  font-size: 0.9em;
}
.container { max-width: 1120px; margin: 0 auto; padding: 0 20px; }

/* Nav */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: 1120px; margin: 0 auto; padding: 12px 20px;
  display: flex; align-items: center; gap: 24px;
}
.logo { font-weight: 800; font-size: 1.35em; color: var(--text); display: flex; align-items: center; gap: 8px; }
.logo:hover { text-decoration: none; }
.logo-mark {
  width: 30px; height: 30px; border-radius: 8px; background: var(--gradient);
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-size: 15px; font-weight: 800;
}
.nav-links { display: flex; gap: 20px; margin-left: 8px; }
.nav-links a { color: var(--muted); font-weight: 500; }
.nav-links a:hover, .nav-links a.active { color: var(--text); text-decoration: none; }
.nav-spacer { flex: 1; }
.demo-pill {
  font-size: 0.75em; font-weight: 700; letter-spacing: 0.06em;
  background: #fef3c7; color: #92400e; border: 1px solid #fcd34d;
  padding: 4px 10px; border-radius: 999px; cursor: pointer;
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 24px; border-radius: 10px; font-weight: 600; font-size: 1em;
  border: none; cursor: pointer; transition: transform 0.08s ease, box-shadow 0.15s ease;
  text-decoration: none;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary { background: var(--gradient); color: #fff; box-shadow: 0 6px 20px rgba(79, 70, 229, 0.35); }
.btn-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-sm { padding: 8px 16px; font-size: 0.9em; }
.btn:disabled { opacity: 0.6; cursor: wait; transform: none; }
.btn-success { background: var(--easy); color: #fff; }

/* Hero */
.hero {
  background: var(--gradient);
  color: #fff;
  padding: 84px 20px 72px;
  text-align: center;
}
.hero h1 { font-size: 2.6em; margin: 0 0 16px; line-height: 1.2; }
.hero p { font-size: 1.15em; opacity: 0.92; max-width: 640px; margin: 0 auto 28px; }
.hero-cta { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.hero .btn-secondary { background: rgba(255,255,255,0.15); color: #fff; border: 1px solid rgba(255,255,255,0.4); }
.stats-row {
  display: flex; gap: 32px; justify-content: center; margin-top: 40px; flex-wrap: wrap;
}
.stat { text-align: center; }
.stat-num { font-size: 1.8em; font-weight: 800; }
.stat-label { font-size: 0.9em; opacity: 0.85; }

/* Sections */
.section { padding: 64px 0; }
.section h2 { text-align: center; font-size: 2em; margin: 0 0 12px; }
.section-sub { text-align: center; color: var(--muted); max-width: 640px; margin: 0 auto 40px; }

/* Cards */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; }
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow);
}
.card h3 { margin: 0 0 10px; font-size: 1.15em; }
.card p { color: var(--muted); margin: 0; }
.step-num {
  width: 40px; height: 40px; border-radius: 50%; background: var(--gradient);
  color: #fff; font-weight: 800; display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
}

/* Pricing */
.pricing { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; max-width: 760px; margin: 0 auto; }
.price-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 32px; box-shadow: var(--shadow);
  display: flex; flex-direction: column;
}
.price-card.featured { border: 2px solid var(--indigo); position: relative; }
.price-flag {
  position: absolute; top: -14px; left: 50%; transform: translateX(-50%);
  background: var(--gradient); color: #fff; font-size: 0.8em; font-weight: 700;
  padding: 4px 14px; border-radius: 999px; white-space: nowrap;
}
.price { font-size: 2.4em; font-weight: 800; margin: 8px 0; }
.price span { font-size: 0.45em; font-weight: 500; color: var(--muted); }
.price-card ul { list-style: none; padding: 0; margin: 0 0 24px; flex: 1; }
.price-card li { padding: 8px 0; border-bottom: 1px solid #f1f5f9; color: var(--muted); }
.price-card li:last-child { border-bottom: none; }
.price-card li strong { color: var(--text); }

/* FAQ */
.faq { max-width: 720px; margin: 0 auto; }
.faq-item { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; margin-bottom: 12px; }
.faq-q {
  width: 100%; text-align: left; background: none; border: none; cursor: pointer;
  padding: 18px 20px; font-size: 1em; font-weight: 600; color: var(--text);
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.faq-a { padding: 0 20px 18px; color: var(--muted); display: none; }
.faq-item.open .faq-a { display: block; }
.faq-toggle { font-size: 1.3em; color: var(--indigo); flex-shrink: 0; }

/* Problems list */
.toolbar { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin: 28px 0 18px; }
.search {
  flex: 1; min-width: 200px; padding: 11px 16px; border: 1px solid var(--border);
  border-radius: 10px; font-size: 1em; background: var(--surface);
}
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  padding: 8px 16px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); cursor: pointer; font-size: 0.9em; font-weight: 500; color: var(--muted);
}
.chip.active { background: var(--text); color: #fff; border-color: var(--text); }
.progress-wrap { margin: 0 0 18px; }
.progress-label { font-size: 0.9em; color: var(--muted); margin-bottom: 6px; }
.progress { height: 8px; background: #e2e8f0; border-radius: 999px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--gradient); border-radius: 999px; transition: width 0.3s ease; }
.problem-list { display: flex; flex-direction: column; gap: 10px; padding-bottom: 60px; }
.problem-row {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 14px 18px;
}
.problem-row:hover { border-color: var(--indigo); }
.problem-row a.title { font-weight: 600; color: var(--text); flex: 1; }
.problem-row a.title:hover { color: var(--indigo); text-decoration: none; }
.solved-check {
  width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border);
  flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; color: #fff;
}
.solved-check.done { background: var(--easy); border-color: var(--easy); }
.badge {
  font-size: 0.75em; font-weight: 700; padding: 4px 12px; border-radius: 999px;
  text-transform: capitalize; flex-shrink: 0;
}
.badge.easy { background: var(--easy-bg); color: var(--easy); }
.badge.medium { background: var(--medium-bg); color: var(--medium); }
.badge.hard { background: var(--hard-bg); color: var(--hard); }
.tag { font-size: 0.78em; color: var(--muted); background: #f1f5f9; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; }
.lock { color: var(--medium); font-size: 1.1em; flex-shrink: 0; }
.empty-state { text-align: center; color: var(--muted); padding: 60px 20px; }

/* Solve layout */
.solve-layout {
  display: grid; grid-template-columns: minmax(340px, 5fr) minmax(0, 7fr);
  gap: 0; height: calc(100vh - 57px); min-height: 560px;
}
.problem-pane { overflow-y: auto; padding: 28px; border-right: 1px solid var(--border); background: var(--surface); }
.problem-pane h1 { font-size: 1.5em; margin: 0 0 10px; }
.pane-meta { display: flex; gap: 8px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }
.example { background: #f8fafc; border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; margin-bottom: 12px; }
.example p { margin: 6px 0; font-size: 0.92em; }
.example .ex-label { font-weight: 700; font-size: 0.85em; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.constraints-list { padding-left: 20px; color: var(--muted); font-size: 0.92em; }
.constraints-list code { background: #f1f5f9; }
.editor-pane { display: flex; flex-direction: column; background: #1e1e2e; min-width: 0; }
.editor-toolbar {
  display: flex; align-items: center; gap: 10px; padding: 10px 16px;
  background: #171725; border-bottom: 1px solid #2d2d44; flex-wrap: wrap;
}
.lang-toggle { display: flex; background: #0f0f1c; border-radius: 8px; padding: 3px; }
.lang-toggle button {
  border: none; background: none; color: #a0a0b8; padding: 7px 16px;
  border-radius: 6px; cursor: pointer; font-size: 0.88em; font-weight: 600;
}
.lang-toggle button.active { background: var(--indigo); color: #fff; }
.editor-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.CodeMirror { flex: 1; height: auto; font-size: 14px; }
.results-pane {
  background: #171725; color: #e2e8f0; border-top: 1px solid #2d2d44;
  max-height: 42%; overflow-y: auto; padding: 16px 20px;
}
.results-pane h3 { margin: 0 0 10px; font-size: 1em; }
.test-row { border: 1px solid #2d2d44; border-radius: 8px; padding: 10px 14px; margin-bottom: 8px; font-size: 0.88em; }
.test-row.pass { border-left: 4px solid var(--easy); }
.test-row.fail { border-left: 4px solid var(--hard); }
.test-row .t-head { font-weight: 700; margin-bottom: 6px; }
.test-row .t-detail { color: #a0a0b8; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.92em; word-break: break-all; }
.test-row .t-err { color: #f87171; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.92em; word-break: break-all; }
.results-summary { font-weight: 700; margin-bottom: 12px; }
.results-summary.ok { color: #4ade80; }
.results-summary.bad { color: #f87171; }
.py-notice {
  background: #1e293b; border: 1px solid #334155; border-radius: 8px;
  padding: 12px 16px; margin-bottom: 12px; font-size: 0.9em; color: #cbd5e1;
}
.lock-banner {
  background: #fffbeb; border: 1px solid #fcd34d; border-radius: 10px;
  padding: 16px 18px; margin-bottom: 18px; font-size: 0.92em; color: #92400e;
}
.lock-banner strong { display: block; margin-bottom: 4px; }
.solved-banner {
  background: #f0fdf4; border: 1px solid #86efac; border-radius: 10px;
  padding: 16px 18px; margin-bottom: 18px; color: #166534; font-weight: 600;
}

/* Footer */
footer { border-top: 1px solid var(--border); background: var(--surface); padding: 40px 0 28px; margin-top: 40px; }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 28px; margin-bottom: 28px; }
.footer-grid h4 { margin: 0 0 12px; font-size: 0.95em; }
.footer-grid p, .footer-grid a { color: var(--muted); font-size: 0.92em; }
.footer-grid ul { list-style: none; padding: 0; margin: 0; }
.footer-grid li { margin-bottom: 8px; }
.footer-bottom { border-top: 1px solid var(--border); padding-top: 20px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; color: var(--muted); font-size: 0.85em; }
.link-btn { background: none; border: none; padding: 0; color: var(--indigo); cursor: pointer; font-size: 0.92em; }
.link-btn:hover { text-decoration: underline; }

/* Modals */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.55);
  display: none; align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--surface); border-radius: 16px; max-width: 480px; width: 100%;
  padding: 32px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  max-height: 90vh; overflow-y: auto; position: relative;
}
.modal h2 { margin: 0 0 8px; font-size: 1.4em; }
.modal .modal-sub { color: var(--muted); margin: 0 0 20px; }
.modal-close {
  position: absolute; top: 14px; right: 16px; background: none; border: none;
  font-size: 1.4em; cursor: pointer; color: var(--muted);
}
.plan-line { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid #f1f5f9; font-size: 0.95em; }
.plan-line span:last-child { font-weight: 700; }
.pro-features { margin: 16px 0; padding-left: 20px; color: var(--muted); font-size: 0.95em; }
.pro-features li { margin-bottom: 6px; }
.demo-link { margin-top: 14px; text-align: center; font-size: 0.85em; color: var(--muted); }
.privacy-body { color: var(--muted); font-size: 0.93em; }
.privacy-body h3 { color: var(--text); font-size: 1em; margin: 18px 0 6px; }

/* Toast */
.toast-wrap { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: #0f172a; color: #fff; padding: 12px 22px; border-radius: 10px;
  font-size: 0.92em; box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  animation: toast-in 0.25s ease;
}
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* Responsive */
@media (max-width: 860px) {
  .solve-layout { grid-template-columns: 1fr; height: auto; }
  .problem-pane { border-right: none; border-bottom: 1px solid var(--border); max-height: none; }
  .editor-pane { min-height: 480px; }
  .CodeMirror { min-height: 320px; }
  .hero h1 { font-size: 2em; }
  .nav-links { display: none; }
  .tags { display: none; }
}
