/* ===================================================
   電柱広告デザインアプリ — ブループリント / 設計図ツール風
   =================================================== */

/* ---------- CSS変数（製図紙カラーシステム） ---------- */
:root {
  /* 製図紙ベース */
  --paper:         #F2F3EC;
  --paper-shade:   #E8EAE0;
  --paper-light:   #FAFAF5;

  /* インク */
  --ink:           #1A2538;
  --ink-2:         #2C3E5C;
  --ink-muted:     #6B7A92;
  --ink-faint:     #A8B2C3;

  /* 赤鉛筆（注釈・強調） */
  --red:           #C9342A;
  --red-hover:     #A82820;
  --red-faint:     #F5E3E1;

  /* グリッド */
  --grid-major:    rgba(26, 37, 56, 0.10);
  --grid-minor:    rgba(26, 37, 56, 0.04);

  /* レイアウト */
  --header-h:  44px;
  --menu-h:    48px;
  --toolbar-w: 76px;
  --bottom-h:  36px;

  /* 後方互換（JS・モーダルなどで参照） */
  --accent:       #1A2538;
  --accent-hover: #2C3E5C;
  --accent-light: rgba(26, 37, 56, 0.08);
  --danger:       #C9342A;
  --bg-stage:     var(--paper);
  --bg-panel:     var(--paper-light);
  --border:       var(--ink-faint);
  --text:         var(--ink);
  --text-muted:   var(--ink-muted);
  --radius:       2px;
  --shadow-canvas: none;
}

/* ---------- リセット ---------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  height: 100vh;
  overflow: hidden;
  font-family: 'Inter Tight', 'Noto Sans JP', 'Hiragino Sans', 'YuGothic', sans-serif;
  font-feature-settings: 'ss01';
  -webkit-font-smoothing: antialiased;
  color: var(--ink);
  background: var(--paper);
  letter-spacing: 0.01em;
}

/* モノスペース（数値・座標・番号用） */
.mono {
  font-family: 'JetBrains Mono', monospace;
  font-feature-settings: 'tnum';
  letter-spacing: 0;
}

/* ---------- アプリ全体レイアウト ---------- */
.app {
  display: grid;
  grid-template-rows: var(--header-h) var(--menu-h) 1fr var(--bottom-h);
  height: 100vh;
}

/* ============================================================
   トップバー — 図面タイトルブロック風
   ============================================================ */
.topbar {
  background: var(--paper-light);
  border-bottom: 1.5px solid var(--ink);
  display: flex;
  align-items: stretch;
  padding: 0;
  position: relative;
  z-index: 10;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  border-right: 1px solid var(--ink);
  cursor: pointer;
  transition: background 100ms;
}
.topbar-brand:hover { background: var(--paper-shade); }

/* 電柱バッジアイコン */
.topbar-brand-icon {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  display: block;
}

.topbar-brand-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--ink);
}

.topbar-meta {
  flex: 1;
  display: flex;
  align-items: center;
  padding: 0 20px;
}

.topbar-help {
  display: flex;
  align-items: center;
  padding: 0 18px;
  font-size: 12px;
  font-weight: 900; /* HELP / 使い方 の文字を極太に（Noto Sans JP / Inter Tight の900をindex.htmlで読み込み） */
  -webkit-text-stroke: 0.6px currentColor; /* 文字の縁取りでさらに太く見せる（文字色と同色） */
  letter-spacing: 0.04em;
  color: var(--ink-muted);
  text-decoration: none;
  border-left: 1px solid var(--ink);
  cursor: pointer;
  transition: color 120ms, background 120ms;
}
.topbar-help:hover {
  color: var(--ink);
  background: var(--paper-shade);
}

/* ============================================================
   メニューバー
   ============================================================ */
.menubar {
  background: var(--paper-light);
  border-bottom: 1px solid var(--ink);
  display: flex;
  align-items: center;
  padding: 0 20px;
  justify-content: space-between;
  position: relative;
  z-index: 9;
}

.menubar-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* メニュー区切り */
.menubar-sep {
  width: 1px;
  height: 18px;
  background: var(--ink-faint);
  margin: 0 6px;
}

/* ボタン基本（角ばった・CAD風） */
.btn {
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--ink);
  background: var(--paper-light);
  color: var(--ink);
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  letter-spacing: 0.02em;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 2px;
  transition: background 100ms, color 100ms;
  white-space: nowrap;
}
.btn:hover {
  background: var(--ink);
  color: var(--paper-light);
}
.btn:active { transform: translateY(0.5px); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn:disabled:hover { background: var(--paper-light); color: var(--ink); }

.btn-red {
  border-color: var(--red);
  color: var(--red);
}
.btn-red:hover {
  background: var(--red);
  color: #fff;
}
.btn-red:disabled:hover { background: transparent; color: var(--red); }

.btn-primary {
  background: var(--ink);
  color: var(--paper-light);
}
.btn-primary:hover { background: var(--ink-2); }

.btn svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ============================================================
   エディタ本体
   ============================================================ */
.editor {
  display: flex;
  overflow: hidden;
  height: 100%;
  position: relative;
}

/* ============================================================
   左ツールバー
   ============================================================ */
.toolbar {
  width: var(--toolbar-w);
  flex-shrink: 0;
  background: var(--paper-light);
  border-right: 1px solid var(--ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0;
  gap: 0;
  overflow-y: auto;
  /* スライドインするサイドパネル(z-index:8)より上に出して、
     パネルが「ツールバーの裏」から滑り出るように見せる */
  position: relative;
  z-index: 9;
}

.tool-btn {
  width: 100%;
  padding: 12px 4px 10px;
  border: none;
  border-bottom: 1px solid var(--ink-faint);
  background: transparent;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  color: var(--ink-muted);
  font-size: 10px;
  font-weight: 500;
  font-family: inherit;
  letter-spacing: 0.02em;
  transition: background 100ms, color 100ms;
  position: relative;
}

.tool-btn:hover {
  background: var(--paper-shade);
  color: var(--ink);
}

/* アクティブ（黒地） */
.tool-btn.active {
  background: var(--ink);
  color: var(--paper-light);
}
/* 左端の赤いアクティブライン */
.tool-btn.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--red);
}

.tool-btn svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  stroke-width: 1.6;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ツール番号（JetBrains Mono・左上） */
.tool-num {
  position: absolute;
  top: 4px;
  left: 6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  color: var(--ink-faint);
  letter-spacing: 0;
}
.tool-btn.active .tool-num { color: var(--paper-shade); }

/* 削除ボタン（非表示） */
.tool-btn.tool-danger { display: none; }

/* セパレーター */
.toolbar-sep {
  width: 52px;
  height: 1px;
  background: var(--ink-faint);
  margin: 4px 0;
}

/* ============================================================
   サイドパネル
   ============================================================ */
.side-panel {
  width: 240px;
  height: 100%;
  background: var(--paper-light);
  border-right: 1px solid var(--ink);
  padding: 0;
  overflow-y: auto;
  position: absolute;
  left: var(--toolbar-w);
  top: 0;
  z-index: 8;
  /* 閉じ状態：左へスライドアウト（ツールバーの真下に隠れる）。
     display:none ではなく transform で隠して slide-in アニメーションを成立させる */
  transform: translateX(-100%);
  pointer-events: none;
  box-shadow: none;
  transition: transform 220ms cubic-bezier(0.2, 0.7, 0.2, 1),
              box-shadow 220ms ease-out;
  will-change: transform;
}

.side-panel.open {
  transform: translateX(0);
  pointer-events: auto;
  box-shadow: 8px 0 18px rgba(26, 37, 56, 0.12);
}

/* パネルブロック（各ツールに対応するブロック） */
.panel-block {
  display: none;
}
.panel-block.panel-active { display: block; }

/* パネルヘッダー */
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--ink);
  background: var(--paper-shade);
}

.panel-head-left {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.panel-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--ink-muted);
  letter-spacing: 0;
}

.panel-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--ink);
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

/* パネル内コンテンツ領域 */
.panel-body {
  padding: 14px 16px;
}

/* パネルクリアボタン（RESETラベル） */
.panel-clear-btn {
  height: 22px;
  padding: 0 8px;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--red);
  background: transparent;
  border: 1px solid var(--red);
  border-radius: 2px;
  cursor: pointer;
  font-family: inherit;
  transition: background 120ms, color 120ms;
  width: auto;
}
.panel-clear-btn:hover {
  background: var(--red);
  color: #fff;
}

/* 旧スタイル後方互換 */
.panel-clear-btn-spacer { margin-top: 10px; }
.panel-clear-btn-inline { width: auto; }
.panel-title-inline { display: inline; }

/* セクションラベル */
.section-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--ink-muted);
  letter-spacing: 0.06em;
  margin-bottom: 8px;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--ink-faint);
}

/* フォームラベル */
.panel-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-muted);
  margin-bottom: 5px;
  letter-spacing: 0.04em;
}
.panel-label-spacer { margin-top: 12px; }

/* テキスト入力 */
.panel-input {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--ink-faint);
  border-radius: 2px;
  font-size: 13px;
  font-family: inherit;
  color: var(--ink);
  background: var(--paper);
  transition: border-color 0.12s, box-shadow 0.12s;
}
.panel-input:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 2px var(--accent-light);
}

.panel-textarea {
  resize: vertical;
  min-height: 110px;
  line-height: 1.5;
}

/* セレクト */
.panel-select {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--ink-faint);
  border-radius: 2px;
  font-size: 13px;
  font-family: inherit;
  color: var(--ink);
  background: var(--paper);
}
.panel-select:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 2px var(--accent-light);
}

/* カラー入力 */
.panel-color-input { height: 40px; padding: 4px; }

/* ヒントテキスト */
.panel-hint {
  margin-top: 8px;
  font-size: 10px;
  color: var(--ink-muted);
  line-height: 1.6;
}

/* スライダー */
.panel-range {
  width: 100%;
  accent-color: var(--ink);
}
.panel-range-value {
  margin-top: 6px;
  font-size: 12px;
  color: var(--ink-muted);
  font-family: 'JetBrains Mono', monospace;
}

/* ファイルボタン */
.panel-file-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 34px;
  border: 1px solid var(--ink-faint);
  border-radius: 2px;
  background: var(--paper);
  color: var(--ink-muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.12s, color 0.12s;
}
.panel-file-btn:hover {
  border-color: var(--ink);
  color: var(--ink);
}

/* 非表示ファイル入力 */
.panel-file-input-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* アップロードボタン（破線） */
.part-upload-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  height: 36px;
  margin-bottom: 14px;
  border: 1px dashed var(--ink-muted);
  background: transparent;
  color: var(--ink-muted);
  font-size: 11px;
  font-weight: 500;
  font-family: inherit;
  letter-spacing: 0.04em;
  cursor: pointer;
  border-radius: 2px;
  transition: all 120ms;
}
.part-upload-btn:hover {
  border-color: var(--ink);
  color: var(--ink);
  border-style: solid;
  background: var(--paper-shade);
}
.part-upload-btn svg {
  width: 13px;
  height: 13px;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
}

/* カラースウォッチ */
.color-swatches {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
  margin-top: 8px;
}
.color-swatch {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 2px;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
  transition: transform 0.1s, border-color 0.1s;
  outline: none;
  box-shadow: 0 1px 2px rgba(26, 37, 56, 0.2);
}
.color-swatch:hover { transform: scale(1.2); z-index: 1; }
.color-swatch.active {
  border-color: var(--ink);
  box-shadow: 0 0 0 1px white inset;
}

.color-picker-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}
.color-picker-label {
  font-size: 11px;
  color: var(--ink-muted);
  white-space: nowrap;
  font-weight: 500;
}
.panel-color-picker {
  flex: 1;
  height: 32px;
  padding: 2px 4px;
  border: 1px solid var(--ink-faint);
  border-radius: 2px;
  background: var(--paper);
  cursor: pointer;
}

/* フォントウェイトボタン */
.weight-btn-group {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-top: 8px;
}
.weight-btn {
  padding: 8px 4px;
  border: 1px solid var(--ink-faint);
  border-radius: 2px;
  background: var(--paper);
  color: var(--ink);
  font-size: 15px;
  cursor: pointer;
  text-align: center;
  transition: background 0.12s, border-color 0.12s;
  font-family: inherit;
}
.weight-btn:hover {
  border-color: var(--ink);
  background: var(--paper-shade);
}
.weight-btn.active {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper-light);
}

/* 看板テンプレートカード */
.template-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.template-card {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--ink-faint);
  border-radius: 2px;
  background: var(--paper);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, background 0.15s;
}
.template-card:hover { border-color: var(--ink); }
.template-card.is-active {
  border-color: var(--ink);
  background: var(--paper-shade);
}
.template-card svg { flex-shrink: 0; color: var(--ink-muted); }
.template-card-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  display: block;
}
.template-card-size {
  font-size: 10px;
  color: var(--ink-muted);
  display: block;
  margin-top: 2px;
  font-family: 'JetBrains Mono', monospace;
}
/* 看板種類パネルの表示設定エリア */
.template-display-settings {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--ink-faint);
}
.template-settings-label {
  font-size: 9px;
  color: var(--ink-muted);
  letter-spacing: 0.08em;
  font-family: 'JetBrains Mono', monospace;
  margin: 0 0 2px;
}
.disp-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--ink-muted);
  cursor: pointer;
  user-select: none;
}
.disp-toggle input[type="checkbox"] {
  width: 13px;
  height: 13px;
  cursor: pointer;
  accent-color: #5b9cf6;
}

/* ロゴグリッド */
.logo-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

/* ロゴアイテム */
.logo-item {
  width: 100%;
  border: 1px solid var(--ink-faint);
  border-radius: 2px;
  background: var(--paper);
  padding: 6px;
  text-align: center;
  cursor: pointer;
  transition: border-color 120ms;
  position: relative;
}
.logo-item:hover { border-color: var(--ink); }
.logo-item.active {
  border-color: var(--ink);
  background: var(--paper-shade);
}
.logo-item:focus, .logo-item:focus-visible { outline: none; }

.logo-item-thumb {
  width: 100%;
  height: 48px;
  object-fit: contain;
  display: block;
  background: transparent;
}
.logo-item-name {
  margin-top: 4px;
  font-size: 10px;
  font-weight: 500;
  color: var(--ink);
}
.logo-item-id {
  font-family: 'JetBrains Mono', monospace;
  font-size: 8px;
  color: var(--ink-faint);
  margin-top: 1px;
  letter-spacing: 0;
}

/* セットグリッド・アイテム */
.set-grid {
  grid-template-columns: 1fr;
  gap: 10px;
}
.set-item {
  opacity: 0.8;
  transition: opacity 0.12s;
  border: 1px solid var(--ink-faint);
  border-radius: 2px;
  background: var(--paper);
  padding: 6px;
  cursor: pointer;
}
.set-item:hover, .set-item.active {
  opacity: 1;
  border-color: var(--ink);
}
.set-item-thumb {
  height: 120px;
  object-fit: contain;
  display: block;
  width: 100%;
}
.set-item-name {
  display: block;
  margin-top: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink);
  text-align: center;
}

/* 住居表示プレビュー */
.address-preview {
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid var(--ink-faint);
  border-radius: 2px;
  background: var(--paper);
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
  word-break: break-all;
}

/* テキストモード切替 */
.text-mode-list {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
}
.text-mode-card {
  width: 100%;
  padding: 8px 0;
  border: none;
  background: transparent;
  text-align: left;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.12s;
}
.text-mode-card:hover { opacity: 0.85; }
.text-mode-card.is-active { opacity: 1; }
.text-mode-card-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-muted);
}
.text-mode-card.is-active .text-mode-card-label {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.28em;
  text-decoration-color: var(--red);
}
.text-mode-card-desc {
  display: block;
  margin-top: 3px;
  font-size: 10px;
  line-height: 1.5;
  color: var(--ink-muted);
}
.text-mode-card.is-active .text-mode-card-desc { color: var(--ink); }

.text-panel-section { display: none; }
.text-panel-section.is-active { display: block; }
.text-panel-section + .text-panel-section { margin-top: 14px; }

.text-panel-placeholder, .text-form-preview {
  padding: 0;
  border: none;
  background: transparent;
}
.text-panel-placeholder-title { font-size: 12px; font-weight: 700; color: var(--ink); }

.text-template-grid {
  grid-template-columns: 1fr;
  gap: 10px;
}
.text-template-wrap { margin-top: 4px; }
.text-template-item {
  cursor: pointer;
  opacity: 0.76;
  transition: opacity 0.12s;
}
.text-template-item:hover, .text-template-item.active { opacity: 1; }
.text-template-item .logo-item-thumb { height: 180px; }

/* ============================================================
   キャンバスステージ（製図紙グリッド + コーナーマーク）
   ============================================================ */
.stage {
  flex: 1;
  background:
    linear-gradient(var(--grid-minor) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-minor) 1px, transparent 1px),
    linear-gradient(var(--grid-major) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-major) 1px, transparent 1px),
    var(--paper);
  background-size:
    10px 10px,
    10px 10px,
    50px 50px,
    50px 50px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow: auto;
  padding: 24px;
  position: relative;
}

/* サムネイルをドラッグしてステージ上にホバーしている間の視覚フィードバック */
.stage-drag-overlay {
  display: none;
  position: absolute;
  inset: 0;
  background: rgba(91, 156, 246, 0.08);
  border: 2px dashed var(--accent);
  pointer-events: none;
  z-index: 5;
}
.stage.stage-drag-over .stage-drag-overlay {
  display: block;
}

/* コーナーマーク（製図紙の隅罫線） */
.stage::before,
.stage::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid var(--ink);
  pointer-events: none;
}
.stage::before { top: 12px; left: 12px; border-right: none; border-bottom: none; }
.stage::after  { bottom: 12px; right: 12px; border-left: none; border-top: none; }

/* テキストスタイルパネルは position:absolute で重ねるため、ステージの調整は不要 */

/* ---------- キャンバスエリア ---------- */
.canvas-area {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* キャンバス上部の簡素なキャプション（1行・JetBrains Mono） */
.canvas-caption {
  width: max-content;
  margin-bottom: 10px;
  padding: 0 8px 5px;
  border-bottom: 1px solid var(--ink);
  text-align: center;
  white-space: nowrap;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--ink);
  letter-spacing: 0.02em;
}
.canvas-caption-title {
  font-weight: 600;
  margin-right: 6px;
}
.canvas-caption-meta {
  color: var(--ink-muted);
  font-weight: 500;
  letter-spacing: 0.04em;
}

/* キャンバスラッパー（border は #templateFrame が担当。overflow:visible で枠外配置を可能にする）
   背景は透明にしてステージのグリッドをそのまま透過表示し、ワークスペース部分を目立たせない */
.canvas-wrap {
  position: relative;
  display: inline-block;
  line-height: 0;
  flex-shrink: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  overflow: visible;
  box-shadow: none;
}
/* テンプレート境界の枠（JS がズームに合わせて left/top/width/height を設定） */
#templateFrame {
  position: absolute;
  pointer-events: none;
  border: 1.5px solid var(--ink);
  border-radius: 10px;
  z-index: 10;
}

#designCanvas {
  display: block;
  background: transparent;
}

.image-overlay {
  position: absolute;
  left: 0; top: 0;
  width: 100%; height: 100%;
  pointer-events: none;
}

.text-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}

/* ---------- テキストボックス（縦書きオーバーレイ） ---------- */
.text-box {
  position: absolute;
  border: 1px dashed transparent;
  border-radius: 2px;
  background: transparent;
  pointer-events: auto;
  overflow: hidden;
}
/* マウスホバー中・編集中（フォーカス中）のみ枠線を出し、外れたら消える。
   選択状態(.selected)だけでは表示し続けない（要望：離すと消えてほしい）。背景は常に透明 */
.text-box:hover,
.text-box:focus-within {
  border-color: var(--ink-muted);
  background: transparent;
}
.text-box:focus-within {
  box-shadow: 0 0 0 2px rgba(26, 37, 56, 0.06);
}
.text-box.preview {
  border-color: transparent;
  background: transparent;
  pointer-events: none;
}
.text-box-handle {
  position: absolute;
  left: 50%;
  top: 6px;
  transform: translateX(-50%);
  width: 18px;
  height: 4px;
  border-radius: 999px;
  background: rgba(26, 37, 56, 0.22);
  cursor: move;
  opacity: 0;
  transition: opacity 0.12s;
}
/* ハンドルもホバー中・編集中のみ表示 */
.text-box:hover .text-box-handle,
.text-box:focus-within .text-box-handle { opacity: 1; }
.text-box.preview .text-box-handle { display: none; }

.text-box-editor {
  width: 100%;
  height: 100%;
  border: none;
  outline: none;
  resize: none;
  background: transparent;
  color: var(--ink);
  font-family: 'Hiragino Sans', 'Yu Gothic', 'Meiryo', sans-serif;
  writing-mode: vertical-rl;
  text-orientation: upright;
  line-height: 1;
  text-align: start;
  overflow: hidden;
  white-space: pre;
  padding: 10px 10px 12px;
}
.text-box.preview .text-box-editor { pointer-events: none; }
.text-box-editor::placeholder { color: rgba(26, 37, 56, 0.3); }

/* ---------- テキストスタイルパネル（右側） ---------- */
.text-style-panel {
  position: absolute;
  right: 0; top: 0;
  width: 272px;
  height: 100%;
  background: var(--paper-light);
  border-left: 1px solid var(--ink);
  box-shadow: -4px 0 12px rgba(26, 37, 56, 0.08);
  display: none;
  /* preview-note (z-index:100) より上に来るよう設定 */
  z-index: 110;
}
.text-style-panel.open { display: block; }
.text-style-panel-inner { padding: 16px; }

/* テキスト追加ボタン */
.text-add-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 10px 0;
  border: 1px solid var(--ink);
  border-radius: 2px;
  background: var(--ink);
  color: var(--paper-light);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s;
  font-family: inherit;
}
.text-add-btn:hover { background: var(--ink-2); }

/* ユーザー画像ボックス */
.user-image-box {
  position: absolute;
  min-width: 24px;
  min-height: 24px;
  resize: both;
  overflow: hidden;
  cursor: move;
  border: 1px dashed transparent;
  border-radius: 2px;
  background: transparent;
  pointer-events: auto;
}
.user-image-box.active { border-color: var(--ink-muted); }
.user-image-box::-webkit-resizer {
  width: 0; height: 0; background: transparent;
}
.user-image-box img {
  width: 100%; height: 100%;
  object-fit: contain;
  display: block;
  pointer-events: none;
  user-select: none;
}

/* ============================================================
   ボトムバー（黒地・ステータスバー風）
   ============================================================ */
.bottombar {
  background: var(--ink);
  color: var(--paper-light);
  border-top: 1px solid var(--ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0;
  position: relative;
  z-index: 10;
}

/* ボトムバーのコピーライト表示（ツールバー幅の半分ぶん右へ寄せ、キャンバス本体の中央と揃える） */
.bottombar-copyright {
  position: absolute;
  left: calc(50% + var(--toolbar-w) / 2);
  transform: translateX(-50%);
  color: var(--paper-light);
  opacity: 0.7;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  white-space: nowrap;
  pointer-events: none;
}

.status-group {
  display: flex;
  align-items: center;
  gap: 14px;
}

.status-item {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--ink-faint);
  font-size: 11px;
}
.status-item strong {
  color: var(--paper-light);
  font-weight: 500;
}

.zoom-ctrl {
  display: flex;
  align-items: center;
  gap: 0;
  border-left: 1px solid var(--ink-muted);
  padding-left: 14px;
  margin-left: 6px;
}

.zoom-btn {
  width: 22px;
  height: 22px;
  border: none;
  background: transparent;
  color: var(--ink-faint);
  cursor: pointer;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 100ms;
  line-height: 1;
}
.zoom-btn:hover { color: var(--paper-light); }
.zoom-fit { font-size: 12px; }

.zoom-val {
  min-width: 44px;
  text-align: center;
  color: var(--paper-light);
  font-weight: 500;
}

/* ============================================================
   電柱プレビューモーダル
   ============================================================ */
.mockup-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
}
.mockup-modal.open {
  display: flex;
  align-items: center;
  justify-content: center;
}
.mockup-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 20, 40, 0.75);
  backdrop-filter: blur(3px);
}
.mockup-box {
  position: relative;
  background: var(--paper-light);
  border: 1.5px solid var(--ink);
  border-radius: 4px;
  box-shadow: 0 20px 60px rgba(8, 24, 56, 0.4);
  display: flex;
  flex-direction: column;
  width: min(92vw, 780px);
  max-height: 92vh;
  overflow: hidden;
}
.mockup-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-bottom: 1px solid var(--ink);
  background: var(--paper-shade);
  gap: 12px;
  flex-shrink: 0;
}
.mockup-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: 0.04em;
}
.mockup-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.mockup-close-btn {
  width: 28px; height: 28px;
  border: 1px solid var(--ink-faint);
  background: transparent;
  border-radius: 2px;
  cursor: pointer;
  font-size: 14px;
  color: var(--ink-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.1s, color 0.1s;
}
.mockup-close-btn:hover { background: var(--ink); color: var(--paper-light); }

/* ゴミ箱モーダル */
.trash-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
}
.trash-modal.open {
  display: flex;
  align-items: center;
  justify-content: center;
}
.trash-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 20, 40, 0.75);
  backdrop-filter: blur(3px);
}
.trash-box {
  position: relative;
  background: var(--paper-light);
  border: 1.5px solid var(--ink);
  border-radius: 4px;
  box-shadow: 0 20px 60px rgba(8, 24, 56, 0.4);
  display: flex;
  flex-direction: column;
  width: min(92vw, 640px);
  max-height: 82vh;
  overflow: hidden;
}
.trash-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-bottom: 1px solid var(--ink);
  background: var(--paper-shade);
  gap: 12px;
  flex-shrink: 0;
}
.trash-title { font-size: 13px; font-weight: 600; color: var(--ink); letter-spacing: 0.04em; }
.trash-hint {
  font-size: 11px;
  color: var(--ink-muted);
  padding: 10px 18px 0;
  line-height: 1.6;
}
.trash-tabs {
  display: flex;
  gap: 6px;
  padding: 10px 18px 0;
  flex-shrink: 0;
}
.trash-tab {
  border: 1px solid var(--ink-faint);
  background: transparent;
  color: var(--ink-muted);
  border-radius: 2px;
  padding: 5px 14px;
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  cursor: pointer;
}
.trash-tab.active { background: var(--ink); color: var(--paper-light); border-color: var(--ink); }
.trash-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.trash-item {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--ink-faint);
  border-radius: 3px;
  padding: 6px 10px;
  background: var(--paper);
}
.trash-item-thumb {
  width: 44px; height: 44px;
  object-fit: contain;
  flex-shrink: 0;
  background: #fff;
  border: 1px solid var(--ink-faint);
  border-radius: 2px;
}
.trash-item-info { flex: 1; min-width: 0; }
.trash-item-name {
  font-size: 12px;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.trash-item-meta {
  font-size: 10px;
  color: var(--ink-muted);
  font-family: 'JetBrains Mono', monospace;
}
.trash-item-restore {
  border: 1px solid var(--ink);
  background: var(--paper-light);
  color: var(--ink);
  border-radius: 2px;
  padding: 5px 12px;
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  cursor: pointer;
  flex-shrink: 0;
  white-space: nowrap;
}
.trash-item-restore:hover { background: var(--ink); color: var(--paper-light); }
.trash-item-restore:disabled { opacity: 0.5; cursor: default; }

.mockup-result-area {
  flex: 1;
  min-height: 0;
  background: #111827;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.mockup-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  color: rgba(255,255,255,0.7);
  text-align: center;
  padding: 60px 20px;
}
.mockup-spinner {
  width: 48px; height: 48px;
  border: 4px solid rgba(255,255,255,0.15);
  border-top-color: var(--ink-faint);
  border-radius: 50%;
  animation: mockup-spin 0.9s linear infinite;
}
@keyframes mockup-spin { to { transform: rotate(360deg); } }

.mockup-loading-text {
  font-size: 14px;
  line-height: 1.7;
  color: rgba(255,255,255,0.65);
}
.mockup-loading-text small { font-size: 12px; opacity: 0.7; }

.mockup-result-img {
  display: block;
  max-width: 100%;
  max-height: calc(92vh - 120px);
  width: auto; height: auto;
  object-fit: contain;
}
.mockup-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-top: 1px solid var(--ink-faint);
  background: var(--paper-shade);
  flex-shrink: 0;
}
.mockup-photo-btn, .mockup-regen-btn {
  height: 28px;
  padding: 0 12px;
  background: var(--paper-light);
  border: 1px solid var(--ink-faint);
  border-radius: 2px;
  font-size: 12px;
  font-family: inherit;
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.15s, background 0.15s;
}
.mockup-photo-btn:hover, .mockup-regen-btn:hover:not(:disabled) {
  border-color: var(--ink);
  background: var(--paper-shade);
}
.mockup-regen-btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* 電柱プレビューボタン（メニューバー） */
.menu-btn-export, .menu-btn-mockup {
  /* .btn スタイルを使うため不要になったが後方互換で残す */
}
.menu-btn-export:disabled,
.menu-btn-mockup:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ============================================================
   キャリブレーションUI
   ============================================================ */
.calib-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 16px;
  gap: 10px;
}
.calib-hint {
  font-size: 12px;
  color: var(--ink-muted);
  text-align: center;
}
.calib-canvas-wrap {
  position: relative;
  cursor: crosshair;
  line-height: 0;
  border: 1px solid var(--ink-faint);
  border-radius: 2px;
  overflow: hidden;
  max-height: 55vh;
}
#mockupCalibCanvas {
  display: block;
  max-width: 100%;
  max-height: 55vh;
  object-fit: contain;
}
.calib-actions { display: flex; gap: 8px; }

.calib-reset-btn {
  height: 30px;
  padding: 0 14px;
  border: 1px solid var(--ink-faint);
  background: var(--paper-light);
  color: var(--ink-muted);
  border-radius: 2px;
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.12s, color 0.12s;
}
.calib-reset-btn:hover { border-color: var(--ink); color: var(--ink); }

.calib-confirm-btn {
  height: 30px;
  padding: 0 16px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper-light);
  border-radius: 2px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s;
}
.calib-confirm-btn:hover:not(:disabled) { background: var(--ink-2); }
.calib-confirm-btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ============================================================
   アップロード済みパーツ（削除ボタン付きラッパー）
   ============================================================ */
.logo-item-wrap { position: relative; }
.part-delete-btn {
  position: absolute;
  top: 3px; right: 3px;
  width: 18px; height: 18px;
  border: none;
  border-radius: 50%;
  background: rgba(26, 37, 56, 0.6);
  color: #fff;
  font-size: 10px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 2;
}
.logo-item-wrap:hover .part-delete-btn { opacity: 1; }

/* ============================================================
   右下の赤いスタンプ（PREVIEW / VER 1.0）
   ============================================================ */
/* ============================================================
   トースト通知
   ============================================================ */
.toast-wrap {
  position: fixed;
  bottom: calc(var(--bottom-h) + 12px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 9999;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  white-space: nowrap;
  box-shadow: 2px 2px 0 rgba(0,0,0,0.3);
  animation: toastIn 0.15s ease forwards;
  pointer-events: auto;
}

.toast.success { background: #1a5c3a; border-color: #1a5c3a; }
.toast.error   { background: var(--red); border-color: var(--red); }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* 削除確認ポップアップ */
.delete-popup {
  position: fixed;
  background: var(--ink);
  color: var(--paper);
  border-radius: 4px;
  padding: 8px 10px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  z-index: 9998;
  display: none;
  flex-direction: column;
  gap: 6px;
  white-space: nowrap;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}
.delete-popup.active { display: flex; }
.delete-popup-btns { display: flex; gap: 6px; }
.delete-popup-btns[hidden] { display: none; }
.delete-popup-yes, .delete-popup-no {
  border-radius: 2px;
  padding: 3px 12px;
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  cursor: pointer;
  border: none;
}
.delete-popup-yes { background: var(--red); color: #fff; }
.delete-popup-no  { background: transparent; color: var(--paper); border: 1px solid rgba(255,255,255,0.3); }

/* 削除確認ポップアップ：管理者認証エリア */
.delete-popup-auth {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 160px;
}
.delete-popup-auth[hidden] { display: none; }
.delete-popup-user, .delete-popup-pass {
  width: 100%;
  box-sizing: border-box;
  padding: 4px 6px;
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 2px;
  background: rgba(255,255,255,0.08);
  color: var(--paper);
}
.delete-popup-user::placeholder, .delete-popup-pass::placeholder { color: rgba(255,255,255,0.4); }
.delete-popup-auth-btns { display: flex; gap: 6px; }
.delete-popup-auth-ok, .delete-popup-auth-cancel {
  border-radius: 2px;
  padding: 3px 12px;
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  cursor: pointer;
  border: none;
}
.delete-popup-auth-ok     { background: var(--red); color: #fff; }
.delete-popup-auth-cancel { background: transparent; color: var(--paper); border: 1px solid rgba(255,255,255,0.3); }
.delete-popup-auth-error  { color: #ff8080; font-size: 10px; white-space: normal; }
.delete-popup-auth-error[hidden] { display: none; }

/* HSVカラーピッカーポップアップ（ロゴ・テキスト・誘導の色変更で共通利用） */
.color-picker-popup {
  position: fixed;
  width: 200px;
  background: var(--paper-light);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 10px;
  z-index: 9999;
  display: none;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}
.color-picker-popup.active { display: flex; }

/* 彩度・明度パネル（横=彩度・縦=明度、色相で背景色相を変える） */
.cp-sv-area {
  position: relative;
  width: 100%;
  height: 130px;
  border-radius: 3px;
  cursor: crosshair;
  touch-action: none;
}
.cp-sv-white {
  position: absolute; inset: 0;
  background: linear-gradient(to right, #fff, rgba(255,255,255,0));
  border-radius: 3px;
}
.cp-sv-black {
  position: absolute; inset: 0;
  background: linear-gradient(to top, #000, rgba(0,0,0,0));
  border-radius: 3px;
}
.cp-sv-cursor {
  position: absolute;
  width: 12px; height: 12px;
  margin-left: -6px; margin-top: -6px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.4), 0 1px 3px rgba(0,0,0,0.4);
  pointer-events: none;
}

/* 色相スライダー */
.cp-hue-row { width: 100%; }
.cp-hue-track {
  position: relative;
  width: 100%;
  height: 14px;
  border-radius: 7px;
  cursor: pointer;
  touch-action: none;
  background: linear-gradient(to right,
    #ff0000, #ffff00, #00ff00, #00ffff, #0000ff, #ff00ff, #ff0000);
}
.cp-hue-cursor {
  position: absolute;
  top: 50%;
  width: 16px; height: 16px;
  margin-left: -8px; margin-top: -8px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.35), 0 1px 3px rgba(0,0,0,0.4);
  pointer-events: none;
}

/* HEX入力欄 */
.cp-hex-row {
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 12px;
}
.cp-hex-prefix { color: var(--ink-light); }
.cp-hex-input {
  flex: 1;
  min-width: 0;
  border: 1.5px solid var(--line);
  border-radius: 3px;
  padding: 4px 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
}
.cp-hex-preview {
  width: 22px; height: 22px;
  border-radius: 3px;
  border: 1.5px solid var(--line);
  flex-shrink: 0;
}

.preview-note {
  position: fixed;
  bottom: calc(var(--bottom-h) + 16px);
  right: 20px;
  background: var(--red);
  color: #fff;
  padding: 4px 9px;
  font-size: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  z-index: 100;
  border-radius: 0;
  transform: rotate(-1.5deg);
  box-shadow: 2px 2px 0 var(--ink);
  pointer-events: none;
  user-select: none;
}
/* テキストスタイルパネルが開いている間は z-index を下げてパネルの下に潜らせる */
body.text-style-open .preview-note {
  z-index: 1;
}

/* ============================================================
   スクロールバー（サイドパネル内）
   ============================================================ */
.side-panel::-webkit-scrollbar { width: 4px; }
.side-panel::-webkit-scrollbar-track { background: transparent; }
.side-panel::-webkit-scrollbar-thumb {
  background: var(--ink-faint);
  border-radius: 2px;
}
.side-panel::-webkit-scrollbar-thumb:hover { background: var(--ink-muted); }

/* ============================================================
   セット削除ボタン（logo-item-deleteはpart-delete-btnと同スタイル）
   ============================================================ */
.logo-item-delete {
  position: absolute;
  top: 3px; right: 3px;
  width: 18px; height: 18px;
  background: var(--red, #c0392b);
  border: none;
  border-radius: 50%;
  color: #fff;
  font-size: 10px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
  display: flex; align-items: center; justify-content: center;
  padding: 0;
}
.logo-item-wrap:hover .logo-item-delete { opacity: 1; }

/* ============================================================
   セット作成ビュー
   ============================================================ */
.set-create-view { display: flex; flex-direction: column; gap: 6px; }
.set-create-view.hidden { display: none; }
#setListView.hidden { display: none; }

.set-create-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2px;
}
.set-create-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.set-create-cancel {
  font-size: 10px;
  color: var(--ink-muted);
  background: none;
  border: 1px solid var(--ink-faint);
  border-radius: 2px;
  padding: 2px 7px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.set-create-cancel:hover { border-color: var(--ink-muted); color: var(--ink); }

/* パーツ一覧 */
.set-create-part-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 2px;
}
.set-part-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  border: 1px solid var(--ink-faint);
  border-radius: 2px;
  background: var(--paper);
}
.set-part-thumb {
  width: 36px;
  height: 36px;
  object-fit: contain;
  flex-shrink: 0;
}
.set-part-label {
  flex: 1;
  font-size: 10px;
  color: var(--ink-muted);
  font-family: 'JetBrains Mono', monospace;
}
.set-part-focus-btn {
  font-size: 10px;
  color: var(--blue, #2563eb);
  background: none;
  border: 1px solid var(--blue, #2563eb);
  border-radius: 2px;
  padding: 2px 6px;
  cursor: pointer;
  flex-shrink: 0;
}
.set-part-focus-btn:hover { background: rgba(37,99,235,0.08); }
.set-part-del-btn {
  font-size: 11px;
  color: var(--red, #c0392b);
  background: none;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  padding: 2px 4px;
  opacity: 0.7;
  transition: opacity 0.15s;
}
.set-part-del-btn:hover { opacity: 1; }

/* 保存ボタン */
.set-save-btn {
  margin-top: 6px;
  width: 100%;
  justify-content: center;
}

/* 追加要素の非表示ルール（このアプリは要素ごとに .hidden を定義する方式） */
#setUpdateBar.hidden,
#setUpdateName.hidden,
#hiddenSetsArea.hidden,
#hiddenSetsList.hidden { display: none; }

/* セット配置中の「位置を更新保存／DBに保存」バー */
.set-update-bar {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--ink-faint);
}
.set-update-label {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink);
}
.set-update-name {
  margin-bottom: 4px;
}

/* 非表示にした基本セットを戻すエリア */
.hidden-sets-area {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--ink-faint);
}
.hidden-sets-toggle {
  display: flex;
  align-items: center;
  gap: 5px;
  width: 100%;
  padding: 4px 2px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-muted);
}
.hidden-sets-toggle:hover { color: var(--ink); }
.hidden-sets-caret {
  transition: transform 0.15s ease;
}
.hidden-sets-toggle.open .hidden-sets-caret {
  transform: rotate(90deg);
}
.hidden-sets-list {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.hidden-set-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  background: var(--paper-shade);
  border-radius: 2px;
}
.hidden-set-thumb {
  width: 30px;
  height: 30px;
  object-fit: contain;
  background: var(--paper-light);
  flex-shrink: 0;
}
.hidden-set-name {
  flex: 1;
  font-size: 11px;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hidden-set-restore-btn {
  flex-shrink: 0;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink);
  background: var(--paper-light);
  border: 1px solid var(--ink-faint);
  border-radius: 2px;
  cursor: pointer;
}
.hidden-set-restore-btn:hover {
  background: var(--ink);
  color: var(--paper-light);
}
.hidden-set-restore-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

/* ── 右クリックコンテキストメニュー ── */
.canvas-ctx-menu {
  position: fixed;
  z-index: 9999;
  background: var(--paper-light);
  border: 1px solid var(--ink);
  border-radius: 2px;
  padding: 4px 0;
  min-width: 130px;
  box-shadow: 2px 4px 12px rgba(0,0,0,0.35);
}
.canvas-ctx-menu button {
  display: block;
  width: 100%;
  padding: 6px 14px;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--ink);
  letter-spacing: 0.02em;
}
.canvas-ctx-menu button:hover {
  background: var(--ink);
  color: var(--paper-light);
}
.canvas-ctx-menu .ctx-sep {
  margin: 4px 0;
  border: none;
  border-top: 1px solid var(--line);
}
.canvas-ctx-menu .ctx-label {
  padding: 6px 14px 2px;
  font-size: 9px;
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
  color: var(--ink-muted);
  pointer-events: none;
}
/* 不透明度スライダー行 */
.canvas-ctx-menu .ctx-opacity-row {
  display: flex;
  align-items: center;
  padding: 4px 14px 8px;
  gap: 8px;
}
.canvas-ctx-menu .ctx-opacity-row input[type=range] {
  flex: 1;
  accent-color: var(--ink);
  cursor: pointer;
  height: 4px;
}
.canvas-ctx-menu #ctxOpacityVal {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--ink);
  min-width: 34px;
  text-align: right;
  pointer-events: none;
}

/* ============================================================
   09: 図形パネル
   ============================================================ */

/* 図形選択グリッド（2列×2行） */
.shape-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 4px;
}

/* 各図形ボタン */
.shape-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 6px 8px;
  background: var(--paper-light);
  border: 1.5px solid var(--line);
  border-radius: 4px;
  cursor: pointer;
  color: var(--ink);
  font-size: 10px;
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
  transition: background 0.15s, border-color 0.15s;
}
.shape-btn:hover {
  background: var(--paper);
  border-color: var(--accent);
  color: var(--accent);
}
.shape-btn:active {
  background: var(--accent);
  color: var(--paper-light);
}

/* 色設定の行（「なし」ボタン + カラーピッカー + スウォッチ） */
.shape-color-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

/* ロゴパネル：色変更対応ロゴ選択時に出る色設定エリア */
.logo-color-panel {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

/* 「なし」ボタン */
.shape-color-none-btn {
  padding: 3px 8px;
  font-size: 10px;
  font-family: var(--font-mono);
  background: var(--paper-light);
  border: 1.5px solid var(--line);
  border-radius: 3px;
  cursor: pointer;
  color: var(--ink-light);
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}
.shape-color-none-btn:hover,
.shape-color-none-btn.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--paper-light);
}

/* 隠しinput[type=color]（見た目は非表示・ウェルラベルでトリガー） */
.shape-color-input-hidden {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

/* 色見本ウェル（クリックするとカラーピッカーが開く） */
.shape-color-well-label {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}
.shape-color-well {
  display: inline-block;
  width: 22px;
  height: 22px;
  border-radius: 3px;
  border: 1.5px solid var(--line);
  transition: border-color 0.15s;
}
.shape-color-well-label:hover .shape-color-well {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

/* カラースウォッチの並び */
.shape-color-swatches {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

/* 各スウォッチ */
.color-swatch {
  width: 20px;
  height: 20px;
  border-radius: 3px;
  border: 1.5px solid rgba(0,0,0,0.18);
  cursor: pointer;
  padding: 0;
  transition: transform 0.1s, border-color 0.1s;
}
.color-swatch:hover {
  transform: scale(1.2);
  border-color: var(--accent);
}

/* 枠線太さスライダー */
.panel-slider {
  width: 100%;
  margin-top: 4px;
  accent-color: var(--accent);
}
