/* =============================================
   CSS カスタムプロパティ（テーマ）
   ============================================= */
/* 配色「畑」: 安い＝青みの深い緑（赤緑の色覚でも柿色と見分けやすいように）、高い＝柿色、いつも通り＝生成り。夜は同じ色相を明るくしたダーク版 */
:root {
  color-scheme: light;
  --clr-bg: #fbf9f3;
  --clr-surface: #fffdf8;
  --clr-border: #ddd8c8;
  --clr-line: #22301f;            /* 札の枠・強い罫線 */
  --clr-text: #22301f;
  --clr-text-muted: #5a6355;
  --clr-accent: #2f4a2a;
  --clr-head: #2f4a2a;            /* 上の帯 */
  --clr-head-text: #ffffff;
  --clr-head-sub: #c9d6c3;
  --clr-cream: #f3e3b5;           /* 地域ボタン・見方パネル */
  --clr-cream-text: #22301f;
  --clr-panel-mark: #2f4a2a;
  --clr-on: #2f4a2a;              /* 選択中のボタン */
  --clr-on-text: #ffffff;

  /* 札の5段階（背景 / 文字） */
  --tag-cheap: #24735f;          --tag-cheap-text: #ffffff;
  --tag-slightly-cheap: #d6ece6; --tag-slightly-cheap-text: #1f5c4c;
  --tag-normal: #efe8d6;         --tag-normal-text: #3b3a30;
  --tag-slightly-high: #fde6c4;  --tag-slightly-high-text: #9a4a17;
  --tag-high: #b9561a;           --tag-high-text: #ffffff;
  --tag-none: #ebe9e2;           --tag-none-text: #5a6355;

  /* 文字に使う判定の色（地の上で読める濃さ） */
  --clr-cheap: #1f6553;
  --clr-cheap-bg: #d6ece6;
  --clr-slightly-cheap: #24735f;
  --clr-slightly-cheap-bg: #e8f4f0;
  --clr-normal: #4f5148;
  --clr-normal-bg: #efe8d6;
  --clr-slightly-high: #9a4a17;
  --clr-slightly-high-bg: #fde6c4;
  --clr-high: #a84c14;
  --clr-high-bg: #fde6c4;
  --clr-none: #6b6f66;
  --clr-none-bg: #ebe9e2;

  /* 店頭の見通し: 下がる＝得（緑）、上がる＝損（柿） */
  --clr-outlook-down: #1f6553;
  --clr-outlook-down-bg: #d6ece6;
  --clr-outlook-up: #9a4a17;
  --clr-outlook-up-bg: #fde6c4;

  /* 例年比の数字の色（買う人にとっての得・損） */
  --clr-down: #1f6553;
  --clr-up: #a84c14;
  --clr-last-year: #9a9d92;

  /* 旧トレンド表示（いまは使っていないが残す） */
  --clr-rising: #a84c14;  --clr-rising-bg: #fbe3cf;
  --clr-falling: #1f6553; --clr-falling-bg: #d6ece6;
  --clr-flat: #4f5148;    --clr-flat-bg: #efe8d6;
  --clr-uncertain: #7b5e00; --clr-uncertain-bg: #fbf3d9;

  --clr-skeleton-a: #ece8dc;
  --clr-skeleton-b: #f6f3ea;
  --clr-overlay: rgba(20, 26, 18, 0.5);

  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 12px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.12);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.18);

  --tap-min: 44px;
  --font-base: "BIZ UDPGothic", -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
  --font-display: "M PLUS 1p", "BIZ UDPGothic", -apple-system, "Hiragino Kaku Gothic ProN", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --clr-bg: #151a14;
    --clr-surface: #1b2119;
    --clr-border: #343d31;
    --clr-line: #46523f;
    --clr-text: #eef0e6;
    --clr-text-muted: #a3ab9c;
    --clr-accent: #a6e3cf;
    --clr-head: #0e120d;
    --clr-head-text: #eef0e6;
    --clr-head-sub: #9aa596;
    --clr-cream: #e6cf8a;
    --clr-cream-text: #151a14;
    --clr-panel-mark: #151a14;
    --clr-on: #e6cf8a;
    --clr-on-text: #151a14;

    --tag-cheap: #6fd0b4;          --tag-cheap-text: #151a14;
    --tag-slightly-cheap: #1d3530; --tag-slightly-cheap-text: #a6e3cf;
    --tag-normal: #23271f;         --tag-normal-text: #d9d7c8;
    --tag-slightly-high: #3d2f17;  --tag-slightly-high-text: #f3b47f;
    --tag-high: #f08a3e;           --tag-high-text: #151a14;
    --tag-none: #23271f;           --tag-none-text: #a3ab9c;

    --clr-cheap: #8adcc0;           --clr-cheap-bg: #1d3530;
    --clr-slightly-cheap: #a6e3cf;  --clr-slightly-cheap-bg: #1a2d29;
    --clr-normal: #d9d7c8;          --clr-normal-bg: #23271f;
    --clr-slightly-high: #f3b47f;   --clr-slightly-high-bg: #3d2f17;
    --clr-high: #f6a066;            --clr-high-bg: #3d2f17;
    --clr-none: #a3ab9c;            --clr-none-bg: #23271f;
    --clr-outlook-down: #8adcc0;    --clr-outlook-down-bg: #1d3530;
    --clr-outlook-up: #f3b47f;      --clr-outlook-up-bg: #3d2f17;
    --clr-down: #8adcc0;
    --clr-up: #f6a066;
    --clr-last-year: #7d8577;
    --clr-skeleton-a: #20261e;
    --clr-skeleton-b: #2a3127;
    --clr-overlay: rgba(0, 0, 0, 0.6);
  }
}

/* =============================================
   リセット・ベース
   ============================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 18px; -webkit-text-size-adjust: 100%; }  /* 読みやすさのため大きめ（以前は 16px）。いちばん小さい文字も 0.9rem = 16.2px 以上にする */

body {
  font-family: var(--font-base);
  background: var(--clr-bg);
  color: var(--clr-text);
  min-height: 100vh;
  max-width: 600px;
  margin: 0 auto;
}

button { cursor: pointer; border: none; background: none; font-family: inherit; }
input  { font-family: inherit; }
ul     { list-style: none; }

/* =============================================
   ヘッダー
   ============================================= */
.app-header {
  background: var(--clr-head);
  color: var(--clr-head-text);
  padding: 14px 16px 10px;
}

.header-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.app-title {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.region-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: var(--radius-lg);
  background: var(--clr-bg);
  border: 1px solid var(--clr-border);
  font-size: 0.9rem;
  font-weight: 600;
  min-height: var(--tap-min);
  color: var(--clr-text);
  transition: background 0.15s;
}
.region-btn:hover { background: var(--clr-border); }

.header-sub {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.last-updated { font-size: 0.9rem; color: var(--clr-head-sub); }

.badge {
  display: inline-block;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
}
.badge--mock    { background: #fff3cd; color: #7b5e00; }
.badge--live    { background: #d4edda; color: #155724; }
.badge--loading { background: #e8e8e8; color: #888; }
.badge--error   { background: #f8d7da; color: #721c24; }

/* =============================================
   検索バー（sticky）
   ============================================= */
.search-bar-wrap {
  position: sticky;            /* 上の帯は流して、検索欄だけ画面の上に残す（帯の高さに左右されずめり込まない） */
  top: 0;
  z-index: 9;
  background: var(--clr-bg);
  padding: 8px 12px;
  border-bottom: 1px solid var(--clr-border);
}

.search-bar {
  display: flex;
  align-items: center;
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-lg);
  padding: 8px 12px;
  gap: 8px;
}

.search-icon { flex-shrink: 0; color: var(--clr-text-muted); }

.search-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 0.95rem;
  background: transparent;
  color: var(--clr-text);
  min-height: 28px;
}
.search-input::placeholder { color: var(--clr-text-muted); }

.search-clear {
  padding: 4px;
  font-size: 0.9rem;
  color: var(--clr-text-muted);
  min-width: var(--tap-min);
  min-height: var(--tap-min);
}

/* =============================================
   タブナビ
   ============================================= */
.tab-nav {
  background: var(--clr-surface);
  border-bottom: 1px solid var(--clr-border);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.tab-nav::-webkit-scrollbar { display: none; }

.tab-scroll {
  display: flex;
  padding: 0 8px;
  gap: 2px;
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--clr-text-muted);
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  min-height: var(--tap-min);
  transition: color 0.15s, border-color 0.15s;
}
.tab-btn--active {
  color: var(--clr-accent);
  border-bottom-color: var(--clr-accent);
  font-weight: 700;
}

.tab-count {
  background: var(--clr-bg);
  border-radius: 999px;
  padding: 1px 6px;
  font-size: 0.9rem;
  font-weight: 700;
}
.tab-btn--active .tab-count { background: var(--clr-cheap-bg); }

/* =============================================
   並び替えチップ
   ============================================= */
.sort-chips {
  display: flex;
  gap: 6px;
  padding: 10px 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.sort-chips::-webkit-scrollbar { display: none; }

.chip {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
  min-height: var(--tap-min);
  color: var(--clr-text);
  transition: background 0.15s, border-color 0.15s;
}
.chip--active {
  background: var(--clr-on);
  color: var(--clr-on-text);
  border-color: var(--clr-on);
}

/* =============================================
   品目一覧
   ============================================= */
.item-list {
  padding: 4px 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* スケルトン */
.skeleton-wrap { display: flex; flex-direction: column; gap: 8px; padding: 8px 0; }
.skeleton-card {
  height: 80px;
  border-radius: var(--radius-md);
  background: linear-gradient(90deg, var(--clr-skeleton-a) 25%, var(--clr-skeleton-b) 50%, var(--clr-skeleton-a) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* 空状態 */
.empty-state { text-align: center; padding: 48px 24px; }
.empty-main { font-size: 1rem; font-weight: 600; margin-bottom: 8px; }
.empty-hint { font-size: 0.9rem; color: var(--clr-text-muted); }

/* 品目カード */
.item-card {
  display: flex;
  align-items: center;
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  gap: 12px;
  cursor: pointer;
  transition: box-shadow 0.15s, transform 0.1s;
  min-height: var(--tap-min);
  text-align: left;
  width: 100%;
}
.item-card:hover  { box-shadow: var(--shadow-sm); }
.item-card:active { transform: scale(0.99); }

/* 左：品目名 */
.card-left { flex: 1; min-width: 0; }

.card-name {
  font-size: 1.05rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-name-badge {
  display: inline-block;
  font-size: 0.9rem;
  font-weight: 700;
  background: var(--clr-cream);
  color: var(--clr-cream-text);
  padding: 1px 5px;
  border-radius: 4px;
  margin-right: 4px;
  vertical-align: middle;
}

.card-explanation {
  font-size: 0.9rem;
  color: var(--clr-text-muted);
  margin-top: 3px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
}

/* 中：スパークライン */
.card-spark { flex-shrink: 0; }

/* 右：トレンド情報 */
.card-right {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  min-width: 80px;
}

.trend-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
}
.trend-label--rising    { color: var(--clr-rising);   background: var(--clr-rising-bg); }
.trend-label--falling   { color: var(--clr-falling);  background: var(--clr-falling-bg); }
.trend-label--flat      { color: var(--clr-flat);     background: var(--clr-flat-bg); }
.trend-label--uncertain { color: var(--clr-uncertain);background: var(--clr-uncertain-bg); }

.trend-arrow { font-size: 1rem; line-height: 1; }

.confidence-text {
  font-size: 0.9rem;
  color: var(--clr-text-muted);
  white-space: nowrap;
}

/* =============================================
   注意書きバー
   ============================================= */
.caveats-bar {
  background: var(--clr-bg);
  border-top: 1px solid var(--clr-border);
  padding: 10px 16px;
  font-size: 0.9rem;
  color: var(--clr-text-muted);
  line-height: 1.5;
}

/* =============================================
   モーダル（詳細・地域変更共通）
   ============================================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--clr-overlay);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}
.modal-overlay[hidden] { display: none; }

@media (min-width: 480px) {
  .modal-overlay { align-items: center; padding: 24px; }
}

.modal-sheet {
  background: var(--clr-surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.22s ease-out;
}
@media (min-width: 480px) {
  .modal-sheet { border-radius: var(--radius-lg); max-height: 80vh; }
}
@keyframes slideUp { from { transform: translateY(30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--clr-border);
  position: sticky;
  top: 0;
  background: var(--clr-surface);
  z-index: 1;
}

.modal-title { font-size: 1.1rem; font-weight: 700; }

.modal-close {
  font-size: 1rem;
  color: var(--clr-text-muted);
  min-width: var(--tap-min);
  min-height: var(--tap-min);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.15s;
}
.modal-close:hover { background: var(--clr-bg); }

.modal-body { padding: 16px 20px 24px; }

/* 詳細モーダル内パーツ */
.detail-trend {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.detail-trend .trend-label { font-size: 1rem; padding: 5px 12px; }

.detail-confidence {
  font-size: 0.9rem;
  color: var(--clr-text-muted);
}

.detail-wholesale {
  background: var(--clr-bg);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: 0.9rem;
  color: var(--clr-text-muted);
}
.detail-wholesale strong { color: var(--clr-text); font-size: 1.1rem; }

.detail-section-title {
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--clr-text-muted);
  margin-bottom: 8px;
  margin-top: 16px;
}

.detail-chart-wrap {
  background: var(--clr-bg);
  border-radius: var(--radius-sm);
  padding: 8px;
  overflow-x: auto;
}

.detail-explanation {
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--clr-text);
  margin-bottom: 8px;
}

.detail-signals {
  font-size: 0.9rem;
  color: var(--clr-text-muted);
  background: var(--clr-bg);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  line-height: 1.8;
}

/* 見方: 枠や色を付けず、ほかの欄と同じ見出しの下の地の文として置く */
.detail-caveats {
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--clr-border);
  font-size: 0.9rem;
  line-height: 1.75;
  color: var(--clr-text-muted);
}
.detail-caveats p { margin: 0 0 6px; }

.forecast-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--clr-border);
  font-size: 0.9rem;
}
.forecast-row:last-child { border-bottom: none; }
.forecast-horizon { color: var(--clr-text-muted); }

/* 地域リスト */
.region-search-wrap { padding: 12px 16px; }
.region-list { padding: 0 8px 16px; }
.region-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  min-height: var(--tap-min);
  font-size: 0.95rem;
  transition: background 0.12s;
}
.region-item:hover { background: var(--clr-bg); }
.region-item--active { font-weight: 700; color: var(--clr-accent); }
.region-item--hidden { display: none; }

/* チェックマーク */
.region-check { color: var(--clr-accent); font-size: 1rem; }

/* =============================================
   SVG チャート
   ============================================= */
.sparkline { display: block; }
.chart-line { fill: none; stroke-linejoin: round; stroke-linecap: round; }

/* =============================================
   ユーティリティ
   ============================================= */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* =============================================
   レスポンシブ（PC）
   ============================================= */
@media (min-width: 600px) {
  body { border-left: 1px solid var(--clr-border); border-right: 1px solid var(--clr-border); }
  .app-title { font-size: 1.35rem; }
}

/* =============================================
   水準判定（買い時）
   ============================================= */
.level-label {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 0.9rem; font-weight: 700; padding: 3px 10px;
  border-radius: 999px; white-space: nowrap;
}
.level-mark { font-size: 0.9rem; }
.level-label--cheap          { color: var(--clr-cheap);          background: var(--clr-cheap-bg); }
.level-label--slightly-cheap { color: var(--clr-slightly-cheap); background: var(--clr-slightly-cheap-bg); }
.level-label--normal         { color: var(--clr-normal);         background: var(--clr-normal-bg); }
.level-label--slightly-high  { color: var(--clr-slightly-high);  background: var(--clr-slightly-high-bg); }
.level-label--high           { color: var(--clr-high);           background: var(--clr-high-bg); }
.level-label--none           { color: var(--clr-none);           background: var(--clr-none-bg); }
.item-card--none { opacity: .75; }
.detail-trend .level-label { font-size: 1.05rem; padding: 6px 14px; }

.detail-compare {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  margin: 12px 0; padding: 12px; border-radius: var(--radius-md);
  background: var(--clr-bg);
}
.detail-compare > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.detail-compare-label { font-size: 0.9rem; color: var(--clr-text-muted); }
.detail-compare strong { font-size: 1rem; }

.compare-chart .chart-line { fill: none; stroke-linejoin: round; stroke-linecap: round; }
.chart-line--this-year { stroke: var(--clr-accent); stroke-width: 2.2; }
.chart-line--last-year { stroke: var(--clr-last-year); stroke-width: 1.6; stroke-dasharray: 4 3; }
.chart-line--this-year-dot { fill: var(--clr-accent); }
.chart-line--last-year-dot { fill: var(--clr-last-year); }
.chart-axis { font-size: 14px; fill: var(--clr-text-muted); }
.chart-empty { color: var(--clr-text-muted); font-size: 0.9rem; padding: 16px 0; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 0.9rem; color: var(--clr-text-muted); margin-top: 4px; }
.legend-item { display: inline-flex; align-items: center; gap: 4px; }
.legend-swatch { display: inline-block; width: 16px; height: 0; border-top: 2px solid; }
.legend-swatch--this-year { border-color: var(--clr-accent); }
.legend-swatch--last-year { border-color: var(--clr-last-year); border-top-style: dashed; }
.legend-unit { margin-left: auto; }

.substitute-list { display: flex; flex-direction: column; gap: 4px; font-size: 0.9rem; padding: 4px 0 8px; }
.substitute-list li::before { content: "・"; }
.detail-market { font-size: 0.9rem; color: var(--clr-text-muted); }
.modal-loading { padding: 20px; text-align: center; color: var(--clr-text-muted); }
.modal-error { padding: 20px; color: var(--clr-high); }
.attribution { margin-top: 4px; font-size: 0.9rem; color: var(--clr-text-muted); }

/* 来週の店頭の見通し */
.outlook-chip {
  display: inline-flex; align-items: center; gap: 4px;
  margin-top: 4px; padding: 2px 8px; border-radius: 999px;
  font-size: 0.9rem; font-weight: 600; line-height: 1.5; white-space: nowrap;
}
.outlook--down { color: var(--clr-outlook-down); background: var(--clr-outlook-down-bg); }
.outlook--up   { color: var(--clr-outlook-up);   background: var(--clr-outlook-up-bg); }
.detail-outlook { margin-bottom: 8px; }
.detail-outlook .detail-explanation { margin-top: 4px; }

/* 判定の文字色（詳細の表の中など） */
.level-text--cheap { color: var(--clr-cheap); }
.level-text--slightly-cheap { color: var(--clr-slightly-cheap); }
.level-text--normal { color: var(--clr-normal); }
.level-text--slightly-high { color: var(--clr-slightly-high); }
.level-text--high { color: var(--clr-high); }
.level-text--none { color: var(--clr-none); }


/* 地域の選択（ネイティブのプルダウン。見た目は以前のボタンに合わせる） */
.region-select {
  -webkit-appearance: none; appearance: none;
  padding: 6px 30px 6px 12px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--clr-border);
  background-color: var(--clr-bg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' stroke='%236b6b6b' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  color: var(--clr-text);
  font: inherit; font-size: 0.9rem; font-weight: 600;
  cursor: pointer;
}
.region-select:hover { background-color: var(--clr-border); }
.region-select:focus-visible { outline: 2px solid var(--clr-accent); outline-offset: 2px; }

/* スマホの幅: 文字を大きくした分、カードの小さな折れ線を隠して説明を 2 行まで見せる（推移は詳細のグラフで見られる） */
@media (max-width: 480px) {
  .card-spark { display: none; }
  .card-explanation { -webkit-line-clamp: 2; }
}

/* 一覧の数字の行: 「卸値 +26%　店頭 +131%」（どちらも例年比） */
.card-facts { display: flex; flex-wrap: wrap; gap: 2px 14px; margin-top: 4px; font-size: 0.95rem; font-variant-numeric: tabular-nums; }
.fact { white-space: nowrap; font-weight: 600; }
.fact-label { color: var(--clr-text-muted); font-weight: 400; margin-right: 4px; }

.fact--down { color: var(--clr-down); }
.fact--up   { color: var(--clr-up); }
.off-season-note { margin: 0 16px 80px; font-size: 0.9rem; line-height: 1.6; color: var(--clr-text-muted); }

.season-cal { display: grid; grid-template-columns: max-content 1fr; gap: 4px 6px; align-items: center; }
.season-row { display: contents; }
.season-row-label { font-size: 0.9rem; font-weight: 700; color: var(--clr-text-muted); }
.season-strip { display: grid; grid-template-columns: repeat(12, 1fr); gap: 2px; }
.season-cell {
  text-align: center; padding: 5px 0; border-radius: 6px; font-size: 0.9rem; font-variant-numeric: tabular-nums;
  background: var(--clr-bg); color: var(--clr-text-muted); border: 2px solid transparent;
}
.season-cell--shun { background: var(--clr-outlook-down-bg); color: var(--clr-outlook-down); font-weight: 700; }
.season-cell--nego { background: var(--clr-cheap-bg); color: var(--clr-down); font-weight: 700; }
.season-cell--none { opacity: .45; }
.season-cell--now { border-color: var(--clr-text); }

/* 推移グラフの期間の切り替え */
.detail-section-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.range-toggle { display: inline-flex; border: 1px solid var(--clr-border); border-radius: 999px; overflow: hidden; }
.range-btn { padding: 4px 12px; font: inherit; font-size: 0.9rem; background: var(--clr-surface); color: var(--clr-text-muted);
  border: none; cursor: pointer; }
.range-btn--active { background: var(--clr-text); color: var(--clr-surface); font-weight: 700; }
.range-btn:focus-visible { outline: 2px solid var(--clr-accent); outline-offset: -2px; }

.season-cal { margin: 8px 0 4px; }
.season-column { margin: 8px 0; padding: 10px 12px; border-radius: var(--radius-md); background: var(--clr-bg);
  font-size: 0.9rem; line-height: 1.6; }
.season-column strong { display: block; margin-bottom: 2px; color: var(--clr-accent); }
.season-sources { margin: 4px 0 8px; font-size: 0.9rem; color: var(--clr-text-muted); overflow-wrap: anywhere; }
.season-sources a { color: inherit; }

/* 地域くらべ */
.cmp-list { list-style: none; margin: 8px 0 4px; padding: 0; display: flex; flex-direction: column; }
.cmp-row { display: grid; grid-template-columns: 1fr auto 4.5em; align-items: center; gap: 8px;
  padding: 7px 8px; border-bottom: 1px solid var(--clr-border); font-variant-numeric: tabular-nums; }
.cmp-row:last-child { border-bottom: none; }
.cmp-row--me { background: var(--clr-bg); border-radius: 8px; font-weight: 700; }
.cmp-region { min-width: 0; }
.cmp-me { margin-left: 6px; padding: 0 6px; border-radius: 999px; font-size: 0.9rem; font-weight: 600;
  color: var(--clr-accent); border: 1px solid var(--clr-accent); white-space: nowrap; }
.cmp-label { font-size: 0.9rem; font-weight: 700; white-space: nowrap; }
.cmp-ratio { text-align: right; font-weight: 700; }

/* =============================================
   値札のデザイン（形は「値札」、配色は「畑」）
   ============================================= */
/* 地域の選択: 上の帯の上に生成り色のボタン */
.region-select {
  border: none;
  border-radius: var(--radius-md);
  background-color: var(--clr-cream);
  color: var(--clr-cream-text);
  font-size: 1rem; font-weight: 700;
  padding: 8px 32px 8px 14px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' stroke='%2322301f' stroke-width='1.8' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
}
.region-select:hover { background-color: var(--clr-cream); filter: brightness(0.96); }
.region-select:focus-visible { outline: 2px solid var(--clr-head-text); }

/* 一覧のカード: 枠で囲んだ札。右に判定の色の札 */
.item-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 9.2rem;
  align-items: stretch;
  gap: 0;
  padding: 0;
  background: var(--clr-surface);
  border: 1.5px solid var(--clr-line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  color: var(--clr-text);
}
.item-card:hover { box-shadow: var(--shadow-sm); }
.item-card--none { opacity: 1; }
.item-card .card-left { padding: 12px 12px 12px 14px; display: flex; flex-direction: column; justify-content: center; gap: 4px; }
.card-name { font-family: var(--font-display); font-weight: 800; font-size: 1.3rem; line-height: 1.3; }
.card-facts { margin-top: 0; gap: 2px 12px; font-size: 0.95rem; }
.fact--plain { color: var(--clr-text-muted); font-weight: 400; }
.item-card .outlook-chip { align-self: flex-start; margin-top: 2px; }

.price-tag {
  display: flex; flex-direction: column; align-items: flex-end; justify-content: center; gap: 3px;
  padding: 10px 12px 10px 24px;
  clip-path: polygon(14px 0, 100% 0, 100% 100%, 14px 100%, 0 50%);
  font-variant-numeric: tabular-nums;
}
.price-tag-label { font-size: 0.9rem; font-weight: 700; line-height: 1.2; text-align: right; }
.price-tag-num { font-family: var(--font-display); font-weight: 800; font-size: 1.85rem; line-height: 1; white-space: nowrap; }
.price-tag--cheap          { background: var(--tag-cheap);          color: var(--tag-cheap-text); }
.price-tag--slightly-cheap { background: var(--tag-slightly-cheap); color: var(--tag-slightly-cheap-text); }
.price-tag--normal         { background: var(--tag-normal);         color: var(--tag-normal-text); }
.price-tag--slightly-high  { background: var(--tag-slightly-high);  color: var(--tag-slightly-high-text); }
.price-tag--high           { background: var(--tag-high);           color: var(--tag-high-text); }
.price-tag--none           { background: var(--tag-none);           color: var(--tag-none-text); }
.price-tag--none .price-tag-num { font-size: 1.3rem; }

/* 詳細の頭: 同じ札を大きめに */
.detail-trend { align-items: center; gap: 12px; }
.price-tag--detail { min-width: 11rem; min-height: 4.6rem; border-radius: var(--radius-sm); padding-left: 28px; }
.price-tag--detail .price-tag-label { font-size: 1rem; }
.price-tag--detail .price-tag-num { font-size: 2.2rem; }
.detail-trend-note { font-size: 0.9rem; color: var(--clr-text-muted); }
.modal-title { font-family: var(--font-display); font-weight: 800; font-size: 1.35rem; }
.detail-section-title { color: var(--clr-text); letter-spacing: 0.02em; font-size: 0.95rem; }

/* この札の見方: 生成り色のパネルに番号付きの説明 */
.howto {
  margin-top: 24px;
  padding: 16px 16px 18px;
  border-radius: var(--radius-sm);
  background: var(--clr-cream);
  color: var(--clr-cream-text);
}
.howto-title { font-family: var(--font-display); font-weight: 800; font-size: 1.15rem; margin-bottom: 10px; }
.howto-list { list-style: none; counter-reset: howto; display: flex; flex-direction: column; gap: 10px; }
.howto-list li {
  counter-increment: howto;
  display: grid; grid-template-columns: 1.7rem minmax(0, 1fr); gap: 10px; align-items: start;
  font-size: 0.95rem; line-height: 1.7;
}
.howto-list li::before {
  content: counter(howto);
  width: 1.6rem; height: 1.6rem; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--clr-panel-mark); color: var(--clr-cream);
  font-weight: 800; font-size: 0.9rem; line-height: 1;
  margin-top: 0.1rem;
}
.list-note { margin: 0 16px 12px; font-size: 0.9rem; color: var(--clr-text-muted); }

/* 並び替え・タブも同じ深緑を基調に */
.tab-btn--active { color: var(--clr-accent); border-bottom-color: var(--clr-accent); }
.chip { border-color: var(--clr-line); border-radius: var(--radius-sm); }
.range-btn--active { background: var(--clr-on); color: var(--clr-on-text); }
.season-cell--now { border-color: var(--clr-line); }

/* このアプリについて（about.html） */
.about-back { color: var(--clr-head-text); font-size: 0.95rem; font-weight: 700; text-underline-offset: 3px; white-space: nowrap; }
.about { padding: 8px 16px 32px; line-height: 1.8; }
.about-toc { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 4px; }
.about-toc a { padding: 4px 12px; border: 1.5px solid var(--clr-line); border-radius: var(--radius-sm);
  color: var(--clr-text); text-decoration: none; font-size: 0.9rem; font-weight: 700; }
.about section { padding-top: 20px; scroll-margin-top: 8px; }
.about h2 { font-family: var(--font-display); font-weight: 800; font-size: 1.25rem; margin-bottom: 8px;
  padding-bottom: 6px; border-bottom: 1.5px solid var(--clr-line); }
.about p { margin: 0 0 10px; font-size: 1rem; }
.about-list { list-style: disc; padding-left: 1.3em; margin: 0 0 10px; display: flex; flex-direction: column; gap: 8px; }
.about-steps { list-style: none; counter-reset: step; margin: 0 0 12px; display: flex; flex-direction: column; gap: 10px; }
.about-steps li { counter-increment: step; display: grid; grid-template-columns: 1.7rem minmax(0, 1fr); gap: 10px; }
.about-steps li::before { content: counter(step); width: 1.6rem; height: 1.6rem; border-radius: 50%; margin-top: 0.15rem;
  display: flex; align-items: center; justify-content: center; background: var(--clr-head); color: var(--clr-head-text);
  font-weight: 800; font-size: 0.9rem; }
.about-link { margin: 6px 0; font-weight: 700; }
.about-link a, .caveats-bar a { color: var(--clr-text); text-underline-offset: 3px; }
.about-lead { font-weight: 700; }
