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

:root {
  --primary: #e94560;
  --primary-dark: #c73652;
  --bg: #f2f4f7;
  --card-bg: #ffffff;
  --card-border: #e8e8e8;
  --text: #1a1a1a;
  --text-muted: #999;
  --shadow: 0 1px 6px rgba(0,0,0,0.07);
  --shadow-hover: 0 6px 20px rgba(0,0,0,0.12);
  --radius: 10px;
}

body {
  font-family: 'Hiragino Kaku Gothic ProN', 'Meiryo', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
}

/* Header */
.site-header {
  background: #fff;
  border-bottom: 3px solid var(--primary);
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}

.site-logo-wrap {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.site-logo {
  color: var(--text);
  text-decoration: none;
  font-size: 1.2rem;
  font-weight: bold;
  display: flex;
  align-items: center;
  gap: 8px;
}

.site-logo::before {
  content: '';
  display: inline-block;
  width: 5px;
  height: 20px;
  background: var(--primary);
  border-radius: 3px;
}

.site-tagline {
  font-size: 0.67rem;
  color: #aaa;
  padding-left: 13px;
}

.site-nav {
  display: flex;
  gap: 2px;
}

.site-nav a {
  color: #555;
  text-decoration: none;
  padding: 6px 16px;
  border-radius: 6px;
  font-size: 0.88rem;
  transition: all 0.2s;
  font-weight: 500;
}

.site-nav a:hover {
  color: var(--primary);
  background: #fff0f3;
}

/* Search */
.site-search {
  position: relative;
}
.site-search input {
  width: 220px;
  padding: 7px 12px;
  border: 1px solid #ddd;
  border-radius: 20px;
  font-size: 0.85rem;
  outline: none;
  transition: border 0.2s;
}
.site-search input:focus {
  border-color: var(--primary);
}
.search-results {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 320px;
  background: #fff;
  border: 1px solid #eee;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  z-index: 1000;
  overflow: hidden;
}
.search-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  text-decoration: none;
  color: #333;
  font-size: 0.85rem;
  border-bottom: 1px solid #f5f5f5;
  transition: background 0.15s;
}
.search-item:hover {
  background: #fff0f3;
}
.search-item img {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
}
.search-item span {
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.search-noresult {
  padding: 12px;
  color: #aaa;
  font-size: 0.85rem;
  text-align: center;
}
@media (max-width: 768px) {
  .site-search {
    width: 100%;
    padding: 8px 16px;
    border-top: 1px solid #eee;
  }
  .site-search input {
    width: 100%;
    box-sizing: border-box;
  }
  .search-results {
    width: 100%;
    left: 0;
    right: 0;
  }
  .site-header .container {
    flex-wrap: wrap;
    height: auto;
    padding: 8px 16px;
  }
}

/* Page header bar */
.page-header {
  background: #fff;
  border-bottom: 1px solid var(--card-border);
  padding: 14px 0;
  margin-bottom: 24px;
}

.page-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.page-header-left {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.page-title {
  font-size: 1.1rem;
  font-weight: bold;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.page-title::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 18px;
  background: var(--primary);
  border-radius: 2px;
}

.page-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  padding-left: 12px;
}

.page-count {
  font-size: 0.8rem;
  color: var(--text-muted);
  background: #f5f5f5;
  padding: 4px 12px;
  border-radius: 20px;
}

/* Breadcrumb */
.breadcrumb {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.breadcrumb a {
  color: var(--primary);
  text-decoration: none;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

.breadcrumb-sep {
  color: #ccc;
}

/* Main */
.main-content {
  padding: 0 0 60px;
}

/* Product Grid */
.product-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
}

@media (max-width: 1200px) {
  .product-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 900px) {
  .product-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 600px) {
  .product-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
}

/* Product Card */
.product-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
}

.product-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
}

.product-card a {
  text-decoration: none;
  color: inherit;
  display: block;
}

.card-image {
  overflow: hidden;
  background: #eee;
  position: relative;
}

.card-image img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 0.3s ease;
}

.product-card:hover .card-image img {
  transform: scale(1.04);
}

.card-badge {
  position: absolute;
  top: 7px;
  left: 7px;
  background: var(--primary);
  color: #fff;
  font-size: 0.62rem;
  font-weight: bold;
  padding: 2px 7px;
  border-radius: 4px;
  letter-spacing: 0.05em;
  z-index: 2;
}

.card-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.product-card:hover .card-overlay {
  opacity: 1;
}

.card-overlay-text {
  color: #fff;
  font-size: 0.82rem;
  font-weight: bold;
  background: var(--primary);
  padding: 8px 18px;
  border-radius: 20px;
}

.card-body {
  padding: 10px;
}

.card-title {
  font-size: 0.8rem;
  font-weight: bold;
  line-height: 1.5;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: #222;
}

.card-author {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-bottom: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-price {
  font-size: 0.95rem;
  font-weight: bold;
  color: var(--primary);
  margin-bottom: 6px;
}

.card-genres {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}

.genre-tag {
  font-size: 0.64rem;
  background: #f5f5f5;
  color: #666;
  padding: 2px 7px;
  border-radius: 10px;
  text-decoration: none;
  transition: all 0.15s;
  white-space: nowrap;
}

.genre-tag:hover {
  background: var(--primary);
  color: #fff;
}

/* Home ranking section */
.home-ranking {
  margin-top: 48px;
  padding-top: 32px;
  border-top: 2px solid var(--card-border);
}

.home-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.more-link {
  font-size: 0.85rem;
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}

.more-link:hover {
  text-decoration: underline;
}

/* Ranking */
.ranking-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ranking-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 12px;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
  transition: all 0.2s ease;
}

.ranking-card:hover {
  transform: translateX(4px);
  box-shadow: var(--shadow-hover);
  border-color: var(--primary);
}

.ranking-num {
  font-size: 1.6rem;
  font-weight: bold;
  color: #ddd;
  min-width: 48px;
  text-align: center;
  line-height: 1;
}

.ranking-card:nth-child(1) .ranking-num { color: #FFD700; }
.ranking-card:nth-child(2) .ranking-num { color: #C0C0C0; }
.ranking-card:nth-child(3) .ranking-num { color: #CD7F32; }

.ranking-image {
  width: 80px;
  flex-shrink: 0;
  border-radius: 6px;
  overflow: hidden;
  background: #eee;
}

.ranking-image img {
  width: 100%;
  height: auto;
  display: block;
}

.ranking-body {
  flex: 1;
  min-width: 0;
}

.ranking-title {
  font-size: 0.9rem;
  font-weight: bold;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: #222;
}

.ranking-author {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.ranking-price {
  font-size: 0.95rem;
  font-weight: bold;
  color: var(--primary);
  margin-bottom: 6px;
}

/* Terms (Genre/Author list) */
.terms-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}

@media (max-width: 900px) {
  .terms-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 600px) {
  .terms-grid { grid-template-columns: repeat(2, 1fr); }
}

.term-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 18px 12px;
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow);
  transition: all 0.2s ease;
  text-align: center;
  gap: 5px;
}

.term-card:hover {
  border-color: var(--primary);
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
  color: var(--primary);
}

.term-name {
  font-size: 0.88rem;
  font-weight: bold;
}

.term-count {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Product Detail */
.detail-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 32px;
  margin-bottom: 48px;
}

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

.detail-image img {
  width: 100%;
  border-radius: var(--radius);
  box-shadow: var(--shadow-hover);
}

/* Gallery */
.gallery-main {
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  box-shadow: var(--shadow-hover);
}
.gallery-main img {
  width: 100%;
  display: block;
}
.gallery-thumbs {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  width: 100%;
  box-sizing: border-box;
}
.gallery-thumbs::-webkit-scrollbar {
  height: 4px;
}
.gallery-thumbs::-webkit-scrollbar-thumb {
  background: #555;
  border-radius: 2px;
}
.gallery-thumb {
  flex: 0 0 44px;
  height: 44px;
  overflow: hidden;
  border-radius: 4px;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.2s;
  border: 2px solid transparent;
}
.gallery-thumb:hover {
  opacity: 1;
}
.gallery-thumb.active {
  opacity: 1;
  border-color: var(--accent);
}
.gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.detail-title {
  font-size: 1.25rem;
  margin-bottom: 20px;
  line-height: 1.6;
  color: #111;
}

.detail-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 22px;
  font-size: 0.88rem;
}

.detail-table th,
.detail-table td {
  padding: 10px 12px;
  border: 1px solid #eee;
  text-align: left;
}

.detail-table th {
  background: #fafafa;
  width: 90px;
  white-space: nowrap;
  color: #777;
}

.buy-button {
  display: block;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  text-decoration: none;
  text-align: center;
  padding: 16px;
  border-radius: var(--radius);
  font-size: 1.05rem;
  font-weight: bold;
  margin-bottom: 24px;
  transition: all 0.2s;
  box-shadow: 0 4px 14px rgba(233,69,96,0.3);
  letter-spacing: 0.03em;
}

.buy-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(233,69,96,0.45);
}

.detail-description {
  font-size: 0.88rem;
  line-height: 1.9;
  color: #666;
  background: #fafafa;
  padding: 16px;
  border-radius: 8px;
  border: 1px solid #eee;
}

/* Sample images */
.sample-section {
  margin-top: 48px;
  padding-top: 32px;
  border-top: 1px solid #eee;
}

.sample-toggle-btn {
  display: block;
  width: 100%;
  padding: 14px 20px;
  background: linear-gradient(135deg, #fff0f3 0%, #fff5f7 100%);
  border: 2px solid var(--primary);
  border-radius: var(--radius);
  color: var(--primary);
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  text-align: center;
  transition: background 0.2s, color 0.2s;
}

.sample-toggle-btn:hover {
  background: var(--primary);
  color: #fff;
}

.sample-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease;
}

.sample-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 20px 0 28px;
}

.sample-image {
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid #eee;
}

.sample-image img {
  width: 100%;
  height: auto;
  display: block;
}

.sample-cta {
  text-align: center;
  padding: 28px;
  background: linear-gradient(135deg, #fff0f3 0%, #fff5f7 100%);
  border-radius: var(--radius);
  border: 1px solid #ffd6de;
  margin-bottom: 10px;
}

.sample-cta-text {
  font-size: 0.95rem;
  color: #666;
  margin-bottom: 16px;
}

.sample-cta-btn {
  display: inline-block;
  max-width: 280px;
  margin: 0 auto;
}

@media (max-width: 600px) {
  .sample-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Lightbox reader */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  align-items: center;
  justify-content: center;
}
.lightbox.active {
  display: flex;
}
.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
}
.lightbox-body {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  max-width: 90vw;
}
.lightbox-img {
  max-width: 85vw;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.5);
}
.lightbox-counter {
  color: rgba(255,255,255,0.7);
  font-size: 0.9rem;
  text-align: center;
}
.lightbox-cta {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  white-space: nowrap;
}
.lightbox-cta .buy-button {
  font-size: 0.85rem;
  padding: 8px 20px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.4);
}
.lightbox-close {
  position: fixed;
  top: 16px;
  right: 20px;
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  font-size: 1.5rem;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  z-index: 2;
  line-height: 1;
}
.lightbox-close:hover { background: rgba(255,255,255,0.3); }
.lightbox-prev,
.lightbox-next {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  font-size: 2.5rem;
  padding: 10px 18px;
  cursor: pointer;
  border-radius: 4px;
  line-height: 1;
  z-index: 2;
}
.lightbox-prev { left: 8px; }
.lightbox-next { right: 8px; }
.lightbox-prev:hover,
.lightbox-next:hover { background: rgba(255,255,255,0.3); }

/* Related Products */
.related-products {
  margin-top: 48px;
  padding-top: 28px;
  border-top: 1px solid #eee;
}

.related-products h2 {
  font-size: 1rem;
  margin-bottom: 16px;
  padding-left: 10px;
  border-left: 3px solid var(--primary);
  color: #333;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin-top: 40px;
  flex-wrap: wrap;
  padding: 0;
}

.pagination a,
.pagination span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 14px;
  border: 1px solid #ddd;
  border-radius: 8px;
  text-decoration: none;
  color: #444;
  font-size: 0.88rem;
  transition: all 0.15s;
  background: #fff;
}

.pagination span.current {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  font-weight: bold;
}

.pagination span.disabled {
  background: #f8f8f8;
  color: #ccc;
  border-color: #eee;
  cursor: default;
}

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

/* Footer */
.site-footer {
  background: #222;
  color: #666;
  text-align: center;
  padding: 28px 0;
  font-size: 0.82rem;
  margin-top: 60px;
}

.site-footer p {
  margin-bottom: 4px;
}
