/* ============================================================
   アイデアの苗床 — 園芸ノート風デザイン
   paper: 若葉がかった生成りの方眼紙 / ink: 藍 / accent: 若葉・山吹
   ============================================================ */

:root {
  --paper: #f3f5ee;
  --grid: rgba(63, 139, 92, 0.07);
  --card: #ffffff;
  --ink: #26314a;
  --ink-soft: #5c6678;
  --ink-faint: #8b93a3;
  --leaf: #3f8b5c;
  --leaf-deep: #2f6b47;
  --leaf-mist: #e7f0e9;
  --spark: #d99a2b;
  --beni: #bf5450;
  --line: #dde3d4;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(38, 49, 74, 0.05), 0 10px 26px -14px rgba(38, 49, 74, 0.22);
  --font-display: "Zen Maru Gothic", "Hiragino Maru Gothic ProN", "Yu Gothic UI", "Meiryo", sans-serif;
  --font-body: "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Meiryo", sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.75;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 28px 28px;
}

a { color: var(--leaf-deep); }

.container {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 18px;
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------------- ヘッダー ---------------- */

.site-header {
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 12px;
  padding-bottom: 12px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
}

.logo-mark {
  font-size: 26px;
  background: var(--leaf-mist);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  flex: none;
}

.logo-title {
  display: block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 19px;
  line-height: 1.2;
  letter-spacing: 0.04em;
}

.logo-tagline {
  display: block;
  font-size: 11px;
  color: var(--ink-soft);
  letter-spacing: 0.06em;
}

/* ---------------- ボタン ---------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 999px;
  border: 1.5px solid transparent;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.03em;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background-color 0.12s ease;
  white-space: nowrap;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: var(--leaf);
  color: #fff;
  box-shadow: 0 4px 12px -4px rgba(63, 139, 92, 0.5);
}
.btn-primary:hover { background: var(--leaf-deep); }

.btn-ghost {
  background: var(--card);
  border-color: var(--line);
  color: var(--ink);
}
.btn-ghost:hover { border-color: var(--leaf); color: var(--leaf-deep); }

.btn-danger {
  background: transparent;
  border-color: rgba(191, 84, 80, 0.4);
  color: var(--beni);
}
.btn-danger:hover { background: rgba(191, 84, 80, 0.08); border-color: var(--beni); }

.btn-sm { padding: 6px 13px; font-size: 13px; }

.btn.is-loading { opacity: 0.7; pointer-events: none; }

.link-danger {
  border: 0;
  background: none;
  color: var(--ink-faint);
  cursor: pointer;
  font-size: 13px;
  padding: 2px 6px;
  border-radius: 6px;
}
.link-danger:hover { color: var(--beni); background: rgba(191, 84, 80, 0.08); }

/* ---------------- フラッシュ・トースト ---------------- */

.flash-area { margin-top: 16px; }

.flash {
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  font-size: 14px;
  border: 1px solid;
}
.flash-ok    { background: var(--leaf-mist); border-color: rgba(63, 139, 92, 0.35); color: var(--leaf-deep); }
.flash-error { background: #faecec; border-color: rgba(191, 84, 80, 0.4); color: #8f3a37; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 14px;
  box-shadow: var(--shadow);
  z-index: 100;
}

/* ---------------- ツールバー ---------------- */

.toolbar { margin: 22px 0 14px; }

.search-form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.search-form input[type="search"] {
  flex: 1 1 240px;
  min-width: 0;
}

input[type="text"],
input[type="search"],
select,
textarea {
  font-family: var(--font-body);
  font-size: 14.5px;
  color: var(--ink);
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 9px 13px;
  outline: none;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.btn:focus-visible,
a:focus-visible {
  border-color: var(--leaf);
  box-shadow: 0 0 0 3px rgba(63, 139, 92, 0.2);
  outline: none;
}

textarea { width: 100%; resize: vertical; line-height: 1.7; }

/* ---------------- ステージタブ・タグ ---------------- */

.stage-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.stage-tab {
  --stage: var(--ink-soft);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 13px;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: var(--card);
  color: var(--ink);
  text-decoration: none;
  font-size: 13.5px;
  font-family: var(--font-display);
  font-weight: 500;
  transition: border-color 0.12s ease, background-color 0.12s ease;
}

.stage-tab:hover { border-color: var(--stage); }

.stage-tab.is-active {
  background: var(--stage);
  border-color: var(--stage);
  color: #fff;
}
.stage-tab.is-active .count { background: rgba(255, 255, 255, 0.25); color: #fff; }

.count {
  font-size: 11px;
  background: var(--paper);
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 1px 7px;
  font-family: var(--font-body);
}

.tag-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12.5px;
  color: var(--ink-soft);
  background: var(--card);
  border: 1px dashed var(--line);
  border-radius: 6px;
  padding: 2px 9px;
  text-decoration: none;
}
.tag-chip:hover { color: var(--leaf-deep); border-color: var(--leaf); }
.tag-chip.is-active {
  background: var(--ink);
  color: #fff;
  border-style: solid;
  border-color: var(--ink);
}

/* ---------------- カードグリッド(苗ラベル) ---------------- */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(265px, 1fr));
  gap: 14px;
  margin-bottom: 40px;
}

.card {
  --stage: var(--leaf);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 6px solid var(--stage);
  border-radius: var(--radius);
  padding: 14px 16px 12px;
  text-decoration: none;
  color: var(--ink);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.card-stage {
  font-size: 12px;
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--stage);
  letter-spacing: 0.05em;
}

.card-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.5;
}

.card-summary {
  margin: 0;
  font-size: 13px;
  color: var(--ink-soft);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-foot {
  margin-top: auto;
  padding-top: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.card-meta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--ink-faint);
}

.priority { color: var(--spark); letter-spacing: 0.1em; font-size: 12px; }
.priority.p3 { color: var(--ink-faint); }

.card-tags { display: inline-flex; gap: 4px; flex-wrap: wrap; }

.mini-tag {
  font-size: 11px;
  color: var(--ink-soft);
  background: var(--paper);
  border-radius: 5px;
  padding: 1px 7px;
}

/* ---------------- 空状態 ---------------- */

.empty {
  text-align: center;
  padding: 70px 20px 90px;
  color: var(--ink-soft);
}
.empty-emoji { font-size: 44px; margin: 0 0 10px; }
.empty p { margin: 0 0 18px; }

/* ---------------- パネル共通 ---------------- */

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 16px;
}

.panel-title {
  margin: 0 0 18px;
  font-family: var(--font-display);
  font-size: 19px;
}

.section-title {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-count {
  font-size: 12px;
  background: var(--paper);
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 1px 9px;
  font-weight: 500;
}

.back-link {
  display: inline-block;
  margin: 18px 0 12px;
  font-size: 13.5px;
  color: var(--ink-soft);
  text-decoration: none;
}
.back-link:hover { color: var(--leaf-deep); }

.prewrap { white-space: pre-wrap; word-break: break-word; margin: 0; }

/* ---------------- 詳細ヘッダー ---------------- */

.idea-head { border-left: 6px solid var(--stage); }

.idea-head-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.stage-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--stage);
  color: #fff;
  border-radius: 999px;
  padding: 3px 14px;
  font-size: 13px;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.04em;
}

.idea-title {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-size: 24px;
  line-height: 1.45;
}

.idea-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }

.idea-meta {
  display: flex;
  gap: 16px;
  font-size: 12.5px;
  color: var(--ink-faint);
  margin-bottom: 14px;
}

.idea-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  border-top: 1px dashed var(--line);
  padding-top: 14px;
}

.stage-form { display: inline-flex; gap: 6px; align-items: center; }
.stage-form select { padding: 6px 10px; font-size: 13px; }
.inline-form { display: inline; }

/* ---------------- ステッパー ---------------- */

.stepper {
  display: flex;
  align-items: flex-start;
  gap: 0;
  margin: 6px 0 16px;
  flex-wrap: wrap;
}

.step {
  --stage: var(--ink-faint);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: 1 1 0;
  min-width: 64px;
}

.step:not(:first-child)::before {
  content: "";
  position: absolute;
  top: 17px;
  right: 50%;
  width: 100%;
  height: 2px;
  background: var(--line);
  z-index: 0;
}

.step.is-past:not(:first-child)::before,
.step.is-current:not(:first-child)::before {
  background: var(--leaf);
}

.step-dot {
  position: relative;
  z-index: 1;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  font-size: 15px;
  background: var(--paper);
  border: 2px solid var(--line);
  border-radius: 50%;
  filter: grayscale(1);
  opacity: 0.65;
}

.step.is-past .step-dot {
  filter: none;
  opacity: 1;
  border-color: var(--leaf);
  background: var(--leaf-mist);
}

.step.is-current .step-dot {
  filter: none;
  opacity: 1;
  background: #fff;
  border-color: var(--stage);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--stage) 22%, transparent);
}

.step-label {
  font-size: 11px;
  color: var(--ink-faint);
  font-family: var(--font-display);
}
.step.is-current .step-label { color: var(--stage); font-weight: 700; }
.step.is-past .step-label { color: var(--ink-soft); }

.hold-badge {
  flex: 0 0 auto;
  align-self: center;
  margin-left: 10px;
  font-size: 12.5px;
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--ink-soft);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 12px;
}

/* ---------------- フォーム ---------------- */

.form-panel { max-width: 720px; }

.idea-form .field { margin-bottom: 16px; display: flex; flex-direction: column; gap: 5px; }

.idea-form label,
.note-form label {
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font-display);
  color: var(--ink-soft);
}

.required {
  font-size: 10.5px;
  color: #fff;
  background: var(--beni);
  border-radius: 4px;
  padding: 1px 6px;
  margin-left: 4px;
  vertical-align: 1px;
}

.field-row { display: flex; gap: 16px; flex-wrap: wrap; }
.field-row .field { flex: 1 1 180px; }

.form-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 8px;
  flex-wrap: wrap;
}

/* ---------------- AIパネル ---------------- */

.ai-panel {
  background: linear-gradient(160deg, #f6f8fb 0%, #eef3ee 100%);
  border-color: #ccd8cd;
}

.ai-hint { margin: 0 0 12px; font-size: 13.5px; color: var(--ink-soft); }

.ai-note { font-size: 12.5px; color: var(--ink-faint); }

.ai-setup { margin-top: 14px; font-size: 13px; color: var(--ink-soft); }
.ai-setup summary { cursor: pointer; font-family: var(--font-display); }
.ai-setup code {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px 6px;
  font-size: 12px;
}

/* ---------------- 成長記録タイムライン ---------------- */

.note-form { margin-bottom: 20px; }

.timeline {
  list-style: none;
  margin: 0;
  padding: 0 0 0 18px;
  border-left: 2px solid var(--line);
}

.timeline-item {
  position: relative;
  padding: 0 0 18px 14px;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: -25px;
  top: 7px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--leaf);
  border: 2px solid var(--card);
}

.timeline-item.is-ai::before { background: #4c7fb0; }

.timeline-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.timeline-author {
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font-display);
}
.timeline-item.is-ai .timeline-author { color: #3c6a97; }

.timeline-date { font-size: 12px; color: var(--ink-faint); }

.timeline-delete { margin-left: auto; }

.timeline-body {
  font-size: 14px;
  background: var(--paper);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
}

.timeline-item.is-ai .timeline-body {
  background: #f0f4f9;
  border: 1px solid #dce5ef;
}

.timeline-empty { color: var(--ink-faint); font-size: 13.5px; }

/* ---------------- フッター ---------------- */

.site-footer {
  margin-top: 40px;
  padding: 18px 0 26px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--ink-faint);
}
.site-footer a { color: var(--ink-soft); }
.footer-sep { margin: 0 8px; }

/* ---------------- レスポンシブ・アクセシビリティ ---------------- */

@media (max-width: 560px) {
  .logo-tagline { display: none; }
  .panel { padding: 18px 16px; }
  .idea-title { font-size: 20px; }
  .step { min-width: 52px; }
  .step-label { font-size: 10px; }
}

/* ============================================================
   ここから拡張機能(ナビ / 水やり / 庭 / 星座 / マトリクス / 交配)
   ============================================================ */

/* ---------------- ナビゲーション ---------------- */

.main-nav {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  padding-bottom: 6px;
  -webkit-overflow-scrolling: touch;
}

.main-nav a {
  padding: 4px 12px;
  border-radius: 999px;
  text-decoration: none;
  color: var(--ink-soft);
  font-size: 13.5px;
  font-family: var(--font-display);
  font-weight: 500;
  white-space: nowrap;
}

.main-nav a:hover { color: var(--leaf-deep); background: var(--leaf-mist); }
.main-nav a.is-active { color: #fff; background: var(--ink); }

.page-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 20px;
}

/* ---------------- クイック種まき ---------------- */

.quick-sow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 20px 0 6px;
  background: var(--card);
  border: 1.5px dashed var(--leaf);
  border-radius: var(--radius);
  padding: 10px 14px;
}

.quick-sow-icon { font-size: 18px; }

.quick-sow input {
  flex: 1;
  min-width: 0;
  border: none;
  padding: 6px 4px;
  font-size: 15px;
  background: transparent;
}
.quick-sow input:focus-visible { box-shadow: none; }
.quick-sow:focus-within { box-shadow: 0 0 0 3px rgba(63, 139, 92, 0.15); }

/* ---------------- 水やりバナー ---------------- */

.water-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: 10px 0 6px;
  background: #eef4f9;
  border: 1px solid #cfdeeb;
  border-radius: var(--radius);
  padding: 10px 16px;
  font-size: 14px;
}

.water-info a { color: var(--ink); text-decoration: none; }
.water-info a:hover strong { color: #3c6a97; }

.water-form { display: flex; gap: 8px; flex: 1 1 300px; }
.water-form input { flex: 1; min-width: 0; padding: 6px 12px; font-size: 13.5px; }

.dry-badge {
  font-size: 11px;
  color: #3c6a97;
  background: #e3edf6;
  border-radius: 999px;
  padding: 1px 8px;
  font-family: var(--font-body);
  font-weight: 500;
  white-space: nowrap;
}

/* しおれ表現(カード・植物 共通) */
.wilt-1 { filter: saturate(0.85); }
.wilt-2 { filter: saturate(0.6) sepia(0.12); }
.wilt-3 { filter: saturate(0.35) sepia(0.28); }

.plant.wilt-2 .plant-svg { transform: rotate(4deg); }
.plant.wilt-3 .plant-svg { transform: rotate(8deg); }

/* ---------------- AI採点チップ ---------------- */

.score-chips {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.score-chip {
  font-size: 12.5px;
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 12px;
}

.score-reason { font-size: 12.5px; color: var(--ink-soft); font-style: normal; }

/* ---------------- 人格ピッカー ---------------- */

.persona-picker {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.persona-chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.persona-chip span {
  display: inline-block;
  padding: 5px 13px;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: var(--card);
  font-size: 13px;
  font-family: var(--font-display);
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.12s ease, background-color 0.12s ease;
}

.persona-chip span:hover { border-color: var(--leaf); }
.persona-chip input:checked + span {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}
.persona-chip input:focus-visible + span {
  box-shadow: 0 0 0 3px rgba(63, 139, 92, 0.25);
}

/* ---------------- ガーデンビュー ---------------- */

.garden-head { padding: 16px 20px; }

.garden-stats {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  font-size: 13.5px;
  color: var(--ink-soft);
}

.garden-stats b { color: var(--ink); font-size: 16px; }

.streak {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--ink);
  font-size: 15px;
}
.streak.is-hot b { color: #d96c2b; }
.streak-hint { font-size: 11.5px; color: var(--ink-faint); font-weight: 500; margin-left: 4px; }

.badge-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}

.badge {
  font-size: 12px;
  font-family: var(--font-display);
  border-radius: 999px;
  padding: 3px 11px;
  cursor: default;
}
.badge.is-unlocked { background: var(--leaf-mist); color: var(--leaf-deep); border: 1px solid rgba(63, 139, 92, 0.3); }
.badge.is-locked { background: var(--paper); color: var(--ink-faint); border: 1px solid var(--line); filter: grayscale(1); opacity: 0.6; }

.bed-panel, .harvest-panel, .hold-panel { padding-bottom: 10px; }

.bed, .shelf-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 6px;
  align-items: flex-end;
}

.bed {
  background: linear-gradient(to top, #EBDFC4 34px, transparent 34px);
  border-radius: 10px;
  padding: 4px 8px 0;
}

.harvest-panel { background: linear-gradient(170deg, #fffdf6 0%, #fdf4ec 100%); }
.harvest-panel .shelf-row {
  background: linear-gradient(to top, #D9B98C 12px, #EAD8B8 12px, #EAD8B8 16px, transparent 16px);
  border-radius: 8px;
  padding: 4px 10px 6px;
}

.hold-panel .shelf-row {
  background: linear-gradient(to top, #E8EDF4 14px, transparent 14px);
  border-radius: 8px;
  padding: 4px 10px 2px;
}

.plant {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 104px;
  text-decoration: none;
  color: var(--ink);
  border-radius: 10px;
  padding: 6px 4px 8px;
  transition: transform 0.15s ease, background-color 0.15s ease;
  position: relative;
}

.plant:hover { transform: translateY(-4px); background: rgba(255, 255, 255, 0.75); }
.plant:hover .plant-plate { border-color: var(--leaf); color: var(--leaf-deep); }

.plant-svg {
  width: 74px;
  height: 90px;
  transform-origin: 50% 95%;
  transition: transform 0.2s ease;
}

.plant-plate {
  margin-top: 2px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px 7px;
  font-size: 11px;
  line-height: 1.45;
  text-align: center;
  max-width: 100px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.plant-dry {
  position: absolute;
  top: 4px;
  right: 2px;
  font-size: 10px;
  color: #3c6a97;
  background: #e3edf6;
  border-radius: 999px;
  padding: 1px 6px;
}

.gardener-card {
  background: linear-gradient(160deg, #1d2438 0%, #2a3350 100%);
  border-color: #39456b;
  color: #dfe6f3;
}

.gardener-card .section-title { color: #f2e9c8; }
.gardener-card .ai-hint { color: #b9c3d9; }
.gardener-last { font-size: 13px; color: #8fd0a8; margin: 0 0 12px; }

.gardener-card .ai-setup { color: #b9c3d9; margin-top: 16px; }
.gardener-card .ai-setup code,
.gardener-card .ai-setup pre {
  background: #141a2c;
  border: 1px solid #39456b;
  color: #cdd7ea;
  border-radius: 6px;
}
.gardener-card .ai-setup pre { padding: 10px 12px; overflow-x: auto; font-size: 12px; }
.gardener-card .ai-setup code { padding: 1px 6px; font-size: 12px; }
.gardener-card .ai-setup pre code { border: none; padding: 0; background: transparent; }

/* ---------------- 星座マップ(夜モード) ---------------- */

body.night {
  background: #131a2c;
  background-image: none;
  color: #dfe6f3;
}

body.night .site-header { background: #161e33; border-color: #26304d; }
body.night .logo { color: #eef2fb; }
body.night .logo-tagline { color: #8f9ab5; }
body.night .logo-mark { background: #232d4a; }
body.night .main-nav a { color: #9aa6c4; }
body.night .main-nav a:hover { color: #cdd7ea; background: #232d4a; }
body.night .main-nav a.is-active { background: #e9edf7; color: #131a2c; }
body.night .site-footer { border-color: #26304d; color: #6f7a99; }
body.night .site-footer a { color: #9aa6c4; }

.map-head { margin: 22px 0 12px; }
.map-head .page-title { color: #f2e9c8; }
.map-hint { font-size: 13.5px; color: #9aa6c4; margin: 6px 0 12px; }

.map-legend { display: flex; gap: 10px; flex-wrap: wrap; }

.legend-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: inherit;
}

.legend-chip i {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  display: inline-block;
}

.legend-edge .edge-swatch {
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: rgba(160, 180, 230, 0.6);
}

.map-wrap {
  margin: 4px 0 30px;
  border: 1px solid #26304d;
  border-radius: var(--radius);
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 0%, #1a2340 0%, #10162a 70%);
}

#map-canvas { display: block; width: 100%; cursor: grab; }

/* ---------------- マトリクス ---------------- */

.chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.chart-note { font-size: 12.5px; color: var(--ink-faint); margin: 4px 0 10px; }

.chart-legend {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 6px 0 10px;
  font-size: 12.5px;
  color: var(--ink-soft);
}

.chart-legend i { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.swatch-hold {
  width: 9px !important;
  height: 9px !important;
  background: transparent;
  border: 2px dashed #8B95A5;
}

.matrix-wrap { overflow-x: auto; }
.matrix-svg { width: 100%; max-width: 760px; height: auto; display: block; margin: 0 auto; }

.matrix-svg .grid-line { stroke: #eef1e6; stroke-width: 1; }
.matrix-svg .mid-line { stroke: #cfd6c4; stroke-width: 1.4; stroke-dasharray: 5 4; }
.matrix-svg .frame { stroke: #dde3d4; stroke-width: 1.2; }
.matrix-svg .tick { font-size: 10px; fill: var(--ink-faint); font-family: var(--font-body); }
.matrix-svg .axis-title { font-size: 13px; fill: var(--ink-soft); font-family: var(--font-display); font-weight: 700; }
.matrix-svg .quad-label { font-size: 12px; fill: #a9b09c; font-family: var(--font-display); font-weight: 700; }
.matrix-svg .dot { cursor: pointer; }
.matrix-svg .dot:hover circle:last-child { stroke-width: 3; }

.chart-tip {
  position: fixed;
  z-index: 120;
  max-width: 280px;
  background: var(--ink);
  color: #fff;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12.5px;
  line-height: 1.6;
  pointer-events: none;
  box-shadow: var(--shadow);
}
.chart-tip em { color: #cfe3d6; font-style: normal; }

/* ---------------- 交配 ---------------- */

.hybrid-row {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  margin: 14px 0;
}

.hybrid-parent { flex: 1 1 240px; display: flex; flex-direction: column; gap: 5px; }
.hybrid-parent label { font-size: 13px; font-weight: 700; font-family: var(--font-display); color: var(--ink-soft); }
.hybrid-parent select { width: 100%; }

.hybrid-x {
  font-size: 22px;
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--ink-faint);
  padding-bottom: 6px;
}

.hybrid-note { margin-top: 14px; font-size: 13.5px; }

/* ---------------- 拡張分のレスポンシブ ---------------- */

/* ---------------- 認証・MetAIra連携 ---------------- */

.header-right { display: flex; align-items: center; gap: 12px; }

.nav-user {
  font-size: 12.5px;
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--leaf-deep);
  background: var(--leaf-mist);
  border-radius: 999px;
  padding: 3px 12px;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.logout-link { font-size: 12px; color: var(--ink-faint); text-decoration: none; }
.logout-link:hover { color: var(--beni); }

.footer-metaira a { color: var(--ink-soft); }

.auth-card {
  max-width: 420px;
  margin: 48px auto;
  text-align: center;
  padding: 34px 30px;
}

.auth-mark {
  font-size: 40px;
  background: var(--leaf-mist);
  border-radius: 50%;
  width: 76px;
  height: 76px;
  display: grid;
  place-items: center;
  margin: 0 auto 14px;
}

.auth-title { margin: 0 0 10px; font-family: var(--font-display); font-size: 21px; }
.auth-lead { font-size: 13px; color: var(--ink-soft); margin: 0 0 20px; }
.auth-lead-sub { font-size: 11.5px; color: var(--ink-faint); }

.auth-form { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.auth-form input { text-align: center; }

.auth-switch { font-size: 12.5px; color: var(--ink-soft); margin: 0 0 4px; }

.auth-message { min-height: 20px; font-size: 13px; margin-top: 8px; }
.auth-message.err { color: var(--beni); }
.auth-message.ok { color: var(--leaf-deep); }

.eco-links {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 8px 2px 4px;
  font-size: 12.5px;
}

.eco-label { color: var(--ink-faint); font-family: var(--font-display); font-weight: 700; }

.eco-links a {
  color: var(--ink-soft);
  text-decoration: none;
  padding: 2px 8px;
  border-radius: 999px;
  transition: background-color 0.12s ease, color 0.12s ease;
}
.eco-links a:hover { background: var(--leaf-mist); color: var(--leaf-deep); }

.mirai-panel {
  margin: 10px 0 6px;
  background: linear-gradient(120deg, #fdf4ee 0%, #f3f1fa 55%, #edf5f2 100%);
  border: 1px solid #e3ddd0;
  border-radius: var(--radius);
  padding: 10px 16px 12px;
}

.mirai-head {
  font-size: 13px;
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 8px;
}

.mirai-chips { display: flex; gap: 6px; flex-wrap: wrap; }

.mirai-chip {
  border: 1.5px solid #d8cfe8;
  background: #fff;
  border-radius: 999px;
  padding: 5px 14px;
  font-size: 13px;
  font-family: var(--font-display);
  cursor: pointer;
  transition: border-color 0.12s ease, transform 0.12s ease;
}
.mirai-chip:hover { border-color: var(--leaf); transform: translateY(-1px); }

@media (max-width: 560px) {
  .header-cta { padding: 7px 13px; font-size: 13px; }
  .plant { width: 86px; }
  .plant-svg { width: 62px; height: 76px; }
  .plant-plate { max-width: 84px; font-size: 10px; }
  .hybrid-x { display: none; }
}

/* ============================================================
   モバイル最適化(2026-07-12)— スマホでの読みやすさ・操作性
   既存の 560px 層の後に置き、同点指定は後勝ちで上書きする。
   ============================================================ */
@media (max-width: 640px) {
  /* iOS: フォーム部品が 16px 未満だとフォーカス時に画面ごとズームされる対策 */
  input[type="text"], input[type="search"], input[type="password"],
  input[type="email"], select, textarea, .quick-sow input { font-size: 16px !important; }

  .container { padding: 0 14px; }

  /* sticky ヘッダーを薄くして本文の見える量を確保 */
  .header-inner { padding-top: 8px; padding-bottom: 6px; gap: 8px; }
  .logo-mark { width: 38px; height: 38px; font-size: 22px; }
  .logo-title { font-size: 17px; }
  .header-right { gap: 8px; }
  .nav-user { display: none; }               /* スマホではメールチップを畳む(幅の主犯) */
  .logout-link { white-space: nowrap; }
  .main-nav { padding-bottom: 5px; scrollbar-width: none; }
  .main-nav::-webkit-scrollbar { display: none; }
  .main-nav a { padding: 6px 12px; }

  /* タッチターゲット */
  .btn { padding: 10px 18px; }
  .btn-sm { padding: 8px 13px; }

  .toolbar { margin: 16px 0 12px; }
  .card-grid { gap: 10px; margin-bottom: 28px; }
  .panel { padding: 16px 14px; }
  .idea-meta { flex-wrap: wrap; gap: 8px 14px; }

  /* 詳細のアクション列: ステージ変更フォームを 1 行使いに */
  .idea-actions .stage-form { width: 100%; }
  .idea-actions .stage-form select { flex: 1; min-width: 0; }

  .timeline { padding-left: 14px; }
  .timeline-item { padding: 0 0 16px 11px; }
  .timeline-item::before { left: -21px; }

  .toast { max-width: 90vw; text-align: center; }
  .auth-card { margin: 22px auto; padding: 26px 18px; }
  .site-footer { line-height: 2; }
}

@media (max-width: 430px) {
  .quick-sow { padding: 8px 12px; gap: 8px; }
  .water-banner { padding: 10px 12px; }
  .stage-tabs { gap: 6px; }
  .stage-tab { padding: 5px 11px; font-size: 13px; }
  .idea-title { font-size: 19px; }
  .panel-title { font-size: 17px; }
  .form-actions .btn { flex: 1 1 auto; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
