:root {
  color-scheme: light dark;
  --fg: #1c1c1e;
  --bg: #f7f7f8;
  --muted: #6b6b70;
  --line: #d8d8dc;
  --accent: #3b5bdb;
  --ok: #2b8a3e;
  --err: #c92a2a;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", "Noto Sans JP", sans-serif;
  color: var(--fg);
  background: var(--bg);
  line-height: 1.6;
}

header {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.brand { font-weight: 700; text-decoration: none; color: var(--fg); }
nav { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }
nav a { color: var(--accent); text-decoration: none; }
nav a:hover { text-decoration: underline; }

main { max-width: 1100px; margin: 0 auto; padding: 1.25rem; }
footer { max-width: 1100px; margin: 0 auto; padding: 1rem 1.25rem 3rem; color: var(--muted); font-size: 0.85rem; }

h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; margin-top: 1.75rem; }
h3 { font-size: 1rem; margin-top: 1.25rem; }

a.button, button {
  font: inherit;
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--fg);
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}

a.button { background: var(--accent); border-color: var(--accent); color: #fff; }
button.danger { color: var(--err); border-color: var(--err); }
form.inline { display: inline; }

table { width: 100%; border-collapse: collapse; margin: 0.75rem 0; font-size: 0.9rem; }
th, td { border: 1px solid var(--line); padding: 0.4rem 0.6rem; text-align: left; vertical-align: top; }
th { background: #efeff2; font-weight: 600; }
tr:nth-child(even) td { background: #fbfbfc; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0.75rem; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 0.75rem 1rem; }
.card h2 { margin: 0 0 0.25rem; font-size: 0.9rem; color: var(--muted); font-weight: 600; }
.card p { margin: 0; font-size: 1.15rem; }

.mono, code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.85rem; }
pre.terms, pre.code {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.75rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 28rem;
  overflow: auto;
}

.muted { color: var(--muted); }
.ok { color: var(--ok); }
.err { color: var(--err); font-weight: 600; }
.truncate { max-width: 22rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag { display: inline-block; padding: 0 0.35rem; border: 1px solid var(--line); border-radius: 4px; font-size: 0.75rem; }
.actions { display: flex; flex-wrap: wrap; gap: 0.35rem; }
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 0.75rem 1rem; margin: 1rem 0; background: #fff; }
legend { padding: 0 0.35rem; font-weight: 600; }
label { display: block; margin: 0.5rem 0 0.25rem; }
input, textarea, select { font: inherit; padding: 0.35rem 0.5rem; border: 1px solid var(--line); border-radius: 6px; width: 100%; max-width: 34rem; }
label.checkbox { display: flex; gap: 0.5rem; align-items: flex-start; margin-top: 0.75rem; }
label.checkbox input { width: auto; margin-top: 0.35rem; }

@media (prefers-color-scheme: dark) {
  :root {
    --fg: #e6e6e9;
    --bg: #16161a;
    --muted: #9a9aa2;
    --line: #34343c;
    --accent: #7f9cf5;
  }
  header, .card, fieldset, pre.terms, pre.code, a.button, button { background: #1f1f25; }
  a.button { background: var(--accent); border-color: var(--accent); color: #101014; }
  table th { background: #24242b; }
  tr:nth-child(even) td { background: #1b1b21; }
}
