:root {
  --bg: #faf8f5; --surface: #ffffff; --text: #222019; --muted: #6b665c; --line: #e2ddd3;
  --accent: #7a2e2e; --accent-text: #ffffff; --chip-bg: #f0ece4;
  --ok: #2f6b3a; --warn: #8a6a12; --ng: #9a2c2c; --notice-bg: #fff6e0; --notice-line: #e7c873;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #18171a; --surface: #222126; --text: #ece9e3; --muted: #a9a49a; --line: #3a3840;
    --accent: #d98b8b; --accent-text: #18171a; --chip-bg: #2e2c33;
    --ok: #8fd19a; --warn: #e0c87a; --ng: #f0a0a0; --notice-bg: #3a3220; --notice-line: #7a6430;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); line-height: 1.6; font-size: 15px;
  font-family: system-ui, -apple-system, "Hiragino Sans", "Yu Gothic UI", "Meiryo", sans-serif; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.site-header { background: var(--surface); border-bottom: 1px solid var(--line); padding: 14px 0 10px; }
.site-header h1 { font-size: 1.3rem; margin: 4px 0 6px; }
.badges { margin: 0; display: flex; gap: 6px; flex-wrap: wrap; }
.badge-proto, .badge-mode { font-size: .75rem; padding: 1px 8px; border-radius: 3px; border: 1px solid var(--accent); color: var(--accent); }
.badge-mode.is-mock { border-color: var(--warn); color: var(--warn); font-weight: 600; }
.notices { margin: 4px 0; padding-left: 1.2em; font-size: .85rem; color: var(--muted); }
.notices li:first-child { color: var(--text); font-weight: 600; }

.profile-row { display: flex; gap: 8px; align-items: center; margin: 14px 0 0; font-size: .9rem; color: var(--muted); }
select, .inputs input { font: inherit; padding: 6px 8px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--text); }
.inputs { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 0 0 8px; font-size: .9rem; }
.inputs label { display: flex; gap: 6px; align-items: center; }
.inputs input[type=number] { width: 5em; }
.search-form { display: flex; gap: 8px; margin: 10px 0 10px; }
.search-form input { flex: 1; min-width: 0; font-size: 1rem; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 6px; background: var(--surface); color: var(--text); }
button { font: inherit; padding: 9px 18px; border-radius: 6px; border: 1px solid var(--accent); background: var(--accent);
  color: var(--accent-text); cursor: pointer; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin: 10px 0; }
.panel-title { font-size: .9rem; margin: 0 0 6px; color: var(--muted); font-weight: 600; cursor: default; }
details.panel > summary { cursor: pointer; }
.preset-group { margin: 4px 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.preset-group-label { color: var(--muted); font-size: .8rem; min-width: 3.5em; }
.chip { font-size: .85rem; padding: 3px 12px; border-radius: 999px; background: var(--chip-bg); color: var(--text); border: 1px solid var(--line); }
.chip[aria-pressed="true"] { border-color: var(--accent); background: var(--accent); color: var(--accent-text); }
.hint { font-size: .8rem; color: var(--muted); margin: 6px 0 0; }
.source-select { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: .9rem; margin-top: 6px; }
.source-option { display: flex; gap: 6px; align-items: center; }
.avail-note { font-size: .75rem; color: var(--warn); }

.status { min-height: 1.5em; color: var(--muted); font-size: .9rem; }
.status.error { color: var(--ng); }

.outcomes { display: grid; gap: 4px; margin: 6px 0 12px; }
.outcome { display: grid; grid-template-columns: minmax(9em, auto) 1fr; gap: 2px 12px; font-size: .85rem; padding: 6px 10px;
  border-left: 4px solid var(--line); background: var(--surface); border-radius: 4px; }
.outcome-name { font-weight: 600; }
.outcome-name .provider-name { margin-left: 6px; }
.outcome-note { grid-column: 2; color: var(--muted); font-size: .8rem; }
.outcome-ok { border-left-color: var(--ok); }
.outcome-empty, .outcome-withheld, .outcome-unsupported, .outcome-skipped { border-left-color: var(--warn); }
.outcome-error, .outcome-timeout { border-left-color: var(--ng); }
.outcome-not_selected, .outcome-unavailable { opacity: .75; }

.result-tools { margin: 4px 0 8px; }
.filter-chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* One column on purpose: a multi-column grid would line interleaved sources up as per-store columns. */
.results { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; grid-template-columns: minmax(0, 1fr); max-width: 860px; }
.card { display: grid; grid-template-columns: 80px minmax(0, 1fr); gap: 12px; padding: 12px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 8px; }
.card:not(:has(.ph)) { grid-template-columns: 1fr; }
.ph { width: 80px; height: 80px; border-radius: 6px; display: flex; align-items: center; justify-content: center; text-align: center;
  white-space: pre-line; font-size: .66rem; line-height: 1.3; color: var(--muted); border: 1px solid var(--line);
  background: repeating-linear-gradient(45deg, var(--chip-bg), var(--chip-bg) 6px, var(--surface) 6px, var(--surface) 12px); }
.source-line { margin: 0 0 2px; display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; font-size: .78rem; }
.source-name { font-weight: 700; }
.provider-name { color: var(--muted); font-size: .75rem; }
.pr { font-size: .68rem; padding: 0 5px; border: 1px solid var(--muted); border-radius: 3px; color: var(--muted); }
.rank { color: var(--muted); margin-left: auto; }
.card-title { font-size: .95rem; margin: 0 0 2px; overflow-wrap: anywhere; }
.price { font-weight: 600; margin: 2px 0; }
.was { font-weight: normal; color: var(--muted); text-decoration: line-through; font-size: .85rem; margin-left: 6px; }
.meta { font-size: .78rem; color: var(--muted); margin: 0; overflow-wrap: anywhere; }
.desc { font-size: .82rem; color: var(--muted); margin: 4px 0; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 0 10px; font-size: .82rem; margin: 4px 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.hints { display: flex; flex-wrap: wrap; gap: 4px; }
.hint-badge { font-size: .7rem; padding: 0 6px; border: 1px solid var(--warn); color: var(--warn); border-radius: 3px; }
.actions { margin-top: 6px; }
.go-disabled { font-size: .8rem; padding: 3px 10px; border: 1px dashed var(--line); border-radius: 6px; color: var(--muted); }
.site-footer { font-size: .8rem; color: var(--muted); padding: 24px 16px 40px; }
.credits a { color: inherit; }
.link-note { display: block; font-size: .75rem; color: var(--muted); margin-top: 4px; }

@media (max-width: 560px) {
  .card { grid-template-columns: 64px minmax(0, 1fr); }
  .ph { width: 64px; height: 64px; }
  .outcome { grid-template-columns: 1fr; }
  .outcome-note { grid-column: 1; }
  .rank { margin-left: 0; }
}

/* store-separated display */
.site-nav { margin: 4px 0 0; font-size: .85rem; }
.site-nav a { color: inherit; }
.groups { display: grid; gap: 18px; }
.store-group-title { font-size: 1rem; margin: 8px 0 6px; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.guide { max-width: 760px; }
.guide dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; }
.guide dt { color: var(--muted); }
.guide dd { margin: 0; }

/* genre judgements (display only) */
.annotations { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin-top: 2px; }
.ann { font-size: .7rem; padding: 0 6px; border-radius: 3px; border: 1px solid var(--line); color: var(--muted); }
.ann-strong { border-color: var(--accent, #2b6cb0); color: var(--accent, #2b6cb0); }
.ann-weak { border-style: dashed; }
.ann-basis { font-size: .72rem; color: var(--muted); }
.ann-basis summary { cursor: pointer; }
.ann-basis p { margin: 2px 0; }
.store-summary { font-size: .78rem; color: var(--muted); margin: 0 0 6px; }

.pickup-toggle { font-size: .85rem; margin: 6px 0; }
.unconfirmed { margin: 6px 0 0; }
.unconfirmed > summary { cursor: pointer; font-size: .85rem; color: var(--muted); }
.store-note { font-size: .78rem; color: var(--warn); margin: 0 0 6px; }

/* ---- top page: general search site layout ---- */
.header-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.logo { font-weight: 700; font-size: 1.25rem; color: var(--text); text-decoration: none; letter-spacing: .02em; }
.logo-sub { font-weight: 400; font-size: .85rem; color: var(--muted); margin-left: 8px; }
.site-header .site-nav { display: flex; gap: 14px; margin: 0; font-size: .9rem; }
.site-header .site-nav a { color: var(--text); text-decoration: none; }
.site-header .site-nav a:hover { text-decoration: underline; }
.hero { background: var(--surface); border-bottom: 1px solid var(--line); padding: 18px 0 14px; }
.hero-title { font-size: 1.45rem; margin: 6px 0 12px; }
.genre-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.genre-tab { font-size: .85rem; padding: 5px 14px; border-radius: 999px; background: var(--chip-bg); color: var(--text); border: 1px solid var(--line); }
.genre-tab[aria-selected="true"] { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.hero .search-form input { font-size: 1.05rem; padding: 12px 14px; }
.hero .search-form button { padding: 0 22px; }
.notice-lead { font-size: .8rem; color: var(--muted); margin: 6px 0 0; }
.entry { margin: 14px 0; }
.entry-grid { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 760px) { .entry-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.entry-card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
#stores-card { margin-top: 10px; }
.entry-title { font-size: .95rem; margin: 0 0 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.store-links { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: .9rem; }
.store-links .provider-name { margin-left: 6px; }
body.has-results .entry { display: none; }
.notices-more { margin-top: 18px; }
.variants { margin-top: 6px; }
.variants > summary { cursor: pointer; font-size: .8rem; color: var(--muted); }
.variants .card { border-style: dashed; }

/* ---- results: overview + compact store blocks ---- */
.outcomes { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin: 8px 0 14px; }
.overview-title { font-size: 1.05rem; margin: 0 0 6px; }
.overview { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.overview-item { display: flex; flex-wrap: wrap; gap: 2px 10px; align-items: baseline; font-size: .9rem; padding-left: 10px; border-left: 4px solid var(--line); }
.overview-item.st-ok { border-left-color: var(--ok); }
.overview-item.st-empty { border-left-color: var(--warn); }
.overview-item.st-ng { border-left-color: var(--ng); }
.overview-item.st-off { opacity: .75; }
.overview-store { font-weight: 600; background: none; border: 0; padding: 0; color: var(--text); font-size: inherit; cursor: default; }
button.overview-store { cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.overview-status { color: var(--muted); font-size: .85rem; }
.store-group { margin: 18px 0 24px; }
.store-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; border-bottom: 2px solid var(--accent); padding-bottom: 4px; margin-bottom: 6px; }
.store-head .store-group-title { margin: 0; font-size: 1.1rem; display: flex; gap: 8px; align-items: baseline; }
.store-status { margin: 0; font-size: .85rem; color: var(--muted); }
.store-items { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 8px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 760px) { .store-items { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1040px) { .store-items { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.store-items .card { grid-template-columns: 56px minmax(0, 1fr); gap: 10px; padding: 10px; position: relative; }
.store-items .ph { width: 56px; height: 56px; font-size: .62rem; }
.thumb { width: 56px; height: 56px; object-fit: cover; border-radius: 6px; }
.card-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; margin: 2px 0; }
.qty { font-size: .78rem; padding: 0 6px; border-radius: 3px; background: var(--chip-bg); color: var(--text); }
.more { margin-top: 8px; background: var(--surface); color: var(--accent); border: 1px solid var(--accent); }
.variant-list { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 6px; }
.variant-list .card { grid-template-columns: 1fr; border-style: dashed; padding: 8px; }
.variant-list .ph { display: none; }
.store-cat { font-size: .72rem; color: var(--muted); margin-left: 4px; }
.store-links li { display: flex; align-items: center; }
.px { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
/* The HTML hidden attribute must win over display rules (folded items are neither shown nor measured). */
[hidden] { display: none !important; }
/* Larger product images: side thumbnail on phones, image on top of the card on wider screens. */
.store-items .card { grid-template-columns: 88px minmax(0, 1fr); }
.store-items .ph, .thumb { width: 88px; height: 88px; }
.thumb { object-fit: contain; background: #fff; border: 1px solid var(--line); }
@media (min-width: 760px) {
  .store-items .card { grid-template-columns: minmax(0, 1fr); align-content: start; }
  .store-items .card > .thumb, .store-items .card > .ph { width: 100%; height: 150px; }
  .store-items .card > .ph { font-size: .75rem; }
}
.store-items .desc { margin: 2px 0 4px; font-size: .8rem; line-height: 1.5; }
.seller { font-size: .78rem; color: var(--muted); margin: 2px 0; }
.same-as .hint { margin: 2px 0; font-size: .78rem; }

/* Folded sources (e.g. other shops of a mall): last, closed by default. */
.fold-group { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin: 28px 0 10px; }
.fold-group > summary { cursor: pointer; font-weight: 600; color: var(--muted); }
.fold-group[open] > summary { margin-bottom: 8px; }
.genre-tabs[hidden] { display: none; }
.hero-lead { margin: -4px 0 12px; color: var(--muted); font-size: .95rem; }
.cta { font-weight: 600; }
