/* Bokbrødrene Hubro — Kafka yellow #f2c249, rust #ad3b31, black & white.
   :root is the day theme (the yellow page). [data-theme="dark"] is the night
   variant behind the theme toggle.

   Layout: #app-shell is a page column under a sticky top bar. On narrow
   screens #tab-nav becomes a fixed bottom tab bar, like an app. */

:root {
  --gold: #f2c249;
  --red: #ad3b31;
  --bg: #f2c249;
  --surface: #fffdf6;
  --surface-2: #fbf2d6;
  --fg: #191510;
  --muted: #5a4a24;
  --line: color-mix(in srgb, var(--fg) 18%, transparent);
  --accent: var(--red);
  --accent-strong: #8a2f26;
  --accent-soft: color-mix(in srgb, var(--red) 12%, transparent);
  --red-soft: color-mix(in srgb, var(--red) 16%, transparent);
  --shadow: 0 16px 36px rgba(70, 45, 5, .22);
  --card-shadow: 0 8px 22px rgba(70, 45, 5, .07);
  --radius: 14px;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #0d0c0a;
  --surface: #17150f;
  --surface-2: #201d15;
  --fg: #f7f3e9;
  --muted: #a79e8c;
  --line: #322c22;
  --accent: var(--gold);
  --accent-strong: var(--gold);
  --accent-soft: color-mix(in srgb, var(--gold) 16%, transparent);
  --red-soft: color-mix(in srgb, var(--red) 20%, transparent);
  --shadow: 0 14px 40px rgba(0, 0, 0, .45);
  --card-shadow: 0 8px 22px rgba(0, 0, 0, .35);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { scrollbar-gutter: stable; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

[hidden] { display: none !important; }

h1, h2, h3, h4, .brand { font-family: "Iowan Old Style", Georgia, "Times New Roman", serif; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 1.5rem; margin: 0; }
h4 { font-size: 1rem; margin: 1.4rem 0 .6rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }

a { color: var(--accent-strong); }
.muted { color: var(--muted); }
.small { font-size: .82rem; }

.skip { position: absolute; left: -999px; }
.skip:focus { left: 1rem; top: 1rem; background: var(--red); color: #fff; padding: .5rem .8rem; border-radius: 8px; z-index: 50; }

/* ---------- icons (Material Symbols, inlined by web/icons.ts) ---------- */
.ic { display: inline-flex; width: 1.2em; height: 1.2em; flex: none; vertical-align: -.25em; }
.ic svg { width: 100%; height: 100%; fill: currentColor; display: block; }

/* ---------- app shell: top bar + page column ---------- */
#app-shell {
  min-height: 100dvh;
  max-width: 92rem;
  margin-inline: auto;
}

.topbar {
  display: flex; align-items: center; gap: .5rem;
  position: sticky; top: 0; z-index: 20;
  padding: .6rem clamp(1rem, 4vw, 2.4rem);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
}
.topbar .brand { display: inline-flex; align-items: center; gap: .5rem; font-size: 1.05rem; line-height: 1.15; text-decoration: none; color: var(--fg); min-width: 0; }
.topbar .brand img { border-radius: 8px; flex: none; }
.brand-name { overflow-wrap: anywhere; }
.top-links { display: flex; gap: .15rem; margin-left: .8rem; flex-wrap: wrap; }
.top-links .nav-item { padding: .42rem .65rem; font-size: .9rem; }
.topbar .who { margin-left: auto; }
.nav-item {
  display: flex; align-items: center; gap: .55rem;
  padding: .5rem .7rem; border-radius: 10px;
  color: var(--fg); text-decoration: none; font-weight: 600; font-size: .95rem;
  transition: background .15s, color .15s;
}
.nav-item svg { width: 20px; height: 20px; flex: none; fill: currentColor; }
.nav-item:hover { background: var(--accent-soft); }
.nav-item[aria-current="page"] { background: var(--red); color: #fff; }
.who { display: inline-flex; align-items: center; gap: .35rem; color: var(--muted); font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none; }
a.who:hover { color: var(--fg); }
.who[aria-current="page"] { color: var(--accent-strong); }
.who .ic { width: 1.05em; height: 1.05em; }

/* bottom tabs: mobile only, like an app */
.tabs { display: none; }

main { min-width: 0; padding: 1.4rem clamp(1rem, 4vw, 2.4rem) 3rem; }
footer { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; color: var(--muted); border-top: 1px solid var(--line); padding: 1rem clamp(1rem, 4vw, 2.4rem) 1.6rem; font-size: .82rem; }
main section { padding: 1.2rem 0; }

/* ---------- buttons / forms ---------- */
button, select, input, textarea { font: inherit; color: inherit; }
button {
  background: transparent; border: 1px solid var(--line); border-radius: 9px;
  padding: .32rem .7rem; cursor: pointer; transition: border-color .15s, background .15s, color .15s;
}
button:hover { border-color: var(--accent); }
button[aria-pressed="true"] { background: var(--red); color: #fff; border-color: var(--red); }

.btn { display: inline-flex; align-items: center; gap: .4rem; padding: .5rem .9rem; border-radius: 10px; font-weight: 600; text-decoration: none; }
.btn.primary { background: var(--red); color: #fff; border: 1px solid var(--red); }
.btn.primary:hover { background: color-mix(in srgb, var(--red) 82%, #000); border-color: color-mix(in srgb, var(--red) 82%, #000); }
.link { border: none; padding: 0; color: var(--accent-strong); font-size: .85rem; text-decoration: none; }
.link:hover { text-decoration: underline; }
button.link:hover { border-color: transparent; }

.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 2.2rem; height: 2.2rem; padding: 0; border-radius: 9px; color: var(--muted); }
.icon-btn svg { width: 20px; height: 20px; fill: currentColor; display: block; }
.icon-btn:hover { color: var(--fg); }

select, input, textarea {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px;
  padding: .42rem .6rem; color: var(--fg);
}
select:focus, input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
textarea { width: 100%; min-height: 4.5rem; resize: vertical; line-height: 1.5; }

/* ---------- gate (its own page: /login) ---------- */
body[data-page="login"] main { padding: 0; }
#gate { min-height: 100dvh; display: grid; place-items: center; padding: 2rem 1.1rem; }
.gate-theme { position: fixed; top: 1rem; right: 1rem; z-index: 30; }
.gate-card { width: min(26rem, 100%); display: flex; flex-direction: column; align-items: center; text-align: center; }
.gate-card .sigil { width: 96px; height: 96px; margin-bottom: .6rem; }
.gate-card h1 { margin: .15rem 0 .2rem; font-size: clamp(1.8rem, 6vw, 2.6rem); }
.gate-sub { margin: 0 0 1.1rem; }
.gate-card form { width: 100%; display: flex; flex-direction: column; gap: .8rem; text-align: left; }
.gate-card .field input { width: 100%; }
.gate-card .btn { width: 100%; justify-content: center; }
.gate-error { margin: 0; color: var(--red); font-size: .85rem; }
.gate-toggle { margin: .9rem 0 0; }

/* ---------- layout ---------- */
.section-head { display: flex; align-items: baseline; gap: 1rem; flex-wrap: wrap; margin-bottom: .9rem; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--card-shadow); }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: .7rem; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem; margin-top: .9rem; }

/* ---------- hero / current read: no box, just the cover on the page ---------- */
.hero {
  display: grid; grid-template-columns: minmax(200px, 320px) 1fr;
  gap: clamp(1.5rem, 5vw, 3.5rem); align-items: center;
  padding: 1.6rem 0 2.4rem;
  border-bottom: 2px solid color-mix(in srgb, var(--red) 55%, transparent);
}
.hero-cover { justify-self: center; max-width: 320px; box-shadow: 0 26px 55px rgba(70, 40, 0, .35); }
.eyebrow { margin: 0; text-transform: uppercase; letter-spacing: .2em; font-size: .72rem; color: var(--accent-strong); font-weight: 700; }
.hero-body h1 { margin: .3rem 0 .15rem; font-size: clamp(2rem, 5.5vw, 3.6rem); line-height: 1.02; }
.byline { margin: 0; color: var(--muted); font-style: italic; }
.blurb { margin: .9rem 0; max-width: 46ch; }
.tags { display: flex; gap: .4rem; flex-wrap: wrap; margin: .5rem 0; }
.tag { font-size: .74rem; color: var(--muted); border: 1px solid var(--line); border-radius: 99px; padding: .08rem .55rem; background: color-mix(in srgb, var(--surface) 60%, transparent); }
.hero-stats { display: flex; align-items: center; gap: .6rem; }
.hero-actions { display: flex; gap: .5rem; margin-top: 1.1rem; flex-wrap: wrap; }
.progress-block { margin-top: 1.1rem; max-width: 34rem; }
.progress-head { display: flex; justify-content: space-between; align-items: baseline; gap: .6rem; font-size: .72rem; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); margin-bottom: .35rem; }
.progress-head b { color: var(--fg); font-size: .8rem; letter-spacing: .02em; }

/* cover art */
.cover {
  position: relative; aspect-ratio: 2 / 3; width: 100%; max-width: 260px;
  border-radius: 5px 12px 12px 5px; overflow: hidden; display: flex; align-items: flex-end;
  padding: .9rem; box-shadow: var(--shadow);
  border: 1px solid color-mix(in srgb, var(--fg) 16%, transparent);
  background: linear-gradient(150deg, hsl(var(--h, 45) 50% 44%), hsl(calc(var(--h, 45) + 32) 58% 20%));
}
.cover.sm { max-width: none; aspect-ratio: 2 / 3; padding: .6rem; border-radius: 4px 9px 9px 4px; }
.cover-spine { position: absolute; left: 0; top: 0; bottom: 0; width: 11px; background: linear-gradient(90deg, rgba(0,0,0,.5), rgba(0,0,0,.05)); }
.cover-text { position: relative; display: flex; flex-direction: column; gap: .2rem; color: #fff; text-shadow: 0 1px 6px rgba(0,0,0,.5); }
.cover-text b { font-family: Georgia, serif; font-size: 1rem; line-height: 1.15; }
.cover-text i { font-size: .72rem; opacity: .85; font-style: normal; }
.cover.sm .cover-text b { font-size: .8rem; }
.cover.has-img { background-size: cover; background-position: center; }
.cover.has-img .cover-spine, .cover.has-img .cover-text { display: none; }

/* progress bar: two rounded rectangles — a quiet track, a coloured fill */
.bar { height: 10px; background: color-mix(in srgb, var(--fg) 9%, transparent); border-radius: 999px; overflow: hidden; box-shadow: inset 0 1px 2px rgba(0, 0, 0, .08); }
.bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--red), color-mix(in srgb, var(--red) 45%, var(--gold))); border-radius: 999px; transition: width .45s cubic-bezier(.22, .8, .3, 1); }
[data-theme="dark"] .bar > span { background: linear-gradient(90deg, color-mix(in srgb, var(--gold) 60%, var(--red)), var(--gold)); }

/* stars */
.stars { color: var(--accent-strong); letter-spacing: .08em; font-size: 1rem; }
.stars.sm { font-size: .82rem; }

/* ---------- pulse stats ---------- */
.pulse { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: .7rem; margin-top: 1.2rem; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem .9rem; display: flex; flex-direction: column; gap: .1rem; }
.stat b { font-family: Georgia, serif; font-size: 1.5rem; color: var(--accent-strong); }
.stat span { font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }

/* ---------- mini lists ---------- */
.mini-list { display: flex; flex-direction: column; gap: .55rem; }
.mini-post { display: flex; gap: .6rem; align-items: center; }
.mini-post > div { min-width: 0; }
.mini-post b { font-size: .9rem; }
.mini-post p { margin: .05rem 0 0; color: var(--muted); font-size: .85rem; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.mini-post .chips { margin-left: auto; }
.mini-post.spoiler { cursor: pointer; }
.mini-post.spoiler p { filter: blur(6px); user-select: none; pointer-events: none; }
.mini-post.spoiler .spoiler-hint { display: inline-flex; }
.mini-post .spoiler-hint { margin-top: .2rem; }

/* ---------- home: the brothers, by page in the current read ---------- */
.brother-list { display: flex; flex-direction: column; gap: .5rem; }
.brother-row { display: flex; align-items: center; gap: .6rem; padding: .3rem .4rem; border: 1px solid transparent; border-radius: 10px; }
.brother-row.you { border-color: color-mix(in srgb, var(--red) 40%, transparent); background: var(--accent-soft); }
.brother-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .3rem; }
.brother-top { display: flex; align-items: baseline; gap: .45rem; min-width: 0; }
.brother-top b { font-size: .9rem; }
.brother-pct { margin-left: auto; color: var(--accent-strong); font-weight: 600; }

/* ---------- avatars ---------- */
.avatar {
  width: 40px; height: 40px; flex: 0 0 auto; border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.2rem; background: var(--surface-2); border: 1px solid var(--line);
}
.avatar.sm { width: 30px; height: 30px; font-size: .95rem; border-radius: 9px; }

/* ---------- members ---------- */
.member-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .8rem; }
.member-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; display: flex; flex-direction: column; gap: .5rem; }
.member-top { display: flex; align-items: center; gap: .6rem; }
.member-id { display: flex; flex-direction: column; min-width: 0; }
.member-id b { font-size: .98rem; }
.handle { color: var(--muted); font-size: .8rem; }
.you-badge { margin-left: auto; font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; background: var(--red); color: #fff; border-radius: 99px; padding: .1rem .5rem; }
.role { margin: 0; font-size: .84rem; color: var(--muted); font-style: italic; }
.member-foot { display: flex; justify-content: space-between; font-size: .78rem; color: var(--accent-strong); }
.member-foot .muted { color: var(--muted); }

/* ---------- forum ---------- */
.section-head .filter-pop { margin-left: auto; }
.filter-pop { position: relative; }
.filter-pop summary { list-style: none; cursor: pointer; }
.filter-pop summary::-webkit-details-marker { display: none; }
.filter-pop.active summary { color: var(--accent-strong); background: var(--accent-soft); }
.filter-menu {
  position: absolute; right: 0; top: calc(100% + .35rem); z-index: 25;
  min-width: 11rem; display: flex; flex-direction: column; gap: .1rem;
  padding: .4rem; border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); box-shadow: var(--shadow);
}
.menu-title { margin: .35rem .5rem .15rem; font-size: .66rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.filter-menu button { display: flex; align-items: center; gap: .45rem; border: none; text-align: left; border-radius: 8px; font-size: .85rem; padding: .32rem .5rem; }
.filter-menu button[aria-pressed="true"] { background: var(--accent-soft); color: var(--fg); }
.filter-menu .check { width: 1em; height: 1em; visibility: hidden; }
.filter-menu button[aria-pressed="true"] .check { visibility: visible; }
.compose { display: flex; flex-direction: column; gap: .7rem; margin: 0 0 1.4rem; }
.compose-head { font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.compose-head b { color: var(--fg); }
.compose-row { display: flex; gap: .7rem; flex-wrap: wrap; align-items: end; }
.compose-foot { display: flex; align-items: center; justify-content: space-between; gap: .8rem; flex-wrap: wrap; }
.field { display: flex; flex-direction: column; gap: .2rem; font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.field.grow { flex: 1 1 220px; }
.field input, .field select { width: 100%; }

/* the composer's label picker: a dropdown of the same pills as posts wear */
.label-picker { position: relative; }
.label-picker summary { list-style: none; cursor: pointer; }
.label-picker summary::-webkit-details-marker { display: none; }
.picker-summary {
  display: inline-flex; align-items: center; gap: .4rem;
  min-width: 12rem; padding: .38rem .6rem;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px;
}
.picker-empty { color: var(--muted); font-size: .85rem; }
.label-picker.has-labels .picker-empty { display: none; }
.picker-chips { display: inline-flex; align-items: center; gap: .3rem; flex-wrap: wrap; }
.picker-arrow { margin-left: auto; color: var(--muted); }
.picker-menu {
  position: absolute; left: 0; top: calc(100% + .35rem); z-index: 25;
  display: flex; flex-direction: column; gap: .1rem;
  padding: .4rem; border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); box-shadow: var(--shadow);
}
.picker-item { display: flex; align-items: center; gap: .45rem; padding: .3rem .45rem; border-radius: 8px; cursor: pointer; }
.picker-item:hover { background: var(--accent-soft); }

/* labels are optional tags on a post, not a post type: GitHub-style pills */
.chips { display: inline-flex; align-items: center; gap: .3rem; flex-wrap: wrap; }
.chip {
  --chip: var(--muted);
  display: inline-flex; align-items: center; gap: .35em;
  font-size: .68rem; font-weight: 600; line-height: 1.7;
  padding: .05rem .55rem; border-radius: 999px; white-space: nowrap;
  color: var(--chip);
  background: color-mix(in srgb, var(--chip) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--chip) 38%, transparent);
}
.chip::before { content: ""; width: .45em; height: .45em; border-radius: 50%; background: currentColor; }
.chip.insight { --chip: #1d4ed8; }
.chip.spoiler { --chip: #b42318; }
.chip.discussion { --chip: #15803d; }
[data-theme="dark"] .chip.insight { --chip: #7aa2ff; }
[data-theme="dark"] .chip.spoiler { --chip: #ff8a80; }
[data-theme="dark"] .chip.discussion { --chip: #6fdd8b; }

.post-list { display: flex; flex-direction: column; gap: .8rem; }
.post { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; }
.post-head { display: flex; align-items: center; gap: .6rem; }
.post-head .chips { margin-left: auto; justify-content: flex-end; }
.post-who { display: flex; flex-direction: column; min-width: 0; }
.post-body { margin: .7rem 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.post-img { margin-top: .8rem; width: 100%; max-width: 520px; border-radius: 12px; border: 1px solid var(--line); display: block; }
.spoiler-hint { display: none; align-items: center; gap: .35rem; margin-top: .7rem; font-size: .82rem; color: var(--muted); }
.post.spoiler { cursor: pointer; }
.post.spoiler .spoiler-hint { display: inline-flex; }
.post.spoiler .post-body,
.post.spoiler .post-img { filter: blur(7px); user-select: none; pointer-events: none; }
.post.spoiler .post-body { margin-top: .35rem; }
.post-foot { display: flex; align-items: center; gap: 1rem; margin-top: .8rem; }
.like { display: inline-flex; align-items: center; gap: .35rem; border-color: var(--line); color: var(--muted); }
.like .ic { width: 1.05em; height: 1.05em; }
.like:hover { color: var(--red); border-color: var(--red); }
.book-ref { display: inline-flex; align-items: center; gap: .3rem; margin-left: auto; }
.book-ref .ic { width: 1em; height: 1em; }

/* ---------- archive ---------- */
.book-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .9rem; }
.book-card { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .7rem; display: flex; flex-direction: column; gap: .55rem; cursor: pointer; transition: transform .15s, border-color .15s; }
.book-card:hover, .book-card:focus-visible { transform: translateY(-3px); border-color: var(--accent); outline: none; }
.book-info { display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.book-info b { font-size: .9rem; line-height: 1.2; }
.book-card .status { position: absolute; top: .5rem; right: .5rem; font-size: .62rem; text-transform: uppercase; letter-spacing: .07em; border-radius: 99px; padding: .1rem .45rem; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); }
.status.current { background: var(--red); color: #fff; border-color: var(--red); }
.status.queued { background: var(--surface-2); color: var(--muted); }

.book-detail { position: relative; margin-top: 1.2rem; }
.book-detail .close { position: absolute; top: .5rem; right: .5rem; border: none; padding: .2rem; color: var(--muted); display: inline-flex; }
.book-detail .close .ic { width: 1.35rem; height: 1.35rem; }
.book-detail .close:hover { color: var(--fg); }
.detail-head { display: grid; grid-template-columns: minmax(150px, 200px) 1fr; gap: 1.3rem; align-items: start; }
.detail-info h3 { margin: 0; font-size: 1.5rem; }

/* blurb + its inline editor (any member can fix a description) */
.blurb-row { display: flex; align-items: flex-start; gap: .3rem; }
.blurb-row .blurb { flex: 1; }
.blurb-edit { opacity: .5; flex: none; width: 1.9rem; height: 1.9rem; margin-top: .55rem; }
.blurb-edit:hover { opacity: 1; }
.blurb-edit-box { display: flex; flex-direction: column; gap: .5rem; margin: .4rem 0 .6rem; max-width: 46ch; }
.blurb-actions { display: flex; gap: .5rem; }
.rating-summary { display: flex; flex-direction: column; gap: .25rem; margin: 1.2rem 0 .4rem; max-width: 26rem; }
.dist-row { display: grid; grid-template-columns: 2.4rem 1fr 2rem; align-items: center; gap: .5rem; font-size: .78rem; color: var(--muted); }
.dist-row .bar { height: 6px; }
.dist-row .bar > span { background: var(--red); }
.stars-input { display: inline-flex; gap: .15rem; margin-bottom: .5rem; }
.stars-input button { border: none; font-size: 1.6rem; line-height: 1; color: color-mix(in srgb, var(--muted) 50%, transparent); padding: 0 .1rem; }
.stars-input button.on { color: var(--accent-strong); }
.stars-input button:hover { color: var(--accent-strong); }
.review-list { display: flex; flex-direction: column; gap: .6rem; }
.review { border-left: 2px solid var(--line); padding: .1rem 0 .1rem .8rem; }
.review-head { display: flex; align-items: center; gap: .5rem; }
.review-head b { font-size: .88rem; }
.review p { margin: .3rem 0 0; font-size: .9rem; }

/* ---------- my collection (on the archive page) ---------- */
.collection-section { margin-top: 1.5rem; border-top: 1px solid var(--line); }
.book-form { display: flex; flex-direction: column; gap: .6rem; margin-top: 1rem; }
.staged-list { display: flex; flex-direction: column; gap: .7rem; margin-top: 1rem; }
.staged { display: flex; align-items: center; gap: 1rem; background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); padding: .9rem 1rem; }
.staged .cover.sm { flex: 0 0 auto; }
.staged-body { display: flex; flex-direction: column; gap: .1rem; min-width: 0; flex: 1; }
.staged-body b { font-size: 1.05rem; }
.staged .btn { flex: 0 0 auto; }
@media (max-width: 560px) {
  .staged { flex-wrap: wrap; }
  .staged .btn { width: 100%; }
}

/* ---------- settings / admin ---------- */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: .9rem; }
.settings-grid .panel { display: flex; flex-direction: column; gap: .6rem; }
.settings-grid h4 { margin-top: 0; }
.settings-grid form { display: flex; flex-direction: column; gap: .6rem; }
.avatar.lg { width: 56px; height: 56px; font-size: 1.7rem; border-radius: 16px; }
.page-edit { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-top: .8rem; padding: .5rem .6rem; width: fit-content; max-width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; box-shadow: 0 8px 20px rgba(70, 45, 5, .08); }
.page-edit input[type="number"] { width: 5.2rem; text-align: center; font-weight: 700; border-radius: 999px; }
.page-edit .btn { border-radius: 999px; padding: .42rem .95rem; }
.save-note { margin: 0; color: var(--accent-strong); font-size: .82rem; }

.admin-list { display: flex; flex-direction: column; gap: .6rem; }
.admin-row {
  display: grid; grid-template-columns: auto minmax(9rem, 1fr) auto auto;
  align-items: center; gap: .7rem;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: .8rem 1rem;
}
.admin-id { display: flex; flex-direction: column; min-width: 0; }
.admin-name { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.admin-stats { display: flex; gap: .8rem; flex-wrap: wrap; font-size: .8rem; color: var(--muted); }
.admin-actions { display: flex; gap: .4rem; }
.admin-actions button { font-size: .8rem; padding: .3rem .55rem; }
.admin-actions button:disabled { opacity: .4; cursor: not-allowed; }
.chip.admin { --chip: #6d28d9; }
[data-theme="dark"] .chip.admin { --chip: #c4a5ff; }
.btn.danger { border: 1px solid var(--red); color: var(--red); background: transparent; }
.btn.danger:hover { background: var(--red); color: #fff; }
button.danger { border-color: color-mix(in srgb, var(--red) 45%, transparent); color: var(--red); }
button.danger:hover { background: var(--red); color: #fff; border-color: var(--red); }
.danger-zone { margin-top: 1.2rem; display: flex; flex-direction: column; gap: .6rem; align-items: flex-start; }
.danger-zone h4 { margin: 0; }

/* ---------- toast / boot error ---------- */
.toast { position: fixed; left: 50%; bottom: 1.4rem; transform: translateX(-50%); background: var(--red); color: #fff; padding: .6rem 1rem; border-radius: 10px; box-shadow: var(--shadow); z-index: 40; max-width: 90vw; }
.boot-error { max-width: 40rem; margin: 3rem auto; padding: 1rem 1.2rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--red); }

.empty { color: var(--muted); font-style: italic; padding: 1rem 0; }

/* ---------- responsive: the top bar stays, tabs move to the bottom ---------- */
@media (max-width: 760px) {
  #app-shell { padding-bottom: calc(4.4rem + env(safe-area-inset-bottom)); }
  .topbar { padding: .55rem .9rem; }
  .top-links { display: none; }
  .topbar .who { max-width: 9rem; }
  main { padding: 1rem .9rem 2.4rem; }
  footer { padding: .9rem .9rem 1.4rem; }
  .tabs {
    display: flex; justify-content: space-around; align-items: stretch;
    position: fixed; inset: auto 0 0 0; z-index: 20;
    padding: .25rem .3rem calc(.25rem + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: color-mix(in srgb, var(--bg) 92%, transparent);
    backdrop-filter: blur(10px);
  }
  .tab {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: .05rem;
    padding: .3rem .1rem; border-radius: 10px;
    color: var(--muted); text-decoration: none; font-size: .6rem;
    text-transform: uppercase; letter-spacing: .04em;
  }
  .tab svg { width: 22px; height: 22px; fill: currentColor; }
  .tab[aria-current="page"] { color: var(--accent-strong); background: var(--accent-soft); }

  .hero { grid-template-columns: 1fr; gap: 1.4rem; }
  .hero-cover { max-width: 210px; }
  .two-col { grid-template-columns: 1fr; }
  .detail-head { grid-template-columns: 1fr; }
  .detail-head .cover { max-width: 170px; }
  .post-head .chips { justify-content: flex-end; }
  .admin-row { grid-template-columns: auto 1fr; }
  .admin-stats, .admin-actions { grid-column: 2; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
