
:root {
  --paper: #f8f4ec;
  --surface: #fffdf8;
  --ink: #1f1c18;
  --muted: #6d665c;
  --line: #e3dccf;
  --accent: #b24a26;
  --accent-ink: #fffaf4;
  --accent-soft: #f6e4d8;
  --free: #2f6b4f;
  --free-soft: #e1efe6;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Charter, "Source Serif Pro", Georgia, serif;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #161412;
    --surface: #1e1b18;
    --ink: #ece6dc;
    --muted: #a39a8c;
    --line: #34302a;
    --accent: #e07a52;
    --accent-ink: #1a1410;
    --accent-soft: #3a261c;
    --free: #79c29c;
    --free-soft: #1c2e24;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 17px/1.6 var(--sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

header.site, footer.site {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  max-width: 1040px; width: 100%; margin: 0 auto; padding: 22px 24px;
}
header.site .brand {
  font: 600 24px/1 var(--serif); color: var(--ink); text-decoration: none; letter-spacing: -0.01em;
}
header.site .brand span { color: var(--accent); }
header.site nav { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; justify-content: flex-end; font-size: 15px; }
header.site nav a:not(.button) { color: var(--ink); text-decoration: none; }
header.site nav a:not(.button):hover { color: var(--accent); }
header.site nav form { margin: 0; }
.balance { border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; font-variant-numeric: tabular-nums; }
footer.site { margin-top: auto; color: var(--muted); font-size: 13px; border-top: 1px solid var(--line); flex-wrap: wrap; }

main { width: 100%; max-width: 700px; margin: 0 auto; padding: 8px 24px 72px; }
main.wide { max-width: 1040px; }

.flash {
  max-width: 652px; width: calc(100% - 48px); margin: 0 auto 8px; padding: 10px 16px;
  background: var(--free-soft); color: var(--free); border-radius: 10px; font-size: 15px;
}
.flash.error { background: var(--accent-soft); color: var(--accent); }

h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: -0.01em; line-height: 1.2; }
h1 { font-size: clamp(34px, 6vw, 48px); margin: 24px 0 12px; }

button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 600 15px/1 var(--sans); padding: 12px 20px; border-radius: 999px;
  border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink);
  text-decoration: none; cursor: pointer; transition: transform .08s ease, filter .15s ease;
}
button:hover, .button:hover { filter: brightness(1.06); }
button:active, .button:active { transform: translateY(1px); }
button.secondary, .button.secondary { background: transparent; color: var(--ink); border-color: var(--line); }
button.secondary:hover, .button.secondary:hover { border-color: var(--ink); filter: none; }
button.small, .button.small { padding: 8px 14px; font-size: 14px; }
button.danger { background: transparent; color: var(--accent); border-color: var(--accent); }
button.linkish { background: none; border: 0; padding: 0; color: var(--ink); font: inherit; font-weight: 400; }
button.linkish:hover { color: var(--accent); filter: none; }

/* Home */
.intro { padding: 32px 0 8px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.intro p { color: var(--muted); font-size: 18px; max-width: 560px; }
.entries { list-style: none; margin: 0; padding: 0; }
.entry { padding: 28px 0; border-bottom: 1px solid var(--line); }
.entry h2 { font-size: 28px; margin: 4px 0 8px; }
.entry h2 a { color: var(--ink); text-decoration: none; }
.entry h2 a:hover { color: var(--accent); }
.entry .excerpt { font-family: var(--serif); font-size: 18px; color: var(--muted); margin: 0 0 12px; }
.meta { color: var(--muted); font-size: 14px; margin: 0; letter-spacing: 0.02em; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 0; }
.chip {
  display: inline-block; font-size: 13px; padding: 3px 10px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); color: var(--muted); white-space: nowrap;
}
.chip.free, .chip.pass { background: var(--free-soft); border-color: transparent; color: var(--free); }
.chip.owned { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.chip.open { background: var(--free-soft); border-color: transparent; color: var(--free); }
.empty { color: var(--muted); padding: 40px 0; }

/* Thought */
.thought header { margin: 24px 0 24px; }
.thought h1 { margin-top: 8px; }
.prose { font: 20px/1.75 var(--serif); }
.prose p { margin: 0 0 1.1em; }
.prose h2 { font-size: 28px; margin: 1.6em 0 .5em; }
.prose h3 { font-size: 23px; margin: 1.4em 0 .4em; }
.prose h4, .prose h5 { font-size: 20px; margin: 1.2em 0 .4em; }
.prose blockquote { margin: 1.4em 0; padding: 0 0 0 20px; border-left: 3px solid var(--accent); color: var(--muted); font-style: italic; }
.prose hr { border: 0; text-align: center; margin: 2em 0; }
.prose hr::after { content: "· · ·"; color: var(--muted); letter-spacing: .5em; }
.prose img { max-width: 100%; height: auto; border-radius: 8px; }
.prose code { font: .85em var(--mono); background: var(--surface); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; }
.prose pre { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px; overflow-x: auto; }
.prose pre code { background: none; border: 0; padding: 0; font-size: 15px; }
.prose ul, .prose ol { padding-left: 1.3em; margin: 0 0 1.1em; }
.prose li { margin: .3em 0; }
.teaser { position: relative; max-height: 13em; overflow: hidden; }
.teaser::after { content: ""; position: absolute; inset: auto 0 0 0; height: 5em; background: linear-gradient(to bottom, transparent, var(--paper)); }
.colophon { text-align: center; color: var(--muted); font-size: 14px; margin: 48px 0 0; }
.back { margin-top: 48px; font-size: 15px; }

.banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 12px 16px; margin: 0 0 28px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--line); font-size: 15px; color: var(--muted);
}
.banner.pass { background: var(--free-soft); border-color: transparent; color: var(--free); }
.banner form { margin: 0; }

.paywall { margin: 8px 0 0; padding: 28px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); }
.paywall h2 { margin: 0 0 18px; font-size: 26px; }
.options { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.options.single { grid-template-columns: 1fr; }
.option { padding: 20px; border-radius: 14px; border: 1px solid var(--line); display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.option.primary { border-color: var(--accent); }
.option h3 { margin: 0; font-size: 20px; }
.option p { margin: 0; color: var(--muted); font-size: 15px; }
.option form { margin: 4px 0 0; }
.option .button, .option button { margin-top: 4px; }
.option .price { font: 600 30px/1.1 var(--serif); color: var(--ink); }
.option .count { color: var(--free); font-weight: 600; }
.note { color: var(--muted); font-size: 14px; }
.meter { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0; }
.meter i { width: 10px; height: 10px; border-radius: 50%; background: var(--free); display: block; }
.meter i.taken { background: var(--line); }

/* Panels & forms */
.panel h2 { font-size: 22px; margin: 36px 0 12px; }
.panel.narrow { max-width: 420px; }
.narrow-form { max-width: 420px; margin-top: 12px; }
.lede { color: var(--muted); font-size: 18px; }
.stack { display: grid; gap: 16px; margin: 24px 0; }
label { display: grid; gap: 6px; font-size: 14px; font-weight: 600; }
label.inline { display: inline-flex; align-items: center; gap: 8px; font-weight: 400; margin-right: 20px; }
input, textarea {
  font: 16px/1.4 var(--sans); color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px; width: 100%;
}
input[type=radio] { width: auto; accent-color: var(--accent); }
input:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: vertical; }
textarea.mono { font: 15px/1.6 var(--mono); }
.small { font-size: 13px; font-weight: 400; }
.muted { color: var(--muted); }
fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; }
legend { font-size: 14px; font-weight: 600; padding: 0 6px; }

.packs { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin: 28px 0; }
.pack { margin: 0; padding: 22px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); display: flex; flex-direction: column; gap: 6px; }
.pack p { margin: 0; }
.pack-name { color: var(--muted); font-size: 14px; text-transform: uppercase; letter-spacing: .08em; }
.pack-credits { font: 600 40px/1.1 var(--serif); }
.pack-credits span { font: 400 16px var(--sans); color: var(--muted); }
.pack-price { font-size: 18px; margin-bottom: 10px !important; }

ul.plain { list-style: none; padding: 0; margin: 0; }
ul.plain li { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
ul.plain li span { font-size: 14px; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 13px; color: var(--muted); font-weight: 600; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.plus { color: var(--free); }
.minus { color: var(--muted); }

/* Admin */
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin: 20px 0 28px; }
.stats div { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.stats dt { color: var(--muted); font-size: 13px; }
.stats dd { margin: 4px 0 0; font: 600 24px/1.2 var(--serif); font-variant-numeric: tabular-nums; }
.table-scroll { overflow-x: auto; }
.admin-table { min-width: 640px; }
.editor { display: grid; gap: 18px; margin-top: 20px; }
.editor button[type=submit] { justify-self: start; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; align-items: end; }
.danger-zone { margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--line); }
.search { display: flex; gap: 10px; margin: 20px 0; max-width: 480px; }
.adjust { display: flex; gap: 6px; margin: 0; }
.adjust input { padding: 6px 8px; font-size: 14px; }
.adjust input[type=number] { width: 80px; }

@media (max-width: 640px) {
  body { font-size: 16px; }
  header.site { padding: 16px; }
  main { padding: 4px 16px 56px; }
  .options, .grid3 { grid-template-columns: 1fr; }
  .paywall { padding: 20px; }
  .prose { font-size: 19px; }
  .adjust { flex-wrap: wrap; }
}
