:root {
  --ink: #121d2e;
  --ink-2: #2b3a5c;
  --text: #1d2230;
  --muted: #5d6578;
  --line: #e2e4ea;
  --bg: #faf9f6;
  --card: #ffffff;
  --accent: #8a2c2c;
  --accent-soft: #f6eaea;
  --gold: #a8895a;
  --chip: #eef0f5;
  --mark: #fff2b3;
  --radius: 10px;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e7ebf5;
    --ink-2: #c3cbe0;
    --text: #dfe3ec;
    --muted: #9aa3b8;
    --line: #2b3242;
    --bg: #11141b;
    --card: #181c26;
    --accent: #e08a8a;
    --accent-soft: #2a1d22;
    --gold: #d6c4a3;
    --chip: #232938;
    --mark: #5a4b12;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.6 var(--sans);
}
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3 { font-family: var(--serif); color: var(--ink); line-height: 1.25; }
h1 { font-size: clamp(1.6rem, 3.2vw, 2.25rem); margin: .2em 0 .4em; }
h2 { font-size: 1.35rem; margin: 1.6em 0 .6em; }
h3 { font-size: 1.1rem; margin: 1.4em 0 .4em; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 780px; }
.muted { color: var(--muted); }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 8px; top: 8px; background: var(--card); padding: 8px; z-index: 10; }

/* header */
.site-head { background: #121d2e; color: #fff; }
.head-row { display: flex; align-items: center; gap: 18px; padding-top: 12px; padding-bottom: 12px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 8px; color: #fff; text-decoration: none; }
.brand-mark { display: block; height: 40px; width: auto; }
.brand-name { font-family: Cinzel, var(--serif); font-weight: 600; font-size: 1.3rem; letter-spacing: 3px; text-transform: uppercase; color: #d6c4a3; padding-top: 2px; }
.head-search { flex: 1 1 320px; display: flex; min-width: 0; }
.head-search input {
  flex: 1; min-width: 0; padding: 9px 12px; border: 0; border-radius: 8px 0 0 8px;
  font: inherit; font-size: .95rem; background: #fff; color: #1d2230;
}
.head-search button, .btn {
  padding: 9px 14px; border: 0; border-radius: 0 8px 8px 0; cursor: pointer;
  background: #d6c4a3; color: #121d2e; font: 600 .95rem var(--sans);
}
.head-nav { display: flex; gap: 16px; }
.head-nav a { color: #e7ebf5; text-decoration: none; font-size: .95rem; }
.head-nav a:hover { color: #fff; text-decoration: underline; }
@media (max-width: 720px) {
  .head-row { gap: 10px; }
  .head-search { order: 3; flex-basis: 100%; }
  .head-nav { order: 4; flex-basis: 100%; gap: 18px; overflow-x: auto; font-size: .9rem; }
  .brand-name { font-size: 1.15rem; letter-spacing: 2px; }
  .brand-mark { height: 34px; }
}
body { overflow-x: hidden; }
.body, .headnote, .item-title, .facts dd { overflow-wrap: anywhere; }

/* hero */
.hero { background: linear-gradient(180deg, #121d2e 0%, #1f2a40 100%); color: #e7ebf5; padding: 48px 0 56px; }
.hero h1 { color: #fff; font-size: clamp(1.8rem, 4vw, 2.7rem); max-width: 760px; }
.hero p { max-width: 640px; color: #c3cbe0; font-size: 1.05rem; }
.hero-search { display: flex; max-width: 680px; margin-top: 22px; }
.hero-search input { flex: 1; min-width: 0; padding: 14px 16px; font: inherit; font-size: 1.05rem; border: 0; border-radius: 10px 0 0 10px; }
.hero-search button { padding: 0 22px; border: 0; border-radius: 0 10px 10px 0; background: #d6c4a3; color: #121d2e; font: 600 1rem var(--sans); cursor: pointer; }
.hero-hints { margin-top: 12px; font-size: .9rem; color: #9aa3b8; }
.hero-hints a { color: #d6c4a3; }
.stats { display: flex; gap: 28px; flex-wrap: wrap; margin-top: 28px; }
.stats b { display: block; font-family: var(--serif); font-size: 1.5rem; color: #fff; }
.stats span { font-size: .85rem; color: #9aa3b8; }

/* layout */
.page { padding-top: 28px; padding-bottom: 56px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 36px; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }
.crumbs { font-size: .85rem; color: var(--muted); margin-bottom: 6px; }
.crumbs a { color: var(--muted); }

/* cards and lists */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.card + .card { margin-top: 16px; }
.card h2:first-child, .card h3:first-child { margin-top: 0; }
.list { list-style: none; padding: 0; margin: 0; }
.item { padding: 16px 0; border-bottom: 1px solid var(--line); }
.item:last-child { border-bottom: 0; }
.item-title { font-family: var(--serif); font-size: 1.12rem; font-weight: 600; color: var(--ink); text-decoration: none; }
.item-title:hover { text-decoration: underline; }
.item-meta { font-size: .85rem; color: var(--muted); margin: 3px 0 6px; display: flex; flex-wrap: wrap; gap: 4px 12px; }
.item-snip { margin: 0; font-size: .95rem; }
.item-snip mark, .body mark { background: var(--mark); color: inherit; padding: 0 2px; border-radius: 2px; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: .78rem; font-weight: 600; background: var(--accent-soft); color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-block; padding: 3px 10px; border-radius: 99px; background: var(--chip); color: var(--ink-2); font-size: .85rem; text-decoration: none; }
.chip:hover { background: var(--line); }
.cols { columns: 3 220px; column-gap: 28px; }
.cols a { display: block; padding: 3px 0; break-inside: avoid; }
.count { color: var(--muted); font-size: .85rem; }

/* judgment page */
.j-head { border-bottom: 1px solid var(--line); padding-bottom: 14px; margin-bottom: 20px; }
.j-cites { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 4px; }
.cite { font: 600 .85rem var(--sans); padding: 3px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--card); color: var(--ink-2); cursor: pointer; }
.cite:hover { border-color: var(--gold); }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; font-size: .93rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.author-tag { font-size: .75rem; color: var(--gold); font-weight: 600; margin-left: 4px; }
.headnote { font-family: var(--serif); font-size: 1.04rem; line-height: 1.65; }
.headnote p { margin: 0 0 .8em; }
.src-note { font-size: .8rem; color: var(--muted); margin-top: 10px; }
.body { font-family: var(--serif); font-size: 1.06rem; line-height: 1.75; }
.body p { margin: 0 0 1em; }
.body p.num { position: relative; }
.body .pn { font: 600 .8rem var(--sans); color: var(--muted); text-decoration: none; margin-right: 6px; }
.body h3 { font-family: var(--sans); font-size: .95rem; letter-spacing: .4px; text-transform: uppercase; color: var(--ink-2); }
.side h3 { font-family: var(--sans); font-size: .85rem; letter-spacing: .5px; text-transform: uppercase; color: var(--muted); margin: 0 0 8px; }
.side .card { padding: 14px 16px; }
.side ul { padding-left: 18px; margin: 0; font-size: .92rem; }
.side li { margin: 4px 0; }
.side .sticky { position: sticky; top: 12px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0; }
.btn-line { display: inline-block; padding: 7px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink); text-decoration: none; font-size: .9rem; font-weight: 500; }
.btn-line:hover { border-color: var(--gold); }
details.more summary { cursor: pointer; color: var(--accent); font-size: .92rem; }

/* search */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin: 10px 0 18px; }
.filters label { display: flex; flex-direction: column; font-size: .8rem; color: var(--muted); gap: 3px; }
.filters select, .filters input { padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--text); font: inherit; font-size: .9rem; }
.filters .btn { border-radius: 8px; }
.pager { display: flex; gap: 18px; align-items: center; justify-content: center; margin: 26px 0 0; font-size: .95rem; }

/* forms */
.form label { display: block; font-weight: 500; margin: 14px 0 4px; }
.form input, .form select, .form textarea { width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--text); font: inherit; }
.form textarea { min-height: 140px; }
.form .btn { margin-top: 16px; border-radius: 8px; padding: 10px 18px; }
.hp { position: absolute; left: -5000px; }
.notice { padding: 12px 14px; border-radius: 8px; background: var(--accent-soft); color: var(--text); }
.prose p, .prose li { max-width: 72ch; }

/* footer */
.site-foot { border-top: 1px solid var(--line); background: var(--card); padding: 32px 0 20px; font-size: .92rem; }
.foot-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 24px; }
.foot-grid a { display: block; color: var(--text); text-decoration: none; padding: 2px 0; }
.foot-grid a:hover { color: var(--accent); }
.foot-brand { font-family: Cinzel, var(--serif); font-weight: 600; font-size: 1.1rem; letter-spacing: 2px; text-transform: uppercase; color: var(--ink); margin: 0 0 6px; }
.foot-h { font-weight: 600; margin: 0 0 6px; }
.foot-note { margin-top: 18px; font-size: .82rem; }
@media (max-width: 720px) { .foot-grid { grid-template-columns: 1fr 1fr; } .foot-grid > div:first-child { grid-column: 1 / -1; } }
@media print { .site-head, .site-foot, .side, .actions { display: none; } .grid-2 { display: block; } }

/* advanced search */
.search-panel { margin: 6px 0 16px; }
.sp-main { display: flex; gap: 0; }
.sp-main input { flex: 1; min-width: 0; padding: 11px 12px; border: 1px solid var(--line); border-right: 0; border-radius: 8px 0 0 8px; background: var(--bg); color: var(--text); font: inherit; }
.sp-main .btn { border-radius: 0 8px 8px 0; padding: 0 20px; }
.sp-opts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 12px; }
.sp-opts label { display: flex; flex-direction: column; gap: 3px; font-size: .78rem; color: var(--muted); }
.sp-opts select { padding: 7px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--text); font: inherit; font-size: .9rem; min-width: 0; }
.active-filters, .kw-hits { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0 0 14px; }
.chip-x { background: var(--accent-soft); color: var(--accent); }
.chip-x span { margin-left: 2px; font-weight: 700; }
.chip-clear { font-size: .85rem; margin-left: 4px; }
.facets .facet { list-style: none; padding: 0; margin: 0; }
.facets .facet li { display: flex; justify-content: space-between; gap: 8px; padding: 3px 0; }
.results-grid { margin-top: 4px; }

/* indexes */
.az { display: flex; flex-wrap: wrap; gap: 4px; margin: 14px 0 18px; }
.az a, .az span { display: inline-flex; align-items: center; justify-content: center; min-width: 32px; height: 32px; border-radius: 6px; font-weight: 600; font-size: .9rem; text-decoration: none; }
.az a { background: var(--chip); color: var(--ink-2); }
.az a:hover { background: var(--line); }
.az a.on { background: var(--ink); color: var(--bg); }
.az .az-off { color: var(--line); }
.index-filter { display: flex; max-width: 520px; margin: 10px 0 0; }
.index-filter input { flex: 1; min-width: 0; padding: 9px 11px; border: 1px solid var(--line); border-right: 0; border-radius: 8px 0 0 8px; background: var(--card); color: var(--text); font: inherit; }
.index-filter .btn { border-radius: 0 8px 8px 0; }
.index-cols { columns: 3 240px; }
.index-cols a { font-size: .95rem; }
.index-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; margin: 18px 0 10px; }
.index-card { display: block; text-decoration: none; color: var(--text); transition: border-color .15s; }
.index-card + .index-card { margin-top: 0; }
.index-card:hover { border-color: var(--gold); }
.index-card h2 { margin: 0 0 4px; font-size: 1.15rem; }
.index-card p { margin: 0 0 8px; font-size: .92rem; color: var(--muted); }
.list.compact .item { padding: 9px 0; }
.list.compact .item-title { font-size: 1rem; }

/* suggestions */
.suggest-wrap { position: relative; }
.suggest { position: absolute; left: 0; right: 0; top: 100%; z-index: 30; margin: 4px 0 0; padding: 4px; list-style: none; background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.18); max-height: 70vh; overflow-y: auto; text-align: left; }
.suggest li a { display: grid; grid-template-columns: 64px 1fr auto; gap: 8px; align-items: baseline; padding: 8px 10px; border-radius: 6px; color: var(--text); text-decoration: none; font-size: .92rem; }
.suggest li.on a, .suggest li a:hover { background: var(--chip); }
.sg-type { font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.sg-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sg-meta { font-size: .78rem; color: var(--muted); white-space: nowrap; }
@media (max-width: 560px) { .suggest li a { grid-template-columns: 1fr; gap: 0; } .sg-meta { display: none; } }
