:root {
  --primary: #E85A2C;
  --primary-light: #FFF4F0;
  --text: #1A1A1A;
  --text-secondary: #6B6B6B;
  --text-muted: #9A9A9A;
  --border: #E8E8E8;
  --bg: #FAFAFA;
  --white: #FFFFFF;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  min-height: 100vh;
  color: var(--text);
  line-height: 1.5;
}

.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px;
}

/* PC対応 */
@media (min-width: 768px) {
  .container {
    max-width: 720px;
    padding: 24px;
  }
}

@media (min-width: 1024px) {
  .container {
    max-width: 960px;
    padding: 32px;
  }
}

/* ヘッダー */
header {
  padding: 24px 0 20px;
}

.logo {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.5px;
}

.logo span {
  color: var(--primary);
}

.tagline {
  margin-top: 4px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

@media (min-width: 768px) {
  header {
    padding: 32px 0 24px;
  }
  
  .logo {
    font-size: 2rem;
  }
  
  .tagline {
    font-size: 0.9rem;
  }
}

/* 検索 */
.search-box {
  margin: 16px 0;
}

.search-input-wrapper {
  position: relative;
}

.search-input {
  width: 100%;
  padding: 12px 16px 12px 44px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 0.95rem;
  background: var(--white);
  outline: none;
  transition: border-color 0.2s;
}

.search-input:focus {
  border-color: var(--primary);
}

@media (min-width: 768px) {
  .search-input {
    padding: 14px 16px 14px 48px;
    font-size: 1rem;
  }
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  color: var(--text-muted);
}

/* カテゴリ */
.category-section {
  margin-bottom: 16px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.section-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.selected-count {
  font-size: 0.7rem;
  color: var(--primary);
  font-weight: 500;
}

.category-scroll {
  flex: 1;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  -webkit-overflow-scrolling: touch;
  cursor: grab;
  user-select: none;
}

.category-scroll:active {
  cursor: grabbing;
}

.category-scroll.dragging {
  scroll-behavior: auto;
}

.category-scroll::-webkit-scrollbar { height: 6px; }
.category-scroll::-webkit-scrollbar-track { background: var(--border); border-radius: 3px; }
.category-scroll::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 3px; }
.category-scroll::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }

.category-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
}

.scroll-btn {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--white);
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

@media (min-width: 768px) {
  .scroll-btn {
    display: flex;
  }
}

.scroll-btn:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.scroll-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

.scroll-btn:disabled:hover {
  border-color: var(--border);
  background: var(--white);
}

.scroll-btn svg {
  width: 16px;
  height: 16px;
  color: var(--text-secondary);
}

.scroll-btn:hover svg {
  color: var(--primary);
}

.category-chip {
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.8rem;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.category-chip svg {
  width: 14px;
  height: 14px;
}

.category-chip.active {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
}

.category-chip:not(.active):hover {
  border-color: var(--text-muted);
}

/* フィルターパネル */
.filter-panel {
  background: var(--white);
  border-radius: 12px;
  padding: 20px;
  border: 1px solid var(--border);
}

@media (min-width: 768px) {
  .filter-panel {
    padding: 24px;
  }
  
  .filter-sliders {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
  }
  
  .filter-sliders .slider-section {
    margin-bottom: 0;
  }
}

/* スライダー */
.slider-section {
  margin-bottom: 24px;
}

.slider-section:last-of-type {
  margin-bottom: 0;
}

.slider-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.slider-label {
  font-size: 0.85rem;
  color: var(--text);
  font-weight: 600;
}

.slider-value {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary);
}

.range-slider {
  position: relative;
  height: 20px;
  display: flex;
  align-items: center;
}

.range-track {
  position: absolute;
  width: 100%;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
}

.range-fill {
  position: absolute;
  height: 4px;
  background: var(--primary);
  border-radius: 2px;
}

.range-input {
  position: absolute;
  width: 100%;
  height: 20px;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  pointer-events: none;
}

.range-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--white);
  border: 2px solid var(--primary);
  cursor: pointer;
  pointer-events: auto;
  transition: box-shadow 0.2s;
}

.range-input::-webkit-slider-thumb:hover {
  box-shadow: 0 0 0 6px rgba(232, 90, 44, 0.1);
}

.slider-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
}

.slider-mark {
  font-size: 0.65rem;
  color: var(--text-muted);
}

/* レベルインジケーター */
.level-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 10px 12px;
  background: var(--primary-light);
  border-radius: 8px;
}

.level-indicator svg {
  width: 18px;
  height: 18px;
  color: var(--primary);
  flex-shrink: 0;
}

.level-text {
  font-size: 0.75rem;
  color: var(--primary);
  font-weight: 500;
}

/* ソートボタン */
.sort-section {
  display: flex;
  gap: 8px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.sort-btn {
  flex: 1;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--white);
  font-size: 0.8rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}

.sort-btn.active {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
  font-weight: 600;
}

@media (min-width: 768px) {
  .sort-section {
    justify-content: center;
    gap: 12px;
    margin-top: 24px;
    padding-top: 24px;
  }
  
  .sort-btn {
    flex: none;
    padding: 10px 24px;
  }
}

/* 結果ヘッダー */
.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 20px 0 12px;
}

.results-count {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.results-count span {
  color: var(--text);
  font-weight: 600;
}

/* 表示切り替え */
.view-toggle {
  display: flex;
  gap: 2px;
  background: var(--border);
  padding: 3px;
  border-radius: 8px;
}

.view-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.view-btn.active {
  background: var(--white);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.view-btn svg {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
}

.view-btn.active svg {
  color: var(--text);
}

/* 商品 - リスト表示 */
.products {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.products.grid-view {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}

@media (min-width: 768px) {
  .products {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  
  .products.grid-view {
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
  }
}

@media (min-width: 1024px) {
  .products {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .products.grid-view {
    grid-template-columns: repeat(5, 1fr);
  }
}

.product-card {
  background: var(--white);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  gap: 12px;
  border: 1px solid var(--border);
  transition: all 0.2s;
  text-decoration: none;
  color: inherit;
}

.product-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.products.grid-view .product-card {
  padding: 0;
  flex-direction: column;
  overflow: hidden;
}

.product-img {
  width: 100px;
  height: 100px;
  border-radius: 8px;
  background: var(--bg);
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

.product-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@media (min-width: 768px) {
  .product-card {
    padding: 16px;
    gap: 16px;
  }
  
  .product-img {
    width: 120px;
    height: 120px;
  }
}

.products.grid-view .product-img {
  width: 100%;
  height: 0;
  padding-bottom: 100%;
  border-radius: 0;
}

.products.grid-view .product-img img {
  position: absolute;
  top: 0;
  left: 0;
}

.discount-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  padding: 3px 6px;
  background: var(--primary);
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--white);
}

.products.grid-view .discount-badge {
  top: 4px;
  left: 4px;
  font-size: 0.6rem;
}

.product-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.products.grid-view .product-info {
  padding: 6px;
}

.product-title {
  font-size: 0.85rem;
  font-weight: 500;
  line-height: 1.4;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.products.grid-view .product-title {
  display: none;
}

.product-meta {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 6px;
}

.products.grid-view .product-meta {
  margin-top: 0;
  flex-direction: column;
  gap: 2px;
}

.price-now {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
}

.products.grid-view .price-now {
  font-size: 0.85rem;
}

.price-original {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-decoration: line-through;
}

.products.grid-view .price-original {
  font-size: 0.6rem;
}

/* 商品カード非表示 */
.product-card.hidden {
  display: none;
}

/* もっと見るボタン */
.load-more-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: auto;
  margin: 24px auto 0;
  padding: 10px 24px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--white);
  font-size: 0.8rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}

.load-more-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

.load-more-btn svg {
  width: 16px;
  height: 16px;
}

.load-more-btn.hidden {
  display: none;
}

/* フッター */
.footer {
  margin-top: 48px;
  padding: 32px 0;
  border-top: 1px solid var(--border);
}

.footer-content {
  text-align: center;
}

.footer-logo {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text);
}

.footer-logo span {
  color: var(--primary);
}

.footer-desc {
  margin-top: 12px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.6;
  max-width: 360px;
  margin-left: auto;
  margin-right: auto;
}

.footer-social {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 20px;
}

.social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg);
  color: var(--text-secondary);
  transition: all 0.2s;
}

.social-link:hover {
  background: var(--primary-light);
  color: var(--primary);
}

.social-link svg {
  width: 20px;
  height: 20px;
}

.footer-links {
  margin-top: 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
}

.footer-links a {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s;
}

.footer-links a:hover {
  color: var(--primary);
}

.footer-divider {
  color: var(--border);
  font-size: 0.75rem;
}

.footer-copyright {
  margin-top: 20px;
  font-size: 0.7rem;
  color: var(--text-muted);
}

@media (min-width: 768px) {
  .footer {
    margin-top: 64px;
    padding: 40px 0;
  }
  
  .footer-desc {
    max-width: 480px;
  }
}