:root {
  --ink: #14322f;
  --ink-2: #2c4a46;
  --muted: #61716e;
  --line: #dfe5e3;
  --bg: #f6f4ef;
  --card: #ffffff;
  --accent: #f2b84b;
  --accent-ink: #3b2a00;
  --good: #1f7a4d;
  --good-bg: #e3f4ea;
  --bad: #b3261e;
  --bad-bg: #fbe7e5;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 50, 47, .06), 0 4px 16px rgba(20, 50, 47, .06);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh; display: flex; flex-direction: column;
}
a { color: var(--ink); }
main { width: 100%; max-width: 820px; margin: 0 auto; padding: 16px; flex: 1; outline: none; }
h1 { font-size: 1.7rem; line-height: 1.2; margin: .3em 0 .4em; letter-spacing: -.01em; }
h2 { font-size: 1.25rem; margin: 1.4em 0 .5em; }
h3 { font-size: 1.05rem; margin: 0 0 .3em; }
p { margin: .4em 0 .8em; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.pad { padding: 16px; }

.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; background: var(--ink); color: #fff; position: sticky; top: 0; z-index: 5;
}
.brand { white-space: nowrap; color: #fff; text-decoration: none; font-weight: 700; font-size: 1.1rem; display: flex; align-items: center; gap: 8px; }
.logo { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--accent); color: var(--ink); font-weight: 800; }
.hide-sm { display: contents; }
#nav { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
#nav a, #nav button { color: #e6efed; text-decoration: none; font-size: .92rem; padding: 6px 9px; border-radius: 8px; background: none; border: 0; cursor: pointer; font: inherit; }
#nav a:hover, #nav button:hover, #nav a.on { background: rgba(255,255,255,.12); color: #fff; }
.foot { text-align: center; padding: 20px 16px 28px; color: var(--muted); font-size: .9rem; }
.foot a { color: var(--muted); }

#banner .test { background: #fff4d6; color: var(--accent-ink); text-align: center; padding: 6px 12px; font-size: .88rem; }

.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin: 0 0 14px; }
.card.link { display: block; text-decoration: none; transition: transform .12s ease; }
.card.link:hover { transform: translateY(-1px); }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.stack > * + * { margin-top: 10px; }
.tag { display: inline-block; font-size: .78rem; padding: 2px 8px; border-radius: 999px; background: #e9efed; color: var(--ink-2); }
.tag.gold { background: #fdf0d2; color: var(--accent-ink); }
.tag.green { background: var(--good-bg); color: var(--good); }
.tag.red { background: var(--bad-bg); color: var(--bad); }

.hero { padding: 26px 20px; background: var(--ink); color: #fff; border-radius: var(--radius); margin-bottom: 18px; }
.hero h1 { font-size: 1.9rem; }
.hero p { color: #d6e2df; max-width: 52ch; }
.hero .btn { margin-top: 6px; }
.steps { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin: 6px 0 18px; }
.steps div { background: var(--card); border-radius: 12px; padding: 14px; box-shadow: var(--shadow); }
.steps b { display: block; margin-bottom: 2px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 11px 18px; border-radius: 11px; border: 0; cursor: pointer;
  font: inherit; font-weight: 650; text-decoration: none;
  background: var(--ink); color: #fff; min-height: 44px;
}
.btn.accent { background: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn.small { padding: 6px 12px; min-height: 34px; font-size: .9rem; }
.btn.danger { background: transparent; color: var(--bad); box-shadow: inset 0 0 0 1.5px #efc9c5; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.block { width: 100%; }

form .field { margin: 0 0 14px; }
label { display: block; font-weight: 600; margin-bottom: 4px; font-size: .95rem; }
input, textarea, select {
  width: 100%; padding: 11px 12px; border: 1.5px solid var(--line); border-radius: 10px;
  font: inherit; background: #fff; color: var(--ink);
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); border-color: transparent; }
textarea { min-height: 140px; resize: vertical; }
.err { color: var(--bad); font-weight: 600; min-height: 1.2em; }

.tabs { display: flex; gap: 6px; margin: 4px 0 14px; overflow-x: auto; }
.tabs button { flex: 1; padding: 10px; border: 0; border-radius: 10px; background: #e9efed; font: inherit; font-weight: 600; cursor: pointer; color: var(--ink-2); white-space: nowrap; }
.tabs button.on { background: var(--ink); color: #fff; }

.bar { height: 8px; background: #e6ebe9; border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .3s ease; }

/* course outline */
.chapter { padding: 0; overflow: hidden; }
.chapter > .head { padding: 16px 18px; display: flex; gap: 12px; align-items: flex-start; }
.num { flex: none; width: 34px; height: 34px; border-radius: 10px; background: #e9efed; display: grid; place-items: center; font-weight: 700; }
.num.done { background: var(--good-bg); color: var(--good); }
.units { border-top: 1px solid var(--line); padding: 8px 18px 14px; }
.unit-title { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 10px 0 4px; }
.sec { display: flex; gap: 10px; align-items: center; padding: 8px 0; text-decoration: none; border-bottom: 1px dashed var(--line); }
.sec:last-child { border-bottom: 0; }
.dot { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line); flex: none; }
.dot.done { background: var(--good); border-color: var(--good); }

/* lesson */
.crumb { font-size: .85rem; color: var(--muted); margin-bottom: 4px; }
.lesson-body ul { padding-left: 1.2em; margin: .4em 0 .9em; }
.lesson-body li { margin: .25em 0; }
.keys { background: #fdf6e3; border-radius: 12px; padding: 14px 16px; margin: 14px 0; }
.keys h3 { font-size: .85rem; text-transform: uppercase; letter-spacing: .05em; color: var(--accent-ink); }
.keys ul { margin: 6px 0 0; padding-left: 1.1em; }
.cite { font-size: .85rem; color: var(--muted); }

/* questions */
.q { font-weight: 650; font-size: 1.07rem; margin-bottom: 12px; }
.opts { display: grid; gap: 8px; }
.opt {
  text-align: left; padding: 13px 14px; border-radius: 11px; border: 1.5px solid var(--line);
  background: #fff; font: inherit; cursor: pointer; color: var(--ink); display: flex; gap: 10px; align-items: flex-start;
}
.opt:hover:not(:disabled) { border-color: var(--ink-2); }
.opt .letter { flex: none; width: 24px; height: 24px; border-radius: 7px; background: #e9efed; display: grid; place-items: center; font-weight: 700; font-size: .85rem; }
.opt.picked { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.opt.right { border-color: var(--good); background: var(--good-bg); }
.opt.wrong { border-color: var(--bad); background: var(--bad-bg); }
.opt:disabled { cursor: default; }
.feedback { margin-top: 10px; padding: 12px 14px; border-radius: 11px; }
.feedback.good { background: var(--good-bg); color: #134d31; }
.feedback.bad { background: var(--bad-bg); color: #7c1a14; }

.qnav { display: flex; flex-wrap: wrap; gap: 5px; margin: 10px 0; }
.qnav button { width: 34px; height: 34px; border-radius: 8px; border: 1.5px solid var(--line); background: #fff; font: inherit; font-size: .85rem; cursor: pointer; }
.qnav button.ans { background: #e9efed; }
.qnav button.cur { border-color: var(--ink); font-weight: 700; }
.timer { font-variant-numeric: tabular-nums; font-weight: 700; }

.score { font-size: 3rem; font-weight: 800; line-height: 1; }
.stat { text-align: center; }
.stat b { display: block; font-size: 1.5rem; }

table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.scroll { overflow-x: auto; }

#toast { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%) translateY(20px); opacity: 0; visibility: hidden; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; transition: transform .25s ease, opacity .25s ease, visibility .25s; z-index: 20; max-width: 90vw; pointer-events: none; }
#toast.show { transform: translateX(-50%) translateY(0); opacity: 1; visibility: visible; }

.empty { text-align: center; padding: 28px 18px; }
.cert { background: #fff; border: 10px double var(--ink); padding: 40px 26px; text-align: center; border-radius: 4px; }
.cert h1 { font-size: 2rem; }
.cert .who { font-size: 1.8rem; font-weight: 700; margin: 10px 0; border-bottom: 2px solid var(--accent); display: inline-block; padding: 0 12px 4px; }

@media (max-width: 560px) {
  h1 { font-size: 1.45rem; }
  .hero h1 { font-size: 1.55rem; }
  #nav a, #nav button { padding: 6px 5px; font-size: .84rem; }
  .hide-sm { display: none; }
  .top { padding: 10px 12px; }
  .card { padding: 15px; }
}
@media print {
  .top, .foot, #banner, .noprint { display: none !important; }
  body { background: #fff; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

.btn.google { background: #fff; color: #1f1f1f; box-shadow: inset 0 0 0 1.5px var(--line); gap: 10px; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .85rem; margin: 14px 0; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
