:root {
  --bg: #0d1117;
  --card: #161b22;
  --card-hover: #1c222c;
  --border: #30363d;
  --text: #e6edf3;
  --text-secondary: #8b949e;
  --accent: #58a6ff;
  --accent-soft: rgba(88, 166, 255, 0.12);
  --good: #3fb950;
  --good-soft: rgba(63, 185, 80, 0.12);
  --warn: #d29922;
  --warn-soft: rgba(210, 153, 34, 0.12);
  --bad: #f85149;
  --bad-soft: rgba(248, 81, 73, 0.12);
  --radius: 12px;
  --maxw: 1280px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
}

.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 20px;
}

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

/* Header */
.site-header {
  padding: 36px 0 20px;
  border-bottom: 1px solid var(--border);
}
.site-header h1 {
  margin: 0 0 6px;
  font-size: 2rem;
  letter-spacing: -0.02em;
}
.subtitle {
  margin: 0 0 18px;
  color: var(--text-secondary);
  font-size: 1rem;
}
.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--text-secondary);
  font-size: 0.9rem;
}
.stats b { color: var(--text); }
.stats .dot { opacity: 0.5; }

/* Sticky nav */
.cat-nav {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(13, 17, 23, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.nav-scroll {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding: 10px 20px;
  scrollbar-width: none;
}
.nav-scroll::-webkit-scrollbar { display: none; }
.cat-nav a {
  flex: 0 0 auto;
  padding: 8px 14px;
  border-radius: 999px;
  color: var(--text-secondary);
  font-size: 0.88rem;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.cat-nav a:hover { color: var(--text); background: var(--card); }
.cat-nav a.active { color: var(--bg); background: var(--accent); }

/* Toolbar */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 20px;
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 28px;
}
.toolbar-group { display: flex; align-items: center; gap: 8px; font-size: 0.88rem; color: var(--text-secondary); }
.toolbar-group label { white-space: nowrap; }
.toolbar select {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 0.88rem;
}
.checkbox-label { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.toolbar-hint { margin-left: auto; }

/* Category section */
.category-section { margin-bottom: 56px; scroll-margin-top: 64px; }
.category-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.category-header h2 { margin: 0; font-size: 1.4rem; }
.category-count { color: var(--text-secondary); font-size: 0.85rem; font-weight: 400; margin-left: 8px; }
.btn {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.btn:hover { border-color: var(--accent); background: var(--card-hover); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #06131f; font-weight: 600; }
.btn-primary:hover { filter: brightness(1.08); }
.empty-hint { color: var(--text-secondary); font-size: 0.9rem; padding: 20px 0; }

/* Card grid */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s, transform 0.15s;
}
.card:hover { border-color: #3d444d; }

.card-photo {
  position: relative;
  aspect-ratio: 4 / 3;
  background: #060809;
  cursor: zoom-in;
  overflow: hidden;
}
.card-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.card-photo .photo-count {
  position: absolute;
  right: 8px;
  bottom: 8px;
  background: rgba(0,0,0,0.6);
  color: #fff;
  font-size: 0.72rem;
  padding: 3px 7px;
  border-radius: 999px;
}
.fav-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,0.55);
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, transform 0.15s;
}
.fav-btn:hover { transform: scale(1.08); }
.fav-btn.active { color: #ffd43b; }
.needs-check-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: var(--warn-soft);
  color: var(--warn);
  border: 1px solid rgba(210,153,34,0.4);
  font-size: 0.68rem;
  padding: 3px 8px;
  border-radius: 999px;
  font-weight: 600;
}

.card-body { padding: 16px 16px 18px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.card-brand { font-size: 0.78rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.04em; }
.card-title { font-size: 1.02rem; font-weight: 600; margin: 0; }
.card-model { font-size: 0.82rem; color: var(--text-secondary); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.card-price { font-size: 1.35rem; font-weight: 700; color: var(--text); }
.card-price .orig { font-size: 0.82rem; color: var(--text-secondary); text-decoration: line-through; font-weight: 400; margin-left: 8px; }
.card-price .store-tag { display: block; font-size: 0.72rem; color: var(--text-secondary); font-weight: 400; margin-top: 2px; }

.key-specs { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; font-size: 0.83rem; color: var(--text-secondary); }
.key-specs li { display: flex; justify-content: space-between; gap: 10px; }
.key-specs li b { color: var(--text); font-weight: 500; text-align: right; }
.confid { font-size: 0.75em; opacity: 0.7; margin-left: 4px; }

.card-actions { display: flex; gap: 8px; margin-top: auto; padding-top: 6px; flex-wrap: wrap; }
.card-actions .btn { flex: 1; text-align: center; font-size: 0.8rem; padding: 8px 10px; }

.pc-mini { display: flex; gap: 14px; font-size: 0.78rem; color: var(--text-secondary); }
.pc-mini span { display: flex; align-items: center; gap: 4px; }

/* Gallery thumbnails inside specs modal */
.gallery-thumbs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.gallery-thumbs img {
  width: 84px; height: 84px; object-fit: cover; border-radius: 8px;
  border: 1px solid var(--border); cursor: zoom-in; flex: 0 0 auto;
}
.photo-source-tag { font-size: 0.68rem; color: var(--text-secondary); text-align: center; margin-top: 2px; }

/* Modal */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.65); }
.modal-panel {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 640px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  padding: 28px;
}
.modal-panel-wide { max-width: 1100px; }
.modal-close {
  position: absolute; top: 14px; right: 14px;
  background: var(--bg); border: 1px solid var(--border); color: var(--text);
  width: 32px; height: 32px; border-radius: 50%; cursor: pointer; font-size: 0.9rem;
  z-index: 2;
}

/* Specs modal content */
.specs-modal-header { display: flex; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.specs-modal-header img { width: 120px; height: 120px; object-fit: cover; border-radius: 10px; border: 1px solid var(--border); }
.specs-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; margin: 12px 0 20px; }
.specs-table tr { border-bottom: 1px solid var(--border); }
.specs-table td { padding: 8px 4px; vertical-align: top; }
.specs-table td:first-child { color: var(--text-secondary); width: 46%; }
.specs-table td:last-child { text-align: right; font-weight: 500; }

.block-title { font-size: 0.95rem; font-weight: 600; margin: 20px 0 8px; }
.pill-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; font-size: 0.88rem; }
.pill-list.good li::before { content: "✓ "; color: var(--good); }
.pill-list.bad li::before { content: "− "; color: var(--bad); }
.review-summary { font-size: 0.88rem; color: var(--text-secondary); background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; margin-top: 8px; }
.sources-list { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.sources-list a { background: var(--bg); border: 1px solid var(--border); border-radius: 999px; padding: 5px 12px; font-size: 0.8rem; }
.sources-list a:hover { border-color: var(--accent); }
.insufficient-note { color: var(--warn); font-size: 0.85rem; font-style: italic; }

/* Comparison table */
.compare-wrap { overflow-x: auto; }
.compare-table { border-collapse: collapse; width: 100%; font-size: 0.85rem; }
.compare-table th, .compare-table td { padding: 10px 14px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
.compare-table th:first-child, .compare-table td:first-child {
  position: sticky; left: 0; background: var(--card); z-index: 2; color: var(--text-secondary); white-space: normal; min-width: 160px;
}
.compare-table thead th { background: var(--card); position: sticky; top: 0; z-index: 3; }
.compare-table thead th:first-child { z-index: 4; }
.compare-table td.diff { background: rgba(88,166,255,0.06); }
.compare-table td.good-cell { color: var(--good); font-weight: 600; }
.compare-table td.bad-cell { color: var(--bad); }
.compare-table .col-photo { width: 60px; height: 60px; object-fit: cover; border-radius: 6px; }

/* Kit section */
.kit-section, .checklist-section { margin-bottom: 60px; }
.kit-section h2, .checklist-section h2 { font-size: 1.5rem; margin-bottom: 8px; }
.section-hint { color: var(--text-secondary); font-size: 0.9rem; margin-top: 0; margin-bottom: 20px; }
.kit-tabs { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.kit-tab { padding: 8px 16px; border-radius: 999px; border: 1px solid var(--border); background: var(--card); color: var(--text-secondary); cursor: pointer; font-size: 0.85rem; }
.kit-tab.active { background: var(--accent); color: #06131f; border-color: var(--accent); font-weight: 600; }
.kit-list { display: grid; gap: 10px; margin-bottom: 16px; }
.kit-row { display: flex; justify-content: space-between; align-items: center; background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 12px 16px; gap: 12px; }
.kit-row .kit-cat { color: var(--text-secondary); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.03em; }
.kit-row .kit-name { font-weight: 500; }
.kit-row .kit-price { font-weight: 600; white-space: nowrap; }
.kit-total { display: flex; justify-content: space-between; font-size: 1.15rem; font-weight: 700; padding: 14px 16px; background: var(--accent-soft); border: 1px solid rgba(88,166,255,0.3); border-radius: 10px; }

/* Checklist */
.checklist { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.checklist li { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 12px 16px; font-size: 0.9rem; display: flex; gap: 10px; }
.checklist li::before { content: "☐"; color: var(--text-secondary); flex-shrink: 0; }
.checklist li b { color: var(--text); }

/* Lightbox */
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,0.92); z-index: 200; display: flex; align-items: center; justify-content: center; }
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 92vw; max-height: 88vh; object-fit: contain; border-radius: 6px; }
.lightbox-close, .lightbox-nav {
  position: absolute; background: rgba(255,255,255,0.08); color: #fff; border: none;
  cursor: pointer; border-radius: 50%; width: 44px; height: 44px; font-size: 1.3rem;
  display: flex; align-items: center; justify-content: center;
}
.lightbox-close:hover, .lightbox-nav:hover { background: rgba(255,255,255,0.18); }
.lightbox-close { top: 18px; right: 18px; }
.lightbox-prev { left: 18px; top: 50%; transform: translateY(-50%); }
.lightbox-next { right: 18px; top: 50%; transform: translateY(-50%); }

/* Footer */
.site-footer { border-top: 1px solid var(--border); padding: 24px 0 60px; color: var(--text-secondary); font-size: 0.82rem; }

/* Responsive */
@media (max-width: 480px) {
  .site-header h1 { font-size: 1.5rem; }
  .card-grid { grid-template-columns: 1fr; }
  .toolbar { gap: 12px; }
  .toolbar-hint { margin-left: 0; }
  .modal-panel { padding: 18px; }
  .specs-modal-header img { width: 90px; height: 90px; }
}
