:root { --bg: #14110f; --panel: #1e1a17; --line: #342d27; --text: #f2ece4; --muted: #a89d90; --accent: #e0a458; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.5 system-ui, sans-serif; color-scheme: dark; }
h2, p { margin: 0; }
h2 { font-size: 18px; }
a { color: var(--accent); }
/* "body >" so a book's own <header> elements aren't styled like the site's menu. */
body > header { position: sticky; top: 0; z-index: 2; background: var(--bg); border-bottom: 1px solid var(--line); padding: 10px 16px; display: flex; flex-wrap: wrap; gap: 8px 16px; justify-content: space-between; align-items: center; }
.brand { color: var(--text); font-weight: 700; text-decoration: none; }
nav { display: flex; flex-wrap: wrap; gap: 4px; }
nav a { color: var(--muted); text-decoration: none; padding: 6px 10px; border-radius: 8px; white-space: nowrap; }
nav a.on { background: var(--panel); color: var(--text); }
main { max-width: 900px; margin: 0 auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.muted { color: var(--muted); font-size: 14px; }
.message { max-width: 868px; margin: 12px auto 0; padding: 8px 16px; }
.message.error { color: #ff8f85; }
.message.ok { color: #86d99a; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
button, .button, input, select { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; max-width: 100%; }
button, .button { cursor: pointer; text-align: center; text-decoration: none; }
button:hover, .button:hover { border-color: var(--muted); }
button:disabled { opacity: .4; cursor: default; }
.primary { background: var(--accent); border-color: var(--accent); color: #1c1205; font-weight: 700; }
button.small { font-size: 13px; padding: 4px 8px; }
button.danger { color: #ff8f85; align-self: flex-start; }
button.wide { width: 100%; }
button.star { font-size: 22px; color: var(--accent); padding: 2px 8px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.grow { flex: 1 1 160px; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
label { display: flex; flex-direction: column; gap: 4px; }
label.check { flex-direction: row; gap: 10px; align-items: flex-start; flex: 1; }
label.check input { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--accent); }
label.check > span { display: flex; flex-direction: column; }
.struck { text-decoration: line-through; color: var(--muted); }
details > summary { cursor: pointer; margin-bottom: 8px; }
.head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
progress { width: 100%; height: 10px; accent-color: var(--accent); }
.goal { font-weight: 600; }
.recap { border-left: 3px solid var(--accent); padding-left: 10px; }
.now { display: grid; grid-template-columns: 110px 1fr; gap: 16px; align-items: start; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px; }
.grid > .muted { grid-column: 1 / -1; }
.tile { display: flex; flex-direction: column; gap: 4px; color: var(--text); text-decoration: none; min-width: 0; }
.tile strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.because { color: var(--accent); font-size: 13px; }
.about { white-space: pre-line; overflow-wrap: anywhere; }
a.tile:hover .cover { border-color: var(--accent); }
.cover { position: relative; aspect-ratio: 2 / 3; background: #2b241f; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; display: grid; place-items: center; text-align: center; color: var(--muted); font-size: 13px; padding: 6px; }
.cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.calendar { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; max-width: 420px; width: 100%; margin: 0 auto; }
.weekday { color: var(--muted); font-size: 12px; }
.day { display: grid; place-items: center; aspect-ratio: 1; border-radius: 8px; border: 1px solid var(--line); font-size: 13px; }
.day.met { background: var(--accent); border-color: var(--accent); color: #1c1205; font-weight: 700; }
.day.some { background: #6b5233; border-color: #6b5233; }
.day.now { outline: 2px solid var(--text); outline-offset: -2px; grid-template-columns: none; }
ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
li { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
blockquote { margin: 0; border-left: 3px solid var(--accent); padding-left: 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
blockquote footer { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 4px; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.stat { border: 1px solid var(--line); border-radius: 10px; padding: 12px; background: var(--panel); }
.stat strong { font-size: 18px; }
.stat.earned { border-color: var(--accent); }
.stat.locked { opacity: .6; }
.monthrow { display: grid; grid-template-columns: 40px 1fr 30px; align-items: center; }
main.login { max-width: 360px; min-height: 90vh; justify-content: center; }
h1 { margin: 0; font-size: 28px; line-height: 1.2; }
.hero { display: flex; flex-direction: column; gap: 18px; padding: 22px; border: 1px solid var(--line); border-radius: 18px; background: linear-gradient(140deg, #3a2a18, var(--panel) 60%); }
.hero .now { grid-template-columns: 130px 1fr; }
.tag { color: var(--accent); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.stats.four { grid-template-columns: repeat(4, 1fr); }
.stats.four .stat strong { display: block; font-size: 24px; }
.week { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; gap: 4px; }
.week > div { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.week small { color: var(--muted); }
.dot { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); font-size: 14px; }
.dot.met { background: var(--accent); border-color: var(--accent); color: #1c1205; font-weight: 700; }
.dot.some { background: #6b5233; border-color: #6b5233; }
.dot.today { outline: 2px solid var(--text); outline-offset: 2px; }
.shelf { display: grid; grid-auto-flow: column; grid-auto-columns: 130px; gap: 14px; overflow-x: auto; padding-bottom: 8px; }
.sites { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; align-items: start; }
.site { min-width: 0; overflow-wrap: anywhere; }
.letter { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--accent); color: #1c1205; font-weight: 700; }
.sitename { font-weight: 700; }
@media (max-width: 560px) {
  .stats.four { grid-template-columns: repeat(2, 1fr); }
  .hero { padding: 16px; }
  .hero .now { grid-template-columns: 96px 1fr; }
}
/* The site menu stays while you read. Only full screen puts it away. */
:root:fullscreen body.reading > header { display: none; }
body.reading main { max-width: none; padding: 0; gap: 0; }
.reader { min-height: 100vh; min-height: 100dvh; background: var(--paper); color: var(--ink); }
.reader > .muted, .reader > .message, .reader > .button, .reader > button { display: block; width: fit-content; margin: 24px auto; }
.reader article { max-width: var(--width); margin: 0 auto; padding: 76px 24px 24px; font: var(--size)/var(--spacing) Georgia, "Times New Roman", serif; overflow-wrap: break-word; hyphens: auto; -webkit-user-select: text; user-select: text; touch-action: manipulation; }
.reader[data-font=sans] article { font-family: system-ui, sans-serif; }
.reader[data-align=justify] article p { text-align: justify; }
.reader[data-theme=dark] { --paper: #171412; --ink: #e8e0d5; --bar: #221e1a; --edge: #38312a; }
.reader[data-theme=black] { --paper: #000; --ink: #c9c4bc; --bar: #101010; --edge: #262626; }
.reader[data-theme=sepia] { --paper: #f3e7cf; --ink: #43341f; --bar: #e9dabd; --edge: #d3c09b; color-scheme: light; }
.reader[data-theme=light] { --paper: #fff; --ink: #1d1d1d; --bar: #f2f2f2; --edge: #ddd; color-scheme: light; }
.reader button, .reader select, .reader input, .rbar .button { background: var(--bar); color: var(--ink); border-color: var(--edge); }
.rbar, .rfoot { position: fixed; left: 0; right: 0; z-index: 2; display: flex; gap: 8px; align-items: center; justify-content: center; background: var(--bar); border-color: var(--edge); border-style: solid; border-width: 0; padding: 8px 12px; transition: transform .2s; }
.rbar { top: var(--menu, 0px); border-bottom-width: 1px; }
.rfoot { bottom: 0; border-top-width: 1px; padding-bottom: calc(8px + env(safe-area-inset-bottom)); }
.rbar > .chapters { flex: 0 1 480px; min-width: 0; }
.rbar select { width: 100%; }
.rfoot .status { flex: 0 1 420px; text-align: center; font-size: 13px; min-width: 0; }
.rfoot button { min-width: 56px; font-size: 20px; line-height: 1.2; }
:root:fullscreen .reader.hide-bars .rbar { transform: translateY(-100%); }
:root:fullscreen .reader.hide-bars .rfoot { transform: translateY(100%); }
.hpanel { position: fixed; z-index: 3; top: calc(var(--menu, 0px) + 60px); bottom: 62px; right: 0; width: 300px; max-width: 100%; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; background: var(--bar); border-left: 1px solid var(--edge); padding: 14px; }
.hpanel .head button { padding: 2px 10px; }
.reader button.on-panel { background: var(--accent); border-color: var(--accent); color: #1c1205; }
@media (min-width: 1100px) { .reader.with-panel { padding-right: 300px; } .reader.with-panel .rfoot { right: 300px; } .reader.with-panel .hpanel { bottom: 0; } }
.sheet { position: fixed; top: calc(var(--menu, 0px) + 60px); right: 12px; z-index: 4; width: min(360px, calc(100% - 24px)); max-height: calc(100dvh - 140px); overflow-y: auto; display: flex; flex-direction: column; gap: 10px; background: var(--bar); border: 1px solid var(--edge); border-radius: 14px; padding: 14px; box-shadow: 0 12px 32px #0008; }
.sheet label { flex-direction: row; justify-content: space-between; align-items: center; }
.sheet label select { flex: 0 0 180px; }
.reader .end { max-width: var(--width); margin: 0 auto; padding: 8px 24px 96px; display: flex; flex-direction: column; gap: 10px; }
.reader .end button { width: 100%; }
.reader .end .primary { background: var(--accent); border-color: var(--accent); color: #1c1205; }
@media (max-width: 560px) {
  .reader article { padding: 68px 18px 16px; }
  .sheet { top: auto; bottom: 64px; left: 12px; width: auto; max-height: 65dvh; }
  .rbar .wide-only { display: none; }
  .rbar { gap: 6px; }
  .hpanel { top: auto; bottom: 62px; left: 0; width: auto; max-height: 55dvh; border-left: 0; border-top: 1px solid var(--edge); border-radius: 14px 14px 0 0; }
  /* One swipeable line, so the menu doesn't eat the page. */
  body.reading > header { padding: 6px 8px; }
  body.reading > header .brand { display: none; }
  body.reading > header nav { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
}
button.pickcover { padding: 0; border: 0; background: none; display: block; }
button.pickcover .cover:hover { border-color: var(--accent); }
.hpanel button.saved { white-space: pre-line; flex-shrink: 0; }
.reader article ul, .reader article ol { display: block; padding-left: 1.4em; margin: 0 0 .8em; }
.reader article li { display: list-item; }
.reader article p { margin: 0 0 .8em; }
.reader article h1, .reader article h2, .reader article h3 { line-height: 1.25; text-align: center; font-size: 1.3em; margin: 1em 0; }
.reader article img { display: block; max-width: 100%; height: auto; margin: 0 auto; }
.reader article table { max-width: 100%; display: block; overflow-x: auto; }
.reader article pre { white-space: pre-wrap; }
mark { border-radius: 3px; color: #161208; cursor: pointer; }
mark.noted { border-bottom: 2px dashed #161208; }
.yellow { --c: #ffe066; }
.green { --c: #a8e6a1; }
.blue { --c: #a9d4ff; }
.pink { --c: #ffb8d2; }
.purple { --c: #d5baff; }
.orange { --c: #ffc48a; }
mark { background: var(--c); }
mark.underline { background: transparent; color: inherit; text-decoration: underline 3px var(--c); text-underline-offset: 4px; }
.reader[data-theme=light] mark.underline, .reader[data-theme=sepia] mark.underline { text-decoration-color: color-mix(in srgb, var(--c) 65%, #000); }
blockquote.yellow, blockquote.green, blockquote.blue, blockquote.pink, blockquote.purple, blockquote.orange { border-color: var(--c); }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.reader button.swatch { width: 30px; height: 30px; padding: 0; border-radius: 50%; background: var(--c); border: 2px solid transparent; }
.reader button.swatch.chosen { box-shadow: 0 0 0 2px var(--bar), 0 0 0 4px var(--ink); }
.reader button.saved { border-left: 4px solid var(--c); }
.markbar { position: fixed; left: 8px; right: 8px; bottom: 68px; z-index: 5; width: fit-content; max-width: calc(100% - 16px); margin: 0 auto; display: flex; flex-direction: column; gap: 10px; background: var(--bar); color: var(--ink); border: 1px solid var(--edge); border-radius: 16px; padding: 12px; box-shadow: 0 12px 32px #0006; font: 14px/1.4 system-ui, sans-serif; }
.markbar.floating { position: absolute; right: auto; bottom: auto; margin: 0; }
.markbar .line { display: flex; gap: 10px; align-items: center; justify-content: center; }
.markbar .actions { flex-wrap: wrap; }
.markbar .actions button { flex: 1; white-space: nowrap; padding: 7px 14px; }
.reader .markbar button.underliner { width: 34px; height: 34px; padding: 0; text-decoration: underline 2px; font-weight: 700; }
.reader .markbar button.underliner.chosen { background: var(--ink); color: var(--bar); }
.markbar button.close { margin-left: auto; width: 34px; height: 34px; padding: 0; }
.markbar textarea { font: inherit; font-size: 16px; width: min(360px, 100%); min-width: 100%; resize: vertical; background: var(--paper); color: var(--ink); border: 1px solid var(--edge); border-radius: 10px; padding: 8px 10px; }
.reader .markbar button.primary { background: var(--accent); border-color: var(--accent); color: #1c1205; }
.reader .markbar button.remove { color: #d5483f; }
button.hit { text-align: left; font-size: 14px; }
