:root {
  /* --- palette (light) --- */
  --bg: #fdf6f0;
  --surface: #ffffff;
  --surface-alt: #fbeee4;
  --border: #f0e0d8;
  --text: #3a2e2e;
  --text-muted: #6e5e5e;
  --primary: #e07a92;
  --primary-dark: #c25c75;
  --primary-soft: #fce4ea;
  --primary-strong: #b34c69;      /* 白文字でコントラストAA(4.5+)を満たす濃いローズ。塗りボタン/フォーカス縁用 */
  --primary-strong-hover: #9c4159;
  --accent: #8bc4a7;
  --warn: #d97b4a;

  /* --- radius scale --- */
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-pill: 999px;

  /* --- shadow hierarchy --- */
  --shadow-sm: 0 1px 2px rgba(60, 40, 45, 0.06), 0 1px 1px rgba(60, 40, 45, 0.04);
  --shadow-md: 0 2px 4px rgba(60, 40, 45, 0.06), 0 4px 12px rgba(60, 40, 45, 0.05);
  --shadow-lg: 0 8px 24px rgba(60, 40, 45, 0.10), 0 2px 6px rgba(60, 40, 45, 0.06);
  --shadow: var(--shadow-sm); /* legacy alias */

  /* --- type scale (1.20 minor third) --- */
  --fs-xs: 0.75rem;
  --fs-sm: 0.8125rem;
  --fs-base: 0.9375rem;
  --fs-md: 1rem;
  --fs-lg: 1.125rem;
  --fs-xl: 1.375rem;
  --fs-2xl: 1.75rem;
  --fs-3xl: 2.25rem;
  --lh-tight: 1.3;
  --lh-snug: 1.5;
  --lh-base: 1.75;
  --ls-heading: -0.01em;
  --ls-body: 0.01em;

  /* --- spacing scale (4px base) --- */
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.5rem;
  --sp-6: 2rem;
  --sp-8: 3rem;
  --section-gap: var(--sp-8);

  /* --- motion --- */
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --dur-fast: 0.12s;
  --dur: 0.2s;
  --dur-slow: 0.32s;

  /* --- focus (縁は地とのコントラスト3:1以上を満たす濃色) --- */
  --focus-ring: 0 0 0 3px var(--primary-soft), 0 0 0 2px var(--primary-strong);
}

html[data-theme="dark"] {
  --bg: #1a1517;
  --surface: #252023;
  --surface-alt: #332a2e;
  --border: #4a3e42;
  --text: #f0e8e8;
  --text-muted: #b8a8a8;
  --primary: #f4a3b8;
  --primary-dark: #e07a92;
  --primary-soft: #3d2832;
  /* --primary-strong は :root(#b34c69) を継承。白文字でAA(5.0+)を満たすため両モード共通 */
  --accent: #8bc4a7;
  --warn: #e8a17a;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 10px 28px rgba(0, 0, 0, 0.55);
  --shadow: var(--shadow-sm);
}

html[data-theme="dark"] .food-card.level-bad { background: #2e1f1f; }
html[data-theme="dark"] .notice.info { background: #1f3550; color: #a8c6e8; }
html[data-theme="dark"] .notice.warn { background: #3d2820; color: #f0c8a0; }
html[data-theme="dark"] .notice.error { background: #3d2020; color: #f0a0a0; }
html[data-theme="dark"] .notice.success { background: #1f3527; color: #a0e0b8; }
html[data-theme="dark"] .food-note { background: #3d2f1a; color: #f0d090; }
html[data-theme="dark"] .btn-amazon { background: #ff9900; }
html[data-theme="dark"] .btn-rakuten { background: #d11a1a; }
html[data-theme="dark"] img:not(.no-darken) { filter: brightness(0.95); }

* { box-sizing: border-box; }

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

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

body {
  font-size: var(--fs-base);
  line-height: var(--lh-base);
  letter-spacing: var(--ls-body);
  font-feature-settings: "palt" 1;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

/* 見出し: 行間を締め、日本語の字間をわずかに詰める */
h1, h2, h3, h4, .page-title, .hero h1, .cat-heading, .brand {
  line-height: var(--lh-tight);
  letter-spacing: var(--ls-heading);
}

a { color: var(--primary-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

/* キーボード操作時のみ出る明確なフォーカスリング */
:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--radius-sm);
}

/* モーション控えめ設定の尊重 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

.app-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: none;
  transition: box-shadow var(--dur) var(--ease);
}
.app-header.scrolled { box-shadow: var(--shadow-md); }

.header-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.theme-toggle, .hamburger {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  font-size: 1.05rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  color: var(--text);
  flex: 0 0 auto;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.theme-toggle:hover, .hamburger:hover { background: var(--surface-alt); border-color: var(--primary-soft); }
.theme-toggle:active, .hamburger:active { transform: scale(0.94); }

.hamburger { display: none; }

@media (max-width: 820px) {
  .hamburger { display: inline-flex; }
  nav.tabs {
    display: none !important;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    align-items: stretch;
    padding: 0.5rem;
    gap: 0.25rem;
    box-shadow: 0 8px 16px rgba(0,0,0,0.08);
  }
  nav.tabs.open { display: flex !important; }
  nav.tabs a { text-align: center; padding: 0.7rem; }
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--text);
}

.brand-icon {
  width: 32px; height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
}
.brand-icon svg { width: 27px; height: 27px; display: block; }

nav.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  flex: 1;
  min-width: 0;
}

nav.tabs a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius-pill);
  color: var(--text-muted);
  font-size: var(--fs-base);
  font-weight: 600;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
nav.tabs a:hover { background: var(--surface-alt); text-decoration: none; }
nav.tabs a.active {
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.auth-area {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

main {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem 1rem 4rem;
}

.page-title {
  font-size: var(--fs-2xl);
  margin: 0 0 var(--sp-1);
}
.page-lead {
  color: var(--text-muted);
  margin: 0 0 var(--sp-5);
  max-width: 40em;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
}

.hero {
  background:
    radial-gradient(120% 130% at 0% 0%, var(--primary-soft) 0%, transparent 55%),
    radial-gradient(120% 130% at 100% 100%, #f7ecd6 0%, transparent 60%),
    linear-gradient(135deg, #fbe7e0, #f7ecd6);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-6) var(--sp-5);
  margin-bottom: var(--sp-5);
}
.hero h1 { margin: 0 0 var(--sp-2); font-size: clamp(1.75rem, 5vw, var(--fs-3xl)); }
.hero p { margin: 0; color: var(--text-muted); max-width: 36em; }
html[data-theme="dark"] .hero {
  background:
    radial-gradient(120% 130% at 0% 0%, var(--primary-soft) 0%, transparent 55%),
    linear-gradient(135deg, #2e2228, #242023);
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}
.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: var(--sp-5);
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.feature-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  text-decoration: none;
}
.feature-card .emoji { font-size: 2rem; }
.feature-card h3 { margin: 0; font-size: 1.1rem; }
.feature-card p { margin: 0; color: var(--text-muted); font-size: 0.9rem; }

button, .btn {
  font-family: inherit;
  font-size: var(--fs-base);
  font-weight: 600;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), transform var(--dur-fast) var(--ease);
}
button:hover, .btn:hover { background: var(--surface-alt); }
button:active, .btn:active { transform: translateY(1px); }
button.primary, .btn.primary {
  background: var(--primary-strong);
  border-color: var(--primary-strong);
  color: white;
  box-shadow: var(--shadow-sm);
}
button.primary:hover, .btn.primary:hover { background: var(--primary-strong-hover); border-color: var(--primary-strong-hover); }
button.ghost, .btn.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-muted);
}
button.ghost:hover, .btn.ghost:hover { background: var(--surface-alt); color: var(--text); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

input[type=text], input[type=email], input[type=password], input[type=url], input[type=tel],
select, textarea {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.95rem;
  background: var(--surface);
  color: var(--text);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--primary-soft);
  border-color: var(--primary);
}
textarea { min-height: 80px; resize: vertical; }

.form-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 1rem;
}
.form-row label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}
.form-row .hint {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
@media (max-width: 600px) {
  .form-grid { grid-template-columns: 1fr; }
}

.search-bar {
  display: grid;
  grid-template-columns: 200px 1fr auto;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}
@media (max-width: 600px) {
  .search-bar { grid-template-columns: 1fr; }
}

.breed-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}
.breed-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  display: flex;
  flex-direction: column;
}
.breed-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.breed-card .breed-photo {
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--surface-alt);
}
.breed-card .breed-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s;
}
.breed-card:hover .breed-photo img { transform: scale(1.05); }
.breed-card .breed-card-body { padding: 0.85rem 1rem 1rem; }
.breed-card .emoji { font-size: 2.5rem; line-height: 1; padding: 1rem 1rem 0; }
.breed-card h3 { margin: 0 0 0.25rem; font-size: 1.05rem; }
.breed-card .breed-en { color: var(--text-muted); font-size: 0.85rem; }
.breed-card .breed-tags { margin-top: 0.5rem; display: flex; flex-wrap: wrap; gap: 0.25rem; }

.breed-modal-photo {
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 0.5rem;
  background: var(--surface-alt);
}
.breed-modal-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.tag {
  display: inline-block;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-size: 0.75rem;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
}
.tag.green { background: #e3f2e8; color: #4a8a64; }
.tag.warn { background: #fbe4d6; color: var(--warn); }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: var(--sp-5);
  position: relative;
}
.modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-muted);
}
.modal-close:hover { background: var(--surface-alt); }

.hospital-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.hospital-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}
.hospital-item h3 {
  margin: 0 0 0.25rem;
  font-size: 1.1rem;
}
.hospital-meta {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}
.hospital-actions {
  margin-top: 0.75rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.notice {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}
.notice.info { background: #e3f0fb; color: #2d5a82; }
.notice.warn { background: #fbe4d6; color: var(--warn); }
.notice.error { background: #fbdcdc; color: #9a3838; }
.notice.success { background: #e3f2e8; color: #4a8a64; }

.empty {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--text-muted);
}
.empty .emoji { font-size: 3rem; display: block; margin-bottom: 0.5rem; }

.spinner {
  display: inline-block;
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

footer {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.detail-row {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 0.5rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
}
.detail-row:last-child { border-bottom: none; }
.detail-row .label { color: var(--text-muted); font-weight: 600; }

/* --- 商品(アフィリエイト)関連 --- */
.category-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1.5rem;
}
.cat-btn {
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: var(--fs-base);
  color: var(--text-muted);
  cursor: pointer;
}
.cat-btn:hover { background: var(--surface-alt); color: var(--text); }
.cat-btn.active {
  background: var(--primary-strong);
  color: white;
  border-color: var(--primary-strong);
}

.cat-section { margin-bottom: var(--section-gap); }
.cat-heading {
  font-size: var(--fs-xl);
  margin: 0 0 var(--sp-1);
  padding-left: 0.6rem;
  border-left: 3px solid var(--primary);
}
.cat-desc { margin: 0 0 var(--sp-3); color: var(--text-muted); font-size: var(--fs-base); }

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0.75rem;
}
.product-grid-compact {
  grid-template-columns: 1fr;
  gap: 0.5rem;
}

.product-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.product-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.product-hero {
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--surface-alt);
  display: flex;
  align-items: center;
  justify-content: center;
}
.product-hero.photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s;
}
.product-card:hover .product-hero.photo img { transform: scale(1.05); }
.product-hero.emoji { position: relative; }
.product-hero.emoji .hero-emoji {
  font-size: 4rem;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.08));
}
.product-emoji {
  font-size: 2.2rem;
  line-height: 1;
  flex: 0 0 auto;
  width: 48px;
  text-align: center;
}
.product-body { flex: 1; min-width: 0; padding: 0.85rem 1rem 1rem; }
.product-cat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  margin-bottom: 0.2rem;
}
.product-cat {
  font-size: 0.75rem;
  color: var(--text-muted);
}
.product-name {
  margin: 0.1rem 0 0.3rem;
  font-size: 1rem;
  line-height: 1.35;
}
.product-desc {
  margin: 0 0 0.6rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.45;
}
.product-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.btn-amazon, .btn-rakuten {
  flex: 1 1 120px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  min-height: 40px;
  text-align: center;
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--dur) var(--ease), transform var(--dur-fast) var(--ease);
}
.btn-amazon:active, .btn-rakuten:active { transform: translateY(1px); }
.btn-amazon { background: #ff9900; color: #232f3e; }
.btn-amazon:hover { background: #ffac33; text-decoration: none; }
.btn-rakuten { background: #bf0000; color: white; }
.btn-rakuten:hover { background: #d11a1a; text-decoration: none; }

.pr-label {
  margin-top: 0.4rem;
  font-size: 0.7rem;
  color: var(--text-muted);
}
.pr-inline {
  font-size: 0.7rem;
  color: var(--text-muted);
  background: var(--surface-alt);
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
}

.modal-products-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.modal-products-header h3 {
  margin: 0;
  font-size: 1.05rem;
}

/* --- 食材図鑑 --- */
.food-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 0.7rem;
}
.food-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem;
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  border-left: 4px solid var(--border);
}
.food-card.level-good { border-left-color: #4a8a64; }
.food-card.level-ok { border-left-color: #c9a23a; }
.food-card.level-caution { border-left-color: #c25c2a; }
.food-card.level-bad { border-left-color: #a13838; background: #fff8f8; }
.food-icon {
  font-size: 2rem;
  line-height: 1;
  width: 44px;
  text-align: center;
  flex: 0 0 auto;
}
.food-body { flex: 1; min-width: 0; }
.food-head {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.2rem;
}
.food-head h3 { margin: 0; font-size: 1.05rem; }
.food-en { color: var(--text-muted); font-size: 0.8rem; }
.food-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem 0.5rem;
  margin: 0.25rem 0 0.4rem;
  font-size: 0.78rem;
}
.food-cat { color: var(--text-muted); }
.food-level-tag {
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}
.food-note {
  background: #fff4cd;
  color: #7a5a1a;
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
}
.food-desc {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text);
  line-height: 1.5;
}

/* --- スクロールトップボタン --- */
.scroll-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--primary-strong);
  color: white;
  border: none;
  cursor: pointer;
  font-size: 1.3rem;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px);
  transition: opacity 0.25s, transform 0.25s, background 0.15s;
  z-index: 40;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.scroll-top.show { opacity: 1; pointer-events: auto; transform: translateY(0); }
.scroll-top:hover { background: var(--primary-strong-hover); }

/* --- skeleton loader --- */
.skeleton {
  background: linear-gradient(90deg, var(--surface-alt) 25%, var(--border) 50%, var(--surface-alt) 75%);
  background-size: 200% 100%;
  animation: skel 1.4s ease-in-out infinite;
}
@keyframes skel { from { background-position: 200% 0; } to { background-position: -200% 0; } }
img.lazy-img {
  opacity: 0;
  transition: opacity 0.35s ease;
}
img.lazy-img.loaded {
  opacity: 1;
}

/* --- お気に入りボタン --- */
.fav-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.88);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.05rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition: background 0.15s, color 0.15s, transform 0.15s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}
.fav-btn:hover { background: white; transform: scale(1.1); }
.fav-btn.active { color: var(--primary-dark); }
html[data-theme="dark"] .fav-btn { background: rgba(40,30,35,0.85); }
html[data-theme="dark"] .fav-btn:hover { background: rgba(50,40,45,1); }

.breed-card, .food-card { position: relative; }

/* --- 検索ハイライト --- */
mark.hl {
  background: #ffe9a8;
  color: inherit;
  padding: 0 0.1em;
  border-radius: 3px;
}
html[data-theme="dark"] mark.hl { background: #6a5a20; color: #fff5d0; }

/* --- 緊急時アラート(食材ページ) --- */
.emergency-bar {
  position: sticky;
  top: 64px;
  z-index: 30;
  background: #fdf0d6;
  border: 1px solid #f0c878;
  border-radius: 8px;
  padding: 0.5rem 0.9rem;
  margin-bottom: 1rem;
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #7a4a10;
  cursor: pointer;
}
.emergency-bar:hover { background: #fde8b8; }
html[data-theme="dark"] .emergency-bar {
  background: #3d2820;
  color: #f0c8a0;
  border-color: #8a6038;
}

/* --- ホームヒーロー強化 --- */
.hero-search {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}
.hero-search-tabs {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}
.hero-search-tab {
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.7);
  border: 1px solid transparent;
  color: var(--text);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
}
.hero-search-tab.active { background: var(--primary-strong); color: white; }
html[data-theme="dark"] .hero-search-tab { background: rgba(0,0,0,0.25); color: var(--text); }
.hero-search input[type=text] {
  flex: 1;
  min-width: 200px;
  font-size: 1rem;
  padding: 0.65rem 0.9rem;
  border: none;
  background: rgba(255,255,255,0.95);
  color: #3a2e2e;
}
html[data-theme="dark"] .hero-search input[type=text] {
  background: rgba(255,255,255,0.95);
  color: #3a2e2e;
}
.tip-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  margin: 1.5rem 0;
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
}
.tip-card .tip-emoji { font-size: 2rem; line-height: 1; flex: 0 0 auto; }
.tip-card .tip-body strong { color: var(--primary-dark); display: block; margin-bottom: 0.2rem; }

.season-alert {
  background: linear-gradient(135deg, #fce4ea, #fdf6f0);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  margin: 1rem 0;
  font-size: 0.92rem;
}
html[data-theme="dark"] .season-alert {
  background: linear-gradient(135deg, #3d2832, #2a2528);
}

/* --- フェードイン --- */
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.fade-in { animation: fadeUp var(--dur-slow) var(--ease) backwards; }

/* --- お気に入りトグルの弾み --- */
@keyframes favPop { 0% { transform: scale(1); } 40% { transform: scale(1.3); } 100% { transform: scale(1); } }
.fav-btn.just-added { animation: favPop var(--dur) var(--ease); }

/* --- ホバー可能端末のみ浮き上がりを適用(タッチでの残留を防止) --- */
@media (hover: none) {
  .feature-card:hover, .breed-card:hover, .product-card:hover {
    transform: none;
    box-shadow: var(--shadow-sm);
  }
}

/* --- モバイル最適化: タップ領域44px・余白・モーダル --- */
@media (max-width: 820px) {
  :root { --section-gap: var(--sp-6); }
  nav.tabs a,
  .theme-toggle, .hamburger,
  .cat-btn, .hero-search-tab,
  .btn-amazon, .btn-rakuten,
  button, .btn { min-height: 44px; }
  .theme-toggle, .hamburger { width: 44px; height: 44px; }
}
@media (max-width: 600px) {
  .modal { padding: var(--sp-4); }
  .hero { padding: var(--sp-5) var(--sp-4); }
}
