/* Gummelier — ミニマル図鑑風（決定事項 Q1・Q2：標本グリーン #2F6B4F ＋ オフホワイト #FAFAF7）
 * 白い余白、細い罫、標本ラベル風の番号、写真が主役。
 */
:root {
  --bg: #FAFAF7;        /* オフホワイト */
  --surface: #FFFFFF;   /* カード */
  --text: #222222;      /* チャコール */
  --muted: #6E6E69;     /* 補助テキスト（#8A8A85 は本文サイズでは淡いため少し濃くしている） */
  --line: #E3E2DC;      /* 罫線 */
  --accent: #2F6B4F;    /* 標本グリーン */
  --accent-soft: #E8F0EB;
  --on-accent: #FFFFFF;
  --amber: #B97A1E;     /* 評価色（琥珀。白背景で読める濃さに調整） */
  --tabbar-h: 60px;
  --font-sans: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
  --font-serif: "Cormorant Garamond", "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161816;
    --surface: #1E211F;
    --text: #ECECE8;
    --muted: #A3A39D;
    --line: #333733;
    --accent: #7FB89A;
    --accent-soft: #233229;
    --on-accent: #10140F;
    --amber: #E0A955;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; } /* .actions などの display 指定より hidden を優先する */
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.7;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 16px);
  -webkit-text-size-adjust: 100%;
}
a { color: var(--accent); }
img { display: block; }

/* ---- 題字 ---- */
.masthead {
  padding: calc(20px + env(safe-area-inset-top)) 16px 12px;
  max-width: 760px; margin: 0 auto;
  border-bottom: 1px solid var(--line);
}
.masthead .brand { font-family: var(--font-serif); font-size: 26px; font-weight: 600; letter-spacing: .04em; margin: 0; line-height: 1.2; }
.masthead .brand small { font-family: var(--font-sans); font-size: 13px; font-weight: normal; color: var(--muted); letter-spacing: .1em; margin-left: 8px; }
.masthead .section { margin: 6px 0 0; font-size: 13px; color: var(--muted); letter-spacing: .12em; }

main { padding: 16px; max-width: 760px; margin: 0 auto; }
h2 {
  font-size: 13px; font-weight: 600; letter-spacing: .14em; color: var(--muted);
  margin: 28px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--line);
}
h2:first-child { margin-top: 4px; }
h3 { font-size: 16px; margin: 0 0 6px; }
.muted { color: var(--muted); font-size: 14px; }
.mono, .no { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.no { font-size: 12px; letter-spacing: .06em; color: var(--accent); }
.empty { color: var(--muted); padding: 32px 0; text-align: center; }

/* ---- タブ ---- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-top: 1px solid var(--line);
}
.tabbar a {
  display: flex; align-items: center; justify-content: center; min-height: 44px;
  color: var(--muted); text-decoration: none; font-size: 13px; letter-spacing: .06em;
}
.tabbar a.active { color: var(--accent); font-weight: 600; }
.tabbar .tab-record span {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 64px; height: 40px; padding: 0 12px; border-radius: 20px;
  background: var(--accent); color: var(--on-accent); font-weight: 600;
}

/* ---- 図鑑グリッド（標本ラベル） ---- */
.specimens { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; } /* 第2弾Q1：2列 */
.specimen { display: block; color: inherit; text-decoration: none; background: var(--surface); border: 1px solid var(--line); }
.specimen .photo { aspect-ratio: 1 / 1; width: 100%; object-fit: cover; background: var(--accent-soft); }
.specimen .photo.none { display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 13px; }
.label { padding: 8px 10px 10px; border-top: 1px solid var(--line); }
.label .name { font-size: 15px; font-weight: 600; line-height: 1.4; margin: 2px 0; overflow-wrap: anywhere; }
.label .meta { font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; gap: 6px; }
.score { font-family: var(--font-mono); font-variant-numeric: tabular-nums; color: var(--amber); font-weight: 600; }

/* ---- リスト（ランキング・新聞） ---- */
.list { list-style: none; padding: 0; margin: 0; }
.row { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; }
.row .rank { width: 2.2em; text-align: right; font-family: var(--font-mono); font-size: 15px; color: var(--muted); flex: none; }
.row.top .rank { color: var(--accent); font-weight: 600; font-size: 20px; }
/* 第2弾Q3：上位3件だけ写真を大きく */
.row.top .thumb { width: 96px; height: 96px; }
.row.top .body { font-size: 17px; font-weight: 600; }
.row.top .score { font-size: 18px; }
.row .body { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.thumb { width: 56px; height: 56px; object-fit: cover; background: var(--accent-soft); flex: none; }
.thumb.none { display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 11px; }

/* ---- 詳細 ---- */
.hero { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; background: var(--accent-soft); }
.hero.none { display: flex; align-items: center; justify-content: center; color: var(--muted); }
.hero-strip { display: flex; gap: 8px; overflow-x: auto; margin-top: 8px; }
.hero-strip img { width: 64px; height: 64px; object-fit: cover; flex: none; }
.plate { border: 1px solid var(--line); background: var(--surface); padding: 14px 16px; margin-top: 12px; }
.plate .name { font-size: 20px; font-weight: 600; margin: 2px 0; }
.big-score { font-family: var(--font-mono); font-size: 28px; color: var(--amber); font-weight: 600; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { border-bottom: 1px solid var(--line); padding: 6px 4px; text-align: left; font-weight: normal; }
th { color: var(--muted); font-size: 12px; letter-spacing: .08em; }
td.num { font-family: var(--font-mono); text-align: right; }
.bar { height: 4px; background: var(--line); margin-top: 4px; }
.bar i { display: block; height: 100%; background: var(--accent); }
.entry { border-top: 1px solid var(--line); padding: 14px 0; }

/* ---- フォーム ---- */
label, .field-label { display: block; margin: 14px 0 4px; font-size: 14px; }
input[type=text], input[type=url], input[type=number], input[type=date], input[type=search], select, textarea {
  width: 100%; font: inherit; padding: 10px; border: 1px solid var(--line); border-radius: 0;
  background: var(--surface); color: var(--text);
}
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
textarea { min-height: 80px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.axis { margin: 14px 0; }
.axis-label { font-size: 15px; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.axis-anchor { font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; margin-top: 2px; }
.taps { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-top: 4px; }
.taps button, .chips button {
  min-height: 44px; border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font: inherit; font-family: var(--font-mono); cursor: pointer;
}
.taps button.on, .chips button.on { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.chips button { flex: none; padding: 4px 14px; font-family: var(--font-sans); font-size: 14px; }
.photo-input { display: flex; align-items: center; justify-content: center; min-height: 120px; border: 1px dashed var(--accent); color: var(--accent); background: var(--accent-soft); cursor: pointer; }
.photo-input input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.preview { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.preview img { width: 80px; height: 80px; object-fit: cover; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 10px 18px;
  border: 1px solid var(--accent); background: var(--accent); color: var(--on-accent);
  font: inherit; font-size: 15px; cursor: pointer; text-decoration: none; border-radius: 0;
}
.btn.secondary { background: transparent; color: var(--accent); }
.btn.quiet { background: transparent; color: var(--muted); border-color: var(--line); font-size: 14px; }
.btn.block { width: 100%; margin-top: 20px; }
.btn:disabled { opacity: .5; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.toast {
  position: fixed; left: 16px; right: 16px; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 16px); z-index: 20;
  max-width: 480px; margin: 0 auto; background: var(--text); color: var(--bg); padding: 12px 16px; text-align: center; font-size: 14px;
}

/* ---- レーダーチャート（第2弾Q6：特徴5軸） ---- */
.radar { display: block; width: 100%; max-width: 340px; margin: 0 auto 8px; }
.radar .radar-grid { fill: none; stroke: var(--line); stroke-width: 1; }
.radar .radar-grid.outer { stroke: var(--muted); stroke-opacity: .5; }
.radar .radar-shape { fill: var(--accent); fill-opacity: .18; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; }
.radar .radar-dot { fill: var(--accent); }
.radar .radar-label { font-family: var(--font-sans); font-size: 13px; fill: var(--text); }
.radar .radar-val { font-family: var(--font-mono); font-size: 12px; fill: var(--muted); }

/* ---- 「詳しく記録」（第2弾Q4） ---- */
.more { margin-top: 24px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.more > summary {
  min-height: 48px; display: flex; align-items: center; cursor: pointer; list-style: none;
  color: var(--accent); font-size: 15px; font-weight: 600;
}
.more > summary::-webkit-details-marker { display: none; }
.more > summary::before { content: "＋"; margin-right: 8px; }
.more[open] > summary::before { content: "－"; }
.more[open] { padding-bottom: 16px; }

/* ---- タグ（第2弾Q5） ---- */
.chips.wrap { flex-wrap: wrap; overflow-x: visible; }
.add-tag { display: flex; gap: 8px; margin-top: 8px; }
.add-tag input { flex: 1; min-width: 0; }
.add-tag .btn { flex: none; }

/* ---- 記録の編集：今ある写真（第3弾Q1） ---- */
.ph { position: relative; padding: 0; border: 1px solid var(--line); background: none; cursor: pointer; width: 80px; height: 80px; }
.ph img { width: 100%; height: 100%; object-fit: cover; }
.ph span {
  position: absolute; top: 2px; right: 2px; width: 24px; height: 24px; line-height: 24px; text-align: center;
  background: var(--surface); color: var(--text); border: 1px solid var(--line); font-size: 13px;
}
.ph.removing img { opacity: .3; }
.ph.removing span { background: #B3261E; color: #fff; border-color: #B3261E; }
.linklike { background: none; border: 0; padding: 0 0 0 6px; color: var(--accent); text-decoration: underline; font: inherit; font-size: 14px; cursor: pointer; min-height: 44px; }
.warn { color: #B3261E; }
@media (prefers-color-scheme: dark) { .warn { color: #F2B8B5; } }
.btn.quiet.block { margin-top: 8px; }
