/* ==========================================================================
   Book Rat — a modern literary bookshop aesthetic
   Display: Fraunces · Reading: Spectral · UI: Inter
   ========================================================================== */

:root {
  --paper: #f6efe2;
  --paper-2: #eee4d2;
  --card: #fffdf8;
  --ink: #2a2018;
  --ink-soft: #5f5446;
  --muted: #8a7d6a;
  --line: #ddcdb2;
  --line-strong: #c8b48d;
  --accent: #7a2b24;
  --accent-deep: #5d1f1a;
  --accent-soft: #f3e1da;
  --brass: #a9791f;
  --high: #3f6b4a;
  --mid: #35617f;
  --warn: #a9761a;
  --low: #9c3a32;

  --radius: 6px;
  --radius-sm: 4px;
  --radius-lg: 10px;
  --shadow-card: 0 1px 0 #fff inset, 0 14px 28px -22px rgba(42, 32, 24, .65);
  --shadow-book: 0 22px 44px -28px rgba(42, 32, 24, .8);

  --font-head: "Fraunces", Georgia, "Times New Roman", serif;
  --font-serif: "Spectral", Georgia, "Times New Roman", serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  background-color: var(--paper);
  background-image:
    radial-gradient(1100px 520px at 50% -8%, rgba(255, 255, 255, .75), rgba(255, 255, 255, 0) 62%),
    repeating-linear-gradient(0deg, rgba(122, 43, 36, .02) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, rgba(122, 43, 36, .02) 0 1px, transparent 1px 3px),
    linear-gradient(180deg, #f8f2e7 0%, #f1e7d6 100%);
  background-attachment: fixed;
}

h1, h2, h3, h4 {
  font-family: var(--font-head);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -.012em;
  margin: 0 0 .45em;
  color: var(--ink);
}
h1 { font-size: clamp(2rem, 1.2rem + 2.6vw, 3rem); font-weight: 700; }
h2 { font-size: clamp(1.45rem, 1.1rem + 1.1vw, 2rem); }
h3 { font-size: 1.2rem; }

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-deep); }

p { margin: 0 0 1rem; }
img { max-width: 100%; display: block; }

::selection { background: var(--accent-soft); color: var(--accent-deep); }

:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 2px;
  border-radius: 2px;
}

.wrap { width: min(1140px, 92vw); margin-inline: auto; }
.wrap-wide { width: min(1280px, 94vw); }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.grow { flex: 1 1 auto; }
.inline { display: inline; }
.link { font-weight: 600; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: -999px; top: 0; background: var(--ink); color: #fff;
  padding: .6rem 1rem; z-index: 100;
}
.skip-link:focus { left: 1rem; top: 1rem; }

/* ------------------------------------------------------------------ Header */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: rgba(247, 241, 230, .92);
  backdrop-filter: saturate(150%) blur(10px);
  border-bottom: 3px double var(--line-strong);
}
.header-inner {
  display: flex; align-items: center; gap: 1.1rem;
  padding: .85rem 0; flex-wrap: wrap;
}

/* Desktop: the wrapper is transparent, so nav/search/account sit in the
   header row exactly as before. It becomes a dropdown only on phones. */
.nav-menu { display: contents; }
.nav-toggle {
  display: none; align-items: center; justify-content: center; width: 44px; height: 40px;
  background: var(--card); border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  color: var(--ink); cursor: pointer; padding: 0;
}
.nav-toggle:hover { background: var(--paper-2); }
.nav-toggle svg { display: block; }

.brand { display: flex; align-items: center; gap: .65rem; color: var(--ink); white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 38px; height: auto; display: block; flex: 0 0 auto; }
.brand-name {
  font-family: var(--font-head); font-weight: 700; font-size: 1.4rem; letter-spacing: -.01em;
}

.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.site-nav { display: flex; gap: .95rem; margin-inline-start: .3rem; flex-wrap: wrap; }
.site-nav a {
  color: var(--ink-soft); font-weight: 600; font-size: .74rem;
  text-transform: uppercase; letter-spacing: .08em;
}
.site-nav a:hover { color: var(--accent); text-decoration: none; }

.nav-search { margin-inline-start: auto; position: relative; }
.nav-search input {
  width: 200px; padding: .5rem .75rem; border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); background: var(--card); font: inherit; font-size: .9rem;
  color: var(--ink);
}

.nav-account { display: flex; align-items: center; gap: .55rem; flex-wrap: wrap; }

/* ----------------------------------------------------------------- Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .55rem 1rem; border-radius: var(--radius-sm); font-weight: 600; font-size: .88rem;
  letter-spacing: .015em; border: 1.5px solid transparent; cursor: pointer;
  font-family: inherit; transition: background .15s ease, color .15s ease, border-color .15s ease, transform .06s ease;
}
.btn:active { transform: translateY(1px); }
.btn:hover { text-decoration: none; }
.btn-primary {
  background: var(--accent); color: #fff; border-color: var(--accent-deep);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .18) inset, 0 8px 18px -12px rgba(122, 43, 36, .9);
}
.btn-primary:hover { background: var(--accent-deep); color: #fff; }
.btn-ghost { background: var(--card); border-color: var(--line-strong); color: var(--ink); }
.btn-ghost:hover { background: var(--paper-2); }
.link-btn {
  background: none; border: 0; color: var(--ink-soft); cursor: pointer;
  font: inherit; font-size: .88rem; padding: .4rem;
}
.link-btn:hover { color: var(--accent); text-decoration: underline; }
.danger { color: var(--low); }
.row-actions { white-space: nowrap; }
.row-actions a { margin-right: .6rem; }

/* ---------------------------------------------------------------- Messages */
.messages { margin-top: 1rem; }
.message {
  padding: .75rem 1rem; border-radius: var(--radius-sm); margin-bottom: .6rem;
  border: 1px solid var(--line-strong); background: var(--card); font-size: .92rem;
  border-left-width: 4px;
}
.message-error { border-left-color: var(--low); color: var(--accent-deep); background: #fdf1ee; }
.message-success { border-left-color: var(--high); color: #245038; background: #eef5ef; }
.message-warning { border-left-color: var(--warn); color: #6f4f12; background: #faf3df; }

/* -------------------------------------------------------------------- Hero */
.hero {
  display: grid; grid-template-columns: 1.25fr .9fr; gap: 3rem;
  padding: 3.6rem 0 2.6rem; align-items: center;
}
.eyebrow {
  text-transform: uppercase; letter-spacing: .18em; font-size: .72rem;
  font-weight: 700; color: var(--brass); margin-bottom: .9rem;
}
.eyebrow::before { content: "❧ "; color: var(--accent); }
.hero h1 { max-width: 15ch; }
.lede { font-family: var(--font-serif); font-size: 1.18rem; color: var(--ink-soft); max-width: 52ch; }
.hero-actions { display: flex; gap: .7rem; margin: 1.5rem 0 .9rem; flex-wrap: wrap; }
.hero-meta {
  color: var(--muted); font-size: .82rem; letter-spacing: .04em;
  text-transform: uppercase;
}
.hero-meta::before {
  content: ""; display: inline-block; width: 26px; height: 1px;
  background: var(--line-strong); vertical-align: middle; margin-right: .6rem;
}

.hero-featured {
  position: relative; display: block; color: var(--ink);
  background: var(--card); border: 1px solid var(--line-strong); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-book);
}
.hero-featured:hover { text-decoration: none; transform: translateY(-3px); transition: transform .18s ease; }
.hero-featured::before {
  content: ""; position: absolute; top: -9px; right: 30px; width: 26px; height: 68px;
  background: linear-gradient(180deg, var(--accent), var(--accent-deep));
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 82%, 0 100%);
  filter: drop-shadow(0 4px 4px rgba(42, 32, 24, .3)); z-index: 2;
}
.hero-featured img {
  width: 100%; aspect-ratio: 16/10; object-fit: cover;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.hero-featured-body { padding: 1.1rem 1.3rem 1.35rem; }
.hero-featured h2 { font-size: 1.4rem; margin-bottom: .05rem; }

/* -------------------------------------------------------------- Pills/chips */
.pill {
  display: inline-block; font-size: .68rem; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; padding: .28rem .65rem; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
}
.pill-draft { background: #faf3df; color: #7a5c12; border-color: #e6d3a4; }
.pill-muted { background: var(--paper-2); color: var(--muted); border-color: var(--line); }
.chip {
  display: inline-block; font-size: .74rem; padding: .22rem .65rem; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--card); color: var(--ink-soft);
  transition: border-color .15s ease, color .15s ease;
}
.chip:hover { text-decoration: none; border-color: var(--accent); color: var(--accent); }
.chip-tag { color: var(--brass); }

/* ----------------------------------------------------------------- Sections */
.section { padding: 2.2rem 0; }
.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 1rem; margin-bottom: 1.3rem; border-bottom: 1px solid var(--line);
  padding-bottom: .7rem;
}
.section-head h2 { margin: 0; }
.section-head h2::before { content: "❧"; color: var(--brass); margin-right: .55rem; font-size: .8em; }
.empty { color: var(--muted); padding: 2rem 0; font-family: var(--font-serif); font-style: italic; }

/* --------------------------------------------------- Score mark (logo badge) */
.score-mark {
  --seal: var(--muted);
  display: inline-block; width: 54px; line-height: 0;
  filter: drop-shadow(0 5px 8px -5px rgba(42, 32, 24, .55));
}
.score-mark-lg { width: 104px; }
.score-mark.is-high { --seal: var(--high); }
.score-mark.is-mid { --seal: var(--mid); }
.score-mark.is-warn { --seal: var(--warn); }
.score-mark.is-low { --seal: var(--low); }
.score-mark-svg { display: block; width: 100%; height: auto; }

.mark-shield { fill: var(--seal); }
.mark-inner { fill: none; stroke: var(--card); stroke-width: 1.6; opacity: .5; }
.mark-fur { fill: var(--card); }
.mark-hole { fill: var(--seal); }
.mark-whisker { stroke: var(--card); stroke-width: 1.2; stroke-linecap: round; }
.mark-num {
  fill: var(--card); font-family: var(--font-head); font-weight: 700;
  font-size: 42px; text-anchor: middle;
}
.mark-word {
  display: none; fill: var(--card); font-family: var(--font-head);
  font-weight: 600; font-size: 8px; letter-spacing: 1px; text-anchor: middle;
}
.score-mark-lg .mark-word { display: block; }

/* ------------------------------------------------------------ Review grid */
.review-grid {
  display: grid; gap: 1.3rem;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
}
.review-card {
  position: relative; display: flex; gap: 1rem; padding: 1rem 1rem 1rem calc(1rem + 7px);
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-card); overflow: hidden;
}
.review-card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 7px;
  background: linear-gradient(180deg, var(--accent), var(--accent-deep));
}
.review-card:hover { border-color: var(--line-strong); }

/* Stretched link: the whole card navigates, except raised secondary links. */
.review-card-link::after {
  content: ""; position: absolute; inset: 0; z-index: 1; border-radius: var(--radius);
}
.review-card-cover,
.review-card .chip,
.review-author-link { position: relative; z-index: 2; }
.review-author-link { color: var(--ink-soft); }
.review-author-link:hover { color: var(--accent); }

.review-card-cover {
  position: relative; flex: 0 0 86px; width: 86px; height: 128px;
  border-radius: 2px 5px 5px 2px; background: var(--paper-2);
  box-shadow: 0 10px 18px -12px rgba(42, 32, 24, .85);
  overflow: visible;
}
.review-card-cover img {
  width: 100%; height: 100%; object-fit: cover; border-radius: 2px 5px 5px 2px;
}
.review-card-cover::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 9px; border-radius: 2px 0 0 2px;
  background: linear-gradient(90deg, rgba(0, 0, 0, .32), rgba(0, 0, 0, 0));
}
.review-card-cover::after {
  content: ""; position: absolute; top: 2px; bottom: 2px; right: -4px; width: 4px;
  border-radius: 0 2px 2px 0;
  background: repeating-linear-gradient(180deg, var(--card) 0 2px, #e4d7bf 2px 3px);
}
.cover-placeholder {
  display: grid; place-items: center; height: 100%; width: 100%;
  border-radius: 2px 5px 5px 2px; border: 1px solid var(--line-strong);
  font-family: var(--font-head); font-size: 2.3rem; font-weight: 700; color: var(--accent);
  background: linear-gradient(135deg, #fbf4e6, #ecdfc8);
}
.review-card-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.review-card-text { display: block; }
.review-card-text .score-mark {
  float: right; width: 54px; flex: none; margin: 0 0 .45rem .7rem;
}
.review-card h3 { font-size: 1.12rem; margin-bottom: .15rem; }
.review-card .review-author { margin: 0 0 .55rem; }
.review-card h3 a { color: var(--ink); }
.review-card h3 a:hover { color: var(--accent); }
.review-card .clamp {
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
  font-family: var(--font-serif); font-size: .94rem; color: var(--ink-soft);
}
.review-card-foot {
  margin-top: auto; padding-top: .6rem; display: flex; gap: .4rem; align-items: center; flex-wrap: wrap;
}
.review-card-foot .small { font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ Filters */
.page-head { padding: 2.6rem 0 1.1rem; }
.page-head h1 { margin-bottom: .2rem; }
.filters {
  display: flex; gap: .8rem; align-items: flex-end; flex-wrap: wrap;
  padding: 1rem 1.1rem; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); margin-bottom: 1.5rem; box-shadow: var(--shadow-card);
}
.field { display: flex; flex-direction: column; gap: .3rem; margin-bottom: .9rem; }
.field label, .field .label {
  font-weight: 600; font-size: .76rem; text-transform: uppercase; letter-spacing: .09em; color: var(--ink-soft);
}
.field input:not([type="checkbox"]):not([type="radio"]),
.field select, .field textarea, .score-note {
  font: inherit; padding: .55rem .7rem; border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); background: var(--card); color: var(--ink); width: 100%;
}
.field select {
  appearance: none; -webkit-appearance: none;
  padding-right: 2.1rem; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%238a7d6a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .8rem center;
}
.field input:focus, .field select:focus, .field textarea:focus,
.score-note:focus {
  outline: 2px solid color-mix(in srgb, var(--brass) 55%, transparent);
  outline-offset: 0; border-color: var(--brass);
}
.filters select { min-width: 150px; }
.help { font-size: .8rem; color: var(--muted); }

.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--line); border-top-color: var(--accent);
  animation: spin .7s linear infinite; display: inline-block;
}
.htmx-indicator { opacity: 0; visibility: hidden; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; visibility: visible; }
@keyframes spin { to { transform: rotate(360deg); } }

.pagination { display: flex; align-items: center; gap: 1rem; justify-content: center; padding: 1.7rem 0; }

/* ----------------------------------------------------------- Review detail */
.review-detail { padding: 2.6rem 0 3rem; }
.review-hero { display: flex; gap: 2.2rem; align-items: flex-start; margin-bottom: 1.5rem; }
.review-cover {
  position: relative; flex: 0 0 208px; width: 208px; aspect-ratio: 2/3;
  border-radius: 3px 7px 7px 3px; background: var(--paper-2);
  box-shadow: var(--shadow-book);
}
.review-cover img { width: 100%; height: 100%; object-fit: cover; border-radius: 3px 7px 7px 3px; }
.review-cover::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 12px; border-radius: 3px 0 0 3px;
  background: linear-gradient(90deg, rgba(0, 0, 0, .3), rgba(0, 0, 0, 0));
}
.review-cover::after {
  content: ""; position: absolute; top: 3px; bottom: 3px; right: -5px; width: 5px;
  border-radius: 0 3px 3px 0;
  background: repeating-linear-gradient(180deg, var(--card) 0 3px, #e4d7bf 3px 4px);
}
.review-cover .cover-placeholder { font-size: 4rem; }

.review-headline { flex: 1 1 auto; }
.subtitle { font-family: var(--font-serif); font-size: 1.25rem; color: var(--ink-soft); font-style: italic; margin-top: -.3rem; }
.byline { font-family: var(--font-serif); font-size: 1.1rem; color: var(--ink-soft); }
.series-line { font-family: var(--font-serif); font-style: italic; color: var(--muted); margin-top: -.5rem; }
.byline::before { content: "— "; color: var(--line-strong); }
.score-summary { display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap; margin: .9rem 0 .4rem; padding-bottom: 1.4rem; }
.score-meter { flex: 1 1 240px; height: 10px; background: var(--paper-2); border-radius: 999px; overflow: hidden; border: 1px solid var(--line); }
.score-meter span { display: block; height: 100%; background: linear-gradient(90deg, var(--brass), var(--high)); }
.review-meta { display: flex; gap: 1.2rem; color: var(--muted); font-size: .82rem; flex-wrap: wrap; text-transform: uppercase; letter-spacing: .06em; }
.review-meta a { color: var(--ink-soft); text-decoration: underline; text-decoration-color: var(--line-strong); }
.owner-actions { margin-top: .9rem; }
.review-summary {
  font-family: var(--font-serif); font-size: 1.22rem; font-style: italic; color: var(--ink-soft);
  border-left: 4px solid var(--accent); padding: .2rem 0 .2rem 1.2rem; margin: 1.2rem 0;
  max-width: 72ch; margin-inline: auto;
}
.review-detail .rich-content { max-width: 72ch; margin-inline: auto; }

/* ------------------------------------------------------------------- Panels */
.panel {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.5rem 1.7rem; margin-bottom: 1.5rem; box-shadow: var(--shadow-card);
}
.panel-title {
  font-size: 1.18rem; margin-bottom: 1.1rem; padding-bottom: .55rem;
  border-bottom: 1px solid var(--line);
}
.panel-title::before { content: "❧"; color: var(--brass); margin-right: .5rem; font-size: .82em; }
.panel-title-link { float: right; font-family: var(--font-body); font-size: .76rem; font-weight: 600; letter-spacing: .02em; }

/* -------------------------------------------------------- Score breakdown */
.breakdown { display: grid; gap: 1.1rem; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); }
.breakdown-category {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: .95rem 1.05rem;
}
.breakdown-category.muted { opacity: .7; }
.breakdown-head { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; margin-bottom: .55rem; }
.breakdown-head h3 { font-size: .98rem; margin: 0; letter-spacing: .01em; }
.breakdown-head .points {
  font-size: .74rem; color: var(--muted); font-weight: 600; white-space: nowrap;
  text-transform: uppercase; letter-spacing: .05em; font-variant-numeric: tabular-nums;
}
.breakdown-items { list-style: none; margin: 0; padding: 0; }
.breakdown-items li {
  display: flex; justify-content: space-between; align-items: baseline; gap: .5rem;
  flex-wrap: wrap;
  font-size: .9rem; padding: .2rem 0; color: var(--muted);
  border-bottom: 1px dotted var(--line-strong);
}
.breakdown-items .item-name,
.breakdown-items .item-points { background: var(--paper); padding-inline: .3rem; }
.breakdown-items li.has-points { color: var(--ink); font-weight: 600; }
.breakdown-items .item-points { font-variant-numeric: tabular-nums; margin-left: auto; }
.item-weight { color: var(--muted); font-weight: 600; }
.breakdown-items li.has-points .item-weight { color: var(--accent); font-weight: 700; }
.breakdown-items .item-name {
  display: inline-flex; align-items: center; gap: .55rem; min-width: 0;
}

/* --------------------------------------------------- Details / catalogue */
.meta-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 0 1.4rem; margin: 0; }
.meta-list > div { padding: .6rem 0; border-bottom: 1px dotted var(--line); }
.meta-list dt { font-size: .7rem; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); font-weight: 600; }
.meta-list dd { margin: .15rem 0 0; font-family: var(--font-serif); font-size: 1.05rem; }

/* ---------------------------------------------------------- Rich content */
.rich-content, .prose { font-family: var(--font-serif); font-size: 1.08rem; line-height: 1.78; color: #33291f; }
.static-page { margin-top: 2.6rem; margin-bottom: 2rem; }
.rich-content h2, .rich-content h3 { font-family: var(--font-head); margin-top: 1.4rem; }
.rich-content blockquote {
  border-left: 3px solid var(--brass); margin: 1.1rem 0; padding: .2rem 0 .2rem 1.1rem;
  color: var(--ink-soft); font-style: italic;
}
.rich-content a { text-decoration: underline; text-decoration-color: var(--brass); text-underline-offset: 2px; }
.rich-content > p:first-of-type::first-letter {
  font-family: var(--font-head); font-weight: 700; font-size: 3.3em; line-height: .74;
  float: left; padding: .08em .12em 0 0; color: var(--accent);
}
.reviewer-note { background: #fbf6ea; border-left: 4px solid var(--brass); }
.category-note { border-left: 4px solid var(--accent); }

.review-foot { margin-top: 1.5rem; margin-bottom: 1.5rem; }
.tags { display: flex; gap: .5rem; flex-wrap: wrap; }

/* ----------------------------------------------------------- How it works */
.how-grid { display: grid; gap: 1.1rem; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.how-card {
  position: relative; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.3rem 1.3rem 1.3rem 1.5rem; box-shadow: var(--shadow-card);
}
.how-card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px;
  background: linear-gradient(180deg, var(--brass), var(--accent));
  border-radius: var(--radius) 0 0 var(--radius);
}
.how-card h3 { font-size: 1.05rem; }
.how-card p { margin: 0; color: var(--ink-soft); font-family: var(--font-serif); font-size: 1rem; }

/* -------------------------------------------------------------- Review form */
.review-form .panel-title { font-size: 1.35rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.span-2 { grid-column: 1 / -1; }
.isbn-row { display: flex; gap: .8rem; align-items: flex-end; }
.isbn-btn { white-space: nowrap; margin-bottom: .9rem; }
.checkbox-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .5rem;
}
.checkbox-grid > div { display: contents; }
.checkbox-grid label {
  display: flex; align-items: center; gap: .55rem; margin: 0;
  padding: .55rem .75rem; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--card); cursor: pointer; font-weight: 500; font-size: .9rem;
  line-height: 1.25; text-transform: none; letter-spacing: normal; color: var(--ink);
  transition: border-color .15s ease, background .15s ease, color .15s ease;
}
.checkbox-grid label:hover { border-color: var(--line-strong); background: var(--paper-2); }
.checkbox-grid label:has(input:checked) {
  border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600;
}
.checkbox-grid input[type="checkbox"] {
  width: 1.05rem; height: 1.05rem; margin: 0; flex: 0 0 auto; accent-color: var(--accent);
}

.score-panel-head {
  position: sticky; top: 4.25rem; z-index: 15;
  display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap;
  background: var(--card); padding: .5rem 0 .7rem; border-bottom: 1px solid var(--line);
}
.live-score-wrap { display: flex; align-items: center; gap: .7rem; }
.live-score-wrap .score-mark { width: 96px; }
.live-score-caption {
  font-family: var(--font-body); font-size: .62rem; text-transform: uppercase;
  letter-spacing: .12em; color: var(--muted); font-weight: 600;
}

.score-category { border-top: 1px solid var(--line); padding: 1.15rem 0; }
.score-category:first-of-type { margin-top: .6rem; }
.score-category-head { display: flex; align-items: center; gap: .7rem; }
.score-category-head h3 { margin: 0; }
.score-item { display: grid; gap: .5rem; padding: .8rem 0; border-bottom: 1px dashed var(--line); }
.score-item-head { display: flex; align-items: baseline; gap: .7rem; flex-wrap: wrap; }
.score-item-name { font-weight: 600; font-size: .95rem; }
.prevalence { display: flex; flex-wrap: wrap; gap: .4rem; }
.prevalence label {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  padding: .4rem .8rem; border: 1px solid var(--line-strong); border-radius: 999px;
  background: var(--card); font-size: .82rem; font-weight: 600; color: var(--ink-soft);
  cursor: pointer; user-select: none; text-transform: none; letter-spacing: normal;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.prevalence input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.prevalence label:hover { border-color: var(--accent); color: var(--accent); }
.prevalence label:has(input:focus-visible) { outline: 2px solid var(--brass); outline-offset: 2px; }
.prevalence label:has(input:checked) { color: #fff; border-color: transparent; }
.prev-none:has(input:checked) { background: var(--high); }
.prev-rare:has(input:checked) { background: #b08a1f; }
.prev-common:has(input:checked) { background: #c2671c; }
.prev-frequent:has(input:checked) { background: var(--accent); }
.score-note { font-size: .88rem; }

.prev-tag {
  display: inline-block; font-size: .72rem; font-weight: 700; letter-spacing: .02em;
  padding: .06rem .5rem; border-radius: 999px; white-space: nowrap;
}
.prev-tag.prev-none { background: color-mix(in srgb, var(--high) 16%, transparent); color: var(--high); }
.prev-tag.prev-rare { background: #f5edcf; color: #8a6a14; }
.prev-tag.prev-common { background: #f8e4cb; color: #a4531a; }
.prev-tag.prev-frequent { background: var(--accent-soft); color: var(--accent); }
.required-mark { color: var(--low); font-weight: 700; }

.form-actions { display: flex; gap: .8rem; padding: 1rem 0 3rem; }
.quill-wrap { border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--line-strong); }
.quill-editor { min-height: 140px; background: var(--card); }
.ql-toolbar.ql-snow, .ql-container.ql-snow { border-color: var(--line); font-family: var(--font-body); background: var(--card); }
.ql-editor { min-height: 140px; font-size: 1.02rem; font-family: var(--font-serif); }

/* -------------------------------------------------------------------- Auth */
.auth-wrap { display: flex; justify-content: center; padding: 3.2rem 0; }
.auth-card {
  position: relative; width: min(660px, 94vw); background: var(--card);
  border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: var(--shadow-book);
  padding: 2.2rem 2.2rem 2rem;
}
.auth-card::before {
  content: "❧"; position: absolute; top: -1.05rem; left: 50%; transform: translateX(-50%);
  background: var(--card); color: var(--brass); padding: 0 .6rem; font-size: 1.1rem;
}
.auth-card.narrow { width: min(460px, 94vw); }
.auth-card h1 { font-size: 2rem; }
.auth-alt { margin-top: 1.3rem; font-size: .92rem; color: var(--muted); }
.errorlist { list-style: none; margin: .2rem 0; padding: 0; color: var(--low); font-size: .84rem; }
.auth-card form p { display: flex; flex-direction: column; gap: .3rem; margin-bottom: .9rem; }
.auth-card form label { font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-soft); }
.auth-card form input:not([type="checkbox"]),
.auth-card form textarea {
  font: inherit; padding: .55rem .7rem; border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); background: var(--card); width: 100%;
}

/* --------------------------------------------------------------- Dashboard */
.dash-head {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  flex-wrap: wrap; padding: 2.6rem 0 1.1rem;
}
.stats { display: flex; gap: 1rem; }
.stat {
  background: var(--card); border: 1px solid var(--line-strong); border-radius: var(--radius);
  padding: .8rem 1.2rem; min-width: 100px; text-align: center;
  box-shadow: inset 0 0 0 3px var(--card), inset 0 0 0 4px var(--line); color: var(--ink);
}
.stat .num { font-family: var(--font-head); font-size: 1.8rem; font-weight: 700; display: block; color: var(--accent); }
.stat .lbl { font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.review-table {
  width: 100%; border-collapse: collapse; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow-card);
}
.review-table th, .review-table td { padding: .85rem 1rem; text-align: left; border-bottom: 1px dotted var(--line-strong); font-size: .92rem; }
.review-table th {
  background: var(--paper-2); font-size: .7rem; text-transform: uppercase;
  letter-spacing: .1em; color: var(--muted); border-bottom: 1px solid var(--line-strong);
}
.review-table tr:last-child td { border-bottom: 0; }
.review-table tbody tr:hover { background: #fbf6ea; }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: .45rem; background: var(--line-strong); }
.status-published { background: var(--high); }
.status-draft { background: var(--warn); }
.review-table tr.is-mine { background: #fbf6ea; }
.queue-pick select { width: 100%; max-width: 520px; }

/* ------------------------------------------------------------------ Authors */
.author-grid { display: grid; gap: 1.3rem; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); }
.author-card {
  display: flex; gap: 1rem; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.3rem; box-shadow: var(--shadow-card); color: var(--ink);
}
.author-card:hover { border-color: var(--line-strong); text-decoration: none; }
.author-card > span:last-child { display: block; min-width: 0; }
.author-card h3 { margin: 0; }
.author-avatar {
  flex: 0 0 64px; width: 64px; height: 64px; border-radius: 50%; overflow: hidden;
  display: grid; place-items: center; font-family: var(--font-head); font-weight: 700;
  color: var(--accent); font-size: 1.5rem; background: var(--accent-soft);
  border: 2px solid var(--accent); box-shadow: inset 0 0 0 3px var(--card), inset 0 0 0 4px color-mix(in srgb, var(--accent) 40%, transparent);
}
.author-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.author-avatar.large { flex-basis: 108px; width: 108px; height: 108px; font-size: 2.6rem; }
.author-profile { display: flex; align-items: center; gap: 1.6rem; }
.author-profile h1 { margin-bottom: .2rem; }

/* ------------------------------------------------------------------- Footer */
.site-footer {
  border-top: 3px double var(--line-strong); margin-top: 3.5rem; background-color: var(--paper-2);
  background-image:
    repeating-linear-gradient(45deg, rgba(122, 43, 36, .04) 0 9px, transparent 9px 18px),
    repeating-linear-gradient(-45deg, rgba(169, 121, 31, .05) 0 9px, transparent 9px 18px);
}
.footer-inner { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1.7rem 0; flex-wrap: wrap; }
.footer-brand { margin: 0; color: var(--ink-soft); font-size: .92rem; font-family: var(--font-serif); font-style: italic; }
.footer-brand::before { content: "❦ "; color: var(--brass); font-style: normal; }
.site-footer nav { display: flex; gap: 1.1rem; flex-wrap: wrap; }
.site-footer nav a {
  color: var(--ink-soft); font-size: .76rem; text-transform: uppercase; letter-spacing: .09em; font-weight: 600;
}

/* --------------------------------------------------------------- Responsive */
@media (min-width: 1024px) {
  .nav-search { flex: 1 1 180px; min-width: 120px; max-width: 240px; }
  .nav-search input { width: 100%; }
}

@media (max-width: 1023px) {
  .hero { grid-template-columns: 1fr; gap: 2rem; padding-top: 2.4rem; }
  .hero-featured { order: -1; }
  .nav-search { order: 3; width: 100%; margin-inline-start: 0; }
  .nav-search input { width: 100%; }
  .review-hero { flex-direction: column; gap: 1.5rem; }
  .review-cover { flex-basis: auto; width: 170px; }
  .grid-2 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .author-profile { flex-direction: column; align-items: flex-start; gap: 1rem; }
}

/* ------------------------------------------------------------- Feedback */
.feedback-panel { max-width: 780px; margin-inline: auto; }
.comparison { text-align: center; }
.compare-form {
  display: grid; gap: .9rem 1rem; max-width: 660px; margin-inline: auto;
  grid-template-columns: 1fr auto 1fr;
  grid-template-areas:
    "q q q"
    "a vs b"
    "actions actions actions";
}
.compare-question {
  grid-area: q;
  font-family: var(--font-serif); font-size: 1.2rem; color: var(--ink-soft);
  margin: 0 0 .2rem;
}
.compare-item-a { grid-area: a; }
.compare-item-b { grid-area: b; }
.compare-vs {
  grid-area: vs; display: grid; place-items: center; align-self: center;
  font-family: var(--font-head); font-style: italic; color: var(--muted); font-size: 1.1rem;
}
.compare-item {
  display: flex; flex-direction: column; justify-content: center; gap: .35rem;
  min-height: 104px; padding: 1.1rem 1rem; border: 1px solid var(--line-strong);
  border-radius: var(--radius); background: var(--paper);
}
.compare-cat {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .12em;
  color: var(--brass); font-weight: 700;
}
.compare-name { font-family: var(--font-head); font-size: 1.35rem; font-weight: 600; line-height: 1.15; }
.compare-actions { grid-area: actions; display: flex; gap: .5rem; justify-content: center; flex-wrap: wrap; }
.verdict-btn { flex: 1 1 120px; }
.arw { font-weight: 700; opacity: .75; margin-inline: .18rem; }
.arw-v { display: none; }
.arw-h { display: inline; }
.hp-field { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.verdict-btn.is-far { background: var(--accent); color: #fff; border-color: var(--accent-deep); }
.verdict-btn.is-far:hover { background: var(--accent-deep); color: #fff; }
.verdict-btn.is-more { background: var(--accent-soft); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.verdict-btn.is-more:hover { background: color-mix(in srgb, var(--accent) 22%, var(--card)); color: var(--accent-deep); }
.verdict-btn.is-same { background: var(--card); color: var(--ink-soft); border-color: var(--line-strong); }
.verdict-btn.is-same:hover { background: var(--paper-2); color: var(--ink); }
.compare-count { margin-top: 1.2rem; }

/* Vertical form on phones: first item, choices, second item. */
@media (max-width: 767px) {
  .compare-form {
    grid-template-columns: 1fr; max-width: 440px; gap: .8rem;
    grid-template-areas: "q" "a" "actions" "b";
  }
  .compare-vs { display: none; }
  .compare-actions { display: grid; grid-template-columns: 1fr; justify-content: stretch; }
  .verdict-btn { width: 100%; }
  .arw-h { display: none; }
  .arw-v { display: inline; }
}

/* -------------------------------------------------------- Report a review */
.report-panel { padding: 1rem 1.7rem; }
.report-details summary {
  cursor: pointer; list-style: none; font-family: var(--font-head);
  font-weight: 600; font-size: 1.05rem; color: var(--ink);
}
.report-details summary::-webkit-details-marker { display: none; }
.report-details summary::before { content: "⚑ "; color: var(--brass); }
.report-details[open] summary { margin-bottom: .5rem; }
.report-details form { margin-top: .5rem; max-width: 560px; }

/* ------------------------------------------------------- Search suggestions */
.search-suggestions { position: absolute; top: calc(100% + .35rem); left: 0; right: 0; z-index: 60; }
.search-suggestions:empty { display: none; }
.suggest-list {
  list-style: none; margin: 0; padding: .3rem; max-height: 60vh; overflow: auto;
  background: var(--card); border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-book);
}
.suggest-list a { display: block; padding: .45rem .6rem; border-radius: var(--radius-sm); color: var(--ink); }
.suggest-list a:hover { background: var(--paper-2); text-decoration: none; }
.suggest-title { display: block; font-family: var(--font-head); font-weight: 600; line-height: 1.2; }
.suggest-author { display: block; font-size: .8rem; color: var(--muted); }
.suggest-all {
  display: block; padding: .5rem .7rem; font-size: .82rem; font-weight: 600;
  background: var(--paper-2); border: 1px solid var(--line-strong); border-top: 0;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}
.suggest-empty {
  margin: 0; padding: .55rem .7rem; font-size: .85rem; color: var(--muted);
  background: var(--card); border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
}

/* --------------------------------------------------------- Scoring page */
.notice {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  flex-wrap: wrap; padding: 1rem 1.3rem; margin-bottom: 1.4rem;
  background: #fbf6ea; border: 1px solid var(--brass);
  border-left: 4px solid var(--brass); border-radius: var(--radius);
}
.notice p { margin: 0; color: var(--ink-soft); }
.notice strong { color: var(--ink); }
.notice .btn { flex: 0 0 auto; }
.score-formula code {
  display: block; overflow-x: auto; padding: .9rem 1rem; margin: .4rem 0 1rem;
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius-sm); font-size: .95rem;
}
.score-subhead { margin-top: 1.4rem; }
.score-weights { border-top: 1px solid var(--line); padding-top: 1.1rem; margin-top: 1.1rem; }
.score-weights-head { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.score-weights-head h3 { margin: 0; }
.score-table { width: 100%; border-collapse: collapse; margin: .5rem 0 0; }
.score-table th {
  text-align: left; font-size: .68rem; text-transform: uppercase; letter-spacing: .1em;
  color: var(--muted); font-weight: 700; padding: .3rem .4rem; border-bottom: 1px solid var(--line-strong);
}
.score-table td { padding: .35rem .4rem; border-bottom: 1px dotted var(--line); font-size: .94rem; }
.score-table td.num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; color: var(--accent); width: 4rem; }
.curve-table { max-width: 320px; }
.score-weights .score-table { max-width: 420px; }
.updated-note { font-family: var(--font-serif); font-style: italic; color: var(--ink-soft); margin: 0 0 1.4rem; }
.snapshot-weights { display: grid; gap: 0 1.4rem; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }

/* ============================================================ Mobile pass */
h1, h2, h3, h4, .compare-name, .review-card h3 a, .rich-content { overflow-wrap: anywhere; }

/* Horizontally scrollable tables (dashboard). */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-scroll .review-table { min-width: 540px; }

@media (max-width: 767px) {
  /* Keep the header in normal flow (so the sticky score can float) but
     establish a positioning context for the dropdown menu. */
  .site-header { position: relative; }
  .score-panel-head { top: .5rem; }

  .nav-toggle { display: inline-flex; margin-inline-start: auto; }
  .nav-menu {
    display: none; position: absolute; left: 0; right: 0; top: 100%;
    flex-direction: column; align-items: stretch; flex-wrap: nowrap;
    gap: .8rem; padding: 1rem 4vw 1.2rem; margin: 0;
    background: var(--paper); border-bottom: 3px double var(--line-strong);
    box-shadow: var(--shadow-book); z-index: 30;
  }
  .nav-menu.is-open { display: flex; }
  .site-nav { flex-direction: column; gap: .1rem; margin: 0; }
  .site-nav a { padding: .55rem 0; font-size: .82rem; letter-spacing: .08em; }
  .nav-search { order: 0; margin-inline-start: 0; width: 100%; }
  .nav-search input { width: 100%; }
  .nav-account { justify-content: flex-start; }
}

@media (max-width: 640px) {
  .header-inner { gap: .45rem .6rem; padding: .7rem 0; }
  .brand-name { font-size: 1.22rem; }
  .brand-mark { width: 32px; }
  .nav-account { gap: .4rem; }
  .nav-account .btn { padding: .45rem .7rem; font-size: .82rem; }

  /* ISBN lookup: field full width, button below. */
  .isbn-row { flex-wrap: wrap; }
  .isbn-row .field { flex: 1 1 100%; }
  .isbn-btn { width: 100%; margin: .2rem 0 .7rem; }

  /* Centre the review hero. */
  .review-hero { align-items: center; text-align: center; }
  .review-cover { flex-basis: auto; width: 150px; margin-inline: auto; }
  .score-summary { justify-content: center; }
  .review-meta { justify-content: center; }

  .live-score-wrap .score-mark { width: 84px; }
  .report-panel { padding: .9rem 1.1rem; }

  h1 { font-size: clamp(1.7rem, 1.2rem + 3vw, 2.2rem); }
  .panel { padding: 1.15rem 1.15rem; }
  .hero { padding: 1.8rem 0 1.4rem; gap: 1.4rem; }
  .section { padding: 1.6rem 0; }
}

/* ------------------------------------------------------- Genre picker */
.genre-picker { position: relative; }
.genre-selected { display: flex; flex-wrap: wrap; gap: .4rem; }
.genre-selected:not(:empty) { margin-bottom: .5rem; }
.genre-chip {
  display: inline-flex; align-items: center; gap: .35rem; padding: .3rem .55rem .3rem .7rem;
  background: var(--accent-soft); color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: 999px; font-size: .82rem; font-weight: 600;
}
.chip-remove { background: none; border: 0; color: inherit; cursor: pointer; font-size: 1.05rem; line-height: 1; padding: 0 .1rem; }
.chip-remove:hover { color: var(--accent-deep); }
.genre-search-input {
  width: 100%; font: inherit; padding: .55rem .7rem; border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); background: var(--card); color: var(--ink);
}
.genre-results { position: absolute; left: 0; right: 0; z-index: 30; margin-top: .25rem;
  background: var(--card); border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-book); max-height: 280px; overflow: auto; padding: .25rem; }
.genre-results:empty { display: none; }
.genre-result {
  display: block; width: 100%; text-align: left; background: none; border: 0; cursor: pointer;
  font: inherit; font-size: .9rem; padding: .45rem .55rem; border-radius: var(--radius-sm); color: var(--ink);
}
.genre-result:hover { background: var(--paper-2); }
.genre-noresult { display: block; padding: .5rem .55rem; color: var(--muted); font-size: .88rem; }

/* --------------------------------------------------- Tag suggestions */
.tag-suggestions { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; margin-top: .5rem; }
.tag-chip {
  background: var(--card); border: 1px solid var(--line-strong); border-radius: 999px;
  font: inherit; font-size: .78rem; padding: .25rem .65rem; cursor: pointer; color: var(--ink-soft);
}
.tag-chip:hover { border-color: var(--accent); color: var(--accent); }
.tag-chip.is-on { background: var(--accent); color: #fff; border-color: var(--accent-deep); }

/* --------------------------------------------------- Personal scoring */
.personalize-cta {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem 1.5rem; flex-wrap: wrap;
}
.personalize-cta h2 { margin: 0 0 .2rem; }
.personalize-cta p { margin: 0; max-width: 62ch; }
.dash-links { margin: 0 0 1rem; }

.score-compare { display: flex; align-items: center; gap: 1.6rem; flex-wrap: wrap; }
.score-block { display: flex; flex-direction: column; align-items: center; gap: .35rem; }
.score-label {
  font-size: .7rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .09em; color: var(--muted);
}
.score-block.is-personal .score-label { color: var(--accent); }

.personal-score {
  display: flex; align-items: center; gap: .55rem;
  padding-left: .65rem; border-left: 1px solid var(--line);
}
.personal-score .score-mark { width: 46px; }
.personal-score-label {
  font-size: .68rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .09em; color: var(--accent); white-space: nowrap;
}
.personal-score > a { font-size: .78rem; font-weight: 600; }
.personal-score-cta { font-size: .82rem; font-weight: 600; }

.quiz-rows { display: grid; gap: .1rem; }
.quiz-row {
  display: grid; grid-template-columns: minmax(170px, 1fr) auto;
  align-items: center; gap: .6rem 1rem; padding: .6rem 0;
  border-bottom: 1px solid var(--line);
}
.quiz-row:last-child { border-bottom: 0; }
.quiz-item { display: flex; flex-direction: column; gap: .1rem; }
.quiz-item strong { font-size: .94rem; }
.quiz-options { display: flex; gap: .3rem; flex-wrap: wrap; }
.quiz-option { position: relative; }
.quiz-option input { position: absolute; opacity: 0; pointer-events: none; }
.quiz-option span {
  display: inline-block; padding: .32rem .55rem; border: 1px solid var(--line);
  border-radius: 999px; font-size: .76rem; color: var(--ink-soft);
  background: var(--paper); cursor: pointer; white-space: nowrap;
}
.quiz-option input:checked + span {
  background: var(--accent); border-color: var(--accent); color: #fff;
}
.quiz-option input:focus-visible + span { outline: 2px solid var(--brass); outline-offset: 2px; }

.slider-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: .9rem 1.4rem;
}
.weight-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: .55rem 1.4rem;
}
.slider-field {
  display: grid; grid-template-columns: 1fr auto; align-items: center;
  gap: .25rem .6rem;
}
.slider-field > span {
  grid-column: 1 / -1; font-size: .82rem; font-weight: 600; color: var(--ink-soft);
}
.slider-field input[type="range"] {
  grid-column: 1; width: 100%; accent-color: var(--accent); cursor: pointer;
}
.slider-field output {
  grid-column: 2; min-width: 3ch; text-align: right; font-size: .8rem;
  color: var(--muted); font-variant-numeric: tabular-nums;
}
.personal-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin: 1.2rem 0 2rem; }

@media (max-width: 720px) {
  .quiz-row { grid-template-columns: 1fr; }
  .personal-score { border-left: 0; padding-left: 0; }
  .score-compare { justify-content: center; }
}

.item-desc {
  display: block; max-width: 52ch; margin-top: .15rem;
  font-size: .78rem; color: var(--muted);
}
.score-table td.num { white-space: nowrap; }
.delta-up { color: #a33b2f; font-weight: 700; }
.delta-down { color: #2f7d4f; font-weight: 700; }
.delta-new {
  color: var(--muted); font-size: .7rem; text-transform: uppercase;
  letter-spacing: .05em;
}
