/* ===== CSS Custom Properties (Light/Dark) ===== */
:root, [data-theme="light"] {
  --bg: #f8f9fa;
  --bg-card: #fff;
  --bg-header: #fff;
  --bg-footer: #1e293b;
  --text: #333;
  --text-heading: #1e293b;
  --text-sub: #64748b;
  --text-muted: #94a3b8;
  --text-footer: #94a3b8;
  --border: #e2e8f0;
  --border-header: #2563eb;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --accent: #f97316;
  --accent-hover: #ea580c;
  --featured: #f59e0b;
  --success: #10b981;
  --danger: #ef4444;
  --shadow: rgba(0,0,0,.06);
  --shadow-lg: rgba(0,0,0,.1);
  --ad-bg: #f1f5f9;
  --ad-border: #cbd5e1;
  --cat-active-bg: #eff6ff;
  --cat-text: #475569;
  --search-shadow: rgba(0,0,0,.15);
  --toast-bg: #1e293b;
  --toast-text: #fff;
  --link-footer: #93c5fd;
  --link-sister: #60a5fa;
}
[data-theme="dark"] {
  --bg: #0f172a;
  --bg-card: #1e293b;
  --bg-header: #1e293b;
  --bg-footer: #0f172a;
  --text: #e2e8f0;
  --text-heading: #f1f5f9;
  --text-sub: #94a3b8;
  --text-muted: #64748b;
  --text-footer: #94a3b8;
  --border: #334155;
  --border-header: #3b82f6;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --accent: #fb923c;
  --accent-hover: #f97316;
  --featured: #fbbf24;
  --success: #34d399;
  --danger: #f87171;
  --shadow: rgba(0,0,0,.2);
  --shadow-lg: rgba(0,0,0,.3);
  --ad-bg: #1e293b;
  --ad-border: #475569;
  --cat-active-bg: #1e3a5f;
  --cat-text: #cbd5e1;
  --search-shadow: rgba(0,0,0,.3);
  --toast-bg: #334155;
  --toast-text: #f1f5f9;
  --link-footer: #93c5fd;
  --link-sister: #60a5fa;
}

/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Hiragino Sans', 'Noto Sans JP', sans-serif;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }
ul { list-style: none; }

/* ===== Layout ===== */
.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

/* ===== Header ===== */
.site-header {
  background: var(--bg-header);
  border-bottom: 3px solid var(--border-header);
  padding: 14px 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px var(--shadow);
}
.site-header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.site-logo {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text-heading);
}
.site-logo span { color: var(--primary); }
.header-nav { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.header-nav a { color: var(--cat-text); font-size: .9rem; font-weight: 500; }
.header-nav a:hover { color: var(--primary); text-decoration: none; }

/* Header action buttons */
.header-actions { display: flex; gap: 8px; align-items: center; }
.theme-btn, .lang-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: .85rem;
  cursor: pointer;
  color: var(--text);
  transition: all .2s;
}
.theme-btn:hover, .lang-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* ===== Hero ===== */
.hero {
  background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
  color: #fff;
  padding: 60px 0;
  text-align: center;
}
.hero h1 { font-size: 2rem; margin-bottom: 12px; }
.hero p { font-size: 1.1rem; opacity: .9; max-width: 600px; margin: 0 auto 24px; }
.hero-search {
  max-width: 500px;
  margin: 0 auto;
  position: relative;
}
.hero-search input {
  width: 100%;
  padding: 14px 50px 14px 20px;
  border: none;
  border-radius: 50px;
  font-size: 1rem;
  outline: none;
  box-shadow: 0 4px 20px var(--search-shadow);
  background: var(--bg-card);
  color: var(--text);
}
.hero-search button {
  position: absolute;
  right: 6px;
  top: 6px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 1.1rem;
  cursor: pointer;
}

/* ===== Categories ===== */
.categories { padding: 40px 0 20px; }
.category-grid {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}
.category-btn {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 12px 22px;
  cursor: pointer;
  font-size: .95rem;
  font-weight: 600;
  color: var(--cat-text);
  transition: all .2s;
}
.category-btn:hover,
.category-btn.active {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--cat-active-bg);
}

/* ===== Sort Bar ===== */
.sort-bar {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  padding: 0 0 16px;
}
.sort-select {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: .9rem;
  color: var(--text);
  cursor: pointer;
}
.sort-select:focus { border-color: var(--primary); outline: none; }
.fav-filter-btn {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: 8px;
  padding: 8px 16px;
  font-size: .9rem;
  cursor: pointer;
  color: var(--text);
  transition: all .2s;
}
.fav-filter-btn:hover { border-color: var(--primary); }
.fav-filter-btn.active {
  border-color: #ef4444;
  background: #fef2f2;
  color: #ef4444;
}
[data-theme="dark"] .fav-filter-btn.active {
  background: #451a1a;
}

/* ===== Favorite Button ===== */
.card-top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.fav-btn {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 2px 4px;
  transition: transform .2s;
  line-height: 1;
}
.fav-btn:hover { transform: scale(1.2); }
.fav-btn.active { animation: favPop .3s ease; }
@keyframes favPop {
  0% { transform: scale(1); }
  50% { transform: scale(1.4); }
  100% { transform: scale(1); }
}

/* ===== Section Titles ===== */
.section-title {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 24px;
  padding-bottom: 8px;
  border-bottom: 3px solid var(--primary);
  display: inline-block;
  color: var(--text-heading);
}

/* ===== Product Cards ===== */
.products-section { padding: 30px 0 50px; }
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
}
.product-card {
  background: var(--bg-card);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 2px 12px var(--shadow);
  transition: transform .2s, box-shadow .2s;
  display: flex;
  flex-direction: column;
}
.product-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 30px var(--shadow-lg);
}
.product-card.featured { border: 2px solid var(--featured); }
.product-card.featured::before {
  content: attr(data-featured-label);
  background: var(--featured);
  color: #fff;
  font-size: .75rem;
  font-weight: 700;
  padding: 4px 14px;
  display: block;
}
.card-body { padding: 20px; flex: 1; display: flex; flex-direction: column; }
.card-category {
  font-size: .75rem;
  font-weight: 600;
  color: var(--primary);
  background: var(--cat-active-bg);
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  margin-bottom: 8px;
}
.card-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text-heading);
}
.card-summary {
  font-size: .9rem;
  color: var(--text-sub);
  margin-bottom: 14px;
  flex: 1;
}
.card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.card-rating { color: var(--featured); font-weight: 700; font-size: .95rem; }
.card-price { font-weight: 700; color: var(--text-heading); font-size: 1rem; }
.card-actions { display: flex; gap: 10px; }
.btn {
  display: inline-block;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: .9rem;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  border: none;
  transition: all .2s;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
  flex: 1;
}
.btn-primary:hover { background: var(--accent-hover); text-decoration: none; }
.btn-outline {
  background: var(--bg-card);
  color: var(--primary);
  border: 2px solid var(--primary);
  flex: 1;
}
.btn-outline:hover { background: var(--cat-active-bg); text-decoration: none; }

/* ===== Review Page ===== */
.review-page { padding: 40px 0 60px; }
.review-header { margin-bottom: 30px; }
.review-header h1 { font-size: 1.8rem; margin-bottom: 6px; color: var(--text-heading); }
.review-meta { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.review-rating-lg { font-size: 1.5rem; color: var(--featured); font-weight: 800; }
.review-price-lg { font-size: 1.3rem; font-weight: 700; color: var(--text-heading); }
.review-badge {
  background: var(--success);
  color: #fff;
  padding: 4px 14px;
  border-radius: 20px;
  font-size: .8rem;
  font-weight: 600;
}
.review-content { display: grid; grid-template-columns: 1fr 300px; gap: 30px; }
.review-sidebar { position: sticky; top: 80px; align-self: start; }
.review-description {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 2px 8px var(--shadow);
  line-height: 1.9;
  color: var(--text);
}
.review-description h1 { color: var(--text-heading); margin-bottom: 16px; }
.review-description h3 { color: var(--text-heading); margin: 16px 0 8px; }
.pros-cons { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 24px; }
.pros, .cons {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 8px var(--shadow);
}
.pros h3 { color: var(--success); margin-bottom: 10px; }
.cons h3 { color: var(--danger); margin-bottom: 10px; }
.pros li::before { content: '✓ '; color: var(--success); font-weight: 700; }
.cons li::before { content: '✗ '; color: var(--danger); font-weight: 700; }
.pros li, .cons li { padding: 4px 0; font-size: .9rem; }
.features-list {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 24px;
  box-shadow: 0 2px 8px var(--shadow);
}
.features-list h3 { margin-bottom: 12px; color: var(--text-heading); }
.features-list li {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: .9rem;
}
.features-list li::before { content: '● '; color: var(--primary); }
.sidebar-cta {
  background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
  color: #fff;
  border-radius: 16px;
  padding: 28px;
  text-align: center;
  box-shadow: 0 4px 20px rgba(37,99,235,.25);
}
.sidebar-cta h3 { margin-bottom: 8px; font-size: 1.1rem; }
.sidebar-cta p { font-size: .85rem; opacity: .9; margin-bottom: 18px; }
.sidebar-cta .btn-cta {
  display: block;
  background: var(--accent);
  color: #fff;
  padding: 14px;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 10px;
}
.sidebar-cta .btn-cta:hover { background: var(--accent-hover); text-decoration: none; }
.sidebar-cta .btn-official {
  display: block;
  color: rgba(255,255,255,.9);
  font-size: .85rem;
}

/* ===== Ad Slots ===== */
.ad-slot {
  background: var(--ad-bg);
  border: 2px dashed var(--ad-border);
  border-radius: 8px;
  padding: 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: .85rem;
  margin: 24px 0;
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ===== Footer ===== */
.site-footer {
  background: var(--bg-footer);
  color: var(--text-footer);
  padding: 30px 0;
  text-align: center;
  font-size: .85rem;
  border-top: 1px solid var(--border);
}
.site-footer a { color: var(--link-footer); }
.footer-links { display: flex; gap: 20px; justify-content: center; margin-bottom: 12px; flex-wrap: wrap; }
.sister-site { margin: 10px 0; font-size: .85rem; }
.sister-site a { color: var(--link-sister); font-weight: 600; }

/* ===== Toast / Notifications ===== */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--toast-bg);
  color: var(--toast-text);
  padding: 14px 24px;
  border-radius: 10px;
  font-size: .9rem;
  box-shadow: 0 4px 20px rgba(0,0,0,.2);
  transform: translateY(100px);
  opacity: 0;
  transition: all .3s;
  z-index: 999;
}
.toast.show { transform: translateY(0); opacity: 1; }

/* ===== Breadcrumb ===== */
.breadcrumb {
  padding: 14px 0;
  font-size: .85rem;
  color: var(--text-sub);
}
.breadcrumb a { color: var(--primary); }
.breadcrumb span { margin: 0 6px; }

/* ===== Load More & Result Count ===== */
.load-more-wrap { text-align: center; padding: 24px 0 8px; }
.btn-load-more {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 12px 40px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s;
}
.btn-load-more:hover { background: var(--primary-hover); }
.result-count {
  text-align: center;
  font-size: .85rem;
  color: var(--text-muted);
  padding: 8px 0 0;
}

/* ===== No Results ===== */
.no-results {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.no-results p { font-size: 1.1rem; }

/* ===== Status Badge ===== */
.status-active { color: var(--success); }
.status-inactive { color: var(--danger); }

/* ===== Back to Top ===== */
.back-to-top {
  position: fixed;
  bottom: 20px;
  left: 20px;
  background: var(--primary);
  color: #fff;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 10px rgba(0,0,0,.15);
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s;
}
.back-to-top.visible { opacity: 1; pointer-events: auto; }

/* ===== Loading ===== */
.loading {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
}
.loading::after {
  content: '';
  display: block;
  width: 36px;
  height: 36px;
  margin: 12px auto;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Quiz / Tool Finder ===== */
.quiz-start-btn {
  display: inline-block;
  margin-top: 18px;
  background: #fff;
  color: var(--primary);
  border: none;
  border-radius: 50px;
  padding: 14px 36px;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform .2s, box-shadow .2s;
  box-shadow: 0 4px 16px rgba(0,0,0,.15);
}
.quiz-start-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(0,0,0,.2);
}

.quiz-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  padding: 20px;
}
/* visibility controlled via inline style in JS */

.quiz-modal {
  background: var(--bg-card);
  border-radius: 20px;
  padding: 36px 32px;
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  animation: quizSlideIn .3s ease;
}
@keyframes quizSlideIn {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

.quiz-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-muted);
  transition: color .2s;
}
.quiz-close:hover { color: var(--primary); }

.quiz-progress {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 28px;
}
.quiz-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--border);
  transition: background .3s;
}
.quiz-dot.active { background: var(--primary); }
.quiz-dot.done { background: var(--success); }

.quiz-content h2 {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-heading);
  text-align: center;
  margin-bottom: 24px;
}

.quiz-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.quiz-option {
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  font-size: .95rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  text-align: center;
  transition: all .2s;
}
.quiz-option:hover {
  border-color: var(--primary);
  background: var(--cat-active-bg);
  transform: translateY(-2px);
}

.quiz-back {
  display: inline-block;
  margin-top: 18px;
  background: none;
  border: none;
  color: var(--text-sub);
  font-size: .9rem;
  cursor: pointer;
  padding: 6px 0;
}
.quiz-back:hover { color: var(--primary); }

.quiz-results-title {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text-heading);
  text-align: center;
  margin-bottom: 20px;
}
.quiz-results-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
.quiz-results-grid .product-card { margin: 0; }
.quiz-no-result {
  text-align: center;
  color: var(--text-muted);
  padding: 30px 0;
  font-size: 1rem;
}
.quiz-retry {
  display: block;
  margin: 24px auto 0;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 12px 32px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s;
}
.quiz-retry:hover { background: var(--primary-hover); }

/* ===== Responsive ===== */
@media (min-width: 1024px) {
  .product-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
  .hero h1 { font-size: 1.4rem; }
  .hero { padding: 40px 0; }
  .product-grid { grid-template-columns: 1fr; }
  .review-content { grid-template-columns: 1fr; }
  .review-sidebar { position: static; }
  .pros-cons { grid-template-columns: 1fr; }
  .section-title { font-size: 1.2rem; }
  .site-header .container { flex-wrap: wrap; }
  .header-nav { gap: 10px; }
  .header-actions { gap: 4px; }
  .lang-btn { padding: 6px 8px; font-size: .8rem; }
  .sort-bar { justify-content: center; }
  .category-grid {
    flex-wrap: nowrap;
    overflow-x: auto;
    justify-content: flex-start;
    padding-bottom: 8px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }
  .category-btn { white-space: nowrap; flex-shrink: 0; padding: 10px 16px; font-size: .85rem; }
  .quiz-options { grid-template-columns: 1fr; }
  .quiz-modal { padding: 28px 20px; }
}
@media (min-width: 481px) and (max-width: 768px) {
  .product-grid { grid-template-columns: repeat(2, 1fr); }
}
