:root {
  --ink: #2b2118;
  --muted: #7a6a58;
  --bg: #faf6ef;
  --card: #ffffff;
  --accent: #b3541e;       /* warm terracotta */
  --accent-soft: #f7e8dd;
  --good: #2e7d4f;
  --good-soft: #e3f2e8;
  --bad: #b3372e;
  --bad-soft: #fbe9e7;
  --line: #e7dccb;
  --radius: 14px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
}
h1, h2, h3 { font-family: Georgia, "Times New Roman", serif; line-height: 1.25; }
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 18px; background: var(--card); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.brand { font-family: Georgia, serif; font-weight: bold; font-size: 19px; color: var(--accent); }
.badge { background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 3px 10px; font-size: 13px; font-weight: 600; margin-right: 8px; }
main { max-width: 760px; margin: 0 auto; padding: 18px 14px 40px; }
.footer { max-width: 760px; margin: 0 auto; padding: 0 14px 28px; text-align: center; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; margin-bottom: 14px;
}
.login-card { max-width: 460px; margin: 30px auto; }
label { display: block; font-weight: 600; margin: 14px 0 6px; }
input[type="password"], input[type="text"] {
  width: 100%; font-size: 17px; padding: 13px 14px; border: 1.5px solid var(--line);
  border-radius: 10px; background: #fff; color: var(--ink);
}
.btn {
  font-size: 16px; padding: 11px 18px; border-radius: 10px; border: 1.5px solid var(--line);
  background: var(--card); color: var(--ink); cursor: pointer; min-height: 48px;
}
.btn:active { transform: scale(0.99); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--accent); min-height: 40px; padding: 6px 8px; }
.btn-big { width: 100%; margin-top: 16px; font-size: 17px; min-height: 54px; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.muted { color: var(--muted); }
.small { font-size: 13.5px; }
.error { color: var(--bad); font-weight: 600; }
.next-up { border-left: 5px solid var(--accent); }
.week-row {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 10px; cursor: pointer; width: 100%; text-align: left; font-size: 16px;
}
.week-row .wk-title { font-weight: 600; }
.pips { display: flex; gap: 5px; flex-shrink: 0; }
.pip { width: 13px; height: 13px; border-radius: 50%; border: 2px solid var(--line); background: #fff; }
.pip.done { background: var(--good); border-color: var(--good); }
.pip.doing { background: var(--accent-soft); border-color: var(--accent); }
.part-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.part-card h3 { margin: 0 0 4px; }
.status-tag { font-size: 13px; font-weight: 700; border-radius: 999px; padding: 3px 10px; white-space: nowrap; }
.status-tag.complete { background: var(--good-soft); color: var(--good); }
.status-tag.in_progress { background: var(--accent-soft); color: var(--accent); }
.status-tag.not_started { background: #f1ece2; color: var(--muted); }
.status-tag.locked { background: #f1ece2; color: var(--muted); }
.quiz-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.quiz-meta { font-weight: 600; }
.timer { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 700; background: var(--accent-soft); color: var(--accent); padding: 5px 12px; border-radius: 999px; }
.timer.low { background: var(--bad-soft); color: var(--bad); }
.progress { height: 9px; background: #eee4d3; border-radius: 99px; margin: 12px 0; overflow: hidden; }
.progress-bar { height: 100%; background: var(--accent); width: 0%; transition: width 0.25s; }
.block-banner { background: var(--accent-soft); border-radius: 10px; padding: 10px 14px; margin-bottom: 12px; font-weight: 600; }
.passage {
  background: #fffdf8; border: 1px solid var(--line); border-left: 4px solid var(--accent);
  border-radius: 10px; padding: 14px 16px; margin-bottom: 14px; white-space: pre-line;
}
.passage h4 { margin: 0 0 8px; font-family: Georgia, serif; }
.prompt { font-size: 18px; font-weight: 600; white-space: pre-line; margin: 6px 0 14px; }
.choices { display: grid; gap: 10px; }
.choice {
  text-align: left; font-size: 17px; padding: 14px 16px; min-height: 54px; border-radius: 12px;
  border: 1.5px solid var(--line); background: var(--card); cursor: pointer; width: 100%;
}
.choice.selected { border-color: var(--accent); background: var(--accent-soft); }
.choice.correct { border-color: var(--good); background: var(--good-soft); }
.choice.wrong { border-color: var(--bad); background: var(--bad-soft); }
.choice[disabled] { cursor: default; opacity: 0.92; }
.explain {
  margin-top: 14px; border-radius: 10px; padding: 13px 15px; white-space: pre-line;
}
.explain.good { background: var(--good-soft); }
.explain.bad { background: var(--bad-soft); }
.hintbox { margin-top: 12px; background: #fdf3d8; border: 1px solid #ecd9a0; border-radius: 10px; padding: 12px 14px; }
.quiz-nav { display: flex; justify-content: space-between; margin-top: 18px; gap: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: 0.04em; }
.bar-wrap { background: #eee4d3; border-radius: 99px; height: 10px; position: relative; min-width: 90px; }
.bar-now { background: var(--accent); height: 100%; border-radius: 99px; }
.bar-base { position: absolute; top: -3px; bottom: -3px; width: 2.5px; background: var(--ink); opacity: 0.55; }
.review-q { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-bottom: 12px; background: var(--card); }
.review-q .prompt { font-size: 16.5px; }
.tag { font-size: 12.5px; font-weight: 700; border-radius: 999px; padding: 2px 9px; }
.tag.good { background: var(--good-soft); color: var(--good); }
.tag.bad { background: var(--bad-soft); color: var(--bad); }
.tag.warn { background: #fdf3d8; color: #8a6d1a; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 14px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.stat .big { font-size: 26px; font-weight: 700; font-family: Georgia, serif; }
details.week-acc { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 10px; padding: 10px 14px; }
details.week-acc summary { cursor: pointer; font-weight: 600; padding: 4px 0; }
.lesson-text { white-space: pre-line; }
.example { border-top: 1px dashed var(--line); margin-top: 16px; padding-top: 14px; }
