:root {
  --primary: #A6D8A8;
  --accent: #2E7D32;
  --bg: #fafafa;
  --text: #222;
  --border: #e0e0e0;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
.site-header {
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.site-header .container.header-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  padding-bottom: 12px;
  position: relative;
}

.site-header .brand {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.site-header img {
  height: 48px;
  transition: transform 0.3s;
}

.site-header img:hover {
  transform: scale(1.05);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.main-nav {
  display: flex;
  gap: 24px;
  align-items: center;
}

/* パソコンでは、ナビをロゴのすぐ右に置き、カートと設定だけを右端に寄せる。
   ナビを右端に寄せていたため、項目を減らすとロゴとの間が大きく空いていた(2026-09-26) */
@media (min-width: 901px) {
  .site-header .container.header-container {
    justify-content: flex-start;
    gap: 32px;
  }

  .header-actions {
    flex: 1;
  }

  .main-nav {
    margin-right: auto;
  }
}

.main-nav a {
  color: var(--text);
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-weight: 500;
  transition: background 0.2s, color 0.2s;
  white-space: nowrap;
}

.main-nav a:hover {
  background: var(--primary);
  color: var(--accent);
}

/* Navigation Category Dropdown */
.nav-dropdown {
  position: relative;
  display: inline-block;
}

.nav-dropdown-toggle {
  display: inline-block;
  color: var(--text);
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s, color 0.2s;
}

.nav-dropdown:hover .nav-dropdown-toggle {
  background: var(--primary);
  color: var(--accent);
}

.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 240px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  padding: 12px;
  z-index: 200;
}

.nav-dropdown:hover .nav-dropdown-menu {
  display: block;
}

.nav-dropdown-group {
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid #f0f0f0;
}

.nav-dropdown-group:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.nav-dropdown-parent {
  font-weight: bold;
  color: var(--accent) !important;
  font-size: 14px;
  display: block;
  padding: 4px 8px !important;
}

.nav-dropdown-children {
  display: flex;
  flex-direction: column;
  padding-left: 8px;
}

.nav-dropdown-child {
  font-size: 13px;
  color: #555 !important;
  padding: 3px 8px !important;
  font-weight: normal !important;
}

.nav-dropdown-child:hover {
  background: #f5f9f5 !important;
  color: var(--accent) !important;
}

.icon-link {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  color: var(--text);
  text-decoration: none;
  border-radius: 50%;
  transition: background 0.2s;
}

.icon-link svg {
  width: 22px;
  height: 22px;
}

.icon-link:hover {
  background: var(--primary);
  color: var(--accent);
}

/* Cart badge style */
.cart-link {
  position: relative;
}

#nav-cart-count {
  position: absolute;
  top: -2px;
  right: -2px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  min-width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

/* Menu Toggle Button */
.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 30px;
  height: 20px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 101;
}

.menu-toggle span {
  width: 100%;
  height: 2px;
  background-color: var(--text);
  border-radius: 2px;
  transition: all 0.3s ease;
}

.menu-toggle.active span:nth-child(1) {
  transform: translateY(9px) rotate(45deg);
}

.menu-toggle.active span:nth-child(2) {
  opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
  transform: translateY(-9px) rotate(-45deg);
}

/* Main content */
main.container {
  padding-bottom: 60px;
  min-height: calc(100vh - 200px);
}

/* Footer */
.site-footer {
  margin-top: 80px;
  padding: 32px 0;
  border-top: 1px solid var(--border);
  background: #fff;
  text-align: center;
}

.site-footer a {
  color: #666;
  text-decoration: none;
  transition: color 0.2s;
}

.site-footer a:hover {
  color: var(--accent);
}

/* Typography */
h1 {
  font-size: 2.5em;
  font-weight: 700;
  margin-bottom: 24px;
}

h2 {
  font-size: 2em;
  font-weight: 700;
  margin: 32px 0 24px;
}

h3 {
  font-size: 1.5em;
  font-weight: 600;
  margin: 20px 0 12px;
}

p {
  margin-bottom: 16px;
}

/* Cards */
.cards, .product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 24px;
  margin-top: 32px;
}

.card {
  display: block;
  border-radius: 12px;
  overflow: hidden;
  color: inherit;
  text-decoration: none;
  position: relative;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: transform 0.3s, box-shadow 0.3s;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.card img {
  width: 100%;
  height: 200px;
  object-fit: cover;
}

.card h3 {
  padding: 16px;
  margin: 0;
  font-size: 1.1em;
}

.badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
}

td,
th {
  border: 1px solid var(--border);
  padding: 12px;
}

table th {
  background: #f5f5f5;
  font-weight: 600;
  text-align: left;
}

table tr:hover td {
  background: #fafafa;
}

/* Product detail */
.product-detail {
  margin-top: 32px;
}

.product-detail .info {
  max-width: 800px;
  margin: 0 auto;
}

.product-detail h1 {
  font-size: 2em;
  margin-bottom: 24px;
  color: var(--text);
}

.product-description {
  line-height: 1.8;
  font-size: 16px;
  color: #333;
  margin-bottom: 32px;
}

.product-description img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 20px 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.product-description h2,
.product-description h3,
.product-description h4 {
  margin-top: 24px;
  margin-bottom: 12px;
}

.product-purchase {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 40px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.product-purchase .price {
  font-size: 1.5em;
  color: var(--accent);
  margin-bottom: 12px;
}

.product-purchase .stock {
  color: #666;
  margin-bottom: 20px;
}

.product-purchase form {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.product-purchase label {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.product-purchase input[type=number] {
  width: 80px;
}

/* Seller information section */
.seller-info {
  max-width: 800px;
  margin: 60px auto 0;
  padding: 32px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.seller-info h3 {
  margin: 0 0 24px;
  font-size: 1.3em;
  color: var(--text);
}

.seller-card {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.seller-avatar,
.seller-avatar-placeholder {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.seller-avatar-placeholder {
  background: #e0e0e0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
}

.seller-details {
  flex: 1;
}

.seller-details h4 {
  margin: 0 0 8px;
  font-size: 1.2em;
}

.seller-details h4 a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s;
}

.seller-details h4 a:hover {
  color: #1b5e20;
  text-decoration: underline;
}

.seller-details p {
  margin: 0;
  color: #666;
  line-height: 1.6;
}

/* Product list filtering */
.product-list-container {
  display: grid;
  grid-template-columns: 250px 1fr;
  gap: 32px;
  margin-top: 32px;
}

.filter-sidebar {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  height: fit-content;
  position: sticky;
  top: 80px;
}

.filter-sidebar h2 {
  margin: 0 0 24px;
  font-size: 1.3em;
}

.filter-section {
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.filter-section:last-of-type {
  border-bottom: none;
}

.filter-section h3 {
  margin: 0 0 12px;
  font-size: 1em;
  font-weight: 600;
}

.filter-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  cursor: pointer;
  font-size: 14px;
}

.filter-option input[type="radio"] {
  width: auto;
  cursor: pointer;
}

.price-select {
  width: 100%;
}

.sort-select {
  width: 100%;
}

.filter-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 24px;
}

.filter-actions button,
.filter-actions a {
  width: 100%;
  text-align: center;
}

.product-grid-container {
  min-width: 0;
}

.product-count {
  margin-bottom: 20px;
  color: #666;
  font-size: 14px;
}

.no-products {
  text-align: center;
  padding: 60px 20px;
  color: #999;
}

.card-no-image {
  width: 100%;
  height: 200px;
  background: #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #999;
}

.card-content {
  padding: 12px;
}

.card-price {
  font-size: 1.2em;
  font-weight: 600;
  color: var(--accent);
  margin: 8px 0 0;
}

/* Buttons */
button,
.btn {
  appearance: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 12px 24px;
  font-weight: 600;
  font-size: 1em;
  cursor: pointer;
  transition: all 0.2s;
}

button:hover,
.btn:hover {
  background: #f5f5f5;
  border-color: #ccc;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary,
#to-payment {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.btn-primary:hover,
#to-payment:hover {
  background: #1b5e20;
  border-color: #1b5e20;
}

/* Forms */
label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin: 16px 0 6px;
  color: #333;
}

input[type=text],
input[type=email],
input[type=tel],
input[type=number],
input[type=password],
textarea,
select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  font-size: 15px;
  outline: none;
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.1);
}

/* Utility */
.error {
  color: #d32f2f;
  margin: 12px 0;
}

.note {
  color: #666;
  font-size: 14px;
  margin: 8px 0;
}

.actions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 20px;
}

/* Checkout */
.checkout {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 32px;
  align-items: start;
  margin-top: 32px;
}

.checkout .buyer,
.checkout .summary {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.checkout h3 {
  margin-top: 0;
}

/* Cart */
.cart-table input[type=number] {
  width: 80px;
}

/* Auth */
.auth {
  max-width: 440px;
  margin: 40px auto;
  padding: 32px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.auth h2 {
  margin-top: 0;
}

.auth .actions {
  margin-top: 24px;
}

/* Event Content (CKEditor output) */
.event-content {
  line-height: 1.8;
  font-size: 16px;
  color: #333;
}

.event-content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 20px 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.event-content h2 {
  margin-top: 32px;
  margin-bottom: 16px;
  font-size: 1.8em;
  color: #222;
  border-bottom: 2px solid var(--primary);
  padding-bottom: 8px;
}

.event-content h3 {
  margin-top: 24px;
  margin-bottom: 12px;
  font-size: 1.4em;
  color: #333;
}

.event-content ul,
.event-content ol {
  margin: 16px 0;
  padding-left: 28px;
}

.event-content li {
  margin-bottom: 8px;
}

.event-content blockquote {
  border-left: 4px solid var(--accent);
  padding-left: 20px;
  margin: 20px 0;
  color: #555;
  font-style: italic;
  background: #f9f9f9;
  padding: 16px 20px;
  border-radius: 4px;
}

.event-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.event-content table th,
.event-content table td {
  border: 1px solid #ddd;
  padding: 12px;
  text-align: left;
}

.event-content table th {
  background: #f5f5f5;
  font-weight: 600;
  color: #333;
}

.event-content table tr:hover {
  background: #fafafa;
}

.event-content a {
  color: var(--accent);
  text-decoration: underline;
  transition: color 0.2s;
}

.event-content a:hover {
  color: #1b5e20;
}

.event-content p {
  margin-bottom: 16px;
  line-height: 1.8;
}

.event-content figure {
  margin: 24px 0;
}

.event-content figure img {
  margin: 0;
}

.event-content figcaption {
  text-align: center;
  color: #666;
  font-size: 14px;
  margin-top: 8px;
  font-style: italic;
}

/* Responsive */
@media (max-width:900px) {
  .checkout {
    grid-template-columns: 1fr;
  }

  .product-detail {
    grid-template-columns: 1fr;
  }

  .product-list-container {
    grid-template-columns: 1fr;
  }

  .filter-sidebar {
    position: static;
    padding: 16px;
  }

  .filter-sidebar h2 {
    font-size: 1.1em;
    margin-bottom: 16px;
  }

  /* モバイルでフィルターを横並びに */
  .filter-sidebar form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
  }

  .filter-section {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
  }

  .filter-section h3 {
    font-size: 0.9em;
    margin-bottom: 8px;
  }

  .filter-option {
    padding: 4px 0;
    font-size: 13px;
  }

  .filter-actions {
    grid-column: 1 / -1;
    flex-direction: row;
    margin-top: 8px;
  }

  .cards, .product-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }
}

@media (max-width: 900px) {
  .menu-toggle {
    display: flex;
  }

  .main-nav {
    position: fixed;
    top: 73px; /* Header height */
    left: 0;
    width: 100%;
    height: calc(100vh - 73px);
    background: #fff;
    flex-direction: column;
    align-items: flex-start;
    padding: 20px;
    gap: 0;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 100;
    box-shadow: inset 0 2px 8px rgba(0,0,0,0.05);
  }

  .main-nav.active {
    transform: translateX(0);
  }

  .main-nav a {
    width: 100%;
    padding: 16px;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
    font-size: 18px;
  }

  .main-nav a:last-child {
    border-bottom: none;
  }

  .site-header nav {
    gap: 12px;
  }

  .site-header nav a {
    padding: 6px 12px;
    font-size: 14px;
  }
  h1 {
    font-size: 2.5em; /* Restore desktop size or keep mobile? Let's use 2em for mobile as before */
  }
}

@media (max-width: 600px) {
  h1 {
    font-size: 2em;
  }

  h2 {
    font-size: 1.5em;
  }

  .cards, .product-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .card img, .card-no-image {
    height: 150px;
  }

  .card h3 {
    padding: 10px;
    font-size: 0.95em;
  }

  .card-content {
    padding: 10px;
  }

  .event-content h2 {
    font-size: 1.5em;
  }

  .event-content h3 {
    font-size: 1.2em;
  }
}

/* ============================================================
   Product List & Sidebar Category Tree Refinements (Points 1-8)
   ============================================================ */

.sidebar-category-tree {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar-category-tree .cat-item {
  margin-bottom: 6px;
}

.sidebar-category-tree .cat-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  font-size: 14px;
  color: #333;
  text-decoration: none;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.sidebar-category-tree .cat-link:hover {
  background: #f5f9f5;
  color: var(--accent);
}

.sidebar-category-tree .cat-group {
  margin-top: 20px;
}

.sidebar-category-tree .cat-parent-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  border-radius: 6px;
  transition: all 0.2s ease;
}

/* 1. 大分類: アイコン表示＋フォント調整 */
.sidebar-category-tree .cat-parent-link {
  display: inline-flex;
  align-items: center;
  font-size: 13px;
  font-weight: 700;
  color: #666;
  text-decoration: none;
  letter-spacing: 0.04em;
  transition: color 0.2s;
}

.cat-icon-img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  margin-right: 8px;
  flex-shrink: 0;
  vertical-align: middle;
}

.nav-dropdown-parent .header-cat-icon {
  width: 26px;
  height: 26px;
  margin-right: 8px;
}

.sidebar-category-tree .cat-parent-row:hover .cat-parent-link {
  color: var(--accent);
}

.sidebar-category-tree .cat-children-list {
  list-style: none;
  padding-left: 14px;
  margin-top: 4px;
  margin-bottom: 0;
}

/* 1, 2, 8. 中分類: 通常文字色(#333)、インデント、中黒なし、引き締まった行間＋アイコン表示 */
.sidebar-category-tree .cat-child-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
  padding: 5px 8px;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.sidebar-category-tree .cat-child-link, .nav-dropdown-child {
  display: inline-flex;
  align-items: center;
  font-size: 14px;
  color: #333;
  text-decoration: none;
  font-weight: normal;
  transition: color 0.2s;
}

.sub-cat-icon {
  width: 26px;
  height: 26px;
  margin-right: 8px;
}

.header-sub-cat-icon {
  width: 22px;
  height: 22px;
  margin-right: 7px;
}

.sidebar-category-tree .cat-child-row:hover .cat-child-link {
  color: var(--accent);
}

/* 6. 件数表示 */
.sidebar-category-tree .cat-count {
  font-size: 12px;
  color: #888;
  font-weight: normal;
  margin-left: 6px;
}

/* 4. 選択中カテゴリデザイン（薄い緑背景＋左端の太いアクセントバー） */
.sidebar-category-tree .active-cat {
  background: #e8f5e9 !important;
  border-left: 4px solid var(--accent) !important;
  border-radius: 0 6px 6px 0 !important;
  padding-left: 8px !important;
}

.sidebar-category-tree .active-cat .cat-parent-link,
.sidebar-category-tree .active-cat .cat-child-link,
.sidebar-category-tree .active-cat .all-cat-link {
  color: var(--accent) !important;
  font-weight: 700 !important;
}

.sidebar-category-tree .active-cat .cat-count {
  color: var(--accent) !important;
  font-weight: 600 !important;
}

/* 7. 統合ヘッダーバー: 件数＋フィルターチップ（左） と 並び替え（右） */
.product-grid-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding: 12px 16px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 24px;
}

.grid-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.product-grid-header .product-count {
  font-size: 14px;
  font-weight: 600;
  color: #333;
  margin: 0;
}

.active-filter-chips {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: #e8f5e9;
  color: var(--accent);
  border-radius: 16px;
  font-size: 13px;
  font-weight: 600;
}

.chip-remove {
  color: var(--accent);
  text-decoration: none;
  font-weight: bold;
  font-size: 14px;
  line-height: 1;
  padding: 0 2px;
  border-radius: 50%;
  transition: opacity 0.2s;
}

.chip-remove:hover {
  opacity: 0.7;
}

.grid-header-right .sort-form {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sort-label {
  font-size: 13px;
  color: #666;
  margin: 0;
  white-space: nowrap;
}

.sort-select-top {
  padding: 6px 12px;
  font-size: 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
}

/* 5. 3列グリッド & バランス調整
   4列だとカードが細く、長い商品名が何行も折り返して縦長になっていた(幅195px×高さ557px)。
   3列・正方形の画像・商品名は2行まで にして、カードがおよそ 3:4 になるようにしている(2026-09-26) */
.product-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 0;
}

.product-cards-grid .card img,
.product-cards-grid .card-no-image {
  height: auto;
  aspect-ratio: 1 / 1;
  display: block;
}

.product-cards-grid .card-content {
  padding: 12px 14px 14px;
}

.product-cards-grid .card h3 {
  padding: 0;
  margin: 0 0 6px;
  font-size: 1em;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-cards-grid .card-price {
  margin: 0;
  font-size: 1.05em;
}


@media (max-width: 768px) {
  .product-cards-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  /* スマホは列が細いので、画像を少し横長にして 3:4 に近づける */
  .product-cards-grid .card img,
  .product-cards-grid .card-no-image {
    aspect-ratio: 4 / 3;
  }

  .product-cards-grid .card-content {
    padding: 8px 10px 10px;
  }

  .product-cards-grid .card h3 {
    font-size: 0.9em;
    margin-bottom: 4px;
  }

  .product-cards-grid .card-price {
    font-size: 0.95em;
  }
}

/* ============================================================
   Header Category Dropdown Menu (Compact Vertical Spacing)
   ============================================================ */

.nav-dropdown {
  position: relative;
  display: inline-block;
}

.nav-dropdown-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

.nav-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 230px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  padding: 6px 0;
  display: none;
  z-index: 1000;
  max-height: 80vh;
  overflow-y: auto;
}

.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown-menu:hover {
  display: block;
}

.nav-dropdown-group {
  padding: 2px 0;
  border-bottom: 1px dashed #eee;
}

.nav-dropdown-group:last-child {
  border-bottom: none;
}

/* 大分類: コンパクトなパディングと見やすいスタイル */
.nav-dropdown-parent {
  display: flex !important;
  align-items: center !important;
  padding: 4px 12px !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  color: var(--accent) !important;
  text-decoration: none !important;
  background: transparent !important;
  border-bottom: none !important;
  transition: background 0.15s;
}

.nav-dropdown-parent:hover {
  background: #f4fbf5 !important;
}

.nav-dropdown-children {
  display: flex;
  flex-direction: column;
  padding: 1px 0 3px 6px;
}

/* 中分類: 縦の上下パディングを極力詰めた引き締まった表示 */
.nav-dropdown-child {
  display: flex !important;
  align-items: center !important;
  padding: 3px 12px 3px 10px !important;
  font-size: 13px !important;
  color: #444 !important;
  text-decoration: none !important;
  border-bottom: none !important;
  border-radius: 4px;
  transition: all 0.15s ease;
}

.nav-dropdown-child:hover {
  background: #e8f5e9 !important;
  color: var(--accent) !important;
}

/* ヘッダーアイコンのサイズ最適化 */
.nav-dropdown-parent .header-cat-icon {
  width: 20px !important;
  height: 20px !important;
  margin-right: 6px !important;
  flex-shrink: 0;
}

.nav-dropdown-child .header-sub-cat-icon {
  width: 17px !important;
  height: 17px !important;
  margin-right: 6px !important;
  flex-shrink: 0;
}

/* 特定商取引法など、見出し＋内容の情報テーブル */
.info-table th {
  width: 32%;
}

@media (max-width: 600px) {
  /* 狭い画面では見出しと内容を縦に積む（列が潰れて縦長になるのを防ぐ） */
  .info-table,
  .info-table tbody,
  .info-table tr,
  .info-table th,
  .info-table td {
    display: block;
    width: auto;
  }

  .info-table tr {
    border-bottom: 1px solid var(--border);
  }

  .info-table th,
  .info-table td {
    border: none;
  }

  .info-table th {
    padding: 12px 12px 4px;
  }

  .info-table td {
    padding: 0 12px 12px;
  }
}

/* ------------------------------------------------------------
   提携商品(外部リンク)の画像まわり
   ------------------------------------------------------------ */

/* 表紙やアプリのアイコンは切り取られると読めないので、全体が収まるように見せる */
.card img.card-img-contain {
  object-fit: contain;
  background: #f5f5f5;
}

/* 画像がないときの、タイトル入りの表紙 */
.card-link-cover {
  padding: 0;
  background: none;
  display: block;
}

.link-cover {
  position: relative;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  padding: 14px 14px 12px 22px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  overflow: hidden;
  color: #fff;
  background: linear-gradient(160deg, #2e7d32 0%, #5a9e3a 100%);
}

/* 背表紙 */
.link-cover::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 8px;
  background: rgba(0, 0, 0, 0.18);
}

.link-cover--digital-contents {
  background: linear-gradient(160deg, #1f6f6a 0%, #3f9a8c 100%);
}

.link-cover--seminars-events {
  background: linear-gradient(160deg, #7a5a2f 0%, #b08a4a 100%);
}

.link-cover-label {
  align-self: flex-start;
  padding: 2px 10px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 999px;
  font-size: 0.72em;
  letter-spacing: 0.06em;
}

.link-cover-title {
  font-weight: 700;
  font-size: 1.05em;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.link-cover-mark {
  align-self: flex-end;
  font-size: 0.72em;
  opacity: 0.85;
}

/* ------------------------------------------------------------
   「書籍」カテゴリの本棚表示(商品一覧で書籍を選んだときだけ)
   表紙を縦長にそろえ、段ごとに棚板を敷く。棚板は各カードの下に
   隙間の半分ずつはみ出させて描き、横に並ぶと1枚の板に見えるようにしている
   ------------------------------------------------------------ */
.product-cards-grid.is-bookshelf {
  grid-template-columns: repeat(4, 1fr);
  gap: 40px 28px;
  padding: 8px 14px 24px;
}

.is-bookshelf .card {
  background: transparent;
  box-shadow: none;
  overflow: visible;
  border-radius: 0;
}

.is-bookshelf .card:hover {
  box-shadow: none;
}

.is-bookshelf .card img,
.is-bookshelf .card-no-image {
  aspect-ratio: 2 / 3;
  object-fit: cover;
  background: #eee;
  border-radius: 2px 4px 4px 2px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
  overflow: hidden;
}

.is-bookshelf .card::after {
  content: "";
  position: absolute;
  left: -14px;
  right: -14px;
  bottom: -22px;
  height: 12px;
  background: linear-gradient(#a07d52, #7a5a36);
  border-radius: 2px;
  box-shadow: 0 3px 4px rgba(0, 0, 0, 0.2);
}

.is-bookshelf .card-content {
  padding: 10px 2px 0;
}

.is-bookshelf .card h3 {
  font-size: 0.9em;
  line-height: 1.45;
  margin-bottom: 4px;
}

.is-bookshelf .card-price {
  font-size: 0.85em;
}

@media (max-width: 1100px) {
  .product-cards-grid.is-bookshelf {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .product-cards-grid.is-bookshelf {
    grid-template-columns: repeat(2, 1fr);
    gap: 36px 20px;
    padding: 4px 10px 20px;
  }

  .is-bookshelf .card::after {
    left: -10px;
    right: -10px;
  }
}

/* 提携商品(書籍以外)のカードに添える紹介文。商品ページを通らず外部へ飛ぶので、ここで中身を伝える */
.card-summary {
  margin: 0 0 8px;
  font-size: 0.85em;
  line-height: 1.6;
  color: #555;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

@media (max-width: 768px) {
  .card-summary {
    font-size: 0.8em;
    -webkit-line-clamp: 2;
  }
}

/* ------------------------------------------------------------
   イベント・ブログの記事(トップページ・記事ページ共通)
   スマホでは見出しを小さくし、本文の画像を画面の幅に収める(2026-10-01)
   エディタで入れた画像には width:800px のような固定サイズが付くことがあるので、
   !important で上書きして、はみ出さないようにしている
   ------------------------------------------------------------ */
.article-title {
  font-size: 2.5em;
  margin: 0 0 16px;
  font-weight: 700;
  line-height: 1.3;
}

.article-title--large {
  font-size: 3em;
  margin-bottom: 20px;
  line-height: 1.2;
}

.article-cover {
  width: 100%;
  height: 500px;
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 40px;
}

/* トップページのイベント記事カルーセル(2026-10-20) */
.event-carousel { position: relative; display: flex; align-items: center; gap: 8px; }
.event-carousel-track {
  display: flex;
  gap: 20px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  padding: 4px 2px 12px;
  flex: 1;
}
.event-card {
  flex: 0 0 300px;
  scroll-snap-align: start;
  display: block;
  text-decoration: none;
  color: inherit;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  transition: transform 0.3s, box-shadow 0.3s;
}
.event-card:hover { transform: translateY(-4px); box-shadow: 0 4px 16px rgba(0,0,0,0.15); }
.event-card-cover { width: 100%; height: 180px; background-size: cover; background-position: center; background-color: #f5f5f5; }
.event-card-body { padding: 16px; }
.event-card-title {
  font-size: 1.1em; margin: 0 0 6px; font-weight: 700; line-height: 1.4;
  overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.event-card-date { color: #999; font-size: 0.8em; margin: 0 0 8px; }
.event-card-summary {
  color: #555; font-size: 0.9em; line-height: 1.6; margin: 0;
  overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
}
.carousel-btn {
  flex: 0 0 auto;
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1px solid #ddd;
  background: #fff;
  font-size: 1.3em;
  line-height: 1;
  cursor: pointer;
  color: #555;
}
.carousel-btn:hover { background: #f5f5f5; }
@media (max-width: 480px) {
  .carousel-btn { display: none; }
}

.article-body img {
  max-width: 100% !important;
  height: auto !important;
}

.article-body iframe,
.article-body video {
  max-width: 100%;
}

.article-body table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
}

@media (max-width: 768px) {
  .article-title,
  .article-title--large {
    font-size: 1.5em;
    line-height: 1.4;
  }

  .article-cover {
    height: 220px;
    margin-bottom: 24px;
  }
}

/* ------------------------------------------------------------
   予約商品(収穫待ちなど、注文後すぐには発送できない商品)の印(2026-10-02)
   商品一覧・トップ・出品者ページのカードは画像の左上に「予約」、価格の下に発送予定
   ------------------------------------------------------------ */
.preorder-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 1;
  padding: 3px 10px;
  border-radius: 4px;
  background: #1565c0;
  color: #fff;
  font-size: 0.8em;
  font-weight: 700;
  letter-spacing: 0.08em;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.preorder-badge--inline {
  position: static;
  display: inline-block;
  margin-right: 6px;
  box-shadow: none;
}

.preorder-note {
  margin: 4px 0 0;
  font-size: 0.85em;
  font-weight: 600;
  color: #1565c0;
}

.preorder-box {
  margin: 8px 0 16px;
  padding: 10px 12px;
  border: 1px solid #bbdefb;
  border-left: 4px solid #1565c0;
  border-radius: 4px;
  background: #e3f2fd;
}

/* ===== 商品の感想(2026-10-08) ===== */
.reviews-page,
.review-write-page { max-width: 860px; margin: 24px auto; }
.reviews-page h1,
.review-write-page h1 { font-size: 1.6em; margin-bottom: 8px; }
.reviews-lead,
.review-write-lead { color: #666; margin-bottom: 24px; line-height: 1.7; }
.reviews-empty { color: #666; padding: 32px 0; text-align: center; }

.review-list { list-style: none; }
.review-card {
  display: flex;
  gap: 16px;
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
}
.review-card-thumb {
  flex: 0 0 96px;
  width: 96px;
  height: 96px;
  border-radius: 8px;
  overflow: hidden;
  background: #f5f5f5;
  display: block;
}
.review-card-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.review-card-thumb .link-cover { width: 100%; height: 100%; font-size: 10px; }
.review-card-main { flex: 1; min-width: 0; }
.review-card-product { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; margin-bottom: 6px; }
.review-card-product a { color: var(--accent); font-weight: 700; text-decoration: none; }
.review-card-product a.review-card-seller { color: #666; font-weight: 400; font-size: 0.9em; }
.review-card-product a.review-card-seller::before { content: '出品者: '; }
.review-card-meta,
.review-admin-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; color: #666; font-size: 0.9em; margin-bottom: 8px; }
.review-card-body { white-space: pre-wrap; line-height: 1.8; overflow-wrap: anywhere; }

.review-card-photos { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.review-card-photos img { width: 92px; height: 92px; object-fit: cover; border-radius: 8px; border: 1px solid #e2e2e2; }

.review-stars { color: #f5a623; letter-spacing: 1px; font-size: 1.05em; }
.review-stars-off { color: #ddd; }

.review-reply {
  margin-top: 12px;
  padding: 10px 14px;
  background: #f1f8e9;
  border-left: 3px solid var(--accent);
  border-radius: 4px;
}
.review-reply-head { font-size: 0.85em; font-weight: 700; color: var(--accent); margin-bottom: 4px; }
.review-reply p { white-space: pre-wrap; line-height: 1.7; overflow-wrap: anywhere; }

.reviews-pager { display: flex; justify-content: center; gap: 20px; margin: 28px 0; }
.reviews-pager a { color: var(--accent); }

/* 感想フォーム */
.review-write-item { border: 1px solid var(--border); border-radius: 8px; padding: 20px; margin-bottom: 20px; background: #fff; }
.review-write-product { display: flex; gap: 12px; align-items: center; margin-bottom: 16px; }
.review-write-product img { width: 64px; height: 64px; object-fit: cover; border-radius: 6px; flex: 0 0 64px; }
.review-write-product h2 { font-size: 1.1em; margin: 0; }
.review-form { display: flex; flex-direction: column; gap: 14px; }
.review-field label,
.review-field .review-label { display: block; font-weight: 700; margin-bottom: 6px; }
.review-field input[type="text"],
.review-field textarea { width: 100%; padding: 10px; border: 1px solid #ccc; border-radius: 6px; font: inherit; }
.review-required { font-size: 11px; color: #fff; background: #e65100; border-radius: 3px; padding: 1px 6px; margin-left: 4px; font-weight: 400; }
.review-newsletter { display: flex; gap: 8px; align-items: flex-start; font-size: 0.95em; line-height: 1.6; }
.review-newsletter input { margin-top: 5px; }
.review-form-note { color: #666; font-size: 0.9em; line-height: 1.7; }
.review-form button[type="submit"] { align-self: flex-start; }
.review-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* 星の入力(右から並べて、選んだ星より左も光らせる) */
.star-input { display: inline-flex; flex-direction: row-reverse; gap: 2px; }
.star-input input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.star-input label { font-size: 2em; line-height: 1; color: #ddd; cursor: pointer; margin: 0; }
.star-input input:checked ~ label,
.star-input label:hover,
.star-input label:hover ~ label { color: #f5a623; }
.star-input input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 2px; }

.review-notice { padding: 12px 16px; border-radius: 6px; margin-bottom: 14px; line-height: 1.7; }
.review-notice--ok { background: #e8f5e9; border-left: 4px solid var(--accent); }
.review-notice--error { background: #fff3e0; border-left: 4px solid #e65100; }

/* 提携商品ページの「感想を送る」 */
.link-review { margin: 24px 0; }
.link-review details > summary { display: inline-block; cursor: pointer; list-style: none; }
.link-review details > summary::-webkit-details-marker { display: none; }
.link-review details[open] > summary { margin-bottom: 14px; }
.link-review .review-form { border: 1px solid var(--border); border-radius: 8px; padding: 16px; background: #fff; }

/* ダッシュボード: 感想の審査・届いた感想 */
.review-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.review-tabs a { padding: 6px 14px; border: 1px solid var(--border); border-radius: 16px; text-decoration: none; color: #444; font-size: 14px; }
.review-tabs a.is-active { background: var(--accent); border-color: var(--accent); color: #fff; }
.review-admin-card { border: 1px solid var(--border); border-radius: 8px; padding: 14px 16px; margin-bottom: 12px; background: #fff; }
.review-admin-card--pending { border-left: 4px solid #e65100; }
.review-admin-card--hidden { opacity: 0.7; }
.review-admin-head { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; margin-bottom: 6px; }
.review-status-badge { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 10px; background: #eee; color: #555; }
.review-status-badge--pending { background: #fff3e0; color: #e65100; }
.review-status-badge--published { background: #e8f5e9; color: var(--accent); }
.review-status-badge--new { background: #e65100; color: #fff; }
.review-admin-actions { display: flex; gap: 8px; margin-top: 12px; }
.review-reply-form { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.review-reply-form label { font-size: 13px; color: #666; }
.review-reply-form textarea { width: 100%; padding: 8px; border: 1px solid #ccc; border-radius: 6px; font: inherit; }
.review-reply-form button { align-self: flex-start; }

@media (max-width: 600px) {
  .review-card { gap: 12px; }
  .review-card-thumb { flex-basis: 72px; width: 72px; height: 72px; }
  .review-write-item { padding: 14px; }
}

/* ===== トップページの売れ筋・新着(2026-10-21): 画面の幅に合わせて、ちょうど2行だけ見せる ===== */
.home-product-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) {
  .home-product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .home-product-grid > :nth-child(n+7) { display: none !important; } /* カードに display:block が直書きされているため */
}
@media (max-width: 600px) {
  .home-product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-product-grid > :nth-child(n+5) { display: none !important; }
}
