/* 你没错法庭 —— 卷宗纸叠在胡桃木法官席上；朱砂印章是唯一的强调色，法槌铜色做次要点缀 */
:root {
  --bench: #3a2519;
  --bench-ink: #f1e7d6;
  --ground: #e4e0d7;
  --paper: #fbfaf6;
  --paper-line: #d9d3c5;
  --ink: #1f1b17;
  --ink-soft: #6b6257;
  --seal: #b3261e;
  --brass: #9c7a35;
  --brass-on-bench: #d9b56c; /* 木色底上的铜色，保证对比度 */
  --innocent: #2d6a4f;
  --guilty: #b3261e;
  --hung: #8a6a26;
  --void: #7d766c;
  --on-color: #ffffff;
  --serif: "Noto Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --sans: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  --nav-h: 62px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--ground);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------- 外框 ---------- */
.app { max-width: 520px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; background: var(--ground); }
.topbar {
  position: sticky; top: 0; z-index: 5;
  background: var(--bench); color: var(--bench-ink);
  padding: calc(env(safe-area-inset-top, 0px) + 14px) max(18px, env(safe-area-inset-right, 0px)) 12px max(18px, env(safe-area-inset-left, 0px));
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  border-bottom: 3px solid var(--brass);
}
.topbar .t { font-family: var(--serif); font-weight: 900; font-size: 19px; letter-spacing: .08em; display: flex; align-items: center; gap: 6px; min-width: 0; }
.topbar .s { font-size: 12px; opacity: .75; white-space: nowrap; }
.back { background: none; border: 0; padding: 0 6px 0 0; font-size: 22px; line-height: 1; color: var(--bench-ink); }
.screen {
  flex: 1; display: flex; flex-direction: column; gap: 14px;
  padding: 16px max(16px, env(safe-area-inset-right, 0px)) calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 24px) max(16px, env(safe-area-inset-left, 0px));
}
.nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 5;
  max-width: 520px; margin: 0 auto;
  background: var(--bench);
  display: grid; grid-template-columns: repeat(4, 1fr);
  padding: 8px max(4px, env(safe-area-inset-right, 0px)) calc(10px + env(safe-area-inset-bottom, 0px)) max(4px, env(safe-area-inset-left, 0px));
  border-top: 3px solid var(--brass);
}
.nav a {
  color: var(--bench-ink); opacity: .6; text-decoration: none;
  display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; letter-spacing: .1em;
}
.nav a[aria-current="page"] { opacity: 1; color: var(--brass-on-bench); }
.nav svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- 卷宗卡片 ---------- */
.docket {
  background: var(--paper); border: 1px solid var(--paper-line); border-radius: 4px; padding: 18px 18px 16px;
  box-shadow: 0 1px 0 var(--paper-line), 0 3px 0 -1px var(--paper), 0 4px 0 -1px var(--paper-line);
  min-width: 0;
}
.case-no { font-family: var(--mono); font-size: 12px; color: var(--ink-soft); display: flex; justify-content: space-between; gap: 8px; }
.tag { display: inline-block; font-size: 12px; padding: 0 8px; border: 1px solid var(--brass); color: var(--brass); border-radius: 2px; letter-spacing: .1em; white-space: nowrap; font-family: var(--sans); }
.case-title { font-family: var(--serif); font-weight: 900; font-size: 21px; line-height: 1.35; margin: 10px 0 8px; text-wrap: balance; overflow-wrap: anywhere; }
.field-k { font-size: 12px; color: var(--ink-soft); letter-spacing: .2em; }
.case-body { margin: 2px 0 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 14px; padding-top: 10px; border-top: 1px dashed var(--paper-line); font-size: 13px; color: var(--ink-soft); }
.clock { font-family: var(--mono); color: var(--seal); font-variant-numeric: tabular-nums; }

/* ---------- 投票 ---------- */
.remark { width: 100%; border: 0; border-bottom: 1px solid var(--paper-line); background: transparent; padding: 8px 2px; font: inherit; color: var(--ink); }
.remark::placeholder { color: var(--ink-soft); }
.verdict-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.vbtn {
  border: 2px solid currentColor; background: var(--paper); border-radius: 4px; padding: 14px 8px 12px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-family: var(--serif); font-weight: 900; font-size: 20px; letter-spacing: .1em; transition: transform .12s;
}
.vbtn small { font-family: var(--sans); font-weight: 400; font-size: 11px; letter-spacing: .15em; opacity: .8; }
.vbtn:active:not(:disabled) { transform: translateY(2px); }
.vbtn.ok { color: var(--innocent); }
.vbtn.bad { color: var(--guilty); }
.hint { font-size: 12px; color: var(--ink-soft); text-align: center; margin: 0; }

.ratio { display: flex; height: 34px; border-radius: 3px; overflow: hidden; font-size: 13px; font-weight: 700; color: var(--on-color); background: var(--paper-line); }
.ratio span { display: flex; align-items: center; padding: 0 10px; white-space: nowrap; overflow: hidden; }
.ratio .a { background: var(--innocent); }
.ratio .b { background: var(--guilty); justify-content: flex-end; }
.ratio-legend { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--ink-soft); margin-top: 6px; }
.mine { display: flex; gap: 10px; align-items: center; background: var(--paper); border: 1px solid var(--paper-line); border-radius: 4px; padding: 10px 12px; font-size: 14px; }
.chip-side { font-size: 12px; padding: 1px 8px; border-radius: 2px; color: var(--on-color); white-space: nowrap; }
.chip-side.majority { background: var(--innocent); }
.chip-side.minority { background: var(--brass); }
.chip-side.tie { background: var(--void); }
.primary { background: var(--bench); color: var(--bench-ink); border: 1px solid var(--bench); border-radius: 4px; padding: 13px; font-weight: 700; letter-spacing: .2em; width: 100%; }
.ghost { background: transparent; border: 1px solid var(--ink-soft); color: var(--ink); border-radius: 4px; padding: 11px; width: 100%; letter-spacing: .1em; }
.stamp-wrap { display: flex; justify-content: center; padding: 4px 0; }

/* ---------- 印章 ---------- */
.seal {
  --c: var(--seal);
  width: 96px; height: 96px; flex: none; border: 4px double var(--c); border-radius: 50%; color: var(--c);
  display: grid; place-items: center; font-family: var(--serif); font-weight: 900; font-size: 30px; letter-spacing: .05em;
  transform: rotate(-14deg); position: relative; white-space: nowrap;
}
.seal::after { content: ""; position: absolute; inset: 7px; border: 1px solid var(--c); border-radius: 50%; }
.seal.w3 { width: 112px; height: 112px; font-size: 25px; }
.seal.innocent { --c: var(--innocent); }
.seal.guilty { --c: var(--guilty); }
.seal.hung { --c: var(--hung); }
.seal.void { --c: var(--void); }
.seal.brass { --c: var(--brass); }
.seal.sm { width: 46px; height: 46px; font-size: 14px; border-width: 3px; }
.seal.sm::after { inset: 3px; }
@keyframes stamp { 0% { transform: rotate(-14deg) scale(2.2); opacity: 0; } 60% { transform: rotate(-14deg) scale(.92); opacity: 1; } 100% { transform: rotate(-14deg) scale(1); } }
.stamp-in { animation: stamp .45s cubic-bezier(.3, 1.4, .5, 1) both; }
@media (prefers-reduced-motion: reduce) { .stamp-in { animation: none; } }

/* ---------- 立案表单 ---------- */
.form { display: flex; flex-direction: column; gap: 16px; }
.f label, .f .lbl { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink-soft); letter-spacing: .15em; margin-bottom: 6px; }
.f em { font-style: normal; font-family: var(--mono); letter-spacing: 0; }
.f em.over { color: var(--seal); }
.f input, .f textarea { width: 100%; background: var(--paper); border: 1px solid var(--paper-line); border-radius: 3px; padding: 10px 12px; font: inherit; color: var(--ink); resize: vertical; line-height: 1.7; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--paper-line); background: var(--paper); border-radius: 2px; padding: 4px 12px; font-size: 13px; }
.chip[aria-pressed="true"] { border-color: var(--bench); background: var(--bench); color: var(--bench-ink); }
.f .picked { font-family: var(--sans); letter-spacing: .05em; color: var(--seal); font-weight: 600; }
.f .picked.none { color: var(--ink-soft); font-weight: 400; }
/* 立案表单里的单选：选中项用朱砂色填充并打勾，未选项是浅色描边，一眼能分清 */
.pick .chip { padding: 6px 14px; font-size: 14px; color: var(--ink); border-color: #c9c1b1; }
.pick .chip[aria-pressed="true"] { background: var(--seal); border-color: var(--seal); color: var(--on-color); font-weight: 600; box-shadow: 0 2px 6px rgba(179, 38, 30, .3); }
.pick .chip[aria-pressed="true"]::before { content: "✓ "; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.seg button { display: flex; align-items: center; gap: 10px; text-align: left; border: 1.5px solid #c9c1b1; border-radius: 4px; background: var(--paper); padding: 10px 12px; font-size: 15px; color: var(--ink); }
.seg small { display: block; font-size: 12px; color: var(--ink-soft); }
.seg .dot { flex: none; width: 18px; height: 18px; border-radius: 50%; border: 2px solid #a89f90; background: var(--paper); }
.seg button[aria-pressed="true"] { border: 2px solid var(--seal); background: #fbeeec; padding: 9.5px 11.5px; font-weight: 600; box-shadow: 0 2px 6px rgba(179, 38, 30, .18); }
.seg button[aria-pressed="true"] small { color: #7a1a14; font-weight: 400; }
.seg button[aria-pressed="true"] .dot { border-color: var(--seal); background: radial-gradient(circle, var(--seal) 0 4px, var(--paper) 5px); }
.quota { font-size: 13px; color: var(--ink-soft); text-align: center; }
.quota b { color: var(--seal); font-family: var(--mono); }
.form-error { color: var(--seal); font-size: 13px; text-align: center; margin: 0; min-height: 1.6em; }

/* ---------- 广场 / 列表 ---------- */
.tabs { display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid var(--paper-line); }
.tabs button { background: none; border: 0; padding: 10px 0; font-family: var(--serif); font-weight: 600; color: var(--ink-soft); border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs button[aria-selected="true"] { color: var(--ink); border-color: var(--seal); }
.list { display: flex; flex-direction: column; gap: 10px; }
.row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center;
  background: var(--paper); border: 1px solid var(--paper-line); border-radius: 4px; padding: 12px 14px;
  text-decoration: none; color: inherit;
}
.row:hover { border-color: var(--brass); }
.row h4 { margin: 0 0 4px; font-family: var(--serif); font-size: 16px; line-height: 1.4; font-weight: 600; overflow-wrap: anywhere; }
.row .sub { font-size: 12px; color: var(--ink-soft); display: flex; gap: 6px 10px; flex-wrap: wrap; align-items: center; }
.mini-ratio { height: 4px; border-radius: 2px; background: var(--guilty); overflow: hidden; margin-top: 8px; }
.mini-ratio i { display: block; height: 100%; background: var(--innocent); }
.countdown { font-family: var(--mono); font-size: 13px; color: var(--seal); text-align: right; line-height: 1.3; font-variant-numeric: tabular-nums; }
.countdown small { display: block; font-family: var(--sans); font-size: 11px; color: var(--ink-soft); }
.countdown.soon small { color: var(--seal); font-weight: 700; }
.muted { color: var(--ink-soft); font-size: 14px; text-align: center; padding: 24px 0; margin: 0; }

/* ---------- 判决书 ---------- */
.judgment { background: var(--paper); border: 1px solid var(--paper-line); padding: 22px 20px; font-family: var(--serif); min-width: 0; }
.judgment .court { text-align: center; font-weight: 900; font-size: 20px; letter-spacing: .3em; }
.judgment .doc { text-align: center; font-size: 13px; letter-spacing: .4em; margin-top: 2px; }
.judgment .no { text-align: right; font-family: var(--mono); font-size: 12px; color: var(--ink-soft); margin: 14px 0 10px; }
.judgment p { margin: 0 0 10px; line-height: 1.8; overflow-wrap: anywhere; }
.judgment .k { font-weight: 900; }
.judgment .body { font-family: var(--sans); font-size: 14px; color: var(--ink-soft); white-space: pre-wrap; }
.verdict-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 16px 0 12px; padding: 14px 0; border-top: 1px solid var(--paper-line); border-bottom: 1px solid var(--paper-line); }
.verdict-line .big b { display: block; font-size: 26px; letter-spacing: .2em; }
.verdict-line .big small { font-family: var(--sans); font-size: 12px; color: var(--ink-soft); }
.v-innocent { color: var(--innocent); } .v-guilty { color: var(--guilty); } .v-hung { color: var(--hung); } .v-void { color: var(--void); }
.remarks { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.remarks q { display: block; font-family: var(--sans); font-size: 14px; quotes: none; padding-left: 10px; border-left: 2px solid var(--brass); overflow-wrap: anywhere; }
.remarks q span { display: block; font-size: 11px; color: var(--ink-soft); }
.judgment .foot { text-align: right; font-size: 13px; color: var(--ink-soft); margin-top: 14px; }
.copy-fallback { width: 100%; font: inherit; font-size: 13px; padding: 8px; border: 1px solid var(--paper-line); background: var(--paper); color: var(--ink); }

/* ---------- 我的 ---------- */
.badge { display: flex; gap: 14px; align-items: center; background: var(--bench); color: var(--bench-ink); border-radius: 4px; padding: 16px; }
.badge .id { font-family: var(--mono); font-size: 20px; color: var(--brass-on-bench); }
.badge .seal.brass { --c: var(--brass-on-bench); }
.badge small { display: block; opacity: .7; font-size: 12px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { background: var(--paper); border: 1px solid var(--paper-line); border-radius: 4px; padding: 10px; text-align: center; }
.stat b { display: block; font-family: var(--mono); font-size: 20px; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: var(--ink-soft); }
.sec-h { font-family: var(--serif); font-weight: 900; font-size: 15px; letter-spacing: .2em; margin: 6px 0 -4px; }
.note { font-size: 12px; color: var(--ink-soft); margin: 0; }

/* ---------- 空状态 / 加载 / 提示 ---------- */
.empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 12px; padding: 32px 12px; }
.empty svg { width: 96px; height: 96px; stroke: var(--brass); fill: none; stroke-width: 1.5; }
.empty h3 { font-family: var(--serif); font-weight: 900; font-size: 22px; margin: 0; letter-spacing: .3em; }
.empty p { margin: 0; color: var(--ink-soft); font-size: 14px; }
.empty .primary, .empty .ghost { max-width: 220px; }
.loading { color: var(--ink-soft); text-align: center; padding: 48px 0; letter-spacing: .3em; }
.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 20px); transform: translateX(-50%);
  background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 4px; font-size: 14px; z-index: 20;
  max-width: calc(100% - 32px); text-align: center; box-shadow: 0 8px 24px -8px rgba(0, 0, 0, .4);
}
