:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --text: #1c2430;
  --muted: #5d6877;
  --line: #dde2e8;
  --accent: #0f6e8c;
  --accent-ink: #ffffff;
  --accent-soft: #e3f1f5;
  --ok: #1d7a46;
  --ok-soft: #e2f3e8;
  --warn: #8a5a00;
  --warn-soft: #fbf0d9;
  --err: #b42318;
  --row-hover: #f1f5f8;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161c;
    --card: #1a2029;
    --text: #e6eaef;
    --muted: #9aa5b3;
    --line: #2c3541;
    --accent: #4fb3d1;
    --accent-ink: #0b1418;
    --accent-soft: #173040;
    --ok: #6fd39b;
    --ok-soft: #173326;
    --warn: #f0c060;
    --warn-soft: #362a12;
    --err: #ff8a80;
    --row-hover: #212935;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.55 system-ui, -apple-system, "Segoe UI", "Hiragino Sans", "Noto Sans JP", sans-serif;
}
a { color: var(--accent); }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
header.site { background: var(--card); border-bottom: 1px solid var(--line); padding: 20px 0 16px; margin-bottom: 24px; }
header.site h1 { margin: 0; font-size: 1.35rem; }
header.site h1 a { color: inherit; text-decoration: none; }
.lead { margin: 4px 0 0; color: var(--muted); }
h2 { font-size: 1.15rem; margin: 0 0 8px; word-break: break-all; }
h3 { font-size: 1rem; margin: 0 0 6px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 20px; margin-bottom: 16px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.error { color: var(--err); }

/* Upload */
.drop {
  display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center;
  border: 2px dashed var(--line); border-radius: 10px; padding: 36px 16px; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.drop-icon { font-size: 2rem; color: var(--accent); line-height: 1; }
.hint { color: var(--muted); font-size: .85rem; }
.actions { display: flex; justify-content: flex-end; margin-top: 14px; }
.progress { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin-top: 12px; }
.progress div { height: 100%; width: 0; background: var(--accent); transition: width .2s; }

button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-size: .9rem; padding: 8px 14px; border-radius: 7px; cursor: pointer;
  border: 1px solid var(--line); background: var(--card); color: var(--text); text-decoration: none;
  min-height: 38px;
}
button:hover, .button:hover { border-color: var(--accent); }
.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
button:disabled { opacity: .45; cursor: not-allowed; }

/* Status */
.status-line { display: flex; gap: 14px; align-items: center; }
.status-title { font-weight: 600; }
.spinner { width: 26px; height: 26px; border: 3px solid var(--line); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .9s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }

/* Results */
.result-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.buttons { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-start; }
.stats { display: flex; flex-wrap: wrap; gap: 4px 20px; margin: 0; }
.stats div { display: flex; gap: 6px; }
.stats dt { color: var(--muted); }
.stats dd { margin: 0; font-variant-numeric: tabular-nums; }
.verdict { margin-top: 14px; padding: 12px 14px; border-radius: 8px; }
.verdict:empty { display: none; }
.verdict.ok { background: var(--ok-soft); color: var(--ok); }
.verdict.warn { background: var(--warn-soft); color: var(--warn); }
.verdict strong { color: var(--text); }
.verdict i { font-style: italic; }

.table-card { padding: 0; }
.table-card > p { padding: 0 20px; }
.table-card > p:last-child { padding-bottom: 14px; }
.table-scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { position: sticky; top: 0; background: var(--card); font-weight: 600; white-space: nowrap; cursor: pointer; user-select: none; }
th[data-sort="asc"]::after { content: " ▲"; font-size: .7em; }
th[data-sort="desc"]::after { content: " ▼"; font-size: .7em; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tbody tr.hit { cursor: pointer; }
tbody tr.hit:hover { background: var(--row-hover); }
tbody tr.hit[aria-expanded="true"] { background: var(--row-hover); }
.ref { font-family: var(--mono); font-size: .82rem; word-break: break-all; }
.acc { display: inline-block; margin-top: 2px; font-size: .82rem; }
.sp-name { font-style: italic; }
.lineage { color: var(--muted); font-size: .8rem; margin-top: 2px; }
.badge { display: inline-block; font-size: .72rem; font-weight: 600; padding: 1px 7px; border-radius: 999px; vertical-align: 1px; margin-left: 6px; }
.badge.sp { background: var(--ok-soft); color: var(--ok); }
.ani-bar { display: block; height: 3px; margin-top: 4px; background: var(--line); border-radius: 2px; }
.ani-bar span { display: block; height: 100%; background: var(--accent); border-radius: 2px; }
tr.detail td { background: var(--bg); padding: 12px 16px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 3px 16px; font-size: .82rem; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-family: var(--mono); word-break: break-all; }

.notes { padding: 4px 4px 40px; }
.notes ul { padding-left: 1.2em; margin: 0; }
.notes li { margin: 3px 0; }

@media (max-width: 640px) {
  .card { padding: 16px; }
  th, td { padding: 8px; }
  .hide-sm { display: none; }
}
