:root { color-scheme: dark; --bg: #161514; --fg: #ebe8e3; --muted: #9a958c; --line: #2e2c29; --accent: #fb923c; --card: #1f1e1c; --hi: #2a211b; --ok: #4ade80; }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; }
header { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
  border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--bg); z-index: 2; }
.brand { font-weight: 700; color: var(--fg); text-decoration: none; font-size: 18px; }
.who { color: var(--muted); font-size: 14px; display: flex; gap: 8px; align-items: center; }
button { font: inherit; font-size: 14px; border: 1px solid var(--line); background: var(--card); color: var(--fg); border-radius: 8px; padding: 6px 10px; cursor: pointer; }
button.primary { background: var(--accent); color: #fff; border: 0; }
main { max-width: 760px; margin: 0 auto; padding: 16px 16px 48px; }
a { color: var(--accent); }
h1 { font-size: 24px; line-height: 1.25; margin: 4px 0 12px; }
h2 { font-size: 19px; margin: 24px 0 8px; }
.docs { list-style: none; padding: 0; } .docs li { margin: 0 0 10px; }
.docs a { display: block; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); text-decoration: none; font-size: 17px; font-weight: 600; }
.files a { font-weight: 400; font-size: 15px; }
.badge { background: var(--accent); color: #fff; border-radius: 10px; padding: 0 7px; font-size: 13px; }
.progress { position: sticky; top: 49px; z-index: 1; background: var(--bg); padding: 6px 0; font-weight: 600; color: var(--ok); border-bottom: 1px solid var(--line); margin-bottom: 8px; }

/* A block: tick boxes, the text, the comment button; its thread opens full width underneath. */
.blk { display: grid; grid-template-columns: auto 1fr auto; column-gap: 8px; align-items: start; margin: 0 0 10px; border-radius: 8px; }
.blk.k-li { margin: 0 0 2px; padding: 2px 0; }
.blk .body { grid-column: 2; min-width: 0; overflow-wrap: anywhere; }
.blk:not(.chk) .body { grid-column: 1 / 3; }
.blk .body > :first-child { margin-top: 0; } .blk .body > :last-child { margin-bottom: 0; }
.blk.k-li ul, .blk.k-li ol { margin: 0; padding-left: 20px; }
.blk.chk .body > ul { list-style: none; padding-left: 0; }
.blk.chk .body ul ul { list-style: disc; color: var(--muted); font-size: 14px; }
.blk.open { background: var(--hi); }
.blk.packed .body > ul > li > p:first-child, .blk.packed .body > ul > li { text-decoration: line-through; text-decoration-color: var(--muted); color: var(--muted); }
.boxes { grid-column: 1; display: flex; gap: 4px; padding-top: 1px; }
.box { display: inline-flex; align-items: center; gap: 2px; font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 2px 4px; background: var(--card); }
.box input { width: 20px; height: 20px; margin: 0; accent-color: var(--ok); }
.box span:empty { display: none; }
.cbtn { grid-column: 3; min-width: 40px; padding: 2px 6px; color: var(--muted); opacity: .45; font-size: 13px; }
.cbtn.has, .blk.open .cbtn { opacity: 1; }
.cbtn.has { color: var(--accent); border-color: var(--accent); }
@media (hover: hover) { .blk:hover .cbtn { opacity: 1; } }
.thread { grid-column: 1 / -1; margin: 6px 0 4px; padding: 8px; border-left: 3px solid var(--accent); }
.c { margin-bottom: 10px; } .c.done { opacity: .55; }
.meta { font-size: 12px; color: var(--muted); }
.txt { white-space: pre-wrap; }
.acts { display: flex; gap: 6px; margin-top: 4px; } .acts button { font-size: 12px; padding: 3px 8px; }
.add { display: flex; flex-direction: column; gap: 6px; }
.c .add { margin-top: 4px; }
textarea { font: inherit; font-size: 16px; width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 8px; background: var(--card); color: var(--fg); }
.orphan blockquote { margin: 0; padding-left: 10px; border-left: 3px solid var(--line); color: var(--muted); }
.login { max-width: 360px; margin: 12vh auto; display: flex; flex-direction: column; gap: 12px; }
.login label { display: flex; flex-direction: column; gap: 6px; }
.login input { font: inherit; font-size: 16px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--fg); }
.login button { padding: 12px; font-size: 16px; background: var(--accent); color: #fff; border: 0; }
.err { color: #dc2626; }

/* Hierarchy: breadcrumbs, the home router, tabs, folded details, links back up. */
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.crumbs a { color: var(--muted); }
.today { display: block; margin: 4px 0 8px; padding: 14px 16px; border-radius: 12px; background: var(--accent); color: #1a0f08; font-weight: 700; text-decoration: none; font-size: 17px; }
.docs .t { display: block; }
.docs .s { display: block; font-size: 13px; font-weight: 400; color: var(--muted); margin-top: 2px; }
.tabbar { position: sticky; top: 49px; z-index: 1; display: flex; gap: 6px; overflow-x: auto; padding: 8px 0; margin: 4px 0 10px;
  background: var(--bg); border-bottom: 1px solid var(--line); scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.tabbar::-webkit-scrollbar { display: none; }
.tabbar button { flex: none; border-radius: 16px; padding: 6px 12px; white-space: nowrap; color: var(--muted); }
.tabbar button.on { background: var(--accent); border-color: var(--accent); color: #1a0f08; font-weight: 600; }
.progress + article .tabbar, .progress ~ article .tabbar { top: 84px; }
.tabfoot { display: flex; justify-content: space-between; gap: 8px; margin: 18px 0 6px; padding-top: 10px; border-top: 1px solid var(--line); }
.tabfoot button { font-size: 13px; color: var(--muted); max-width: 48%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
li.folds > ul, li.folds > ol { display: none; }
li.folds.open > ul, li.folds.open > ol { display: block; }
.more { font-size: 12px; padding: 1px 8px; margin: 2px 0 2px 6px; border-radius: 10px; color: var(--accent); border-color: var(--line); vertical-align: 1px; }
li.folds.open > .more { color: var(--muted); }
.place { white-space: normal; font-size: 13px; }
.place a { color: var(--muted); }
button.zh { font-size: 15px; padding: 1px 8px; border-color: var(--accent); color: var(--fg); }
.zhcard { position: fixed; inset: 0; z-index: 10; background: #000; color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; }
.zhcard .big { font-size: min(18vw, 120px); line-height: 1.2; text-align: center; word-break: break-all; }
.zhcard .hint { margin-top: 24px; color: #888; font-size: 14px; }
.backlinks { margin-top: 24px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
h3 { font-size: 17px; margin: 18px 0 6px; }
blockquote { margin: 0; padding-left: 10px; border-left: 3px solid var(--accent); color: var(--muted); }
table { border-collapse: collapse; font-size: 14px; display: block; overflow-x: auto; }
td, th { border: 1px solid var(--line); padding: 4px 8px; text-align: left; vertical-align: top; }
.net { font-size: 12px; color: var(--muted); }
.net.off { color: #fff; background: #b45309; border-radius: 10px; padding: 1px 8px; }
.c.pending .meta { color: var(--accent); }
code { background: var(--line); padding: 0 4px; border-radius: 4px; font-size: .9em; }
