:root {
  --bg: #f6f1e8;
  --surface: #fffdf8;
  --raised: #ffffff;
  --ink: #1d1814;
  --muted: #6d6257;
  --line: #e3d9c9;
  --accent: #b4441f;
  --accent-ink: #fffaf3;
  --good: #2f7d4f;
  --mid: #b8862b;
  --bad: #b23a2e;
  --tile: #efe7d9;
  --shadow: 0 1px 2px rgb(60 40 20 / 6%), 0 8px 24px rgb(60 40 20 / 8%);
  --serif: ui-serif, "New York", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --r: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14110e; --surface: #1c1814; --raised: #241f1a; --ink: #f3ebdf; --muted: #a89b8b; --line: #342c24;
    --accent: #e9824f; --accent-ink: #1a120c; --good: #6cc08c; --mid: #e0b45a; --bad: #e97a6c; --tile: #2a241e;
    --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 10px 30px rgb(0 0 0 / 35%);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #14110e; --surface: #1c1814; --raised: #241f1a; --ink: #f3ebdf; --muted: #a89b8b; --line: #342c24;
  --accent: #e9824f; --accent-ink: #1a120c; --good: #6cc08c; --mid: #e0b45a; --bad: #e97a6c; --tile: #2a241e;
  --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 10px 30px rgb(0 0 0 / 35%);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; }
body { margin: 0; overflow-x: clip; background: var(--bg); color: var(--ink); font: 16px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: -0.02em; line-height: 1.08; margin: 0; text-wrap: balance; }
p { margin: 0; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 12px; top: 12px; background: var(--raised); padding: 8px 12px; z-index: 50; }

/* header */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 20px; padding: 12px clamp(16px, 4vw, 40px);
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.mark { font-family: var(--serif); font-size: 22px; text-decoration: none; letter-spacing: -0.03em; display: inline-flex; align-items: center; gap: 8px; }
.mark b { font-weight: 700; color: var(--accent); }
.mark-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); box-shadow: inset 0 0 0 4px var(--bg), 0 0 0 1.5px var(--accent); }
.nav { display: flex; gap: 18px; margin-left: auto; font-size: 14px; }
.nav a, .link { color: var(--muted); text-decoration: none; background: none; border: 0; padding: 0; cursor: pointer; }
.nav a:hover, .link:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.tools { display: flex; gap: 8px; align-items: center; }
.icon-btn { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); cursor: pointer; display: grid; place-items: center; }
.icon-btn:hover { border-color: var(--muted); }
@media (max-width: 720px) { .nav { display: none; } .tools { margin-left: auto; } }

/* controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); cursor: pointer; text-decoration: none; font-weight: 600; font-size: 15px; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.primary:hover { filter: brightness(1.06); }
.btn:disabled { opacity: 0.55; cursor: default; }
.input, .select, textarea.input { min-height: 44px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); width: 100%; }
textarea.input { padding: 10px 14px; min-height: 76px; resize: vertical; }
.select { width: auto; padding-right: 30px; }
.select.small { min-height: 36px; font-size: 14px; border-radius: 999px; }
.check { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-size: 14px; white-space: nowrap; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

/* hero */
main { max-width: 1180px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 40px); }
.hero { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: clamp(24px, 5vw, 64px); align-items: center; padding: clamp(36px, 7vw, 88px) 0 clamp(28px, 5vw, 56px); }
.hero h1 { font-size: clamp(40px, 6.4vw, 76px); }
.lede { color: var(--muted); font-size: clamp(16px, 1.5vw, 19px); max-width: 52ch; margin: 18px 0 26px; }
.stats { display: flex; gap: clamp(20px, 4vw, 44px); margin: 34px 0 0; padding-top: 22px; border-top: 1px solid var(--line); }
.stats div { display: flex; flex-direction: column-reverse; }
.stats dt { color: var(--muted); font-size: 13px; }
.stats dd { margin: 0; font: 600 clamp(26px, 3.2vw, 38px)/1 var(--serif); font-variant-numeric: tabular-nums; }
.hero-shelf { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; min-width: 0; }
.hero-shelf .tile { aspect-ratio: 1; border-radius: 22px; display: grid; place-items: center; min-width: 0; overflow: hidden; }
.hero-shelf .tile:nth-child(3n + 2) { transform: translateY(18px); }
.hero-shelf img, .hero-shelf svg { width: 78%; height: 78%; object-fit: contain; filter: drop-shadow(0 10px 14px rgb(0 0 0 / 22%)); }
@media (max-width: 860px) { .hero { grid-template-columns: 1fr; } .hero-shelf { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; } .hero-shelf .tile { border-radius: 14px; } .hero-shelf .tile:nth-child(3n + 2) { transform: none; } .hero-shelf .tile:nth-child(n + 7) { display: none; } }

/* blocks */
.block { padding: clamp(28px, 5vw, 56px) 0; border-top: 1px solid var(--line); }
.block-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 24px; margin-bottom: 22px; }
.block-head h2 { font-size: clamp(26px, 3.4vw, 40px); }
.hint { color: var(--muted); font-size: 14px; max-width: 64ch; }
.empty { color: var(--muted); padding: 28px; text-align: center; border: 1px dashed var(--line); border-radius: var(--r); }

/* score badge */
.score { font: 700 15px/1 var(--mono); font-variant-numeric: tabular-nums; padding: 6px 8px; border-radius: 8px; background: var(--ink); color: var(--bg); white-space: nowrap; }
.score.good { background: var(--good); color: #fff; } .score.mid { background: var(--mid); color: #1a120c; } .score.bad { background: var(--bad); color: #fff; }
.score.none { background: transparent; color: var(--muted); border: 1px solid var(--line); font-weight: 500; font-family: var(--sans); font-size: 12px; }

/* ranking */
.rank { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 40px; }
.rank li { border-bottom: 1px solid var(--line); }
.rank button { all: unset; box-sizing: border-box; display: grid; grid-template-columns: 28px 48px minmax(0, 1fr) auto; align-items: center; gap: 12px; width: 100%; padding: 10px 4px; cursor: pointer; min-height: 64px; }
.rank button:hover .r-name { text-decoration: underline; text-underline-offset: 3px; }
.rank .pos { font: 600 15px var(--mono); color: var(--muted); text-align: right; }
.rank .thumb { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; }
.rank .thumb img, .rank .thumb svg { width: 80%; height: 80%; object-fit: contain; }
.r-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.r-sub { color: var(--muted); font-size: 13px; }
@media (max-width: 760px) { .rank { grid-template-columns: 1fr; } }

/* latest */
.latest { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.latest button { all: unset; box-sizing: border-box; cursor: pointer; display: flex; gap: 12px; align-items: flex-start; width: 100%; padding: 14px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); min-height: 76px; }
.latest button:hover { border-color: var(--muted); }
.latest .l-name { font-weight: 600; font-size: 14px; }
.latest .l-text { color: var(--muted); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* library */
.filters { display: grid; grid-template-columns: minmax(200px, 1fr) auto auto auto auto; gap: 10px 14px; align-items: center; }
@media (max-width: 860px) { .filters { grid-template-columns: 1fr 1fr; } .filters .input { grid-column: 1 / -1; } .filters .select { width: 100%; } }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 6px; }
.chip { min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: 14px; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.count { color: var(--muted); font-size: 13px; margin: 10px 0 14px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; }
.card { all: unset; box-sizing: border-box; cursor: pointer; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; transition: transform 0.15s ease, box-shadow 0.15s ease; }
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.card-img { position: relative; aspect-ratio: 4 / 3; display: grid; place-items: center; }
.card-img img, .card-img svg { width: 62%; height: 78%; object-fit: contain; filter: drop-shadow(0 8px 10px rgb(0 0 0 / 20%)); }
.card-img .score { position: absolute; top: 10px; right: 10px; }
.card-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.eyebrow { font: 500 11px/1.3 var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.card h3 { font-size: 19px; }
.note { color: var(--muted); font-size: 14px; }
.meta { margin-top: auto; padding-top: 10px; display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.bar { flex: 1; height: 5px; border-radius: 3px; background: var(--tile); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--ink); border-radius: 3px; }
@media (max-width: 520px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } .card h3 { font-size: 16px; } }
@media (prefers-reduced-motion: reduce) { .card { transition: none; } html { scroll-behavior: auto; } }

/* dialogs */
.sheet { border: 0; padding: 0; border-radius: 22px; background: var(--raised); color: var(--ink); width: min(880px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); box-shadow: var(--shadow); }
.sheet.narrow { width: min(460px, calc(100vw - 24px)); }
.sheet::backdrop { background: rgb(20 14 10 / 55%); backdrop-filter: blur(3px); }
.sheet .close { position: sticky; top: 12px; float: right; margin: 12px 12px 0 0; z-index: 2; }
.c-top { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 24px; padding: 28px 28px 0; align-items: center; }
.c-img { aspect-ratio: 1; border-radius: 20px; display: grid; place-items: center; }
.c-img img, .c-img svg { width: 72%; height: 72%; object-fit: contain; filter: drop-shadow(0 12px 16px rgb(0 0 0 / 24%)); }
.c-top h2 { font-size: clamp(28px, 4vw, 42px); margin: 6px 0 8px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.tag { font: 500 12px var(--mono); padding: 4px 9px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.c-link { font-size: 13px; color: var(--muted); }
.c-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; padding: 24px 28px 28px; }
.panel h3 { font-size: 20px; margin-bottom: 12px; }
.big { display: flex; align-items: baseline; gap: 10px; }
.big b { font: 700 56px/1 var(--serif); font-variant-numeric: tabular-nums; }
.big span { color: var(--muted); font-size: 14px; }
.dist { display: grid; grid-template-columns: repeat(11, 1fr); gap: 4px; align-items: end; height: 84px; margin: 16px 0 4px; }
.dist i { display: block; background: var(--ink); border-radius: 3px 3px 0 0; min-height: 2px; opacity: 0.85; }
.dist-x { display: grid; grid-template-columns: repeat(11, 1fr); gap: 4px; font: 11px var(--mono); color: var(--muted); text-align: center; }
.form { display: flex; flex-direction: column; gap: 14px; padding: 28px; }
.c-cols .form { padding: 0; }
.form label, .field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; }
.field small { font-weight: 400; color: var(--muted); display: flex; justify-content: space-between; }
.seg { display: grid; gap: 4px; }
.seg.s11 { grid-template-columns: repeat(11, 1fr); } .seg.s5 { grid-template-columns: repeat(5, 1fr); } .seg.s2 { grid-template-columns: repeat(2, 1fr); }
.seg label { display: block; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: grid; place-items: center; min-height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font: 600 14px var(--mono); }
.seg input:checked + span { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.msg { font-size: 14px; min-height: 1.4em; color: var(--muted); }
.msg.err { color: var(--bad); } .msg.ok { color: var(--good); }
.rated-note { padding: 14px 16px; border-radius: 12px; background: var(--tile); font-weight: 600; }
.comments { list-style: none; margin: 0; padding: 0 28px 28px; display: grid; gap: 10px; }
.comments li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 12px 0; border-top: 1px solid var(--line); font-size: 14px; }
.comments time { color: var(--muted); font-size: 12px; display: block; }
.c-section-title { padding: 0 28px; font-size: 20px; margin-bottom: 4px; }
@media (max-width: 720px) { .c-top { grid-template-columns: 1fr; padding: 20px 18px 0; } .c-img { max-width: 200px; } .c-cols { grid-template-columns: 1fr; padding: 20px 18px; } .comments, .c-section-title { padding-left: 18px; padding-right: 18px; } .seg span { min-height: 44px; } }

/* footer + consent */
.foot { max-width: 1180px; margin: 0 auto; padding: 32px clamp(16px, 4vw, 40px) 56px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; display: grid; gap: 12px; }
.foot p { max-width: 90ch; }
.foot-links { display: flex; flex-wrap: wrap; gap: 18px; }
.consent { position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 40; max-width: 560px; margin: 0 auto; padding: 16px 18px; border-radius: 18px; background: var(--raised); border: 1px solid var(--line); box-shadow: var(--shadow); display: grid; gap: 12px; font-size: 14px; }
.consent-actions { display: flex; gap: 8px; justify-content: flex-end; }
.consent .btn { min-height: 40px; }

/* legal pages */
.prose { max-width: 720px; margin: 0 auto; padding: 48px clamp(16px, 4vw, 40px) 80px; }
.prose h1 { font-size: clamp(32px, 5vw, 48px); margin-bottom: 20px; }
.prose h2 { font-size: 22px; margin: 32px 0 8px; }
.prose p, .prose li { color: var(--muted); margin-bottom: 10px; }
.prose mark { background: color-mix(in srgb, var(--mid) 35%, transparent); color: var(--ink); padding: 0 4px; border-radius: 4px; }

/* my rating */
.mine h3 { margin-bottom: 6px; }
.facts { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 16px; margin: 16px 0 18px; font-size: 14px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
