@charset "UTF-8";
@import url('https://fonts.googleapis.com/css2?family=BIZ+UDGothic:wght@400;700&display=swap');

/* =========================================================
   THEME TOKENS
   - shop.html / brand-config.js から --brand-color を上書きすれば全体に反映
   - 互換のため従来トークン名も残しています
========================================================= */
:root{
  /* ブランド — brand-config.js が Firestore tenants/{id} の値で上書きします */
  /* デフォルトは Wine History 中立色（Amenita テナント色 #7a2945 ではない） */
  --brand-color:        #4a3f6b;       /* 主色（中立ワイン紫） */
  --brand-color-dark:   #2d2745;       /* 濃い主色 */
  --brand-contrast:     #ffffff;       /* 主色上の文字色 */
  --brand-deep:         var(--brand-color-dark); /* 互換（既存名） */
  --brand-color-rgb:    74, 63, 107;   /* rgba() 用 RGB 値（brand-config.js が上書き） */
  /* 派生変数（brand-config.js が上書き。新規実装はこれを使う）
     禁止: 固定オレンジ値 #c26a1b / #c96a2a / #f07628 のフォールバック */
  --brand-primary:      #4a3f6b;       /* --brand-color の別名 */
  --brand-primary-dark: #2d2745;       /* --brand-color-dark の別名 */
  --brand-border:       rgba(74, 63, 107, 0.30); /* ボーダー用（--brand-color-rgb 連動） */
  --brand-bg:           rgba(74, 63, 107, 0.08); /* 薄背景用 */
  --brand-hover:        rgba(74, 63, 107, 0.12); /* hover 用 */

  /* ニュートラル */
  --page-bg: #f4f7f6;
  --surface: #ffffff;
  --border: #e6e6e6;
  --muted-border: #e5e5e5;
  --text-color: #333;
  --muted: #555;

  /* Smart テーマ用ニュートラルトークン */
  --surface-subtle : #f8f9fa;
  --text-primary   : #111827;
  --text-secondary : #6b7280;
  --border-subtle  : #e5e7eb;

  /* 情報枠（ブランド色からの濃淡） */
  --info-bg: color-mix(in srgb, var(--brand-color) 10%, #ffffff 90%);
  --info-border: color-mix(in srgb, var(--brand-color) 35%, #ffffff 65%);
  --info-strong: color-mix(in srgb, var(--brand-color) 70%, #000 30%);
}

/* =========================================================
   Base
========================================================= */
*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; font-size: 17px; }
@media (min-width: 1024px){ html { font-size: 18px; } }

body{
  font-family: 'BIZ UDGothic', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  margin: 0;
  padding: 0;
  background: var(--page-bg);
  color: var(--text-color);
  line-height: 1.65;
  font-size: 1rem;
}

main{
  padding: 20px;
  max-width: 1280px;
  margin: 20px auto;
}

/* スマホ固定フッター（bottom-nav）分の下余白 — コンテンツ末尾が隠れないよう確保 */
@media (max-width: 767px) {
  main {
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  }
}

/* =========================================================
   Header / Nav
========================================================= */
header{
  background: var(--brand-color-dark);
  color: var(--brand-contrast);
  padding: 14px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 5px rgba(0,0,0,.18);
  position: relative;
}
header h1{
  margin: 0;
  font-size: 2rem;
  font-weight: 700;
  white-space: nowrap;
}
header nav ul{
  list-style: none;
  display: flex;
  gap: 20px;
  margin: 0;
  padding: 0;
  align-items: center;
}
.nav-link{
  color: var(--brand-contrast); font-weight:700; font-size:1.125rem;
  text-decoration:none; white-space:nowrap; transition:opacity .2s ease;
}
.nav-link:hover{ opacity:.85; text-decoration: underline; }
.nav-button{
  color: var(--brand-contrast); font-weight:700; font-size:1.125rem;
  background:transparent; border:1px solid var(--brand-contrast); padding:8px 14px;
  border-radius:8px; cursor:pointer; transition:background-color .2s ease, opacity .2s ease;
}
.nav-button:hover{ background: rgba(255,255,255,.18); }

@media (max-width: 600px){
  header{ flex-direction: column; gap: 10px; text-align: center; }
  header nav ul{ flex-direction: column; width: 100%; gap: 6px; }
  .nav-link, .nav-button{ display:block; width:100%; padding:10px 0; }
  .nav-button{ background: rgba(255,255,255,.1); border:none; }
}

/* =========================================================
   #global-header — customer 共通ヘッダー（components/header.html）
   既存の header{} を上書きするための ID セレクタ
========================================================= */

/* sticky は含まれるブロック(div[data-include-header])が56pxしかなく
   即スクロールアウトするため fixed に変更。
   div[data-include-header] に同じ高さのスペーサーを設けてコンテンツが
   ヘッダーに重ならないようにする。                                     */
[data-include-header] {
  height: 56px;   /* #global-header と同じ高さ → fixed 化によるコンテンツ重複を防ぐ */
}

#global-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  /* 帯感を消す — 背景透明 + blur で背景画像/壁紙上でも成立 */
  background: transparent;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  /* 必要最小限の下線のみ */
  border-bottom: 1px solid rgba(0,0,0,0.07);
  height: 56px;
  box-sizing: border-box;
  padding: 0 16px;
  display: flex;
  flex-direction: row;          /* mobile media query の column を上書き */
  align-items: center;
  justify-content: space-between;
  gap: 0;
  text-align: left;             /* mobile media query の center を上書き */
  box-shadow: none;
  color: inherit;
}

/* ─ ブランド（ロゴ + 屋号） */
.gh-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex: 1 1 0;   /* 残スペースをすべて占有 */
  min-width: 0;  /* flex child でも overflow: hidden が効くように */
}
.gh-logo {
  height: 32px;
  width: auto;
  flex-shrink: 0;
}
.gh-title {
  font-size: clamp(0.95rem, 3.5vw, 1.2rem);
  font-weight: 700;
  /* ベース: #333（brand-config.js 透明化フェーズでも必ず見える）
     header.js が Firestore 完了後に style.color でbrandcolorへ上書きする */
  color: #333;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.25s ease; /* brandcolor適用時のスムーズな切り替え */
}

/* ─ ハンバーガーボタン */
.gh-ham-btn {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  padding: 6px;
  background: transparent;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
}
.gh-ham-line {
  display: block;
  width: 100%;
  height: 2px;
  /* brand-config.js が loading 中に --brand-color を #ffffff00 にするため
     var() fallback が発動せず透明になる問題を回避: 固定の暗色を使う */
  background: #333;
  border-radius: 2px;
  transition: opacity 0.15s ease;
}
.gh-ham-btn:hover .gh-ham-line {
  opacity: 0.7;
}

/* ─ オーバーレイ */
.gh-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.32);
  z-index: 200;
}
.gh-overlay.is-visible {
  display: block;
}

/* ─ ドロワー */
.gh-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 280px;
  max-width: 85vw;
  background: #fff;
  z-index: 300;
  transform: translateX(100%);
  transition: transform 0.22s ease;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.gh-drawer.is-open {
  transform: translateX(0);
}
.gh-drawer-inner {
  display: flex;
  flex-direction: column;
  padding: 16px 0 32px;
  min-height: 100%;
}

/* ─ 閉じるボタン */
.gh-close-btn {
  align-self: flex-end;
  margin-right: 16px;
  margin-bottom: 8px;
  width: 36px;
  height: 36px;
  background: transparent;
  border: none;
  font-size: 1.1rem;
  color: #888;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.1s ease, color 0.1s ease;
}
.gh-close-btn:hover {
  background: #f0f0f0;
  color: #333;
}

/* ─ ナビ */
.gh-nav {
  display: flex;
  flex-direction: column;
}
.gh-nav-link {
  display: block;
  padding: 13px 24px;
  font-size: 0.95rem;
  font-weight: 500;
  color: #333;
  text-decoration: none;
  transition: background 0.1s ease;
}
.gh-nav-link:hover {
  background: #f5f5f5;
}

/* ─ 区切り線 */
.gh-nav-sep {
  height: 1px;
  background: #f0f0f0;
  margin: 8px 0;
}

/* ─ SNS トグルボタン */
.gh-sns-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 13px 24px;
  background: transparent;
  border: none;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--brand-color, #4a3f6b);
  cursor: pointer;
  text-align: left;
  transition: background 0.1s ease;
}
.gh-sns-btn:hover {
  background: #f5f5f5;
}
.gh-chevron {
  flex-shrink: 0;
  transition: transform 0.2s ease;
}
.gh-sns-btn[aria-expanded="true"] .gh-chevron {
  transform: rotate(180deg);
}

/* ─ SNS リスト */
.gh-sns-list {
  list-style: none;
  margin: 0;
  padding: 4px 16px 8px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.gh-sns-list.hidden {
  display: none;
}
.gh-sns-item {
  border: 1px solid #ebebeb;
  border-radius: 8px;
  overflow: hidden;
}
.gh-sns-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  color: #555;
  text-decoration: none;
  font-size: 0.82rem;
  transition: background 0.1s ease;
}
.gh-sns-link:hover {
  background: #f8f8f8;
  color: #222;
}
.gh-sns-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  color: var(--brand-color);
}
.gh-sns-icon svg {
  width: 100%;
  height: 100%;
}
.gh-sns-label {
  font-weight: 500;
  white-space: nowrap;
}

/* ─ ログアウト */
.gh-logout {
  margin: 4px 16px 0;
  padding: 11px 16px;
  background: transparent;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 0.88rem;
  color: #888;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.1s ease, color 0.1s ease;
}
.gh-logout:hover {
  border-color: #bbb;
  color: #555;
}
.gh-logout.hidden {
  display: none;
}

/* =========================================================
   #bottom-nav — customer スマホ専用タブバー
   PC では非表示。スマホ (≤767px) で fixed bottom に表示。
========================================================= */
#bottom-nav {
  display: none; /* PC: 非表示 */
}

@media (max-width: 767px) {
  #bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    /* iOS safe area 対応 */
    padding-bottom: env(safe-area-inset-bottom, 0px);
    height: calc(60px + env(safe-area-inset-bottom, 0px));
    background: rgba(255,255,255,0.97);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-top: 1px solid #ebebeb;
    z-index: 100;
    justify-content: space-around;
    align-items: stretch;
  }
}

/* ── タブ1項目 */
.bn-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: 3px;
  color: #bbb;
  text-decoration: none;
  font-size: 0.68rem;
  letter-spacing: 0.03em;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  transition: color 0.12s ease;
}

.bn-item:hover {
  color: #999;
}

/* ── SVGアイコン */
.bn-icon {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bn-icon svg {
  width: 100%;
  height: 100%;
}

/* ── テキストラベル */
.bn-label {
  line-height: 1;
}

/* ── Active 状態 */
.bn-item.is-active {
  color: var(--brand-color, #4a3f6b);
}

/* Active インジケーター: タブ上辺に2pxのbrandcolorライン */
.bn-item.is-active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 20%;
  right: 20%;
  height: 2px;
  background: var(--brand-color, #4a3f6b);
  border-radius: 0 0 2px 2px;
}

/* ── ページスペーサー（fixed nav 分の余白） */
.bn-page-spacer {
  display: none;
}

@media (max-width: 767px) {
  .bn-page-spacer {
    height: calc(60px + env(safe-area-inset-bottom, 0px));
  }
}

/* =========================================================
   Cards & Buttons (共通)
========================================================= */
.card{
  background: var(--surface);
  border-radius:12px;
  box-shadow:0 6px 18px rgba(0,0,0,.06);
  padding:22px; margin-bottom:22px;
  border:1px solid var(--border);
}
.button, .action-button{
  background: var(--brand-color);
  color: var(--brand-contrast);
  border:none; border-radius:8px;
  padding:10px 18px; font-size:1rem; cursor:pointer; display:inline-block;
  transition: background-color .2s ease, transform .02s ease, opacity .2s ease;
}
.button:hover, .action-button:hover{ background: var(--brand-color-dark); }
.button:active{ transform: translateY(1px); }

/* =========================================================
   Customer Button System
   ─ .btn-primary  / .btn-secondary / .btn-neutral / .btn-link
   ─ customer 側ページで共通使用。admin 側の .button は従来通り。
   ─ font-size / padding を抑えて静かなUI基調に合わせる。
========================================================= */

/* Primary — 保存・登録などの確定アクション */
.btn-primary {
  background: var(--brand-color, #4a3f6b);
  color: var(--brand-contrast, #fff);
  border: 1.5px solid transparent;
  border-radius: 8px;
  padding: 7px 16px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-block;
  line-height: 1.4;
  text-decoration: none;
  box-sizing: border-box;
  transition: opacity 0.15s ease;
}
.btn-primary:hover  { opacity: 0.86; }
.btn-primary:active { opacity: 0.72; }

/* Secondary — 編集・補助アクション（白地・枠線・brandcolor文字） */
.btn-secondary {
  background: #fff;
  color: var(--brand-color, #4a3f6b);
  border: 1.5px solid var(--brand-color, #4a3f6b);
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-block;
  line-height: 1.4;
  text-decoration: none;
  box-sizing: border-box;
  transition: background 0.15s ease, opacity 0.15s ease;
}
.btn-secondary:hover  { background: rgba(0,0,0,0.03); }
.btn-secondary:active { opacity: 0.72; }

/* Neutral — キャンセル・戻るなど色を持たない補助 */
.btn-neutral {
  background: transparent;
  color: #888;
  border: 1.5px solid #d4d4d4;
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 0.88rem;
  font-weight: 400;
  cursor: pointer;
  display: inline-block;
  line-height: 1.4;
  text-decoration: none;
  box-sizing: border-box;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.btn-neutral:hover  { border-color: #aaa; color: #555; }
.btn-neutral:active { opacity: 0.72; }

/* Link Button — テキストリンク風の最小ボタン */
.btn-link {
  background: none;
  border: none;
  color: var(--brand-color, #4a3f6b);
  font-size: 0.88rem;
  font-weight: 400;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  display: inline;
  line-height: inherit;
}
.btn-link:hover  { opacity: 0.75; }
.btn-link:active { opacity: 0.55; }

/* =========================================================
   Forms
========================================================= */
form label{ display:block; margin:8px 0 6px; font-weight:700; color:var(--text-color); }
form input[type="date"],
form input[type="text"],
form input[type="number"],
form input[type="tel"],
form textarea{
  width:100%; padding:10px; border:1px solid var(--border); border-radius:8px; font-size:1rem; background:#fff;
}
form textarea{ min-height:110px; resize: vertical; }

/* =========================================================
   Generic wine blocks
========================================================= */
.wine-item{
  padding:18px; border:1px solid var(--border); border-radius:10px; background:#fcfcfc;
  display:flex; flex-direction:column; align-items:center; text-align:center; gap:8px;
}
.wine-image{ max-width:100%; height:auto; border-radius:8px; box-shadow:0 2px 5px rgba(0,0,0,.08); }

/* =========================================================
   My Page
========================================================= */
.info-group{ margin-bottom:10px; display:flex; align-items: baseline; }
.info-group label{ min-width:140px; text-align:right; padding-right:10px; color:#555; font-weight:700; }
.info-group span{ flex:1; word-break: break-word; }
@media (max-width:600px){
  .info-group{ flex-direction: column; align-items:flex-start; }
  .info-group label{ min-width:0; text-align:left; padding-right:0; margin-bottom:4px; }
}

/* =========================================================
   TOP：漫画（PC/スマホの見切れ防止・縮尺最適化）
========================================================= */
.manga-carousel{
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: min(100%, 1100px);
  gap: 0;
  max-width: 1200px;
  margin: 0 auto;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}
.manga-carousel > img{
  max-width: 100%;
  max-height: 72vh;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  margin: 0 auto;
  scroll-snap-align: start;
}
@media (max-width: 1200px){
  .manga-carousel{ grid-auto-columns: min(100%, 1000px); }
  .manga-carousel > img{ max-height: 68vh; }
}
@media (max-width: 768px){
  .manga-carousel{ grid-auto-columns: 100%; max-width: 100%; }
  .manga-carousel > img{ max-width: 100%; max-height: 48vh; }
}

/* =========================================================
   SNS icons
========================================================= */
.sns-bar{
  display:flex; flex-direction:row; justify-content:center; align-items:center;
  gap:10px; padding:8px 12px;
}
.sns-bar img{ width:28px; height:28px; object-fit:contain; flex:0 0 auto; }

/* =========================================================
   Review form misc
========================================================= */
#back-button{
  position:absolute; left:20px; top:50%; transform:translateY(-50%);
  padding:8px 14px; font-size:.95rem; background: var(--brand-color); color:#fff;
  border:none; border-radius:8px; cursor:pointer;
}
@media (max-width:600px){
  #back-button{ position:static; transform:none; width:100%; margin-top:8px; }
}
.wine-info-display-for-form{
  background: var(--info-bg);
  border:1px solid var(--info-border);
  border-left:5px solid var(--brand-color);
  border-radius:8px; padding:15px; margin-bottom:20px;
}
.wine-info-display-for-form h3{ margin:0 0 8px; color: var(--info-strong); }
.wine-info-display-for-form p{ margin:5px 0; color:#333; }

/* =========================================================
   History：カード
========================================================= */
.history-grid{ display: contents; }

.history-cards{
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  align-items: start;
}

/* --- PCでは横スクロール --- */
@media (min-width: 1024px){
  .history-cards{
    display: flex;
    flex-wrap: nowrap;
    gap: 18px;
    overflow-x: auto;
    padding-bottom: 8px;
    scroll-snap-type: x mandatory;
  }
  .history-card{
    flex: 0 0 560px;
    max-width: 560px;
    scroll-snap-align: start;
  }
}

.history-card{
  background: var(--surface);
  border:1px solid var(--border);
  border-radius:12px;
  padding:14px; box-shadow:0 6px 18px rgba(0,0,0,.06); width:100%;
}

.history-card-header{
  display:flex; justify-content:space-between; align-items:center;
  gap:12px; margin-bottom:8px;
}
.history-card-title{ font-weight:700; font-size:18px; margin:0; line-height:1.3; }

/* chips */
.chips{ display:flex; gap:6px; align-items:center; flex-wrap:wrap; }
.chip{
  display:inline-block; padding:4px 10px; border-radius:999px;
  background:#f7f7f7; color:#555; font-size:12px; line-height:1;
  border:1px solid var(--muted-border);
}
.chip--tasting    { background: color-mix(in srgb, var(--brand-color) 10%, #fff 90%); color: var(--brand-color-dark); border-color: color-mix(in srgb, var(--brand-color) 35%, #fff 65%); }
.chip--restaurant { background:#fff7e6; color:#8a5a00; border-color:#ffe0a6; }
.chip--party      { background:#eef9ff; color:#0a5f85; border-color:#bde6ff; }
.chip--normal     { background:#f7f7f7; color:#555;   border-color:var(--muted-border); }

.history-card-body{
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 14px;
  align-items: start;
}

/* 画像は見切れ無しで */
.history-card-photo{
  width:120px; height:120px;
  object-fit: contain;
  object-position: center;
  border-radius:10px;
  border:1px solid var(--border); background:#f9f9f9;
}
.history-card-photo.--empty{ width:120px; height:120px; }

.history-card-meta{
  display:grid; grid-template-columns:88px 1fr; gap:8px 10px;
  font-size:14px; color:#333;
}
.history-card-meta .label{
  color:#777; text-align:right; padding:6px 8px; background:#fafafa;
  border:1px solid var(--border); border-radius:8px;
}
.history-card-meta .value{
  padding:6px 10px; background:#fff; border:1px solid var(--border); border-radius:8px;
  word-break: break-word;
}
.history-card-meta .full{ grid-column: 1 / -1; }

@media (max-width: 430px){
  .history-card-body{ grid-template-columns: 1fr; gap: 10px; }
  .history-card-photo, .history-card-photo.--empty{
    width:120px; height:120px; margin:0 auto 2px;
  }
  .history-card-meta{ grid-template-columns:90px 1fr; gap:6px 8px; font-size:13px; }
}

.history-card-footer{
  margin-top:10px; display:flex; justify-content:space-between; align-items:center; gap:12px;
}
.history-card-date{ color:#666; font-size:12px; }

/* review summary & radar */
.review-summary{
  font-size:13px; color:#444; background:#fafafa; border:1px solid var(--border);
  padding:8px 10px; border-radius:8px;
}
.review-line{ display:flex; gap:10px; align-items:baseline; flex-wrap:wrap; }
.review-overall{ font-weight:700; }
.review-note{ color:#555; }
.review-button{
  border:none; background: var(--brand-color-dark); color:#fff; padding:10px 14px; border-radius:10px;
  font-size:14px; font-weight:700; cursor:pointer;
}
.review-button:disabled{ background:#ddd; color:#888; cursor:not-allowed; }
.review-summary canvas{ width:100%; height:auto; max-width:360px; display:block; margin-top:6px; }

@media (max-width: 768px) {
  .review-note { color:#555; white-space: pre-wrap; }
  .review-summary canvas { max-height: 160px; }
}

/*（PC向け重複ブロック。scroll-snapは mandatory で統一）*/
@media (min-width: 1024px){
  .history-cards{
    display: flex;
    gap: 18px;
    overflow-x: auto;
    padding-bottom: 8px;
    scroll-snap-type: x mandatory;
  }
  .history-card{
    flex: 0 0 560px;
    max-width: 560px;
    scroll-snap-align: start;
  }
}

.month-header{
  position: sticky;
  top: 64px;
  z-index: 1;
  background: #f7f7f9cc;
  backdrop-filter: blur(2px);
  padding: 6px 10px;
  border-left: 4px solid var(--brand-color);
  margin: 8px 0;
  font-weight: 700;
  color: #333;
}

/* === History：横カルーセル（モバイル/PC両対応） ==================== */
.history-cards.is-carousel{
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding: 6px 4px 12px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}
.history-cards.is-carousel > .history-card{
  flex: 0 0 86vw;
  max-width: 560px;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}

/* PCでは少しワイドに */
@media (min-width: 1024px){
  .history-cards.is-carousel{ gap: 18px; }
  .history-cards.is-carousel > .history-card{
    flex-basis: 560px;
    max-width: 560px;
  }
}

/* 共通カルーセル（他ページ） */
.is-carousel{
  position: relative;
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding: 6px 24px 12px;
  scroll-padding-inline: 24px;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}
.is-carousel > .manga-card{
  flex: 0 0 86vw;
  max-width: 560px;
  margin-right: 12px;
  scroll-snap-align: start;
}
@media (min-width: 1024px){
  .is-carousel{ gap: 18px; }
  .is-carousel > .manga-card{ flex-basis: 560px; max-width: 560px; }
}
.is-carousel::before,
.is-carousel::after{
  content:"";
  position: sticky;
  top:0; bottom:0;
  width:28px;
  pointer-events:none;
  z-index:2;
  opacity:0;
  transition:opacity .2s ease;
}
.is-carousel::before{
  left:0;
  background: linear-gradient(to right, var(--page-bg) 70%, rgba(0,0,0,0));
}
.is-carousel::after{
  right:0;
  background: linear-gradient(to left,  var(--page-bg) 70%, rgba(0,0,0,0));
}
.is-carousel.has-left::before{  opacity:1; }
.is-carousel.has-right::after{  opacity:1; }
.is-carousel .carousel-btn{
  position: sticky;
  top: 50%;
  transform: translateY(-50%);
  width: 36px; height: 36px;
  border: none; border-radius: 999px;
  background: var(--brand-color-dark);
  color: #fff; font-weight: 700;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
  display: none;
  z-index: 3;
  cursor: pointer;
}
.is-carousel .carousel-btn.prev{ left: 6px; }
.is-carousel .carousel-btn.next{ right: 6px; }
.is-carousel .carousel-btn:active{ transform: translateY(-50%) scale(.98); }
.is-carousel .carousel-dots{
  position: sticky;
  left: 0; right: 0; bottom: 0;
  display: flex; justify-content: center; gap: 6px;
  padding: 8px 0 2px;
  z-index: 2; pointer-events: none;
}
.is-carousel .carousel-dot{
  width: 6px; height: 6px; border-radius: 999px;
  background: #cfcfcf; opacity: .8;
}
.is-carousel .carousel-dot.is-active{ background: var(--brand-deep); opacity: 1; }

.manga-card{
  background: var(--surface); border:1px solid var(--border); border-radius:12px;
  box-shadow:0 6px 18px rgba(0,0,0,.06);
  padding: 12px;
}
.manga-card img{ width: 100%; height: auto; display:block; border-radius:10px; }
.manga-card .caption{ margin-top:8px; color:#444; font-size:14px; }

/* 試飲番号バッジ（タイトル左） */
.badge-no{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.8em;
  height: 1.6em;
  padding: 0 .5em;
  margin-right: .45em;
  border-radius: 999px;
  background: var(--brand-color-dark);
  color: #fff;
  font-size: .85em;
  line-height: 1;
  vertical-align: middle;
  box-shadow: 0 1px 2px rgba(0,0,0,.08);
}
:root.theme-loading {
  --brand-color: transparent;
  --brand-color-dark: transparent;
}

/* =============================================
   共通ワインカード (.sw-card*)
   select-wine / admin_wines / history / wine-card.js 共用
   ============================================= */
.sw-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
  padding: 4px 0 24px;
}
.sw-card {
  background: #fff;
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  position: relative;
  display: flex;
  flex-direction: column;
  box-shadow: 0 2px 6px rgba(0,0,0,.05);
  transition: border-color .15s, box-shadow .15s;
}
.sw-card:hover {
  border-color: var(--brand-color, #4a3f6b);
  box-shadow: 0 2px 8px rgba(0,0,0,.1);
}
.sw-card.selected {
  border-color: var(--brand-color, #4a3f6b);
  box-shadow: 0 0 0 3px rgba(74,63,107,.15);
}
.sw-card-img,
.wine-image {
  width: 100%;
  height: 180px;
  object-fit: contain;
  background: #fafafa;
  display: block;
}
.sw-card-no-img {
  width: 100%;
  height: 180px;
  background: #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .8rem;
  color: #aaa;
}
/* ── カードボディ：上下2ブロック構造 ── */
.sw-card-body {
  padding: 10px;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.sw-card-info {
  min-height: 90px;
}
.sw-card-footer {
  margin-top: auto;
}
/* ── 名前：2行固定・はみ出し省略 ── */
.sw-card-name {
  font-size: .9rem;
  font-weight: 700;
  color: var(--brand-color-dark, #2d2745);
  margin: 0 0 4px;
  line-height: 1.3;
  height: calc(1.3em * 2);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
/* ── メタ情報：最大2行・高さ確保 ── */
.sw-card-meta {
  font-size: .78rem;
  color: #666;
  line-height: 1.4;
  margin: 0 0 3px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: calc(1.4em * 2);
}
/* ── 価格（footer最上部） ── */
.sw-card-price {
  font-size: .9rem;
  color: var(--brand-color, #4a3f6b);
  font-weight: 700;
  margin: 0 0 6px;
}
/* ── アクションボタン ── */
.sw-card-actions {
  display: flex;
  gap: 6px;
}
.sw-card-actions button {
  flex: 1;
  height: 32px;
  padding: 0;
  border-radius: 6px;
  font-size: .78rem;
  cursor: pointer;
  text-align: center;
  transition: background .12s;
  box-sizing: border-box;
}
.sw-detail-btn {
  border: 1px solid #ddd;
  background: #f8f8f8;
  color: #555;
}
.sw-detail-btn:hover { background: #eee; color: #333; }
.sw-edit-btn {
  border: none;
  background: var(--brand-color, #4a3f6b);
  color: #fff;
}
.sw-edit-btn:hover { background: var(--brand-color-dark, #2d2745); }
.sw-review-btn {
  border: none;
  background: var(--brand-color, #4a3f6b);
  color: #fff;
}
.sw-review-btn:hover { background: var(--brand-color-dark, #2d2745); }
.sw-share-btn {
  border: 1px solid var(--brand-color, #4a3f6b);
  background: #fff;
  color: var(--brand-color, #4a3f6b);
}
.sw-share-btn:hover { background: color-mix(in srgb, var(--brand-color) 10%, #fff 90%); }
/* ── 選択チェックバッジ（select-wine 用） ── */
.sw-card-check {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid #ccc;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  transition: background .1s, border-color .1s;
}
.sw-card.selected .sw-card-check {
  background: var(--brand-color, #4a3f6b);
  border-color: var(--brand-color, #4a3f6b);
  color: #fff;
}
/* ── 数量入力（select-wine 用） ── */
.sw-card-qty {
  display: none;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid #eee;
}
.sw-card.selected .sw-card-qty { display: flex; }
.sw-card-qty label { font-size: .72rem; color: #555; }
.sw-card-qty input[type="number"] {
  width: 54px;
  padding: 3px 6px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: .82rem;
}

/* ── モバイル：sw-card-grid → 横スクロールカルーセル（body 幅内に収める） ── */
@media (max-width: 767px) {
  .sw-card-grid {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 10px;
    padding-bottom: 12px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    width: 100%;     /* コンテナ自身を親幅に収める */
    max-width: 100%; /* 親幅を超えて body を押し広げない */
  }
  .sw-card-grid::-webkit-scrollbar { display: none; }
  .sw-card-grid > .sw-card {
    flex: 0 0 calc(100% - 40px);
    max-width: 280px;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    flex-shrink: 0;
  }
}
