/* ============================================================
   カメラ価格比較  スタイル
   配色は社内デザインシステム（rules/design-system.md）準拠
   ============================================================ */

:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --violet: #7c3aed;
  --success: #059669;
  --warning: #d97706;
  --error: #dc2626;
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --text: #0f172a;
  --text-sub: #475569;
  --border: #e2e8f0;
  --rakuten: #bf0000;
  --yahoo: #ff0033;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);
  --font: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP",
    system-ui, -apple-system, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.8;
  font-size: 16px;
}

.wrap {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ---------- ヘッダー ---------- */
.site-header {
  background: linear-gradient(135deg, var(--primary), var(--violet));
  color: #fff;
  padding: 32px 0 28px;
}
.site-title {
  margin: 0 0 8px;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.site-sub {
  margin: 0;
  font-size: 0.95rem;
  opacity: 0.95;
  line-height: 1.7;
}

/* ---------- ステータスバー ---------- */
.statusbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: 24px 0 16px;
}
.status-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.updated {
  font-size: 0.9rem;
  color: var(--text-sub);
}
.updated time {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--text);
}

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge-neutral {
  background: #e2e8f0;
  color: var(--text-sub);
}
.badge-live {
  background: #d1fae5;
  color: #047857;
}
.badge-mock {
  background: #fef3c7;
  color: #b45309;
}
.badge-mixed {
  background: #dbeafe;
  color: #1d4ed8;
}

/* ---------- ボタン ---------- */
.btn {
  border: none;
  border-radius: 10px;
  padding: 8px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s ease, opacity 0.15s ease;
}
.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  background: #f1f5f9;
}
.btn:disabled {
  opacity: 0.55;
  cursor: default;
}

/* ---------- 注記 / 通知 ---------- */
.notice {
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 0.9rem;
  margin: 12px 0;
}
.notice-info {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e40af;
}
.notice-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: var(--error);
}

.disclosures {
  margin: 20px 0;
}
.disclosure {
  margin: 6px 0;
  font-size: 0.85rem;
  color: var(--text-sub);
  line-height: 1.7;
}
.disclosure-strong {
  color: var(--text);
  font-weight: 600;
}

/* ---------- 商品セレクタ（機種タブ） ---------- */
.selector-block {
  margin: 8px 0 18px;
}
.selector-label {
  margin: 0 0 8px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-sub);
  letter-spacing: 0.02em;
}
.product-selector {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}
.product-tab {
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 12px 14px;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 3px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease,
    transform 0.05s ease;
}
.product-tab:hover {
  border-color: #cbd5e1;
}
.product-tab:active {
  transform: translateY(1px);
}
.product-tab.is-active {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary), var(--shadow);
  background: #f5f8ff;
}
.product-tab-name {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.4;
}
.product-tab-sub {
  font-size: 0.76rem;
  color: var(--text-sub);
  font-variant-numeric: tabular-nums;
}
.product-tab.is-active .product-tab-sub {
  color: var(--primary);
  font-weight: 600;
}

/* ---------- 選択中商品パネル ---------- */
.product-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 8px;
}
.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  padding-bottom: 16px;
  margin-bottom: 6px;
}
.panel-title {
  margin: 0 0 4px;
  font-size: 1.3rem;
  font-weight: 800;
  line-height: 1.35;
}
.panel-sub {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-sub);
  line-height: 1.6;
}
.panel-empty {
  color: var(--text-sub);
  font-size: 0.92rem;
  margin: 14px 0 0;
}

/* 統計チップ */
.stat-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.stat-chip {
  background: var(--surface-2);
  border-radius: 10px;
  padding: 7px 12px;
  display: flex;
  flex-direction: column;
  min-width: 84px;
}
.stat-chip-label {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-sub);
}
.stat-chip-value {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.stat-chip:first-child .stat-chip-value {
  color: var(--success);
}

/* ---------- オファー一覧 ---------- */
.offers {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
}
.offer-row {
  display: grid;
  grid-template-columns: 44px 1fr auto auto;
  align-items: center;
  gap: 12px;
  padding: 12px 6px;
  border-bottom: 1px solid var(--border);
}
.offer-row:last-child {
  border-bottom: none;
}
.offer-row.is-best {
  background: #f0fdf7;
  border-radius: 10px;
  border-bottom: 1px solid transparent;
  padding-left: 10px;
  padding-right: 10px;
}
.offer-rank {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-sub);
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.offer-best-badge {
  display: inline-block;
  background: var(--success);
  color: #fff;
  font-size: 0.66rem;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 999px;
  letter-spacing: 0.03em;
}
.offer-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.offer-shop {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  line-height: 1.4;
  word-break: break-word;
}
a.offer-shop:hover {
  color: var(--primary);
  text-decoration: underline;
}
.offer-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.tag {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
  white-space: nowrap;
}
.tag-rakuten {
  background: #fde8e8;
  color: var(--rakuten);
}
.tag-yahoo {
  background: #ffe6ea;
  color: var(--yahoo);
}
.tag-condition {
  background: #eef2ff;
  color: #4338ca;
}
.tag-unknown {
  background: #f1f5f9;
  color: var(--text-sub);
}

.offer-price {
  display: flex;
  align-items: baseline;
  gap: 2px;
  justify-self: end;
  white-space: nowrap;
}
.offer-price-yen {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary);
}
.offer-price-num {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.offer-row.is-best .offer-price-yen,
.offer-row.is-best .offer-price-num {
  color: var(--success);
}

.offer-cta {
  display: inline-block;
  text-align: center;
  background: var(--primary);
  color: #fff;
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.85rem;
  white-space: nowrap;
  transition: background 0.15s ease;
}
.offer-cta:hover {
  background: var(--primary-hover);
}

.per-price-note {
  font-size: 0.74rem;
  color: #94a3b8;
  line-height: 1.6;
  margin: 14px 0 0;
}

/* スケルトン（読み込み中） */
.skeleton {
  background: linear-gradient(90deg, #f1f5f9 25%, #e8edf3 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
  border-radius: var(--radius);
}
.skeleton-panel {
  min-height: 320px;
}
@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* ---------- フッター ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 24px 0 40px;
  margin-top: 24px;
}
.site-footer p {
  margin: 8px 0;
  font-size: 0.82rem;
  color: var(--text-sub);
  line-height: 1.8;
}
.footer-meta {
  color: #94a3b8;
  font-size: 0.78rem;
}

/* ---------- レスポンシブ ---------- */
@media (max-width: 600px) {
  .site-title {
    font-size: 1.4rem;
  }
  .product-selector {
    grid-template-columns: 1fr 1fr;
  }
  /* スマホでは順位列を詰めて、価格とCTAを2段に */
  .offer-row {
    grid-template-columns: 32px 1fr auto;
    row-gap: 8px;
  }
  .offer-rank {
    font-size: 0.85rem;
  }
  .offer-cta {
    grid-column: 2 / 4;
    justify-self: start;
  }
  .offer-price-num {
    font-size: 1.2rem;
  }
}

/* ---------- ダークモード ---------- */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f172a;
    --surface: #1e293b;
    --surface-2: #263449;
    --text: #f1f5f9;
    --text-sub: #94a3b8;
    --border: #334155;
  }
  .btn-secondary:hover {
    background: #334155;
  }
  .notice-info {
    background: #172554;
    border-color: #1e40af;
    color: #bfdbfe;
  }
  .badge-neutral {
    background: #334155;
    color: #cbd5e1;
  }
  .skeleton {
    background: linear-gradient(90deg, #1e293b 25%, #263449 50%, #1e293b 75%);
    background-size: 200% 100%;
  }
  .product-tab.is-active {
    background: #1c2f52;
  }
  .offer-row.is-best {
    background: rgba(5, 150, 105, 0.12);
  }
  .tag-rakuten {
    background: #3b1414;
    color: #fca5a5;
  }
  .tag-yahoo {
    background: #3b1418;
    color: #fca5a5;
  }
  .tag-condition {
    background: #1e1b4b;
    color: #c7d2fe;
  }
  .tag-unknown {
    background: #334155;
    color: #cbd5e1;
  }
}
