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

:root {
  --primary: #f0a500;
  --primary-dark: #d49100;
  --bg: #f5f5f5;
  --card-bg: #fff;
  --text: #333;
  --text-light: #666;
  --border: #e0e0e0;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --radius: 8px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

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

.header {
  background: #1a1a2e;
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 32px;
}

.logo {
  font-size: 22px;
  font-weight: 700;
  color: var(--primary) !important;
  text-decoration: none !important;
}

.nav {
  display: flex;
  gap: 20px;
}

.nav a {
  color: #ccc !important;
  font-size: 14px;
  text-decoration: none !important;
  padding: 4px 8px;
  border-radius: 4px;
  transition: 0.2s;
}

.nav a:hover,
.nav a.active {
  color: #fff !important;
  background: rgba(255,255,255,0.1);
}

.page { display: none; }
.page.active { display: block; }

.search-hero {
  text-align: center;
  padding: 60px 20px 40px;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  color: #fff;
}

.search-hero h1 {
  font-size: 28px;
  margin-bottom: 8px;
}

.search-hero p {
  font-size: 14px;
  color: #aaa;
  margin-bottom: 24px;
}

.search-box {
  display: flex;
  max-width: 600px;
  margin: 0 auto;
  border-radius: 50px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

.search-box input {
  flex: 1;
  padding: 14px 20px;
  border: none;
  font-size: 16px;
  outline: none;
}

.search-box button {
  padding: 14px 32px;
  background: var(--primary);
  color: #fff;
  border: none;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s;
}

.search-box button:hover {
  background: var(--primary-dark);
}

.popular-tags {
  margin-top: 16px;
  font-size: 13px;
  color: #999;
}

.popular-tags a {
  color: var(--primary) !important;
  margin: 0 6px;
  text-decoration: none !important;
}

.popular-tags a:hover {
  text-decoration: underline !important;
}

.search-info {
  max-width: 1200px;
  margin: 16px auto;
  padding: 0 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--text-light);
}

.search-info .count { font-weight: 600; color: var(--text); }

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px 40px;
}

.product-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
  position: relative;
}

.product-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.12);
}

.product-card .badge {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  z-index: 1;
}

.badge-rakuten { background: #bf0000; }
.badge-yahoo { background: #ff0033; }

.product-card .image-wrap {
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  background: #fafafa;
  display: flex;
  align-items: center;
  justify-content: center;
}

.product-card .image-wrap img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.product-card .info {
  padding: 12px;
}

.product-card .name {
  font-size: 14px;
  font-weight: 500;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
  min-height: 39px;
}

.product-card .price-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0;
}

.product-card .price {
  font-size: 20px;
  font-weight: 700;
  color: #e53935;
}

.product-card .price .yen { font-size: 14px; }

.product-card .shop {
  font-size: 12px;
  color: var(--text-light);
}

.product-card .review {
  font-size: 12px;
  color: var(--text-light);
  display: flex;
  align-items: center;
  gap: 4px;
}

.product-card .review .stars {
  color: var(--primary);
}

.product-card .ai-score {
  margin-top: 8px;
  padding: 8px 12px;
  background: #f8f9ff;
  border-radius: 6px;
  font-size: 12px;
}

.product-card .ai-score .score-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.product-card .ai-score .score-value {
  font-weight: 700;
  color: #4a6cf7;
  font-size: 15px;
}

.product-card .ai-reason {
  font-size: 11px;
  color: var(--text-light);
  margin-top: 4px;
}

.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 20px;
}

.pagination button {
  padding: 8px 16px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
}

.pagination button:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.pagination button.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.product-detail {
  max-width: 1000px;
  margin: 0 auto;
  padding: 24px 20px;
}

.product-detail .back {
  display: inline-block;
  margin-bottom: 16px;
  font-size: 14px;
}

.product-detail .detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

@media (max-width: 768px) {
  .product-detail .detail-grid {
    grid-template-columns: 1fr;
  }
}

.product-detail .detail-image {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  background: #fafafa;
  border-radius: var(--radius);
}

.product-detail .detail-name {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 12px;
  line-height: 1.4;
}

.product-detail .detail-price {
  font-size: 28px;
  font-weight: 700;
  color: #e53935;
  margin-bottom: 8px;
}

.product-detail .detail-shop {
  font-size: 14px;
  color: var(--text-light);
  margin-bottom: 16px;
}

.product-detail .detail-review {
  margin-bottom: 16px;
}

.product-detail .detail-review .stars {
  color: var(--primary);
  font-size: 18px;
}

.product-detail .detail-btn {
  display: inline-block;
  padding: 12px 32px;
  background: var(--primary);
  color: #fff;
  border-radius: 50px;
  font-size: 16px;
  font-weight: 600;
  text-decoration: none !important;
  transition: 0.2s;
}

.product-detail .detail-btn:hover {
  background: var(--primary-dark);
}

.product-detail .summary-box {
  background: #f8f9ff;
  border-radius: var(--radius);
  padding: 16px 20px;
  margin: 20px 0;
  border-left: 4px solid #4a6cf7;
}

.product-detail .summary-box h3 {
  font-size: 14px;
  color: #4a6cf7;
  margin-bottom: 8px;
}

.product-detail .summary-box p {
  font-size: 14px;
  line-height: 1.6;
}

.product-detail .score-detail {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin: 20px 0;
}

.product-detail .score-detail h3 {
  font-size: 16px;
  margin-bottom: 12px;
}

.product-detail .score-detail .score-big {
  font-size: 36px;
  font-weight: 700;
  color: #4a6cf7;
}

.product-detail .score-detail .reason {
  font-size: 14px;
  color: var(--text-light);
  margin: 8px 0;
}

.product-detail .strengths {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0;
}

.product-detail .strengths .tag {
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
}

.product-detail .strengths .tag-good {
  background: #e8f5e9;
  color: #2e7d32;
}

.product-detail .strengths .tag-bad {
  background: #fbe9e7;
  color: #c62828;
}

.product-detail .price-chart {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin: 20px 0;
}

.product-detail .price-chart h3 {
  font-size: 16px;
  margin-bottom: 12px;
}

.product-detail .price-chart .chart {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 120px;
}

.product-detail .price-chart .bar {
  flex: 1;
  background: var(--primary);
  border-radius: 2px 2px 0 0;
  min-width: 12px;
  position: relative;
  transition: 0.2s;
}

.product-detail .price-chart .bar:hover {
  background: var(--primary-dark);
}

.product-detail .price-chart .bar .tooltip {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: #fff;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  white-space: nowrap;
  display: none;
}

.product-detail .price-chart .bar:hover .tooltip {
  display: block;
}

.product-detail .price-chart .labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-light);
  margin-top: 4px;
}

.ranking-header {
  text-align: center;
  padding: 40px 20px 24px;
}

.ranking-header h1 {
  font-size: 24px;
}

.ranking-header p {
  font-size: 14px;
  color: var(--text-light);
}

.genre-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  padding: 0 20px 20px;
  max-width: 900px;
  margin: 0 auto;
}

.genre-tabs a {
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 13px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  color: var(--text) !important;
  text-decoration: none !important;
  transition: 0.2s;
}

.genre-tabs a:hover,
.genre-tabs a.active {
  background: var(--primary);
  color: #fff !important;
  border-color: var(--primary);
}

.ranking-comment {
  max-width: 800px;
  margin: 0 auto 20px;
  padding: 16px 20px;
  background: #f8f9ff;
  border-radius: var(--radius);
  border-left: 4px solid #4a6cf7;
  font-size: 14px;
  line-height: 1.6;
}

.ranking-list {
  max-width: 800px;
  margin: 0 auto 40px;
  padding: 0 20px;
}

.ranking-item {
  display: flex;
  gap: 16px;
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: 0.2s;
}

.ranking-item:hover {
  transform: translateX(4px);
}

.ranking-item .rank-badge {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
  flex-shrink: 0;
}

.rank-1 { background: #ffd700; color: #333; }
.rank-2 { background: #c0c0c0; color: #333; }
.rank-3 { background: #cd7f32; color: #fff; }
.rank-other { background: #e0e0e0; color: #666; }

.ranking-item .rank-image {
  width: 80px;
  height: 80px;
  object-fit: contain;
  border-radius: 4px;
  flex-shrink: 0;
  background: #fafafa;
}

.ranking-item .rank-info {
  flex: 1;
  min-width: 0;
}

.ranking-item .rank-name {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ranking-item .rank-price {
  font-size: 18px;
  font-weight: 700;
  color: #e53935;
}

.ranking-item .rank-reason {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 4px;
}

.loading {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-light);
}

.loading::after {
  content: '';
  display: inline-block;
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.error-box {
  max-width: 600px;
  margin: 40px auto;
  padding: 20px;
  background: #fff3f3;
  border-radius: var(--radius);
  border: 1px solid #ffcdd2;
  color: #c62828;
  text-align: center;
}

.no-results {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-light);
}

.footer {
  text-align: center;
  padding: 24px 20px;
  font-size: 12px;
  color: var(--text-light);
  border-top: 1px solid var(--border);
}
