:root {
  --bg: #f6f7f9;
  --fg: #1d2530;
  --muted: #5d6b7d;
  --accent: #1f6feb;
  --done: #1a7f52;
  --border: #dde3ea;
  --card: #ffffff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.6 -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.wrap { max-width: 900px; margin: 0 auto; padding: 0 1rem; }

.site-header {
  background: #16202c;
  color: #fff;
  padding: .8rem 0;
}
.site-header .wrap { display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; }
.site-header a { color: #fff; text-decoration: none; }
.site-header .brand { font-weight: 700; font-size: 1.2rem; }
.site-header nav a { margin-right: 1rem; opacity: .85; }
.site-header nav a:hover { opacity: 1; text-decoration: underline; }

main.wrap { padding-top: 1.5rem; padding-bottom: 3rem; }

h1 { font-size: 1.8rem; margin: .2rem 0 .6rem; }
h2 { font-size: 1.25rem; }
a { color: var(--accent); }

.lead { color: var(--muted); }
.hint { color: var(--muted); font-size: .9rem; }
.empty { color: var(--muted); font-style: italic; }

.breadcrumbs { font-size: .9rem; color: var(--muted); margin-bottom: .8rem; }

.card-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 1rem; }
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.2rem;
}
.card h2 { margin: 0 0 .3rem; }
.card h2 a { text-decoration: none; }
.desc { margin: .2rem 0 .6rem; color: var(--muted); }

.progress-text { margin: .3rem 0; font-weight: 600; }
.progress-bar {
  background: #e3e8ee;
  border-radius: 999px;
  height: 10px;
  overflow: hidden;
  margin-bottom: .6rem;
}
.progress-bar span { display: block; height: 100%; background: var(--done); }

.btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 6px;
  padding: .5rem .9rem;
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}
.btn-done { background: var(--done); }
.btn-undo { background: #8a6d1f; }

.filters { margin: 1.4rem 0; }
.tag-filter { list-style: none; display: flex; flex-wrap: wrap; gap: .4rem; padding: 0; margin: .5rem 0; }
.tag {
  display: inline-block;
  background: #eaf0f7;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .15rem .65rem;
  font-size: .85rem;
  color: #22406b;
  text-decoration: none;
}
.tag-active { background: var(--accent); color: #fff; border-color: var(--accent); }
.tag-small { font-size: .78rem; }
.tag-count { opacity: .7; font-size: .75rem; }
.filter-info { font-size: .9rem; color: var(--muted); }

.chapter-title {
  margin-top: 1.6rem;
  border-bottom: 2px solid var(--border);
  padding-bottom: .3rem;
}
.lesson-list { list-style: none; padding: 0; margin: .5rem 0; }
.lesson-row {
  display: flex;
  gap: .7rem;
  align-items: flex-start;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .6rem .8rem;
  margin-bottom: .45rem;
}
.lesson-row.done { border-left: 4px solid var(--done); }
.lesson-order { color: var(--muted); min-width: 2.2rem; text-align: right; }
.lesson-main { flex: 1; display: flex; flex-direction: column; gap: .2rem; }
.lesson-title { font-weight: 600; text-decoration: none; }
.lesson-summary { color: var(--muted); font-size: .9rem; }
.lesson-tags { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; }
.lesson-meta { text-align: right; font-size: .85rem; color: var(--muted); min-width: 6rem; }
.lesson-meta .status { display: block; }
.lesson-row.done .status { color: var(--done); font-weight: 600; }

.lesson { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 1.2rem 1.5rem; }
.chapter-label { text-transform: uppercase; letter-spacing: .06em; font-size: .78rem; color: var(--muted); margin: 0; }
.lesson-meta-line { color: var(--muted); font-size: .9rem; }
.toggle-form { margin: 1rem 0; }
.lesson-content { margin-top: 1.4rem; }
.lesson-content h2 { margin-top: 1.6rem; }
.lesson-content pre {
  background: #16202c;
  color: #e8eef5;
  padding: .9rem 1rem;
  border-radius: 8px;
  overflow-x: auto;
}
.lesson-content code { font-family: "SFMono-Regular", Consolas, monospace; font-size: .9em; }
.lesson-content :not(pre) > code { background: #eaf0f7; padding: .1rem .3rem; border-radius: 4px; }
.lesson-content table { border-collapse: collapse; width: 100%; }
.lesson-content th, .lesson-content td { border: 1px solid var(--border); padding: .35rem .5rem; text-align: left; }
.lesson-content blockquote { border-left: 4px solid var(--border); margin: 1rem 0; padding: .2rem 1rem; color: var(--muted); }

.lesson-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: .92rem;
}
.nav-next { text-align: right; }

.site-footer { border-top: 1px solid var(--border); color: var(--muted); font-size: .85rem; }
