:root {
  --bg: #faf8f4;
  --surface: #ffffff;
  --ink: #1d1b18;
  --muted: #6f6a62;
  --line: #e7e2d8;
  --accent: #e8590c;
  --accent-soft: #fff0e6;
  --good: #2f9e44;
  --heat-0: #ece8df;
  --heat-1: #ffd8bf;
  --heat-2: #ffa86b;
  --heat-3: #f76707;
  --heat-4: #c2410c;
  --radius: 14px;
  --serif: "Newsreader", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15140f;
    --surface: #1e1c17;
    --ink: #ece7dd;
    --muted: #a39d92;
    --line: #34312a;
    --accent: #ff7a2e;
    --accent-soft: #2d1d12;
    --heat-0: #2a2721;
    --heat-1: #5c3214;
    --heat-2: #9a4a12;
    --heat-3: #e2600d;
    --heat-4: #ff9447;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); line-height: 1.6; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration-color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent); }
.wrap { max-width: 980px; margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 700px; }

/* header */
.site-head { border-bottom: 1px solid var(--line); background: var(--surface); }
.site-head .wrap { display: flex; align-items: center; gap: 24px; height: 60px; }
.brand { font-family: var(--serif); font-size: 1.35rem; font-weight: 600; text-decoration: none; }
.brand span { color: var(--accent); }
.site-head nav { display: flex; gap: 18px; margin-left: auto; font-size: .92rem; }
.site-head nav a { text-decoration: none; color: var(--muted); }
.site-head nav a:hover, .site-head nav a.on { color: var(--ink); }
.streak-pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: .85rem; font-family: var(--mono); }
.streak-pill.cold { background: var(--line); color: var(--muted); }
main { padding: 36px 0 80px; }
footer { border-top: 1px solid var(--line); color: var(--muted); font-size: .85rem; padding: 24px 0; }

/* typography */
h1, h2, h3 { font-family: var(--serif); line-height: 1.2; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 2.3rem; margin: 0 0 .4em; }
h2 { font-size: 1.5rem; margin: 1.8em 0 .6em; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .72rem; font-weight: 600; color: var(--muted); }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }

/* cards & grids */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.card + .card { margin-top: 16px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 760px) { .g2, .g3 { grid-template-columns: 1fr; } .g4 { grid-template-columns: repeat(2, 1fr); } h1 { font-size: 1.8rem; } }
.stat .v { font-family: var(--mono); font-size: 1.6rem; font-weight: 600; line-height: 1.1; }
.stat .l { font-size: .78rem; color: var(--muted); }

/* assignment card */
.assign { border-left: 4px solid var(--accent); }
.assign h3 { font-size: 1.4rem; margin: 6px 0 8px; }
.assign ol { margin: 10px 0 0; padding-left: 20px; }
.assign li { margin: 4px 0; }
.badge-status { display: inline-block; font-size: .72rem; font-weight: 600; padding: 2px 8px; border-radius: 6px; background: var(--line); color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.badge-status.done { background: #d3f9d8; color: #2b8a3e; }
.badge-status.open { background: var(--accent-soft); color: var(--accent); }
.badge-status.missed { background: #ffe3e3; color: #c92a2a; }
.tag { display: inline-block; font-size: .78rem; color: var(--muted); margin-right: 8px; }
.tag::before { content: "#"; color: var(--accent); }

/* buttons & forms */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); padding: 8px 16px; border-radius: 10px; font: 600 .9rem var(--sans); cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--ink); color: var(--ink); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.sm { padding: 4px 10px; font-size: .8rem; }
input, textarea, select { width: 100%; font: inherit; color: inherit; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; }
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
label { display: block; font-size: .82rem; font-weight: 600; margin: 12px 0 4px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.alert { padding: 12px 16px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); font-weight: 500; margin-bottom: 16px; }

/* post list */
.post-list { list-style: none; padding: 0; margin: 0; }
.post-list li { padding: 18px 0; border-bottom: 1px solid var(--line); }
.post-list a.t { font-family: var(--serif); font-size: 1.3rem; font-weight: 600; text-decoration: none; }
.post-list .meta { font-size: .82rem; color: var(--muted); margin-top: 4px; display: flex; gap: 14px; flex-wrap: wrap; font-family: var(--mono); }

/* article */
.article-meta { display: flex; gap: 18px; flex-wrap: wrap; font-family: var(--mono); font-size: .82rem; color: var(--muted); padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin: 18px 0 30px; }
.prose { font-family: var(--serif); font-size: 1.2rem; line-height: 1.75; }
.prose h2 { font-size: 1.6rem; }
.prose img { max-width: 100%; border-radius: 10px; }
.prose blockquote { margin: 1.4em 0; padding-left: 18px; border-left: 3px solid var(--accent); color: var(--muted); font-style: italic; }
.prose pre { background: var(--surface); border: 1px solid var(--line); padding: 14px; border-radius: 10px; overflow-x: auto; font-size: .85rem; }
.prose code { font-family: var(--mono); font-size: .85em; }
.refs { font-size: .9rem; }
.refs li { margin: 6px 0; word-break: break-word; }
.kudos-btn { font-size: 1rem; }
.kudos-btn[disabled] { opacity: .7; cursor: default; }

/* gamification */
.level-bar { height: 10px; border-radius: 99px; background: var(--line); overflow: hidden; margin: 10px 0 6px; }
.level-bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), #fab005); border-radius: 99px; }
.week-dots { display: flex; gap: 6px; margin-top: 10px; }
.week-dots span { flex: 1; text-align: center; font-size: .7rem; color: var(--muted); }
.week-dots span i { display: block; height: 28px; border-radius: 8px; background: var(--heat-0); margin-bottom: 4px; }
.week-dots span.on i { background: var(--accent); }
.week-dots span.today i { outline: 2px dashed var(--accent); outline-offset: 2px; }
.heatmap { overflow-x: auto; }
.heatmap svg { display: block; }
.heat-legend { display: flex; gap: 4px; align-items: center; font-size: .72rem; color: var(--muted); margin-top: 8px; justify-content: flex-end; }
.heat-legend i { width: 11px; height: 11px; border-radius: 2px; display: inline-block; }
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.badge { text-align: center; padding: 16px 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.badge .i { font-size: 2rem; }
.badge .n { font-weight: 600; font-size: .9rem; margin-top: 6px; }
.badge .d { font-size: .75rem; color: var(--muted); }
.badge.locked { opacity: .35; filter: grayscale(1); }
.celebrate { text-align: center; padding: 40px 20px; }
.celebrate .xp { font-family: var(--mono); font-size: 3.5rem; font-weight: 700; color: var(--accent); }
.breakdown { max-width: 360px; margin: 16px auto; text-align: left; }
.breakdown div { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: .92rem; }

/* editor */
.editor { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 900px) { .editor { grid-template-columns: 1fr; } }
.editor aside { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow-y: auto; }
.editor .title-input { font-family: var(--serif); font-size: 2rem; font-weight: 600; border: none; background: transparent; padding: 4px 0; }
.editor .title-input:focus { outline: none; }
.editor .body-input { font-family: var(--serif); font-size: 1.15rem; line-height: 1.75; min-height: 60vh; resize: vertical; border: none; background: transparent; padding: 8px 0; }
.editor .body-input:focus { outline: none; }
.editor-bar { position: sticky; bottom: 0; background: var(--surface); border-top: 1px solid var(--line); padding: 10px 20px; display: flex; gap: 18px; align-items: center; flex-wrap: wrap; font-family: var(--mono); font-size: .85rem; z-index: 5; }
.progress-mini { width: 120px; height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; display: inline-block; vertical-align: middle; }
.progress-mini > i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .2s; }
.source-item { display: flex; gap: 8px; align-items: flex-start; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: .85rem; }
.source-item a { word-break: break-all; }
.source-item button { margin-left: auto; }
.feedback { border-left: 3px solid #7950f2; }
.feedback .prose { font-size: 1rem; font-family: var(--sans); }
code.block { display: block; white-space: pre-wrap; word-break: break-all; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 12px; font-size: .8rem; }
