:root {
  --ink: #2b2620;
  --ink-soft: #5c5548;
  --paper: #f7f3ec;
  --paper-2: #efe8dc;
  --line: #ddd3c2;
  --accent: #7a5230;      /* wood / rosewood */
  --accent-2: #b5893f;    /* brass tuning peg */
  --jade: #4f7361;        /* subtle green for "done" */
  --max: 900px;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(43, 38, 32, 0.06), 0 4px 16px rgba(43, 38, 32, 0.06);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Songti SC", serif;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.6;
  font-size: 18px;
}

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

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

/* header */
.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--paper-2);
  position: sticky;
  top: 0;
  z-index: 10;
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand-mark {
  display: inline-grid; place-items: center;
  width: 34px; height: 34px; border-radius: 8px;
  background: var(--accent); color: #fff; font-size: 20px;
  font-family: "Songti SC", "STSong", serif;
}
.brand-text { font-size: 19px; letter-spacing: 0.2px; }
.site-nav { display: flex; gap: 18px; font-size: 16px; }
.site-nav a { color: var(--ink-soft); }
.site-nav a:hover { color: var(--accent); text-decoration: none; }

/* main */
main.wrap { padding-top: 32px; padding-bottom: 64px; min-height: 60vh; }

h1 { font-size: 2rem; line-height: 1.2; margin: 0 0 0.4em; }
h2 { font-size: 1.4rem; margin: 1.6em 0 0.5em; }
h3 { font-size: 1.15rem; margin: 1.4em 0 0.4em; }
p { margin: 0 0 1em; }
.lead { font-size: 1.15rem; color: var(--ink-soft); }
.muted { color: var(--ink-soft); font-size: 0.9em; }

/* hero */
.hero { text-align: center; padding: 24px 0 8px; }
.hero h1 { font-size: 2.6rem; }
.hero .cn { font-family: "Songti SC", "STSong", serif; color: var(--accent); }
.hero p { max-width: 640px; margin-left: auto; margin-right: auto; }
.cta-row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 20px; }
.btn {
  display: inline-block; padding: 11px 22px; border-radius: 999px;
  background: var(--accent); color: #fff; font-size: 16px; border: 0; cursor: pointer;
}
.btn:hover { background: #5f3f24; text-decoration: none; }
.btn.ghost { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.btn.ghost:hover { background: rgba(122,82,48,0.08); }

/* progress summary bar */
.progress-summary {
  display: flex; align-items: center; gap: 14px;
  background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 18px; margin: 24px 0;
}
.progress-bar { flex: 1; height: 10px; background: var(--line); border-radius: 999px; overflow: hidden; }
.progress-bar > span { display: block; height: 100%; width: 0; background: var(--jade); transition: width 0.3s ease; }
.progress-count { font-variant-numeric: tabular-nums; font-size: 0.95rem; color: var(--ink-soft); white-space: nowrap; }

/* section groups + lesson cards */
.section-group { margin: 40px 0; }
.section-group > h2 { border-bottom: 2px solid var(--line); padding-bottom: 6px; }
.section-blurb { color: var(--ink-soft); margin-top: 0; }

.lesson-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; margin-top: 18px; }
.lesson-card {
  display: block; position: relative;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 16px 16px 18px; box-shadow: var(--shadow); color: var(--ink);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.lesson-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(43,38,32,0.12); text-decoration: none; }
.lesson-card .num { font-size: 0.8rem; color: var(--accent-2); font-weight: 600; letter-spacing: 0.06em; }
.lesson-card .ct { font-size: 1.02rem; font-weight: 600; margin: 4px 0 6px; line-height: 1.3; }
.lesson-card .cs { font-size: 0.88rem; color: var(--ink-soft); margin: 0; }
.lesson-card .status-dot {
  position: absolute; top: 14px; right: 14px; width: 10px; height: 10px; border-radius: 50%;
  background: var(--line); border: 1px solid rgba(0,0,0,0.06);
}
.lesson-card[data-status="in-progress"] .status-dot { background: var(--accent-2); }
.lesson-card[data-status="done"] .status-dot { background: var(--jade); }
.lesson-card[data-status="done"] { background: #f2f6f2; }

/* lesson page */
.video-embed { position: relative; width: 100%; aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden; background: #000; margin: 8px 0 24px; box-shadow: var(--shadow); }
.video-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.lesson-meta { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 20px; }
.chip { font-size: 0.82rem; padding: 3px 11px; border-radius: 999px; background: var(--paper-2); border: 1px solid var(--line); color: var(--ink-soft); }
.chip.cn { font-family: "Songti SC", "STSong", serif; }

.prose { max-width: 68ch; }
.prose h2 { border-bottom: 1px solid var(--line); padding-bottom: 4px; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose blockquote { border-left: 3px solid var(--accent-2); margin: 1em 0; padding: 4px 0 4px 16px; color: var(--ink-soft); font-style: italic; }

.lesson-nav { display: flex; justify-content: space-between; gap: 12px; margin: 40px 0 0; padding-top: 20px; border-top: 1px solid var(--line); }
.lesson-nav a { max-width: 45%; }

/* controls (status + notes) */
.lesson-controls { background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin: 24px 0; }
.status-btns { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.status-btns button {
  font: inherit; font-size: 0.9rem; padding: 7px 14px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: #fff; color: var(--ink-soft);
}
.status-btns button[aria-pressed="true"] { background: var(--accent); color: #fff; border-color: var(--accent); }
.notes-label { display: block; font-size: 0.9rem; color: var(--ink-soft); margin: 12px 0 6px; }
textarea.notes {
  width: 100%; min-height: 110px; resize: vertical; font: inherit; font-size: 0.95rem;
  padding: 12px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--ink);
}
.save-hint { font-size: 0.8rem; color: var(--ink-soft); margin-top: 6px; min-height: 1em; }

/* jianzipu glossary */
.glyph-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin-top: 20px; }
.glyph-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; text-align: center; box-shadow: var(--shadow); }
.glyph-card .g { font-size: 2.2rem; font-family: "Songti SC", "STSong", serif; color: var(--accent); line-height: 1; }
.glyph-card .gn { font-weight: 600; margin: 8px 0 2px; }
.glyph-card .gp { font-size: 0.85rem; color: var(--accent-2); }
.glyph-card .gm { font-size: 0.85rem; color: var(--ink-soft); margin-top: 4px; }

/* footer */
.site-footer { border-top: 1px solid var(--line); background: var(--paper-2); padding: 28px 0; margin-top: 40px; }
.site-footer p { font-size: 0.88rem; color: var(--ink-soft); margin: 0 0 6px; }

/* responsive */
@media (max-width: 560px) {
  body { font-size: 17px; }
  .brand-text { display: none; }
  .hero h1 { font-size: 2rem; }
  .site-nav { gap: 12px; font-size: 15px; }
}
