:root {
  --bg: #f6f6f4; --card: #ffffff; --text: #1d1d1f; --muted: #6e6e73; --line: #e2e2df;
  --accent: #2f6fdf; --accent-text: #ffffff; --danger: #c4372d; --ok: #2e8540; --warn: #b26a00;
  --radius: 12px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111113; --card: #1c1c1f; --text: #f2f2f4; --muted: #9a9aa0; --line: #2e2e33;
    --accent: #5b8ff0; --accent-text: #0b0b0d; --danger: #ff6b5e; --ok: #5cc479; --warn: #f0a742;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 17px/1.5 -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  overflow-wrap: anywhere;
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
}
header.top, main { max-width: 640px; margin: 0 auto; padding: 0 16px; }
header.top { display: flex; align-items: center; justify-content: space-between; min-height: 56px; }
header.top h1 { font-size: 22px; margin: 0; }
h2 { font-size: 18px; margin: 24px 0 8px; }
a { color: var(--accent); }
.muted { color: var(--muted); font-size: 15px; }
.error { color: var(--danger); }
.notice { background: var(--card); border: 1px solid var(--warn); border-radius: var(--radius); padding: 12px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin: 12px 0; }
.card h3 { font-size: 17px; margin: 0 0 6px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
label { display: flex; flex-direction: column; gap: 6px; }
input, textarea, button, select { font: inherit; color: inherit; }
input[type=password], input[type=text], textarea {
  width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--card);
}
textarea.big { min-height: 140px; resize: vertical; }
button, .button {
  min-height: 44px; padding: 8px 16px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--card); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center;
}
button.primary, .button.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
button.danger { color: var(--danger); border-color: var(--danger); }
button.link { border: none; background: none; color: var(--accent); padding: 8px 0; }
button.grow { flex: 1 1 0; }
.option.recommended { border-color: var(--accent); font-weight: 600; }
.tag { display: inline-block; font-size: 13px; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.tag.ok { color: var(--ok); border-color: var(--ok); }
.tag.warn { color: var(--warn); border-color: var(--warn); }
.tag.bad { color: var(--danger); border-color: var(--danger); }
ul.list { list-style: none; padding: 0; margin: 0; }
ul.list li { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin: 8px 0; }
ul.list li a.title { font-weight: 600; text-decoration: none; color: var(--text); display: block; min-height: 24px; }
dl.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; }
pre { white-space: pre-wrap; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px; font-size: 14px; }
details summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; color: var(--muted); }
nav.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-around;
  background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
nav.tabs a {
  flex: 1; min-height: 56px; display: flex; align-items: center; justify-content: center; gap: 4px;
  color: var(--muted); text-decoration: none; font-size: 14px; min-width: 0; white-space: nowrap;
}
nav.tabs a.on { color: var(--accent); font-weight: 600; }
.badge { background: var(--danger); color: #fff; border-radius: 999px; font-size: 12px; min-width: 18px; padding: 0 5px; text-align: center; }

.diff { font-family: ui-monospace, Menlo, monospace; font-size: 13px; white-space: pre-wrap; background: var(--card);
  border: 1px solid var(--line); border-radius: 10px; padding: 8px; }
.diff .add { color: var(--ok); }
.diff .del { color: var(--danger); }
.diff .hunk { color: var(--muted); }
.ok-msg { color: var(--ok); }
.fields { display: grid; grid-template-columns: 1fr; gap: 12px; }
select { min-height: 44px; padding: 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); width: 100%; }
input[type=number] { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.checks { display: flex; flex-wrap: wrap; gap: 12px; }
.checks label { flex-direction: row; align-items: center; min-height: 44px; }
.hint { color: var(--muted); font-size: 14px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choice { flex-direction: row; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice span {
  display: inline-flex; align-items: center; min-height: 44px; padding: 8px 14px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--card); cursor: pointer;
}
.choice input:checked + span { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 600; }
.choice input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
