:root {
  --paper: #f7f3ea;
  --ink: #23201b;
  --muted: #6d665a;
  --rule: #d8cfbd;
  --accent: #7a2e1d;
  --accent-soft: #f0e0d6;
  --good: #2f5d3a;
  --card: #fffdf8;
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.55;
}
@media (prefers-color-scheme: dark) {
  :root { --paper: #1c1a17; --ink: #ece6d9; --muted: #a59d8e; --rule: #3a352d; --accent: #e08a6c; --accent-soft: #3a2a22; --good: #8fc79c; --card: #24211d; }
}
* { box-sizing: border-box; }
body { margin: 0; }
main { max-width: 760px; margin: 0 auto; padding: 1.5rem 1.25rem 4rem; }
header.site { border-bottom: 1px solid var(--rule); }
header.site nav { max-width: 760px; margin: 0 auto; padding: .8rem 1.25rem; display: flex; gap: 1.25rem; align-items: baseline; flex-wrap: wrap; }
header.site .brand { font-weight: 700; font-size: 1.15rem; letter-spacing: .02em; color: var(--ink); text-decoration: none; margin-right: auto; }
header.site a { color: var(--muted); text-decoration: none; }
header.site a:hover, header.site a[aria-current] { color: var(--accent); }
h1 { font-size: 2rem; margin: 1rem 0 .5rem; font-weight: 600; }
h2 { font-size: 1.3rem; margin: 2rem 0 .5rem; border-bottom: 1px solid var(--rule); padding-bottom: .25rem; font-weight: 600; }
h3 { font-size: 1.05rem; margin: 1.25rem 0 .25rem; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: .88rem; }

ol.books { padding-left: 2.6rem; }
ol.books li { padding: .25rem 0; }
ol.books .author { color: var(--muted); }

table { border-collapse: collapse; width: 100%; font-size: .95rem; }
th, td { text-align: left; padding: .4rem .5rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
th { font-weight: 600; color: var(--muted); font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }

.card { background: var(--card); border: 1px solid var(--rule); border-radius: 8px; padding: 1rem 1.1rem; margin: .75rem 0; }
.callout { background: var(--accent-soft); border-radius: 8px; padding: .8rem 1rem; margin: 1rem 0; }

button, .button { font: inherit; background: var(--accent); color: #fff; border: 0; border-radius: 6px; padding: .45rem .9rem; cursor: pointer; text-decoration: none; display: inline-block; }
button.secondary { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
button.link { background: none; color: var(--accent); padding: 0; text-decoration: underline; }
button:disabled { opacity: .5; cursor: default; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--card); border: 1px solid var(--rule); border-radius: 6px; padding: .4rem .55rem; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
label { display: block; margin: .5rem 0 .2rem; font-size: .9rem; color: var(--muted); }
.row { display: flex; gap: .6rem; flex-wrap: wrap; align-items: end; }
.row > * { flex: 1 1 10rem; }
.row > button { flex: 0 0 auto; }
.error { color: #b3261e; }
.ok { color: var(--good); }

.pill { display: inline-block; font-size: .78rem; padding: .05rem .5rem; border-radius: 99px; border: 1px solid var(--rule); color: var(--muted); vertical-align: middle; }
.pill.voting { border-color: var(--accent); color: var(--accent); }
.pill.closed { border-color: var(--good); color: var(--good); }

.book { display: flex; gap: .9rem; align-items: flex-start; }
.book img { width: 56px; height: auto; border-radius: 3px; flex: none; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.book .noimg { width: 56px; height: 84px; background: var(--rule); border-radius: 3px; flex: none; }
.book .meta { flex: 1; min-width: 0; }
.book .title { font-weight: 600; }
.links a { font-size: .85rem; margin-right: .6rem; }

.search-results { list-style: none; padding: 0; margin: .4rem 0; border: 1px solid var(--rule); border-radius: 6px; max-height: 22rem; overflow-y: auto; background: var(--card); }
.search-results li { padding: .4rem .6rem; cursor: pointer; border-bottom: 1px solid var(--rule); }
.search-results li:last-child { border-bottom: 0; }
.search-results li:hover, .search-results li:focus { background: var(--accent-soft); outline: none; }

.scores { display: flex; gap: .3rem; margin-top: .4rem; }
.scores label { margin: 0; }
.scores input { position: absolute; opacity: 0; pointer-events: none; }
.scores span { display: inline-block; min-width: 2.2rem; text-align: center; padding: .3rem 0; border: 1px solid var(--rule); border-radius: 6px; cursor: pointer; color: var(--ink); font-variant-numeric: tabular-nums; }
.scores input:checked + span { background: var(--accent); border-color: var(--accent); color: #fff; }
.scores input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }

.bar { height: .55rem; background: var(--accent); border-radius: 3px; min-width: 2px; }
.winner { font-size: 1.4rem; font-weight: 600; }

/* tier lists */
.tiers { border: 1px solid var(--rule); border-radius: 8px; overflow: hidden; margin: .5rem 0; }
.tier { display: flex; min-height: 3rem; border-top: 1px solid var(--rule); }
.tier:first-child { border-top: 0; }
.tier-label { flex: 0 0 2.75rem; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 1.15rem; color: #23201b; }
.tier-S .tier-label { background: #e58f78; }
.tier-A .tier-label { background: #ebb27a; }
.tier-B .tier-label { background: #e8d27f; }
.tier-C .tier-label { background: #bfd48e; }
.tier-D .tier-label { background: #93c0b3; }
.tier-F .tier-label { background: #a6a6c4; }
.tier-drop { flex: 1; display: flex; flex-wrap: wrap; gap: .35rem; padding: .4rem; align-content: flex-start; background: var(--card); }
.tier-pool { border: 1px dashed var(--rule); border-radius: 8px; min-height: 3rem; }
.chip { font-size: .85rem; padding: .3rem .55rem; border: 1px solid var(--rule); border-radius: 5px; background: var(--paper); line-height: 1.25; max-width: 14rem; }
.tier-edit .chip { cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.tier-edit .chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.chip.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.chip.dragging { opacity: .25; }
.chip.ghost { position: fixed; pointer-events: none; z-index: 10; cursor: grabbing; box-shadow: 0 4px 12px rgba(0,0,0,.25); }
.chip-placeholder { width: 4rem; border: 2px dashed var(--accent); border-radius: 5px; }
.tier-N { border-top: 2px solid var(--rule); }
.tier-N .tier-label { background: var(--rule); color: var(--muted); font-size: .68rem; font-weight: 600; line-height: 1.15; text-align: center; padding: 0 .2rem; }
.tier-N .tier-drop { background: var(--paper); }

/* covers */
.thumb { width: 30px; height: 45px; object-fit: cover; border-radius: 2px; flex: none; display: inline-block; vertical-align: middle; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.thumb-none { background: var(--rule); box-shadow: none; }
.chip { display: inline-flex; align-items: center; gap: .4rem; padding: .2rem .5rem .2rem .25rem; }
.chip-cover { width: 22px; height: 33px; object-fit: cover; border-radius: 2px; flex: none; }
.chip-cover.thumb-none { background: var(--rule); display: inline-block; }
ol.books { list-style: none; padding-left: 0; }
ol.books li { display: flex; align-items: center; gap: .75rem; padding: .3rem 0; }
ol.books .pos { color: var(--muted); font-variant-numeric: tabular-nums; min-width: 1.6rem; text-align: right; }
.book-head { display: flex; gap: 1.25rem; align-items: flex-start; }
.book-head .cover { width: 110px; height: auto; border-radius: 3px; box-shadow: 0 2px 6px rgba(0,0,0,.25); flex: none; }
.book-head h1 { margin-top: 0; }
.book img.thumb { width: 30px; height: 45px; }
.book .thumb-none { width: 30px; height: 45px; }

/* bookshelf (history) */
main.wide { max-width: 980px; }
.shelf { list-style: none; padding: 0; margin: 1.5rem 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(138px, 1fr)); gap: 2.2rem 1.4rem; }
.shelf li { min-width: 0; }
.shelf a.book-tile { display: block; color: inherit; text-decoration: none; }
.shelf a.book-tile:focus-visible { outline: none; }
/* every cover sits in the same box, at its own proportions, standing on the bottom edge */
.shelf .cover-wrap { aspect-ratio: 2 / 3; display: flex; align-items: flex-end; justify-content: center; }
.shelf .cover-wrap img { display: block; max-width: 100%; max-height: 100%; border-radius: 3px;
  box-shadow: 0 1px 2px rgba(0,0,0,.2), 0 8px 16px -6px rgba(0,0,0,.4); transition: transform .18s ease, box-shadow .18s ease; }
.shelf a.book-tile:hover img, .shelf a.book-tile:focus-visible img { transform: translateY(-5px); box-shadow: 0 2px 4px rgba(0,0,0,.2), 0 16px 24px -8px rgba(0,0,0,.45); }
.shelf a.book-tile:focus-visible img { outline: 2px solid var(--accent); outline-offset: 3px; }
.shelf .no-cover { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; padding: .8rem; text-align: center; font-style: italic; color: var(--muted); background: var(--rule); border-radius: 3px; }
.shelf .tile-num { margin-top: .7rem; color: var(--muted); font-size: .72rem; font-variant-numeric: tabular-nums; letter-spacing: .04em; }
.shelf .tile-title { font-style: italic; font-weight: 600; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.shelf .tile-author { color: var(--muted); font-size: .88rem; line-height: 1.3; margin-top: .15rem; }
.shelf .tile-meta { color: var(--muted); font-size: .78rem; margin-top: .3rem; }
@media (max-width: 520px) { .shelf { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 1.6rem .9rem; } .shelf .tile-author { font-size: .8rem; } }
