:root {
  --bg: #f5f3ee; --card: #ffffff; --ink: #1b2028; --muted: #616b77; --line: #e6e1d6; --line-2: #efebe3;
  --brand: #7b2d26; --brand-2: #a3412f; --brand-ink: #ffffff; --brand-soft: #f6e9e5;
  --gold: #b8862b; --gold-soft: #f7efdc; --teal: #2b6f6a; --teal-soft: #e1f0ee; --slate: #56606d; --slate-soft: #eceef1;
  --mark: #ffe48a; --mark-active: #ffb547;
  --good: #2e7d4f; --bad: #b3362f;
  --radius: 14px;
  --shadow-sm: 0 1px 2px rgba(30, 20, 10, .06);
  --shadow: 0 1px 2px rgba(30, 20, 10, .05), 0 8px 24px -8px rgba(30, 20, 10, .12);
  --shadow-lg: 0 2px 6px rgba(30, 20, 10, .06), 0 24px 48px -16px rgba(60, 20, 10, .28);
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121418; --card: #1b1f26; --ink: #ebe8e2; --muted: #9aa3ad; --line: #2b313a; --line-2: #232830;
    --brand: #e08d74; --brand-2: #f0a58c; --brand-ink: #1a0f0c; --brand-soft: #3a2420;
    --gold: #e2b866; --gold-soft: #3a3020; --teal: #6cc2b9; --teal-soft: #1d3533; --slate: #aab3bf; --slate-soft: #272c34;
    --mark: #6d5a10; --mark-active: #a86a16; --good: #7ccf9c; --bad: #f19a92;
    --shadow-sm: none; --shadow: 0 0 0 1px var(--line); --shadow-lg: 0 0 0 1px var(--line), 0 24px 48px -16px rgba(0,0,0,.6);
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.55 var(--sans); -webkit-font-smoothing: antialiased; }
.wrap { max-width: 960px; margin: 0 auto; padding: 0 16px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
button, select, textarea { font: inherit; color: inherit; }

/* ---------- hero ---------- */
.hero { position: relative; color: #fff; padding-bottom: 88px; overflow: hidden; isolation: isolate; transition: padding .3s ease; }
.hero-bg { position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(1200px 400px at 85% -10%, rgba(255, 200, 140, .22), transparent 60%),
    radial-gradient(700px 300px at 0% 110%, rgba(255, 255, 255, .08), transparent 60%),
    linear-gradient(135deg, #4a1814 0%, #6e2720 45%, #8a3a24 100%); }
.hero-bg::after { content: ""; position: absolute; inset: 0; opacity: .07;
  background-image: repeating-linear-gradient(45deg, #fff 0 1px, transparent 1px 14px); }
.nav { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; }
.logo { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px;
  background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .22); color: #ffd79a; }
.brand-text { font-family: var(--serif); font-size: 20px; letter-spacing: .2px; }
.brand-text b { font-weight: 700; color: #ffd79a; margin-left: 1px; }
.free { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500;
  background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .22); padding: 5px 12px; border-radius: 99px; }
.free .dot { width: 7px; height: 7px; border-radius: 50%; background: #7be0a1; box-shadow: 0 0 0 3px rgba(123, 224, 161, .25); }
.hero-copy { padding-top: 28px; max-width: 760px; margin-left: max(16px, calc((100% - 960px) / 2 + 16px)); }
.hero h1 { font-family: var(--serif); font-weight: 600; font-size: clamp(28px, 5vw, 44px); line-height: 1.12; margin: 0 0 12px; letter-spacing: -.3px; }
.hero p { margin: 0; font-size: clamp(15px, 2.2vw, 18px); color: rgba(255, 255, 255, .82); max-width: 620px; }
.stats { list-style: none; display: flex; flex-wrap: wrap; gap: 10px 28px; padding: 0; margin: 22px 0 0; }
.stats li { display: flex; align-items: baseline; gap: 6px; font-size: 14px; color: rgba(255, 255, 255, .75); }
.stats b { font-family: var(--serif); font-size: 22px; color: #ffd79a; font-weight: 600; }
body.searched .hero { padding-bottom: 64px; }
body.searched .hero-copy, body.searched .stats { display: none; }
.updated { margin: 14px 0 0; font-size: 13px; color: rgba(255, 255, 255, .7); }
.updated b { color: #ffd79a; font-weight: 600; }
.foot .credit { display: block; margin-top: 6px; font-size: 12px; }
.foot .credit a { color: inherit; }

/* ---------- search ---------- */
.main { position: relative; margin-top: -60px; }
body.searched .main { margin-top: -44px; }
.search { background: var(--card); border-radius: 18px; box-shadow: var(--shadow-lg); padding: 10px; position: relative; z-index: 2; }
.search-box { display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 14px; border-radius: 12px;
  border: 1.5px solid transparent; transition: border-color .15s, background .15s; background: var(--line-2); }
.search-box:focus-within { border-color: var(--brand); background: var(--card); }
.search-ico { color: var(--muted); flex: none; }
.search textarea { flex: 1; border: 0; outline: 0; resize: none; background: transparent; font-size: 17px; line-height: 1.5;
  padding: 10px 0; min-height: 46px; max-height: 200px; }
.search textarea::placeholder { color: var(--muted); }
.courts { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px 8px 4px; }
.courts-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-right: 2px; }
.chips { display: contents; }
.chip { display: inline-flex; align-items: center; gap: 2px; background: var(--brand-soft); color: var(--brand);
  border-radius: 99px; padding: 4px 4px 4px 12px; font-size: 14px; font-weight: 500; }
.chip.sc { background: var(--gold-soft); color: var(--gold); }
.chip.tribunal { background: var(--teal-soft); color: var(--teal); }
.chip.other { background: var(--slate-soft); color: var(--slate); }
.chip button { border: 0; background: transparent; cursor: pointer; width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center; color: inherit; opacity: .7; font-size: 12px; }
.chip button:hover { opacity: 1; background: rgba(0, 0, 0, .06); }
.pick-btn { display: inline-flex; align-items: center; gap: 8px; border: 1.5px dashed var(--line); background: transparent; border-radius: 99px;
  padding: 5px 6px 5px 12px; font-size: 14px; color: var(--muted); cursor: pointer; }
.pick-btn:hover, .pick-btn[aria-expanded="true"] { border-color: var(--brand); color: var(--brand); }
.pick-count { font-size: 12px; font-weight: 600; background: var(--line-2); color: var(--muted); border-radius: 99px; padding: 1px 8px; }
.picker { margin: 10px 4px 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); padding: 12px; }
.picker-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
#pickFilter { flex: 1 1 240px; min-width: 0; border: 1.5px solid var(--line); border-radius: 10px; padding: 9px 12px; font: inherit; font-size: 15px;
  background: var(--line-2); color: var(--ink); outline: 0; }
#pickFilter:focus { border-color: var(--brand); background: var(--card); }
.pick-info { font-size: 13px; font-weight: 600; color: var(--muted); }
.pick-info.full { color: var(--bad); }
.pick-info.shake { animation: shake .35s ease; }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.pick-note { margin: 10px 0 4px; font-size: 13px; color: var(--muted); }
.pick-note b { color: var(--ink); }
.pick-list { max-height: min(52vh, 420px); overflow-y: auto; overscroll-behavior: contain; margin: 0 -4px; padding: 0 4px; }
.pick-group { border: 0; margin: 10px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 4px 8px; }
.pick-group legend { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 0 0 6px; }
.pick-group legend small { font-weight: 600; opacity: .7; margin-left: 4px; }
.pick { display: flex; align-items: center; gap: 9px; padding: 7px 10px; border-radius: 9px; cursor: pointer; font-size: 14px;
  border: 1px solid transparent; line-height: 1.3; }
.pick:hover { background: var(--line-2); }
.pick input { width: 17px; height: 17px; margin: 0; accent-color: var(--brand); flex: none; cursor: inherit; }
.pick.on { background: var(--brand-soft); border-color: transparent; font-weight: 600; }
.pick-group.sc .pick.on { background: var(--gold-soft); }
.pick-group.tribunal .pick.on { background: var(--teal-soft); }
.pick-group.other .pick.on { background: var(--slate-soft); }
.pick.off { opacity: .45; cursor: not-allowed; }
.picker-foot { display: flex; align-items: center; gap: 8px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line-2); }
.btn.disabled { opacity: .5; cursor: not-allowed; }
.muted { color: var(--muted); }

/* ---------- buttons ---------- */
.btn { border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 8px 14px; cursor: pointer;
  text-decoration: none; display: inline-flex; align-items: center; gap: 6px; color: var(--ink); font-weight: 500;
  transition: border-color .15s, background .15s, transform .1s, box-shadow .15s; }
.btn:hover { border-color: var(--muted); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: linear-gradient(180deg, var(--brand-2), var(--brand)); color: var(--brand-ink); border-color: transparent;
  font-weight: 600; box-shadow: 0 6px 16px -6px rgba(123, 45, 38, .6); }
.btn.primary:hover { filter: brightness(1.06); }
#go { padding: 12px 26px; border-radius: 10px; font-size: 16px; flex: none; }
.btn.small { padding: 6px 12px; font-size: 14px; border-radius: 8px; }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: .7; cursor: default; }
.icon { border: 0; background: transparent; cursor: pointer; padding: 8px; color: var(--muted); border-radius: 8px; display: grid; place-items: center; }
.icon:hover { background: var(--line-2); color: var(--ink); }

/* ---------- understood + status ---------- */
.understood { margin: 18px 2px 0; font-size: 14px; color: var(--muted); display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.understood b { color: var(--ink); font-weight: 600; }
.tag { display: inline-flex; align-items: center; background: var(--card); color: var(--ink); border: 1px solid var(--line);
  border-radius: 8px; padding: 2px 9px; font-size: 13px; font-weight: 500; box-shadow: var(--shadow-sm); }
.status { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 16px; }
.st { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; border-radius: 99px; padding: 5px 12px;
  background: var(--card); border: 1px solid var(--line); color: var(--muted); }
.st::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.st.wait::before { width: 10px; height: 10px; background: none; border: 2px solid var(--brand); border-top-color: transparent; animation: spin .8s linear infinite; }
.st.ok { color: var(--ink); } .st.ok::before { background: var(--good); }
.st.err { color: var(--bad); } .st.err::before { background: var(--bad); }
.st b { font-weight: 600; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- results ---------- */
.results { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.card { position: relative; min-width: 0; overflow-wrap: anywhere; background: var(--card); border-radius: var(--radius); padding: 18px 20px 16px 22px; box-shadow: var(--shadow);
  border: 1px solid var(--line-2); transition: transform .15s ease, box-shadow .15s ease; }
.card.enter { animation: rise .25s ease both; }
.card::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 4px; border-radius: 0 4px 4px 0; background: var(--brand); }
.card.sc::before { background: var(--gold); } .card.tribunal::before { background: var(--teal); } .card.other::before { background: var(--slate); }
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.card-top { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; letter-spacing: .02em;
  background: var(--brand-soft); color: var(--brand); border-radius: 6px; padding: 3px 8px; }
.badge.sc { background: var(--gold-soft); color: var(--gold); }
.badge.tribunal { background: var(--teal-soft); color: var(--teal); }
.badge.other { background: var(--slate-soft); color: var(--slate); }
.rel { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.bars { display: inline-flex; gap: 2px; align-items: flex-end; height: 12px; }
.bars i { width: 4px; border-radius: 1px; background: var(--line); }
.bars i:nth-child(1) { height: 5px; } .bars i:nth-child(2) { height: 7px; } .bars i:nth-child(3) { height: 9px; }
.bars i:nth-child(4) { height: 11px; } .bars i:nth-child(5) { height: 12px; }
.bars i.on { background: var(--good); }
.card h3 { margin: 0 0 6px; font-family: var(--serif); font-size: 19px; font-weight: 600; line-height: 1.3; }
.card h3 a { color: var(--ink); text-decoration: none; cursor: pointer; background-image: linear-gradient(currentColor, currentColor);
  background-size: 0 1px; background-position: 0 100%; background-repeat: no-repeat; transition: background-size .2s; }
.card h3 a:hover { background-size: 100% 1px; }
.loading-title { color: var(--muted); font-style: italic; font-weight: 500; }
.meta { font-size: 13.5px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 16px; }
.meta span { display: inline-flex; align-items: center; gap: 5px; }
.meta svg { opacity: .7; flex: none; }
.snip { margin: 12px 0 14px; font-size: 15px; line-height: 1.65; color: var(--ink); background: var(--line-2);
  border-radius: 10px; padding: 10px 14px; border-left: 3px solid var(--line); }
.acts { display: flex; gap: 8px; flex-wrap: wrap; }
.acts .btn.read { background: var(--ink); color: var(--card); border-color: var(--ink); }
.acts .btn.read:hover { filter: brightness(1.15); }
mark { background: var(--mark); color: inherit; border-radius: 3px; padding: 0 2px; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
mark.active { background: var(--mark-active); box-shadow: 0 0 0 2px var(--mark-active); }

/* skeleton */
.skel { pointer-events: none; }
.skel .sk { background: linear-gradient(90deg, var(--line-2) 0%, var(--line) 50%, var(--line-2) 100%); background-size: 200% 100%;
  animation: shimmer 1.2s infinite linear; border-radius: 6px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.more-wrap { text-align: center; margin: 20px 0; }
.empty-card { text-align: center; padding: 36px 20px; color: var(--muted); }
.empty-card h3 { font-family: var(--serif); color: var(--ink); margin: 0 0 6px; }

/* ---------- landing ---------- */
.empty { margin: 34px 0 10px; }
.sec-title { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 0 0 12px; }
.examples { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 10px; }
.ex { text-align: left; border: 1px solid var(--line); background: var(--card); border-radius: 12px; padding: 12px 14px; cursor: pointer;
  font-size: 14.5px; display: flex; align-items: center; gap: 10px; box-shadow: var(--shadow-sm); transition: border-color .15s, transform .15s; }
.ex span { flex: none; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--brand);
  background: var(--brand-soft); padding: 3px 7px; border-radius: 6px; }
.ex:hover { border-color: var(--brand); transform: translateY(-1px); }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin-top: 34px; }
.feature { background: var(--card); border: 1px solid var(--line-2); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.f-ico { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; color: var(--brand); background: var(--brand-soft); margin-bottom: 12px; }
.feature h3 { margin: 0 0 6px; font-family: var(--serif); font-size: 18px; font-weight: 600; }
.feature p { margin: 0; color: var(--muted); font-size: 14.5px; }

.foot { margin-top: 40px; padding: 22px 0 40px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }

/* ---------- reader ---------- */
.reader { position: fixed; top: 0; right: 0; bottom: 0; width: min(820px, 100%); background: var(--card); z-index: 20;
  display: flex; flex-direction: column; box-shadow: -20px 0 60px rgba(0, 0, 0, .25); animation: slide .25s ease; }
@keyframes slide { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.reader-head { display: flex; gap: 8px; padding: 20px 22px 14px; align-items: flex-start; border-bottom: 1px solid var(--line-2);
  background: linear-gradient(180deg, var(--brand-soft), transparent); }
.reader-title { flex: 1; min-width: 0; }
.reader-title h2 { margin: 8px 0 4px; font-family: var(--serif); font-size: 22px; font-weight: 600; line-height: 1.28; }
.reader-title p { margin: 0; font-size: 14px; color: var(--muted); }
.reader-bar { display: flex; gap: 8px; align-items: center; padding: 10px 22px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.nav-matches { display: inline-flex; align-items: center; gap: 6px; background: var(--line-2); border-radius: 10px; padding: 3px; }
.nav-matches .btn { border: 0; background: var(--card); padding: 4px 10px; }
#rCount { font-size: 13px; color: var(--muted); min-width: 64px; text-align: center; font-variant-numeric: tabular-nums; }
.grow { flex: 1; }
.reader-body { flex: 1; overflow: auto; padding: 24px 28px 60px; white-space: pre-wrap; font-family: var(--serif); font-size: 17px;
  line-height: 1.75; overflow-wrap: anywhere; }
.reader-body > * { max-width: 70ch; }
.shade { position: fixed; inset: 0; background: rgba(20, 10, 8, .45); backdrop-filter: blur(2px); z-index: 10; animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; } }

@media (max-width: 640px) {
  .hero { padding-bottom: 76px; }
  .search-box { flex-wrap: wrap; padding: 8px 10px; }
  .search-ico { display: none; }
  .search textarea { width: 100%; flex-basis: 100%; }
  #go { width: 100%; justify-content: center; }
  .card { padding: 16px 16px 14px 18px; }
  .rel .lbl { display: none; }
  .reader-head, .reader-bar { padding-left: 16px; padding-right: 16px; }
  .reader-body { padding: 18px 16px 60px; font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before { animation: none !important; transition: none !important; } }

/* ---------- head note ---------- */
.reader-body.head { white-space: normal; }
.mode-tabs { display: inline-flex; background: var(--line-2); border-radius: 10px; padding: 3px; gap: 2px; }
.tab { border: 0; background: transparent; border-radius: 8px; padding: 5px 12px; font-size: 14px; font-weight: 500; color: var(--muted); cursor: pointer; }
.tab.on { background: var(--card); color: var(--ink); box-shadow: var(--shadow-sm); font-weight: 600; }
.hn-label { margin: 0 0 14px; font-family: var(--sans); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.hn { margin: 0 0 16px; padding: 14px 18px 12px; border-left: 4px solid var(--gold); background: var(--gold-soft); border-radius: 0 12px 12px 0;
  white-space: pre-wrap; font-size: 16.5px; line-height: 1.7; }
.hn-go { display: flex; margin: 10px 0 0 auto; font-family: var(--sans); }
.hn-more { margin: 22px 0 0; font-family: var(--sans); }
.part { scroll-margin-top: 16px; }

/* ---------- ready searches ---------- */
.sec-title small { text-transform: none; letter-spacing: 0; font-weight: 500; margin-left: 6px; }
.ready-group { margin: 12px 0 0; }
.ready-group h4 { margin: 0 0 8px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--brand); }
.ready-qs { display: flex; flex-wrap: wrap; gap: 6px; }
.rq { border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 99px; padding: 6px 13px; font-size: 14px;
  cursor: pointer; text-align: left; line-height: 1.35; transition: border-color .15s, background .15s; }
.rq:hover { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.ready-home { background: var(--card); border: 1px solid var(--line-2); border-radius: var(--radius); padding: 6px 18px 18px; box-shadow: var(--shadow); margin-bottom: 26px; }
#rCount { min-width: 130px; }
.btn.copied { border-color: var(--good); color: var(--good); }
