:root {
  --bg: #0d1117;
  --bg-soft: #161b22;
  --bg-card: #1a2029;
  --border: #2a323d;
  --text: #e6edf3;
  --text-dim: #9aa7b4;
  --accent: #3b82f6;
  --accent-hover: #2f6fd6;
  --accent-soft: rgba(59, 130, 246, 0.12);
  --green: #3fb950;
  --amber: #d29922;
  --red: #f85149;
  --purple: #a371f7;
  --radius: 12px;
  --maxw: 1040px;
  font-synthesis: none;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

/* ---------- Header ---------- */
.site-header {
  border-bottom: 1px solid var(--border);
  background: rgba(13, 17, 23, 0.85);
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 50;
}
.site-header .inner {
  max-width: var(--maxw); margin: 0 auto; padding: 14px 20px;
  display: flex; align-items: center; gap: 24px;
}
.brand { font-weight: 800; font-size: 20px; color: var(--text); letter-spacing: -0.02em; }
.brand:hover { text-decoration: none; }
.brand .dot { color: var(--accent); }
.nav { display: flex; gap: 20px; margin-left: auto; align-items: center; }
.nav a { color: var(--text-dim); font-size: 15px; font-weight: 500; }
.nav a:hover { color: var(--text); text-decoration: none; }
.nav .btn { color: #fff; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block; background: var(--accent); color: #fff;
  padding: 10px 20px; border-radius: 8px; font-weight: 600; font-size: 15px;
  border: none; cursor: pointer; transition: background 0.15s;
}
.btn:hover { background: var(--accent-hover); text-decoration: none; }
.btn.secondary { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn.secondary:hover { background: var(--bg-soft); }
.btn.ghost { background: transparent; color: var(--accent); padding-left: 0; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- Hero ---------- */
.hero { text-align: center; padding: 90px 20px 60px; }
.hero h1 { font-size: 46px; line-height: 1.1; margin: 0 0 18px; letter-spacing: -0.03em; font-weight: 820; }
.hero h1 .grad { background: linear-gradient(90deg, #3b82f6, #a371f7); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p.sub { font-size: 20px; color: var(--text-dim); max-width: 640px; margin: 0 auto 32px; }
.hero .cta { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

/* ---------- Feature cards ---------- */
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; margin: 40px 0; }
.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px;
}
.card h3 { margin: 0 0 8px; font-size: 18px; }
.card p { margin: 0; color: var(--text-dim); font-size: 15px; }
.card .ico { font-size: 24px; margin-bottom: 10px; }

/* ---------- Section ---------- */
.section { padding: 40px 0; }
.section h2 { font-size: 30px; letter-spacing: -0.02em; margin: 0 0 8px; }
.section .lead { color: var(--text-dim); margin: 0 0 28px; font-size: 17px; }

/* ---------- Question list ---------- */
.progress-bar-wrap { background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 22px; margin-bottom: 28px; display: flex; align-items: center; gap: 18px; }
.progress-track { flex: 1; height: 8px; background: var(--border); border-radius: 99px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--green)); width: 0; transition: width .4s; }
.progress-label { font-size: 14px; color: var(--text-dim); white-space: nowrap; }

.cat-group { margin-bottom: 30px; }
.cat-group h3 { font-size: 15px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-dim); margin: 0 0 10px; }
.q-list { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.q-row {
  display: flex; align-items: center; gap: 14px; padding: 14px 18px;
  border-bottom: 1px solid var(--border); background: var(--bg-card);
}
.q-row:last-child { border-bottom: none; }
.q-row:hover { background: #20272f; }
.q-row .status-ico { width: 20px; text-align: center; flex: none; }
.q-row .q-title { font-weight: 600; color: var(--text); flex: 1; }
.q-row .q-title:hover { color: var(--accent); }
.q-row.locked .q-title { color: var(--text-dim); }

.badge { font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 99px; white-space: nowrap; }
.badge.easy { color: var(--green); background: rgba(63,185,80,.13); }
.badge.medium { color: var(--amber); background: rgba(210,153,34,.13); }
.badge.hard { color: var(--red); background: rgba(248,81,73,.13); }
.badge.pro { color: var(--purple); background: rgba(163,113,247,.14); }

/* ---------- Problem page ---------- */
.problem-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; margin: 24px 0 60px; }
@media (max-width: 860px) { .problem-layout { grid-template-columns: 1fr; } }
.panel { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.panel h1 { margin: 0 0 6px; font-size: 26px; letter-spacing: -0.02em; }
.meta-row { display: flex; gap: 10px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }
.meta-row .cat { color: var(--text-dim); font-size: 14px; }

.prose { font-size: 15.5px; }
.prose h2 { font-size: 19px; margin: 22px 0 8px; }
.prose h3 { font-size: 16px; margin: 18px 0 6px; }
.prose code { background: var(--bg-soft); padding: 2px 6px; border-radius: 5px; font-size: 13.5px; font-family: "SFMono-Regular", Consolas, monospace; }
.prose pre { background: #0b0f14; border: 1px solid var(--border); border-radius: 8px; padding: 14px 16px; overflow-x: auto; }
.prose pre code { background: none; padding: 0; font-size: 13.5px; }
.prose table { border-collapse: collapse; width: 100%; }
.prose th, .prose td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; }

.editor-tools { display: flex; gap: 10px; margin: 14px 0; flex-wrap: wrap; }
.CodeMirror { height: auto; min-height: 260px; border: 1px solid var(--border); border-radius: 8px; font-size: 13.5px; }
.save-hint { font-size: 12px; color: var(--text-dim); margin-left: auto; align-self: center; }

.locked-box { text-align: center; padding: 30px; border: 1px dashed var(--purple); border-radius: var(--radius); background: rgba(163,113,247,.06); }
.locked-box .ico { font-size: 30px; }
.solution-wrap { margin-top: 20px; border-top: 1px solid var(--border); padding-top: 20px; }

/* ---------- Pricing ---------- */
.pricing { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; margin: 30px 0; align-items: stretch; }
.price-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; display: flex; flex-direction: column; }
.price-card.featured { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); position: relative; }
.price-card .tag { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); background: var(--accent); color: #fff; font-size: 12px; font-weight: 700; padding: 3px 12px; border-radius: 99px; }
.price-card h3 { margin: 0 0 4px; font-size: 20px; }
.price-card .price { font-size: 38px; font-weight: 800; letter-spacing: -0.02em; }
.price-card .price span { font-size: 15px; color: var(--text-dim); font-weight: 500; }
.price-card ul { list-style: none; padding: 0; margin: 18px 0 24px; color: var(--text-dim); font-size: 14.5px; }
.price-card li { padding: 5px 0 5px 24px; position: relative; }
.price-card li::before { content: "✓"; color: var(--green); position: absolute; left: 0; font-weight: 700; }
.price-card .btn { margin-top: auto; text-align: center; }

/* ---------- Forms ---------- */
.form-card { max-width: 440px; margin: 20px auto; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; }
.form-card label { display: block; font-size: 14px; margin: 14px 0 6px; color: var(--text-dim); }
.form-card input { width: 100%; padding: 11px 13px; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; color: var(--text); font-size: 15px; }
.form-card input:focus { outline: none; border-color: var(--accent); }
.notice { padding: 12px 16px; border-radius: 8px; margin: 16px 0; font-size: 14.5px; }
.notice.ok { background: rgba(63,185,80,.12); color: var(--green); border: 1px solid rgba(63,185,80,.3); }
.notice.err { background: rgba(248,81,73,.12); color: var(--red); border: 1px solid rgba(248,81,73,.3); }
.notice.info { background: var(--accent-soft); color: var(--accent); border: 1px solid rgba(59,130,246,.3); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); margin-top: 60px; padding: 30px 20px; color: var(--text-dim); font-size: 14px; }
.site-footer .inner { max-width: var(--maxw); margin: 0 auto; display: flex; gap: 20px; flex-wrap: wrap; align-items: center; }
.site-footer a { color: var(--text-dim); }
.site-footer .spacer { margin-left: auto; }

.muted { color: var(--text-dim); }
.center { text-align: center; }
.hidden { display: none !important; }
