@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');
body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
    background-color: #868686;
  }
  /* ロゴ（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(120px, 30vw); height: auto; }
  
  .wrap {
    display: grid;
    gap: 12px;
    max-width: 1060px; /* 500x2 + 余白 */
  }
  
  .canvas-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    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: #868686;
    display: block;
    /* 枠は無し */
    border: none;
  }

  /* --- 左側パネル（STEP1詳細） --- */
  .left-panel {
    position: fixed;
    top: 16px;
    right: var(--left-panel-right, 16px); /* 右サイドバーの左に配置（JSで調整） */
    left: auto;
    width: 360px;
    background: rgba(30, 58, 138, 0.9); /* ネイビー系、透過 */
    color: #fff;
    border: 1px solid #1e40af;
    padding: 12px;
    border-radius: 4px; /* 角は四角〜微小 */
    z-index: 1000;
  }
  /* 左パネル内は横書き強制（縦書き指定の影響を排除） */
  .left-panel, .left-panel * { writing-mode: horizontal-tb; }
  .panel-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .panel-item {
    display: grid;
    grid-template-columns: 1fr; /* 縦積み */
    row-gap: 4px;
    align-items: start;
    background: rgba(255,255,255,0.05);
    padding: 6px 10px; /* 右側ボタンと同等の内側余白に寄せる */
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 10px; /* ボタンは独自の角丸 */
    min-height: 40px; /* 小さすぎ防止。内容に応じて縦に伸びる */
    height: auto;
  }
  .panel-item.-wide { grid-column: 1 / -1; }
  .panel-title { font-weight: 700; margin: 0; font-size: 14px; white-space: nowrap; }
  .panel-value { background:#1f2937; padding: 4px 8px; border: 1px solid #111827; font-size: 14px; white-space: normal; overflow: visible; text-overflow: initial; }
  .panel-item.is-clickable { cursor: pointer; }
  .panel-item.is-clickable:hover { outline: 2px solid rgba(255,255,255,0.35); outline-offset: 2px; }

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

  /* --- 用途選択ドロワー --- */
  .usage-drawer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(31, 41, 55, 0.95);
    color: #fff;
    border-top: 3px solid #16a34a;
    z-index: 1100;
    padding: 12px 16px;
  font-size: 10px; /* ドロワー内基準フォントサイズ */
  }
  .usage-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.usage-title { font-weight: 700; font-size: 10px; }
/* STEP5専用見出し（他と衝突しないクラス名） */
.STEP5usage-title-u { font-weight: 700; font-size: 10px; margin-top: 8px; }
/* STEP5 番号プレビュー */
.number-preview { background:#fff; color:#000; border:1px solid #1f2937; border-radius:6px; padding:8px 12px; display:inline-block; min-width:60px; text-align:center; font-weight:700; font-family:"Noto Sans JP", sans-serif; font-size:60px; line-height:1; }
  .usage-close { background: #334155; color:#fff; border:1px solid #0f172a; padding:6px 10px; border-radius: 6px; }
  .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 親指付け根刺繍 影カラー（裏革と同スタイル） */
  #thumbShadowColors { display: flex; gap: 12px; overflow-x: auto; padding: 8px 0; }
  #thumbShadowColors .usage-card { min-width: 120px; text-align: center; }
  /* 縫い糸（ハミダシと同スタイル） */
  #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 番号刺繍 文字色カラー（nameCharColorsと同スタイル） */
  #thumbNumberCharColors { display: flex; gap: 12px; overflow-x: auto; padding: 8px 0; }
  #thumbNumberCharColors .usage-card { min-width: 120px; text-align: center; }
  /* STEP5 番号刺繍 縁/影カラー（nameEdgeColorsと同スタイル） */
  #thumbNumberEdgeColors { display: flex; gap: 12px; overflow-x: auto; padding: 8px 0; }
  #thumbNumberEdgeColors .usage-card { min-width: 120px; text-align: center; }
  /* ネーム刺繍 プレビュー */
.name-preview { font-size: 60px; font-weight: 700; letter-spacing: 1px; background:#ffffff; color:#000000; border:1px solid #1f2937; padding:12px; border-radius:6px; max-width: auto; text-align: center;}
  /* ラベル（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; }
  .usage-card { text-align: left; background:#0f172a; color:#fff; border:2px solid #1e293b; padding:12px; border-radius: 6px; cursor: pointer; }
  .usage-card:hover { background:#111827; }
  .usage-card.is-selected { border-color: #22c55e; box-shadow: inset 0 0 0 2px #16a34a; }
.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; }
/* STEP4: 刺繍場所のサムネイルを3倍に拡大 */
#namePlaceRow .usage-thumb { width:170px; height:170px; }
.usage-card-title { font-weight: 700; margin-bottom: 6px; font-size: 10px; }
.usage-card-sub { font-size: 10px; color: #cbd5e1; }
  .usage-footer { display:flex; justify-content:center; padding-top: 8px; }
.usage-next { width: 200px; height: 44px; background:#c50b24; color:#fff; border:1px solid #8e081b; border-radius: 12px; font-size: 10px; }
/* STEP5・STEP4 クリアボタン（明るめの青） */
#thumbBaseClear,
#nameClear {
  background:#3b82f6;
  border-color:#1e40af;
  color:#fff;
}
  /* ネーム刺繍ドロワーは縦スクロール可能に */
  #nameDrawer { max-height: 80vh; overflow-y: auto; -webkit-overflow-scrolling: touch; }
  
  /* --- ウェブ選択（p1〜p15）専用レイアウト --- */
  #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; }
  /* 汎用モーダル */
  .modal-overlay { position: fixed; inset: 0; background: rgba(15,23,42,0.75); z-index: 1300; display: flex; align-items: center; justify-content: center; }
  .modal-overlay[hidden] { display: none !important; }
  .modal-panel { background:#0f172a; color:#fff; border:1px solid #1f2937; border-radius: 8px; max-width: 560px; width: calc(100% - 32px); padding: 16px; margin: 12px;}
  .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: 16px; /* ヘッダーの高さ5%ルールを考慮し控えめに */
    right: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 1000;
  }
  .side-btn {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #2563eb; /* CTAは目立つ色 */
    color: #fff;
    text-decoration: none;
    font-size: 14px;
    line-height: 1.2;
    border: 1px solid #1e40af; /* 影は禁止 → 枠で代替 */
    border-radius: 10px; /* ボタンは独自の角丸 */
  }
  .side-btn:hover { background: #1d4ed8; }
  .side-btn.is-active { background: #c50b24; border-color: #8e081b; }
  .side-btn.is-active:hover { background: #a70a1f; }
  .side-btn .step { font-weight: 700; }
  .side-btn .label { font-weight: 500; }
  .side-div { border: 0; border-top: 1px solid #E0E0E0; margin: 4px 0; }
  .side-btn.is-keep { background: #f58106; border-color: #ef5125; }
  .side-btn.is-keep:hover { background: #db380a; }
  .side-btn.is-camera { background: #373737; border-color: #242424; }
  .side-btn.is-camera:hover { background: #111111; }
  /* --- キャンバス用ローディングオーバーレイ（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; }
  }

  /* 768px以下はキャンバスを縦並び＆横幅にフィット */
  @media (max-width: 768px) {
    .canvas-row { grid-template-columns: 1fr; justify-items: start; }
    canvas { width: 100%; max-width: 250px; height: auto; }
    .side-buttons .side-btn { font-size: 10px; }
    .left-panel { font-size: 10px; width: calc(100vw - 180px); max-width: 220px; left: 8px; right: auto; }
    .left-panel .panel-title, .left-panel .panel-value { font-size: 10px; }
    .name-preview { font-size: 30px; font-weight: 700; letter-spacing: 1px; background:#ffffff; color:#000000; border:1px solid #1f2937; padding:12px; border-radius:6px; max-width: auto; text-align: center;}
    .number-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;
}