:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #1d2330;
  --muted: #5d6677;
  --line: #dde1e8;
  --accent: #1f6feb;
  --accent-text: #ffffff;
  --ok: #1a7f37;
  --warn: #9a6700;
  --bad: #cf222e;
  --drop: #eef4ff;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1218; --panel: #171b23; --text: #e6e9ef; --muted: #9aa3b2; --line: #2a303b;
    --accent: #4c8dff; --accent-text: #0b1020; --ok: #4ac26b; --warn: #d4a72c; --bad: #ff7b72; --drop: #142036;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1218; --panel: #171b23; --text: #e6e9ef; --muted: #9aa3b2; --line: #2a303b;
  --accent: #4c8dff; --accent-text: #0b1020; --ok: #4ac26b; --warn: #d4a72c; --bad: #ff7b72; --drop: #142036;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: "Hiragino Sans", "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
  line-height: 1.7; font-size: 16px;
}
a { color: var(--accent); }
.wrap { max-width: 880px; margin: 0 auto; padding: 0 16px; }
header.site { border-bottom: 1px solid var(--line); background: var(--panel); }
header.site .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 12px; padding-bottom: 12px; }
header.site a.brand { color: var(--text); text-decoration: none; font-weight: 700; font-size: 18px; }
header.site nav a { margin-left: 14px; font-size: 14px; color: var(--muted); text-decoration: none; }
header.site .offline { font-size: 12px; color: var(--ok); border: 1px solid var(--ok); border-radius: 999px; padding: 1px 8px; margin-left: 10px; }
h1 { font-size: 26px; margin: 28px 0 6px; line-height: 1.4; }
h2 { font-size: 19px; margin: 32px 0 8px; }
.lead { color: var(--muted); margin: 0 0 20px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 20px; }
.drop {
  border: 2px dashed var(--line); border-radius: 10px; padding: 32px 16px; text-align: center;
  background: var(--drop); cursor: pointer;
}
.drop.over { border-color: var(--accent); }
.drop strong { display: block; font-size: 17px; margin-bottom: 4px; }
.drop small { color: var(--muted); }
.btn {
  display: inline-block; background: var(--accent); color: var(--accent-text); border: 0; border-radius: 8px;
  padding: 10px 18px; font-size: 16px; font-weight: 600; cursor: pointer; text-decoration: none;
}
.btn.secondary { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.small-link { font-size: 14px; }
.options { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; font-size: 14px; }
.options label { color: var(--muted); }
.options small { color: var(--muted); font-size: 12px; }
.options select { font: inherit; font-size: 14px; padding: 5px 8px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg); color: var(--text); }
.pdfbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; font-size: 14px; }
.pdfbar .pdflabel { color: var(--muted); }
.pdfbar select { font: inherit; font-size: 14px; padding: 5px 8px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg); color: var(--text); }
.pdfbar .btn { padding: 6px 14px; font-size: 14px; }
.exportbar label { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); }
.exportbar { padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.btn[aria-disabled="true"], .btn:disabled { opacity: .5; cursor: default; }
.status { margin-top: 16px; min-height: 1.7em; color: var(--muted); }
.status.ok { color: var(--ok); }
.status.bad { color: var(--bad); }
.result { margin-top: 16px; display: none; }
.result.show { display: block; }
.result table { width: 100%; border-collapse: collapse; font-size: 14px; margin-top: 12px; }
.result th, .result td { text-align: left; border-top: 1px solid var(--line); padding: 6px 4px; vertical-align: top; }
.result th { width: 38%; color: var(--muted); font-weight: 500; }
.notice { font-size: 14px; color: var(--muted); }
table.files { width: 100%; border-collapse: collapse; font-size: 14px; margin: 0 0 12px; }
table.files td { border-bottom: 1px solid var(--line); padding: 7px 4px; vertical-align: middle; }
table.files tr.sel td { background: var(--drop); }
table.files .fname { word-break: break-all; font-weight: 600; width: 34%; }
table.files .fstate { color: var(--muted); }
table.files .fstate.done { color: var(--ok); }
table.files .fstate.fail { color: var(--bad); }
table.files .factions { text-align: right; white-space: nowrap; }
table.files .factions button, table.files .factions a {
  font: inherit; font-size: 13px; margin-left: 6px; padding: 3px 10px; border-radius: 6px;
  border: 1px solid var(--line); background: var(--bg); color: var(--text); cursor: pointer; text-decoration: none;
}
#zip { margin: 0 0 16px; }
#detail { margin-top: 8px; }
.viewer { margin-top: 16px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.viewer .toolbar { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px; background: var(--panel); border-bottom: 1px solid var(--line); }
.viewer .toolbar .sep { flex: 1; }
.viewer button {
  font: inherit; font-size: 13px; padding: 5px 10px; border-radius: 6px; cursor: pointer;
  border: 1px solid var(--line); background: var(--bg); color: var(--text);
}
.viewer button[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.viewer button:disabled { opacity: .4; cursor: default; }
.viewer canvas { display: block; width: 100%; height: min(62vh, 560px); touch-action: none; cursor: grab; }
.viewer .readout { padding: 8px 10px; font-size: 14px; border-top: 1px solid var(--line); background: var(--panel); min-height: 2.4em; font-variant-numeric: tabular-nums; }
.points { padding-left: 1.2em; }
.points li { margin: 4px 0; }
.ad-slot {
  margin: 24px 0; min-height: 100px; border: 1px dashed var(--line); border-radius: 8px;
  display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 12px;
}
footer.site { margin-top: 48px; border-top: 1px solid var(--line); padding: 20px 0 32px; font-size: 13px; color: var(--muted); }
footer.site a { color: var(--muted); margin-right: 14px; }
pre.license { white-space: pre-wrap; font-size: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px; overflow-x: auto; }
@media (max-width: 560px) {
  table.files, table.files tbody, table.files tr { display: block; width: 100%; }
  table.files tr { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; border-bottom: 1px solid var(--line); padding: 6px 0; }
  table.files td { display: block; border: 0; padding: 0 4px; }
  table.files .fname { width: 100%; }
  table.files .fstate { flex: 1 1 auto; min-width: 0; }
  table.files .factions { margin-left: auto; }
  h1 { font-size: 22px; }
  header.site nav a { margin-left: 10px; }
  .result th { width: 45%; }
}

/* FAQ and articles (search / reading pages) */
.faq dt { font-weight: 600; margin-top: 14px; }
.faq dd { margin: 4px 0 0 0; color: var(--muted); }
.article { max-width: 760px; }
.article p { line-height: 1.8; }
.crumbs { font-size: 13px; color: var(--muted); margin: 0 0 4px; }
.cta { margin: 20px 0; }
.points.list li { margin: 12px 0; }
.ad-slot.filled { display: block; border: 0; min-height: 0; }
