@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-display: swap; src: url("/fonts/ibm-plex-sans-400.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 500; font-display: swap; src: url("/fonts/ibm-plex-sans-500.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 600; font-display: swap; src: url("/fonts/ibm-plex-sans-600.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 500; font-display: swap; src: url("/fonts/ibm-plex-mono-500.woff2") format("woff2"); }

:root {
  --bg: #f4f1ea;
  --surface: #fffdf8;
  --ink: #1b1a17;
  --muted: #6b675e;
  --rule: #ddd7ca;
  --accent: #7a2e2e; /* oxblood: old leather bindings (the same in both themes) */
  --accent-ink: #fff;
  --accent-text: #7a2e2e; /* the accent as text (links, badges) */
  --chip: #ebe6da;
  --chip-ink: #514a3d; /* softer warm grey-brown text on the chips (7:1) */
  --shadow: 0 1px 2px rgb(0 0 0 / 0.06), 0 8px 24px rgb(0 0 0 / 0.06);
  --good: #3f8f1f;
  --mixed: #c99700;
  --bad: #d12f1f;
  --sans: "IBM Plex Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  /* statements are read, not scanned: a book face (the reader's own, nothing loaded) */
  --serif: "Iowan Old Style", "Charter", "Bitstream Charter", "Sitka Text", Cambria, Georgia, serif;
  color-scheme: light;
}
/* dark: the device's setting (unless light was chosen), or chosen (theme.js sets data-theme) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12110f;
    --surface: #1c1b18;
    --ink: #eeeae1;
    --muted: #9c978b;
    --rule: #33302a;
    --accent: #7a2e2e;
    --accent-text: #c98a7d; /* lighter as text, to read on the dark page */
    --accent-ink: #fff;
    --chip: #2a2824;
    --chip-ink: #cbc3b2;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 8px 24px rgb(0 0 0 / 0.3);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
    --bg: #12110f;
    --surface: #1c1b18;
    --ink: #eeeae1;
    --muted: #9c978b;
    --rule: #33302a;
    --accent: #7a2e2e;
    --accent-text: #c98a7d; /* lighter as text, to read on the dark page */
    --accent-ink: #fff;
    --chip: #2a2824;
    --chip-ink: #cbc3b2;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 8px 24px rgb(0 0 0 / 0.3);
    color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 16px/1.5 var(--sans); }
a { color: inherit; }
button, input, textarea, select { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }

.site-head { border-bottom: 1px solid var(--rule); }
.site-head .wrap { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding-top: 18px; padding-bottom: 14px; }
.brand { font-weight: 600; font-size: 1.1rem; text-decoration: none; letter-spacing: -0.01em; }
.brand span { color: var(--muted); font-weight: 400; }
.site-nav { display: flex; gap: 4px; margin-left: auto; }
.theme-switch { border: 1px solid var(--rule); background: none; color: var(--muted); border-radius: 7px; padding: 4px 9px; font-size: 0.8rem; cursor: pointer; white-space: nowrap; }
.theme-switch:hover { color: var(--ink); border-color: var(--muted); }
.account { display: flex; align-items: center; gap: 12px; font-size: 0.86rem; color: var(--muted); }
.account .who { color: var(--ink); font-weight: 600; }
.account a { color: var(--muted); }
.link { border: 0; background: none; padding: 0; color: var(--muted); text-decoration: underline; cursor: pointer; font-size: inherit; }
.people { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 10px; }
.people:empty { display: none; }
.people-label { font-size: 0.82rem; color: var(--muted); margin-right: 4px; }
/* the reading list: a book on several people's lists */
.entry.overlap { position: relative; }
/* several want to read it: a bookmark ribbon at the top right, and a quiet line under the title */
.entry.overlap::after { content: ""; position: absolute; top: -1px; right: 62px; width: 14px; height: 30px; background: var(--accent); opacity: 0.85;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 76%, 0 100%); pointer-events: none; }
.shared-read { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 2px; font: italic 0.95rem/1.5 var(--serif); color: var(--muted); }
.shared-read .person-chip { font-style: normal; }
.overlap-banner { position: relative; z-index: 2; padding: 7px 10px; background: linear-gradient(90deg, #a855f7, #ec4899); color: #fff; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.01em; text-align: center; }
.overlap-banner::before { content: "★ "; }
.meta.who { color: var(--ink); font-weight: 500; }
/* each user's color (app.js tint() sets --person and the readable --person-fg-light / --person-fg-dark): the name
   in their color, outlined, on a transparent background (as arthistory's changelog labels) */
.meta.who { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.person-chip { --person-fg: var(--person-fg-light, var(--ink)); display: inline-block; padding: 0 8px; border-radius: 999px;
  background: transparent; color: var(--person-fg); border: 1px solid currentColor;
  font-size: 0.8rem; font-weight: 600; line-height: 1.5; letter-spacing: 0; text-transform: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .person-chip { --person-fg: var(--person-fg-dark, var(--ink)); } }
:root[data-theme="dark"] .person-chip { --person-fg: var(--person-fg-dark, var(--ink)); }
.person-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--person, var(--muted)); box-shadow: 0 0 0 1px color-mix(in srgb, var(--ink) 30%, transparent); }
/* the people filter: like the name labels on the books (outlined, in their color); unticked: grey, dashed, struck */
.chip.tick.person { --person-fg: var(--person-fg-light, var(--ink)); font-weight: 600; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .chip.tick.person { --person-fg: var(--person-fg-dark, var(--ink)); } }
:root[data-theme="dark"] .chip.tick.person { --person-fg: var(--person-fg-dark, var(--ink)); }
.chip.tick.person[aria-pressed="true"] { background: transparent; color: var(--person-fg); border-color: currentColor; }
.chip.tick.person[aria-pressed="false"] { border-style: dashed; font-weight: 500; }
.note-label .person-chip { font-size: 0.7rem; padding: 0 7px; margin-right: 2px; }
.whose { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.whose legend { font-size: 0.9rem; margin-bottom: 4px; }
.whose #wantPeople { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.check { display: inline-flex; align-items: center; gap: 4px; }
.toast { position: fixed; z-index: 70; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; max-width: calc(100vw - 32px); padding: 10px 16px; border-radius: 10px; background: var(--ink); color: var(--bg); font-size: 0.9rem; box-shadow: var(--shadow); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: var(--bad); color: #fff; }
.btn:disabled { opacity: 0.6; }
.site-nav a { padding: 5px 11px; border-radius: 7px; text-decoration: none; font-size: 0.9rem; font-weight: 500; color: var(--muted); }
.site-nav a:hover { color: var(--ink); background: var(--chip); }
.site-nav a[aria-current="page"] { color: var(--ink); background: var(--chip); }

.intro { padding: 40px 0 8px; }
.intro h1 { font-size: clamp(2rem, 5vw, 3rem); line-height: 1.05; letter-spacing: -0.03em; margin: 0 0 12px; }
.intro p { color: var(--muted); margin: 0; font-size: 1.05rem; }

.filters { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; padding: 22px 0 18px; }
.search { flex: 0 1 340px; min-width: 0; padding: 9px 12px; border: 1px solid var(--rule); border-radius: 8px; background: var(--surface); }
.pick { display: flex; align-items: center; gap: 6px; font-size: 0.85rem; color: var(--muted); }
.pick select { padding: 7px 28px 7px 10px; border: 1px solid var(--rule); border-radius: 8px; background: var(--surface); color: var(--ink); }
.count { color: var(--muted); font-size: 0.85rem; margin: 10px 0 14px; min-height: 1.2em; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid transparent; background: var(--chip); color: var(--chip-ink); border-radius: 999px; padding: 4px 12px; font-size: 0.85rem; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
/* genres: ticked = shown, unticked = left out */
.chip.tick { display: inline-flex; align-items: center; gap: 6px; padding-left: 8px; }
.chip.tick .box { width: 13px; height: 13px; border-radius: 3px; border: 1.5px solid currentColor; display: inline-grid; place-items: center; font-size: 10px; line-height: 1; }
.chip.tick[aria-pressed="true"] { background: var(--chip); color: var(--chip-ink); }
.chip.tick[aria-pressed="true"] .box::after { content: "✓"; font-weight: 700; }
.chip.tick[aria-pressed="false"] { background: transparent; color: var(--muted); border-color: var(--rule); text-decoration: line-through; }
.chip.all:disabled { opacity: 0.45; cursor: default; }
.genre-hint { margin: 8px 0 0; font-size: 0.82rem; color: var(--muted); }

/* ---------- the shelf: one book per row, the statements first ---------- */
.shelf { display: flex; flex-direction: column; gap: 18px; padding-bottom: 56px; }
.entry { position: relative; display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 8px 26px; padding: 24px 26px 22px;
  background: var(--surface); border-radius: 14px; box-shadow: var(--shadow); scroll-margin: 24px; }
.entry > .overlap-banner { grid-column: 1 / -1; margin: -24px -26px 6px; border-radius: 14px 14px 0 0; }
/* the book a shared link points at: marked for as long as the address points at it */
.entry.linked { outline: 3px solid var(--accent); outline-offset: 3px; }
@keyframes arrived { 0%, 100% { outline-offset: 3px; } 50% { outline-offset: 9px; } }
.entry.arrived { animation: arrived 0.6s ease-in-out 0.2s 2; }
.linked-label { align-self: flex-start; padding: 2px 8px; border-radius: 6px; background: var(--accent); color: var(--accent-ink); font-size: 0.68rem; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; }
.btn.share.done { color: var(--good); border-color: var(--good); }

/* the cover: small, a thing to recognise the book by, not the subject */
.entry-cover { align-self: start; display: block; width: 112px; padding: 0; border: 0; background: none; cursor: pointer; border-radius: 4px; position: sticky; top: 16px; }
.entry-cover img, .entry-cover .no-cover { width: 112px; aspect-ratio: 2 / 3; height: auto; object-fit: cover; border-radius: 3px 5px 5px 3px;
  box-shadow: 0 1px 1px rgb(0 0 0 / 0.12), 0 4px 12px rgb(0 0 0 / 0.14), inset 3px 0 0 rgb(0 0 0 / 0.08); transition: transform 0.2s ease; }
.entry-cover:hover img, .entry-cover:focus-visible img { transform: translateY(-2px) rotate(-1deg); }
.no-cover { display: flex; flex-direction: column; justify-content: center; gap: 6px; padding: 10px; background: linear-gradient(160deg, var(--chip), color-mix(in srgb, var(--accent) 22%, var(--chip)));
  color: var(--ink); font: 600 0.8rem/1.25 var(--serif); text-align: center; overflow: hidden; }
.no-cover small { font: 400 0.7rem/1.2 var(--sans); color: var(--muted); }

.entry-main { min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.entry-head { display: flex; flex-direction: column; gap: 6px; }
.title { margin: 0; font: 600 1.35rem/1.2 var(--serif); letter-spacing: -0.005em; }
.title-link { padding: 0; border: 0; background: none; font: inherit; color: inherit; text-align: left; cursor: pointer; text-decoration: none; }
.title-link:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.title .subtitle { display: block; margin-top: 2px; font: 400 0.98rem/1.35 var(--serif); font-style: italic; color: var(--muted); }
.byline { margin: 0; display: flex; flex-wrap: wrap; color: var(--muted); font-size: 0.9rem; }
.byline .authors { color: var(--ink); font-weight: 500; }
.byline > * + *::before { content: "·"; margin: 0 9px; color: var(--muted); opacity: 0.6; }
.meta { color: var(--muted); font-size: 0.86rem; margin: 0; }
.genres { display: flex; flex-wrap: wrap; gap: 4px; }
.genres span { background: var(--chip); color: var(--chip-ink); border-radius: 4px; padding: 1px 7px; font-size: 0.76rem; }

/* each person's statement: the main thing, set for reading */
.note { margin: 0; padding: 2px 0 2px 18px; border-left: 3px solid var(--person, var(--accent)); }
.note-label { display: block; margin-bottom: 6px; font-size: 0.7rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.note-label .person-chip { font-size: 0.74rem; padding: 0 8px; text-transform: none; letter-spacing: 0; }
.note .rich { font: 400 1.13rem/1.65 var(--serif); color: var(--ink); hyphens: auto; }
.note .rich p { margin: 0 0 0.75em; }
.note-empty { margin: 0; color: var(--muted); font-style: italic; }

/* Markdown texts (my statement): rendered by the server, see server/src/rich.js */
.rich > :first-child { margin-top: 0; }
.rich > :last-child { margin-bottom: 0; }
.rich p, .rich ul, .rich ol, .rich blockquote, .rich table, .rich pre { margin: 0 0 0.6em; }
.rich ul, .rich ol { padding-left: 1.3em; }
.rich h1, .rich h2, .rich h3, .rich h4, .rich h5, .rich h6 { font-size: 1em; margin: 0.8em 0 0.3em; }
.rich h1, .rich h2 { font-size: 1.08em; }
.rich a { color: var(--accent-text); }
.rich a.movie-link, .rich a.title-link { text-decoration-style: dotted; text-underline-offset: 2px; }
.rich .missing { color: var(--muted); text-decoration: underline dotted; }
.rich mark { background: color-mix(in srgb, #facc15 55%, transparent); color: inherit; padding: 0 2px; border-radius: 2px; }
.rich code { font-family: var(--mono); font-size: 0.88em; background: var(--chip); padding: 1px 4px; border-radius: 3px; }
.rich pre { background: var(--chip); padding: 8px 10px; border-radius: 6px; overflow-x: auto; }
.rich pre code { background: none; padding: 0; }
.rich hr { border: 0; border-top: 1px solid var(--rule); margin: 0.8em 0; }
.rich blockquote { padding-left: 10px; border-left: 3px solid var(--rule); color: var(--muted); }
.rich table { border-collapse: collapse; font-size: 0.92em; display: block; overflow-x: auto; }
.rich th, .rich td { border: 1px solid var(--rule); padding: 3px 7px; }
.rich li.task { list-style: none; margin-left: -1.2em; }
.rich li.task-done { color: var(--muted); text-decoration: line-through; }
.rich .task-box { text-decoration: none; display: inline-block; }
.spoiler { border-radius: 3px; cursor: pointer; transition: color 0.15s, background 0.15s; }
.spoiler:not(.shown) { color: transparent; background: var(--ink); user-select: none; }
.spoiler:not(.shown) img { visibility: hidden; }
.callout { --c: #3b82f6; color: var(--ink) !important; border: 1px solid color-mix(in srgb, var(--c) 35%, transparent) !important; border-left: 4px solid var(--c) !important; border-radius: 6px; padding: 8px 10px !important; background: color-mix(in srgb, var(--c) 9%, transparent); }
.callout-title { font-weight: 600; color: var(--c); margin-bottom: 2px !important; }
.callout-tip, .callout-example { --c: #16a34a; }
.callout-warning, .callout-important { --c: #ea580c; }
.callout-question, .callout-todo { --c: #a855f7; }
.callout-quote { --c: #78716c; }
img.emote { display: inline-block; height: 1.75em; width: auto; vertical-align: middle; margin: -0.3em 0.05em; }
.emote-tip { position: fixed; z-index: 50; pointer-events: none; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 10px; border-radius: 8px; background: var(--surface); border: 1px solid var(--rule); box-shadow: var(--shadow); font: 500 0.75rem/1 var(--mono); color: var(--muted); }
.emote-tip img { max-width: 112px; max-height: 112px; width: auto; height: auto; }
/* the plot: as wide as the statements */
.overview summary { cursor: pointer; color: var(--muted); font-size: 0.86rem; width: max-content; }
.overview summary:hover { color: var(--ink); }
.overview p { margin: 8px 0 0; font-size: 0.95rem; line-height: 1.6; color: var(--muted); white-space: pre-line; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-top: 2px; }


.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); font-weight: 500; font-size: 0.92rem; text-decoration: none; cursor: pointer; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--rule); }
.btn.small { padding: 5px 10px; font-size: 0.85rem; }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn.danger { background: transparent; color: var(--bad); border-color: var(--rule); }
.btn.btn-bad { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.ghost.remove-mine { color: var(--bad); }

.empty, .status { color: var(--muted); padding: 32px 0; }

dialog { border: 0; border-radius: 14px; padding: 0; width: min(420px, calc(100vw - 32px)); background: var(--surface); color: var(--ink); box-shadow: 0 20px 60px rgb(0 0 0 / 0.35); }
dialog::backdrop { background: rgb(0 0 0 / 0.55); }
.dialog-body { padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.dialog-body h2 { margin: 0; font-size: 1.2rem; }
.dialog-body p { margin: 0; color: var(--muted); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.field { display: flex; flex-direction: column; gap: 5px; font-size: 0.9rem; }
.field input, .field textarea, .field select { padding: 9px 11px; border: 1px solid var(--rule); border-radius: 8px; background: var(--bg); width: 100%; }
.field small { color: var(--muted); font-size: 0.8rem; }
.dialog-body .dialog-alt { font-size: 0.85rem; }
.dialog-body .consent { align-items: flex-start; gap: 8px; font-size: 0.85rem; color: var(--muted); }
.dialog-body .consent input { margin-top: 3px; }
#signup .dialog-body { max-height: calc(100dvh - 32px); overflow-y: auto; }
.msg { font-size: 0.9rem; margin: 0; }
.msg.bad { color: var(--bad); }
.msg.ok { color: var(--good); }
dialog.detail { width: min(980px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow: hidden; display: none; }
dialog.detail[open] { display: block; }
.detail-body { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 32px; padding: 32px; max-height: calc(100dvh - 32px); overflow-y: auto; }
.detail-cover img, .detail-cover .no-cover { width: 180px; aspect-ratio: 2 / 3; height: auto; object-fit: cover; border-radius: 3px 6px 6px 3px; position: sticky; top: 0;
  box-shadow: 0 2px 2px rgb(0 0 0 / 0.12), 0 10px 28px rgb(0 0 0 / 0.18); }
.detail-info { display: flex; flex-direction: column; gap: 14px; min-width: 0; padding-right: 28px; }
.detail-info .title { font-size: 1.7rem; }
.detail-info h3 { margin: 8px 0 0; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.detail-info .meta { font-size: 0.92rem; }
.detail-info .actions { margin-top: 10px; }
.detail-info .overlap-banner { position: static; border-radius: 8px; }
.detail-close { position: absolute; top: 10px; right: 10px; z-index: 2; width: 38px; height: 38px; border: 0; border-radius: 50%; background: var(--chip); color: var(--ink); font-size: 1.5rem; line-height: 1; cursor: pointer; }
.detail-close:hover { background: var(--rule); }

/* feedback (feedback.js) */
.fb-button { position: fixed; z-index: 60; right: 16px; bottom: 16px; display: inline-flex; align-items: center; height: 40px; min-width: 40px; padding: 0 14px; border: 0; border-radius: 20px; background: var(--ink); color: var(--bg); font: 600 0.95rem/1 var(--sans); cursor: pointer; box-shadow: var(--shadow); }
.fb-button .fb-word { max-width: 0; overflow: hidden; white-space: nowrap; transition: max-width 0.2s; }
.fb-button:hover .fb-word, .fb-button:focus-visible .fb-word, .fb-button[aria-expanded="true"] .fb-word { max-width: 80px; }
.fb-panel { position: fixed; z-index: 61; right: 16px; bottom: 66px; width: min(380px, calc(100vw - 32px)); max-height: calc(100vh - 90px); overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; border-radius: 12px; background: var(--surface); border: 1px solid var(--rule); box-shadow: 0 20px 60px rgb(0 0 0 / 0.3); }
.fb-head { display: flex; justify-content: space-between; align-items: center; }
.fb-close { border: 0; background: none; color: var(--muted); font-size: 1.4rem; line-height: 1; cursor: pointer; }
.fb-kinds { display: flex; flex-wrap: wrap; gap: 6px; }
.fb-kinds label { cursor: pointer; }
.fb-kinds input { position: absolute; opacity: 0; pointer-events: none; }
.fb-kinds span { display: inline-block; padding: 4px 11px; border-radius: 999px; background: var(--chip); font-size: 0.82rem; }
.fb-kinds input:checked + span { background: var(--ink); color: var(--bg); }
.fb-kinds input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.fb-pick-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fb-hint { font-size: 0.78rem; color: var(--muted); }
.fb-picked { list-style: none; margin: 0; padding: 0; font-size: 0.8rem; display: flex; flex-direction: column; gap: 4px; }
.fb-picked:empty { display: none; }
.fb-picked li { display: flex; justify-content: space-between; gap: 8px; padding: 4px 8px; border-radius: 6px; background: var(--chip); }
.fb-bar { position: fixed; z-index: 62; left: 50%; bottom: 16px; transform: translateX(-50%); display: flex; align-items: center; gap: 12px; padding: 8px 10px 8px 16px; border-radius: 12px; background: var(--ink); color: var(--bg); font-size: 0.88rem; box-shadow: var(--shadow); }
.fb-picking .fb-button { display: none; }
.fb-picking * { cursor: crosshair !important; }
.fb-hover { outline: 2px dashed var(--accent) !important; outline-offset: 2px; }
.fb-shown { outline: 3px solid #e11d48 !important; outline-offset: 3px; }
@media (max-width: 600px) { .fb-button { right: 12px; bottom: 12px; height: 36px; min-width: 36px; padding: 0 12px; } .fb-panel { right: 12px; bottom: 58px; } }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.site-foot { border-top: 1px solid var(--rule); color: var(--muted); font-size: 0.85rem; }
.credits { display: flex; align-items: flex-start; gap: 10px; flex: 1 1 420px; min-width: 0; }
.credits p { margin: 0; line-height: 1.45; }
.site-foot .wrap { display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between; padding-top: 18px; padding-bottom: 28px; }

.prose { max-width: 46rem; padding-bottom: 48px; }
.prose h1 { font-size: 2rem; letter-spacing: -0.02em; margin: 36px 0 4px; }
.prose h2 { font-size: 1.1rem; margin: 28px 0 6px; }
.prose .updated { color: var(--muted); margin-top: 0; }
.table-wrap { overflow-x: auto; }
.prose table { border-collapse: collapse; font-size: 0.9rem; width: 100%; }
.prose th, .prose td { text-align: left; vertical-align: top; border-bottom: 1px solid var(--rule); padding: 8px 10px 8px 0; }

/* wide screens: the filter panel is just part of the row; the toggle and the short labels are for phones */
.filter-panel, .genre-area { display: contents; }
.filter-toggle { display: none; }
.filter-badge { color: var(--accent-text); }

/* ---------- phones: tidy and compact ---------- */
@media (max-width: 600px) {
  .site-head .wrap { padding-top: 12px; padding-bottom: 10px; align-items: center; }
  .site-nav a { padding: 4px 9px; font-size: 0.85rem; }
  .site-head .wrap { flex-wrap: wrap; row-gap: 6px; }
  .site-nav { margin-left: 0; order: 3; }
  .account { margin-left: auto; font-size: 0.8rem; gap: 10px; }
  .theme-switch { padding: 3px 7px; font-size: 0.74rem; }

  .intro { padding: 18px 0 2px; }
  .intro h1 { font-size: 1.6rem; margin-bottom: 10px; }
  .intro p { font-size: 0.9rem; }

  /* search and "Sort & filter" in one row; the rest opens below */
  .filters { flex-wrap: wrap; gap: 8px; padding: 14px 0 10px; }
  .search { flex: 1 1 0; }
  .filter-toggle { display: inline-flex; flex: none; padding: 8px 12px; }
  .filter-panel, .genre-area { display: none; }
  .filters-open .filter-panel { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; flex-basis: 100%; }
  .filters-open .genre-area { display: block; margin-bottom: 4px; }
  .pick { flex-direction: column; align-items: stretch; gap: 2px; min-width: 0; font-size: 0.78rem; }
  .pick select { min-width: 0; width: 100%; padding: 6px 24px 6px 8px; }
  #reset { grid-column: 1 / -1; justify-self: start; }
  .chips { gap: 5px; }
  .chip { font-size: 0.78rem; padding: 3px 9px; }
  .count { margin: 4px 0 10px; }

  .pick { flex: 1 1 100%; }
  /* the shelf on a phone: the cover small beside the title, the statements across the whole width */
  .shelf { gap: 14px; }
  .entry { grid-template-columns: 64px minmax(0, 1fr); gap: 4px 14px; padding: 16px 16px 14px; border-radius: 12px; }
  .entry > .overlap-banner { margin: -16px -16px 6px; border-radius: 12px 12px 0 0; }
  .entry-cover { width: 64px; position: static; }
  .entry-cover img, .entry-cover .no-cover { width: 64px; }
  .no-cover { font-size: 0.6rem; padding: 4px; }
  .no-cover small { display: none; }
  .entry-main { display: contents; }
  .entry-head { grid-column: 2; gap: 4px; }
  .entry-main > :not(.entry-head) { grid-column: 1 / -1; }
  .entry .note:first-of-type { margin-top: 10px; }
  .title { font-size: 1.1rem; }
  .title .subtitle { font-size: 0.86rem; }
  .byline { font-size: 0.8rem; }
  .byline > * + *::before { margin: 0 6px; }
  .genres span { font-size: 0.7rem; padding: 0 5px; }
  .entry .genres { display: none; }
  .note { padding-left: 12px; margin-top: 8px; }
  .note .rich { font-size: 1.04rem; line-height: 1.6; }
  .overview { margin-top: 8px; }
  .actions { margin-top: 8px; gap: 6px; }
  .actions .btn { padding: 6px 10px; font-size: 0.8rem; }
  .actions .ext { flex-basis: 100%; margin-left: 0; }

  dialog .dialog-body { padding: 18px; gap: 12px; }
  .site-foot .wrap { font-size: 0.78rem; }
  .prose h1 { font-size: 1.6rem; margin-top: 22px; }
}

/* My account: the Telegram bot's link and QR code */
.bot-link { display: flex; gap: 16px; align-items: flex-start; }
.bot-link .steps { flex: 1; margin: 0; }
.bot-qr { flex: none; display: block; padding: 6px; background: #fff; border-radius: 10px; line-height: 0; }
.bot-qr img { width: 140px; height: auto; }
@media (max-width: 560px) { .bot-link { flex-direction: column; } .bot-qr { align-self: center; } }

/* My color: the suggestions, any color, the preview (the chip and dot styles come from style.css) */
.swatches { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 10px; }
.swatch { position: relative; width: 34px; height: 34px; border: 0; border-radius: 50%; background: var(--person); color: var(--person-ink); cursor: pointer;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ink) 20%, transparent); font: 600 0.8rem/1 var(--sans, inherit); display: grid; place-items: center; }
.swatch[aria-pressed="true"] { outline: 3px solid var(--ink); outline-offset: 2px; }
.swatch:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.color-row { gap: 10px; }
.color-pick { display: inline-flex; align-items: center; gap: 8px; font-size: 0.9rem; white-space: nowrap; }
.color-pick input[type="color"] { width: 44px; height: 32px; padding: 2px; border: 1px solid var(--rule); border-radius: 8px; background: var(--bg); cursor: pointer; }

/* ---------- logged in: adding from the search, the statement dialog, the account panel (account.js) ---------- */
.me-button { display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; padding: 0; cursor: pointer; font: inherit; }
.me-button .person-chip { font-size: 0.86rem; padding: 2px 10px; }
.me-button .person-chip::after { content: " ▾"; font-size: 0.7em; }
.me-unread, .acc-badge { min-width: 18px; padding: 1px 5px; border-radius: 999px; background: var(--bad); color: #fff; font-size: 0.7rem; font-weight: 700; text-align: center; line-height: 1.4; }

.add-box { margin: 0 0 18px; padding: 14px 16px; border: 1px solid var(--rule); border-radius: 12px; background: var(--surface); }
.add-head { margin: 0 0 10px; font-size: 1rem; }
.add-results { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.add-item { display: grid; grid-template-columns: 46px 1fr auto; gap: 12px; align-items: center; }
.add-item img, .add-ph { width: 46px; height: 69px; border-radius: 4px; object-fit: cover; background: var(--chip); }
.add-info { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.add-info strong { font-size: 0.95rem; }
.add-info .year { color: var(--muted); font-weight: 400; }
.add-kind { font-size: 0.8rem; color: var(--muted); }
.add-sub { font-size: 0.8rem; color: var(--muted); font-style: italic; }
.add-info p { margin: 0; font-size: 0.82rem; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.add-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.add-on { font-size: 0.85rem; color: var(--good); font-weight: 600; }
.add-wait { color: var(--muted); font-size: 0.9rem; }

dialog#rate { width: min(680px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow-y: auto; }
#rate textarea { min-height: 200px; resize: vertical; font: 400 1.05rem/1.6 var(--serif); }
#rate .rich { font: 400 1.05rem/1.6 var(--serif); }
.rate-preview { border: 1px dashed var(--rule); border-radius: 8px; padding: 8px 10px; }
.rate-preview-label { display: block; font-size: 0.7rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin-bottom: 2px; }

dialog.account-panel { width: min(760px, calc(100vw - 32px)); height: min(820px, calc(100dvh - 32px)); display: none; flex-direction: column; }
dialog.account-panel[open] { display: flex; }
.acc-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px 6px; }
.acc-head h2 { margin: 0; font-size: 1.2rem; }
.acc-close { border: 0; background: none; color: var(--ink); font-size: 1.6rem; line-height: 1; width: 36px; height: 36px; border-radius: 8px; cursor: pointer; }
.acc-close:hover { background: var(--chip); }
.acc-tabs { display: flex; gap: 4px; padding: 0 16px; border-bottom: 1px solid var(--rule); overflow-x: auto; }
.acc-tabs button { display: inline-flex; align-items: center; gap: 6px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--muted); padding: 10px 10px; font: inherit; font-size: 0.92rem; cursor: pointer; white-space: nowrap; }
.acc-tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }
.acc-body { flex: 1; overflow-y: auto; padding: 14px 20px 20px; }
.acc-hint { margin: 0; font-size: 0.85rem; color: var(--muted); }
.acc-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.acc-row.between { justify-content: space-between; margin-bottom: 10px; }
.acc-row > input:not([type="color"]) { flex: 1 1 200px; min-width: 0; padding: 8px 10px; border: 1px solid var(--rule); border-radius: 8px; background: var(--bg); color: var(--ink); font: inherit; }
.acc-switch { display: inline-flex; border: 1px solid var(--rule); border-radius: 999px; padding: 2px; margin-bottom: 8px; }
.acc-switch button { border: 0; background: none; color: var(--muted); padding: 5px 14px; border-radius: 999px; font: inherit; font-size: 0.88rem; cursor: pointer; }
.acc-switch button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.acc-list, .acc-requests, .acc-chats { list-style: none; margin: 10px 0 0; padding: 0; }
.acc-item, .acc-requests li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 0; border-bottom: 1px solid var(--rule); }
.acc-item img, .acc-item .add-ph { width: 40px; height: 60px; border-radius: 4px; object-fit: cover; background: var(--chip); flex: none; }
.acc-info { flex: 1 1 200px; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 0.85rem; color: var(--muted); }
.acc-info strong { color: var(--ink); font-size: 0.95rem; }
.acc-tag { align-self: flex-start; padding: 0 8px; border-radius: 999px; background: var(--chip); color: var(--ink); font-size: 0.72rem; font-weight: 600; }
.acc-tag.both { background: linear-gradient(90deg, #a855f7, #ec4899); color: #fff; }
.acc-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-left: auto; }
.acc-need { font-size: 0.82rem; color: var(--muted); }
.acc-requests li.unread .acc-info { color: var(--ink); }
.acc-requests li.unread { box-shadow: inset 3px 0 0 var(--accent); padding-left: 10px; }
.acc-date { font-size: 0.78rem; }
.acc-empty { padding: 18px 0; color: var(--muted); font-size: 0.9rem; }
.acc-form { display: flex; flex-direction: column; gap: 8px; }
.acc-form h3 { margin: 14px 0 2px; font-size: 1rem; display: flex; align-items: center; gap: 8px; }
.acc-form h3:first-of-type { margin-top: 6px; }
.acc-state { font-size: 0.75rem; font-weight: 500; padding: 1px 8px; border-radius: 999px; background: var(--chip); color: var(--muted); }
.acc-chats li { display: flex; align-items: center; gap: 10px; padding: 4px 0; font-size: 0.9rem; }
.acc-form .steps { padding-left: 20px; }
.acc-toast { position: absolute; left: 50%; bottom: 16px; transform: translate(-50%, 20px); max-width: calc(100% - 32px); padding: 9px 14px; border-radius: 10px; background: var(--ink); color: var(--bg); font-size: 0.88rem; opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; z-index: 5; }
.acc-toast.show { opacity: 1; transform: translate(-50%, 0); }
.acc-toast.bad { background: var(--bad); color: #fff; }
@media (max-width: 560px) {
  dialog.account-panel { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; }
  .acc-body { padding: 12px 14px 18px; }
  .add-item { grid-template-columns: 40px 1fr; }
  .add-item img, .add-item .add-ph { width: 40px; height: 60px; }
  .add-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .acc-actions { margin-left: 52px; }
}

@media (max-width: 640px) {
  .detail-body { grid-template-columns: 1fr; gap: 16px; padding: 16px; }
  .detail-cover { width: 120px; margin: 0 auto; }
  .detail-cover img, .detail-cover .no-cover { width: 120px; position: static; }
  .detail-info { padding-right: 0; }
  .detail-info .title { font-size: 1.3rem; padding-right: 36px; }
  .detail-info .genres span { font-size: 0.74rem; padding: 1px 7px; }
}

/* the Telegram link code (site panel and CMS) */
.tg-code { display: inline-block; padding: 1px 8px; border-radius: 6px; background: var(--chip); color: var(--ink); font: 600 1rem/1.5 var(--mono, monospace); letter-spacing: 0.08em; user-select: all; }
.acc-delete { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--rule); }
.acc-delete h3 { color: var(--bad); }

/* suggestions while typing a statement on the site (":emote", "[[title"), as in the CMS editor */
.suggest { position: fixed; z-index: 60; list-style: none; margin: 0; padding: 4px; max-height: 260px; overflow-y: auto; background: var(--surface); border: 1px solid var(--rule); border-radius: 8px; box-shadow: var(--shadow); }
.suggest li { display: flex; align-items: center; gap: 8px; padding: 4px 8px; border-radius: 5px; cursor: pointer; font-size: 0.88rem; }
.suggest li[aria-selected="true"] { background: var(--chip); }
.suggest li img { width: 28px; height: 28px; object-fit: contain; flex: none; }
.suggest li.wiki img { width: 22px; height: 33px; object-fit: cover; border-radius: 3px; }

/* a statement that is a spoiler as a whole: a heavy blur and "Spoiler" over it until clicked */
.spoiler-wrap { position: relative; min-height: 3.4em; border-radius: 8px; }
.spoiler-wrap > .rich { filter: blur(10px); user-select: none; pointer-events: none; transition: filter 0.3s ease; }
.spoiler-wrap.shown > .rich { filter: none; user-select: auto; pointer-events: auto; }
.spoiler-cover { position: absolute; inset: 0; display: grid; place-items: center; width: 100%; border: 0; border-radius: 8px; background: transparent; cursor: pointer; }
.spoiler-cover span { padding: 6px 16px; border-radius: 999px; background: var(--ink); color: var(--bg); font-size: 0.8rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; box-shadow: 0 2px 10px rgb(0 0 0 / 0.25); }
.spoiler-cover:hover span, .spoiler-cover:focus-visible span { background: var(--accent); color: var(--accent-ink); }
.spoiler-cover:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.spoiler-wrap.shown .spoiler-cover { display: none; }


/* the writing dialog: Review | Discussion */
.mode { display: inline-flex; align-self: flex-start; border: 1px solid var(--rule); border-radius: 9px; overflow: hidden; }
.mode button { border: 0; background: none; padding: 6px 16px; font: inherit; font-size: 0.9rem; font-weight: 500; color: var(--muted); cursor: pointer; }
.mode button + button { border-left: 1px solid var(--rule); }
.mode button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.mode button:disabled { opacity: 0.45; cursor: not-allowed; }
.mode-note { margin: 0; padding: 8px 12px; border-radius: 8px; background: var(--chip); color: var(--ink); font-size: 0.86rem; }


/* the discussion under the reviews: folded; every message blurred until one is clicked, then all are shown */
.talk { margin: 4px 0 0; border: 1px solid var(--rule); border-radius: 10px; }
.talk > summary { display: flex; align-items: baseline; gap: 8px; padding: 7px 12px; cursor: pointer; list-style: none; font-size: 0.86rem; }
.talk > summary::-webkit-details-marker { display: none; }
.talk > summary::before { content: "▸"; color: var(--muted); font-size: 0.8em; transition: transform 0.15s; }
.talk[open] > summary::before { transform: rotate(90deg); }
.talk-title { font-weight: 600; }
.talk-count { color: var(--muted); font-size: 0.8rem; }
.talk-body { display: flex; flex-direction: column; gap: 10px; padding: 4px 12px 12px; }
.talk-msg { padding-left: 10px; border-left: 3px solid var(--person, var(--rule)); }
.talk-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 4px; font-size: 0.8rem; }
.talk-head .person-chip { font-size: 0.72rem; padding: 0 7px; }
.talk-time { color: var(--muted); }
.talk-act { font-size: 0.78rem; color: var(--muted); }
.talk-act.bad { color: var(--bad); }
.talk-text { position: relative; min-height: 2.6em; }
.talk-text .rich { font-size: 0.93rem; transition: filter 0.3s ease; }
.talk-body:not(.shown) .talk-text .rich { filter: blur(9px); user-select: none; pointer-events: none; }
.talk-text .spoiler-cover { position: absolute; inset: 0; display: grid; place-items: center; width: 100%; border: 0; border-radius: 8px; background: transparent; cursor: pointer; }
.talk-text .spoiler-cover span { padding: 4px 12px; border-radius: 999px; background: var(--ink); color: var(--bg); font-size: 0.7rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; box-shadow: 0 2px 10px rgb(0 0 0 / 0.25); }
.talk-text .spoiler-cover:hover span, .talk-text .spoiler-cover:focus-visible span { background: var(--accent); color: var(--accent-ink); }
.talk-body.shown .spoiler-cover { display: none; }
.talk-write { align-self: flex-start; }
.talk-hint { margin: 0; color: var(--muted); font-size: 0.82rem; }

/* small icon buttons: share (top right of an entry), "−" to take my book off my list (bottom right), edit my statement */
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 1px solid transparent; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; transition: color 0.15s, background 0.15s, border-color 0.15s; }
.icon-btn:hover, .icon-btn:focus-visible { color: var(--ink); background: var(--chip); }
.icon-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.entry > .share-icon { position: absolute; top: 14px; right: 14px; }
.entry-head { padding-right: 34px; } /* the title stays clear of the share icon */
.remove-icon { width: 24px; height: 24px; border-color: var(--rule); font-size: 1rem; line-height: 1; opacity: 0.7; }
.remove-icon:hover, .remove-icon:focus-visible { opacity: 1; color: var(--bad); border-color: var(--bad); background: transparent; }
.entry > .remove-icon { position: absolute; bottom: 14px; right: 14px; }
.note.mine { position: relative; padding-right: 40px; }
.note .edit-icon { position: absolute; right: 0; bottom: -6px; width: 30px; height: 30px; }
.actions:empty { display: none; }
.byline .ext { color: var(--muted); }
.byline .ext:hover { color: var(--ink); }
.detail-icons { display: flex; align-items: center; gap: 8px; }
.detail-icons .remove-icon { margin-left: auto; }

