/* Style Atlas — styles */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

:root {
  --paper: #ffffff;
  --surface: #ffffff;
  --surface-2: #f3f4f0;
  --ink: #191b17;
  --ink-soft: #5c6154;
  --ink-faint: #858c7b;
  --line: #e4e6dc;
  --accent: #dfff65;
  --accent-ink: #191b17;
  --active-bg: #1b1e17;
  --active-text: #dfff65;
  --shadow: 0 1px 0 rgba(25,27,23,0.05);
  --radius: 3px;
  --font-ui: Arial, "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo,
    "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", "Noto Sans KR", "Malgun Gothic", sans-serif;
  --font-mono: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #14160f;
    --surface: #191c14;
    --surface-2: #20241a;
    --ink: #eef0e6;
    --ink-soft: #b7bcaa;
    --ink-faint: #7a8070;
    --line: #333827;
    --accent: #c9e85c;
    --accent-ink: #12140d;
    --active-bg: #2b3122;
    --active-text: #e4ff8f;
    --shadow: 0 1px 0 rgba(0,0,0,0.4);
  }
}
:root[data-theme="dark"] {
  --paper: #14160f;
  --surface: #191c14;
  --surface-2: #20241a;
  --ink: #eef0e6;
  --ink-soft: #b7bcaa;
  --ink-faint: #7a8070;
  --line: #333827;
  --accent: #c9e85c;
  --accent-ink: #12140d;
  --active-bg: #2b3122;
  --active-text: #e4ff8f;
  --shadow: 0 1px 0 rgba(0,0,0,0.4);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

.skip-link {
  position: absolute; left: -999px; top: 0;
  background: var(--accent); color: var(--accent-ink);
  padding: 0.5rem 1rem; z-index: 100;
  font-weight: 700;
}
.skip-link:focus { left: 0.5rem; top: 0.5rem; }

/* ---------- Top bar ---------- */
header.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  margin: 0;
  padding: 1rem 1.25rem;
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap;
}
.wordmark {
  display: flex; align-items: baseline; gap: 0.6rem; flex-wrap: wrap;
}
.wordmark h1 {
  font-family: var(--font-ui);
  font-weight: 900;
  font-size: 1.9rem;
  letter-spacing: -0.03em;
  margin: 0;
  text-wrap: balance;
}
.wordmark .kicker {
  font-family: var(--font-ui);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
  font-weight: 600;
}
.subline {
  font-size: 0.82rem;
  color: var(--ink-soft);
  margin-top: 0.3rem;
  max-width: 52ch;
}

.controls {
  display: flex; align-items: center; gap: 0.7rem; flex-wrap: wrap;
}
.count-badge {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--ink-soft);
  letter-spacing: 0.04em;
}
.seg {
  display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden;
}
.seg button {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 0.4rem 0.65rem;
  background: var(--surface);
  color: var(--ink-soft);
  border: none; border-right: 1px solid var(--line);
  cursor: pointer;
}
.seg button:last-child { border-right: none; }
.seg button[aria-pressed="true"] {
  background: var(--active-bg); color: var(--active-text);
}
.seg button:hover:not([aria-pressed="true"]) { background: var(--surface-2); }

button.pill {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.42rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 0.4rem;
}
button.pill:hover { border-color: var(--ink-faint); }
button.pill[aria-pressed="true"] {
  background: var(--active-bg); color: var(--active-text); border-color: var(--active-bg);
}

.lang-wrap { position: relative; }
.lang-btn {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.42rem 0.75rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 0.35rem;
}
.lang-btn:hover { border-color: var(--ink-faint); }
.lang-btn .car { font-size: 0.6rem; color: var(--ink-faint); }
.lang-menu {
  position: absolute; right: 0; top: calc(100% + 0.35rem);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 8px 20px rgba(0,0,0,0.08);
  min-width: 9rem; padding: 0.3rem;
  display: none; flex-direction: column; z-index: 40;
}
.lang-menu.open { display: flex; }
.lang-menu button {
  font-family: var(--font-ui);
  font-size: 0.82rem;
  text-align: left;
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius);
  border: none; background: transparent; color: var(--ink);
  cursor: pointer;
}
.lang-menu button:hover { background: var(--surface-2); }
.lang-menu button[aria-selected="true"] { color: var(--accent-ink); background: var(--accent); font-weight: 700; }

.info-bar {
  display: none;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  font-size: 0.8rem;
  color: var(--ink-soft);
}
.info-bar.open { display: block; }
.info-bar-inner { padding: 0.7rem 1.25rem; }

:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* ---------- Layout ---------- */
.layout {
  margin: 0;
  display: grid; grid-template-columns: 230px 1fr;
  gap: 0; align-items: start;
}

nav.rail {
  position: sticky; top: 78px;
  align-self: start;
  padding: 1.5rem 1rem 2rem 1.25rem;
  border-right: 1px solid var(--line);
  max-height: calc(100vh - 78px);
  overflow-y: auto;
}
nav.rail h2 {
  font-family: var(--font-ui);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
  font-weight: 700;
  margin: 0 0 0.75rem;
}
.rail-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.1rem; }
.rail-list a {
  display: flex; align-items: baseline; gap: 0.55rem;
  text-decoration: none;
  padding: 0.34rem 0.5rem;
  border-radius: var(--radius);
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--ink-soft);
  border-left: 3px solid transparent;
}
.rail-list a .code {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 400;
  color: var(--ink-faint);
  min-width: 1.3em;
}
.rail-list a .n {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 400;
  color: var(--ink-faint);
}
.rail-list a:hover { background: var(--surface-2); color: var(--ink); }
.rail-list a[aria-current="true"] {
  background: var(--surface-2); color: var(--ink);
  border-left: 3px solid var(--accent);
}

main { padding: 1.5rem 1.25rem 6rem; min-width: 0; }

section.category { margin-bottom: 3rem; scroll-margin-top: 88px; }
.cat-head {
  display: flex; align-items: baseline; gap: 0.75rem; flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.5rem; margin-bottom: 0.9rem;
}
.cat-head .code {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--ink-faint);
}
.cat-head h2 {
  font-family: var(--font-ui);
  font-weight: 800;
  font-size: 1.35rem;
  letter-spacing: -0.01em;
  margin: 0;
  text-wrap: balance;
}
.cat-head .local {
  font-size: 0.82rem;
  color: var(--ink-faint);
  font-weight: 600;
}
.cat-head .n {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ink-faint);
}
.cat-blurb {
  font-size: 0.84rem; color: var(--ink-soft); max-width: 64ch; margin: -0.2rem 0 1rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--card-size, 250px), 1fr));
  gap: 0.9rem;
}

html[data-size="s"] { --card-size: 180px; }
html[data-size="m"] { --card-size: 250px; }
html[data-size="l"] .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.25rem; }
html[data-size="l"] .card-label { padding: 0.7rem 0.85rem 0.8rem; }
html[data-size="l"] .card-label .name { font-size: 0.95rem; }
html[data-size="l"] .card-label .id { font-size: 0.72rem; }

.card {
  position: relative;
  cursor: pointer;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex; flex-direction: column;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.card:hover { transform: translateY(-2px); border-color: var(--ink-faint); }
.thumb-wrap { position: relative; }
img.thumb { display: block; width: 100%; height: auto; aspect-ratio: 1 / 1; object-fit: cover; background: var(--surface-2); }
.card-label {
  padding: 0.45rem 0.55rem 0.55rem;
  display: flex; flex-direction: column; gap: 0.15rem;
}
.card-label .name {
  font-size: 0.76rem; font-weight: 700; line-height: 1.2;
}
.card-label .id {
  font-family: var(--font-mono);
  font-size: 0.63rem;
  color: var(--ink-faint);
}

.select-badge {
  position: absolute; top: 0.4rem; right: 0.4rem;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  font-family: var(--font-ui); font-size: 0.85rem; font-weight: 700; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; z-index: 3;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}
.select-badge:hover { border-color: var(--ink-faint); }
.select-badge.on {
  background: var(--accent); color: var(--accent-ink); border-color: var(--accent);
}
.card.selected { outline: 2px solid var(--accent); outline-offset: -2px; }

/* ---------- Compare bar ---------- */
.compare-bar {
  position: fixed; left: 50%; bottom: 1.2rem; z-index: 30;
  transform: translateX(-50%) translateY(140%);
  transition: transform 0.3s ease;
  background: var(--active-bg); color: var(--active-text);
  border-radius: 999px;
  box-shadow: 0 14px 34px rgba(0,0,0,0.32);
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.45rem 0.55rem 0.45rem 0.55rem;
  max-width: calc(100vw - 2rem);
}
.compare-bar.open { transform: translateX(-50%) translateY(0); }
.compare-bar-thumbs { display: flex; gap: 0.35rem; }
.compare-bar-thumbs .thumb {
  position: relative; width: 40px; height: 40px; border-radius: 8px; overflow: hidden;
  border: 1px solid rgba(255,255,255,0.25); flex: 0 0 auto;
}
.compare-bar-thumbs .thumb img { width: 100%; height: 100%; display: block; object-fit: cover; }
.compare-bar-thumbs .thumb button {
  position: absolute; top: -5px; right: -5px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; color: #14160f; border: none; font-size: 0.62rem; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.compare-bar-count {
  font-family: var(--font-mono); font-size: 0.72rem; color: var(--active-text);
  opacity: 0.85; white-space: nowrap; padding: 0 0.1rem;
}
.compare-bar-action {
  font-family: var(--font-ui); font-weight: 800; font-size: 0.8rem;
  background: var(--accent); color: var(--accent-ink);
  border: none; border-radius: 999px; padding: 0.5rem 0.95rem; cursor: pointer; white-space: nowrap;
}
.compare-bar-action:disabled { opacity: 0.45; cursor: not-allowed; }
.compare-bar-close {
  width: 28px; height: 28px; border-radius: 50%; border: none; flex: 0 0 auto;
  background: rgba(255,255,255,0.15); color: var(--active-text);
  cursor: pointer; font-size: 0.85rem;
}

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(20,23,20,0.6);
  display: flex; align-items: center; justify-content: center;
  padding: 2rem;
  opacity: 0; pointer-events: none;
  transition: opacity 0.18s ease;
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }
.modal-box {
  background: var(--surface);
  border-radius: var(--radius);
  width: 100%; max-width: 760px; max-height: 88vh;
  overflow-y: auto;
  box-shadow: 0 24px 60px rgba(0,0,0,0.35);
  position: relative;
}
.modal-box.wide { max-width: 1040px; }
.modal-close {
  position: absolute; top: 0.6rem; right: 0.6rem; z-index: 5;
  width: 32px; height: 32px; border-radius: 50%;
  border: none; background: var(--active-bg); color: var(--active-text);
  font-size: 1rem; cursor: pointer;
}
.modal-layout {
  display: grid; grid-template-columns: 1.1fr 1fr;
}
@media (max-width: 720px) {
  .modal-layout { grid-template-columns: 1fr; }
}
.modal-image {
  background: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
  padding: 1.2rem;
}
.modal-image img { display: block; width: 100%; height: auto; aspect-ratio: 1 / 1; object-fit: contain; border-radius: var(--radius); }
.modal-panel {
  padding: 1.4rem 1.4rem 1.2rem;
  display: flex; flex-direction: column; gap: 0.65rem;
  min-width: 0;
}
.modal-panel .crumb {
  font-size: 0.7rem; color: var(--ink-faint); font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.modal-panel .title {
  font-size: 1.3rem; font-weight: 800; letter-spacing: -0.01em; margin: 0;
  text-wrap: balance;
}
.modal-panel .idline {
  font-family: var(--font-mono); font-size: 0.7rem; color: var(--ink-faint);
}
.modal-btn-row { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.copy-btn {
  font-family: var(--font-ui); font-weight: 700; font-size: 0.8rem;
  border-radius: 999px; padding: 0.5rem 0.95rem; cursor: pointer; text-align: center;
  border: 1px solid transparent;
}
.copy-btn.primary { background: var(--accent); color: var(--accent-ink); }
.copy-btn.primary:hover { filter: brightness(0.96); }
.copy-btn.secondary { background: transparent; border-color: var(--line); color: var(--ink); }
.copy-btn.secondary:hover { border-color: var(--ink-faint); }
.modal-tabs { display: flex; gap: 0.9rem; border-bottom: 1px solid var(--line); margin-top: 0.2rem; }
.modal-tabs button {
  font-family: var(--font-ui); font-size: 0.78rem; font-weight: 700;
  padding: 0.5rem 0; border: none; background: none; color: var(--ink-faint);
  cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.modal-tabs button.active { color: var(--ink); border-bottom-color: var(--accent); }
.tab-panel {
  font-size: 0.84rem; color: var(--ink-soft); line-height: 1.55;
  background: var(--surface-2); border-radius: var(--radius); padding: 0.8rem 0.9rem;
}
.tab-panel.prompt {
  font-family: var(--font-mono); font-size: 0.76rem; white-space: pre-wrap; overflow-wrap: anywhere;
  max-height: 18rem; overflow-y: auto;
}
.modal-disclaimer { font-size: 0.72rem; color: var(--ink-faint); line-height: 1.5; }
.modal-compare-toggle {
  font-family: var(--font-ui); font-size: 0.8rem; font-weight: 700;
  padding: 0.5rem 0.9rem; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  cursor: pointer; display: inline-flex; align-items: center; gap: 0.4rem; align-self: flex-start;
}
.modal-compare-toggle.on { background: var(--active-bg); color: var(--active-text); border-color: var(--active-bg); }
.modal-nav-row {
  display: flex; align-items: center; justify-content: center; gap: 1rem;
  padding: 0.8rem 1rem 1.1rem;
  border-top: 1px solid var(--line);
}
.modal-nav-row button {
  width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); cursor: pointer; font-size: 1rem;
}
.modal-nav-row .counter { font-family: var(--font-mono); font-size: 0.75rem; color: var(--ink-faint); }

.compare-body { padding: 1.2rem; }
.compare-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: 1rem;
}
.compare-grid .item img {
  display: block; width: 100%; height: auto; aspect-ratio: 1 / 1; object-fit: cover;
  border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--surface-2);
}
.compare-grid .item .name { font-size: 0.8rem; font-weight: 700; margin-top: 0.4rem; }
.compare-grid .item .id { font-family: var(--font-mono); font-size: 0.65rem; color: var(--ink-faint); }

footer.credit {
  margin: 0; padding: 1rem 1.25rem 3rem;
  color: var(--ink-faint); font-size: 0.74rem; max-width: 70ch;
}
@media (min-width: 821px) {
  footer.credit { margin-left: 230px; }
}

/* ---------- card link (cards are real links to /style/NNN/) ---------- */
.card-link {
  display: flex; flex-direction: column; flex: 1;
  color: inherit; text-decoration: none;
}
.card-link:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }

/* ---------- about + FAQ (home) ---------- */
.about {
  border-top: 1px solid var(--line);
  margin-top: 1rem; padding-top: 2rem;
  display: grid; gap: 2.5rem;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}
.about h2 {
  font-size: 1.15rem; font-weight: 800; letter-spacing: -0.01em;
  margin: 0 0 0.8rem;
}
.about p { font-size: 0.9rem; line-height: 1.75; color: var(--ink-soft); margin: 0 0 0.9rem; max-width: 62ch; }
.faq-list details {
  border-bottom: 1px solid var(--line);
  padding: 0.75rem 0;
}
.faq-list summary {
  cursor: pointer; font-weight: 700; font-size: 0.92rem; line-height: 1.5;
  list-style: none; display: flex; gap: 0.6rem; align-items: baseline;
}
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary::before { content: "+"; font-family: var(--font-mono); color: var(--ink-faint); }
.faq-list details[open] summary::before { content: "−"; }
.faq-list details p { margin: 0.55rem 0 0.2rem 1.2rem; }

/* ---------- modal additions ---------- */
.modal-desc { font-size: 0.86rem; line-height: 1.7; color: var(--ink-soft); margin: 0; }
.prompt-lang {
  display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap;
  font-size: 0.74rem; color: var(--ink-faint); font-weight: 700;
}
.prompt-lang .seg button { font-family: var(--font-ui); letter-spacing: 0; }
.modal-page-link {
  font-size: 0.8rem; font-weight: 700; color: var(--ink); text-underline-offset: 3px;
  align-self: flex-start;
}

/* ---------- style detail page ---------- */
.crumbs {
  font-size: 0.78rem; color: var(--ink-faint);
  padding: 0.9rem 1.25rem 0;
}
.crumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.35rem; }
.crumbs li + li::before { content: "/"; margin-right: 0.35rem; }
.crumbs a { color: var(--ink-soft); text-decoration: none; }
.crumbs a:hover { color: var(--ink); text-decoration: underline; }

.detail {
  padding: 1.25rem 1.25rem 3rem;
  display: grid; gap: 2rem;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  align-items: start;
}
.detail-image {
  position: sticky; top: 1rem;
  background: var(--surface-2); border-radius: var(--radius); padding: 1rem;
}
.detail-image img { display: block; width: 100%; height: auto; aspect-ratio: 1 / 1; border-radius: var(--radius); }
.detail-body { display: flex; flex-direction: column; gap: 0.9rem; min-width: 0; }
.detail-body .eyebrow { font-size: 0.74rem; font-weight: 700; color: var(--ink-faint); letter-spacing: 0.04em; }
.detail-body .eyebrow a { color: inherit; }
.detail-body h1 { font-size: 2rem; font-weight: 900; letter-spacing: -0.02em; margin: 0; line-height: 1.2; text-wrap: balance; }
.detail-body .alt-names { font-size: 0.85rem; color: var(--ink-faint); margin: -0.4rem 0 0; }
.detail-body .lead { font-size: 1rem; line-height: 1.8; color: var(--ink-soft); margin: 0; max-width: 60ch; }
.detail-body h2 { font-size: 1.05rem; font-weight: 800; margin: 0.8rem 0 0; }
.prompt-block { display: flex; flex-direction: column; gap: 0.65rem; }
.prompt-block .tab-panel.prompt { max-height: none; }
.detail-nav {
  display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  border-top: 1px solid var(--line); padding-top: 1rem; margin-top: 0.5rem;
  font-size: 0.85rem;
}
.detail-nav a { color: var(--ink); text-decoration: none; font-weight: 700; }
.detail-nav a:hover { text-decoration: underline; }
.detail-nav .dir { display: block; font-size: 0.7rem; color: var(--ink-faint); font-weight: 700; }

.related { padding: 0 1.25rem 3rem; }
.related h2 { font-size: 1.15rem; font-weight: 800; margin: 0 0 0.9rem; border-bottom: 1px solid var(--line); padding-bottom: 0.5rem; }
.related .grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.detail-footer { margin-left: 0; }

@media (max-width: 820px) {
  .about { grid-template-columns: minmax(0, 1fr); gap: 1.5rem; }
  .crumbs { padding: 0.8rem 1rem 0; }
  .detail { grid-template-columns: minmax(0, 1fr); padding: 1rem 1rem 2rem; gap: 1.25rem; }
  .detail-image { position: static; padding: 0.6rem; }
  .detail-body h1 { font-size: 1.55rem; }
  .related { padding: 0 1rem 2rem; }
  .related .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
  /* header scrolls away; the category bar is what stays pinned */
  header.topbar { position: static; }
  .topbar-inner { padding: 1rem 1rem 0.85rem; gap: 0.75rem; }
  .topbar-inner > div:first-child { width: 100%; }
  .wordmark h1 { font-size: 1.6rem; }
  .subline { font-size: 0.88rem; line-height: 1.55; max-width: none; margin-top: 0.4rem; }
  .controls { width: 100%; gap: 0.5rem; }
  .count-badge { display: none; }
  .lang-wrap { margin-left: auto; }
  .seg button { padding: 0.5rem 0.75rem; }
  button.pill, .lang-btn { padding: 0.5rem 0.85rem; }
  .info-bar-inner { padding: 0.8rem 1rem; line-height: 1.6; }

  .layout { grid-template-columns: minmax(0, 1fr); }
  nav.rail {
    position: sticky; top: 0; z-index: 15; min-width: 0;
    max-height: none; overflow: visible;
    background: var(--paper);
    border-right: none; border-bottom: 1px solid var(--line);
    padding: 0;
  }
  nav.rail h2 { display: none; }
  .rail-list {
    position: relative; flex-direction: row; gap: 0.4rem;
    overflow-x: auto; overscroll-behavior-x: contain;
    padding: 0.6rem 1rem;
    scrollbar-width: none;
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 1rem, #000 calc(100% - 1.5rem), transparent 100%);
            mask-image: linear-gradient(90deg, transparent 0, #000 1rem, #000 calc(100% - 1.5rem), transparent 100%);
  }
  .rail-list::-webkit-scrollbar { display: none; }
  .rail-list li { flex: 0 0 auto; }
  .rail-list a,
  .rail-list a[aria-current="true"] {
    white-space: nowrap;
    align-items: center; gap: 0.35rem;
    padding: 0.45rem 0.85rem;
    border: 1px solid var(--line); border-radius: 999px;
    background: var(--surface);
    font-size: 0.84rem; color: var(--ink-soft);
  }
  .rail-list a .code { display: none; }
  .rail-list a .n { margin-left: 0; font-size: 0.7rem; }
  .rail-list a[aria-current="true"] {
    background: var(--active-bg); color: var(--active-text); border-color: var(--active-bg);
  }
  .rail-list a[aria-current="true"] .n { color: inherit; opacity: 0.7; }

  main { padding: 1.1rem 1rem 6rem; }
  section.category { margin-bottom: 2.25rem; scroll-margin-top: 64px; }
  .cat-head { gap: 0.5rem; }
  .cat-head h2 { font-size: 1.2rem; }
  .cat-blurb { font-size: 0.86rem; margin-bottom: 0.85rem; }
  .grid { gap: 0.65rem; }
  html[data-size="s"] .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.45rem; }
  html[data-size="s"] .card-label .name { font-size: 0.72rem; }
  html[data-size="m"] .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  html[data-size="l"] .grid { grid-template-columns: minmax(0, 1fr); gap: 1rem; }
  .card-label { padding: 0.5rem 0.6rem 0.6rem; }
  .card-label .name { font-size: 0.82rem; line-height: 1.3; }

  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal-box { max-height: 92vh; border-radius: 12px 12px 0 0; }
  .modal-close { position: fixed; top: calc(8vh + 0.6rem); right: 0.6rem; width: 36px; height: 36px; box-shadow: 0 2px 8px rgba(0,0,0,0.25); }
  .modal-image { padding: 0.75rem; }
  .modal-panel { padding: 1rem 1rem 0.9rem; }
  .modal-panel .title { font-size: 1.2rem; padding-right: 2.2rem; }
  .copy-btn { flex: 1 1 auto; }
  .tab-panel.prompt { max-height: 14rem; }
  .compare-bar { bottom: 0.75rem; }
}

/* ---------- standalone page header ---------- */
header.topbar.static { position: static; }
.wordmark .brand {
  font-family: var(--font-ui); font-weight: 900; font-size: 1.6rem; letter-spacing: -0.03em;
  color: var(--ink); text-decoration: none;
}
.wordmark .brand:hover { text-decoration: underline; text-underline-offset: 4px; }
a.pill { text-decoration: none; }

/* keep the standalone page readable on very wide screens (the home gallery stays full-width) */
.crumbs, .detail, .related, footer.detail-footer { max-width: 1320px; margin-left: auto; margin-right: auto; }
footer.detail-footer { max-width: 1320px; }

/* ---------- cookie consent ---------- */
.consent-banner {
  position: fixed; left: 50%; bottom: 1rem; transform: translateX(-50%); z-index: 120;
  width: min(640px, calc(100vw - 2rem));
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 12px 36px rgba(0,0,0,0.22);
  padding: 0.9rem 1rem;
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
}
.consent-banner[hidden] { display: none; }
.consent-msg { margin: 0; flex: 1 1 260px; font-size: 0.84rem; line-height: 1.6; color: var(--ink-soft); }
.consent-actions { display: flex; gap: 0.5rem; }
.consent-link { margin: -2.25rem 0 2.5rem; padding: 0 1.25rem; }
.consent-link button {
  font: inherit; font-size: 0.74rem; color: var(--ink-faint);
  background: none; border: none; padding: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 3px;
}
.consent-link button:hover { color: var(--ink); }
@media (min-width: 821px) {
  .consent-link:not(.detail-footer) { margin-left: 230px; }
}
