:root,
html[data-theme="night"] {
  --bg: #10151a;
  --panel: #182128;
  --soft: #222c36;
  --line: rgba(232, 220, 196, 0.1);
  --text: #ebe4d6;
  --muted: #95a0ab;
  --faint: #66717d;
  --accent: #6fbfa3;
  --warn: #d4a15a;
  --glow: rgba(111, 191, 163, 0.12);
  --glow2: rgba(212, 161, 90, 0.08);
  --font-ui: "Noto Sans SC", system-ui, sans-serif;
  --font-display: "Noto Serif SC", serif;
  --radius: 14px;
  --grid: transparent;
}
html[data-theme="paper"] {
  --bg: #efe6d4;
  --panel: #fffaf0;
  --soft: #f3ead8;
  --line: rgba(92, 64, 38, 0.16);
  --text: #2c2118;
  --muted: #7a6754;
  --faint: #9a8772;
  --accent: #8b3a2a;
  --warn: #b45309;
  --glow: rgba(180, 120, 60, 0.12);
  --glow2: rgba(139, 58, 42, 0.08);
  --font-ui: "Noto Serif SC", "Songti SC", serif;
  --font-display: "Noto Serif SC", serif;
}
html[data-theme="ink"] {
  --bg: #070b08;
  --panel: #0c1410;
  --soft: #122018;
  --line: rgba(80, 255, 160, 0.16);
  --text: #d7ffe8;
  --muted: #7fba96;
  --faint: #4d7a60;
  --accent: #3dff9a;
  --warn: #c8ff6a;
  --glow: rgba(61, 255, 154, 0.1);
  --glow2: rgba(200, 255, 106, 0.06);
  --font-ui: "JetBrains Mono", "Noto Sans SC", monospace;
  --font-display: "JetBrains Mono", "Noto Sans SC", monospace;
  --grid: rgba(61, 255, 154, 0.05);
  --radius: 4px;
}
html[data-theme="workshop"] {
  --bg: #e7eef6;
  --panel: #f7fbff;
  --soft: #dce7f3;
  --line: rgba(20, 70, 120, 0.18);
  --text: #14324d;
  --muted: #4b6d88;
  --faint: #7a93a8;
  --accent: #1d4e89;
  --warn: #c45c26;
  --glow: rgba(29, 78, 137, 0.1);
  --glow2: rgba(196, 92, 38, 0.08);
  --font-ui: "Noto Sans SC", system-ui, sans-serif;
  --font-display: "Noto Sans SC", system-ui, sans-serif;
  --radius: 2px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-ui);
  color: var(--text);
  background:
    linear-gradient(var(--grid) 1px, transparent 1px) 0 0 / 100% 28px,
    linear-gradient(90deg, var(--grid) 1px, transparent 1px) 0 0 / 28px 100%,
    radial-gradient(700px 380px at 10% -10%, var(--glow), transparent 55%),
    radial-gradient(560px 320px at 100% 0%, var(--glow2), transparent 50%),
    var(--bg);
}
html[data-theme="paper"] body {
  background:
    radial-gradient(800px 400px at 20% 0%, rgba(255, 255, 255, 0.35), transparent 50%),
    repeating-linear-gradient(0deg, transparent, transparent 27px, rgba(92, 64, 38, 0.04) 28px),
    var(--bg);
}
a { color: inherit; text-decoration: none; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 28px 20px 72px; }
header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 22px;
}
.header-tools { display: flex; flex-direction: row; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
.theme-wrap { position: relative; }
.theme-icon {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
  line-height: 1;
}
.theme-icon:hover { color: var(--accent); border-color: var(--accent); }
.theme-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 20;
  min-width: 120px;
  padding: 6px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}
.theme-menu .theme-btn { width: 100%; text-align: left; border-radius: 8px; }
.brand {
  font-family: var(--font-display);
  font-size: 40px;
  letter-spacing: 0.04em;
}
.brand span { color: var(--accent); }
.sub { color: var(--muted); margin: 8px 0 0; font-size: 13px; line-height: 1.6; }
nav { display: flex; flex-wrap: wrap; gap: 8px; }
nav button, .btn, input, select, textarea, .theme-btn { font: inherit; }
nav button, .theme-btn {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  padding: 7px 12px;
  border-radius: 999px;
  cursor: pointer;
}
html[data-theme="ink"] nav button,
html[data-theme="ink"] .theme-btn,
html[data-theme="workshop"] nav button,
html[data-theme="workshop"] .theme-btn { border-radius: var(--radius); }
nav button.on, .theme-btn.on {
  color: var(--bg);
  background: var(--accent);
  border-color: var(--accent);
}
.tab { display: none; }
.tab.on { display: block; }
.hidden { display: none !important; }
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 18px;
}
.card {
  display: block;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0;
  overflow: hidden;
  cursor: pointer;
  text-align: left;
  width: 100%;
  color: inherit;
  transition: 0.2s border-color, 0.2s transform, 0.2s background;
}
.card:hover { border-color: var(--accent); transform: translateY(-2px); }
.card.current { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.card-cover {
  position: relative;
  aspect-ratio: 3 / 4;
  background: var(--soft);
  overflow: hidden;
}
.card-cover img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.card-fallback {
  position: absolute;
  inset: 0;
  padding: 18px 14px;
  display: flex;
  align-items: flex-end;
  font-family: var(--font-display);
  font-size: 20px;
  line-height: 1.35;
  color: var(--text);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--accent) 22%, var(--soft)), var(--soft));
}
.card-body { padding: 12px 12px 14px; }
.card-title {
  font-family: var(--font-display);
  font-size: 15px;
  line-height: 1.35;
  margin: 0 0 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-blurb { margin: 0 0 10px; color: var(--muted); font-size: 12px; min-height: 16px; }
.today-row { display: flex; gap: 14px; align-items: stretch; }
.today-cover {
  width: 72px;
  height: 96px;
  object-fit: cover;
  border-radius: 8px;
  background: var(--soft);
  flex: 0 0 auto;
}
.book-hero { display: flex; gap: 18px; align-items: flex-start; margin-bottom: 8px; }
.book-hero-cover {
  width: 120px;
  height: 160px;
  object-fit: cover;
  border-radius: var(--radius);
  background: var(--soft);
  flex: 0 0 auto;
  border: 1px solid var(--line);
}
.meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12px; }
.prog { color: var(--accent); font-weight: 700; }
.pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 8px;
  color: var(--warn);
  background: color-mix(in srgb, var(--warn) 12%, transparent);
  font-size: 11px;
}
.track { height: 8px; border-radius: 99px; background: color-mix(in srgb, var(--text) 8%, var(--bg)); overflow: hidden; margin-top: 10px; }
.fill { height: 100%; width: 0; background: var(--accent); transition: width 0.35s; }
.today, .panel, .note, .job {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 12px;
}
.today strong { color: var(--accent); }
.label {
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--faint);
  margin-bottom: 10px;
  text-transform: uppercase;
}
.dash { display: grid; grid-template-columns: 1.3fr 0.7fr; gap: 12px; margin: 16px 0; }
.pct { font-family: var(--font-display); font-size: 36px; color: var(--accent); }
.meter { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: end; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.btn {
  border: 1px solid var(--line);
  background: var(--soft);
  color: var(--text);
  border-radius: 10px;
  padding: 9px 12px;
  cursor: pointer;
}
html[data-theme="ink"] .btn, html[data-theme="workshop"] .btn { border-radius: var(--radius); }
.btn.primary { background: var(--accent); color: var(--bg); border-color: var(--accent); font-weight: 700; }
.ch {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 8px;
  background: color-mix(in srgb, var(--bg) 55%, var(--panel));
  overflow: hidden;
}
.ch.done { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
.ch.open { border-color: color-mix(in srgb, var(--warn) 55%, var(--line)); }
.row {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 10px;
  padding: 12px;
  align-items: start;
}
.chk {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 1px solid var(--muted);
  display: grid;
  place-items: center;
  cursor: pointer;
  background: var(--bg);
  color: transparent;
}
.ch.done .chk { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.title { margin: 0; font-size: 14px; font-weight: 700; }
.thesis { margin: 6px 0 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.extra { display: none; padding: 0 12px 16px 50px; color: var(--text); font-size: 14px; white-space: normal; }
.ch.open .extra { display: block; }
.md-body { line-height: 1.8; max-width: 46em; }
.md-body p { margin: 0 0 0.85em; }
.md-body h1, .md-body h2, .md-body h3, .md-body h4 {
  font-family: var(--font-display);
  line-height: 1.4;
  margin: 1.2em 0 0.5em;
}
.md-body h1 { font-size: 1.25em; }
.md-body h2 { font-size: 1.1em; }
.md-body h3, .md-body h4 { font-size: 1em; }
.md-body img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 14px auto;
  border-radius: 8px;
  background: var(--soft);
  border: 1px solid var(--line);
}
.md-body table { border-collapse: collapse; width: 100%; margin: 12px 0; font-size: 13px; }
.md-body th, .md-body td { border: 1px solid var(--line); padding: 6px 8px; }
.md-body blockquote {
  margin: 0 0 0.85em;
  padding: 0 0 0 12px;
  border-left: 3px solid var(--accent);
  color: var(--muted);
}
.md-body code { font-family: "JetBrains Mono", monospace; font-size: 0.9em; }
.more { margin-top: 8px; border: 0; background: none; color: var(--accent); cursor: pointer; padding: 0; font-size: 12px; }
.back { color: var(--muted); font-size: 13px; display: inline-block; margin-bottom: 10px; }
h2 { font-family: var(--font-display); font-size: 32px; margin: 0 0 6px; }
.muted { color: var(--muted); }
form label { display: block; margin: 10px 0; color: var(--muted); font-size: 13px; }
input, select, textarea {
  width: 100%;
  margin-top: 4px;
  padding: 8px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  border-radius: 8px;
}
pre { white-space: pre-wrap; color: var(--muted); }
@media (max-width: 800px) {
  header { flex-direction: column; align-items: flex-start; }
  .header-tools { align-items: flex-start; }
  .dash { grid-template-columns: 1fr; }
  .book-hero-cover { width: 84px; height: 112px; }
  .cards { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}
