/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body { font-family: 'Hiragino Sans', 'Meiryo', sans-serif; color: #1a1a1a; background: #f8f8f8; line-height: 1.6; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

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

/* ===== Header ===== */
.site-header { background: #fff; border-bottom: 2px solid #e63946; position: sticky; top: 0; z-index: 100; box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.header-inner { display: flex; align-items: center; gap: 24px; height: 60px; }
.logo { font-size: 1.5rem; font-weight: 900; color: #1a1a1a; }
.logo span { color: #e63946; }
.header-nav { display: flex; gap: 16px; flex: 1; }
.header-nav a { font-size: .9rem; font-weight: 600; padding: 4px 8px; border-radius: 4px; transition: background .15s; }
.header-nav a:hover { background: #f0f0f0; }
.header-actions { display: flex; align-items: center; gap: 8px; }
.btn-icon { font-size: 1.3rem; padding: 4px 8px; }
.btn-sm { font-size: .85rem; padding: 6px 14px; border-radius: 6px; border: 1px solid #ccc; background: #fff; cursor: pointer; transition: background .15s; }
.btn-sm:hover { background: #f0f0f0; }
.btn-primary { background: #e63946; color: #fff; border-color: #e63946; }
.btn-primary:hover { background: #c1121f; border-color: #c1121f; }
.btn-admin { background: #457b9d; color: #fff; border-color: #457b9d; }
.sb-badge { font-size: .82rem; font-weight: 800; background: #1d3557; color: #a8dadc; padding: 4px 10px; border-radius: 20px; }

/* ===== Hero ===== */
.hero { background: linear-gradient(135deg, #1d3557 0%, #457b9d 100%); color: #fff; padding: 60px 0; text-align: center; }
.hero h1 { font-size: 2.4rem; font-weight: 900; margin-bottom: 12px; }
.hero p { font-size: 1.1rem; opacity: .85; margin-bottom: 28px; }
.hero-btns { display: flex; gap: 12px; justify-content: center; }
.btn { display: inline-block; padding: 12px 28px; border-radius: 8px; font-weight: 700; font-size: 1rem; cursor: pointer; transition: all .15s; border: 2px solid transparent; }
.btn-white { background: #fff; color: #1d3557; }
.btn-white:hover { background: #f0f0f0; }
.btn-outline-white { border-color: #fff; color: #fff; }
.btn-outline-white:hover { background: rgba(255,255,255,.15); }
.btn-red { background: #e63946; color: #fff; border-color: #e63946; }
.btn-red:hover { background: #c1121f; }

/* ===== Section ===== */
.section { padding: 48px 0; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.section-title { font-size: 1.4rem; font-weight: 800; border-left: 4px solid #e63946; padding-left: 12px; }
.section-more { font-size: .9rem; color: #457b9d; font-weight: 600; }
.section-more:hover { text-decoration: underline; }

/* ===== Product Grid ===== */
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 20px; }
.product-card { background: #fff; border-radius: 10px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,.06); transition: transform .15s, box-shadow .15s; }
.product-card:hover { transform: translateY(-4px); box-shadow: 0 8px 20px rgba(0,0,0,.12); }
.product-card-img { aspect-ratio: 1; background: #f0f0f0; display: flex; align-items: center; justify-content: center; font-size: 3rem; overflow: hidden; position: relative; }
.product-card-img img { width: 100%; height: 100%; object-fit: cover; }
.product-card-body { padding: 12px; }
.product-card-cat { font-size: .75rem; color: #457b9d; font-weight: 700; margin-bottom: 4px; }
.product-card-name { font-size: .9rem; font-weight: 600; margin-bottom: 8px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.product-card-price { font-size: 1.1rem; font-weight: 800; color: #e63946; }
.product-card-price small { font-size: .75rem; color: #666; font-weight: 400; }
.badge-sold-out { display: inline-block; background: #999; color: #fff; font-size: .7rem; padding: 2px 8px; border-radius: 4px; margin-top: 4px; }

/* ===== SOLD OUT スタンプ（在庫0） ===== */
.sold-out-stamp { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%) rotate(-12deg); background: rgba(230,57,70,.92); color: #fff; font-weight: 900; font-size: 1.05rem; letter-spacing: 2px; padding: 6px 18px; border: 3px solid #fff; border-radius: 8px; box-shadow: 0 3px 10px rgba(0,0,0,.35); z-index: 2; pointer-events: none; white-space: nowrap; }
.product-card-img:has(.sold-out-stamp) img,
.product-images .main-img:has(.sold-out-stamp) img { filter: grayscale(80%); opacity: .5; }
.product-images .main-img .sold-out-stamp { font-size: 2rem; padding: 10px 32px; letter-spacing: 4px; }

/* ===== Product List Page ===== */
.product-layout { display: grid; grid-template-columns: 240px 1fr; gap: 32px; }
.sidebar { background: #fff; border-radius: 10px; padding: 20px; box-shadow: 0 2px 8px rgba(0,0,0,.06); align-self: start; position: sticky; top: 76px; }
.sidebar h3 { font-size: 1rem; font-weight: 800; margin-bottom: 12px; border-bottom: 1px solid #eee; padding-bottom: 8px; }
.filter-group { margin-bottom: 20px; }
.filter-group label { display: block; font-size: .9rem; margin-bottom: 6px; cursor: pointer; }
.filter-group label input { margin-right: 6px; }
.filter-group select, .filter-group input[type=number] { width: 100%; padding: 6px 10px; border: 1px solid #ccc; border-radius: 6px; font-size: .9rem; }
.btn-filter { width: 100%; padding: 10px; background: #e63946; color: #fff; border: none; border-radius: 6px; font-weight: 700; cursor: pointer; }
.btn-filter:hover { background: #c1121f; }

/* ===== Product Detail ===== */
.product-detail { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; }
.product-images .main-img { aspect-ratio: 1; background: #f0f0f0; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 6rem; overflow: hidden; position: relative; }
.product-images .main-img img { width: 100%; height: 100%; object-fit: cover; }
.product-info h1 { font-size: 1.6rem; font-weight: 800; margin-bottom: 8px; }
.product-info .price { font-size: 2rem; font-weight: 900; color: #e63946; margin-bottom: 16px; }
.product-info .price small { font-size: 1rem; color: #666; font-weight: 400; }
.stock-badge { display: inline-block; padding: 4px 12px; border-radius: 20px; font-size: .85rem; font-weight: 700; margin-bottom: 16px; }
.stock-in { background: #d4edda; color: #155724; }
.stock-out { background: #f8d7da; color: #721c24; }

/* ===== 商品状態ランク ===== */
.rank-badge { display:inline-flex;align-items:center;justify-content:center;min-width:26px;height:26px;border-radius:6px;font-size:.78rem;font-weight:900;color:#fff;padding:0 6px;letter-spacing:.02em; }
.rank-S { background:linear-gradient(135deg,#d4af37,#f0c040); color:#5a3e00; }
.rank-A { background:#28a745; }
.rank-B { background:#1a73e8; }
.rank-C { background:#fd7e14; }
.rank-D { background:#dc3545; }
.condition-box { margin:12px 0 16px;padding:14px 16px;background:#fffbf0;border:1px solid #f0dfa0;border-radius:10px;font-size:.88rem; }
.condition-box .condition-header { display:flex;align-items:center;gap:10px;margin-bottom:6px; }
.condition-box .condition-label { font-weight:700;color:#5a3e00;font-size:.82rem; }
.condition-box .condition-note { color:#555;line-height:1.6;margin:0; }
.add-to-cart-form { display: flex; gap: 12px; margin-bottom: 24px; }
.qty-input { width: 80px; padding: 10px; border: 1px solid #ccc; border-radius: 6px; font-size: 1rem; text-align: center; }
.btn-cart { flex: 1; padding: 12px; background: #e63946; color: #fff; border: none; border-radius: 8px; font-size: 1rem; font-weight: 700; cursor: pointer; }
.btn-cart:hover { background: #c1121f; }
.btn-cart:disabled { background: #ccc; cursor: not-allowed; }
.affiliate-links { display: flex; gap: 8px; flex-wrap: wrap; }
.affiliate-links a { padding: 8px 16px; border-radius: 6px; font-size: .85rem; font-weight: 600; }
.btn-amazon { background: #ff9900; color: #fff; }
.btn-rakuten { background: #bf0000; color: #fff; }
.btn-yahoo { background: #ff0033; color: #fff; }

/* ===== Cart ===== */
.cart-layout { display: grid; grid-template-columns: 1fr 320px; gap: 32px; }
.cart-table { width: 100%; background: #fff; border-radius: 10px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.cart-table th, .cart-table td { padding: 14px 16px; text-align: left; border-bottom: 1px solid #f0f0f0; }
.cart-table th { background: #f8f8f8; font-size: .9rem; font-weight: 700; }
.cart-summary { background: #fff; border-radius: 10px; padding: 24px; box-shadow: 0 2px 8px rgba(0,0,0,.06); align-self: start; position: sticky; top: 76px; }
.cart-summary h3 { font-size: 1.1rem; font-weight: 800; margin-bottom: 16px; }
.summary-row { display: flex; justify-content: space-between; margin-bottom: 10px; font-size: .95rem; }
.summary-total { display: flex; justify-content: space-between; font-size: 1.2rem; font-weight: 800; border-top: 2px solid #e63946; padding-top: 12px; margin-top: 12px; }
.btn-checkout { display: block; width: 100%; padding: 14px; background: #e63946; color: #fff; border: none; border-radius: 8px; font-size: 1.05rem; font-weight: 700; cursor: pointer; text-align: center; margin-top: 16px; }
.btn-checkout:hover { background: #c1121f; }
.free-shipping-bar { background: #fff3cd; border: 1px solid #ffc107; border-radius: 6px; padding: 10px 14px; font-size: .85rem; margin-bottom: 16px; }

/* ===== Forms ===== */
.form-card { background: #fff; border-radius: 12px; padding: 32px; box-shadow: 0 4px 16px rgba(0,0,0,.08); max-width: 480px; margin: 48px auto; }
.form-card h2 { font-size: 1.4rem; font-weight: 800; margin-bottom: 24px; text-align: center; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: .9rem; font-weight: 600; margin-bottom: 6px; }
.form-group input, .form-group select, .form-group textarea { width: 100%; padding: 10px 14px; border: 1px solid #ccc; border-radius: 8px; font-size: 1rem; transition: border-color .15s; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline: none; border-color: #457b9d; box-shadow: 0 0 0 3px rgba(69,123,157,.15); }
.btn-submit { width: 100%; padding: 12px; background: #e63946; color: #fff; border: none; border-radius: 8px; font-size: 1rem; font-weight: 700; cursor: pointer; margin-top: 8px; }
.btn-submit:hover { background: #c1121f; }
.form-error { background: #f8d7da; color: #721c24; padding: 10px 14px; border-radius: 6px; font-size: .9rem; margin-bottom: 16px; }
.form-link { text-align: center; margin-top: 16px; font-size: .9rem; color: #666; }
.form-link a { color: #457b9d; font-weight: 600; }

/* ===== Account ===== */
.account-layout { display: grid; grid-template-columns: 220px 1fr; gap: 32px; }
.account-sidebar { background: #fff; border-radius: 10px; padding: 20px; box-shadow: 0 2px 8px rgba(0,0,0,.06); align-self: start; }
.account-sidebar h3 { font-size: .95rem; color: #666; margin-bottom: 12px; }
.account-sidebar a { display: block; padding: 8px 12px; border-radius: 6px; font-size: .95rem; font-weight: 600; margin-bottom: 4px; }
.account-sidebar a:hover, .account-sidebar a.active { background: #f0f0f0; }
.account-card { background: #fff; border-radius: 10px; padding: 24px; box-shadow: 0 2px 8px rgba(0,0,0,.06); margin-bottom: 20px; }
.account-card h3 { font-size: 1.1rem; font-weight: 800; margin-bottom: 16px; }

/* ===== Order Status ===== */
.status-badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: .8rem; font-weight: 700; }
.status-未入金 { background: #fff3cd; color: #856404; }
.status-入金済 { background: #cff4fc; color: #055160; }
.status-発送準備中 { background: #d1ecf1; color: #0c5460; }
.status-発送済 { background: #d4edda; color: #155724; }
.status-完了 { background: #e2e3e5; color: #383d41; }
.status-キャンセル { background: #f8d7da; color: #721c24; }

/* ===== News ===== */
.news-list { display: flex; flex-direction: column; gap: 12px; }
.news-item { background: #fff; border-radius: 8px; padding: 16px 20px; box-shadow: 0 2px 8px rgba(0,0,0,.06); display: flex; gap: 16px; align-items: flex-start; }
.news-date { font-size: .85rem; color: #999; white-space: nowrap; }
.news-title { font-weight: 600; }

/* ===== Categories ===== */
.category-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; }
.category-card { background: #fff; border-radius: 10px; padding: 20px 12px; text-align: center; box-shadow: 0 2px 8px rgba(0,0,0,.06); transition: transform .15s; font-weight: 700; }
.category-card:hover { transform: translateY(-3px); background: #e63946; color: #fff; }

/* ===== Admin ===== */
.admin-layout { display: grid; grid-template-columns: 220px 1fr; gap: 32px; min-height: calc(100vh - 60px); }
.admin-sidebar { background: #1d3557; color: #fff; padding: 24px 0; }
.admin-sidebar .admin-brand { padding: 0 20px 20px; font-size: 1.1rem; font-weight: 800; border-bottom: 1px solid rgba(255,255,255,.15); }
.admin-sidebar a { display: block; padding: 10px 20px; font-size: .95rem; color: rgba(255,255,255,.8); transition: background .15s; }
.admin-sidebar a:hover, .admin-sidebar a.active { background: rgba(255,255,255,.1); color: #fff; }
.admin-content { padding: 32px 0; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 32px; }
.stat-card { background: #fff; border-radius: 10px; padding: 20px; box-shadow: 0 2px 8px rgba(0,0,0,.06); text-align: center; }
.stat-card .stat-num { font-size: 2rem; font-weight: 900; color: #e63946; }
.stat-card .stat-label { font-size: .9rem; color: #666; }
.admin-table { width: 100%; background: #fff; border-radius: 10px; box-shadow: 0 2px 8px rgba(0,0,0,.06); overflow: hidden; }
.admin-table th, .admin-table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid #f0f0f0; font-size: .9rem; }
.admin-table th { background: #f8f8f8; font-weight: 700; }

/* ===== Checkout ===== */
.checkout-layout { display: grid; grid-template-columns: 1fr 360px; gap: 32px; }

/* ===== Complete ===== */
.complete-card { max-width: 600px; margin: 60px auto; background: #fff; border-radius: 16px; padding: 48px; text-align: center; box-shadow: 0 8px 32px rgba(0,0,0,.1); }
.complete-card .icon { font-size: 4rem; margin-bottom: 16px; }
.complete-card h2 { font-size: 1.6rem; font-weight: 800; margin-bottom: 12px; }

/* ===== 404 ===== */
.error-page { text-align: center; padding: 80px 20px; }
.error-page h1 { font-size: 6rem; font-weight: 900; color: #e63946; }
.error-page p { font-size: 1.2rem; color: #666; margin-bottom: 24px; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .header-nav { display: none; }
  .product-layout, .cart-layout, .checkout-layout, .account-layout { grid-template-columns: 1fr; }
  .product-detail { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .admin-layout { grid-template-columns: 1fr; }
  .cart-summary, .sidebar { position: static; }
}

/* ── 法務ページ（特商法・プライバシーポリシー）── */
.legal-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.legal-table th,
.legal-table td { border: 1px solid #e5e5e5; padding: 12px 14px; text-align: left; vertical-align: top; line-height: 1.7; }
.legal-table th { background: #f7f7f7; width: 220px; font-weight: 700; white-space: nowrap; }
.legal-table .muted,
.legal-doc .muted { color: #888; }
.legal-doc { max-width: 820px; line-height: 1.9; }
.legal-doc h3 { margin: 28px 0 8px; font-size: 1.05rem; font-weight: 700; border-left: 4px solid #e63946; padding-left: 10px; }
.legal-doc p { margin: 8px 0; }
.legal-doc ul { margin: 8px 0 8px 1.4em; list-style: disc; }
.legal-doc li { margin: 4px 0; }
@media (max-width: 600px) {
  .legal-table th { width: 110px; white-space: normal; }
}
