/* ============================================================
   食べる力チェックAI 共通スタイル
   コンセプト：安心・清潔・温かい（医療サイト風にしない）
   方針：文字は大きく(18〜20px)、コントラストは高く(4.5:1以上)、
         タップ領域は48px以上、余白を十分に取る。
   ============================================================ */

:root {
  --bg: #FAFBF2;          /* 背景（クリーム） */
  --surface: #FFFFFF;
  --ink: #292420;         /* 本文（ほぼ黒の温かい色） */
  --ink-soft: #4A423A;
  --sub: #6B6057;
  --line: #DCE8CB;
  --brand: #7CB342;       /* アクセント（温かいオレンジ） */
  --brand-deep: #4E7A1F;  /* ボタン・強調（白文字でAA適合） */
  --brand-dark: #33521A;
  --red: #B3261E;
  --red-bg: #FCEFEE;
  --yellow: #7A5C00;
  --yellow-bg: #FBF4D9;
  --green: #2E6B34;
  --green-bg: #EDF6EC;
  --orange: #B4531F;
  --orange-bg: #EFF7E3;
  /* 信号機色（赤=要注意 / 黄=注意 / 緑=問題なし） */
  --sig-red: #C62828;
  --sig-yellow: #8A5A00;
  --sig-green: #2E7D32;
  --radius: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI",
               "Meiryo", "Noto Sans JP", sans-serif;
  font-size: 19px;
  line-height: 1.95;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; }

a { color: var(--brand-dark); text-underline-offset: 3px; }
a:hover { color: var(--brand); }

/* ---------- レイアウト ---------- */
.container { max-width: 760px; margin: 0 auto; padding: 0 20px; }
.container-wide { max-width: 980px; margin: 0 auto; padding: 0 20px; }

/* ---------- ヘッダー ---------- */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 50;
}
.header-inner {
  max-width: 980px; margin: 0 auto; padding: 10px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand img { width: 44px; height: 44px; border-radius: 12px; }
.brand-name {
  font-size: 20px; font-weight: 700; color: var(--brand-dark);
  letter-spacing: 0.02em; line-height: 1.35;
}
.brand-name small { display: block; font-size: 12px; font-weight: 600; color: var(--sub); letter-spacing: 0.08em; }

.main-nav ul { list-style: none; display: flex; gap: 4px; flex-wrap: wrap; }
.main-nav a {
  display: inline-block; padding: 10px 12px; min-height: 44px;
  font-size: 16px; font-weight: 700; color: var(--ink-soft);
  text-decoration: none; border-radius: 10px;
}
.main-nav a:hover { background: var(--orange-bg); color: var(--brand-deep); }
.main-nav a[aria-current="page"] { background: var(--orange-bg); color: var(--brand-deep); }

/* ---------- ヒーロー（トップ） ---------- */
.hero {
  text-align: center;
  padding: 48px 20px 40px;
  background: linear-gradient(180deg, #EDF6DE 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--line);
}
.hero h1 { font-size: 32px; line-height: 1.5; color: var(--brand-dark); font-weight: 800; }
.hero .lead { margin-top: 12px; font-size: 21px; color: var(--ink); font-weight: 700; }
.hero p { margin-top: 10px; color: var(--ink-soft); }

.hero-cta { margin-top: 28px; }
.hero-note { margin-top: 14px; font-size: 15px; color: var(--sub); }

/* ---------- ボタン ---------- */
.btn {
  display: inline-block; appearance: none; border: none; cursor: pointer;
  font-family: inherit; font-size: 20px; font-weight: 800;
  min-height: 56px; padding: 14px 34px; border-radius: 14px;
  text-decoration: none; text-align: center;
  background: var(--brand-deep); color: #FFFFFF;
  box-shadow: 0 3px 0 var(--brand-dark);
  transition: transform .06s ease, background .15s ease;
}
.btn:hover { background: var(--brand); color: #FFFFFF; }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--brand-dark); }
.btn:focus-visible { outline: 4px solid #C5E1A5; outline-offset: 2px; }

.btn-secondary {
  background: var(--surface); color: var(--brand-deep);
  border: 2px solid var(--brand-deep); box-shadow: none;
}
.btn-secondary:hover { background: var(--orange-bg); color: var(--brand-deep); }

.btn-ghost {
  background: transparent; color: var(--ink-soft);
  border: 2px solid var(--line); box-shadow: none; font-weight: 700; font-size: 18px;
}
.btn-ghost:hover { border-color: var(--sub); color: var(--ink); background: var(--surface); }

.btn-block { display: block; width: 100%; }
.btn-row { display: flex; gap: 12px; margin-top: 24px; }
.btn-row .btn { flex: 1; }

/* ---------- カード・見出し ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 24px; margin-top: 20px;
}
.card h2, .section-title {
  font-size: 24px; font-weight: 800; color: var(--brand-dark);
  margin-bottom: 12px; line-height: 1.5;
}
.card h3 { font-size: 20px; font-weight: 800; color: var(--ink); margin: 18px 0 8px; }

.section { margin-top: 36px; }
.section-title { padding-bottom: 10px; border-bottom: 3px solid var(--brand); }

/* ---------- ラジオカード（大きい選択肢） ---------- */
.radio-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.radio-grid.single { grid-template-columns: 1fr; }
@media (min-width: 640px) { .radio-grid { grid-template-columns: 1fr 1fr 1fr; } .radio-grid.two { grid-template-columns: 1fr 1fr; } }

.radio-card { position: relative; }
.radio-card input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.radio-card label {
  display: flex; align-items: center; justify-content: center; text-align: center;
  min-height: 58px; padding: 12px 10px;
  border: 2px solid var(--line); border-radius: 14px;
  background: var(--surface); color: var(--ink-soft);
  font-size: 18px; font-weight: 700; cursor: pointer;
  transition: border-color .1s, background .1s;
}
.radio-card input:focus-visible + label { outline: 4px solid #C5E1A5; outline-offset: 2px; }
.radio-card input:checked + label {
  border-color: var(--brand-deep); background: var(--orange-bg);
  color: var(--brand-deep); box-shadow: inset 0 0 0 1px var(--brand-deep);
}
.radio-card input:disabled + label { opacity: .45; cursor: not-allowed; }

/* ---------- 数値入力 ---------- */
.field { margin-top: 18px; }
.field label { display: block; font-weight: 800; font-size: 19px; margin-bottom: 6px; }
.field .help { font-size: 15px; color: var(--sub); font-weight: 400; margin-bottom: 6px; }
.field input[type="number"], .field input[type="text"], .field select {
  width: 100%; min-height: 56px; padding: 10px 16px;
  font-size: 20px; font-family: inherit; color: var(--ink);
  border: 2px solid var(--line); border-radius: 12px; background: var(--surface);
}
.field input:focus, .field select:focus { border-color: var(--brand-deep); outline: none; box-shadow: 0 0 0 4px #D9EDBB; }
.field .unit { font-size: 17px; color: var(--sub); }

/* ---------- チェックボックス ---------- */
.check-line { display: flex; align-items: flex-start; gap: 10px; margin-top: 14px; font-size: 17px; }
.check-line input { width: 26px; height: 26px; margin-top: 4px; accent-color: var(--brand-deep); }

/* ---------- 進捗バー ---------- */
.progress-wrap { padding: 16px 0 4px; }
.progress-label { display: flex; justify-content: space-between; font-size: 16px; font-weight: 700; color: var(--sub); margin-bottom: 6px; }
.progress-track { height: 12px; background: var(--line); border-radius: 99px; overflow: hidden; }
.progress-fill { height: 100%; width: 0%; background: var(--brand); border-radius: 99px; transition: width .3s ease; }

/* ---------- 結果カード（信号機3段階：赤=要注意 / 黄=注意 / 緑=問題なし） ---------- */
.flag-card {
  border-radius: var(--radius); padding: 20px 22px; margin-top: 16px;
  border: 2px solid;
}
.flag-card .flag-head { display: flex; align-items: center; gap: 10px; }
.flag-card .flag-title { font-size: 21px; font-weight: 800; }
.flag-card p { margin-top: 8px; font-size: 18px; }
.flag-card ul { margin: 10px 0 0 22px; }
.flag-card li { margin-top: 4px; font-size: 17px; }

.flag-red    { border-color: var(--red);    background: var(--red-bg); }
.flag-yellow { border-color: #C9A53E;       background: var(--yellow-bg); }
.flag-green  { border-color: #9CC79E;       background: var(--green-bg); }
.flag-red .flag-title { color: var(--red); }
.flag-yellow .flag-title { color: var(--yellow); }
.flag-green .flag-title { color: var(--green); }

.icon-red, .icon-yellow, .icon-green { font-size: 26px; line-height: 1; }

/* 信号の凡例 */
.traffic-legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 12px; }
.traffic-legend span { font-size: 15px; font-weight: 700; color: var(--sub); }
.traffic-legend .dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; vertical-align: -1px; margin-right: 4px; }
.dot-red { background: var(--sig-red); } .dot-yellow { background: var(--sig-yellow); } .dot-green { background: var(--sig-green); }

/* 音声ステータス */
.voice-status { min-height: 24px; font-size: 15px; color: var(--sub); margin-top: 6px; }
.voice-listening { color: var(--brand-deep); font-weight: 700; }
/* ボタン上のマイクマーク */
.voice-capable::after { content: "\1F3A4"; margin-left: 6px; font-size: 15px; }

/* 優先順位ナンバー */
.priority-list { list-style: none; counter-reset: pri; margin-top: 8px; }
.priority-list li {
  counter-increment: pri; position: relative;
  background: var(--surface); border: 2px solid var(--line);
  border-radius: var(--radius); padding: 18px 18px 18px 66px; margin-top: 14px;
}
.priority-list li::before {
  content: counter(pri); position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--brand-deep); color: #FFF; font-size: 20px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}
.priority-list .pri-title { font-size: 20px; font-weight: 800; }
.priority-list p { font-size: 16px; color: var(--ink-soft); margin-top: 4px; }

/* 今日からできること */
.tip-list { list-style: none; margin-top: 8px; }
.tip-list li {
  background: var(--green-bg); border: 2px solid #BFDCC2;
  border-radius: 14px; padding: 14px 16px 14px 48px; margin-top: 12px;
  font-size: 18px; position: relative;
}
.tip-list li::before { content: "✓"; position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--green); font-weight: 800; font-size: 20px; }

/* 注意書き */
.notice {
  border: 2px solid #AECB8E; background: #F0F5E4;
  border-radius: 14px; padding: 16px 18px; font-size: 16px; color: var(--ink-soft);
  margin-top: 20px; line-height: 1.8;
}
.notice strong { color: var(--brand-dark); }

/* AI説明ボックス */
.ai-box {
  background: #F4F7FF; border: 2px solid #B7C8F0; border-radius: var(--radius);
  padding: 22px; margin-top: 20px;
}
.ai-box .ai-badge {
  display: inline-block; background: #3D5B99; color: #FFF; font-size: 14px; font-weight: 800;
  padding: 4px 12px; border-radius: 99px; margin-bottom: 10px;
}
.ai-box p { margin-top: 10px; font-size: 18px; }

/* ---------- 広告スペース ---------- */
.ad-slot {
  min-height: 120px; margin: 28px 0;
  border: 2px dashed #C3D8A8; border-radius: 12px;
  background: #F5F9EC; color: #7A8C68;
  display: flex; align-items: center; justify-content: center; text-align: center;
  font-size: 15px; padding: 12px;
}
/* チェック中・結果直前に広告は置かない（運用ルール） */

/* ---------- チップ（具体例など） ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; justify-content: center; }
.chip {
  background: var(--surface); border: 2px solid var(--line); border-radius: 99px;
  padding: 10px 18px; font-size: 17px; font-weight: 700; color: var(--ink-soft);
  text-decoration: none;
}
.chip:hover { border-color: var(--brand); color: var(--brand-deep); }

/* ---------- テーブル ---------- */
.table-wrap { overflow-x: auto; margin-top: 14px; }
table { width: 100%; border-collapse: collapse; font-size: 17px; background: var(--surface); }
th, td { border: 1px solid var(--line); padding: 10px 12px; text-align: left; vertical-align: top; }
th { background: var(--orange-bg); color: var(--brand-dark); font-weight: 800; white-space: nowrap; }

/* ---------- フッター ---------- */
.site-footer { background: #3B332B; color: #E9DDCB; margin-top: 56px; padding: 36px 20px 48px; font-size: 16px; }
.site-footer a { color: #C5E1A5; }
.footer-inner { max-width: 980px; margin: 0 auto; }
.footer-nav { list-style: none; display: flex; flex-wrap: wrap; gap: 8px 20px; margin-bottom: 18px; }
.footer-nav a { display: inline-block; padding: 8px 4px; min-height: 44px; text-decoration: none; font-weight: 700; }
.footer-note { color: #C9BCA8; font-size: 15px; line-height: 1.9; }
.copyright { margin-top: 18px; font-size: 14px; color: #A99C87; }

/* ---------- モーダル ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(41, 36, 32, .55);
  display: none; align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--surface); border-radius: var(--radius); max-width: 520px;
  padding: 28px; width: 100%; max-height: 86vh; overflow-y: auto;
}
.modal h3 { font-size: 22px; color: var(--brand-dark); margin-bottom: 10px; }
.modal p { margin-top: 10px; }

/* ---------- ステップ（チェック画面） ---------- */
.step { display: none; }
.step.active { display: block; animation: fadeIn .25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px);} to { opacity: 1; transform: none;} }
.step-title { font-size: 24px; font-weight: 800; color: var(--brand-dark); margin-top: 18px; }
.step-desc { font-size: 17px; color: var(--ink-soft); margin-top: 4px; }
.fieldset-group { margin-top: 22px; }
.fieldset-group > p { font-weight: 800; font-size: 19px; margin-bottom: 8px; }

.form-error {
  display: none; background: var(--red-bg); border: 2px solid var(--red);
  color: var(--red); border-radius: 12px; padding: 12px 16px; font-size: 16px; margin-top: 16px;
}
.form-error.show { display: block; }

/* ---------- 空状態など ---------- */
.empty-msg { text-align: center; color: var(--sub); padding: 40px 10px; font-size: 18px; }
.text-center { text-align: center; }
.mt16 { margin-top: 16px; } .mt24 { margin-top: 24px; } .mt32 { margin-top: 32px; }
.muted { color: var(--sub); font-size: 16px; }
.small { font-size: 15px; }
strong.strong-brand { color: var(--brand-dark); }

/* ---------- アクセシビリティ ---------- */
:focus-visible { outline: 4px solid #C5E1A5; outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- PC対応 ---------- */
@media (min-width: 800px) {
  body { font-size: 20px; }
  .hero h1 { font-size: 40px; }
  .card { padding: 32px; }
}

/* ---------- 項目別読み上げボタン（音声モードON時のみ表示） ---------- */
.voice-item-btn {
  display: none;
  align-items: center; gap: 6px;
  margin-top: 10px; min-height: 44px; padding: 8px 18px;
  font-size: 16px; font-weight: 700; font-family: inherit;
  color: var(--brand-deep); background: var(--surface);
  border: 2px solid var(--brand-deep); border-radius: 99px;
  cursor: pointer;
}
body.voice-enabled .voice-item-btn { display: inline-flex; }
.voice-item-btn:active { transform: translateY(1px); }

/* ---------- 7日間献立（カード型：文字が縦に潰れない構成） ---------- */
.menu-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 800px) { .menu-grid { grid-template-columns: 1fr 1fr; } }
.menu-day {
  background: var(--surface); border: 2px solid var(--line);
  border-radius: var(--radius); padding: 18px;
}
.menu-day h4 { font-size: 20px; font-weight: 800; color: var(--brand-dark); margin-bottom: 4px; }
.menu-meal {
  display: flex; gap: 10px; align-items: flex-start;
  font-size: 18px; line-height: 1.8; padding: 10px 0;
  border-top: 1px dashed var(--line);
}
.menu-meal-label {
  flex: 0 0 auto; width: 46px; height: 34px; border-radius: 8px;
  background: var(--orange-bg); color: var(--brand-deep);
  font-weight: 800; font-size: 17px;
  display: inline-flex; align-items: center; justify-content: center;
}
.menu-protein { margin-top: 8px; font-size: 16px; font-weight: 700; color: var(--green); }

/* ---------- 前回との比較 ---------- */
.compare-list { list-style: none; margin-top: 8px; }
.compare-list li {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--surface); border: 2px solid var(--line);
  border-radius: 14px; padding: 14px 18px; margin-top: 12px;
}
.compare-icon { font-size: 22px; flex: 0 0 auto; }
.compare-title { font-size: 18px; font-weight: 800; }
.compare-label { font-size: 15px; color: var(--sub); width: 100%; padding-left: 34px; }
.compare-list li.compare-worse { border-color: var(--red); background: var(--red-bg); }
.compare-list li.compare-better, .compare-list li.compare-resolved { border-color: #9CC79E; background: var(--green-bg); }
.compare-list li.compare-new { border-color: #C9A53E; background: var(--yellow-bg); }
