:root {
  --bg: #ffffff;
  --fg: #1a1a1a;
  --muted: #666666;
  --border: #dddddd;
  --accent: #2563eb;
  --surface: #f6f7f9;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16181c;
    --fg: #e8e8e8;
    --muted: #9aa0a6;
    --border: #33363b;
    --accent: #60a5fa;
    --surface: #1e2126;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: env(safe-area-inset-top) 16px env(safe-area-inset-bottom);
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, "Hiragino Sans", sans-serif;
  line-height: 1.7;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
}

h1 { font-size: 18px; margin: 0; }

/* 指で押せる大きさを確保する。iOS の推奨は44px以上 */
button {
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--fg);
  font-size: 15px;
}

/* 16px 未満だと iOS が入力時に勝手に拡大する */
input {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  font-size: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--fg);
}

.search { display: flex; gap: 8px; margin-bottom: 12px; }
.search button { white-space: nowrap; }

#list { list-style: none; margin: 0; padding: 0; }

#list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 14px 4px;
  border-bottom: 1px solid var(--border);
}

#list li[data-status="seed"] .term { color: var(--muted); }

.badge { font-size: 12px; color: var(--muted); white-space: nowrap; }

.muted { color: var(--muted); font-size: 14px; }
.summary { font-weight: 600; }

.tone { display: flex; gap: 8px; margin: 12px 0; }
.tone button.is-active { background: var(--accent); border-color: var(--accent); color: #fff; }

.related { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }

.error {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  margin-bottom: 12px;
  border-radius: 8px;
  background: #fdecea;
  color: #8a1c12;
}

@media (prefers-color-scheme: dark) {
  .error { background: #3b1a17; color: #f7b8b0; }
}

dialog { width: 92%; max-width: 480px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg); color: var(--fg); }
dialog label { display: block; margin: 12px 0 4px; font-size: 14px; }
.backup, .actions { display: flex; gap: 8px; margin-top: 16px; }
