:root {
  --ink: #18212B; --muted: #5A6673; --paper: #F3F5F7; --surface: #FFFFFF; --rule: #D6DCE3;
  --seq: #2B4EA2; --seq-soft: #E8EDF8; --vit: #12766A; --vit-soft: #E3F2F0;
  --warn: #8A4B00; --warn-soft: #FFF1DC; --err: #B3261E;
  --ui: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --read: "Newsreader", Georgia, "Times New Roman", serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 15px/1.55 var(--ui); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 28px; background: var(--surface);
  border-bottom: 1px solid var(--rule); padding: 12px max(20px, calc((100% - 1120px) / 2)); }
.brand { font-weight: 600; font-size: 17px; letter-spacing: -0.01em; }
#nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
#nav a { padding: 6px 12px; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; }
#nav a:hover { color: var(--ink); }
#nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--ink); font-weight: 500; }
.status { display: flex; gap: 8px; list-style: none; margin: 0; padding: 0; flex-wrap: wrap; }
.chip { display: flex; align-items: center; gap: 7px; padding: 3px 11px; border: 1px solid var(--rule);
  border-radius: 999px; font-size: 13px; background: var(--surface); }
.chip small { color: var(--muted); font-size: 12px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.st-ready .dot { background: #1E8E5A; } .st-loading .dot { background: #D98A00; }
.st-error { border-color: var(--err); cursor: pointer; } .st-error .dot { background: var(--err); }

main { max-width: 1120px; margin: 0 auto; padding: 28px 20px 72px; }
h1 { font-size: 24px; font-weight: 600; letter-spacing: -0.015em; margin: 0 0 20px; }
.muted { color: var(--muted); font-weight: 400; }

.field { margin-bottom: 16px; }
label { display: block; font-weight: 500; margin-bottom: 6px; }
input[type="text"], input[type="search"], textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--rule);
  border-radius: 4px; background: var(--surface); color: var(--ink); font: inherit; }
textarea { font-family: var(--read); font-size: 17px; line-height: 1.55; resize: vertical; }
details { margin-bottom: 16px; } summary { cursor: pointer; font-weight: 500; padding: 4px 0; }
details textarea { margin-top: 8px; }
.actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 400; margin: 0; }
button { font: inherit; cursor: pointer; border-radius: 4px; padding: 9px 16px; }
button:disabled { opacity: .55; cursor: progress; }
.primary { background: var(--ink); color: #fff; border: 1px solid var(--ink); font-weight: 500; }
.ghost { background: var(--surface); color: var(--ink); border: 1px solid var(--rule); }
.ghost:hover { border-color: var(--ink); } .ghost.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.linklike { background: none; border: 0; padding: 0; color: var(--ink); text-align: left; text-decoration: underline;
  text-decoration-color: var(--rule); text-underline-offset: 3px; }
.linklike:hover { text-decoration-color: var(--ink); }
.msg { color: var(--err); min-height: 1.5em; margin: 12px 0 0; }
.error { color: var(--err); } .warn { background: var(--warn-soft); color: var(--warn); padding: 6px 10px; border-radius: 4px; }

#results { margin-top: 24px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.card { background: var(--surface); border: 1px solid var(--rule); border-top: 4px solid var(--muted);
  border-radius: 4px; padding: 18px 20px 16px; }
.m-seq { border-top-color: var(--seq); } .m-vit { border-top-color: var(--vit); }
.card h2 { margin: 0 0 12px; font-size: 17px; font-weight: 600; }
.m-seq h2 { color: var(--seq); } .m-vit h2 { color: var(--vit); }
.card .sub { margin-left: 8px; color: var(--muted); font-size: 13px; font-weight: 400; }
.summary { font-family: var(--read); font-size: 18px; line-height: 1.65; max-width: 62ch; margin: 0 0 14px; }
.novel { border-bottom: 1.5px dotted var(--muted); }
.legend { color: var(--muted); font-size: 13px; margin: 12px 0 0; }
.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 12px; margin: 14px 0 0;
  padding-top: 12px; border-top: 1px solid var(--rule); }
.facts dt { color: var(--muted); font-size: 12.5px; } .facts dd { margin: 0; font-weight: 500; }
.vote { margin-top: 20px; padding: 16px 20px; background: var(--surface); border: 1px solid var(--rule); border-radius: 4px; }
.vote-q { margin: 0 0 10px; font-weight: 500; } .vote-row { display: flex; flex-wrap: wrap; gap: 10px; }

.list { display: grid; gap: 12px; margin-top: 16px; }
.row { background: var(--surface); border: 1px solid var(--rule); border-radius: 4px; padding: 14px 16px;
  display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; align-items: start; }
.row h3 { margin: 0; font-size: 16px; font-weight: 500; } .row p { grid-column: 1; margin: 0; color: var(--muted); font-size: 14px; }
.row button { grid-column: 2; grid-row: 1 / span 2; }
.pager { display: flex; align-items: center; gap: 12px; margin-top: 16px; color: var(--muted); }
.empty { background: var(--surface); border: 1px dashed var(--rule); border-radius: 4px; padding: 24px; color: var(--muted); }
code { font-size: 13px; background: #E9EDF1; padding: 1px 5px; border-radius: 3px; }

.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--rule); border-radius: 4px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--rule); vertical-align: top; }
th { font-weight: 500; color: var(--muted); background: #FAFBFC; } tr:last-child td { border-bottom: 0; }
th.seq { color: var(--seq); } th.vit { color: var(--vit); }
.bar { display: flex; height: 36px; border-radius: 4px; overflow: hidden; margin: 12px 0 8px; background: var(--rule); }
.bar > div { display: flex; align-items: center; padding: 0 12px; color: #fff; font-weight: 500; white-space: nowrap; overflow: hidden; }
.bar .b-seq { background: var(--seq); } .bar .b-vit { background: var(--vit); } .bar .b-tie { background: #7C8793; }
h2.section { font-size: 17px; margin: 28px 0 4px; font-weight: 600; }

@media (max-width: 760px) {
  .grid2 { grid-template-columns: 1fr; }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .row { grid-template-columns: 1fr; } .row button { grid-column: 1; grid-row: auto; justify-self: start; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
