@import url('https://fonts.googleapis.com/css2?family=Great+Vibes&family=Noto+Sans+JP:wght@100..900&family=Noto+Serif+JP:wght@200..900&family=Roboto:ital,wght@0,100..900;1,100..900&family=UnifrakturMaguntia&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Zen+Old+Mincho&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Yuji+Syuku&display=swap');

body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
    background-color: #000000;
  }
  /* ロゴ（h1） */
  .site-title { margin: 0; display: flex; justify-content: flex-start; }
  .site-logo-link { display: inline-flex; align-items: center; text-decoration: none; }
  .site-logo { display: block; width: min(420px, 50vw); height: auto; margin: 1rem 0;}
  
  .wrap {
    display: grid;
    gap: 12px;
    max-width: 1060px; /* 500x2 + 余白 */
  }
  
  .canvas-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    align-items: start;
  opacity: 0;
  transition: opacity .3s ease;
  }
/* 両面ロード完了後に一斉表示 */
.canvas-row.is-ready { opacity: 1; }
/* 種別変更など読み込み中は再び非表示に */
.canvas-row.is-loading { opacity: 0; }
/* フェードアウトを即時にするための一時クラス（フェードインは維持） */
.canvas-row.no-fade { transition: none; }
  canvas {
    width: 500px;
    height: 500px;
    background: #ffffff;
    display: block;
    /* 枠は無し */
    border: none;
  }

  /* --- 左側パネル（STEP1詳細） --- */
  .left-panel {
    position: fixed;
    top: 5rem; /* PC/スマホで同じ高さに統一 */
    right: var(--left-panel-right, 16px); /* side-buttons実寸に追従（glove.jsが自動計算） */
    left: auto;
    width: 360px;
    max-width: calc(100vw - var(--left-panel-right, 16px) - 16px); /* 右余白16pxを確保してはみ出し防止 */
    background: linear-gradient(135deg, #1a1a1a 0%, #0f0f0f 100%); /* シックなダークグラデーション */
    color: #e5e7eb;
    border: 1px solid #2d2d2d;
    padding: 5px;
    border-radius: 0; /* シャープな角 */
    z-index: 1000; /* side-buttons より上 */
    box-shadow: none;
  }
  /* 左パネル内は横書き強制（縦書き指定の影響を排除） */
  .left-panel, .left-panel * { writing-mode: horizontal-tb; }
  .panel-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    min-width: 0; /* grid内の子要素が縮められるようにする（はみ出し防止） */
  }
  .panel-item {
    display: grid;
    grid-template-columns: 1fr; /* 縦積み */
    row-gap: 6px;
    align-items: start;
    background: rgba(255, 255, 255, 0.03);
    padding: 10px 12px;
    border: 1px solid #2d2d2d;
    border-radius: 0; /* シャープな角 */
    min-height: 40px; /* 小さすぎ防止。内容に応じて縦に伸びる */
    height: auto;
    transition: all 0.2s ease;
    min-width: 0; /* grid item の縮小を許可 */
    box-sizing: border-box;
  }
  .panel-item.-wide { grid-column: 1 / -1; }
  .panel-title { 
    font-weight: 600; 
    margin: 0; 
    font-size: 12px; 
    white-space: nowrap; 
    max-width: 100%;
    overflow: hidden;
    color: #9ca3af;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    font-size: 11px;
  }
  /* panel-title内の英語行は折り返しOK（英語が長いときのはみ出し防止） */
  .panel-title .label-en {
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .panel-value { 
    background: #0f0f0f; 
    padding: 6px 10px; 
    border: 1px solid #2d2d2d; 
    font-size: 14px; 
    white-space: normal; 
    max-width: 100%;
    min-width: 0;
    overflow: hidden; 
    text-overflow: ellipsis; 
    color: #f3f4f6;
    font-weight: 500;
  }
  .panel-item.is-clickable { 
    cursor: pointer; 
  }
  .panel-item.is-clickable:hover { 
    background: rgba(255, 255, 255, 0.06);
    border-color: #404040;
    transform: translateY(-1px);
  }

/* 決済送信中オーバーレイ（PayPal capture中） */
.payment-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.92);
  color: #111827;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-align: center;
  padding: 24px;
}
.payment-loading-overlay[hidden] { display: none; }
.payment-loading-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  max-width: min(560px, 100%);
}
.payment-loading-gif {
  width: 128px;
  height: 128px;
  max-width: 100%;
  object-fit: contain;
}
.payment-loading-text {
  font-size: 16px;
  font-weight: 700;
}

/* 販売店コードの検証結果（確認画面） */
#dealerCodeStatus {
  color: #e5e7eb; /* デフォルトは白寄り（成功時はJSで#fffに） */
  font-size: 16px;
  line-height: 1.4;
}
.dealer-name {
  display: inline-block;
  vertical-align: middle;
}
.dealer-check {
  display: inline-block;
  vertical-align: middle;
  width: 18px;
  height: 18px;
  margin-left: 8px;
}

/* 追加オプション（左上の三角マーカー） */
#extraOptionBtn {
  position: relative;
  overflow: hidden;
}
#extraOptionBtn::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  border-top: 25px solid #5cc2cf;
  border-right: 25px solid transparent;
  pointer-events: none;
}

/* 追加オプション（ドロワー内レイアウト） */
#extraOptionDrawer .usage-body,
#extraOptionDrawer .usage-body-s {
  padding: 8px 0;
}
.extra-options-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  max-width: 100%;
}
.extra-options-main {
  display: grid;
  gap: 12px;
  max-width: 100%;
}
.extra-options-list {
  display: grid;
  gap: 12px;
}
.extra-options-item {
  border: 1px solid #2d2d2d;
  background: rgba(255, 255, 255, 0.03);
  padding: 14px 16px;
  max-width: 100%;
}
.extra-options-item-head {
  display: grid;
  grid-template-columns: 88px 1fr auto;
  align-items: start;
  gap: 12px;
}
.extra-options-thumb {
  border: 1px solid #2d2d2d;
  background: rgba(0, 0, 0, 0.12);
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.extra-options-thumb-img {
  width: 100%;
  height: auto;
  max-width: 100%;
}
.extra-options-thumb--text {
  background: rgba(255, 255, 255, 0.03);
}
.extra-options-thumb-text {
  display: block;
  width: 100%;
  text-align: center;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.06em;
  color: #e5e7eb;
  white-space: nowrap;
}
.extra-options-item-title {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.35;
  color: #f3f4f6;
}
.extra-options-item-title .label-en {
  margin-top: 4px;
}
.extra-options-item-price {
  font-size: 14px;
  font-weight: 700;
  color: #e5e7eb;
  white-space: nowrap;
}
.extra-options-check {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid #2d2d2d;
  background: rgba(0, 0, 0, 0.15);
  cursor: pointer;
  max-width: 100%;
}
.extra-options-checkbox {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  cursor: pointer;
}
.extra-options-check-text {
  font-size: 16px;
  line-height: 1.35;
  color: #e5e7eb;
}
@media (min-width: 768px) {
  .extra-options-layout {
    grid-template-columns: 1fr;
    align-items: start;
  }
}

@media (max-width: 420px) {
  .extra-options-item-head {
    grid-template-columns: 72px 1fr;
    grid-template-areas:
      "thumb title"
      "thumb price";
  }
  .extra-options-thumb { grid-area: thumb; }
  .extra-options-item-title { grid-area: title; }
  .extra-options-item-price { grid-area: price; }
}

  /* すべてのパネル項目が縦積み仕様なので個別指定は不要 */

  /* --- 用途選択ドロワー --- */
  .usage-drawer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #0f0f0f 0%, #1a1a1a 100%);
    color: #e5e7eb;
    border-top: 1px solid #2d2d2d;
    z-index: 1100;
    padding: 20px 24px;
    font-size: 10px; /* ドロワー内基準フォントサイズ */
    box-shadow: none;
  }
  .usage-header { 
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
    margin-bottom: 16px; 
    padding-bottom: 12px;
    border-bottom: 1px solid #2d2d2d;
  }
.usage-title { 
  font-weight: 600; 
  font-size: 12px; 
  color: #f3f4f6;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* 日本語ラベルの下に英語を小さく表示 */
.label-en {
  display: block;
  margin-top: 2px;
  font-size: 10px;
  line-height: 1.2;
  font-weight: 500;
  color: #9ca3af;
  letter-spacing: 0;
  text-transform: none;
}
/* （STEP5削除済み） */
  .usage-close { 
    background: transparent; 
    color: #9ca3af; 
    border: 1px solid #2d2d2d; 
    padding: 6px 12px; 
    border-radius: 0; 
    font-size: 12px;
    transition: all 0.2s ease;
    cursor: pointer;
  }
  .usage-close:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #f3f4f6;
    border-color: #404040;
  }
  .usage-body-c {gap: 12px; padding: 8px 0; }
  /* 本体ドロワーは横スクロール許可 */
  #bodyBaseBody { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; }
  #bodyBaseBody .usage-card { min-width: 120px; text-align: center; }
  #bodyBaseColors { display: flex; gap: 12px; overflow-x: auto; padding: 8px 0; }
  #bodyBaseColors .usage-card { min-width: 120px; text-align: center; }
  #fingerColorColors { display: flex; gap: 12px; overflow-x: auto; padding: 8px 0; }
  #fingerColorColors .usage-card { min-width: 120px; text-align: center; }
  /* ラベル（影）: 指カバー・指あてと同スタイル */
  #labelShadowColorColors { display: flex; gap: 12px; overflow-x: auto; padding: 8px 0; }
  #labelShadowColorColors .usage-card { min-width: 120px; text-align: center; }
  /* ハミダシ（指カバー・指あてと同スタイル） */
  #hamidashiColorColors { display: flex; gap: 12px; overflow-x: auto; padding: 8px 0; }
  #hamidashiColorColors .usage-card { min-width: 120px; text-align: center; }
  /* 裏革（ハミダシと同スタイル） */
  #liningColorColors { display: flex; gap: 12px; overflow-x: auto; padding: 8px 0; }
  #liningColorColors .usage-card { min-width: 120px; text-align: center; }
  /* （STEP5削除済み） */
  /* 縫い糸（ハミダシと同スタイル） */
  #stitchColorColors { display: flex; gap: 12px; overflow-x: auto; padding: 8px 0; }
  #stitchColorColors .usage-card { min-width: 120px; text-align: center; }
  /* レース（ハミダシと同スタイル） */
  #laceColorColors { display: flex; gap: 12px; overflow-x: auto; padding: 8px 0; }
  #laceColorColors .usage-card { min-width: 120px; text-align: center; }
  /* ヘリ革（レースと同スタイル） */
  #edgingColorColors { display: flex; gap: 12px; overflow-x: auto; padding: 8px 0; }
  #edgingColorColors .usage-card { min-width: 120px; text-align: center; }
  /* ネーム刺繍（STEP4）カラー選択はハミダシと同スタイル */
  #nameCharColors { display: flex; gap: 12px; overflow-x: auto; padding: 8px 0; }
  #nameCharColors .usage-card { min-width: 120px; text-align: center; }
  #nameEdgeColors { display: flex; gap: 12px; overflow-x: auto; padding: 8px 0; }
  #nameEdgeColors .usage-card { min-width: 120px; text-align: center; }
  /* （STEP5削除済み） */
  /* ネーム刺繍 プレビュー */
#nameDrawer .usage-body { display: block; }
.name-preview {
  display: block;
  width: min(720px, 100%);
  margin: 0;
  box-sizing: border-box;
  font-size: 60px;
  font-weight: 700;
  letter-spacing: 1px;
  background: #ffffff;
  color: #000000;
  border: 1px solid #1f2937;
  padding: 12px;
  border-radius: 6px;
  text-align: left;
}
  /* ラベル（2カラム） */
  .label-color-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
  .label-color-col { display: grid; gap: 6px; }
  .label-color-col .usage-title { margin-bottom: 0; }
  #labelEdgeColors, #labelTextColors { display: flex; gap: 12px; overflow-x: auto; padding: 8px 0; }
  #labelEdgeColors .usage-card, #labelTextColors .usage-card { min-width: 120px; text-align: center; }
  .color-chip { width: 100%; height: 48px; border: 1px solid #1f2937; border-radius: 6px; margin-bottom: 6px; }
.color-chip.is-mask {
  background-color: #d1d5db; /* fallback */
}
.color-chip.is-mask.mask-silver {
  background: linear-gradient(135deg, #f3f4f6 0%, #9ca3af 100%);
  -webkit-mask-image: url("img/silver.jpg");
  mask-image: url("img/silver.jpg");
  -webkit-mask-size: cover;
  mask-size: cover;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
}
.color-chip.is-mask.mask-gold {
  background: linear-gradient(135deg, #facc15 0%, #a16207 100%);
  -webkit-mask-image: url("img/gold.jpg");
  mask-image: url("img/gold.jpg");
  -webkit-mask-size: cover;
  mask-size: cover;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
}
  .usage-card { 
    text-align: left; 
    background: rgba(255, 255, 255, 0.03); 
    color: #e5e7eb; 
    border: 1px solid #2d2d2d; 
    padding: 14px 16px; 
    border-radius: 0; 
    cursor: pointer; 
    transition: all 0.2s ease;
  }
  .usage-card:hover { 
    background: rgba(255, 255, 255, 0.06);
    border-color: #404040;
    transform: translateY(-1px);
  }
  .usage-card.is-selected { 
    background: rgba(255, 255, 255, 0.08);
    border-color: #6b7280;
    border-left: 3px solid #9ca3af;
  }
.usage-item { display:flex; align-items:center; gap:8px; }
.usage-thumb { width:36px; height:36px; object-fit:cover; border:1px solid #1f2937; border-radius:4px; background: white; }
/* STEP4: 刺繍場所のサムネイルを3倍に拡大 */
#namePlaceRow .usage-thumb { width:170px; height:170px; }
/* STEP4: 刺繍場所はサムネ＋文字を縦並び */
#namePlaceRow .usage-card { text-align: center; }
#namePlaceRow .usage-item { flex-direction: column; align-items: center; gap: 10px; }
/* STEP4: 無効（ベルト部分など） */
#namePlaceRow .usage-card.is-disabled,
#namePlaceRow .usage-card:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none;
}
#namePlaceRow .usage-card.is-disabled:hover,
#namePlaceRow .usage-card:disabled:hover {
  background: rgba(255, 255, 255, 0.03);
  border-color: #2d2d2d;
  transform: none;
}
/* 背面紐ドロワーのサムネイルを大きく */
#backLaceDrawer .usage-thumb { width:80px; height:80px; }
.usage-card-title { 
  font-weight: 500; 
  margin-bottom: 4px; 
  font-size: 11px; 
  color: #f3f4f6;
  letter-spacing: 0.3px;
}
.usage-card-sub { 
  font-size: 10px; 
  color: #9ca3af; 
}
  .usage-footer { 
    display: flex; 
    justify-content: center; 
    padding-top: 16px; 
    margin-top: 16px;
    border-top: 1px solid #2d2d2d;
  }
.usage-next { 
  width: 200px; 
  height: 44px; 
  background: linear-gradient(135deg, #1a1a1a 0%, #0f0f0f 100%); 
  color: #f3f4f6; 
  border: 1px solid #2d2d2d; 
  border-radius: 0; 
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  transition: all 0.2s ease;
  cursor: pointer;
}
.usage-next:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: #404040;
  transform: translateY(-1px);
}
/* STEP4 クリアボタン（明るめの青） */
#nameClear {
  background:#3b82f6;
  border-color:#1e40af;
  color:#fff;
}
  /* ネーム刺繍ドロワーは縦スクロール可能に */
  #nameDrawer { max-height: 80vh; overflow-y: auto; -webkit-overflow-scrolling: touch; }
  
  /* --- ウェブ選択（yw*）専用レイアウト --- */
  #webBody {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 8px;
    flex-wrap: nowrap; /* 折り返さない */
  }
  #webBody .usage-card {
    min-width: 120px;
    text-align: center;
  }
  #webBody .usage-card-title { margin: 0; }
  /* STEP6 フルスクリーンドロワー */
  .fullscreen-drawer { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.95); color:#fff; z-index: 1200; overflow-y: auto;}
  .fullscreen-inner { max-width: 1060px; margin: 0 auto; padding: 16px; }
  .fullscreen-header { display:flex; align-items:center; justify-content: space-between; margin-bottom: 8px; }
  .fullscreen-title { font-weight:700; font-size: 12px; }
  .fullscreen-body { padding: 8px 0; }
  .total-price { font-size: 24px; font-weight: 800; margin: 4px 0 12px 0; }
  .summary-table { width: 100%; border-collapse: collapse; font-size: 10px; }
  .summary-table th, .summary-table td { border: 1px solid #1f2937; padding: 6px 8px; text-align: left; vertical-align: top; }
  .summary-table th { width: 30%; background:#0f172a; color:#fff; }
  .summary-table td { background:#111827; color:#fff; }
  /* 確認画面の刺繍場所は改行（JP→EN）を表示する */
  #sendNPlace { white-space: pre-line; }
  /* 汎用モーダル */
  .modal-overlay { 
    position: fixed; 
    inset: 0; 
    background: rgba(15,23,42,0.75); 
    z-index: 1300; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    opacity: 0;
    transition: opacity 0.3s ease;
  }
  .modal-overlay[hidden] { display: none !important; }
  .modal-overlay.is-showing {
    opacity: 1;
  }
  .modal-overlay.is-hiding {
    opacity: 0;
  }
  .modal-panel { 
    background:#0f172a; 
    color:#fff; 
    border:1px solid #1f2937; 
    border-radius: 8px; 
    max-width: 560px; 
    width: calc(100% - 32px); 
    padding: 16px; 
    margin: 12px;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s ease, opacity 0.3s ease;
    opacity: 0;
  }
  .modal-overlay.is-showing .modal-panel {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
  .modal-overlay.is-hiding .modal-panel {
    transform: scale(0.9) translateY(20px);
    opacity: 0;
  }
  .modal-header { margin-bottom: 8px; font-weight: 700; font-size: 12px; }
  .modal-body { font-size: 10px; line-height: 1.8; white-space: pre-line; }
  .modal-actions { display: flex; gap: 8px; justify-content: center; margin-top: 12px; }
  .modal-primary { width: 220px; height: 44px; background:#f58106; color:#fff; border:1px solid #ef5125; border-radius: 12px; font-size: 10px; }
  
  .status {
    font-size: 14px;
    color: #555;
  }
  
  progress {
    width: 100%;
    height: 8px;
  }
  
  .warn {
    color: #b45309;
  }
  
  .error {
    color: #b91c1c;
  }
  
  .ok {
    color: #065f46;
  }
  
  .small {
    font-size: 12px;
    color: #777;
  }
  
  /* ---- controls ---- */
  .controls {
    display: grid;
    gap: 12px;
    margin-top: 8px;
  }
  .ctrl-group {
    display: grid;
    gap: 6px;
  }
  .ctrl-label {
    font-size: 14px;
  }
  .swatches {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
  }
  .swatch {
    width: 32px;
    height: 32px;
    border: 1px solid #E0E0E0;
    background: var(--swatch, #000);
    padding: 0;
    cursor: pointer;
    border-radius: 8px; /* ボタンは独自の角丸 */
  }
  .swatch.is-active {
    outline: 2px solid #111827;
    outline-offset: 1px;
  }
  .web-picker {
    display: flex;
    gap: 8px;
    align-items: center;
  }
  
  /* --- 右側固定ボタン --- */
  .side-buttons {
    position: fixed;
    top: 5rem; /* left-panel と同じ高さに揃える */
    right: 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    z-index: 900; /* left-panel より下 */
  }
  .side-btn {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: linear-gradient(135deg, #1a1a1a 0%, #0f0f0f 100%);
    color: #e5e7eb;
    text-decoration: none;
    font-size: 13px;
    line-height: 1.3;
    border: 1px solid #2d2d2d;
    border-radius: 0;
    transition: all 0.2s ease;
    box-shadow: none;
  }
  .side-btn:hover { 
    transform: translateX(-2px);
  }
  .side-btn.is-active { 
    background: linear-gradient(135deg, #2d2d2d 0%, #1a1a1a 100%);
    border-color: #6b7280;
    border-left: 3px solid #9ca3af;
    color: #f3f4f6;
  }
  .side-btn.is-active:hover { 
    transform: translateX(-2px);
  }
  .side-btn .step { 
    font-weight: 600; 
    font-size: 11px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: #9ca3af;
  }
  .side-btn .label { 
    font-weight: 500; 
    color: #f3f4f6;
    display: block;
    line-height: 1.2;
  }
  .side-btn .label .jp {
    display: block;
  }
  .side-div { 
    border: 0; 
    border-top: 1px solid #2d2d2d; 
    margin: 8px 0; 
  }
  .side-btn.is-keep { 
    background: linear-gradient(135deg, #1a1a1a 0%, #0f0f0f 100%);
    border-color: #2d2d2d;
    color: #f3f4f6;
  }
  .side-btn.is-keep:hover { 
    transform: translateX(-2px);
  }
  .side-btn.is-camera { 
    background: linear-gradient(135deg, #1a1a1a 0%, #0f0f0f 100%);
    border-color: #2d2d2d;
    color: #e5e7eb;
  }
  .side-btn.is-camera:hover { 
    transform: translateX(-2px);
  }
  .side-btn.is-camera.is-processing {
    opacity: 0.6;
    cursor: wait;
  }
  .side-btn.is-camera.is-processing:hover {
    transform: none;
  }
  /* --- キャンバス用ローディングオーバーレイ（JSで位置・サイズを制御） --- */
  .canvas-loading-overlay {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none; /* 読み込み中の操作は不可視だが、オーバーレイ自身は操作を受けない */
    z-index: 1200; /* パネルやドロワー(1000〜1100)より手前/奥を調整 */
  }
  .canvas-loading-overlay img {
    width: 64px;
    height: 64px;
  }

  /* メディアクエリは末尾に集約 */
  @media (min-width: 768px) {
    .wrap { max-width: 720px; }
  }

  /* 769px以上（スマホ以外）：left-panel を side-btn（side-buttons）のすぐ左に固定 */
  @media (min-width: 769px) {
    .side-buttons {
      --side-rail-w: 156px; /* side-btn 群の占有幅（必要なら調整） */
      width: var(--side-rail-w);
    }
    .side-btn { width: 100%; }
    /* 日本語は1行固定、英語は下に表示（折り返し許可） */
    .side-btn .label { white-space: normal; overflow: hidden; }
    .side-btn .label .jp { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  }

  /* 768px以下はキャンバスを縦並び＆横幅にフィット */
  @media (max-width: 768px) {
    .canvas-row { grid-template-columns: 1fr; justify-items: start; }
    canvas { width: 100%; max-width: 250px; height: auto; }
    /* スマホ：ロゴを大きく */
    .site-logo { width: min(420px, 70vw); height: auto; }

    /* スマホ：右サイドボタンを小さく（位置はPCと同じ top: 5rem のまま） */
    .side-buttons { top: 5rem; }
    .side-buttons .side-btn {
      font-size: 9px;
      padding: 6px 10px;
      gap: 6px;
      min-height: 44px; /* タップ目標 */
    }
    .side-btn .step { font-size: 10px; }
    /* スマホ：left-panel が右サイドボタンと干渉して横はみ出ししないように幅を自動調整 */
    .left-panel {
      /* スマホでもPCと同じ位置（上固定＆side-buttonsのすぐ左）にする */
      top: 5rem;
      font-size: 10px;
      width: min(220px, calc(100vw - var(--left-panel-right, 16px) - 16px));
      max-width: calc(100vw - var(--left-panel-right, 16px) - 16px);
    }
    .left-panel .panel-title, .left-panel .panel-value { font-size: 10px; }
    .name-preview { font-size: 30px; }
    .usage-body {
      display: block;
      gap: 12px;
      padding: 8px 0;
      }
  }

.usage-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 8px 0;
}
.usage-body-sub {
  padding: 8px 0;
}

/* --- STEP2: ラベル（形状→色の2段UI） --- */
#labelOptDrawer .usage-body {
  display: block;
}
.label-opt-section {
  width: 100%;
}
.label-opt-title {
  font-weight: 700;
  margin: 0 0 8px 0;
}
.label-opt-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 768px) {
  .label-opt-grid {
    grid-template-columns: 1fr;
  }
}