:root {
  --bg: #fafaf7; --fg: #1d1d1b; --muted: #77746d; --line: #e4e1da;
  --card: #fff; --accent: #e8542f; --accent-fg: #fff;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #141413; --fg: #ecebe6; --muted: #9a978f; --line: #2c2b28; --card: #1d1c1a; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg);
  font-family: "Noto Sans JP", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
  font-feature-settings: "palt"; -webkit-font-smoothing: antialiased; line-height: 1.5; }
header { position: sticky; top: 0; z-index: 2; background: var(--bg); border-bottom: 1px solid var(--line);
  padding: 10px 16px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
h1 { font-size: 18px; margin: 0; }
nav { display: flex; gap: 4px; }
.tab { border: 1px solid var(--line); background: none; color: var(--fg); padding: 6px 12px; border-radius: 999px; cursor: pointer; }
.tab.active { background: var(--fg); color: var(--bg); }
main { max-width: 720px; margin: 0 auto; padding: 16px; }
.shoot { display: flex; align-items: center; justify-content: center; min-height: 200px; border: 2px dashed var(--line);
  border-radius: 16px; cursor: pointer; overflow: hidden; background: var(--card); }
.shoot img { width: 100%; max-height: 420px; object-fit: contain; }
input[type=text], textarea { width: 100%; padding: 10px 12px; margin-top: 10px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--card); color: var(--fg); font: inherit; }
button { font: inherit; cursor: pointer; }
.primary { width: 100%; margin-top: 10px; padding: 12px; border: 0; border-radius: 10px; background: var(--accent);
  color: var(--accent-fg); font-weight: 700; }
.primary:disabled { opacity: .4; cursor: default; }
.status { margin-top: 12px; color: var(--muted); }
.card { margin-top: 16px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); }
.card h3 { margin: 0 0 6px; font-size: 16px; }
.muted { color: var(--muted); font-size: 13px; }
.badge { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line); margin-left: 6px; }
#requery { display: flex; gap: 8px; align-items: end; }
#requery input { flex: 1; }
#requery button { padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--fg); white-space: nowrap; }
.shop { margin-top: 20px; }
.shop h4 { margin: 0 0 8px; font-size: 15px; }
.items { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.item { position: relative; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px;
  background: var(--card); overflow: hidden; color: inherit; text-decoration: none; }
.item img, .item .noimg { width: 100%; aspect-ratio: 1; object-fit: contain; background: #fff; }
.item .noimg { display: flex; align-items: center; justify-content: center; color: #999; font-size: 28px; }
.item .body { padding: 8px; font-size: 13px; }
.item .title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.item .price { font-weight: 700; margin-top: 4px; }
.item .pick { position: absolute; top: 6px; left: 6px; width: 20px; height: 20px; }
.searchlink { display: block; padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--card);
  color: inherit; text-decoration: none; font-weight: 600; }
.post { margin-bottom: 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--card); overflow: hidden; }
.post > img { width: 100%; max-height: 520px; object-fit: cover; display: block; }
.post .meta { padding: 10px 14px; }
.post .actions { display: flex; gap: 12px; align-items: center; margin-top: 6px; }
.post .actions button { background: none; border: 0; color: var(--fg); padding: 0; }
.post .items { padding: 0 14px 14px; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
footer { max-width: 720px; margin: 24px auto; padding: 0 16px 24px; }

#shoot-label { text-align: center; font-size: 22px; font-weight: 700; color: var(--muted); }
.shoot { min-height: 320px; }
.product { margin-top: 20px; text-align: center; }
.product h2 { margin: 4px 0; font-size: 22px; }
.link { background: none; border: 0; color: var(--muted); text-decoration: underline; font-size: 13px; }
#fix { display: flex; gap: 8px; align-items: end; }
#fix input { flex: 1; }
#fix button { padding: 10px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--fg); }
.buy { display: block; margin-top: 18px; padding: 18px; border-radius: 14px; background: #ff9900; color: #111;
  text-align: center; font-size: 20px; font-weight: 800; text-decoration: none; }
.buy-sub { display: flex; gap: 8px; margin-top: 10px; }
.buy-sub a { flex: 1; padding: 12px; border: 1px solid var(--line); border-radius: 12px; text-align: center;
  color: var(--fg); background: var(--card); text-decoration: none; font-size: 14px; }
.share { margin-top: 24px; }
.share summary { color: var(--muted); cursor: pointer; }
.post .buy { margin: 0 14px 14px; padding: 12px; font-size: 16px; }
.post .buy-sub { margin: 0 14px 14px; }
[hidden] { display: none !important; }
.pick-lib { display: block; margin-top: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--card); text-align: center; font-weight: 700; cursor: pointer; }
.center-text { text-align: center; margin: 6px 0 0; }
.buy { border-radius: 14px; font-size: 18px; }
.buy-sub a { border: 0; background: #f3f2ee; color: #333; font-weight: 600; }
@media (prefers-color-scheme: dark) { .buy-sub a { background: #2a2926; color: #ddd; } }
.product h2 { font-size: 20px; }

.acts { display: flex; gap: 8px; margin-top: 14px; }
.act { flex: 1; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: none; color: var(--fg); font-weight: 600; }
.act.on { color: var(--accent); border-color: var(--accent); }
.share-menu { display: flex; gap: 8px; margin-top: 8px; }
.share-menu > * { flex: 1; padding: 10px; border-radius: 12px; border: 0; background: #f3f2ee; color: #333; font: inherit;
  font-size: 14px; font-weight: 600; text-align: center; text-decoration: none; }
#share-line { background: #06c755; color: #fff; }
@media (prefers-color-scheme: dark) { .share-menu > *:not(#share-line) { background: #2a2926; color: #ddd; } }
.again { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 3;
  width: 68px; height: 68px; border-radius: 50%; background: var(--fg); color: var(--bg); font-size: 28px;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 16px rgba(0,0,0,.25); cursor: pointer; }
body.has-again { padding-bottom: 100px; }
.saved-item { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.saved-item img, .saved-item .noimg { width: 64px; height: 64px; border-radius: 10px; object-fit: cover; background: var(--card); flex: none; }
.saved-item .body { flex: 1; min-width: 0; }
.saved-item .name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.saved-item .row { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.saved-item .row a, .saved-item .row button { padding: 6px 10px; border-radius: 999px; border: 1px solid var(--line); background: none;
  color: var(--fg); font-size: 13px; text-decoration: none; }
.saved-item .row a.amz { background: #ff9900; border-color: #ff9900; color: #111; font-weight: 700; }
h1, .tab { white-space: nowrap; }
@media (max-width: 420px) { h1 { font-size: 16px; } .tab { padding: 6px 10px; font-size: 13px; } }
.share-menu > * { white-space: nowrap; padding: 10px 6px; display: flex; align-items: center; justify-content: center; }
.saved-item .row button.del { margin-left: auto; border: 0; color: var(--muted); padding: 6px 4px; }

/* 写真の上に商品名タグ（複数商品をタップで切替）*/
.stage { text-align: center; }
.stage-box { position: relative; display: inline-block; max-width: 100%; vertical-align: top; }
.stage-box img { display: block; max-width: 100%; max-height: 62vh; border-radius: 16px; }
.tag { position: absolute; transform: translate(-50%, -50%); border: 0; background: none; padding: 0; cursor: pointer; }
.tag .dot { display: block; width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 3px solid rgba(0,0,0,.55);
  box-shadow: 0 0 0 4px rgba(255,255,255,.35); }
.tag .lbl { position: absolute; left: 50%; bottom: 30px; transform: translateX(var(--tx, -50%)); max-width: 46vw; padding: 6px 10px;
  border-radius: 999px; background: rgba(20,20,19,.82); color: #fff; font-size: 12px; font-weight: 700; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; }
.tag .lbl::after { content: ""; position: absolute; left: var(--ax, 50%); top: 100%; width: 2px; height: 10px; background: rgba(20,20,19,.82); transform: translateX(-50%); }
.tag.below .lbl { bottom: auto; top: 30px; }
.tag.below .lbl::after { top: auto; bottom: 100%; }
.tag.sel .dot { background: var(--accent); border-color: #fff; }
.tag.sel .lbl { background: var(--accent); }
.tag.sel .lbl::after { background: var(--accent); }
.tag.sel { z-index: 2; }
.stage-box img { max-height: 48vh; }
.again { left: auto; right: 16px; transform: none; width: 60px; height: 60px; font-size: 24px; }
.stage:not([hidden]) + .pick-lib { padding: 8px; font-weight: 600; font-size: 14px; border: 0; background: none; color: var(--muted); }

/* 購入ボタンは日本語フォントで太く、くっきり */
.buy, .buy-sub a, .saved-item .row a, .act, .share-menu > * { font-family: "Noto Sans JP", "Hiragino Sans", "Yu Gothic", Meiryo, sans-serif; letter-spacing: .02em; }
.buy { font-weight: 900; }
.buy-sub a { font-weight: 700; font-size: 15px; }

.ico { width: 1.1em; height: 1.1em; vertical-align: -0.18em; --ico-hole: var(--card); }
#shoot-label .ico { width: 56px; height: 56px; color: var(--accent); }
.again .ico { width: 30px; height: 30px; --ico-hole: var(--fg); color: var(--bg); }
.again { background: var(--accent); }
.again .ico { color: #fff; --ico-hole: var(--accent); }
.pick-lib .ico { color: var(--muted); }
.acts .act { font-size: 14px; padding: 10px 4px; white-space: nowrap; }

/* 広告表記: 購入ボタンの右上に小さく「PR」。詳しくはヘルプ */
.pr { display: block; width: fit-content; margin: 14px 0 -10px auto; padding: 1px 7px; border: 1px solid var(--line); border-radius: 4px;
  font-size: 11px; font-weight: 700; color: var(--muted); text-decoration: none; letter-spacing: .05em; }
.post .pr { margin: 0 14px 6px auto; }
.help-btn { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid var(--line); color: var(--fg); text-decoration: none; font-weight: 700; }
nav { align-items: center; }
.home { color: inherit; text-decoration: none; }
a.tab { text-decoration: none; }
.help h2 { font-size: 18px; margin: 28px 0 10px; }
.help h2:first-child { margin-top: 8px; }
.help ol, .help ul { padding-left: 1.3em; }
.help li { margin-bottom: 12px; }
.help p { margin: 0 0 10px; }
.help h3 { font-size: 15px; margin: 20px 0 6px; }
.help-links { margin-top: 28px !important; font-size: 13px; }
.ad-slot { margin: 32px 0 8px; min-height: 100px; }
.ad-slot[hidden] { display: none; }

/* おすすめ（写真の商品に合わせたPR）*/
.reco { margin-top: 22px; }
.reco-head { display: flex; align-items: center; justify-content: space-between; font-size: 14px; font-weight: 700; color: var(--muted); }
.reco-head .pr { margin: 0; }
.reco-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.reco-item { display: flex; gap: 8px; }
.reco-main { flex: 1; padding: 12px 14px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); color: var(--fg);
  text-decoration: none; font-weight: 700; font-size: 15px; }
.reco-main::after { content: "Amazon ›"; float: right; color: var(--muted); font-size: 12px; font-weight: 700; margin-top: 2px; }
.reco-sub { padding: 12px 14px; border-radius: 12px; background: #f3f2ee; color: #333; text-decoration: none; font-weight: 700; font-size: 13px; }
@media (prefers-color-scheme: dark) { .reco-sub { background: #2a2926; color: #ddd; } }
.reco-sub { display: flex; align-items: center; }

.feed-search { position: sticky; top: 58px; z-index: 1; background: var(--bg); padding: 4px 0 12px; }
.feed-search input { margin-top: 0; border-radius: 999px; padding: 10px 16px; }
.feed-search input { width: 100%; }
.post .actions .report { margin-left: auto; font-size: 12px; color: var(--muted, #8a877f); }
/* Amazon と楽天を横並び（楽天は楽天レッド） */
.buy-row { display: flex; gap: 8px; margin-top: 18px; }
.buy-row .buy { flex: 1; min-width: 0; margin: 0; padding: 16px 8px; font-size: 16px; white-space: nowrap; }
.buy.rakuten { background: #BF0000; color: #fff; }
.post .buy-row { margin: 0 14px 14px; }
.post .buy-row .buy { margin: 0; padding: 12px 6px; font-size: 15px; }
h1.logo { line-height: 0; }
h1.logo img { height: 26px; width: auto; display: block; }
@media (max-width: 420px) { h1.logo img { height: 20px; } }
/* 指で囲んで探す */
#lasso { position: absolute; inset: 0; border-radius: 16px; touch-action: none; cursor: crosshair; background: rgba(0,0,0,.18); }
.lasso-btn { display: inline-flex; align-items: center; gap: 6px; margin: 10px 4px 0; padding: 8px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card); color: var(--fg); font: inherit; font-weight: 700; font-size: 14px; cursor: pointer; }
.lasso-btn .ico { width: 18px; height: 18px; }
.lasso-btn.on { background: #E8542F; border-color: #E8542F; color: #fff; }
/* Android用ページ内カメラ */
.cam { position: fixed; inset: 0; z-index: 50; background: #000; display: flex; flex-direction: column; }
.cam video { flex: 1; width: 100%; min-height: 0; object-fit: cover; }
.cam-close { position: absolute; top: calc(12px + env(safe-area-inset-top)); left: 12px; width: 44px; height: 44px; border-radius: 50%;
  border: 0; background: rgba(0,0,0,.45); color: #fff; font-size: 28px; line-height: 1; }
.cam-bar { display: flex; align-items: center; justify-content: space-around; padding: 20px 0 calc(24px + env(safe-area-inset-bottom)); background: #000; }
.cam-shutter { width: 76px; height: 76px; border-radius: 50%; border: 4px solid #fff; background: #fff; box-shadow: inset 0 0 0 4px #000; }
.cam-shutter:active { transform: scale(.92); }
.cam-lib { width: 52px; height: 52px; border-radius: 50%; background: rgba(255,255,255,.15); color: #fff; display: flex; align-items: center; justify-content: center; }
.cam-lib svg { width: 26px; height: 26px; }
body.cam-open { overflow: hidden; }
/* 履歴 */
.history { margin-top: 24px; }
.history-head { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 13px; font-weight: 700; margin-bottom: 8px; }
.history-head .link { font-size: 13px; color: var(--muted); }
.history-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.history-item { border: 0; padding: 0; background: none; color: var(--fg); text-align: left; cursor: pointer; min-width: 0; }
.history-item img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; background: var(--card); display: block; }
.history-item span { display: block; font-size: 12px; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#home-logo { cursor: pointer; }
