/* かんたんシールデザイナー（MVP） */

#kodawari-sticker-designer {
  font-family: -apple-system, "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  max-width: 980px;
  margin: 0 auto;
  color: #2b2b2b;
}

#kodawari-sticker-designer .ksd-loading {
  padding: 40px;
  text-align: center;
  color: #888;
}

.ksd-app {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start; /* 子パネルを引き伸ばさない（sticky を効かせるため） */
}

/* === デスクトップ：右パネル（プレビュー）を sticky 化 === */
@media (min-width: 801px) {
  .ksd-app > .ksd-panel + .ksd-panel {
    position: sticky;
    top: 16px;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
  }
}

/* === スマホ：プレビュー上部 sticky + 価格・CTA を下端に固定 === */
@media (max-width: 800px) {
  .ksd-app {
    display: flex;
    flex-direction: column;
    gap: 16px;
    /* fixed CTA バー分の確保（CTA 60px + bottom 12px + summary 約 50px + 余白） */
    padding-bottom: 150px;
  }
  /* パネル2（プレビュー側）の box を解除し、子要素を .ksd-app の直接 flex item に。
     これでプレビューを sticky にしてもページ全体スクロールに追従する。 */
  .ksd-app > .ksd-panel + .ksd-panel {
    display: contents;
  }
  /* パネル2 内の見出しは省略してスペース確保 */
  .ksd-app > .ksd-panel + .ksd-panel > .ksd-step-title,
  .ksd-app > .ksd-panel + .ksd-panel > .ksd-step-heading {
    display: none;
  }
  /* プレビュー本体を最上部に sticky 固定（高さは画面の 32% に圧縮）。
     Flatsome の sticky ヘッダーが上から降りてきたとき、JS が
     --ksd-header-offset を更新するのでプレビューもその分下にずれて隠れない。 */
  .ksd-app > .ksd-panel + .ksd-panel > .ksd-preview-wrap {
    order: -10;
    position: sticky;
    top: var(--ksd-header-offset, 0px);
    z-index: 30;
    aspect-ratio: auto !important;
    height: 32vh;
    min-height: 200px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    transition: top 0.15s ease;
  }
  /* 価格まとめバー（CTA の上、価格と CTA で幅完全一致） */
  .ksd-app > .ksd-panel + .ksd-panel > .ksd-summary {
    position: fixed;
    bottom: 72px; /* CTA(56px) + bottom margin(12px) + 余白(4px) */
    left: 20px;
    right: 20px;
    z-index: 39;
    margin: 0;
    padding: 8px 14px;
    background: #fff;
    border: 1px solid #e6e6e6;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
  }
  .ksd-app > .ksd-panel + .ksd-panel > .ksd-summary .ksd-price { font-size: 20px; }
  /* CTA を価格バーと同じ width で揃え、コンパクトな「ボタン感」に */
  .ksd-app > .ksd-panel + .ksd-panel > .ksd-cta {
    position: fixed;
    bottom: 12px;
    left: 20px;
    right: 20px;
    z-index: 40;
    margin: 0;
    height: 56px;
    font-size: 17px;
    font-weight: 700;
    border-radius: 12px;
    /* オレンジのグロー＋立体感で「ここを押す」を強調 */
    box-shadow:
      0 6px 18px rgba(255, 122, 89, 0.35),
      0 2px 6px rgba(0, 0, 0, 0.12);
  }
  .ksd-app > .ksd-panel + .ksd-panel > .ksd-cta:disabled {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  }
  /* エラーメッセージ表示位置（fixed CTA に隠れないように上にずらす） */
  .ksd-app > .ksd-panel + .ksd-panel > .ksd-error {
    margin: 8px 16px;
  }
}

.ksd-panel {
  background: #fff;
  border: 1px solid #e6e6e6;
  border-radius: 12px;
  padding: 20px;
}

.ksd-step-title {
  font-size: 13px;
  color: #ff7a59;
  font-weight: bold;
  letter-spacing: 0.05em;
  margin: 0 0 4px;
}
.ksd-step-heading {
  font-size: 16px;
  font-weight: bold;
  margin: 0 0 12px;
}

/* --- アップローダー --- */
.ksd-drop {
  border: 2px dashed #cbd5e1;
  border-radius: 12px;
  padding: 36px 20px;
  text-align: center;
  cursor: pointer;
  background: #fafbfc;
  transition: all 0.15s ease;
}
.ksd-drop:hover, .ksd-drop.is-dragover {
  border-color: #ff7a59;
  background: #fff5f1;
}
.ksd-drop-icon {
  font-size: 36px;
  display: block;
  margin-bottom: 8px;
}
.ksd-drop-main {
  font-size: 15px;
  font-weight: bold;
}
.ksd-drop-sub {
  font-size: 12px;
  color: #777;
  margin-top: 6px;
}

/* --- プレビュー --- */
.ksd-preview-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1; /* JS が style 属性で実寸比に上書き */
  /* sticky 化したときに下層が透けないよう不透明な下地を入れる */
  background-color: #f8fafc;
  background-image:
    linear-gradient(45deg, #eee 25%, transparent 25%),
    linear-gradient(-45deg, #eee 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #eee 75%),
    linear-gradient(-45deg, transparent 75%, #eee 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ksd-preview-canvas {
  max-width: 100%;
  max-height: 100%;
  display: block;
  cursor: grab;
  touch-action: none; /* ポインタードラッグでスクロールに干渉しない */
}
.ksd-preview-canvas:active { cursor: grabbing; }
/* v2.17.0: モチーフ／領域配置モード中のカーソル ghost overlay。
   pointer-events:none で下層 canvas にクリックを通す。 */
.ksd-preview-overlay {
  position: absolute;
  inset: 0;
  margin: auto;
  max-width: 100%;
  max-height: 100%;
  pointer-events: none;
  display: block;
}
.ksd-preview-overlay[hidden] { display: none; }
.ksd-preview-empty {
  color: #aaa;
  font-size: 13px;
}

/* --- 形状選択 --- */
.ksd-shapes {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}
.ksd-shape-btn {
  background: #fff;
  border: 2px solid #e6e6e6;
  border-radius: 10px;
  padding: 10px 4px;
  cursor: pointer;
  text-align: center;
  font-size: 12px;
  transition: all 0.15s ease;
}
.ksd-shape-btn:hover { border-color: #cbd5e1; }
.ksd-shape-btn.is-active {
  border-color: #ff7a59;
  background: #fff5f1;
  color: #ff7a59;
  font-weight: bold;
}
.ksd-shape-icon {
  display: block;
  font-size: 24px;
  margin-bottom: 2px;
  line-height: 1;
}

/* --- セレクト群 --- */
.ksd-row {
  display: grid;
  grid-template-columns: 90px 1fr;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
@media (max-width: 600px) {
  .ksd-row {
    grid-template-columns: 60px 1fr;
    gap: 8px;
  }
  .ksd-step-heading { font-size: 15px; }
  .ksd-shapes { grid-template-columns: repeat(4, 1fr); gap: 4px; }
  .ksd-shape-btn { font-size: 11px; padding: 8px 2px; }
  .ksd-shape-icon { font-size: 20px; }
}
.ksd-row label {
  font-size: 13px;
  font-weight: bold;
  color: #555;
}
.ksd-row select {
  padding: 8px 10px;
  border: 1px solid #d6d6d6;
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
  width: 100%;
}
.ksd-row input[type=range] + span {
  margin-left: 8px;
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: #555;
  min-width: 36px;
  display: inline-block;
  text-align: right;
}

/* --- 価格＋CTA --- */
.ksd-summary {
  margin-top: 16px;
  padding: 14px 16px;
  background: #fafbfc;
  border-radius: 10px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.ksd-price-label { font-size: 12px; color: #666; }
.ksd-price {
  font-size: 24px;
  font-weight: bold;
  color: #ff7a59;
}
.ksd-price-tax { font-size: 11px; color: #888; margin-left: 4px; }

.ksd-cta {
  margin-top: 12px;
  width: 100%;
  padding: 14px;
  font-size: 16px;
  font-weight: bold;
  color: #fff;
  background: #ff7a59;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s ease;
}
.ksd-cta:hover:not(:disabled) { background: #ff6440; }
.ksd-cta:disabled {
  background: #ccc;
  cursor: not-allowed;
}

.ksd-bg-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #555;
  margin-top: 10px;
  padding: 8px 10px;
  background: #f5f7fa;
  border-radius: 8px;
}
.ksd-bg-toggle input[type=checkbox] {
  width: 16px; height: 16px;
}
.ksd-bg-status {
  margin-left: auto;
  font-size: 11px;
  color: #888;
}

.ksd-error {
  color: #d33;
  font-size: 13px;
  margin-top: 8px;
  padding: 8px 10px;
  background: #fff5f5;
  border-radius: 6px;
  display: none;
}
.ksd-error.is-visible { display: block; }

.ksd-step {
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid #f0f0f0;
}
.ksd-step:last-child { border-bottom: none; padding-bottom: 0; margin-bottom: 0; }

/* --- 商品ページ引き継ぎ情報 --- */
.ksd-product-info {
  background: #f0f9ff;
  border: 1px solid #bae0ff;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 16px;
}
.ksd-product-info .ksd-step-title { color: #0369a1; margin: 0; }
.ksd-product-info-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}
.ksd-back-link {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  color: #0369a1;
  background: #fff;
  border: 1px solid #bae0ff;
  border-radius: 6px;
  padding: 4px 10px;
  text-decoration: none;
  white-space: nowrap;
  transition: all .12s ease;
}
.ksd-back-link:hover {
  background: #0369a1;
  color: #fff;
  border-color: #0369a1;
}
.ksd-product-info-rows {
  display: grid;
  gap: 4px;
  margin-top: 6px;
}
.ksd-product-info-rows > div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  flex-wrap: wrap;
}
.ksd-product-info-rows span { color: #555; flex-shrink: 0; }
.ksd-product-info-rows strong { color: #0c4a6e; font-weight: 700; text-align: right; }
@media (max-width: 600px) {
  .ksd-product-info-rows > div { font-size: 12px; }
}

/* --- カット線レジェンド --- */
.ksd-line-legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 11px;
  color: #555;
  background: #fafbfc;
  border-radius: 6px;
  padding: 6px 10px;
  margin-top: 4px;
}
.ksd-line-legend span {
  display: flex;
  align-items: center;
  gap: 6px;
}
.ksd-line-swatch {
  display: inline-block;
  width: 18px;
  height: 3px;
  border-radius: 2px;
}
.ksd-line-swatch-cut { background: #e6007e; }
.ksd-line-swatch-half { background: #00a0e9; }

/* --- 仕上がりサイズ表示（読み取り専用） --- */
.ksd-dims-panel {
  margin-top: 12px;
  padding: 8px 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}
.ksd-dims-head {
  font-size: 13px;
  color: #475569;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px 8px;
}
.ksd-dims-head strong { color: #0f172a; font-weight: 700; }
.ksd-dim-source {
  margin-left: auto;
  font-size: 11px;
  color: #94a3b8;
}
.ksd-dim-swap {
  margin-left: auto;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  color: #475569;
  cursor: pointer;
}
.ksd-dim-swap:hover { background: #f1f5f9; }

.ksd-cutsize-panel {
  margin-top: 10px;
  padding: 10px 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  display: block; /* details 要素はデフォルト display:block。閉時は summary だけが見える */
}
.ksd-cutsize-panel[hidden] { display: none; }
.ksd-cutsize-panel[open] {
  display: grid;
  gap: 8px;
}
.ksd-cutsize-summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: #475569;
  list-style: none; /* ネイティブの ▶ 三角を消し、summary 内の ▼ テキストに統一 */
  user-select: none;
  padding: 2px 0;
}
.ksd-cutsize-summary::-webkit-details-marker { display: none; }
.ksd-cutsize-panel[open] .ksd-cutsize-summary { margin-bottom: 4px; }
.ksd-cutsize-summary-arrow {
  display: inline-block;
  transition: transform 0.15s ease;
}
.ksd-cutsize-panel[open] .ksd-cutsize-summary-arrow {
  transform: rotate(180deg);
}
.ksd-cutsize-head {
  font-size: 13px;
  font-weight: 600;
  color: #475569;
}
.ksd-cutsize-hint {
  display: block;
  font-size: 11px;
  font-weight: 400;
  color: #94a3b8;
  margin-top: 2px;
}
.ksd-dim-slider-wrap {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 4px 8px;
  font-size: 12px;
  color: #475569;
}
.ksd-dim-slider-wrap > strong {
  color: #0369a1;
  font-weight: 700;
  text-align: right;
  min-width: 44px;
}
.ksd-dim-slider-wrap > input[type=range] {
  grid-column: 1 / -1;
  width: 100%;
}

/* --- カット線の余白スライダ --- */
.ksd-border-slider-wrap {
  margin-top: 12px;
  padding: 10px 12px;
  background: #fafbfc;
  border-radius: 8px;
}
.ksd-border-slider-wrap > label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 13px;
  font-weight: 700;
  color: #555;
  margin-bottom: 6px;
}
.ksd-border-value {
  color: #ff7a59;
  font-variant-numeric: tabular-nums;
  font-size: 14px;
}
.ksd-border-slider {
  width: 100%;
  margin: 0;
  accent-color: #ff7a59;
}
.ksd-border-ticks {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: #888;
  margin-top: 2px;
}

.ksd-inflate-readout {
  margin-top: 12px;
  padding: 8px 12px;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 8px;
  font-size: 13px;
  color: #0c4a6e;
}
.ksd-inflate-value {
  font-size: 16px;
  font-weight: 700;
  color: #0369a1;
  margin: 0 2px;
}
.ksd-inflate-hint {
  display: block;
  font-size: 11px;
  color: #64748b;
  font-weight: 400;
  margin-top: 2px;
}
.ksd-contour-warning,
.ksd-multicut-warning {
  margin-top: 8px;
  padding: 8px 12px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.55;
  color: #7c2d12;
}
/* multicut（自己交差）はカット不能リスクなので赤系で目立たせる */
.ksd-multicut-warning {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
  font-weight: 600;
}
.ksd-contour-warning[hidden],
.ksd-multicut-warning[hidden] { display: none; }

.ksd-scale-hint {
  margin: 6px 0 0;
  padding: 6px 10px;
  font-size: 11px;
  line-height: 1.55;
  color: #5b5b5b;
  background: #f5f3ff;
  border: 1px solid #ddd6fe;
  border-radius: 6px;
}
.ksd-scale-hint[hidden] { display: none; }

.ksd-advanced {
  margin-top: 16px;
  background: #fafafa;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 10px 14px;
}
.ksd-advanced > summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: #475569;
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 0;
}
.ksd-advanced > summary::-webkit-details-marker { display: none; }
.ksd-advanced > summary::before {
  content: '▶';
  font-size: 10px;
  color: #94a3b8;
  transition: transform 0.15s ease;
}
.ksd-advanced[open] > summary::before { transform: rotate(90deg); }
.ksd-adv-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 10px;
}
.ksd-adv-grid label {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 8px;
  align-items: center;
  font-size: 12px;
  color: #475569;
}
.ksd-adv-grid label > span {
  grid-column: 1;
}
.ksd-adv-grid label > strong {
  grid-column: 2;
  color: #0369a1;
  font-size: 13px;
  font-weight: 700;
  text-align: right;
  min-width: 36px;
}
.ksd-adv-grid label > input[type=range] {
  grid-column: 1 / -1;
  width: 100%;
}
.ksd-adv-reset {
  margin-top: 8px;
  padding: 6px 12px;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 12px;
  color: #475569;
  cursor: pointer;
}
.ksd-adv-reset:hover { background: #f1f5f9; }

/* --- 多画像ギャラリー --- */
.ksd-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 0;
}

@media (max-width: 600px) {
  .ksd-gallery {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: thin;
  }
  .ksd-gallery::-webkit-scrollbar { height: 4px; }
  .ksd-gallery::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 2px; }
}
.ksd-gallery-tile {
  position: relative;
  width: 64px;
  height: 64px;
  border: 2px solid #e6e6e6;
  border-radius: 10px;
  background: #fafbfc;
  cursor: pointer;
  padding: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}
.ksd-gallery-tile canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.ksd-gallery-tile.is-active {
  border-color: #ff7a59;
  box-shadow: 0 0 0 2px rgba(255,122,89,.18);
}
.ksd-gallery-tile:hover { border-color: #cbd5e1; }
.ksd-gallery-remove {
  position: absolute;
  top: 1px; right: 2px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: rgba(15,23,42,.78);
  color: #fff;
  font-size: 14px;
  line-height: 18px;
  text-align: center;
  cursor: pointer;
}
.ksd-gallery-remove:hover { background: #d33; }
.ksd-gallery-empty { font-size: 10px; color: #888; }
.ksd-gallery-add {
  font-size: 24px;
  color: #94a3b8;
  font-weight: bold;
  border-style: dashed;
}
.ksd-gallery-add:hover { color: #ff7a59; border-color: #ff7a59; }

.ksd-gallery-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.ksd-tile-qty-wrap {
  display: flex;
  align-items: baseline;
  gap: 2px;
  font-size: 11px;
  color: #555;
}
.ksd-tile-qty {
  width: 56px;
  padding: 3px 6px;
  border: 1px solid #d6d6d6;
  border-radius: 5px;
  font-size: 12px;
  text-align: right;
}
.ksd-tile-qty:focus { outline: none; border-color: #ff7a59; }
.ksd-tile-qty-unit { color: #888; }

.ksd-qty-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 8px 0 0;
  padding: 6px 10px;
  background: #fafbfc;
  border-radius: 6px;
  font-size: 12px;
}
.ksd-qty-sum { color: #444; font-weight: bold; }
.ksd-qty-sum.is-mismatch { color: #d33; }
.ksd-qty-rebalance {
  font-size: 11px;
  padding: 3px 8px;
  background: #fff;
  border: 1px solid #d6d6d6;
  border-radius: 5px;
  cursor: pointer;
  color: #555;
}
.ksd-qty-rebalance:hover { border-color: #ff7a59; color: #ff7a59; }

/* --- テキストパネル --- */
.ksd-row input[type=text] {
  padding: 8px 10px;
  border: 1px solid #d6d6d6;
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
  width: 100%;
}
.ksd-row input[type=range] { width: 100%; }
.ksd-row input[type=color] {
  width: 50px; height: 32px;
  border: 1px solid #d6d6d6;
  border-radius: 6px;
  padding: 2px;
  cursor: pointer;
  background: #fff;
}
.ksd-row input[type=color][disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}
.ksd-text-stroke-row .ksd-text-stroke-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 14px;
}
.ksd-text-stroke-row .ksd-text-stroke-toggle input[type=checkbox] {
  width: 16px; height: 16px;
  cursor: pointer;
}
.ksd-text-layer-bar {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-bottom: 10px;
}
.ksd-text-layer-select {
  flex: 1;
  padding: 6px 8px;
  border: 1px solid #d6d6d6;
  border-radius: 6px;
  font-size: 13px;
  background: #fff;
  min-width: 0;
}
.ksd-text-layer-add, .ksd-text-layer-remove {
  width: 30px; height: 30px;
  border: 1px solid #d6d6d6;
  border-radius: 6px;
  background: #fff;
  font-size: 16px;
  cursor: pointer;
  flex: 0 0 auto;
}
.ksd-text-layer-add:hover { color: #ff7a59; border-color: #ff7a59; }
.ksd-text-layer-remove:hover { color: #d33; border-color: #d33; }

.ksd-row textarea.ksd-text-input {
  padding: 8px 10px;
  border: 1px solid #d6d6d6;
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
  width: 100%;
  resize: vertical;
  font-family: inherit;
  line-height: 1.4;
}

.ksd-text-pos {
  display: flex;
  gap: 6px;
  margin: 8px 0 6px;
}
.ksd-text-pos-btn {
  flex: 1;
  padding: 6px;
  background: #fff;
  border: 1px solid #d6d6d6;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
}
.ksd-text-pos-btn:hover { border-color: #ff7a59; color: #ff7a59; }
.ksd-text-hint {
  font-size: 11px;
  color: #888;
  margin: 4px 0 0;
}

.ksd-help-link {
  font-size: 11px;
  color: #888;
  text-decoration: underline;
  cursor: pointer;
  margin-left: 8px;
}

/* --- マルチハーフカット領域（v2.26.0+） --- */
.ksd-multicut-step { background: #fafbff; border: 1px dashed #cbd5e1; border-radius: 10px; padding: 14px 16px; }
.ksd-multicut-hint { font-size: 12px; color: #555; margin: 0 0 10px; line-height: 1.5; }
.ksd-region-palette {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.ksd-region-btn {
  background: #fff;
  border: 2px solid #cbd5e1;
  border-radius: 10px;
  padding: 10px 4px;
  cursor: grab;
  text-align: center;
  font-size: 12px;
  transition: all 0.12s ease;
  user-select: none;
}
.ksd-region-btn:hover { border-color: #0ea5e9; color: #0369a1; }
.ksd-region-btn.is-active {
  border-color: #0ea5e9;
  background: #ecfeff;
  color: #0369a1;
  font-weight: bold;
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.18);
}
.ksd-region-btn:active { cursor: grabbing; }
.ksd-region-placehint {
  margin-top: 8px;
  background: #ecfeff;
  border: 1px solid #67e8f9;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  color: #0369a1;
}
.ksd-region-inspector {
  margin-top: 10px;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
}
.ksd-region-inspector-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 13px;
}
.ksd-region-inspector-type { color: #0369a1; }
.ksd-region-delete {
  background: #fff;
  border: 1px solid #fca5a5;
  color: #b91c1c;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
}
.ksd-region-delete:hover { background: #fee2e2; }
.ksd-region-inspector-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.ksd-region-inspector-grid label {
  display: flex;
  flex-direction: column;
  font-size: 11px;
  color: #555;
}
.ksd-region-inspector-grid input {
  padding: 4px 6px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 13px;
  margin-top: 2px;
}
.ksd-region-inspector-hint {
  font-size: 11px;
  color: #777;
  margin: 8px 0 0;
}
.ksd-canvas-placing { cursor: crosshair !important; }
@media (max-width: 600px) {
  .ksd-region-palette { gap: 4px; }
  .ksd-region-btn { font-size: 11px; padding: 8px 2px; }
}
.ksd-region-contour-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  font-size: 12px;
  color: #444;
  cursor: pointer;
}
.ksd-region-contour-toggle input { margin: 0; }
.ksd-region-margin-wrap {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  font-size: 12px;
  color: #555;
}
.ksd-region-margin-wrap input[type=range] { grid-column: 1 / span 2; }
.ksd-region-inspector-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.ksd-region-duplicate {
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
}
.ksd-region-duplicate:hover { background: #f1f5f9; border-color: #0ea5e9; color: #0369a1; }
.ksd-region-reset {
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
}
.ksd-region-reset:hover { background: #fef9c3; border-color: #ca8a04; color: #854d0e; }

/* v2.17.0: モチーフパレット（自動抽出された各島サムネ） */
.ksd-motif-palette-wrap {
  margin: 10px 0 14px;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
}
.ksd-motif-palette-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 13px;
}
.ksd-motif-regenerate {
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 3px 10px;
  font-size: 11px;
  color: #475569;
  cursor: pointer;
}
.ksd-motif-regenerate:hover { border-color: #0ea5e9; color: #0369a1; }
.ksd-motif-palette {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: 8px;
  max-height: 220px;
  overflow-y: auto;
}
.ksd-motif-item {
  background: #f8fafc;
  border: 2px solid #cbd5e1;
  border-radius: 8px;
  padding: 4px 4px 6px;
  cursor: pointer;
  text-align: center;
  font-size: 10px;
  color: #475569;
  transition: all 0.12s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.ksd-motif-item:hover { border-color: #0ea5e9; }
.ksd-motif-item.is-active {
  border-color: #0ea5e9;
  background: #ecfeff;
  color: #0369a1;
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.18);
}
.ksd-motif-thumb {
  width: 56px;
  height: 56px;
  object-fit: contain;
  background-color: #fff;
  background-image:
    linear-gradient(45deg, #eee 25%, transparent 25%),
    linear-gradient(-45deg, #eee 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #eee 75%),
    linear-gradient(-45deg, transparent 75%, #eee 75%);
  background-size: 8px 8px;
  background-position: 0 0, 0 4px, 4px -4px, -4px 0;
  border-radius: 4px;
}
.ksd-motif-thumb-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #94a3b8;
}
.ksd-motif-size { font-size: 10px; color: #64748b; }
.ksd-motif-hint { font-size: 11px; color: #777; margin: 6px 0 0; }
