/* ---------- Fonts ---------- */
/* D-DIN (SIL Open Font License), registered as "DIN", for body text;
   headings use Fraunces. Only Regular and Bold files exist, so the light
   weight (--font-lt) uses Regular. */
@font-face { font-family: "DIN"; src: url("/static/fonts/D-DIN.otf") format("opentype"); font-weight: 100 500; font-style: normal; font-display: swap; }
@font-face { font-family: "DIN"; src: url("/static/fonts/D-DIN-Bold.otf") format("opentype"); font-weight: 600 900; font-style: normal; font-display: swap; }

/* ---------- Tokens ---------- */
:root {
  --bg: #F6F6F6;
  --surface: #ffffff;
  --surface-2: #ededed;
  --ink: #1f1a17;
  --muted: #6b6560;
  --border: #e2e0dd;
  --accent: #9c3d1f;
  --accent-hover: #842f15;
  --accent-ink: #ffffff;
  --accent-soft: #f6e3da;
  --gold: #c98a12;
  --ok: #2f7a4f;
  --ok-soft: #e1f1e7;
  --warn: #9a5b07;
  --warn-soft: #fbeed3;
  --danger: #b42318;
  --danger-soft: #fde4e1;
  --critic: #3651c9;
  --critic-soft: #e5ebff;
  --verified: #1d9bf0;
  --shadow-sm: 0 1px 2px rgb(31 26 23 / .06);
  --shadow: 0 1px 2px rgb(31 26 23 / .05), 0 8px 24px -12px rgb(31 26 23 / .18);
  --shadow-lg: 0 20px 50px -20px rgb(31 26 23 / .35);
  --radius: 14px;
  --radius-sm: 9px;
  --serif: "Fraunces", "Iowan Old Style", Georgia, serif;
  --sans: 'DIN', 'Helvetica Neue', Arial, sans-serif;
  --font-lt: 400;
  --text-color: var(--ink);
  --av-s: 45%; --av-bg: 88%; --av-fg: 28%;
  color-scheme: light;
}
/* Dark tokens apply when the system prefers dark (unless the user picked light),
   or when the user picked dark with the theme toggle. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14110e;
    --surface: #1d1915;
    --surface-2: #27211c;
    --ink: #f2ece4;
    --muted: #a99e92;
    --border: #352e27;
    --accent: #e48a63;
    --accent-hover: #f09d79;
    --accent-ink: #1b120d;
    --accent-soft: #3a2219;
    --gold: #f2b53c;
    --ok: #6fcf97;
    --ok-soft: #16301f;
    --warn: #f3b65b;
    --warn-soft: #3a2b12;
    --danger: #ff8a7a;
    --danger-soft: #3b1915;
    --critic: #93a8ff;
    --critic-soft: #1e2546;
    --verified: #4cb3ff;
    --shadow-sm: 0 1px 2px rgb(0 0 0 / .4);
    --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 10px 30px -12px rgb(0 0 0 / .6);
    --shadow-lg: 0 24px 60px -20px rgb(0 0 0 / .8);
    --av-s: 30%; --av-bg: 26%; --av-fg: 82%;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #14110e;
  --surface: #1d1915;
  --surface-2: #27211c;
  --ink: #f2ece4;
  --muted: #a99e92;
  --border: #352e27;
  --accent: #e48a63;
  --accent-hover: #f09d79;
  --accent-ink: #1b120d;
  --accent-soft: #3a2219;
  --gold: #f2b53c;
  --ok: #6fcf97;
  --ok-soft: #16301f;
  --warn: #f3b65b;
  --warn-soft: #3a2b12;
  --danger: #ff8a7a;
  --danger-soft: #3b1915;
  --critic: #93a8ff;
  --critic-soft: #1e2546;
  --verified: #4cb3ff;
  --shadow-sm: 0 1px 2px rgb(0 0 0 / .4);
  --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 10px 30px -12px rgb(0 0 0 / .6);
  --shadow-lg: 0 24px 60px -20px rgb(0 0 0 / .8);
  --av-s: 30%; --av-bg: 26%; --av-fg: 82%;
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  transition: background-color .2s, color .2s;
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--bg);
  font-family: var(--sans);
  font-weight: var(--font-lt);
  font-size: 18px;
  line-height: 1.5;
  color: var(--text-color);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.15; letter-spacing: -.01em; margin: 0 0 .4em; }
h1 { font-size: clamp(1.8rem, 3vw, 2.4rem); }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 .8em; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
img, svg { display: block; }
.wrap { width: 100%; max-width: 1160px; margin: 0 auto; padding: 0 20px; }
.main { flex: 1; padding-top: 28px; padding-bottom: 64px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.count { font-family: var(--sans); font-size: .9rem; font-weight: 500; }
.eyebrow { display: inline-block; font-size: .72rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }
.bi { line-height: 1; vertical-align: -.125em; }
.verified-mark { color: var(--verified); font-size: .95em; margin-left: 4px; }
.page-title { margin-bottom: 20px; }
.center-link { display: block; text-align: center; margin-top: 12px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* ---------- Buttons & controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border: 1px solid transparent; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink);
  font: 600 .92rem var(--sans); cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .15s, transform .1s, box-shadow .15s;
}
.btn:hover { background: var(--accent-hover); color: var(--accent-ink); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn-ok { background: var(--ok); color: #fff; }
.btn-ok:hover { background: var(--ok); filter: brightness(1.1); color: #fff; }
.btn-danger { background: transparent; color: var(--danger); border-color: var(--danger-soft); }
.btn-danger:hover { background: var(--danger-soft); color: var(--danger); }
.btn-sm { padding: 6px 12px; font-size: .82rem; }
.btn-block { width: 100%; }
.link-btn { background: none; border: 0; padding: 0; color: var(--muted); font: inherit; font-size: .85rem; cursor: pointer; }
.link-btn:hover { color: var(--ink); text-decoration: underline; }
.link-btn.danger { color: var(--danger); }
.icon-btn { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 1.05rem; transition: background .15s, color .15s; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn.danger { width: 32px; height: 32px; font-size: .9rem; }
.icon-btn.danger:hover { background: var(--danger-soft); color: var(--danger); }

input, select, textarea {
  width: 100%; padding: 10px 12px; font: inherit; color: var(--ink);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
select { width: auto; padding-right: 32px; appearance: none; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
textarea { resize: vertical; min-height: 90px; }
.qty { width: 72px; text-align: center; }

.form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span:first-child { font-weight: 600; font-size: .88rem; }
.field .hint { font-weight: 400; color: var(--muted); }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px; }
.error { color: var(--danger); font-size: .84rem; }
.form-error { background: var(--danger-soft); color: var(--danger); padding: 10px 14px; border-radius: var(--radius-sm); font-size: .9rem; }

/* ---------- Tags, badges, chips ---------- */
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: .74rem; font-weight: 600; white-space: nowrap; }
.tag-ok { background: var(--ok-soft); color: var(--ok); }
.tag-warn { background: var(--warn-soft); color: var(--warn); }
.tag-danger { background: var(--danger-soft); color: var(--danger); }
.tag-muted { background: var(--surface-2); color: var(--muted); }
.badge { display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 6px; font: 600 .7rem var(--sans); letter-spacing: .02em; vertical-align: middle; }
.badge-critic { background: var(--critic-soft); color: var(--critic); }
.badge-admin { background: var(--accent-soft); color: var(--accent); }
.rank { display: inline-flex; align-items: center; gap: 4px; font-size: .76rem; font-weight: 600; color: var(--muted); white-space: nowrap; }
.rank-3 { color: var(--critic); }
.rank-4 { color: var(--ok); }
.rank-5 { color: var(--gold); }
.pill { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: .72rem; font-weight: 700; margin-left: auto; }
.chip { display: inline-flex; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--border); color: var(--ink); font-size: .85rem; font-weight: 500; background: var(--surface); transition: all .15s; }
.chip:hover { border-color: var(--ink); color: var(--ink); }
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip-btn { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--border); background: transparent; color: var(--muted); font: 500 .8rem var(--sans); cursor: pointer; }
.chip-btn:hover { border-color: var(--muted); color: var(--ink); }
.chip-btn.on { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.status { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .76rem; font-weight: 600; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-pending { background: var(--warn-soft); color: var(--warn); }
.status-shipped, .status-approved { background: var(--critic-soft); color: var(--critic); }
.status-delivered { background: var(--ok-soft); color: var(--ok); }
.status-cancelled, .status-rejected { background: var(--surface-2); color: var(--muted); }

.stars { color: var(--gold); white-space: nowrap; display: inline-flex; gap: 2px; }
.stars.sm { font-size: .82rem; }
.price { font-weight: 700; font-size: 1rem; }
.price.lg { font-family: var(--serif); font-size: 1.9rem; font-weight: 600; }

.avatar {
  --h: 20; display: inline-grid; place-items: center; flex: none;
  width: 34px; height: 34px; border-radius: 50%;
  background: hsl(var(--h) var(--av-s) var(--av-bg)); color: hsl(var(--h) 60% var(--av-fg));
  font: 600 .9rem var(--sans);
}
.avatar.lg { width: 64px; height: 64px; font-size: 1.6rem; font-family: var(--serif); }
.avatar.xl { width: 88px; height: 88px; font-size: 2.2rem; font-family: var(--serif); }

.user-chip { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); min-width: 0; }
.user-chip:hover { color: var(--ink); }
.user-chip:hover .user-chip-name { text-decoration: underline; }
.user-chip > span:last-child { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.user-chip-name { font-weight: 600; font-size: .9rem; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow-sm); }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head h2, .card-head h3 { margin: 0; }

.progress { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--gold)); border-radius: inherit; transition: width .6s cubic-bezier(.2,.8,.2,1); }
.progress.lg { height: 12px; }

.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty h2 { color: var(--ink); }
.empty-icon { display: inline-grid; place-items: center; width: 64px; height: 64px; border-radius: 20px; background: var(--surface-2); color: var(--accent); font-size: 1.7rem; margin-bottom: 12px; }

/* ---------- Header ---------- */
.topbar { position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: saturate(1.6) blur(12px); border-bottom: 1px solid var(--border); }
.topbar-inner { display: flex; align-items: center; gap: 20px; height: 64px; }
.logo { display: flex; align-items: center; gap: 10px; font: 700 1.25rem var(--serif); color: var(--ink); letter-spacing: -.02em; }
.logo:hover { color: var(--ink); }
.logo-mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); font-size: 1.05rem; transform: rotate(-6deg); }
.topsearch { flex: 1; max-width: 420px; position: relative; }
.topsearch .bi { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: .9rem; vertical-align: 0; }
.topsearch input { padding: 9px 14px 9px 38px; border-radius: 999px; background: var(--surface); }
.topnav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.topnav > a:not(.btn) { padding: 8px 12px; border-radius: 999px; color: var(--muted); font-weight: 500; font-size: .92rem; }
.topnav > a:not(.btn):hover, .topnav > a.active { color: var(--ink); background: var(--surface-2); }
.cart-link { position: relative; display: grid !important; place-items: center; width: 40px; height: 40px; padding: 0 !important; font-size: 1.1rem; }
.cart-link .count-badge { position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: .68rem; font-weight: 700; display: grid; place-items: center; }

.usermenu { position: relative; }
.usermenu summary { list-style: none; display: flex; align-items: center; gap: 8px; padding: 3px 10px 3px 3px; border-radius: 999px; cursor: pointer; font-weight: 500; font-size: .9rem; border: 1px solid var(--border); background: var(--surface); }
.usermenu summary::-webkit-details-marker { display: none; }
.usermenu summary .avatar { width: 30px; height: 30px; font-size: .8rem; }
.usermenu[open] summary { border-color: var(--muted); }
.menu { position: absolute; right: 0; top: calc(100% + 8px); width: 240px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 6px; animation: pop .15s ease-out; }
.menu a, .menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border-radius: 8px; color: var(--ink); font: 500 .9rem var(--sans); background: none; border: 0; cursor: pointer; text-align: left; }
.menu a:hover, .menu button:hover { background: var(--surface-2); color: var(--ink); }
.menu .bi { color: var(--muted); width: 16px; }
.menu-head { padding: 10px 12px 12px; border-bottom: 1px solid var(--border); margin-bottom: 6px; display: flex; flex-direction: column; }
.menu-head span { color: var(--muted); font-size: .82rem; }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: 6px 0; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } }

.flash { position: fixed; top: 76px; left: 50%; transform: translateX(-50%); z-index: 60; display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-radius: 999px; box-shadow: var(--shadow-lg); font-weight: 500; font-size: .92rem; max-width: calc(100% - 32px); animation: slide .3s cubic-bezier(.2,.8,.2,1); background: var(--ink); color: var(--bg); }
.flash-success .bi { color: var(--ok); }
.flash-error { background: var(--danger); color: #fff; }
.flash.hide { opacity: 0; transform: translate(-50%, -10px); transition: all .3s; }
@keyframes slide { from { opacity: 0; transform: translate(-50%, -12px); } }

.site-footer { border-top: 1px solid var(--border); padding: 28px 0; color: var(--muted); font-size: .85rem; }
.site-footer .wrap { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.site-footer a { color: var(--muted); }
.site-footer nav { display: flex; gap: 18px; }

/* ---------- Covers ---------- */
.cover {
  --h: 20; position: relative; overflow: hidden; container-type: inline-size;
  aspect-ratio: 2 / 3; width: 100%; border-radius: 3px 8px 8px 3px;
  padding: 12% 11% 12% 15%; display: flex; flex-direction: column; justify-content: space-between;
  background:
    radial-gradient(120% 80% at 100% 0%, hsl(calc(var(--h) + 30) 60% 60% / .45), transparent 60%),
    linear-gradient(165deg, hsl(var(--h) 42% 40%), hsl(calc(var(--h) + 25) 48% 22%));
  color: #fff8ef;
  box-shadow: inset 5px 0 0 rgb(0 0 0 / .18), inset 7px 0 0 rgb(255 255 255 / .08), 0 12px 24px -12px rgb(0 0 0 / .45);
}
.cover::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgb(255 255 255 / .12), transparent 8%); pointer-events: none; }
.cover-genre { font: 600 5.2cqi var(--sans); text-transform: uppercase; letter-spacing: .14em; opacity: .7; }
.cover-title { font: 600 12cqi/1.05 var(--serif); letter-spacing: -.01em; margin-bottom: 5cqi; text-wrap: balance; }
.cover-author { font: 500 5.8cqi var(--sans); text-transform: uppercase; letter-spacing: .1em; opacity: .85; }
.cover-rule { width: 22%; height: 1px; background: currentColor; opacity: .5; margin-bottom: 5cqi; }
.thumb { display: block; width: 52px; flex: none; }
.thumb .cover { border-radius: 2px 4px 4px 2px; }

/* ---------- Hero / catalog ---------- */
.hero { display: grid; grid-template-columns: 1.35fr 1fr; gap: 40px; align-items: center; padding: 28px 0 56px; }
.hero h1 { font-size: clamp(2.3rem, 5vw, 3.6rem); margin: 10px 0 16px; }
.hero h1 em { font-style: italic; color: var(--accent); font-weight: 500; }
.lead { font-size: 1.08rem; color: var(--muted); max-width: 46ch; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 24px; }
.hero-feature { position: relative; display: flex; flex-direction: column; align-items: center; gap: 18px; color: var(--ink); padding: 28px; border-radius: 24px; background: radial-gradient(circle at 50% 30%, var(--accent-soft), transparent 70%); }
.hero-feature:hover { color: var(--ink); }
.hero-cover { width: min(200px, 60%); transform: rotate(-3deg); transition: transform .3s; }
.hero-feature:hover .hero-cover { transform: rotate(0) scale(1.03); }
.hero-cover .cover { box-shadow: var(--shadow-lg); }
.hero-feature-info { text-align: center; display: flex; flex-direction: column; gap: 2px; }
.hero-feature-info strong { font: 600 1.2rem var(--serif); }

.catalog-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.catalog-head h2 { margin: 0; }
.sort-form { display: flex; align-items: center; gap: 8px; }
.sort-form select { padding-top: 7px; padding-bottom: 7px; font-size: .88rem; }
.mobile-search { display: none; margin-bottom: 16px; }
.mobile-search input { border-radius: 999px; padding-left: 16px; }
.genre-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 26px; }

.book-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 32px 22px; }
.book-card-link { display: flex; flex-direction: column; gap: 12px; color: var(--ink); height: 100%; }
.book-card-link:hover { color: var(--ink); }
.book-card .cover { transition: transform .25s cubic-bezier(.2,.8,.2,1), box-shadow .25s; }
.book-card:hover .cover { transform: translateY(-6px) rotate(-1deg); box-shadow: inset 5px 0 0 rgb(0 0 0 / .18), 0 22px 30px -14px rgb(0 0 0 / .5); }
.book-card-body h3 { font-size: 1rem; margin: 0 0 2px; }
.book-card-body p { margin: 0 0 6px; }
.book-card-meta { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.price-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.latest { margin-top: 64px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 18px; }
.section-head h2 { margin: 0; }
.latest-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; }
.latest-card { display: flex; flex-direction: column; gap: 10px; padding: 22px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: var(--ink); transition: transform .2s, box-shadow .2s; }
.latest-card:hover { color: var(--ink); transform: translateY(-3px); box-shadow: var(--shadow); }
.latest-card p { font: italic 400 1.02rem/1.5 var(--serif); margin: 0; flex: 1; }
.latest-meta { display: flex; align-items: center; gap: 10px; font-size: .84rem; color: var(--muted); }
.latest-meta strong { color: var(--ink); }

/* ---------- Book page ---------- */
.crumbs { font-size: .85rem; color: var(--muted); margin-bottom: 22px; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--ink); }
.book-hero { display: grid; grid-template-columns: 260px 1fr; gap: 48px; margin-bottom: 56px; }
.book-hero-cover .cover { box-shadow: var(--shadow-lg); }
.book-hero h1 { font-size: clamp(2rem, 4vw, 2.9rem); margin: 6px 0 8px; }
.byline { font-size: 1.05rem; color: var(--muted); margin-bottom: 20px; }
.byline strong { color: var(--ink); font-weight: 600; }
.scores { display: flex; gap: 12px; margin-bottom: 22px; flex-wrap: wrap; }
.score { display: flex; align-items: center; gap: 12px; padding: 10px 18px 10px 12px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); }
.score-num { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); font: 700 1.25rem var(--serif); }
.score-critic .score-num { background: var(--critic-soft); color: var(--critic); }
.score-label { font-size: .78rem; line-height: 1.35; color: var(--muted); }
.score-label strong { color: var(--ink); font-size: .88rem; }
.description { font: 400 1.1rem/1.65 var(--sans); max-width: 64ch; margin-bottom: 26px; }
.buy-box { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; padding: 20px 24px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm); max-width: 560px; }
.buy-box > div:first-child { margin-right: auto; }
.stock { font-size: .85rem; font-weight: 600; color: var(--ok); }
.stock.low { color: var(--warn); }
.stock.out { color: var(--muted); }
.buy-form { display: flex; gap: 8px; }

.book-reviews { display: grid; grid-template-columns: 340px 1fr; gap: 32px; align-items: start; }
.reviews-side { display: flex; flex-direction: column; gap: 18px; position: sticky; top: 84px; }
.histogram { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.histogram li { display: grid; grid-template-columns: 28px 1fr 24px; gap: 10px; align-items: center; font-size: .82rem; }
.bar { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--gold); border-radius: inherit; }
.reviews-main h2 { margin-bottom: 18px; }

.review { padding: 22px 0; border-bottom: 1px solid var(--border); }
.review:first-of-type { padding-top: 0; }
.review-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.review-rating { display: flex; align-items: center; gap: 10px; }
.review-body { white-space: pre-line; margin: 10px 0 12px; }
.review-foot { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.review-foot form { margin: 0; }

.thread { margin: 14px 0 0 22px; padding-left: 18px; border-left: 2px solid var(--border); display: flex; flex-direction: column; gap: 12px; }
.comment { display: flex; gap: 10px; }
.comment .avatar { width: 28px; height: 28px; font-size: .75rem; }
.comment-main { flex: 1; min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 4px 14px 14px 14px; padding: 9px 14px; }
.comment-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: .85rem; }
.comment-head > a { color: var(--ink); font-weight: 600; }
.comment-head form { margin: 0 0 0 auto; }
.comment-main p { margin: 3px 0 0; font-size: .92rem; white-space: pre-line; }
.comment-form { display: flex; gap: 8px; }
.comment-form input { border-radius: 999px; padding: 8px 14px; font-size: .9rem; }

.rating-input { border: 0; padding: 0; margin: 0; }
.rating-input legend { font-weight: 600; font-size: .88rem; padding: 0; margin-bottom: 4px; }
/* DOM order is 5..1; row-reverse displays 1..5 so "~" selects lower stars. */
.star-picker { display: inline-flex; flex-direction: row-reverse; }
.star-picker input { position: absolute; opacity: 0; width: 0; height: 0; }
.star-picker label { font-size: 1.7rem; line-height: 1; color: var(--border); cursor: pointer; padding: 0 3px; transition: color .1s, transform .1s; }
.star-picker label:hover { transform: scale(1.12); }
.star-picker input:checked ~ label, .star-picker label:hover, .star-picker label:hover ~ label { color: var(--gold); }
.star-picker:hover input:checked ~ label:not(:hover):not(:hover ~ label) { color: var(--border); }
.star-picker input:focus-visible + label { outline: 2px solid var(--accent); border-radius: 4px; }

.related { margin-top: 64px; }

/* ---------- Auth ---------- */
.auth { display: grid; place-items: center; padding: 24px 0; }
.auth-card { width: 100%; max-width: 420px; padding: 34px; }
.auth-card h1 { font-size: 1.9rem; text-align: center; }
.auth-card .sub { text-align: center; color: var(--muted); margin-bottom: 24px; }
.auth-alt { text-align: center; margin-top: 18px; font-size: .9rem; color: var(--muted); }

/* ---------- Cart & checkout ---------- */
.cart-layout { display: grid; grid-template-columns: 1fr 340px; gap: 28px; align-items: start; }
.cart-lines { padding: 6px 22px; }
.cart-line { display: grid; grid-template-columns: 56px 1fr auto 80px 32px; gap: 18px; align-items: center; padding: 16px 0; border-bottom: 1px solid var(--border); }
.cart-line:last-child { border-bottom: 0; }
.cart-line .thumb { width: 56px; }
.cart-line-info { display: flex; flex-direction: column; gap: 2px; align-items: flex-start; }
.cart-line-info a { color: var(--ink); }
.cart-line-total { text-align: right; font-weight: 700; }
.qty-form { margin: 0; }
.summary-card { position: sticky; top: 84px; }
.totals { margin: 0 0 18px; display: flex; flex-direction: column; gap: 10px; }
.totals div { display: flex; justify-content: space-between; gap: 12px; font-size: .92rem; }
.totals dt { color: var(--muted); }
.totals dd { margin: 0; font-weight: 600; }
.totals .grand { padding-top: 12px; border-top: 1px solid var(--border); font-size: 1.1rem; }
.totals .grand dt { color: var(--ink); font-weight: 600; }
.ship-progress { margin-bottom: 18px; }
.ship-progress p { margin-bottom: 6px; }
.ok { color: var(--ok); }
.checkout-layout { display: grid; grid-template-columns: 1fr 360px; gap: 28px; align-items: start; }
.mini-lines { display: flex; flex-direction: column; gap: 12px; margin-bottom: 18px; }
.mini-line { display: flex; gap: 12px; align-items: center; font-size: .88rem; }
.mini-line .thumb { width: 38px; }
.mini-line > div { flex: 1; display: flex; flex-direction: column; }
.pay-option { display: flex; gap: 12px; align-items: center; padding: 14px 16px; border-radius: var(--radius-sm); border: 2px solid var(--accent); background: var(--accent-soft); }
.pay-option input { width: auto; accent-color: var(--accent); }

/* ---------- Orders ---------- */
.order-list { display: flex; flex-direction: column; gap: 14px; }
.order-card { display: grid; grid-template-columns: auto 1fr auto auto; gap: 20px; align-items: center; color: var(--ink); transition: box-shadow .15s, transform .15s; }
.order-card:hover { color: var(--ink); box-shadow: var(--shadow); transform: translateY(-2px); }
.order-covers { display: flex; }
.order-covers .thumb { width: 40px; margin-right: -14px; }
.order-covers .thumb:last-child { margin-right: 0; }
.timeline { display: flex; gap: 0; margin: 10px 0 28px; }
.timeline-step { flex: 1; position: relative; text-align: center; font-size: .82rem; color: var(--muted); padding-top: 34px; }
.timeline-step::before { content: ""; position: absolute; top: 9px; left: 50%; transform: translateX(-50%); width: 20px; height: 20px; border-radius: 50%; background: var(--surface-2); border: 2px solid var(--border); z-index: 1; }
.timeline-step::after { content: ""; position: absolute; top: 18px; left: -50%; width: 100%; height: 2px; background: var(--border); }
.timeline-step:first-child::after { display: none; }
.timeline-step.done { color: var(--ink); font-weight: 600; }
.timeline-step.done::before { background: var(--ok); border-color: var(--ok); }
.timeline-step.done::after { background: var(--ok); }
.order-layout { display: grid; grid-template-columns: 1fr 320px; gap: 28px; align-items: start; }
.order-items .mini-line { padding: 10px 0; border-bottom: 1px solid var(--border); }
.order-items .mini-line:last-child { border-bottom: 0; }
.address { font-style: normal; line-height: 1.7; }
.notice { padding: 14px 18px; border-radius: var(--radius-sm); background: var(--surface-2); color: var(--muted); margin-bottom: 20px; }

/* ---------- Panels (dashboard / profile) ---------- */
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.panel-id { display: flex; align-items: center; gap: 18px; }
.panel-id h1 { margin: 0 0 2px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.panel-id p { margin: 0; }
.rank-card { display: grid; grid-template-columns: auto 1fr; gap: 6px 24px; align-items: center; margin-bottom: 20px; background: radial-gradient(120% 140% at 0% 0%, var(--accent-soft), var(--surface) 55%); }
.rank-icon { grid-row: span 2; display: grid; place-items: center; width: 84px; height: 84px; font-size: 2.3rem; border-radius: 24px; background: var(--surface); box-shadow: var(--shadow); color: var(--muted); }
.rank-icon.rank-2 { color: var(--accent); }
.rank-info h2 { margin: 2px 0 10px; font-size: 1.7rem; }
.rank-info p { margin: 8px 0 0; }
.rank-ladder { grid-column: 2; display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.rung { display: inline-flex; gap: 5px; align-items: center; padding: 4px 10px; border-radius: 999px; font-size: .76rem; font-weight: 600; background: var(--surface-2); color: var(--muted); }
.rung.got { background: var(--ink); color: var(--bg); }
.rung.now { background: var(--accent); color: var(--accent-ink); }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; display: flex; flex-direction: column; gap: 4px; box-shadow: var(--shadow-sm); }
.stat-label { font-size: .78rem; color: var(--muted); font-weight: 500; display: flex; align-items: center; gap: 6px; }
.stat-value { font: 600 1.9rem/1.1 var(--serif); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-sub { font-size: .78rem; color: var(--muted); }
.stat.accent { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.stat.accent .stat-label, .stat.accent .stat-sub { color: color-mix(in srgb, var(--bg) 70%, transparent); }

.panel-grid { display: grid; grid-template-columns: 1fr 340px; gap: 22px; align-items: start; }
.panel-main, .panel-side { display: flex; flex-direction: column; gap: 22px; min-width: 0; }

.queue { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.queue-item { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: var(--radius-sm); border: 1px solid var(--border); color: var(--ink); transition: background .15s; }
.queue-item:hover { background: var(--surface-2); color: var(--ink); }
.queue-item .thumb { width: 40px; }
.queue-item > span:nth-child(2) { flex: 1; display: flex; flex-direction: column; min-width: 0; font-size: .88rem; line-height: 1.35; }
.queue-item strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.review-row { display: flex; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--border); }
.review-row:last-child { border-bottom: 0; padding-bottom: 0; }
.review-row-body { flex: 1; min-width: 0; }
.review-row-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.review-row-head a { color: var(--ink); }
.review-row p { margin: 0 0 8px; font-size: .92rem; }

.callout { border: 1px dashed var(--critic); background: var(--critic-soft); }
.callout h3 { color: var(--critic); }
.perk-list { padding-left: 18px; margin: 0 0 14px; font-size: .9rem; }
.perk-list li { margin-bottom: 4px; }

.profile-hero { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; margin-bottom: 28px; }
.profile-hero h1 { margin: 0; display: flex; align-items: center; gap: 10px; }
.profile-hero .bio { margin: 6px 0 10px; font: italic 1.05rem var(--serif); color: var(--muted); max-width: 60ch; }
.profile-stats { display: flex; gap: 24px; font-size: .88rem; color: var(--muted); flex-wrap: wrap; }
.profile-stats strong { color: var(--ink); font-size: 1.05rem; margin-right: 4px; }

/* ---------- Leaderboard ---------- */
.lb-head { text-align: center; max-width: 640px; margin: 0 auto 36px; }
.podium { display: grid; grid-template-columns: 1fr 1.15fr 1fr; gap: 18px; align-items: end; max-width: 820px; margin: 0 auto 40px; }
.podium-spot { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 26px 18px; border-radius: 20px 20px var(--radius) var(--radius); background: var(--surface); border: 1px solid var(--border); color: var(--ink); box-shadow: var(--shadow-sm); transition: transform .2s; }
.podium-spot:hover { color: var(--ink); transform: translateY(-4px); }
.podium-spot.p1 { order: 2; padding-top: 38px; background: radial-gradient(circle at 50% 0%, color-mix(in srgb, var(--gold) 25%, transparent), var(--surface) 70%); border-color: color-mix(in srgb, var(--gold) 45%, var(--border)); }
.podium-spot.p2 { order: 1; }
.podium-spot.p3 { order: 3; }
.medal { font-size: 1.9rem; line-height: 1; }
.medal-1 { color: var(--gold); }
.medal-2 { color: #9aa3ad; }
.medal-3 { color: #b8743d; }
.podium-spot .points { font: 600 1.5rem var(--serif); }
.lb-layout { display: grid; grid-template-columns: 1fr 300px; gap: 24px; align-items: start; }
.rank-table-rank { font: 600 1rem var(--serif); color: var(--muted); width: 40px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.table th { text-align: left; font-weight: 600; font-size: .74rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 12px 16px; background: var(--surface-2); white-space: nowrap; }
.table td { padding: 12px 16px; border-top: 1px solid var(--border); vertical-align: middle; }
.table tr:hover td { background: color-mix(in srgb, var(--surface-2) 45%, transparent); }
.table .nowrap { white-space: nowrap; }
.cell-email { margin: 2px 0 0 44px; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .actions { display: flex; gap: 12px; align-items: center; justify-content: flex-end; white-space: nowrap; }
.table .actions form { margin: 0; }
.table select { padding: 5px 30px 5px 10px; font-size: .82rem; }
.cell-book { display: flex; align-items: center; gap: 12px; min-width: 200px; }
.cell-book .thumb { width: 34px; }
.cell-book > div { display: flex; flex-direction: column; line-height: 1.35; }
.cell-book a { color: var(--ink); font-weight: 600; }

/* ---------- Admin ---------- */
.admin-layout { display: grid; grid-template-columns: 220px 1fr; gap: 32px; align-items: start; }
.admin-nav { position: sticky; top: 84px; display: flex; flex-direction: column; gap: 2px; }
.admin-nav-title { font-size: .72rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); padding: 0 12px 10px; }
.admin-nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; color: var(--muted); font-weight: 500; font-size: .92rem; }
.admin-nav a:hover { background: var(--surface-2); color: var(--ink); }
.admin-nav a.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); border: 1px solid var(--border); }
.admin-nav a.active .bi { color: var(--accent); }
.admin-main { min-width: 0; display: flex; flex-direction: column; gap: 22px; }
.admin-title { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.admin-title h1 { margin: 0; font-size: 1.9rem; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.toolbar input[type=search] { width: 260px; }
.tabs { display: flex; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: 999px; width: fit-content; flex-wrap: wrap; }
.tabs a { padding: 6px 14px; border-radius: 999px; color: var(--muted); font-size: .85rem; font-weight: 500; }
.tabs a:hover { color: var(--ink); }
.tabs a.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.admin-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 22px; align-items: start; }

.chart { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; align-items: end; height: 180px; padding-top: 10px; }
.chart-col { display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.chart-bar { width: 100%; max-width: 44px; min-height: 3px; border-radius: 6px 6px 2px 2px; background: linear-gradient(180deg, var(--accent), color-mix(in srgb, var(--accent) 55%, var(--gold))); position: relative; }
.chart-bar:hover::after { content: attr(data-value); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg); font-size: .72rem; font-weight: 600; padding: 3px 7px; border-radius: 6px; white-space: nowrap; }
.chart-label { font-size: .74rem; color: var(--muted); }

.app-card { display: flex; flex-direction: column; gap: 12px; }
.app-card blockquote { margin: 0; padding: 12px 16px; border-left: 3px solid var(--critic); background: var(--surface-2); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; font: italic 1rem/1.55 var(--serif); }
.app-actions { display: flex; gap: 10px; }
.app-actions form { margin: 0; }
.list-plain { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; }
.list-plain li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: .88rem; }
.list-plain li:last-child { border-bottom: 0; }

.book-form-layout { display: grid; grid-template-columns: 1fr 220px; gap: 28px; align-items: start; }
.preview { position: sticky; top: 84px; text-align: center; }
.preview .cover { margin-bottom: 10px; }

/* ---------- Error page ---------- */
.error-page { text-align: center; padding: 60px 0; }
.error-code { font: 600 6rem/1 var(--serif); color: var(--accent); opacity: .25; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .book-reviews, .cart-layout, .checkout-layout, .order-layout, .panel-grid, .lb-layout, .admin-grid { grid-template-columns: 1fr; }
  .reviews-side, .summary-card { position: static; }
  .admin-layout { grid-template-columns: 1fr; gap: 18px; }
  .admin-nav { position: static; flex-direction: row; overflow-x: auto; padding-bottom: 4px; }
  .admin-nav-title { display: none; }
  .admin-nav a { white-space: nowrap; }
}
@media (max-width: 760px) {
  .wrap { padding: 0 16px; }
  .topbar-inner { gap: 10px; }
  .topsearch { display: none; }
  .mobile-search { display: block; }
  .hide-sm { display: none; }
  .logo .logo-name { display: none; }
  .hero { grid-template-columns: 1fr; padding-bottom: 32px; gap: 16px; }
  .hero-feature { padding: 12px; }
  .book-hero { grid-template-columns: 1fr; gap: 24px; }
  .book-hero-cover { width: 200px; margin: 0 auto; }
  .book-grid { grid-template-columns: repeat(2, 1fr); gap: 24px 14px; }
  .cart-line { grid-template-columns: 48px 1fr auto; }
  .cart-line .qty-form { grid-column: 2; }
  .cart-line-total { grid-column: 3; grid-row: 1; }
  .order-card { grid-template-columns: 1fr auto; }
  .order-covers { display: none; }
  .podium { grid-template-columns: 1fr; }
  .podium-spot.p1, .podium-spot.p2, .podium-spot.p3 { order: 0; }
  .rank-card { grid-template-columns: 1fr; text-align: center; }
  .rank-icon { grid-row: auto; margin: 0 auto; }
  .rank-ladder { grid-column: 1; justify-content: center; }
  .book-form-layout { grid-template-columns: 1fr; }
  .preview { display: none; }
  .toolbar input[type=search] { width: 100%; }
}

/* ---------- Forms: checkbox, demo login, verification ---------- */
.check { display: flex; gap: 10px; align-items: flex-start; font-size: .88rem; line-height: 1.45; }
.check input { width: 18px; height: 18px; margin-top: 1px; flex: none; accent-color: var(--accent); }
.demo-box { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 18px; padding: 14px 16px; border-radius: var(--radius-sm); background: var(--critic-soft); }
.demo-box > div { display: flex; flex-direction: column; gap: 2px; }
.demo-box strong { color: var(--critic); font-size: .9rem; }
code { font: 500 .85em ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--surface-2); padding: 1px 6px; border-radius: 5px; }
.verify-btn { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; border: 1px dashed var(--border); background: transparent; color: var(--muted); font: 500 .8rem var(--sans); cursor: pointer; }
.verify-btn:hover { border-color: var(--verified); color: var(--verified); }
.verify-btn.on { border-style: solid; border-color: transparent; background: color-mix(in srgb, var(--verified) 14%, transparent); color: var(--verified); }

/* ---------- Legal pages ---------- */
.legal-layout { display: grid; grid-template-columns: 230px 1fr; gap: 32px; align-items: start; }
.legal-nav { position: sticky; top: 84px; display: flex; flex-direction: column; gap: 2px; }
.legal-nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; color: var(--muted); font-weight: 500; font-size: .92rem; }
.legal-nav a:hover { background: var(--surface-2); color: var(--ink); }
.legal-nav a.active { background: var(--surface); color: var(--ink); border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.legal { max-width: 760px; padding: 40px 48px; }
.legal h2 { font-size: 1.25rem; margin-top: 2em; scroll-margin-top: 84px; }
.legal p, .legal li { line-height: 1.75; }
.legal ul { padding-left: 20px; }
.legal li { margin-bottom: 6px; }
@media (max-width: 760px) {
  .legal-layout { grid-template-columns: 1fr; gap: 14px; }
  .legal-nav { position: static; flex-direction: row; overflow-x: auto; }
  .legal { padding: 24px 20px; }
  .thread { margin-left: 4px; padding-left: 12px; }
}

/* ---------- Shop, payments, marketplace ---------- */
.cover-photo { padding: 0; background: var(--surface-2); }
.cover-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tag-info { background: var(--critic-soft); color: var(--critic); }
.status-paid, .status-succeeded, .status-released, .status-done, .status-approved { background: var(--ok-soft); color: var(--ok); }
.status-awaiting_payment, .status-unpaid, .status-initiated, .status-held, .status-requested, .status-processing, .status-pending { background: var(--warn-soft); color: var(--warn); }
.status-failed, .status-disputed { background: var(--danger-soft); color: var(--danger); }
.status-expired, .status-refunded, .status-unlisted, .status-rejected, .status-cancelled { background: var(--surface-2); color: var(--muted); }
.sold-by { display: flex; align-items: center; gap: 10px; margin: -6px 0 20px; color: var(--muted); font-size: .9rem; }
.buy-note { flex-basis: 100%; margin: 0; }
.notice .bi { margin-right: 4px; }
.label-row { display: flex; justify-content: space-between; align-items: baseline; }
.label-row a { font-weight: 500; }

.pay-methods { display: grid; gap: 10px; }
.pay-methods.compact { grid-template-columns: 1fr 1fr; }
.pay-method { position: relative; display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; transition: border-color .15s, background .15s; }
.pay-method:hover { border-color: var(--muted); }
.pay-method:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.pay-method input { position: absolute; opacity: 0; pointer-events: none; }
.pay-method:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.pay-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--surface-2); color: var(--accent); font-size: 1.15rem; flex: none; }
.pay-method:has(input:checked) .pay-icon { background: var(--accent); color: var(--accent-ink); }
.pay-text { display: flex; flex-direction: column; flex: 1; line-height: 1.35; }
.compact .pay-method { padding: 10px 12px; }
.compact .pay-icon { width: 32px; height: 32px; font-size: 1rem; }
.secure-note { margin: 0; }
fieldset.field { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset[disabled] .pay-method { cursor: default; }
[hidden] { display: none !important; }

.pay-layout { max-width: 640px; margin: 0 auto; display: flex; flex-direction: column; gap: 22px; }
.pay-wait { text-align: center; padding: 36px 28px; }
.pay-wait-icon { display: inline-grid; place-items: center; width: 76px; height: 76px; border-radius: 24px; background: var(--ok-soft); color: var(--ok); font-size: 2.2rem; margin-bottom: 12px; animation: buzz 1.6s ease-in-out infinite; }
.pay-wait.failed .pay-wait-icon { background: var(--danger-soft); color: var(--danger); animation: none; }
@keyframes buzz { 0%, 70%, 100% { transform: rotate(0); } 75% { transform: rotate(-8deg); } 85% { transform: rotate(8deg); } 95% { transform: rotate(-4deg); } }
.pay-status { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; }
.pay-wait.failed .pay-status { color: var(--danger); }
.spinner { width: 16px; height: 16px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }
.pay-callout { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.pay-callout h3 { color: var(--ink); display: flex; align-items: center; gap: 8px; }

.escrow-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border); }
.escrow-actions { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; padding-bottom: 12px; }
.escrow-actions form { margin: 0; }
details.dispute > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
details.dispute > summary::-webkit-details-marker { display: none; }
details.dispute[open] > summary { margin-bottom: 10px; }
details.dispute .form { min-width: min(360px, 80vw); }

.library-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.library-item { display: flex; gap: 16px; align-items: center; }
.library-item .thumb { width: 64px; }
.library-item > div { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.library-item a:not(.btn) { color: var(--ink); }

.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 22px; align-items: start; }
.danger-card { border-color: var(--danger-soft); }
.danger-card h3 { color: var(--danger); }

.upload { display: flex; align-items: center; gap: 12px; padding: 16px; border: 1.5px dashed var(--border); border-radius: var(--radius-sm); cursor: pointer; font-weight: 400 !important; color: var(--muted); transition: border-color .15s; }
.upload:hover { border-color: var(--accent); color: var(--ink); }
.upload .bi { font-size: 1.4rem; color: var(--accent); }
.upload input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.upload:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

.inline-form { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 0; }
.inline-form input { width: 180px; padding: 6px 10px; font-size: .82rem; }
.listing-review { display: flex; gap: 18px; }
.listing-review .thumb { width: 80px; }
.listing-review-body { flex: 1; min-width: 0; }
.todo-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.todo { display: flex; align-items: center; gap: 12px; color: var(--ink); padding: 16px 18px; border-color: color-mix(in srgb, var(--warn) 35%, var(--border)); }
.todo:hover { color: var(--ink); box-shadow: var(--shadow); }
.todo .bi { font-size: 1.3rem; color: var(--warn); }
@media (max-width: 760px) {
  .order-items .mini-line { flex-wrap: wrap; }
  .order-items .mini-line > div { flex: 1 1 0; min-width: 0; }
  .order-items .mini-line .btn { order: 3; flex-basis: 100%; }
  .pay-methods.compact { grid-template-columns: 1fr; }
  .listing-review { flex-direction: column; }
  .inline-form input { width: 100%; }
}

/* ---------- Branding, ads, settings ---------- */
.logo-img { height: 34px; width: auto; max-width: 180px; object-fit: contain; display: block; }
.ad-slot { margin: 40px 0; padding: 14px; border: 1px dashed var(--border); border-radius: var(--radius); background: var(--surface); text-align: center; overflow: hidden; }
.reviews-main .ad-slot { margin: 0 0 22px; }
.ad-label { display: block; font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.settings-form { display: flex; flex-direction: column; gap: 22px; max-width: 860px; }
.brand-row { display: grid; grid-template-columns: 96px 1fr; gap: 18px; align-items: start; }
.brand-preview { display: grid; place-items: center; height: 96px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; }
.brand-preview img { max-width: 80px; max-height: 64px; object-fit: contain; }
.favicon-preview img { width: 48px; height: 48px; }
textarea.code { font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre; tab-size: 2; }
@media (max-width: 760px) { .brand-row { grid-template-columns: 64px 1fr; } .brand-preview { height: 64px; } }

/* ---------- Where to buy ---------- */
.where-to-buy { margin-top: 22px; max-width: 560px; }
.where-to-buy h3 { display: flex; align-items: center; gap: 8px; font-size: 1.05rem; margin-bottom: 10px; }
.where-to-buy ul { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.where-to-buy a { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); transition: border-color .15s, box-shadow .15s; }
.where-to-buy a:hover { border-color: var(--accent); box-shadow: var(--shadow-sm); color: var(--ink); }
.buy-link-store { font-weight: 600; }
.buy-link-host { color: var(--muted); font-size: .85rem; margin-right: auto; }
.where-to-buy .bi { color: var(--accent); }
.guide-price { display: flex; align-items: baseline; gap: 10px; margin: 0 0 6px; }
.buy-link-rows { display: flex; flex-direction: column; gap: 8px; }
.buy-link-row { display: grid; grid-template-columns: minmax(120px, 1fr) 2.5fr; gap: 8px; }
@media (max-width: 760px) { .buy-link-row { grid-template-columns: 1fr; } }

/* ---------- Profile pictures ---------- */
.avatar-img { object-fit: cover; background: var(--surface-2); padding: 0; }
.avatar-size { display: inline-flex; flex: none; }
.avatar-size.lg .avatar { width: 64px; height: 64px; font-size: 1.6rem; font-family: var(--serif); }
.avatar-size.xl .avatar { width: 88px; height: 88px; font-size: 2.2rem; font-family: var(--serif); }
.avatar-edit { display: flex; gap: 16px; align-items: flex-start; }
.avatar-edit .field { flex: 1; min-width: 0; }
.compact-upload { padding: 10px 14px; }
