/* PIC スタイル。担当ごとに節を分ける(同じ節を2人が書かない)。 */

/* ==== tool (S1) ==== */
.pic-err { margin: 6px 0 0; font-size: 14px; line-height: 1.6; color: #7c2d12; }
.pic-err:empty { display: none; }
.pic-flag-f[hidden] { display: none !important; }
.pic-save-note, .pic-reset-note { margin: 10px 0 0; font-size: 14px; line-height: 1.7; color: #475569; }
#r-compare { margin-top: 20px; min-width: 0; }
#r-compare[hidden] { display: none; }
.pic-h3 { font-size: 16px; font-weight: 700; margin: 0 0 8px; color: #374151; }
.pic-table-wrap { max-width: 100%; overflow-x: auto; }
.pic-table { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 1.6; }
.pic-table caption { text-align: left; font-size: 14px; color: #475569; padding: 0 0 6px; }
.pic-table th, .pic-table td { border: 1px solid #cbd5e1; padding: 8px 10px; text-align: left; vertical-align: top; overflow-wrap: anywhere; }
.pic-table thead th { background: #f1f5f9; }
.pic-table tr[aria-current="true"] th, .pic-table tr[aria-current="true"] td { background: #ede9fe; font-weight: 700; }
#r-chart { position: relative; max-width: 100%; height: 260px; margin-top: 14px; }
#r-chart canvas { max-width: 100%; }
#r-reset { margin-top: 18px; padding-top: 14px; border-top: 1px solid #e2e8f0; }
.pic-reset-btn { min-height: 44px; padding: 10px 18px; font-size: 14px; font-weight: 600; color: #334155; background: #fff; border: 2px solid #64748b; border-radius: 10px; cursor: pointer; touch-action: manipulation; }
.pic-reset-btn:focus-visible { outline: 3px solid #7c3aed; outline-offset: 2px; }
#r-title { scroll-margin-top: 16px; }

/* ==== a11y (S3) ==== */
/* 文字は 14px 以上(index.html のインライン font-size は書き換えず、ここで引き上げる) */
[style*="font-size:11px"], [style*="font-size: 11px"], [style*="font-size:12px"], [style*="font-size: 12px"],
[style*="font-size:13px"], [style*="font-size: 13px"], [style*="font-size:.78rem"], [style*="font-size:0.8rem"],
[style*="font-size:.8rem"], [style*="font-size:.85rem"], [style*="font-size:.87rem"] { font-size: 14px !important; }
.site-header p, .site-header .emoji + h1 + p, .badge, .result-sub-card .lbl, .food-table, .compare-table,
.advice-item .time, .advice-item .desc, label, small, legend, footer, footer p, #goal-desc, #activity-help { font-size: 14px !important; }
.site-header h1 { font-size: 18px !important; }
.btn-copy, .pic-reset-btn { font-size: 14px; }

/* タップ対象は 44×44px 以上 */
input:not([type="radio"]):not([type="checkbox"]), select { min-height: 44px !important; font-size: 16px !important; }
.btn, .btn-copy { min-height: 44px !important; }
.btn-copy { padding-left: 16px; padding-right: 16px; }
input[type="radio"], input[type="checkbox"] { width: 24px !important; height: 24px !important; min-height: 24px !important; flex: none; accent-color: #6d28d9; }
label[for^="sex-"], #flags label { min-height: 44px; padding: 4px 10px 4px 0; margin-top: 2px !important; box-sizing: border-box; }
label[for^="sex-"] { min-width: 44px; }
summary { display: list-item; min-height: 44px; padding: 10px 0; box-sizing: border-box; font-size: 14px !important; }
.sr-only:focus, .sr-only:focus-visible { position: absolute !important; width: auto !important; height: auto !important; min-width: 44px; min-height: 44px; margin: 0 !important; clip: auto !important; overflow: visible !important; white-space: normal !important; display: inline-flex; align-items: center; box-sizing: border-box; outline: 3px solid #1e1b4b; outline-offset: 2px; }
a[href="/blog/"], a[href="/"], nav[aria-label="パンくずリスト"] a, footer p a, footer a[href^="https://tech-and-brace"], a[href="#pic-sources"], .pic-gloss-link a { display: inline-flex; align-items: center; min-height: 44px; min-width: 44px; padding-left: 6px; padding-right: 6px; box-sizing: border-box; }
a[href="#pic-sources"] { display: inline-block; padding-top: 10px; padding-bottom: 10px; }
nav[aria-label="パンくずリスト"] ol { gap: 0 !important; }
.pic-gloss-link { margin: 12px 0 0; font-size: 14px; }
.pic-gloss-link a { color: #5b21b6; text-decoration: underline; padding-left: 0; }
.pic-gloss-link a { display: inline-flex; }
#r-block:not(:empty) ~ .pic-gloss-link { display: none; }

/* 読み取り: 専門語の説明 */
abbr[title] { text-decoration: underline dotted; text-underline-offset: 3px; cursor: help; }

/* ボタンの色: 通常・hover・active・disabled のどの状態でも文字と背景の比 4.5:1 以上(hover で透過させない) */
.btn:hover, .btn:active { opacity: 1 !important; }
#calc-btn { background: #6d28d9; color: #fff; }
#calc-btn:hover { background: #5b21b6; }
#calc-btn:active { background: #4c1d95; }
#sample-btn { background: #4b5563 !important; color: #fff !important; }
#sample-btn:hover { background: #374151 !important; }
#sample-btn:active { background: #1f2937 !important; }
.btn:disabled { background: #4b5563 !important; color: #fff !important; opacity: 1 !important; cursor: not-allowed; }
.btn-copy { color: #5b21b6; border-color: #5b21b6; }
.btn-copy:hover { background: #5b21b6; color: #fff; }
.btn-copy.copied { background: #047857; border-color: #047857; color: #fff; }
button[onclick="printResult()"], button[onclick="downloadCSV()"] { background: #6d28d9 !important; color: #fff !important; border-color: #6d28d9 !important; }
button[onclick="printResult()"]:hover, button[onclick="downloadCSV()"]:hover { background: #4c1d95 !important; }

/* フォーカス枠: 3px・背景との比 3:1 以上 */
.btn:focus-visible, .btn-copy:focus-visible, summary:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, button:focus-visible { outline: 3px solid #4c1d95 !important; outline-offset: 3px !important; }
input:focus, select:focus { outline: 3px solid #4c1d95; outline-offset: 2px; }
footer a:focus-visible { outline-color: #fff !important; }

/* 結果の注意文・ブロック文: 中立色(赤・警告色を使わない) */
#r-notice { background: #f1f5f9; color: #1e293b; }
#r-block { color: #1e293b; }

/* 最初の画面: ヒーローを畳み、年齢の入力欄が最初の画面に入る */
.site-header { padding: 12px 16px !important; }
.site-header .emoji { font-size: 28px !important; margin-bottom: 0 !important; line-height: 1.2; }
.site-header h1 { margin-bottom: 2px !important; }
.pic-hero { padding: 12px 16px !important; margin-bottom: 12px !important; }
.pic-hero > p { display: none; }
.pic-hero h2 { font-size: 18px !important; margin: 0 0 8px !important; }
.pic-hero .btn { margin-top: 0 !important; }
.pic-hero-stats { display: none !important; }
.pic-trust { padding: 12px 16px !important; margin-bottom: 12px !important; }
.pic-trust > p { display: none; }
.pic-trust > div { line-height: 1.6 !important; gap: 6px !important; }
.pic-trust > div > span { padding: 0 !important; background: none !important; border-left: 0 !important; box-shadow: none !important; }
main.container { padding-top: 8px !important; }
.card { padding: 16px !important; }

/* 同意バナー(共有物)が最後の本文を覆わない */
body { padding-bottom: 120px; }
@media (max-width: 420px) { body { padding-bottom: 160px; } }
@media (max-width: 300px) { body { padding-bottom: 280px; } }
footer { background: #1e293b; opacity: 1 !important; margin-top: 24px !important; }
footer a { color: #fff !important; }

/* 狭い幅・拡大時の横あふれ防止 */
@media (max-width: 480px) {
  .site-header .emoji { display: none; }
  .site-header { padding: 10px 12px !important; }
  nav[aria-label="パンくずリスト"] li:nth-child(n+4) { display: none; }
  nav[aria-label="パンくずリスト"] { padding: 0 12px !important; }
  .pic-trust > div > span:first-child { display: none !important; }
  [style*="grid-template-columns:1fr 1fr 1fr"] { grid-template-columns: 1fr !important; }
  .result-sub-grid, .advice-grid { grid-template-columns: 1fr; }
  .result-big { font-size: 40px; }
}
main, .card, .pic-table-wrap { min-width: 0; max-width: 100%; }
img, canvas, table { max-width: 100%; }

/* ==== ads (S4) ==== */
.pic-ads { max-width: 740px; margin: 24px auto; padding: 16px; background: #fff; border: 1px solid #d1d5db; border-radius: 12px; }
.pic-ads[hidden] { display: none; }
.pic-ads-h { display: flex; align-items: center; gap: 8px; margin: 0 0 4px; font-size: 16px; font-weight: 700; color: #1f2937; }
.pic-ads-pr { display: inline-block; padding: 1px 8px; border: 1px solid #4b5563; border-radius: 4px; font-size: 14px; font-weight: 700; color: #374151; background: #f3f4f6; }
.pic-ads-note { margin: 0 0 12px; font-size: 14px; line-height: 1.6; color: #4b5563; }
.pic-ads-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.pic-ads-desc { margin: 0 0 4px; font-size: 14px; color: #374151; }
.pic-ads-link { display: flex; align-items: center; justify-content: center; box-sizing: border-box; min-height: 48px; padding: 8px 16px; font-size: 15px; line-height: 1.4; color: #1e3a8a; background: #fff; border: 1px solid #6b7280; border-radius: 8px; text-decoration: underline; text-align: center; }
.pic-ads-link:hover, .pic-ads-link:focus-visible { background: #eff6ff; }
