:root {
  --bg: #f2efe8;
  --paper: #fffaf2;
  --ink: #1c1b18;
  --accent: #b45309;
  --accent-2: #0f766e;
  --muted: #6b675f;
  --border: #e6dfd2;
  --shadow: rgba(0, 0, 0, 0.08);
}
* { box-sizing: border-box; }
html {
  min-height: 100%;
}
body {
  margin: 0;
  background: radial-gradient(1200px 600px at 20% -10%, #fff7e7 0%, transparent 60%),
    radial-gradient(900px 500px at 110% 0%, #e6f1ef 0%, transparent 55%),
    var(--bg);
  color: var(--ink);
  font-family: "Alegreya", "Iowan Old Style", "Palatino", serif;
  line-height: 1.6;
}
main {
  max-width: 980px;
  margin: 0 auto;
  padding: 36px 20px 80px;
}
.page {
  max-width: 980px;
  margin: 0 auto;
  padding: 36px 20px 96px;
}
header {
  margin-bottom: 26px;
  padding: 18px 18px 16px;
  background: linear-gradient(120deg, #fff7e7 0%, #ffffff 40%, #f0f7f6 100%);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 10px 30px -20px var(--shadow);
}
header h1 {
  margin: 0 0 4px;
  font-size: 2.35rem;
  line-height: 1.1;
  letter-spacing: 0.2px;
}
header .meta { color: var(--muted); font-size: 1rem; }
h1 {
  margin-top: 0;
  margin-bottom: 8px;
  font-size: 2.2rem;
}
p { color: var(--muted); }
ul { padding-left: 20px; }
li { margin: 8px 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.book-section {
  margin-top: 22px;
  padding: 14px 16px 4px;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 10px 24px -22px var(--shadow);
}
.book-section:first-of-type { margin-top: 14px; }
.book-section h2 {
  margin: 0 0 6px;
  font-size: 1.35rem;
  color: var(--accent-2);
}
.book-section ul {
  margin: 0;
  padding-left: 20px;
}
.card {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  box-shadow: 0 10px 24px -22px var(--shadow);
}
.card li a {
    display: block;
}
.back { display: inline-block; margin-bottom: 10px; }
.toc {
  background: var(--paper);
  border: 1px solid var(--border);
  padding: 16px 18px;
  border-radius: 12px;
  margin: 20px 0 30px;
  box-shadow: 0 10px 24px -22px var(--shadow);
}
.toc-title { font-weight: 700; margin-bottom: 8px; color: var(--accent-2); }
.toc ul { margin: 0; padding-left: 18px; }
.toc li { margin: 4px 0; }
.toc li.toc-sub { margin-left: 14px; font-size: 0.95rem; }
img {
  max-width: 100%;
  height: auto;
  max-height: 75vh;
  object-fit: contain;
}

p img:not([class]) {
  display: block;
  margin: 0 auto;
}
pre { background: #161922; color: #e7e5e4; padding: 12px 14px; border-radius: 10px; overflow: auto; }
code { font-family: "IBM Plex Mono", "SFMono-Regular", "Menlo", "Consolas", monospace; font-size: 0.95em; }
blockquote {
  margin: 16px 0;
  padding: 10px 16px;
  border-left: 4px solid var(--accent);
  background: #f3f0ea;
}
input[type="checkbox"] {
    appearance: none;
    width: 20px;
    height: 20px;
    border: 1px solid var(--ink);
    border-radius: 3px;
    display: inline-block;
    vertical-align: sub;
    margin: 0 5px 0 0;
    background: #fff;
}
input[type="checkbox"]:checked {
  background: var(--accent-2);
  box-shadow: inset 0 0 0 2px #fff;
  border-color: var(--accent-2);
}
.contains-task-list {
    padding-left: 0;
}
.task-list-item { list-style: none; }
.task-list-item input { pointer-events: none; }
.task-list-item { cursor: pointer; }
.task-links {
  margin-top: 6px;
  margin-left: 25px;
  font-size: 0.82rem;
  color: var(--muted);
}
.task-links-label {
  margin-right: 6px;
  font-weight: 700;
}
.task-link-pill {
  display: inline-block;
  margin: 2px 6px 0 0;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 0.78rem;
  line-height: 1.2;
  color: var(--accent);
}
.task-link-pill:hover {
  text-decoration: none;
  border-color: var(--accent);
}
.task-subcounter {
  display: inline-block;
  margin-left: 12px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.95rem;
  color: var(--muted);
  border: 1px solid var(--border);
  white-space: nowrap;
}
.task-counter {
    display: inline-block;
    margin-right: 12px;
    font-size: 18px;
}
.task-counter[hidden] { display: none; }
.task-subcounter[hidden] { display: none; }
.task-reset {
  padding: 2px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--paper);
  color: var(--ink);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
}
.task-reset:hover { border-color: var(--accent); }
.task-reset[hidden],
.task-reset[hidden] { display: none; }
.next-checklist {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: flex;
  justify-content: center;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(180deg, rgba(242, 239, 232, 0) 0%, rgba(242, 239, 232, 0.94) 35%, rgba(242, 239, 232, 1) 100%);
}
.next-checklist[hidden] { display: none; }
.next-checklist-link {
  display: inline-block;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid var(--accent);
  background: var(--paper);
  color: var(--accent);
  font-weight: 700;
  box-shadow: 0 8px 24px -20px var(--shadow);
}
.next-checklist-link:hover {
  text-decoration: none;
  border-color: var(--accent-2);
  color: var(--accent-2);
}
article h2 {
  margin-top: 28px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
article h3 { margin-top: 22px; color: var(--accent-2); }
@media (max-width: 720px) {
  .page { padding: 24px 16px 64px; }
  main { padding: 24px 16px 64px; }
  header h1 { font-size: 2rem; }
  h1 { font-size: 1.9rem; }
}
@media print {
  body { background: #fff; }
  .page { max-width: 100%; padding: 0; }
  .toc { border: 1px solid #ccc; box-shadow: none; }
}
@page { size: A4; margin: 20mm; }
