/* Maxink Learning OS — presentation layer
   Zero-build, zero-dependency. Class names are stable: this file only changes
   how things look, never what the app does. */

:root {
  --bg: #f6f5f2;
  --card: #ffffff;
  --ink: #23231f;
  --ink-2: #4a4841;
  --muted: #6f6d67;
  --faint: #97948c;
  --line: #e6e3dc;
  --line-2: #d5d1c7;

  --primary: #3d5bd9;
  --primary-bg: #eef1fd;
  --ok: #0f6e56;
  --ok-bg: #e3f3ec;
  --warn: #8a5209;
  --warn-bg: #fbefdc;
  --bad: #a32d2d;
  --bad-bg: #fbeaea;

  --radius: 14px;
  --radius-sm: 9px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Segoe UI",
    "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

.container { max-width: 900px; margin: 0 auto; padding: 0 20px 64px; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; padding: 11px 20px;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { cursor: pointer; display: flex; align-items: baseline; gap: 8px; }
.brand strong { font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.brand .muted { font-size: 11.5px; color: var(--faint); }

.topbar-right { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }

.chip {
  font-size: 11.5px; color: var(--muted);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 3px 10px; background: #fbfaf7; white-space: nowrap;
}

/* ---------- headings ---------- */
h1 { font-size: 26px; font-weight: 600; letter-spacing: -.02em; margin: 30px 0 6px; }
h2 { font-size: 17px; font-weight: 600; margin: 0; letter-spacing: -.01em; }
h3 { font-size: 15px; font-weight: 600; margin: 0 0 10px; }
.muted { color: var(--muted); font-size: 13.5px; }

.page-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ---------- cards ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin: 14px 0;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; flex-wrap: wrap;
}

.track-card { position: relative; }

/* a track nobody has touched yet should read as an invitation, not a void */
.track-card.is-empty .progress { background: #efede7; }
.track-card.is-empty .progress-fill { background: var(--line-2); }

.track-note {
  margin: 10px 0 0; font-size: 13px; color: var(--warn);
  background: var(--warn-bg); border-radius: var(--radius-sm);
  padding: 8px 12px; line-height: 1.6;
}

.track-meta {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; margin-top: 9px; font-size: 13px; color: var(--muted);
}
.track-meta b { font-size: 20px; font-weight: 600; color: var(--ink); letter-spacing: -.02em; }

/* ---------- badges ---------- */
.badge {
  font-size: 11.5px; border-radius: 999px; padding: 3px 10px;
  white-space: nowrap; font-weight: 500;
}
.badge.live { background: var(--ok-bg); color: var(--ok); }
.badge.archive { background: var(--warn-bg); color: var(--warn); }
.badge.waived { background: #f1f0ec; color: var(--faint); }
.lineage { font-size: 12px; color: var(--warn); }

/* ---------- progress ---------- */
.progress {
  height: 7px; background: #efece6; border-radius: 999px;
  overflow: hidden; margin: 14px 0 0;
}
.progress-fill {
  height: 100%; background: var(--primary); border-radius: 999px;
  transition: width .35s ease;
}

/* ---------- buttons ---------- */
.btn {
  font-family: inherit; font-size: 13.5px; line-height: 1.4;
  border: 1px solid var(--line-2); color: var(--ink); background: #fff;
  border-radius: var(--radius-sm); padding: 7px 14px; cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn.primary {
  background: var(--primary); border-color: var(--primary); color: #fff;
  font-weight: 500;
}
.btn.primary:hover { filter: brightness(1.06); color: #fff; }
.btn.ghost { border-color: var(--line); color: var(--ink-2); background: #fff; }
.btn.ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn.danger { border-color: var(--line); color: var(--bad); }
.btn.danger:hover { background: var(--bad-bg); border-color: var(--bad); color: var(--bad); }
.btn.big { font-size: 15px; padding: 11px 22px; width: 100%; margin-top: 12px; }
.btn.wide { width: 100%; margin-top: 14px; text-align: center; }

/* quiet text action, so the primary button keeps its single job */
.link-btn {
  display: inline-block; margin-top: 11px; padding: 0; border: 0;
  background: none; font-family: inherit; font-size: 13px;
  color: var(--primary); cursor: pointer;
}
.link-btn:hover { text-decoration: underline; }

.back { margin-top: 14px; }

/* ---------- lesson list ---------- */
.lesson-list { list-style: none; padding: 0; margin: 12px 0 0; }
.lesson-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  cursor: pointer; border: 1px solid transparent;
  transition: background .15s, border-color .15s;
}
.lesson-item:hover { background: var(--primary-bg); border-color: #dde3fb; }
.lesson-item.completed .lesson-title { color: var(--ok); }
.lesson-title { flex: 1; font-weight: 500; font-size: 14.5px; }

.status-dot {
  width: 20px; height: 20px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; color: #fff; background: #dcd9d1; flex: none;
}
.status-dot.completed { background: var(--ok); }
.status-dot.in-progress { background: var(--warn); }

.status-chip {
  font-size: 12px; border-radius: 999px; padding: 3px 10px;
  background: #f1f0ec; color: var(--muted);
}
.status-chip.completed { background: var(--ok-bg); color: var(--ok); }
.status-chip.in-progress { background: var(--warn-bg); color: var(--warn); }
.status-chip.disconnected { background: #f1f0ec; color: var(--faint); }

/* ---------- lesson body ---------- */
.intro { font-size: 15px; color: var(--ink-2); margin: 6px 0 4px; }

.concept {
  margin: 14px 0; padding-left: 14px;
  border-left: 3px solid var(--primary-bg);
}
.concept strong { color: var(--primary); font-weight: 600; }
.concept p, .concept div { margin: 3px 0 0; }

pre {
  background: #16181f; color: #e7ecff;
  padding: 14px 16px; border-radius: var(--radius-sm);
  overflow-x: auto; font-size: 12.5px; line-height: 1.65;
  font-family: ui-monospace, Menlo, "SF Mono", monospace;
}

/* ---------- quiz ---------- */
.quiz-question { font-weight: 600; font-size: 15px; }
.quiz-option {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 10px 13px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); margin: 8px 0; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.quiz-option:hover { border-color: var(--primary); background: var(--primary-bg); }
.quiz-feedback .ok { color: var(--ok); font-weight: 600; }
.quiz-feedback .bad { color: var(--bad); font-weight: 600; }

/* ---------- evidence / forms ---------- */
.evidence-list { padding-left: 18px; }
.evidence-form { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.evidence-form input {
  flex: 1; min-width: 160px; padding: 8px 12px; font-family: inherit;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-size: 14px; background: #fff;
}
.evidence-form input:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-bg);
}

.row { display: flex; gap: 8px; align-items: center; margin-top: 12px; flex-wrap: wrap; }

select {
  padding: 8px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); font-family: inherit; font-size: 14px;
  background: #fff;
}

/* ---------- diagnostics (cloud sync) ---------- */
.diag {
  margin-top: 12px; font-size: 13px; line-height: 1.65;
  border-radius: var(--radius-sm); padding: 10px 13px;
  background: #faf9f6; border: 1px solid var(--line); color: var(--ink-2);
}
.diag.ok { background: var(--ok-bg); border-color: #c9e6da; color: #0b4a3c; }
.diag.bad { background: var(--bad-bg); border-color: #eec6c6; color: #6b1c1c; }
.diag code {
  font-family: ui-monospace, Menlo, monospace; font-size: 12px;
  background: rgba(0, 0, 0, .05); padding: 1px 5px; border-radius: 4px;
}

/* ---------- misc ---------- */
.errors li { color: var(--bad); }
.conflicts { color: var(--warn); font-size: 13px; }
.hidden { display: none !important; }
.spacer { height: 40px; }
.footer {
  text-align: center; padding: 28px 20px 40px;
  color: var(--faint); font-size: 12.5px;
}
.done-note { color: var(--ok); font-weight: 600; font-size: 14px; }

details { margin-top: 14px; }
details summary { cursor: pointer; font-size: 13px; color: var(--muted); }
details summary:hover { color: var(--primary); }
details ol { margin: 8px 0 0; }

@media (max-width: 640px) {
  .container { padding: 0 14px 56px; }
  .topbar { flex-wrap: wrap; padding: 10px 14px; gap: 8px; }
  .topbar-right { width: 100%; }
  .topbar-right .btn { flex: 1 1 auto; }
  .chip { order: -1; width: 100%; text-align: center; }
  h1 { font-size: 22px; margin-top: 22px; }
  .card { padding: 16px 16px; }
  .lesson-item { flex-wrap: wrap; }
  .track-meta b { font-size: 18px; }
}
