/* ============================================================================
   公開ラベルシュミレーター スタイル
   - CSP は style-src 'self' / img-src data: なので、装飾は全部この外部CSSに置く。
     JS が生成するボタンのアイコンは mask-image の data: URI で付け、DOMを触らない。
   - 色・余白・書体はここのトークンだけを使う。
   ========================================================================== */
:root {
  color-scheme: only light;
  --font-sans: "Noto Sans JP", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Segoe UI", system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --ink: #1f3129;
  --ink-2: #47594f;
  --muted: #6d7d74;
  --line: #dfe6df;
  --line-strong: #c4d1c7;
  --paper: #fffdf8;
  --paper-2: #f7f8f4;
  --page: #f3f5f0;
  --canvas: #eceee7;
  --accent: #275a45;
  --accent-strong: #1b4634;
  --accent-soft: #e6efe7;
  --accent-tint: #f1f5f0;
  --accent-ring: rgb(39 90 69 / 18%);
  --gold: #8f6a25;
  --gold-soft: #f6efdc;
  --gold-line: #e2d3a8;
  --danger: #b3403a;
  --danger-soft: #fbeeed;
  --warn-bg: #fff6dc;
  --warn-ink: #7a4b0d;
  --trim: #d9736c;
  --safe: #5e9a72;
  --radius-s: 8px;
  --radius-m: 12px;
  --radius-l: 18px;
  --radius-xl: 24px;
  --shadow-1: 0 1px 2px rgb(20 40 30 / 6%), 0 6px 18px rgb(20 40 30 / 6%);
  --shadow-2: 0 24px 64px rgb(18 42 30 / 20%), 0 2px 8px rgb(18 42 30 / 8%);
  --shadow-label: 0 18px 48px rgb(28 46 34 / 16%), 0 1px 3px rgb(28 46 34 / 12%);
  --header-h: 68px;
  /* mask アイコン（stroke 2 / 24 grid）。色は background: currentColor で決まる。 */
  --i-close: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6 6 18'/%3E%3C/svg%3E");
  --i-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  --i-sparkle: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23000'%3E%3Cpath d='M12 2c.6 4.6 2.8 7.4 8 8-5.2.6-7.4 3.4-8 8-.6-4.6-2.8-7.4-8-8 5.2-.6 7.4-3.4 8-8Zm7 12c.3 2.1 1.3 3.4 3 3.7-1.7.3-2.7 1.6-3 3.7-.3-2.1-1.3-3.4-3-3.7 1.7-.3 2.7-1.6 3-3.7ZM5 15c.2 1.4.9 2.2 2 2.4-1.1.2-1.8 1-2 2.4-.2-1.4-.9-2.2-2-2.4 1.1-.2 1.8-1 2-2.4Z'/%3E%3C/svg%3E");
  --i-arrow-up: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 19V5m-7 7 7-7 7 7'/%3E%3C/svg%3E");
  --i-arrow-down: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 5v14m7-7-7 7-7-7'/%3E%3C/svg%3E");
  --i-lock: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='5' y='11' width='14' height='10' rx='2'/%3E%3Cpath d='M8 11V7a4 4 0 0 1 8 0v4'/%3E%3C/svg%3E");
  --i-unlock: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='5' y='11' width='14' height='10' rx='2'/%3E%3Cpath d='M8 11V7a4 4 0 0 1 7.5-2'/%3E%3C/svg%3E");
  --i-edit: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 20h4l10.5-10.5a2.1 2.1 0 0 0-3-3L5 17v3Z'/%3E%3Cpath d='m13.5 8.5 3 3'/%3E%3C/svg%3E");
  --i-palette: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3a9 9 0 0 0 0 18c1.4 0 2-.9 2-1.8 0-.9-.5-1.4-.5-2.2 0-1 .8-1.8 2-1.8H17a4 4 0 0 0 4-4c0-4.6-4-8.2-9-8.2Z'/%3E%3Ccircle cx='7.5' cy='11' r='1.2' fill='%23000'/%3E%3Ccircle cx='10.5' cy='7' r='1.2' fill='%23000'/%3E%3Ccircle cx='15' cy='7.5' r='1.2' fill='%23000'/%3E%3C/svg%3E");
  --i-geometry: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='4' width='16' height='16' rx='2'/%3E%3Cpath d='M4 9h4M4 14h4M9 4v4M14 4v4'/%3E%3C/svg%3E");
  --i-rotate: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 12a8 8 0 1 1-2.3-5.7'/%3E%3Cpath d='M20 3v4h-4'/%3E%3C/svg%3E");
  --i-forward: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='9' y='3' width='12' height='12' rx='2'/%3E%3Cpath d='M15 15v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h4' opacity='.45'/%3E%3C/svg%3E");
  --i-backward: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='9' y='3' width='12' height='12' rx='2' opacity='.45'/%3E%3Crect x='3' y='9' width='12' height='12' rx='2'/%3E%3C/svg%3E");
  --i-duplicate: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='8' y='8' width='12' height='12' rx='2'/%3E%3Cpath d='M16 8V6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h2'/%3E%3C/svg%3E");
  --i-trash: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 7h16M9 7V4h6v3M6 7l1 13h10l1-13M10 11v6M14 11v6'/%3E%3C/svg%3E");
  --i-check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7'/%3E%3C/svg%3E");
  --i-export: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 4v11m-5-5 5 5 5-5M5 20h14'/%3E%3C/svg%3E");
  --i-import: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 15V4m-5 6 5-5 5 5M5 20h14'/%3E%3C/svg%3E");
  --i-search: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='6.5'/%3E%3Cpath d='m20 20-4.2-4.2'/%3E%3C/svg%3E");
  --i-fill: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='18' height='18' rx='2'/%3E%3Cpath d='M8 8h8v8H8zM8 8l-3-3M16 8l3-3M8 16l-3 3M16 16l3 3'/%3E%3C/svg%3E");
  --i-info: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 11v5M12 8h.01'/%3E%3C/svg%3E");
}

/* ---------------------------------------------------------------------------
   基礎
   ------------------------------------------------------------------------ */
* { box-sizing: border-box; }
html { font-family: var(--font-sans); color: var(--ink); background: var(--page); font-synthesis: none; -webkit-text-size-adjust: 100%; }
body { min-width: 320px; margin: 0; font-size: 14px; line-height: 1.5; }
button, input, select, textarea, summary { font: inherit; color: inherit; }
button, select, summary, .file-tool { touch-action: manipulation; }
button, summary, .file-tool { cursor: pointer; }
h1, h2, h3, p { margin-top: 0; }
a { color: var(--accent); text-underline-offset: .15em; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; box-shadow: 0 0 0 5px var(--accent-ring); }
.file-tool:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; box-shadow: 0 0 0 5px var(--accent-ring); }
::selection { background: #cfe1d3; }

/* ボタン */
button, .file-tool {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 8px 16px;
  color: var(--ink); background: var(--paper); border: 1px solid var(--line-strong); border-radius: 10px;
  font-size: 13px; font-weight: 600; letter-spacing: .01em; line-height: 1.3;
  transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s;
}
button:hover, .file-tool:hover { background: var(--accent-tint); border-color: #a9bfae; }
button:active { transform: translateY(.5px); }
button:disabled, .is-disabled { opacity: .38; cursor: default; transform: none; }
button:disabled:hover { background: var(--paper); border-color: var(--line-strong); }
button.primary { color: #fff; background: var(--accent); border-color: var(--accent); box-shadow: 0 6px 16px rgb(39 90 69 / 22%); }
button.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
button.primary:disabled { box-shadow: none; }
button.danger, .danger { color: var(--danger); }
button.danger:hover { background: var(--danger-soft); border-color: #e3b3b0; }
.icon-button { width: 40px; height: 40px; padding: 0; font-size: 20px; font-weight: 400; }
button.text-button { display: inline; min-height: 0; border: 0; padding: 0; background: none; font-size: inherit; font-weight: inherit; color: var(--accent); text-decoration: underline; text-underline-offset: .15em; }
button.text-button:hover { background: none; color: var(--accent-strong); }
.tool-icon { width: 22px; height: 22px; flex: none; }

/* mask アイコン（JS 生成ボタン用） */
.dialog-header > button::before,
.site-menu summary::before,
[data-object-action]::before,
[data-layer-action]:not(.layer-name)::before,
.design-picker-trigger > span:first-child::before,
.design-card[aria-pressed="true"] .gallery-status::before,
#export-design::before,
.file-actions .file-tool::before,
#delete-draft::before,
.font-picker-controls label:first-child::before {
  content: ""; display: inline-block; flex: none; width: 18px; height: 18px;
  background: currentColor;
  -webkit-mask: var(--icon) center / contain no-repeat; mask: var(--icon) center / contain no-repeat;
}

/* フォーム部品 */
select {
  appearance: none; -webkit-appearance: none;
  padding: 9px 34px 9px 12px; min-height: 40px;
  border: 1px solid var(--line-strong); border-radius: 10px; background: var(--paper) var(--i-chevron) right 10px center / 16px no-repeat;
  font-size: 13px; font-weight: 500;
}
select:hover { border-color: #a9bfae; }
input:not([type="checkbox"]):not([type="range"]):not([type="color"]):not([type="file"]), textarea {
  width: 100%; min-width: 0; padding: 9px 12px; min-height: 40px;
  border: 1px solid var(--line-strong); border-radius: 10px; background: #fff; color: var(--ink);
  font-size: 14px;
}
input:not([type="checkbox"]):not([type="range"]):not([type="color"]):focus-visible, textarea:focus-visible, select:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-ring); }
input[type="number"] { font-variant-numeric: tabular-nums; }
input[type="checkbox"] { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); flex: none; }
input[type="color"] { width: 48px; height: 34px; padding: 3px; border: 1px solid var(--line-strong); border-radius: 9px; background: #fff; cursor: pointer; }
input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 6px; }
input[type="color"]::-moz-color-swatch { border: 0; border-radius: 6px; }
input[type="color"]:disabled { opacity: .35; cursor: default; }
textarea { resize: vertical; line-height: 1.55; }

/* ---------------------------------------------------------------------------
   ヘッダー
   ------------------------------------------------------------------------ */
.public-header {
  position: sticky; top: 0; z-index: 30;
  height: var(--header-h); padding: 0 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  border-bottom: 1px solid var(--line); background: rgb(255 253 248 / 92%); backdrop-filter: blur(10px);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark { width: 40px; height: 40px; flex: none; color: var(--accent); filter: drop-shadow(0 4px 10px rgb(39 90 69 / 22%)); }
.brand-copy { display: grid; gap: 2px; min-width: 0; }
.brand-copy > span { font-size: 10.5px; font-weight: 700; letter-spacing: .18em; color: var(--accent); }
.brand-copy strong { font-size: 15px; font-weight: 700; letter-spacing: .04em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.site-menu { position: relative; }
.site-menu summary {
  --icon: var(--i-info);
  list-style: none; display: inline-flex; align-items: center; gap: 8px;
  min-height: 38px; padding: 6px 12px; border-radius: 10px; font-size: 13px; font-weight: 600; color: var(--ink-2);
}
.site-menu summary::-webkit-details-marker { display: none; }
.site-menu summary:hover, .site-menu[open] summary { background: var(--accent-tint); color: var(--ink); }
.site-menu nav {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 2000;
  display: grid; min-width: 220px; padding: 8px;
  background: var(--paper); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-2);
}
.site-menu nav button { justify-content: flex-start; min-height: 42px; border: 0; background: transparent; font-weight: 500; text-align: left; }
.site-menu nav button:hover { background: var(--accent-tint); }

/* ---------------------------------------------------------------------------
   スタジオ（編集画面）の骨格
   ------------------------------------------------------------------------ */
#label-app { padding: 14px 16px 18px; }
.studio-frame {
  display: flex; flex-direction: column;
  min-height: calc(100dvh - var(--header-h) - 32px);
  border: 1px solid var(--line); border-radius: var(--radius-l); background: var(--paper); overflow: hidden;
  box-shadow: var(--shadow-1);
}

/* 上段：商品・面・デザインと主操作 */
.selection-bar {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px 24px;
  padding: 12px 20px; border-bottom: 1px solid var(--line);
}
.selection-controls, .editor-actions { display: flex; align-items: center; gap: 12px; min-width: 0; }
.selection-controls { flex-wrap: wrap; row-gap: 10px; }
.selection-title { display: grid; gap: 1px; min-width: 0; padding-right: 16px; border-right: 1px solid var(--line); }
.selection-title > span, .selection-controls label > span, .design-picker-trigger .design-picker-eyebrow {
  font-size: 10.5px; font-weight: 700; letter-spacing: .12em; color: var(--muted);
}
#current-product-name { font-size: 16px; font-weight: 700; letter-spacing: .01em; max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.selection-controls label { display: grid; gap: 3px; }
.selection-controls select { max-width: 200px; min-height: 42px; }
.design-picker-trigger {
  display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 6px 14px 6px 10px;
  background: var(--gold-soft); border-color: var(--gold-line); border-radius: 12px; text-align: left;
}
.design-picker-trigger:hover { background: #f1e7cc; border-color: #d3c08c; }
.design-picker-trigger > span:first-child { --icon: var(--i-sparkle); display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: #fff; color: var(--gold); font-size: 0; box-shadow: 0 1px 2px rgb(96 72 22 / 15%); }
.design-picker-trigger > span:first-child::before { width: 18px; height: 18px; }
.design-picker-body { display: grid; gap: 1px; min-width: 0; }
.design-picker-body .design-picker-eyebrow { color: var(--gold); }
#current-design-name { font-size: 14px; font-weight: 700; color: var(--ink); max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.design-picker-trigger > span:last-child { font-size: 11px; font-weight: 600; color: var(--gold); padding-left: 10px; border-left: 1px solid var(--gold-line); }
.font-picker-trigger { background: var(--accent-tint); border-color: #c6d8ca; }
.font-picker-trigger:hover { background: var(--accent-soft); border-color: #a9bfae; }
.font-picker-trigger > span:first-child { color: var(--accent); font-size: 15px; font-weight: 700; letter-spacing: -.02em; }
.font-picker-trigger > span:first-child::before { display: none; }
.font-picker-trigger .design-picker-eyebrow, .font-picker-trigger > span:last-child { color: var(--accent); }
.font-picker-trigger > span:last-child { border-left-color: #c6d8ca; }
#current-font-name { font-size: 15px; font-weight: 700; color: var(--ink); max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.editor-actions button { white-space: nowrap; }
.editor-actions .icon-button { color: var(--ink-2); font-weight: 700; }

/* 中段：ツール列とワークスペース */
.editor-grid { display: grid; grid-template-columns: 86px minmax(0, 1fr); flex: 1; min-height: 0; }
.toolbar { display: flex; flex-direction: column; gap: 10px; padding: 12px 8px; border-right: 1px solid var(--line); background: var(--paper); }
.tool-buttons { display: grid; gap: 4px; }
.toolbar > button, .tool-buttons button, .tool-buttons .file-tool {
  flex-direction: column; gap: 5px; min-height: 60px; padding: 8px 2px;
  border: 1px solid transparent; background: transparent; border-radius: 12px;
  font-size: 10.5px; font-weight: 600; color: var(--ink-2); text-align: center;
}
.toolbar > button:hover, .tool-buttons button:hover, .tool-buttons .file-tool:hover { background: var(--accent-tint); border-color: transparent; color: var(--ink); }
.toolbar > button:disabled, .tool-buttons button:disabled { background: transparent; }
.tool-icon { color: var(--accent); }
.toolbar > button:last-child { margin-top: auto; }
.history-buttons { display: flex; border-top: 1px solid var(--line); padding-top: 10px; }
.history-buttons button { width: 50%; min-height: 40px; padding: 4px; border: 0; background: transparent; border-radius: 10px; color: var(--ink-2); }
.history-buttons button:hover { background: var(--accent-tint); }
.history-buttons button:disabled { background: transparent; }
.file-tool { position: relative; overflow: hidden; }
.file-tool input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.file-tool.is-disabled input { cursor: default; }

.workspace { position: relative; min-width: 0; display: flex; flex-direction: column; background: var(--canvas); }
#design-operation-status { position: absolute; top: 14px; left: 50%; z-index: 5; transform: translateX(-50%); box-shadow: var(--shadow-1); }
.canvas-stage {
  overflow: auto; flex: 1; height: max(440px, calc(100dvh - 300px)); min-height: 300px;
  overscroll-behavior: contain; outline-offset: -4px;
  background-image: radial-gradient(#c6d0c4 .8px, transparent .9px); background-size: 20px 20px;
}
.canvas-shell { display: flex; align-items: center; justify-content: center; width: max-content; min-width: 100%; min-height: 100%; padding: 64px; }
#label-canvas { position: relative; flex: none; background: white; box-shadow: var(--shadow-label); }
.design-element { position: absolute; display: flex; align-items: center; justify-content: center; user-select: none; }
#label-canvas .design-element { cursor: move; touch-action: none; }
.design-element.selected { outline: 1.5px solid var(--accent); outline-offset: 2px; box-shadow: 0 0 0 5px rgb(39 90 69 / 12%); }
#label-canvas .design-element.is-locked { cursor: pointer; }
#label-canvas .design-element.is-locked.selected { outline-style: dashed; }
.design-resize-handle, .design-rotate-handle {
  position: absolute; z-index: 5; display: grid; place-items: center; padding: 0;
  min-height: 0; background: #fff; border: 1.5px solid var(--accent); color: var(--accent);
  box-shadow: 0 1px 3px rgb(20 40 30 / 25%);
}
.design-resize-handle { right: -7px; bottom: -7px; width: 13px; height: 13px; border-radius: 4px; cursor: nwse-resize; }
.design-resize-handle::after { content: ""; position: absolute; inset: -12px; }
.design-rotate-handle { top: -40px; left: calc(50% - 14px); width: 28px; height: 28px; border-radius: 50%; font-size: 16px; cursor: grab; }
.design-rotate-handle::after { content: ""; position: absolute; width: 1.5px; height: 12px; background: var(--accent); top: 26px; pointer-events: none; }
.bleed-guide, .safe-guide { position: absolute; pointer-events: none; }
.bleed-guide { border: 1px dashed var(--trim); }
.safe-guide { border: 1px dashed var(--safe); }

/* 白紙（オリジナル）デザインの案内。要素が1つでも置かれたら消える */
.canvas-empty-state {
  position: absolute; left: 50%; top: 45%; z-index: 4; transform: translate(-50%, -50%);
  width: min(340px, calc(100% - 32px)); padding: 20px 22px 22px; text-align: center;
  background: rgb(255 253 248 / 96%); border: 1px dashed var(--line-strong); border-radius: 16px; box-shadow: var(--shadow-1);
}
.canvas-empty-state p { margin: 0 0 14px; font-size: 13px; line-height: 1.8; color: var(--ink-2); }
.canvas-empty-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }

/* ワークスペース下段：凡例・ヒント・ズーム */
.workspace-footer {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px;
  min-height: 56px; padding: 8px 16px; border-top: 1px solid rgb(31 49 41 / 6%);
}
.guide-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0; padding: 0; list-style: none; font-size: 11px; color: var(--ink-2); }
.guide-legend li { display: inline-flex; align-items: center; gap: 7px; }
.guide-legend li::before { content: ""; width: 22px; height: 0; border-top: 2px dashed var(--trim); }
.guide-legend li:nth-child(2)::before { border-top-color: var(--safe); }
.workspace-footer p { flex: 1; min-width: 160px; margin: 0; font-size: 11px; color: var(--muted); }
.zoom-control { display: flex; align-items: center; gap: 4px; margin-left: auto; padding: 3px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); box-shadow: var(--shadow-1); }
.zoom-control input { width: 96px; margin: 0 4px; accent-color: var(--accent); }
.zoom-control button { min-height: 32px; height: 32px; border: 0; background: transparent; }
.zoom-control button:hover { background: var(--accent-tint); }
.zoom-control .icon-button { width: 34px; }
#zoom-fit { padding: 0 8px; min-width: 52px; font-size: 12px; font-variant-numeric: tabular-nums; }

/* 最下段：寸法と保存状態 */
.studio-status {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 38px; padding: 6px 20px; border-top: 1px solid var(--line);
  color: var(--ink-2); font-size: 12px;
}
#current-design-size { font-variant-numeric: tabular-nums; font-weight: 600; }
#current-design-size:not(:empty) { padding: 2px 9px; border: 1px solid var(--line); border-radius: 7px; background: var(--paper-2); }
.save-state { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.save-state strong { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; }
.save-state strong::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #b8c4bb; box-shadow: 0 0 0 3px rgb(184 196 187 / 30%); }
.save-state strong.error { color: var(--danger); }
.save-state strong.error::before { background: var(--danger); box-shadow: 0 0 0 3px rgb(179 64 58 / 20%); }
#last-saved { color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------------------
   ダイアログ共通
   ------------------------------------------------------------------------ */
.studio-dialog, .public-confirm-dialog {
  width: min(460px, calc(100vw - 32px)); max-height: calc(100dvh - 40px); padding: 22px 24px 24px;
  color: var(--ink); border: 1px solid var(--line); border-radius: 20px; background: var(--paper);
  box-shadow: var(--shadow-2); overflow: auto; overscroll-behavior: contain;
}
.studio-dialog::backdrop, .public-confirm-dialog::backdrop { background: rgb(18 35 27 / 38%); backdrop-filter: blur(3px); }
.dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.dialog-header h2 { font-size: 17px; margin: 0; font-weight: 700; letter-spacing: .01em; }
.dialog-header > button { --icon: var(--i-close); width: 36px; height: 36px; min-height: 0; padding: 0; font-size: 0; border: 0; background: var(--accent-soft); color: var(--ink-2); border-radius: 50%; flex: none; }
.dialog-header > button:hover { background: #d9e6db; color: var(--ink); }
.dialog-note { font-size: 12.5px; line-height: 1.8; color: var(--ink-2); margin: 0 0 16px; }
.dialog-footer, .public-confirm-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.public-confirm-dialog p { line-height: 1.8; }
.loading-status {
  display: flex; align-items: center; justify-content: center; gap: 10px; margin: 0 0 12px; padding: 12px 18px;
  font-size: 13px; font-weight: 600; color: var(--accent); background: var(--accent-soft); border-radius: 12px;
}
.loading-status::before, .design-card[aria-busy="true"] .gallery-status::before {
  content: ""; display: inline-block; width: 16px; height: 16px; flex: none;
  border: 2px solid #c3d4c6; border-top-color: var(--accent); border-radius: 50%; animation: studio-spin .8s linear infinite;
}
.design-card[aria-busy="true"] .gallery-status::before { width: 12px; height: 12px; margin-right: 7px; vertical-align: middle; }
@keyframes studio-spin { to { transform: rotate(360deg); } }

/* パネル型ダイアログ：キャンバスを隠さず、右端（PC）／下端（モバイル）に寄せる */
.panel-dialog { width: min(380px, calc(100vw - 32px)); margin: 0; inset: auto 28px 16px auto; top: calc(var(--header-h) + 104px); max-height: calc(100dvh - var(--header-h) - 132px); padding: 18px 20px 20px; border-radius: 18px; }
.panel-dialog::backdrop { background: rgb(18 35 27 / 6%); backdrop-filter: none; }
.panel-dialog .dialog-header { margin-bottom: 12px; }
.panel-dialog .dialog-header h2 { font-size: 15px; }

/* オブジェクトメニュー */
.object-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.object-actions button { justify-content: flex-start; min-height: 46px; padding: 8px 12px; font-weight: 600; }
.object-actions button:first-child { grid-column: 1 / -1; background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.object-actions button:first-child:hover { background: #d9e6db; }
.object-actions button::before { color: var(--accent); opacity: .9; }
.object-actions button.danger::before { color: var(--danger); }
[data-object-action="properties"] { --icon: var(--i-edit); }
[data-object-action="appearance"] { --icon: var(--i-palette); }
[data-object-action="geometry"] { --icon: var(--i-geometry); }
[data-object-action="fill"] { --icon: var(--i-fill); }
[data-object-action="rotate"] { --icon: var(--i-rotate); }
[data-object-action="forward"] { --icon: var(--i-forward); }
[data-object-action="backward"] { --icon: var(--i-backward); }
[data-object-action="duplicate"] { --icon: var(--i-duplicate); }
[data-object-action="lock"] { --icon: var(--i-lock); }
[data-object-action="remove"] { --icon: var(--i-trash); }

/* プロパティ */
#property-form { display: grid; gap: 10px; }
#property-form > p { margin: 0; font-size: 13px; color: var(--muted); }
.property-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 0; font-size: 12.5px; font-weight: 600; line-height: 1.4; color: var(--ink-2); }
/* 汎用 input 規則（幅100%）より特異性を上げて、欄の幅を固定しラベルの折返しを防ぐ */
#property-form .property-row input:not([type="checkbox"]):not([type="color"]), #property-form .property-row select, #property-form .property-row textarea { flex: 0 0 58%; width: 58%; font-weight: 500; color: var(--ink); }
.property-row input[type="checkbox"] + input[type="color"] { margin-left: 4px; }
.property-row textarea { min-height: 84px; }
.font-picker-selection { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper-2); }
.font-picker-selection strong { font-size: 14px; }
.font-picker-selection small { color: var(--muted); font-size: 11.5px; }
.font-picker-selection button { grid-column: 2; grid-row: 1 / span 2; min-height: 36px; padding: 6px 12px; font-size: 12px; }
.font-glyph-warning { margin: 0; padding: 10px 12px; font-size: 12.5px; line-height: 1.6; background: var(--warn-bg); color: var(--warn-ink); border-radius: 10px; overflow-wrap: anywhere; }

/* レイヤー */
#layer-list { display: grid; gap: 6px; }
#layer-list > p { margin: 0; padding: 14px; text-align: center; font-size: 12.5px; color: var(--muted); border: 1px dashed var(--line-strong); border-radius: 12px; }
.layer-row { display: flex; align-items: center; gap: 2px; padding: 4px 6px 4px 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); }
.layer-row.is-selected { background: var(--accent-soft); border-color: #9fbca7; }
.layer-row button { min-height: 38px; border: 0; padding: 6px 10px; background: transparent; border-radius: 9px; font-weight: 500; }
.layer-row button:hover { background: rgb(39 90 69 / 8%); }
.layer-row button:disabled { background: transparent; }
.layer-row .layer-name { flex: 1; min-width: 0; justify-content: flex-start; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; font-weight: 600; }
.layer-row .layer-name[aria-pressed="true"] { color: var(--accent); }
.layer-row [data-layer-action]:not(.layer-name) { width: 38px; padding: 0; font-size: 0; color: var(--ink-2); }
.layer-row [data-layer-action="forward"] { --icon: var(--i-arrow-up); }
.layer-row [data-layer-action="backward"] { --icon: var(--i-arrow-down); }
.layer-row [data-layer-action="lock"] { --icon: var(--i-unlock); opacity: .55; }
.layer-row [data-layer-action="lock"][aria-pressed="true"] { --icon: var(--i-lock); opacity: 1; color: var(--accent); }

/* 素材パレット */
#asset-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.asset-button { min-height: 118px; flex-direction: column; gap: 10px; padding: 14px 10px; font-weight: 600; }
.asset-button svg { width: 56px; height: 56px; }
.shape-sample { display: block; width: 64px; height: 50px; margin: 6px auto 0; background: #dcead8; border: 2px solid var(--accent); }
.shape-sample-rounded_rectangle { border-radius: 10px; }
.shape-sample-circle { width: 50px; border-radius: 50%; }
.shape-sample-line { border: 0; background: linear-gradient(var(--accent), var(--accent)) center / 100% 3px no-repeat; }
.stamp-sample { position: relative; width: 56px; height: 56px; border: 2px solid currentColor; border-radius: 50%; color: var(--accent); }
.stamp-sample::after { content: ""; position: absolute; inset: 5px; border: 1px solid currentColor; border-radius: 50%; }

/* デザインギャラリー */
.designs-dialog { width: min(920px, calc(100vw - 32px)); }
.design-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.design-card { position: relative; flex-direction: column; align-items: stretch; gap: 10px; padding: 10px 10px 14px; text-align: left; border-radius: 16px; transition: border-color .15s, transform .15s, box-shadow .15s; }
.design-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-1); }
.design-card[aria-pressed="true"] { border: 2px solid var(--accent); background: var(--accent-tint); }
.design-card-stage { display: grid; place-items: center; height: 220px; border-radius: 12px; background: #efe6d8; }
.design-card:nth-child(3n + 2) .design-card-stage { background: #e3ebde; }
.design-card:nth-child(3n) .design-card-stage { background: #e9e2ee; }
.design-card-label { display: block; overflow: hidden; background: white; box-shadow: 0 10px 24px rgb(36 61 52 / 18%); visibility: hidden; }
.design-card.is-ready .design-card-label { visibility: visible; }
.design-card > strong { padding: 0 4px; font-size: 14px; }
.gallery-status { display: inline-flex; align-items: center; gap: 6px; padding: 0 4px; font-size: 11.5px; font-weight: 600; color: var(--accent); }
.design-card[aria-pressed="true"] .gallery-status { --icon: var(--i-check); }
.design-card[aria-pressed="true"] .gallery-status::before { width: 14px; height: 14px; }
.design-card .gallery-status.error { color: var(--danger); }
.design-card[data-blank="true"] .design-card-stage { background: repeating-linear-gradient(135deg, #f3f1ea 0 10px, #ebe8df 10px 20px); }
.design-card[data-blank="true"] .design-card-label { position: relative; border: 1.5px dashed var(--line-strong); box-shadow: none; }
.design-card[data-blank="true"] .design-card-label::after { content: ""; position: absolute; inset: 0; margin: auto; width: 40%; aspect-ratio: 1; background: var(--accent); opacity: .55; -webkit-mask: var(--i-import) center / contain no-repeat; mask: var(--i-import) center / contain no-repeat; }

/* 容器プレビュー */
.preview-dialog { width: min(720px, calc(100vw - 32px)); }
#container-tabs { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
#container-tabs button { min-height: 36px; padding: 6px 14px; border-radius: 999px; font-size: 12.5px; }
#container-tabs button.is-active { background: var(--accent); border-color: var(--accent); color: #fff; }
#container-tabs button:only-child { pointer-events: none; background: transparent; border-color: transparent; color: var(--ink-2); }
#mockup-stage { display: flex; justify-content: center; border-radius: 16px; background: radial-gradient(120% 90% at 50% 100%, #e6ebe2, #f2f4ee 70%); padding: 20px; overflow: hidden; }
.mockup-card { max-width: 100%; }
.mockup-card > img { max-width: 100%; max-height: 60dvh; width: auto; height: auto; }
.preview-dialog .dialog-note { margin: 14px 0 0; text-align: center; font-size: 11.5px; }

/* 問い合わせ・発注依頼 */
.inquiry-dialog { width: min(640px, calc(100vw - 32px)); }
.inquiry-section form, .order-request { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.inquiry-section label { display: grid; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.inquiry-section input:not([type="checkbox"]), .inquiry-section select, .inquiry-section textarea { font-weight: 400; color: var(--ink); }
.inquiry-section textarea { min-height: 96px; }
.wide, #inquiry-result, #inquiry-turnstile { grid-column: 1 / -1; }
.inquiry-section .consent { display: flex; align-items: center; gap: 10px; font-weight: 500; }
.order-request { margin: 0; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper-2); }
.order-request legend { float: left; width: 100%; grid-column: 1 / -1; margin: 0 0 -4px; padding: 0; font-size: 13.5px; font-weight: 700; color: var(--accent); }
.order-request-note { grid-column: 1 / -1; margin: 0; font-size: 12px; font-weight: 400; line-height: 1.7; color: var(--ink-2); }
#inquiry-form button[type="submit"] { grid-column: 1 / -1; min-height: 46px; font-size: 14px; }
#inquiry-result { line-height: 1.7; font-size: 13px; overflow-wrap: anywhere; }
#inquiry-result:empty { display: none; }
#inquiry-result.success { padding: 12px 14px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); font-weight: 600; }
#inquiry-result.error { padding: 12px 14px; border-radius: 12px; background: var(--danger-soft); }
#inquiry-stopped { margin: 0; }

/* ファイル */
.file-actions { display: grid; gap: 10px; }
.file-actions button, .file-actions .file-tool { justify-content: flex-start; min-height: 46px; text-align: left; }
#export-design { --icon: var(--i-export); }
.file-actions .file-tool { --icon: var(--i-import); }
#delete-draft { --icon: var(--i-trash); }
.file-actions .danger::before { color: var(--danger); }

/* 使い方 */
#help-dialog > p { font-size: 13px; line-height: 1.9; color: var(--ink-2); }
.shortcut-list { display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; margin: 0; font-size: 12.5px; line-height: 1.6; align-items: center; }
.shortcut-list dt { font-family: var(--font-mono); font-size: 11.5px; padding: 3px 9px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 7px; background: var(--paper-2); white-space: nowrap; justify-self: start; }
.shortcut-list dd { margin: 0; }

/* フォントピッカー */
.font-picker-dialog { width: min(920px, calc(100vw - 32px)); }
.font-picker-controls { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; margin: 0 0 16px; }
.font-picker-controls label { display: grid; gap: 5px; font-size: 12px; font-weight: 600; color: var(--ink-2); }
.font-picker-controls label:first-child { position: relative; flex: 1 1 220px; }
.font-picker-controls label:first-child::before { --icon: var(--i-search); position: absolute; left: 12px; bottom: 11px; color: var(--muted); }
.font-picker-controls label:first-child input { padding-left: 38px; }
.font-picker-controls .font-picker-text-filter { display: flex; align-items: center; gap: 8px; min-height: 40px; font-weight: 500; }
.font-picker-live-toggle { flex-basis: 100%; padding: 8px 12px; border-radius: 10px; background: var(--accent-tint); color: var(--accent); font-weight: 600; }
.font-picker-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; max-height: 62vh; overflow-y: auto; padding: 2px; }
.font-picker-list > p { grid-column: 1 / -1; margin: 0; padding: 20px; text-align: center; color: var(--muted); }
.font-picker-card { display: grid; gap: 8px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); }
.font-picker-card[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.font-picker-card h3 { font-size: 13px; margin: 0; color: var(--ink-2); }
.font-picker-card img { width: 100%; height: 64px; object-fit: contain; }
/* 見本は font binary が届くまで PNG、届いたら入力中の文字を実フォントで描く */
.font-picker-sample { display: none; width: 100%; min-height: 72px; padding: 10px 12px; justify-content: flex-start; font-size: 26px; font-weight: inherit; line-height: 1.3; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-radius: 12px; background: #fff; color: var(--ink); }
.font-picker-sample:hover { background: var(--accent-tint); }
.font-picker-card.is-font-ready .font-picker-sample { display: flex; }
.font-picker-card.is-font-ready > img { display: none; }
.font-picker-card p { margin: 0; color: var(--muted); font-size: 11.5px; line-height: 1.6; }
.font-picker-variants { display: flex; flex-wrap: wrap; gap: 6px; }
.font-picker-variants button { min-height: 34px; padding: 5px 11px; font-size: 12px; border-radius: 999px; }
.font-picker-variants button[aria-pressed="true"] { background: var(--accent); color: #fff; border-color: var(--accent); }

/* 使用条件・プライバシー・ライセンス */
.legal-dialog { width: min(640px, calc(100vw - 32px)); padding-top: 0; }
.legal-dialog .dialog-header { position: sticky; top: 0; z-index: 1; margin: 0 -24px 14px; padding: 20px 24px 12px; background: var(--paper); border-bottom: 1px solid var(--line); }
.legal-dialog h2:focus-visible { outline: none; box-shadow: none; }
.legal-intro { font-size: 13px; line-height: 1.9; color: var(--ink-2); }
.legal-copy { font-size: 12.5px; line-height: 1.95; overflow-wrap: anywhere; }
.legal-copy h3 { font-size: 13.5px; font-weight: 700; margin: 22px 0 6px; color: var(--accent); }
.legal-copy p { white-space: pre-line; margin-bottom: 14px; }
.legal-copy article { padding-bottom: 12px; border-bottom: 1px solid var(--line); }
#consent-form { margin-top: 8px; padding-top: 16px; border-top: 1px solid var(--line); }
.consent-check { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; font-size: 13px; line-height: 1.7; border-radius: 12px; background: var(--accent-tint); }
.consent-check input { margin-top: 3px; }
#consent-error { display: block; font-size: 12px; margin-top: 10px; }
#consent-error:empty { display: none; }
.legal-page, .maintenance { max-width: 720px; margin: 64px auto; padding: 32px 28px; line-height: 1.9; text-align: center; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-l); }
.maintenance h1 { font-size: 22px; font-weight: 700; }
.maintenance p { color: var(--ink-2); }
#studio-startup { display: grid; gap: 12px; justify-items: center; }
#studio-startup-message[role="status"]:not(.error)::before { content: ""; display: inline-block; width: 16px; height: 16px; margin-right: 10px; vertical-align: -3px; border: 2px solid #c3d4c6; border-top-color: var(--accent); border-radius: 50%; animation: studio-spin .8s linear infinite; }
.error { color: var(--danger); }
.success { color: var(--accent); }

/* ---------------------------------------------------------------------------
   はじめる画面（容器・商品の選択）
   ------------------------------------------------------------------------ */
.target-picker { max-width: 1080px; margin: 0 auto; padding: 56px 28px 80px; }
.picker-progress { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: .04em; }
.picker-progress > span { display: inline-flex; align-items: center; gap: 8px; }
.picker-progress > span[aria-hidden] { width: 36px; height: 1px; background: var(--line-strong); font-size: 0; }
.picker-progress .current { color: var(--accent); }
.picker-back { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 22px; font-size: 13px; font-weight: 600; text-decoration: none; }
.picker-back:hover { text-decoration: underline; }
.target-picker h1 { font-size: clamp(24px, 3.2vw, 36px); font-weight: 700; letter-spacing: .02em; line-height: 1.35; margin-bottom: 10px; }
.target-picker > p { font-size: 14px; color: var(--ink-2); line-height: 1.9; margin-bottom: 32px; }
.target-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 20px; }
.target-card {
  display: flex; flex-direction: column; text-decoration: none; overflow: hidden;
  border: 1px solid var(--line); border-radius: 20px; background: var(--paper); color: var(--ink);
  box-shadow: var(--shadow-1); transition: border-color .15s, transform .15s, box-shadow .15s;
}
.target-card:hover { transform: translateY(-4px); border-color: #8fb39a; box-shadow: 0 18px 40px rgb(20 40 30 / 12%); }
.target-card img { width: 100%; height: 230px; object-fit: contain; padding: 22px; background: radial-gradient(100% 80% at 50% 100%, #e7ece3, #f3f5ef 70%); }
.target-card strong { padding: 18px 20px 0; font-size: 16px; font-weight: 700; }
.target-card p { padding: 0 20px; margin: 8px 0 0; font-size: 12.5px; line-height: 1.8; color: var(--ink-2); }
.target-card span { display: inline-flex; align-items: center; gap: 6px; margin: 18px 20px 20px; padding-top: 14px; font-size: 13px; font-weight: 700; color: var(--accent); border-top: 1px solid var(--line); }
.target-card:hover span { gap: 10px; }

/* ---------------------------------------------------------------------------
   レスポンシブ
   ------------------------------------------------------------------------ */
@media (max-width: 1100px) {
  .panel-dialog { width: min(560px, 100vw); inset: auto 0 0 0; top: auto; max-height: min(72dvh, 620px); margin: 0 auto; border-radius: 20px 20px 0 0; padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
  .panel-dialog::backdrop { background: rgb(18 35 27 / 22%); }
}
@media (max-width: 900px) {
  :root { --header-h: 62px; }
  .public-header { padding: 0 16px; }
  #label-app { padding: 10px 10px 12px; }
  .selection-bar { padding: 12px 14px; gap: 10px 16px; }
  .selection-controls { gap: 10px; }
  .selection-controls select { max-width: 150px; }
  #current-product-name { max-width: 220px; }
  .editor-actions { gap: 8px; }
  .editor-actions button { padding: 8px 12px; font-size: 12px; }
  .workspace-footer p { display: none; }
}
@media (max-width: 620px) {
  .public-header { padding: 0 12px; }
  .brand { gap: 8px; }
  .brand-mark { width: 34px; height: 34px; }
  .brand-copy strong { font-size: 12.5px; letter-spacing: .015em; }
  .brand-copy > span { font-size: 9.5px; }
  .site-menu summary { width: 40px; padding: 0; justify-content: center; font-size: 0; }
  .site-menu summary::before { width: 22px; height: 22px; }
  #label-app { padding: 0; }
  .studio-frame { min-height: calc(100dvh - var(--header-h)); border-radius: 0; border-left: 0; border-right: 0; box-shadow: none; }
  .selection-bar { padding: 10px 12px 12px; gap: 10px; }
  .selection-controls { width: 100%; gap: 8px; }
  .selection-title { flex: 1 1 140px; padding: 0; border-right: 0; }
  #current-product-name { max-width: none; white-space: normal; font-size: 15px; }
  .selection-controls label { flex: 0 0 auto; margin-left: auto; }
  .selection-controls select { max-width: none; }
  .design-picker-trigger { flex: 1 1 calc(50% - 4px); min-height: 46px; padding: 6px 10px; }
  .design-picker-trigger > span:first-child { width: 26px; height: 26px; }
  #current-design-name, #current-font-name { max-width: 110px; font-size: 13px; }
  .design-picker-trigger > span:last-child { display: none; }
  .editor-actions { width: 100%; }
  .editor-actions button:not(.icon-button) { flex: 1 1 0; padding: 8px 10px; }
  .editor-actions .icon-button { width: 44px; }
  .editor-actions #open-inquiry { flex: 2 1 0; }
  .editor-grid { display: flex; flex-direction: column-reverse; }
  .toolbar { flex-direction: row; align-items: center; gap: 2px; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
  .toolbar::-webkit-scrollbar { display: none; }
  .tool-buttons { display: flex; gap: 2px; }
  .tool-buttons button, .tool-buttons .file-tool, .toolbar > button { flex: none; min-width: 54px; min-height: 56px; gap: 4px; padding: 6px 2px; font-size: 10px; }
  .toolbar > button:last-child { margin: 0; }
  .history-buttons { padding: 0; border: 0; margin-left: auto; }
  .history-buttons button { width: 40px; min-height: 48px; }
  .canvas-stage { height: max(340px, calc(100dvh - 380px)); }
  .canvas-shell { padding: 36px; }
  .workspace-footer { min-height: 48px; padding: 6px 10px; gap: 6px 12px; }
  .guide-legend { font-size: 10.5px; gap: 4px 12px; }
  .zoom-control { margin-left: auto; }
  .zoom-control input { width: 70px; }
  .studio-status { padding: 6px 12px; font-size: 11px; }
  #last-saved { display: none; }
  .studio-dialog { padding: 18px; }
  .panel-dialog { padding: 16px 16px calc(18px + env(safe-area-inset-bottom)); }
  .object-actions { gap: 6px; }
  .object-actions button { min-height: 44px; font-size: 12.5px; }
  #property-form .property-row input:not([type="checkbox"]):not([type="color"]), #property-form .property-row select, #property-form .property-row textarea { flex-basis: 56%; width: 56%; }
  .design-gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .design-card-stage { height: 170px; }
  .inquiry-section form, .order-request { grid-template-columns: 1fr; }
  .shortcut-list { font-size: 11.5px; gap: 8px 12px; }
  .target-picker { padding: 32px 18px 56px; }
  .picker-progress { margin-bottom: 20px; }
  .target-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .target-card { border-radius: 16px; }
  .target-card img { height: 150px; padding: 14px; }
  .target-card strong { padding: 12px 14px 0; font-size: 13.5px; }
  .target-card p { padding: 0 14px; font-size: 11.5px; }
  .target-card span { margin: 12px 14px 14px; padding-top: 10px; font-size: 12px; }
  .legal-dialog .dialog-header { margin: 0 -18px 12px; padding: 16px 18px 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .loading-status::before, .design-card[aria-busy="true"] .gallery-status::before, #studio-startup-message[role="status"]:not(.error)::before { border-top-color: #c3d4c6; }
}
