/* ブロマイド選択ツール - ヤフオク風の一覧デザイン */
:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --border: #d8dbe0;
  --text: #202328;
  --muted: #6b7280;
  --accent: #ff0033;
  --accent-dark: #d2002a;
  --link: #0f62c9;
  --price: #d2002a;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.6;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
.small { font-size: 12px; color: var(--muted); }
.mono { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; }
.right { text-align: right; }

/* ---------------------------------------------------------- ヘッダー */
.site-header {
  background: #fff;
  border-bottom: 3px solid var(--accent);
  position: sticky;
  top: 0;
  z-index: 20;
}
.header-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.logo {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}
.logo:hover { text-decoration: none; color: var(--accent); }
.search { flex: 1 1 320px; display: flex; min-width: 260px; }
.search input {
  flex: 1;
  padding: 8px 10px;
  border: 2px solid var(--border);
  border-right: none;
  border-radius: 4px 0 0 4px;
  font-size: 14px;
}
.search input:focus { outline: none; border-color: var(--accent); }
.search button {
  padding: 8px 18px;
  border: none;
  border-radius: 0 4px 4px 0;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}
.search button:hover { background: var(--accent-dark); }
.selection-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
  color: var(--text);
  font-weight: 600;
  white-space: nowrap;
}
.selection-link:hover { text-decoration: none; border-color: var(--accent); }
.badge {
  min-width: 22px;
  padding: 1px 7px;
  border-radius: 11px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  text-align: center;
}
.badge-plain { background: var(--muted); }

/* ツール名の右隣のログイン/ユーザ名 */
.auth-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-weight: 600;
  white-space: nowrap;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.auth-link:hover { text-decoration: none; border-color: var(--accent); color: var(--accent); }
.auth-icon { font-size: 13px; }
.inline-form { display: inline; }
.link-button {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--link);
  cursor: pointer;
  text-decoration: none;
}
.link-button:hover { text-decoration: underline; }

/* ---------------------------------------------------------- レイアウト */
.container { max-width: 1180px; margin: 0 auto; padding: 16px; }
.layout { display: grid; grid-template-columns: 220px 1fr; gap: 16px; align-items: start; }
@media (max-width: 860px) { .layout { grid-template-columns: 1fr; } }

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
  margin-bottom: 12px;
}
.panel-title {
  margin: 0 0 10px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border);
  font-size: 14px;
  font-weight: 700;
}

/* 折りたたみパネル（スマホのみ折りたたむ。PCでは常に開いた見た目） */
.collapsible > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.collapsible > summary::-webkit-details-marker { display: none; }
/* 閉じているときは見出し下の罫線と余白を詰めて、商品一覧を上に寄せる */
.collapsible:not([open]) > summary {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}
.collapsible > summary::after {
  content: "";
  width: 8px;
  height: 8px;
  margin-bottom: 6px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform .15s;
}
.collapsible[open] > summary::after { transform: rotate(-135deg); margin-bottom: 2px; }
.filter-on {
  margin-left: auto;
  margin-right: 4px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 3px;
}
@media (min-width: 861px) {
  /* PCでは開いたまま固定し、開閉の矢印も出さない */
  .collapsible > summary { cursor: default; pointer-events: none; }
  .collapsible > summary::after { content: none; }
}
.page-title { font-size: 20px; margin: 4px 0 16px; }
.section-title { font-size: 16px; margin: 24px 0 12px; }

.messages { max-width: 1180px; margin: 12px auto 0; padding: 0 16px; }
.message { padding: 10px 14px; border-radius: 4px; margin-bottom: 8px; }
.message-error { background: #ffe9ec; border: 1px solid #ffbcc6; color: #a1001f; }
.message-info, .message-success { background: #e8f3ff; border: 1px solid #b9d8ff; color: #0b4a95; }

/* ---------------------------------------------------------- 絞り込み */
.filter-form .field { display: block; margin-bottom: 10px; }
.field > span, .field > label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.filter-form input, .filter-form select,
.form-panel input, .form-panel textarea {
  width: 100%;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 14px;
  font-family: inherit;
}
.filter-form input:focus, .filter-form select:focus,
.form-panel input:focus, .form-panel textarea:focus {
  outline: none; border-color: var(--accent);
}
.facet-list { list-style: none; margin: 0; padding: 0; max-height: 320px; overflow-y: auto; }
.facet-list li { border-bottom: 1px dotted var(--border); }
.facet-list a { display: flex; justify-content: space-between; gap: 8px; padding: 6px 2px; font-size: 13px; }
.facet-list a.active { font-weight: 700; color: var(--accent); }
.facet-count { color: var(--muted); font-size: 11px; }

/* ---------------------------------------------------------- ボタン */
.btn {
  display: inline-block;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
}
.btn:hover { text-decoration: none; background: #f0f1f4; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-lg { padding: 12px 22px; font-size: 16px; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-block { display: block; width: 100%; margin-top: 8px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------------------------------------------------------- 商品グリッド */
.results-header {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; flex-wrap: wrap; margin-bottom: 12px;
}
.result-count { margin: 0; }
.result-count strong { font-size: 18px; color: var(--accent); }

.product-grid {
  list-style: none; margin: 0; padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}
.product-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow .15s, border-color .15s;
}
.product-card:hover { box-shadow: 0 2px 10px rgba(0,0,0,.1); }
.product-card.is-selected { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(255,0,51,.15); }
.thumb {
  position: relative;
  display: block;
  aspect-ratio: 1 / 1;
  background: #eceef1;
  overflow: hidden;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.no-image {
  display: flex; align-items: center; justify-content: center;
  height: 100%; color: var(--muted); font-size: 12px; letter-spacing: .1em;
}
.r18-tag {
  position: absolute; top: 6px; left: 6px;
  background: var(--accent); color: #fff;
  font-size: 11px; font-weight: 700; padding: 2px 6px; border-radius: 3px;
}
.r18-tag.static { position: static; display: inline-block; }
.image-count {
  position: absolute; right: 6px; bottom: 6px;
  background: rgba(0,0,0,.6); color: #fff;
  font-size: 11px; padding: 1px 6px; border-radius: 3px;
}
.card-body { padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.card-name {
  font-size: 13px; line-height: 1.4; color: var(--link);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-category { margin: 0; font-size: 11px; color: var(--muted); }
.card-price {
  margin: 2px 0 6px;
  font-size: 18px;
  font-weight: 700;
  color: var(--price);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
}
.card-price .yen { font-size: 12px; margin-left: 2px; font-weight: 400; }
/* 金額の右隣に出す「一覧から消えるまで」 */
.card-remaining {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.card-remaining.is-soon { color: var(--accent); }
.card-remaining.is-ended { color: var(--muted); }
.card-actions { margin-top: auto; display: flex; flex-direction: column; gap: 4px; }
.btn-select {
  width: 100%; padding: 7px; border-radius: 4px; cursor: pointer;
  border: 1px solid var(--accent); background: #fff; color: var(--accent);
  font-weight: 700; font-size: 13px; font-family: inherit;
}
.btn-select:hover { background: #fff0f3; }
.btn-select .label-on { display: none; }
.is-selected .btn-select { background: var(--accent); color: #fff; }
.is-selected .btn-select .label-on { display: inline; }
.is-selected .btn-select .label-off { display: none; }

/* ウォッチリスト */
.btn-watch {
  width: 100%; padding: 5px; border-radius: 4px; cursor: pointer;
  border: 1px solid var(--border); background: #fff; color: var(--muted);
  font-weight: 600; font-size: 12px; font-family: inherit;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.btn-watch:hover { background: #fffaf0; border-color: #e8b93a; color: #a97b00; }
.btn-watch .label-on { display: none; }
.is-watched .btn-watch,
.btn-watch.is-on { border-color: #e8b93a; color: #a97b00; background: #fffaf0; }
.is-watched .btn-watch .label-on { display: inline; }
.is-watched .btn-watch .label-off { display: none; }
.detail-watch { margin-top: 8px; }

.empty {
  background: var(--panel); border: 1px solid var(--border); border-radius: 6px;
  padding: 40px 20px; text-align: center;
}

/* ---------------------------------------------------------- ページ送り */
.pagination { display: flex; gap: 4px; justify-content: center; flex-wrap: wrap; margin: 20px 0; }
.pagination a, .pagination span {
  min-width: 34px; padding: 6px 10px; text-align: center;
  border: 1px solid var(--border); border-radius: 4px; background: #fff;
}
.pagination a:hover { background: #f0f1f4; text-decoration: none; }
.pagination .current { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
.pagination .disabled { color: #bbb; background: #fafafa; }

/* ---------------------------------------------------------- 詳細 */
.breadcrumb { display: flex; gap: 6px; flex-wrap: wrap; font-size: 12px; margin-bottom: 12px; color: var(--muted); }
.detail {
  display: grid; grid-template-columns: 1.1fr 1fr; gap: 20px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 6px; padding: 16px;
}
@media (max-width: 760px) { .detail { grid-template-columns: 1fr; } }
.main-image { background: #eceef1; border-radius: 4px; overflow: hidden; aspect-ratio: 4 / 3; }
.main-image img { width: 100%; height: 100%; object-fit: contain; }
.thumb-strip { list-style: none; display: flex; gap: 6px; padding: 8px 0 0; margin: 0; flex-wrap: wrap; }
.thumb-btn {
  width: 64px; height: 64px; padding: 0; cursor: pointer;
  border: 2px solid var(--border); border-radius: 4px; background: #fff; overflow: hidden;
}
.thumb-btn.active { border-color: var(--accent); }
.thumb-btn img { width: 100%; height: 100%; object-fit: cover; }
.detail-name { font-size: 18px; margin: 0 0 8px; line-height: 1.5; }
.detail-price { font-size: 30px; font-weight: 700; color: var(--price); margin: 12px 0; }
.detail-price .yen { font-size: 14px; font-weight: 400; margin-left: 3px; }
.spec { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 13px; }
.spec th, .spec td { border-bottom: 1px solid var(--border); padding: 7px 6px; text-align: left; }
.spec th { width: 90px; color: var(--muted); font-weight: 600; background: #fafbfc; }
.detail-select .btn { width: 100%; }
.note { margin-top: 8px; }

/* ---------------------------------------------------------- 選択内容 */
.selection-layout { display: grid; grid-template-columns: 1fr 340px; gap: 16px; align-items: start; }
@media (max-width: 860px) { .selection-layout { grid-template-columns: 1fr; } }
.selected-list { background: var(--panel); border: 1px solid var(--border); border-radius: 6px; padding: 12px; }
.selected-table { width: 100%; border-collapse: collapse; }
.selected-table th, .selected-table td { border-bottom: 1px solid var(--border); padding: 8px 6px; vertical-align: top; }
.selected-table thead th { font-size: 12px; color: var(--muted); text-align: left; }
.selected-table tfoot td { border-bottom: none; padding-top: 12px; }
.cell-thumb { width: 76px; }
.cell-thumb img { width: 68px; height: 68px; object-fit: cover; border-radius: 4px; }
.cell-price { text-align: right; white-space: nowrap; color: var(--price); font-weight: 700; }
.cell-action { width: 60px; text-align: right; }
.selection-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.form-panel .field { margin-bottom: 12px; }
.form-panel label { font-weight: 600; font-size: 13px; }
.required { background: var(--accent); color: #fff; font-size: 10px; padding: 1px 5px; border-radius: 3px; margin-left: 4px; }
.field-error { color: var(--accent-dark); font-size: 12px; margin: 4px 0 0; }
.form-errors { background: #ffe9ec; border: 1px solid #ffbcc6; padding: 8px; border-radius: 4px; margin-bottom: 10px; }
.selected-table.compact td { padding: 6px 4px; font-size: 13px; }
.done { background: var(--panel); border: 1px solid var(--border); border-radius: 6px; padding: 24px; }
.done-lead { font-size: 15px; }

/* ---------------------------------------------------------- 認証・マイページ */
.auth-page { max-width: 460px; margin: 0 auto; }
.auth-panel { padding: 20px; }
.auth-links { list-style: none; padding: 0; margin: 16px 0 0; font-size: 13px; }
.auth-links li { padding: 4px 0; border-top: 1px dotted var(--border); }
.auth-links li:first-child { border-top: none; }
.field-check { margin: 14px 0; }
.check-label { display: flex; align-items: center; gap: 8px; font-weight: 400; }
.check-label input { width: auto; }
.help { margin: 3px 0 0; }
.help ul { margin: 4px 0 0; padding-left: 18px; }

.account-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: start;
}
.account-history { grid-column: 1 / -1; }
@media (max-width: 700px) { .account-layout { grid-template-columns: 1fr; } }
.status-list { list-style: none; margin: 0 0 12px; padding: 0; }
.status-list li {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 8px 2px; border-bottom: 1px dotted var(--border);
}
.status-list strong { font-size: 18px; color: var(--accent); }

.notice-off {
  background: #fff6e5;
  border: 1px solid #f0cf94;
  color: #8a5b00;
  border-radius: 4px;
  padding: 8px 10px;
  margin: 0 0 10px;
  font-size: 13px;
}

/* ---------------------------------------------------------- 送信履歴 */
.history-list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.history-item { background: var(--panel); border: 1px solid var(--border); border-radius: 6px; }
.history-item:hover { border-color: var(--accent); }
.history-link {
  display: grid;
  grid-template-columns: 160px 1fr 130px;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  color: var(--text);
}
.history-link:hover { text-decoration: none; }
.history-head { display: flex; flex-direction: column; gap: 2px; }
.history-no { font-weight: 700; color: var(--link); }
.history-date { font-size: 12px; color: var(--muted); }
.history-thumbs { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.history-thumbs img {
  width: 48px; height: 48px; object-fit: cover;
  border: 1px solid var(--border); border-radius: 4px;
}
.thumb-blank, .thumb-more {
  display: inline-flex; align-items: center; justify-content: center;
  width: 48px; height: 48px; border-radius: 4px;
  background: #eceef1; color: var(--muted); font-size: 12px;
}
.history-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-size: 13px; }
.history-total { font-size: 17px; font-weight: 700; color: var(--price); }
.row-missing { color: var(--muted); }
.done-actions { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 620px) {
  .history-link { grid-template-columns: 1fr; gap: 8px; }
  .history-meta { flex-direction: row; align-items: baseline; gap: 12px; }
}

/* ---------------------------------------------------------- 文書ページ */
.doc {
  background: var(--panel); border: 1px solid var(--border); border-radius: 6px;
  padding: 24px; max-width: 760px; margin: 0 auto;
}
.doc h2 { font-size: 15px; margin: 24px 0 8px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.doc ul { padding-left: 20px; }
.doc li { margin: 4px 0; }
.back-link { margin-top: 28px; }

/* ---------------------------------------------------------- 年齢確認 */
.gate-body {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; background: #1a1c20; margin: 0;
}
.gate {
  background: #fff; border-radius: 8px; padding: 36px 28px;
  max-width: 460px; width: calc(100% - 32px); text-align: center;
  box-shadow: 0 10px 40px rgba(0,0,0,.4);
}
.gate-title { font-size: 20px; margin: 0 0 16px; }
.gate-lead { color: var(--muted); margin: 0 0 20px; }
.gate-question { font-size: 18px; font-weight: 700; margin: 0 0 20px; }
.gate-actions { display: flex; flex-direction: column; gap: 10px; }
.gate-note { margin-top: 18px; }

/* ---------------------------------------------------------- フッター */
.site-footer {
  border-top: 1px solid var(--border);
  background: #fff;
  margin-top: 32px;
  padding: 20px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}
.site-footer p { margin: 4px 0; }
