:root {
  --bg: #0d0f14;
  --surface: #161922;
  --s2: #1e2230;
  --border: #2a2e3d;
  --accent: #4a9eff;
  --accent2: #3b6d11;
  --text: #e0e0e0;
  --muted: #777;
  --red: #e24b4a;
  --green: #4caf50;
  --orange: #f0a030;
  --radius: 8px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Segoe UI', 'Noto Sans JP', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Login ── */
.login-wrap {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh;
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px;
  width: 360px;
  text-align: center;
}
.login-card h1 {
  font-size: 20px;
  margin-bottom: 8px;
}
.login-card p {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 24px;
}
.login-card input[type="password"] {
  width: 100%;
  padding: 10px 14px;
  background: var(--s2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 14px;
  margin-bottom: 16px;
  outline: none;
}
.login-card input:focus { border-color: var(--accent); }
.login-card button {
  width: 100%;
  padding: 10px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
}
.login-card button:hover { opacity: 0.9; }
.login-error {
  color: var(--red);
  font-size: 12px;
  margin-bottom: 12px;
}

/* ── Header ── */
.header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.header-left .dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--accent);
}
.header-left h1 {
  font-size: 15px;
  font-weight: 700;
}
.header-left .badge {
  font-size: 10px;
  color: var(--green);
  background: #1a2e1a;
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid #2a4a2a;
}
.header-right a {
  color: var(--muted);
  font-size: 13px;
  margin-left: 16px;
}
.header-right a:hover { color: var(--text); }

/* ── Toolbar ── */
.toolbar {
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.search-box {
  flex: 1;
  min-width: 200px;
  position: relative;
}
.search-box input {
  width: 100%;
  padding: 8px 12px 8px 34px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
  outline: none;
}
.search-box input:focus { border-color: var(--accent); }
.search-box::before {
  content: '\1F50D';
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
}
.step-filters {
  display: flex;
  gap: 6px;
}
.step-filters a {
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
}
.step-filters a.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.sort-select {
  padding: 6px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 12px;
  outline: none;
}
.total-count {
  font-size: 12px;
  color: var(--muted);
}

/* ── Product Grid ── */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  padding: 0 24px 24px;
}
.product-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  gap: 12px;
  transition: border-color 0.2s;
  cursor: pointer;
}
.product-card:hover {
  border-color: var(--accent);
  text-decoration: none;
}
.product-card img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 6px;
  background: var(--s2);
  flex-shrink: 0;
}
.card-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-price {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
}
.card-meta {
  font-size: 11px;
  color: var(--muted);
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.card-meta .stars { color: #f0c040; }
.step-badge {
  display: inline-block;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 3px;
  font-weight: 700;
}
.step-badge.s1 { background: #2a3040; color: #6080c0; }
.step-badge.s2 { background: #2a2040; color: #9060c0; }
.step-badge.s3 { background: #1a3020; color: #50b050; }

/* ── Pagination ── */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 16px 24px 32px;
}
.pagination a, .pagination span {
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
}
.pagination a {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
}
.pagination a:hover { border-color: var(--accent); text-decoration: none; }
.pagination span.current {
  background: var(--accent);
  color: #fff;
}

/* ── Detail Page ── */
.detail-wrap {
  max-width: 1000px;
  margin: 0 auto;
  padding: 24px;
}
.detail-back {
  display: inline-block;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--muted);
}
.detail-back:hover { color: var(--text); }
.detail-header {
  display: flex;
  gap: 20px;
  margin-bottom: 24px;
}
.detail-header img {
  width: 200px;
  height: 200px;
  object-fit: cover;
  border-radius: 8px;
  background: var(--s2);
}
.detail-info { flex: 1; }
.detail-info h1 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 12px;
  line-height: 1.4;
}
.detail-meta {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 16px;
  font-size: 13px;
}
.detail-meta dt { color: var(--muted); }
.detail-meta dd { color: var(--text); }
.detail-actions {
  margin-top: 16px;
  display: flex;
  gap: 10px;
}
.btn {
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
.btn:hover { border-color: var(--accent); text-decoration: none; }
.btn-danger { border-color: var(--red); color: var(--red); }
.btn-danger:hover { background: var(--red); color: #fff; }

/* ── Detail Sections ── */
.detail-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  overflow: hidden;
}
.detail-section h2 {
  font-size: 13px;
  font-weight: 700;
  padding: 12px 16px;
  background: var(--s2);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
}
.detail-section h2:hover { color: var(--accent); }
.detail-section .section-body {
  padding: 16px;
  font-size: 13px;
  line-height: 1.6;
}
.detail-section .section-body.collapsed { display: none; }

/* バリエーション */
.var-group { margin-bottom: 12px; }
.var-label { font-weight: 600; margin-bottom: 6px; color: var(--muted); font-size: 12px; }
.var-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.var-tag {
  padding: 4px 10px;
  background: var(--s2);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 12px;
}

/* AI分析テキスト */
.ai-text {
  white-space: pre-wrap;
  font-size: 13px;
  line-height: 1.7;
  max-height: 600px;
  overflow-y: auto;
}

/* レビュー一覧 */
.review-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.review-item:last-child { border-bottom: none; }
.review-stars { color: #f0c040; margin-right: 8px; }
.review-variant { color: var(--muted); margin-left: 8px; }
.review-text { margin-top: 4px; color: var(--text); line-height: 1.5; }

/* empty */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--muted);
  font-size: 14px;
}

/* responsive */
@media (max-width: 600px) {
  .toolbar { padding: 12px 16px; }
  .product-grid { padding: 0 16px 16px; grid-template-columns: 1fr; }
  .detail-header { flex-direction: column; align-items: center; text-align: center; }
  .detail-header img { width: 150px; height: 150px; }
  .detail-meta { grid-template-columns: 1fr; }
}
