/* === すばらしきKindleセールの本棚 — Amazon-inspired Light Theme === */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Noto+Sans+JP:wght@400;500;600;700&display=swap');

:root {
  --bg: #F0F4F5;
  --surface: #FFFFFF;
  --header-bg: #1A3A4A;
  --header-text: #FFFFFF;
  --accent: #2EAD8E;
  --accent-hover: #25937A;
  --link: #1A7A8A;
  --link-hover: #B85C38;
  --price-sale: #B12704;
  --price-original: #565959;
  --text: #0F1111;
  --text-secondary: #565959;
  --text-light: #888;
  --border: #DDD;
  --border-light: #EDEDED;
  --star: #FFA41C;
  --star-empty: #E0E0E0;
  --badge-daily: #CC0C39;
  --badge-monthly: #007185;
  --badge-discount: #CC0C39;
  --shadow: 0 1px 3px rgba(0,0,0,.08);
  --shadow-hover: 0 4px 12px rgba(0,0,0,.12);
  --radius: 8px;
  --radius-sm: 4px;
  --font: 'Noto Sans JP', 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --sidebar-w: 260px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); text-decoration: underline; }
img { max-width: 100%; height: auto; }
[x-cloak] { display: none !important; }

/* ===== Header ===== */
.top-bar {
  background: var(--header-bg);
  color: var(--header-text);
  padding: 0.6rem 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
}
.top-bar-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.site-logo {
  flex-shrink: 0;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--header-text);
  text-decoration: none;
  letter-spacing: -0.02em;
}
.site-logo:hover { color: var(--accent); text-decoration: none; }
.site-logo small {
  display: block;
  font-size: 0.7rem;
  font-weight: 400;
  color: #CCC;
  letter-spacing: 0.02em;
}
.header-search {
  flex: 1;
  max-width: 600px;
  display: flex;
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.header-search input {
  flex: 1;
  border: none;
  padding: 0.55rem 0.8rem;
  font-size: 0.95rem;
  font-family: var(--font);
  color: var(--text);
  outline: none;
}
.header-search button {
  background: var(--accent);
  border: none;
  padding: 0 0.8rem;
  cursor: pointer;
  color: var(--text);
  font-size: 1.1rem;
  display: flex;
  align-items: center;
}
.header-search button:hover { background: var(--accent-hover); }
.header-right {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex-shrink: 0;
}
.lang-btn {
  background: none;
  border: 1px solid #555;
  color: #CCC;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.8rem;
  font-family: var(--font);
  transition: all 0.2s;
}
.lang-btn:hover { border-color: var(--accent); color: var(--accent); }
.lang-btn.active { background: var(--accent); color: #000; border-color: var(--accent); font-weight: 600; }

/* ===== Sub Nav ===== */
.sub-nav {
  background: #234A5A;
  padding: 0 1rem;
}
.sub-nav-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 0;
  width: 100%;
}
.nav-tab {
  background: none;
  border: none;
  color: #DDD;
  padding: 0.5rem 1rem;
  cursor: pointer;
  font-size: 0.9rem;
  font-family: var(--font);
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}
.nav-tab:hover { color: #FFF; border-bottom-color: var(--accent); }
.nav-tab.active { color: #FFF; border-bottom-color: var(--accent); font-weight: 600; }
.nav-meta {
  margin-left: auto;
  color: #999;
  font-size: 0.8rem;
  white-space: nowrap;
  padding: 0.5rem 0;
}

/* ===== Page Layout ===== */
.page-wrap {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1rem;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

/* ===== Sidebar ===== */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.filter-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.8rem 1rem;
  margin-bottom: 0.6rem;
}
.filter-section h3 {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--text);
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--border-light);
}
.filter-list { list-style: none; }
.filter-list li { padding: 0.15rem 0; }
.filter-check {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text);
}
.filter-check:hover { color: var(--link); }
.filter-check input[type="checkbox"] {
  accent-color: var(--accent);
  width: 14px;
  height: 14px;
  cursor: pointer;
}
.filter-count {
  color: var(--text-light);
  font-size: 0.75rem;
  margin-left: auto;
}
.filter-toggle-btn {
  background: none;
  border: none;
  color: var(--link);
  font-size: 0.8rem;
  cursor: pointer;
  padding: 0.3rem 0 0;
  font-family: var(--font);
}
.filter-toggle-btn:hover { text-decoration: underline; }

/* Discount filter links */
.discount-links { list-style: none; }
.discount-links li { padding: 0.15rem 0; }
.discount-link {
  background: none;
  border: none;
  color: var(--link);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0;
  font-family: var(--font);
}
.discount-link:hover { text-decoration: underline; }
.discount-link.active { color: var(--price-sale); font-weight: 600; }

/* Star rating filter */
.star-filter-row {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  cursor: pointer;
  padding: 0.2rem 0;
  font-size: 0.85rem;
}
.star-filter-row:hover { background: #f7f7f7; border-radius: 3px; }
.star-filter-row.active { font-weight: 600; }
.star-filter-label { color: var(--text-secondary); font-size: 0.8rem; }

/* Sidebar promo cards */
.promo-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 0.6rem;
  text-align: center;
}
.promo-card h4 {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
}
.promo-card p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 0.6rem;
  line-height: 1.5;
}
.promo-btn {
  display: inline-block;
  background: var(--accent);
  color: #000;
  padding: 0.45rem 1.2rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.2s;
}
.promo-btn:hover { background: var(--accent-hover); text-decoration: none; color: #000; }

.sidebar-ad { margin-bottom: 0.6rem; }

/* ===== Main Content ===== */
.main-content { flex: 1; min-width: 0; }

/* Results bar */
.results-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.8rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.results-count {
  font-size: 0.9rem;
  color: var(--text-secondary);
}
.results-count strong { color: var(--text); }
.sort-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.sort-row label {
  font-size: 0.85rem;
  color: var(--text-secondary);
}
.sort-select {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.6rem;
  font-size: 0.85rem;
  font-family: var(--font);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

/* Active filter tags */
.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.8rem;
}
.filter-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: #FEF3E2;
  border: 1px solid #FADA9F;
  color: #8B5E00;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.8rem;
}
.filter-tag-remove {
  background: none;
  border: none;
  color: #8B5E00;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0;
}
.clear-all-btn {
  background: none;
  border: none;
  color: var(--link);
  cursor: pointer;
  font-size: 0.8rem;
  font-family: var(--font);
}
.clear-all-btn:hover { text-decoration: underline; }

/* ===== Book Grid ===== */
.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
  align-items: stretch;
}

/* ===== Book Card ===== */
.book-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: box-shadow 0.2s, transform 0.15s;
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 340px;
}
.book-card-link {
  display: flex;
  flex-direction: column;
  flex: 1;
}
.book-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0.6rem 0.7rem 0.8rem;
}
.book-price-row {
  margin-top: auto;
  padding-top: 0.3rem;
}
.book-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}
.book-card-link:hover { text-decoration: none; }
.book-cover-wrap {
  position: relative;
  background: #F7F7F7;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.8rem;
  aspect-ratio: 3/4;
  overflow: hidden;
}
.book-cover {
  max-height: 100%;
  max-width: 100%;
  object-fit: contain;
  border-radius: 2px;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.sale-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 0.65rem;
  font-weight: 700;
  color: #FFF;
}
.badge-daily { background: var(--badge-daily); }
.badge-monthly { background: var(--badge-monthly); }
.discount-corner {
  position: absolute;
  top: 6px;
  right: 6px;
  background: var(--badge-discount);
  color: #FFF;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 0.75rem;
  font-weight: 700;
}
.book-body { padding: 0.6rem 0.7rem 0.8rem; }
.book-name {
  font-size: 0.85rem;
  font-weight: 500;
  line-height: 1.4;
  color: var(--link);
  margin-bottom: 0.2rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.book-card-link:hover .book-name { color: var(--link-hover); }
.book-author {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-bottom: 0.3rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Star rating inline */
.stars-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  margin-bottom: 0.25rem;
}
.stars-display {
  position: relative;
  display: inline-block;
  width: 70px;
  height: 14px;
  font-size: 0;
}
.stars-empty, .stars-filled {
  position: absolute;
  top: 0;
  left: 0;
  white-space: nowrap;
  overflow: hidden;
  font-size: 14px;
  line-height: 1;
  letter-spacing: 0;
}
.stars-empty { color: var(--star-empty); width: 100%; }
.stars-filled { color: var(--star); }
.rating-text { font-size: 0.75rem; color: var(--link); }

/* Price */
.book-price-row { margin-top: 0.3rem; }
.price-sale {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--price-sale);
}
.price-original {
  font-size: 0.78rem;
  color: var(--price-original);
  text-decoration: line-through;
  margin-left: 0.3rem;
}
.discount-label {
  display: inline-block;
  background: var(--badge-discount);
  color: #FFF;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 0.7rem;
  font-weight: 700;
  margin-right: 0.3rem;
  vertical-align: middle;
}
.book-publisher-tag {
  font-size: 0.7rem;
  color: var(--text-light);
  margin-top: 0.2rem;
}

/* Inline ad slot in grid - styled like a book card for proper alignment */
.ad-slot-inline {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  min-height: 340px;
}

.ad-slot-inline .adsbygoogle {
  width: 100%;
}

@media (max-width: 480px) {
  /* Hide inline ads on mobile - they break layout */
  .ad-slot-inline {
    display: none;
  }
}

.no-results {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-secondary);
  font-size: 1rem;
}

/* ===== Audible / KU Promo Banner ===== */
.promo-banner {
  background: linear-gradient(135deg, #1A3A4A 0%, #2A5A6A 100%);
  border-radius: var(--radius);
  padding: 1.5rem 2rem;
  margin: 1.5rem 0;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  color: #FFF;
}
.promo-banner-icon {
  font-size: 2.5rem;
  flex-shrink: 0;
}
.promo-banner-text { flex: 1; }
.promo-banner-text h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
}
.promo-banner-text p {
  font-size: 0.85rem;
  color: #CCC;
  margin-bottom: 0.6rem;
}
.promo-banner .promo-btn { flex-shrink: 0; }

/* ===== Footer ===== */
.site-footer {
  background: #1A3A4A;
  color: #DDD;
  padding: 1.5rem 1rem;
  margin-top: 2rem;
  text-align: center;
  font-size: 0.8rem;
  line-height: 1.8;
}
.site-footer a { color: #DDD; }
.site-footer a:hover { color: var(--accent); }
.footer-links { margin-bottom: 0.5rem; }
.footer-links a { margin: 0 0.8rem; }
.footer-disclosure {
  color: #999;
  font-size: 0.75rem;
  margin-top: 0.5rem;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

/* ===== Mobile filter button ===== */
.mobile-filter-btn {
  display: none;
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  background: var(--accent);
  color: #000;
  border: none;
  padding: 0.7rem 1.2rem;
  border-radius: 30px;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,.25);
  z-index: 90;
}
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 95;
}
.sidebar-close-btn {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text);
  padding: 0.3rem;
  margin-bottom: 0.5rem;
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
  .book-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}
@media (max-width: 768px) {
  .top-bar-inner { 
    flex-wrap: wrap;
  }
  .site-logo { 
    flex: 0 1 auto;
    max-width: 50%;
  }
  .header-right { 
    flex: 0 0 auto;
  }
  .header-search { 
    flex-basis: 100% !important;
    width: 100% !important;
    max-width: 100% !important;
    order: 10;
    margin-top: 0.5rem;
    margin-bottom: 0.3rem;
  }
  .header-search input {
    padding: 0.7rem 0.8rem;
    font-size: 1rem;
    width: 100%;
  }
  .header-search button {
    padding: 0 1rem;
  }
  .sub-nav { padding: 0 0.5rem; }
  .nav-meta { display: none; }
  .page-wrap { flex-direction: column; padding: 0.5rem; }
  .sidebar {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 85%;
    max-width: 320px;
    height: 100vh;
    z-index: 100;
    background: var(--bg);
    overflow-y: auto;
    padding: 1rem;
    box-shadow: 4px 0 20px rgba(0,0,0,.2);
  }
  .sidebar.open { display: flex; }
  .sidebar-backdrop.open { display: block; }
  .sidebar-close-btn.open { display: block; }
  .mobile-filter-btn { display: block; }
  .book-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 0.6rem; }
  .book-body { padding: 0.5rem; }
  .book-name { font-size: 0.8rem; }
  .promo-banner { flex-direction: column; text-align: center; padding: 1rem; }
}
@media (max-width: 480px) {
  /* Mobile: 1 column for clean, reliable layout */
  .book-grid { 
    grid-template-columns: 1fr; 
    gap: 0.5rem;
  }
  .book-card {
    min-height: auto;
  }
  .book-cover-wrap { padding: 0.5rem; }
}
