/* 調味料顔診断：共通スタイル（デザインA：食品ラベル） */
:root {
  --kraft: #efe3cc; --paper: #fbf6ec; --ink: #2a2420; --muted: #6e6253; --red: #b8322a; --red-dark: #7d1f19;
  --rule: #b8a98f; --track: #e6dccb;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--kraft);
  background-image: radial-gradient(rgba(120,90,50,.07) 1px, transparent 1px); background-size: 6px 6px;
  font-family: "Zen Kaku Gothic New", sans-serif; line-height: 1.7; -webkit-text-size-adjust: 100%; }
.mincho { font-family: "Zen Old Mincho", serif; }
.col { max-width: 520px; margin: 0 auto; padding: 0 16px; }
[hidden] { display: none !important; }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }

/* ナビ */
.nav { display: flex; justify-content: space-between; align-items: center; padding: 14px 0; }
.logo { font-family: "Zen Old Mincho", serif; font-weight: 900; border: 2px solid var(--ink); padding: 2px 10px; text-decoration: none; }
.nav-link { font-size: .85rem; font-weight: 700; text-decoration: none; border-bottom: 2px solid var(--ink); }

/* 共通パーツ */
.sec { background: var(--paper); border: 2px solid var(--ink); padding: 16px; margin-bottom: 18px; }
.sec h2, .sec h3 { font-family: "Zen Old Mincho", serif; margin: 0 0 12px; font-size: 1.1rem; border-bottom: 4px double var(--ink); padding-bottom: 4px; }
.cta { display: block; width: 100%; border: 0; background: var(--red); color: #fff; font-weight: 900; font-size: 1.15rem;
  padding: 16px; border-radius: 6px; box-shadow: 0 4px 0 var(--red-dark); text-align: center; text-decoration: none; }
.cta:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--red-dark); }
.cta:disabled { opacity: .45; cursor: default; transform: none; box-shadow: 0 4px 0 var(--red-dark); }
.btn { display: block; width: 100%; text-align: center; padding: 11px; font-weight: 900; border: 2px solid var(--ink);
  background: var(--paper); border-radius: 6px; text-decoration: none; }
.btn.dark { background: var(--ink); color: var(--paper); }
.chips { display: flex; justify-content: center; gap: 8px; margin-top: 12px; font-size: .75rem; flex-wrap: wrap; }
.chips span { border: 1px solid var(--ink); padding: 2px 8px; border-radius: 3px; background: var(--paper); }
.note { font-size: .75rem; color: var(--muted); }

/* 調味料の画像 */
.timg { position: relative; overflow: hidden; border-radius: 50%; flex: none; background: #e2d5bf; }
.timg img, .timg svg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.notices { background: #fff4d6; border: 2px solid #c98a2e; padding: 8px 12px; margin-bottom: 18px; font-size: .82rem; }
.notices p { margin: 0; }
.notices p + p { margin-top: 6px; }

/* トップ */
.hero { text-align: center; padding: 10px 0 28px; }
.stamp { display: inline-block; color: var(--red); border: 2px solid var(--red); border-radius: 50%; padding: 12px 10px;
  font-weight: 900; font-size: .72rem; transform: rotate(-8deg); line-height: 1.3; }
.hero h1 { font-family: "Zen Old Mincho", serif; font-weight: 900; font-size: clamp(2.1rem, 9vw, 2.8rem); line-height: 1.25; margin: 12px 0 10px; }
.hero h1 em { font-style: normal; color: var(--red); }
.hero .sub { font-size: .9rem; margin: 0 0 20px; }
.trio { display: flex; justify-content: center; gap: 12px; margin-bottom: 24px; }
.trio .timg { width: 92px; height: 92px; box-shadow: 0 6px 12px rgba(80,50,20,.18); }
.trio .timg:nth-child(2) { transform: translateY(-14px); }
.steps { margin: 0; padding: 0; list-style: none; font-size: .88rem; }
.steps li { display: flex; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px dashed var(--rule); }
.steps li:last-child { border-bottom: 0; }
.steps b { width: 28px; height: 28px; border-radius: 50%; background: var(--ink); color: var(--paper); display: grid; place-items: center; flex: none; }
.mini-zukan { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; text-align: center; font-size: .66rem; font-weight: 700; line-height: 1.3; margin-bottom: 14px; }
.mini-zukan a { text-decoration: none; }
.mini-zukan .timg { width: 100%; aspect-ratio: 1; margin-bottom: 4px; }

/* 友達から相性診断が届いたとき */
.pair-banner { display: flex; gap: 12px; align-items: center; background: #fff4d6; border: 2px solid #c98a2e; padding: 10px 12px; margin-bottom: 18px; font-size: .85rem; }
.pair-banner .timg { width: 52px; height: 52px; }
.pair-banner b { font-family: "Zen Old Mincho", serif; }

/* 写真を選ぶ */
.page-title { font-family: "Zen Old Mincho", serif; font-weight: 900; font-size: 1.6rem; text-align: center; margin: 4px 0 16px; }
.slot-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.slot-head .tag { font-size: .7rem; font-weight: 900; padding: 1px 8px; border: 1px solid var(--ink); }
.slot-head .tag.req { background: var(--red); color: #fff; border-color: var(--red); }
.guide { font-size: .8rem; color: var(--muted); margin: 0 0 10px; }
.drop { position: relative; display: block; border: 2px dashed var(--rule); min-height: 200px; background: #f3ead9; overflow: hidden; cursor: pointer; }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop .ph { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: var(--muted); font-size: .9rem; font-weight: 700; pointer-events: none; }
.drop .ph svg { display: block; margin: 0 auto 6px; }
.drop.has-image { border-style: solid; border-color: var(--ink); }
.drop.has-image .ph { display: none; }
.drop canvas { display: block; width: 100%; height: auto; max-height: 360px; object-fit: contain; }
.pick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.pick .btn { font-size: .88rem; padding: 10px 4px; cursor: pointer; }
.dir { margin-top: 8px; font-size: .78rem; }
.dir select { font: inherit; border: 1px solid var(--ink); background: var(--paper); padding: 2px 6px; }
.err { color: var(--red); font-weight: 700; font-size: .85rem; margin: 0 0 12px; }

/* 分析中 */
.scan { position: relative; border: 3px solid var(--ink); background: #000; margin-bottom: 16px; }
.scan canvas { display: block; width: 100%; height: auto; max-height: 60vh; object-fit: contain; }
.scan::after { content: ""; position: absolute; left: 0; right: 0; height: 3px; background: var(--red); box-shadow: 0 0 12px var(--red); animation: scan 1.6s ease-in-out infinite alternate; }
@keyframes scan { from { top: 4%; } to { top: 96%; } }
.scan-msg { text-align: center; font-weight: 900; min-height: 1.7em; }
.progress { height: 10px; background: var(--track); border: 2px solid var(--ink); margin-top: 10px; }
.progress i { display: block; height: 100%; width: 0; background: var(--red); transition: width .3s; }

/* 結果：調味料ボトル */
.bottle { background: var(--paper); border: 3px solid var(--ink); border-radius: 22px 22px 8px 8px; padding: 22px 18px 16px; position: relative; text-align: center; margin: 16px 0 14px; }
.bottle::before { content: ""; position: absolute; top: -17px; left: 50%; transform: translateX(-50%); width: 96px; height: 15px; background: var(--ink); border-radius: 6px 6px 0 0; }
.bottle .timg { width: 170px; height: 170px; margin: 0 auto 12px; }
.kicker { font-size: .75rem; letter-spacing: .3em; color: var(--red); font-weight: 700; }
.tname { font-family: "Zen Old Mincho", serif; font-weight: 900; line-height: 1.2; margin: 2px 0; overflow-wrap: anywhere; }
.tname small { font-size: .5em; }
.tcatch { font-weight: 700; margin: 6px 0 14px; }
/* 日本の食品パッケージの「栄養成分表示」風 */
.facts { border: 1.5px solid var(--ink); text-align: left; font-size: .9rem; background: #fff; }
.facts .t, .facts .per { text-align: center; border-bottom: 1.5px solid var(--ink); padding: 4px 8px; }
.facts .t { font-size: 1rem; font-weight: 700; letter-spacing: .1em; }
.facts .rows { padding: 4px 10px; }
.facts .r { display: flex; justify-content: space-between; gap: 12px; padding: 2px 0; }
.facts .r span:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.facts .rows + .rows { border-top: 1.5px solid var(--ink); }
.card-tag { margin-top: 10px; font-size: .75rem; color: var(--muted); }
.share { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 18px; }
.share .btn { font-size: .85rem; padding: 11px 4px; }
/* 特徴のものさし：左右どちらも褒め言葉 */
.scale { display: grid; grid-template-columns: 1fr 88px 1fr; gap: 8px; align-items: center; font-size: .72rem; padding: 5px 0; line-height: 1.3; }
.scale span:first-child { text-align: right; }
.scale .track { height: 8px; background: var(--track); position: relative; }
.scale .track::before { content: ""; position: absolute; left: 50%; top: -3px; bottom: -3px; border-left: 1px dashed var(--muted); }
.scale .track i { position: absolute; top: 50%; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; background: var(--red); border: 2px solid var(--ink); }
.scale.strong span.on { font-weight: 900; color: var(--red); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.tags span { border: 1px solid var(--ink); background: #fff; padding: 2px 10px; font-size: .78rem; font-weight: 700; }
.partner { display: flex; gap: 14px; align-items: center; text-decoration: none; }
.partner .timg { width: 72px; height: 72px; }
.partner b { font-family: "Zen Old Mincho", serif; font-size: 1.2rem; }
.actions2 { display: grid; gap: 10px; margin-bottom: 18px; }

/* 似合うもの（アフィリエイト） */
.sec h2 .pr { float: right; font-family: "Zen Kaku Gothic New", sans-serif; font-size: .68rem; font-weight: 700; border: 1px solid var(--ink); padding: 0 6px; margin-top: 4px; }
.match { margin: 0; padding: 0; list-style: none; }
.match li { padding: 10px 0; border-bottom: 1px dashed var(--rule); }
.match li:last-child { border-bottom: 0; }
.match .cat { display: inline-block; font-size: .72rem; font-weight: 900; background: var(--ink); color: var(--paper); padding: 0 8px; margin-bottom: 4px; }
.match p { margin: 0 0 6px; font-size: .9rem; }
.match .shop { display: inline-block; font-size: .78rem; font-weight: 700; border: 1.5px solid var(--ink); background: #fff; padding: 3px 10px; border-radius: 4px; text-decoration: none; }

/* 友達との相性 */
.pair-card { text-align: center; }
.pair-imgs { display: flex; justify-content: center; align-items: center; gap: 8px; margin-bottom: 8px; }
.pair-imgs .timg { width: 76px; height: 76px; }
.pair-imgs span { font-size: 1.4rem; font-weight: 900; }
.pair-name { font-family: "Zen Old Mincho", serif; font-weight: 900; font-size: 1.6rem; line-height: 1.3; }
.pair-score { font-size: .9rem; font-weight: 700; color: var(--red); margin-bottom: 8px; }

/* 広告枠 */
.ad-slot { margin: 0 0 18px; text-align: center; }
.ad-slot::before { content: "広告"; display: block; font-size: .65rem; color: var(--muted); margin-bottom: 2px; }

/* 図鑑 */
.zukan-group { margin-bottom: 18px; }
.zukan-group h3 { display: flex; align-items: center; gap: 8px; }
.zukan-group h3 i { width: 12px; height: 12px; border-radius: 50%; background: var(--c); display: inline-block; }
.zukan-item { display: flex; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px dashed var(--rule); text-decoration: none; }
.zukan-item:last-child { border-bottom: 0; }
.zukan-item .timg { width: 64px; height: 64px; }
.zukan-item b { font-family: "Zen Old Mincho", serif; font-size: 1.05rem; display: block; line-height: 1.3; }
.zukan-item small { display: block; font-size: .75rem; color: var(--muted); }
.zukan-item .catch { font-size: .82rem; font-weight: 700; }

/* 開発者向け（ローカルで ?debug のときだけ） */
.debug { border-style: dashed; }
.debug canvas { display: block; width: 100%; height: auto; margin-bottom: 8px; border: 1px solid var(--rule); }
.debug table { width: 100%; border-collapse: collapse; font-size: .72rem; font-variant-numeric: tabular-nums; }
.debug th, .debug td { text-align: left; padding: 3px 4px; border-bottom: 1px solid var(--track); }
.debug .tools { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: .78rem; margin: 8px 0; }
.debug .tools button { border: 1px solid var(--ink); background: #fff; padding: 3px 10px; font-size: .78rem; }
.debug select { font: inherit; max-width: 100%; }
.debug .rank { font-size: .75rem; }

footer { text-align: center; font-size: .75rem; color: var(--muted); padding: 10px 0 40px; }
footer a { margin: 0 6px; }
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(100px); background: var(--ink); color: var(--paper);
  padding: 8px 18px; border-radius: 4px; font-size: .85rem; transition: transform .25s; z-index: 10; }
#toast.show { transform: translateX(-50%) translateY(0); }
