:root {
  --red: #bf0000;
  --red-dark: #8c0000;
  --red-soft: #fff0f0;
  --red-line: #ffd0d0;
  --marker: #ffeb5a;
  --amber: #f39c12;
  /* 白地に置く文字用（大きい数字でも読める濃さ） */
  --amber-text: #b35900;
  --green-text: #178046;
  --green: #22a45d;
  --ink: #333;
  --muted: #6b6b6b;
  --bg: #f5f5f5;
  --card: #fff;
  --line: #e6e6e6;
  --danger: #d00;
  --radius: 16px;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
  font-family: "Hiragino Maru Gothic ProN", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", Meiryo, system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.75;
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100dvh; display: flex; flex-direction: column; }
a { color: var(--red); }

/* ヘッダー */
.site-header { background: #fff; border-top: 4px solid var(--red); border-bottom: 1px solid var(--line); padding: 10px 16px; }
.logo { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: 19px; color: var(--ink); text-decoration: none; letter-spacing: .02em; }
.logo img { border-radius: 8px; }
.logo-text span { color: var(--red); }

.wrap { width: 100%; max-width: 560px; margin: 0 auto; padding: 16px 16px 40px; flex: 1; }
.site-footer { background: #fff; text-align: center; font-size: 12px; color: var(--muted); padding: 20px 16px 28px; border-top: 1px solid var(--line); }
.site-footer p { margin: 6px 0 0; }

.step { display: none; }
.step[data-active] { display: block; animation: pop .25s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(6px); } }

h1 { font-size: clamp(27px, 7.6vw, 34px); line-height: 1.4; margin: 10px 0 6px; font-weight: 800; }
h2 { font-size: 22px; line-height: 1.45; margin: 6px 0 6px; font-weight: 800; }
h3 { font-size: 17px; margin: 0 0 8px; display: flex; align-items: center; gap: 8px; }
.marker { color: var(--red); background: linear-gradient(transparent 62%, var(--marker) 62%); padding: 0 2px; }
.lead { color: var(--muted); margin: 0 0 16px; font-size: 15px; }
.lead b { color: var(--ink); background: linear-gradient(transparent 65%, var(--marker) 65%); }
.note { font-size: 12px; color: var(--muted); margin: 10px 0 0; text-align: center; }
.note::before { content: "🔒 "; }
.error { color: var(--danger); background: var(--red-soft); border-radius: 10px; padding: 8px 12px; font-size: 14px; font-weight: 700; margin: 12px 0 0; }

/* トップ */
.hero { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 18px 6px; text-align: center; position: relative; overflow: hidden; }
.hero::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 90px; background: radial-gradient(circle at 15% 0, var(--red-soft) 0 60px, transparent 61px), radial-gradient(circle at 92% 10%, #fff8d6 0 46px, transparent 47px); z-index: 0; }
.hero > * { position: relative; }
.badges { list-style: none; display: flex; justify-content: center; gap: 6px; padding: 0; margin: 0; }
.badges li { background: var(--red); color: #fff; font-size: 12px; font-weight: 800; border-radius: 999px; padding: 2px 12px; }
.hero-illust { width: 190px; height: auto; display: block; margin: 4px auto 6px; }

.flow { list-style: none; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 0; margin: 14px 0; }
.flow li { background: var(--card); border-radius: 12px; box-shadow: var(--shadow); padding: 10px 4px 8px; text-align: center; font-size: 12.5px; font-weight: 700; line-height: 1.45; position: relative; }
.flow li:not(:last-child)::after { content: "▶"; position: absolute; right: -9px; top: 50%; transform: translateY(-50%); font-size: 9px; color: var(--red); }
.num { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--red); color: #fff; font-size: 13px; font-weight: 800; }
.flow .num { display: grid; margin: 0 auto 4px; }

/* ボタン */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; padding: 0 24px; border-radius: 999px; border: 0;
  font: inherit; font-weight: 800; font-size: 16px; cursor: pointer; text-decoration: none;
}
.btn-primary { background: var(--red); color: #fff; box-shadow: 0 4px 12px rgba(191, 0, 0, 0.25); }
.btn-primary:active { background: var(--red-dark); }
.btn-primary:disabled { opacity: .6; }
.btn-ghost { background: var(--red-soft); color: var(--red); }
.btn-camera { width: 100%; min-height: 64px; font-size: 19px; margin-top: 4px; }
.btn-link { display: block; margin: 14px auto 0; background: none; border: 0; color: var(--red); font: inherit; font-size: 14px; font-weight: 700; text-decoration: underline; cursor: pointer; }
.btn:focus-visible, .btn-link:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible { outline: 3px solid #ffb020; outline-offset: 2px; }

/* POINT */
.point { margin-top: 22px; background: #fff6cc; border-radius: var(--radius); padding: 12px 16px; }
.point summary { font-weight: 800; cursor: pointer; display: flex; align-items: center; gap: 8px; list-style: none; }
.point summary::-webkit-details-marker { display: none; }
.point summary::after { content: "＋"; margin-left: auto; color: var(--muted); }
.point[open] summary::after { content: "－"; }
.point-label { background: #ffd21f; color: #4a3200; font-size: 11px; font-weight: 800; border-radius: 6px; padding: 1px 8px; letter-spacing: .06em; }
.point ul { padding-left: 1.2em; margin: 8px 0 2px; font-size: 14px; }
.point li { margin-bottom: 4px; }

/* 読み取り中 */
.reading { text-align: center; padding: 16px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }
.reading img { width: 100%; max-height: 260px; height: auto; object-fit: contain; border-radius: 12px; background: #eee; }
.spinner { width: 38px; height: 38px; margin: 18px auto 6px; border-radius: 50%; border: 4px solid var(--red-line); border-top-color: var(--red); animation: spin 0.9s linear infinite; }
.reading p { font-weight: 700; margin: 0 0 6px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* 確認 */
.step-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--red-soft); color: var(--red); font-size: 13px; font-weight: 800; border-radius: 999px; padding: 3px 12px 3px 4px; margin: 0; }
.step-chip .num { width: 22px; height: 22px; font-size: 12px; }
#step-confirm form { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 16px; }
.field { margin: 0 0 16px; border: 0; padding: 0; }
.field label, .field legend { display: block; font-weight: 800; font-size: 14px; margin-bottom: 6px; padding: 0; }
.field-row { display: grid; grid-template-columns: 2fr 1fr; gap: 12px; }
input[type="number"], input:not([type]), select {
  width: 100%; min-height: 50px; padding: 0 14px; font: inherit; font-size: 17px;
  background: #f0f0f0; color: var(--ink); border: 0; border-radius: 12px;
}
input:focus-visible, select:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; }
.field input[data-filled="ocr"], .field select[data-filled="ocr"] { background: #fff3c4; }
.field .chip { display: inline-flex !important; align-items: center; gap: 6px; font-weight: 600 !important; margin: 0 8px 6px 0; background: #f0f0f0; border-radius: 999px; padding: 6px 14px; cursor: pointer; }
.chip:has(input:checked) { background: var(--red-soft); color: var(--red); }
.chip input { accent-color: var(--red); margin: 0; }
.chip { white-space: nowrap; flex: none; }
.check { display: flex; gap: 8px; align-items: center; font-size: 15px; margin: 4px 0 8px; }
.check input { accent-color: var(--red); width: 18px; height: 18px; }
.actions { display: flex; gap: 10px; margin-top: 18px; }
.actions .btn { flex: 1; padding: 0 12px; }

/* 結果 */
.result-head { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px 6px; margin-top: 10px; }
.result-maker { margin: 0; font-size: 13px; font-weight: 700; color: var(--muted); }
#r-headline { font-size: 22px; margin: 2px 0 0; }
.age-num { font-size: 48px; line-height: 1.1; margin: 0 4px; color: var(--green-text); font-family: "Avenir Next", "Helvetica Neue", sans-serif; font-weight: 800; }
.age-7to9 .age-num { color: var(--amber-text); }
.age-10plus .age-num { color: var(--red); }
.meter { position: relative; height: 14px; border-radius: 7px; background: #eee; margin: 12px 0 6px; overflow: hidden; }
.meter-fill { position: absolute; inset: 0 auto 0 0; width: var(--pct, 0%); background: var(--meter-color, var(--green)); border-radius: 7px; transition: width .6s ease-out; }
.meter-mark { position: absolute; top: 0; bottom: 0; left: 66.6%; width: 2px; background: var(--ink); opacity: .45; }
.meter-caption { position: relative; height: 20px; font-size: 11px; color: var(--muted); margin: 0 0 8px; }
.meter-caption span { position: absolute; top: 0; white-space: nowrap; }
.meter-caption span:nth-child(1) { left: 0; }
.meter-caption span:nth-child(2) { left: 66.6%; transform: translateX(-50%); font-weight: 700; }
.meter-caption span:nth-child(3) { right: 0; }
#r-message { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; margin: 12px 0; font-size: 15px; }
.spec { display: grid; grid-template-columns: auto 1fr; margin: 12px 0; font-size: 14.5px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.spec dt, .spec dd { padding: 9px 14px; border-bottom: 1px solid var(--line); margin: 0; }
.spec dt { background: #fafafa; color: var(--muted); font-weight: 700; }
.spec dd { font-weight: 700; min-width: 0; overflow-wrap: anywhere; }
.spec dt:nth-last-of-type(1), .spec dd:nth-last-of-type(1) { border-bottom: 0; }
.spec-note { font-size: 11.5px; color: var(--muted); margin: -4px 0 12px; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin: 14px 0; }
.card p { margin: 0 0 10px; font-size: 14.5px; }
.card.urgent { background: var(--red-soft); box-shadow: 0 4px 16px rgba(191, 0, 0, 0.12); }
.card.urgent .card-icon { background: #fff; }
.card-icon { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--red-soft); font-size: 15px; }
.program { display: flex; width: 100%; margin-top: 10px; }
.pr { font-size: 11px; color: var(--muted); margin: 10px 0 0 !important; }
.recall-list { margin: 0 0 10px; padding: 0; list-style: none; }
.recall-list li { background: #fff; border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; font-size: 14px; }
.recall-list .recall-title { font-weight: 700; display: block; }
.recall-list .recall-meta { color: var(--muted); font-size: 12.5px; display: block; margin: 2px 0 4px; }
.source { font-size: 11.5px; color: var(--muted); }
.card p.source { font-size: 11.5px; margin: 0; }
.price { background: #fff; border-radius: 12px; padding: 10px 12px; }
.price span, .price strong { display: block; }
.price-label { font-size: 13px; font-weight: 700; }
.price strong { font-size: 24px; color: var(--red); line-height: 1.3; }
.repair-tag { display: inline-block; font-size: 12px; font-weight: 700; border-radius: 999px; padding: 2px 10px; margin-left: 6px; background: #f0f0f0; vertical-align: 2px; }
.repair-tag.repair { background: var(--red-soft); color: var(--red-dark); }
.repair-tag.inspect { background: #fff6cc; }
.disclaimer { font-size: 11.5px; color: var(--muted); margin: 16px 0; }
#restart { width: 100%; }

.prose { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 4px 20px 20px; margin-top: 8px; }
.prose h1 { font-size: 24px; margin-top: 16px; }
.prose h2 { font-size: 17px; margin-top: 24px; padding-left: 10px; border-left: 4px solid var(--red); }
.prose li { margin-bottom: 6px; }
