:root {
  --bg: #f4f7f6;
  --card: #ffffff;
  --text: #17211f;
  --muted: #5b6b67;
  --line: #d9e2df;
  --brand: #0f766e;
  --brand-ink: #ffffff;
  --danger: #b91c1c;
  --danger-bg: #fdecec;
  --warn: #b45309;
  --warn-bg: #fff4e0;
  --low: #8a6d00;
  --low-bg: #fff9db;
  --ok: #166534;
  --ok-bg: #e6f6ec;
  --info: #1d4f8c;
  --info-bg: #e8f1fb;
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1513;
    --card: #17211f;
    --text: #e8f0ee;
    --muted: #9fb0ab;
    --line: #2a3a36;
    --brand: #2dd4bf;
    --brand-ink: #06231f;
    --danger: #ff8a8a;
    --danger-bg: #3a1717;
    --warn: #fbbf6a;
    --warn-bg: #3a2a10;
    --low: #f1d56a;
    --low-bg: #332d10;
    --ok: #86efac;
    --ok-bg: #12301f;
    --info: #9cc4f5;
    --info-bg: #14263d;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.65 -apple-system, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", Meiryo, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}
.top { padding: calc(14px + env(safe-area-inset-top)) 16px 6px; max-width: 720px; margin: 0 auto; }
.top h1 { margin: 0; font-size: 1.5rem; letter-spacing: .02em; }
.logo { margin-right: 8px; }
.sub { margin: 2px 0 0; color: var(--muted); font-size: .85rem; }

.tabs {
  position: sticky; top: 0; z-index: 5;
  display: flex; gap: 4px; max-width: 720px; margin: 8px auto 0; padding: 6px 12px;
  background: var(--bg); border-bottom: 1px solid var(--line);
  overflow-x: auto;
}
.tabs button {
  flex: 1 0 auto; min-height: 44px; padding: 0 14px;
  border: 0; border-radius: 10px; background: transparent; color: var(--muted);
  font: inherit; font-size: .95rem; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.tabs button[aria-selected="true"] { background: var(--brand); color: var(--brand-ink); }

main { max-width: 720px; margin: 0 auto; padding: 12px 16px 48px; }
[hidden] { display: none !important; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin-bottom: 14px;
}
.card h2 { margin: 0 0 6px; font-size: 1.1rem; }
.hint { margin: 0 0 10px; color: var(--muted); font-size: .88rem; line-height: 1.6; }
.warnbox { background: var(--warn-bg); color: var(--warn); padding: 10px 12px; border-radius: 10px; margin: 12px 0 0; }
label { display: block; margin: 10px 0 4px; font-size: .85rem; font-weight: 600; color: var(--muted); }
textarea, input[type="text"], input[type="tel"] {
  width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); color: var(--text); font: inherit; font-size: 1rem;
}
textarea { resize: vertical; min-height: 120px; }
textarea:focus, input:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
code { background: var(--bg); padding: 1px 6px; border-radius: 6px; font-size: .9em; }

.row { display: flex; gap: 8px; margin-top: 12px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; margin-top: 0; }
.btn {
  min-height: 46px; padding: 0 18px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--card); color: var(--text); font: inherit; font-weight: 600; cursor: pointer;
}
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); flex: 1; }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.small { min-height: 38px; padding: 0 12px; font-size: .88rem; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }

details { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 8px; }
summary { cursor: pointer; font-weight: 600; min-height: 36px; display: flex; align-items: center; }

/* 結果 */
.result { border-radius: var(--radius); padding: 16px; margin-bottom: 14px; border: 2px solid; }
.result.danger { background: var(--danger-bg); border-color: var(--danger); }
.result.warn { background: var(--warn-bg); border-color: var(--warn); }
.result.low { background: var(--low-bg); border-color: var(--low); }
.result.ok { background: var(--ok-bg); border-color: var(--ok); }
.result.info { background: var(--info-bg); border-color: var(--info); }
.result h3 { margin: 0; font-size: 1.25rem; }
.result.danger h3 { color: var(--danger); }
.result.warn h3 { color: var(--warn); }
.result.low h3 { color: var(--low); }
.result.ok h3 { color: var(--ok); }
.result.info h3 { color: var(--info); }
.meter { height: 10px; border-radius: 6px; background: rgba(127,127,127,.2); margin: 10px 0 4px; overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: 6px; background: currentColor; }
.result.danger .meter { color: var(--danger); }
.result.warn .meter { color: var(--warn); }
.result.low .meter { color: var(--low); }
.result.ok .meter { color: var(--ok); }
.scoretext { font-size: .8rem; color: var(--muted); margin: 0 0 6px; }
.result h4 { margin: 14px 0 6px; font-size: .95rem; }
.reasons, .bullets, .advice { margin: 0; padding-left: 1.2em; }
.reasons li, .bullets li, .advice li { margin: 6px 0; }
.reasons .rl { font-weight: 700; }
.reasons .rd { display: block; font-size: .88rem; color: var(--muted); }
.urls { list-style: none; padding: 0; margin: 0; }
.urls li { font-family: ui-monospace, Menlo, monospace; font-size: .85rem; word-break: break-all; padding: 6px 8px; background: rgba(127,127,127,.12); border-radius: 8px; margin: 4px 0; }
.urls li small { display: block; color: var(--muted); font-family: inherit; }
.kind { margin: 4px 0 0; font-size: .95rem; color: var(--muted); }
.result .btn { margin-top: 12px; }

.tip { background: var(--info-bg); border-color: transparent; }

.history, .blocklist { list-style: none; margin: 8px 0 0; padding: 0; }
.history li, .blocklist li {
  display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line);
}
.history li:last-child, .blocklist li:last-child { border-bottom: 0; }
.dot { flex: none; width: 12px; height: 12px; border-radius: 50%; }
.dot.danger { background: var(--danger); } .dot.warn { background: var(--warn); }
.dot.low { background: var(--low); } .dot.ok { background: var(--ok); } .dot.info { background: var(--info); }
.history .body, .blocklist .body { flex: 1; min-width: 0; }
.history .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history .d { font-size: .78rem; color: var(--muted); }
.blocklist .num { font-weight: 700; font-family: ui-monospace, Menlo, monospace; }
.blocklist .memo { font-size: .85rem; color: var(--muted); }
.del { flex: none; min-width: 44px; min-height: 44px; border: 0; background: transparent; color: var(--muted); font-size: 1.2rem; cursor: pointer; border-radius: 10px; }
.del:hover { color: var(--danger); }
.badge { background: var(--brand); color: var(--brand-ink); border-radius: 999px; padding: 0 10px; font-size: .8rem; vertical-align: middle; }
.empty { color: var(--muted); font-size: .9rem; }

#toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px);
  background: #17211f; color: #fff; padding: 10px 18px; border-radius: 999px; font-size: .9rem;
  opacity: 0; pointer-events: none; transition: .2s; max-width: 90vw; z-index: 20;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
a { color: var(--brand); font-weight: 600; }
