:root {
  --ink: #0f2d2a;
  --ink-soft: #3d5551;
  --muted: #64807b;
  --line: #dce8e5;
  --bg: #f3f8f7;
  --card: #ffffff;
  --accent: #0f766e;
  --accent-dark: #0b5a54;
  --good: #1a7f4b;
  --good-bg: #e7f4ec;
  --bad: #b3341f;
  --bad-bg: #fbeae6;
  --warn-bg: #fdf4e3;
  --warn: #8a6100;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(15, 45, 42, 0.06), 0 6px 20px rgba(15, 45, 42, 0.05);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.wrap { width: 100%; max-width: 820px; margin: 0 auto; padding: 0 20px; }

h1, h2, h3 { font-family: "Fraunces", Georgia, serif; font-weight: 600; letter-spacing: -0.01em; color: var(--ink); }
h2 { font-size: 1.5rem; margin: 0 0 0.4rem; }
h3 { font-size: 1.05rem; margin: 1.3rem 0 0.4rem; }
p { margin: 0.5rem 0; }
a, .link-btn { color: var(--accent); }

/* Header */
.site-header { background: var(--ink); color: #fff; }
.header-inner { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; gap: 16px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  display: inline-grid; place-items: center;
  width: 40px; height: 40px; border-radius: 9px;
  background: var(--accent); color: #fff;
  font-family: "Fraunces", serif; font-weight: 600; font-size: 0.95rem; letter-spacing: 0.02em;
}
.brand-title { font-family: "Fraunces", serif; font-weight: 600; font-size: 1.02rem; }
.brand-sub { font-size: 0.8rem; color: #9cc6bf; }
.learner-badge { font-size: 0.82rem; color: #bdd9d3; text-align: right; }
.learner-badge strong { color: #fff; display: block; }

/* Main */
#app { padding: 32px 20px 48px; }
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 26px 28px; margin-bottom: 18px;
}
.lead { color: var(--ink-soft); font-size: 1.02rem; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--accent); color: #fff; border: 0;
  padding: 11px 20px; border-radius: 9px; font: inherit; font-weight: 600;
  cursor: pointer; transition: background 0.15s ease;
}
.btn:hover { background: var(--accent-dark); }
.btn:disabled { background: #b9c4d4; cursor: not-allowed; }
.btn.secondary { background: #eef2f7; color: var(--ink); }
.btn.secondary:hover { background: #e3e9f1; }
.link-btn { background: none; border: 0; cursor: pointer; font: inherit; text-decoration: underline; padding: 0; }

/* Forms */
label { display: block; font-weight: 600; font-size: 0.9rem; margin: 14px 0 6px; }
input[type="text"], input[type="email"], input[type="password"] {
  width: 100%; padding: 11px 13px; border: 1px solid var(--line);
  border-radius: 9px; font: inherit; background: #fff;
}
input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }

/* Progress */
.progress { margin: 6px 0 22px; }
.progress-bar { height: 8px; background: #e7ecf3; border-radius: 99px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent); border-radius: 99px; transition: width 0.3s ease; }
.progress-label { font-size: 0.85rem; color: var(--muted); margin-top: 6px; }

/* Module list */
.module-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; padding: 15px 0; border-top: 1px solid var(--line);
}
.module-row:first-child { border-top: 0; }
.module-row .mr-title { font-weight: 600; }
.module-row .mr-sub { font-size: 0.82rem; color: var(--muted); }
.chip {
  font-size: 0.78rem; font-weight: 600; padding: 4px 10px; border-radius: 99px;
  background: #eef2f7; color: var(--ink-soft); white-space: nowrap;
}
.chip.done { background: var(--good-bg); color: var(--good); }
.chip.todo { background: #eef2f7; color: var(--muted); }
.chip.optional { background: var(--warn-bg); color: var(--warn); }

/* Reading */
.reading ul, .reading ol { padding-left: 1.3rem; }
.reading li { margin: 0.3rem 0; }

/* Quiz */
.question { padding: 18px 0; border-top: 1px solid var(--line); }
.question:first-of-type { border-top: 0; }
.q-prompt { font-weight: 600; margin-bottom: 10px; }
.option {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px;
  margin: 6px 0; cursor: pointer; transition: border-color 0.12s ease, background 0.12s ease;
}
.option:hover { border-color: #c2cfe0; background: #fafbfd; }
.option input { margin-top: 3px; }
.option.correct { border-color: var(--good); background: var(--good-bg); }
.option.wrong { border-color: var(--bad); background: var(--bad-bg); }
.option-tag { margin-left: auto; font-size: 0.75rem; font-weight: 600; }
.option-tag.correct { color: var(--good); }
.option-tag.wrong { color: var(--bad); }

/* Results */
.score-big { font-family: "Fraunces", serif; font-size: 3rem; font-weight: 600; line-height: 1; }
.banner { padding: 18px 22px; border-radius: var(--radius); margin: 4px 0 18px; }
.banner.pass { background: var(--good-bg); border: 1px solid #bfe3cd; }
.banner.fail { background: var(--bad-bg); border: 1px solid #efc6bd; }
.banner .verdict { font-family: "Fraunces", serif; font-size: 1.6rem; font-weight: 600; }
.banner.pass .verdict { color: var(--good); }
.banner.fail .verdict { color: var(--bad); }

.breakdown { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 0.92rem; }
.breakdown th, .breakdown td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); }
.breakdown th { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.breakdown td.num { text-align: right; font-variant-numeric: tabular-nums; }

/* Scoreboard */
.scoreboard { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.scoreboard th, .scoreboard td { text-align: left; padding: 10px; border-bottom: 1px solid var(--line); }
.scoreboard th { font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.status-pass { color: var(--good); font-weight: 600; }
.status-fail { color: var(--bad); font-weight: 600; }
.status-prog { color: var(--muted); }

/* Utility */
.row-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; }
.hidden { display: none; }
.error { color: var(--bad); font-size: 0.9rem; margin-top: 10px; }
.note { font-size: 0.85rem; color: var(--muted); }
.back { font-size: 0.88rem; margin-bottom: 14px; display: inline-block; cursor: pointer; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); background: #fff; margin-top: 20px; }
.footer-inner { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; font-size: 0.82rem; color: var(--muted); }

@media (max-width: 560px) {
  .header-inner { flex-direction: column; align-items: flex-start; }
  .learner-badge { text-align: left; }
  .card { padding: 20px; }
}
