/* ============================================================
   PIECE OF SIGN — Design Maker (Pattern B / external PNG app)
   Direction: Quiet Luxury — small radii, deep-green accent, paper warmth,
   step numbering and roomier card rhythm. Prefix: .pos-dm__
   ============================================================ */

/* ============================================================
   看板デザイン用フォント（UIのフォントとは別系統）
   font-weight を範囲指定しているのは、単一ウェイトのフォントに対して
   ブラウザが擬似ボールドを合成するのを防ぐため（印刷品質・書き出し一致のため）。
   ============================================================ */

@font-face {
  font-family: "POS Gotham";
  src: url("./assets/fonts/pos-gotham.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "POS Georgia";
  src: url("./assets/fonts/pos-georgia.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "POS Avenir";
  src: url("./assets/fonts/pos-avenir.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "POS Clarendon";
  src: url("./assets/fonts/pos-clarendon.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Layout palette (Quiet Luxury) */
  --pos-color-body: #f7f5ef;
  --pos-color-body-dim: #fbfaf5;
  --pos-color-paper: #ffffff;
  --pos-color-text: #1d211e;
  --pos-color-text-soft: rgba(29, 33, 30, 0.66);
  --pos-color-muted: rgba(29, 33, 30, 0.48);
  --pos-color-border: #e2ddd1;
  --pos-color-border-soft: #ece7da;
  --pos-color-btn: #1d211e;
  --pos-color-btn-text: #ffffff;
  --pos-color-stage: #efece3;
  --pos-color-stage-line: rgba(255, 255, 255, 0.55);
  --pos-color-frame: #1f211f;
  --pos-color-accent: #365344;
  --pos-color-accent-strong: #2a4337;
  --pos-color-accent-soft: rgba(54, 83, 68, 0.08);

  /* Type */
  --pos-font-base: "Instrument Sans", "Inter", "Helvetica Neue", Arial,
    "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", sans-serif;
  --pos-font-display: "Inter", "Helvetica Neue", Arial,
    "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", sans-serif;
  --pos-font-mincho: Georgia, "Times New Roman", "Yu Mincho",
    "Hiragino Mincho ProN", serif;
  --pos-font-slab: Rockwell, "Courier New", Georgia, serif;

  --pos-base-size: 14px;
  --pos-base-line: 1.6;
  --pos-base-spacing: 0.025em;
  --pos-eyebrow-spacing: 0.26em;
  --pos-btn-spacing: 0.16em;

  /* Radii & shadow */
  --pos-radius-card: 8px;
  --pos-radius-input: 4px;
  --pos-radius-chip: 999px;
  --pos-field-label-height: 22px;
  --pos-field-control-height: 49px;
  --pos-shadow-card: 0 1px 0 rgba(20, 24, 22, 0.025), 0 12px 28px -22px rgba(20, 24, 22, 0.18);
}

* { box-sizing: border-box; }
html, body { margin: 0; }

body {
  color: var(--pos-color-text);
  background: var(--pos-color-body);
  font-family: var(--pos-font-base);
  font-size: var(--pos-base-size);
  line-height: var(--pos-base-line);
  letter-spacing: var(--pos-base-spacing);
  -webkit-font-smoothing: antialiased;
}

body.is-preview-modal-open { overflow: hidden; }

button, input, select, textarea {
  font: inherit;
  letter-spacing: inherit;
  color: inherit;
}

button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

/* ============================================================
   Header
   ============================================================ */

.pos-dm__header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(247, 245, 239, 0.92);
  border-bottom: 1px solid var(--pos-color-border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.pos-dm__header-inner {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 24px;
  max-width: 1320px;
  margin: 0 auto;
  padding: 20px 32px;
}

.pos-dm__brand {
  display: inline-flex;
  align-items: center;
  font-family: var(--pos-font-display);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--pos-color-text);
}

.pos-dm__product {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.pos-dm__product-eyebrow {
  font-size: 0.72em;
  font-weight: 700;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--pos-color-muted);
}

.pos-dm__product-title {
  font-family: var(--pos-font-display);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.005em;
  color: var(--pos-color-text);
  text-transform: none;
}

.pos-dm__return {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 18px;
  border: 1px solid var(--pos-color-border);
  border-radius: var(--pos-radius-input);
  background: var(--pos-color-paper);
  color: var(--pos-color-text);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.pos-dm__return:hover,
.pos-dm__return:focus-visible {
  border-color: var(--pos-color-text);
  background: var(--pos-color-body-dim);
  outline: none;
}

.pos-dm__return::before {
  content: "";
  width: 14px;
  height: 1px;
  background: currentColor;
}

/* ============================================================
   Shell + workspace
   ============================================================ */

.pos-dm__shell {
  max-width: 1320px;
  margin: 0 auto;
  padding: 40px 32px 96px;
}

.pos-dm__workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(400px, 460px);
  gap: 32px;
  align-items: start;
}

.pos-dm__control {
  display: grid;
  gap: 22px;
  min-width: 0;
}

.pos-dm__phase {
  display: grid;
  gap: 22px;
}

.pos-dm__phase[hidden] { display: none; }

/* ============================================================
   Card
   ============================================================ */

.pos-dm__card {
  border: 1px solid var(--pos-color-border);
  border-radius: var(--pos-radius-card);
  background: var(--pos-color-paper);
  box-shadow: var(--pos-shadow-card);
}

.pos-dm__card--padded { padding: 28px 30px; }

.pos-dm__card--export {
  background: linear-gradient(180deg, var(--pos-color-paper), var(--pos-color-body-dim));
}

.pos-dm__card-head {
  display: grid;
  gap: 8px;
  margin-bottom: 22px;
}

.pos-dm__eyebrow {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: var(--pos-eyebrow-spacing);
  text-transform: uppercase;
  color: var(--pos-color-muted);
  line-height: 1.3;
}

.pos-dm__eyebrow .step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 22px;
  padding: 0 7px;
  border-radius: var(--pos-radius-chip);
  background: var(--pos-color-accent-soft);
  color: var(--pos-color-accent);
  font-size: 11px;
  letter-spacing: 0.08em;
}

.pos-dm__card-head h2,
.pos-dm__card-head h3 {
  margin: 0;
  font-family: var(--pos-font-display);
  font-weight: 700;
  letter-spacing: -0.005em;
  color: var(--pos-color-text);
}

.pos-dm__card-head h2 {
  font-size: 21px;
  line-height: 1.32;
}

.pos-dm__card-head h3 {
  font-size: 15px;
  line-height: 1.5;
}

.pos-dm__card-head p {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--pos-color-text-soft);
  max-width: 56ch;
}

/* ============================================================
   Tabs (template filters)
   ============================================================ */

.pos-dm__tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 18px;
}

.pos-dm__tabs button {
  appearance: none;
  border: 1px solid var(--pos-color-border);
  border-radius: var(--pos-radius-chip);
  background: var(--pos-color-paper);
  color: var(--pos-color-text);
  padding: 9px 16px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.pos-dm__tabs button:hover,
.pos-dm__tabs button:focus-visible {
  border-color: var(--pos-color-text);
  outline: none;
}

.pos-dm__tabs button.is-active {
  border-color: var(--pos-color-text);
  background: var(--pos-color-text);
  color: #fff;
}

/* ============================================================
   Template grid
   ============================================================ */

.pos-dm__template-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.pos-dm__template-card {
  appearance: none;
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--pos-color-border);
  border-radius: var(--pos-radius-input);
  background: var(--pos-color-paper);
  color: var(--pos-color-text);
  text-align: left;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.pos-dm__template-card:hover,
.pos-dm__template-card:focus-visible {
  border-color: var(--pos-color-text);
  box-shadow: 0 6px 18px -12px rgba(20, 24, 22, 0.3);
  transform: translateY(-1px);
  outline: none;
}

.pos-dm__template-card.is-active {
  border-color: var(--pos-color-accent);
  box-shadow: 0 0 0 1px var(--pos-color-accent), 0 8px 22px -14px rgba(54, 83, 68, 0.35);
}

.pos-dm__template-thumb {
  display: grid;
  place-items: center;
  min-height: 200px;
  padding: 18px;
  border-radius: 3px;
  background:
    radial-gradient(circle at 1px 1px, rgba(29, 33, 30, 0.07) 1px, transparent 1px),
    var(--pos-color-body-dim);
  background-size: 12px 12px;
  overflow: hidden;
}

.pos-dm__template-text {
  display: grid;
  gap: 4px;
}

.pos-dm__template-text strong {
  font-family: var(--pos-font-display);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: -0.002em;
}

.pos-dm__template-text span {
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--pos-color-text-soft);
}

/* ============================================================
   Form fields
   ============================================================ */

.pos-dm__field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.pos-dm__field {
  display: grid;
  align-content: start;
  gap: 8px;
  min-width: 0;
}

.pos-dm__field[hidden],
.pos-dm__field.is-hidden,
.pos-dm__choice-group[hidden],
.pos-dm__choice-group.is-hidden {
  display: none !important;
}

.pos-dm__field > span,
.pos-dm__field-label,
.pos-dm__choice-group legend {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--pos-color-text);
}

.pos-dm__field > span,
.pos-dm__field-label {
  display: flex;
  align-items: center;
  height: var(--pos-field-label-height);
}

.pos-dm__field > span em,
.pos-dm__field-label em {
  font-style: normal;
  font-size: 10px;
  letter-spacing: 0.16em;
  color: var(--pos-color-muted);
  text-transform: uppercase;
}

.pos-dm__field input[type="text"],
.pos-dm__field input[type="file"],
.pos-dm__field textarea {
  width: 100%;
  min-height: var(--pos-field-control-height);
  padding: 10px 14px;
  border: 1px solid var(--pos-color-border);
  border-radius: var(--pos-radius-input);
  background: var(--pos-color-paper);
  color: var(--pos-color-text);
  font-size: 13.5px;
  line-height: 1.45;
  letter-spacing: 0;
  text-transform: none;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 0.16s ease, outline 0.16s ease;
}

/* 入力例（placeholder）は入力済みテキストとはっきり差がつく薄さにする */
.pos-dm__field input[type="text"]::placeholder,
.pos-dm__field textarea::placeholder {
  color: rgba(29, 33, 30, 0.3);
  opacity: 1; /* Firefox は既定で opacity を落とすため明示 */
}

.pos-dm__field input[type="file"] {
  height: var(--pos-field-control-height);
  padding: 9px 12px;
  font-size: 12.5px;
}

.pos-dm__field input[type="text"],
.pos-dm__field input[type="file"] {
  height: var(--pos-field-control-height);
}

.pos-dm__logo-upload-box {
  position: relative;
  min-width: 0;
  height: var(--pos-field-control-height);
}

.pos-dm__logo-upload-state {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  min-width: 0;
  height: var(--pos-field-control-height);
  padding: 10px 48px 10px 14px;
  border: 1px solid var(--pos-color-border);
  border-radius: var(--pos-radius-input);
  background: var(--pos-color-paper);
  color: var(--pos-color-text);
  font-size: 13px;
  line-height: 1.45;
  letter-spacing: 0;
  cursor: pointer;
}

.pos-dm__logo-upload-state[hidden] {
  display: none;
}

.pos-dm__logo-upload-state > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pos-dm__logo-remove {
  position: absolute;
  top: 50%;
  right: 8px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--pos-color-border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--pos-color-text-soft);
  font-size: 18px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transform: translateY(-50%);
  transition: border-color 0.16s ease, color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.pos-dm__logo-remove[hidden] {
  display: none;
}

.pos-dm__logo-remove:hover,
.pos-dm__logo-remove:focus-visible {
  border-color: var(--pos-color-accent);
  background: var(--pos-color-paper);
  color: var(--pos-color-text);
  box-shadow: 0 0 0 3px var(--pos-color-accent-soft);
  outline: 0;
}

.pos-dm__logo-quality {
  display: block;
  margin-top: 2px;
  font-size: 11.5px;
  line-height: 1.55;
  letter-spacing: 0;
  color: var(--pos-color-text-soft);
  overflow-wrap: anywhere;
}

.pos-dm__logo-quality.is-good { color: #2a6a4d; }
.pos-dm__logo-quality.is-warn { color: #8a5b15; }
.pos-dm__logo-quality.is-bad  { color: #8b2f2f; }

.pos-dm__field textarea {
  min-height: 84px;
  resize: vertical;
}

.pos-dm__field input:focus,
.pos-dm__field textarea:focus {
  border-color: var(--pos-color-accent);
  outline: 3px solid var(--pos-color-accent-soft);
}

.pos-dm__field--menu {
  grid-column: 1 / -1;
}

.pos-dm__menu-editor {
  display: grid;
  gap: 8px;
}

.pos-dm__menu-editor-head,
.pos-dm__menu-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(96px, 0.34fr);
  gap: 8px;
}

.pos-dm__menu-editor-head {
  padding: 0 2px;
  color: var(--pos-color-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.pos-dm__menu-row input[type="text"] {
  min-width: 0;
}

/* ============================================================
   Choice groups (font / ink radio chips)
   ============================================================ */

.pos-dm__choice-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.pos-dm__choice-row > .pos-dm__choice-group {
  grid-column: 1 / -1;
}

.pos-dm__choice-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 16px;
  border: 1px solid var(--pos-color-border);
  border-radius: var(--pos-radius-input);
  background: var(--pos-color-paper);
}

.pos-dm__choice-group legend {
  width: 100%;
  margin-bottom: 10px;
  padding: 0;
}

.pos-dm__choice-group label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 6px 14px;
  border: 1px solid var(--pos-color-border);
  border-radius: var(--pos-radius-chip);
  background: var(--pos-color-paper);
  color: var(--pos-color-text);
  font-size: 12.5px;
  line-height: 1.2;
  letter-spacing: 0.04em;
  transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.pos-dm__choice-group input {
  width: 11px;
  height: 11px;
  margin: 0;
  accent-color: var(--pos-color-btn);
}

.pos-dm__choice-group label:has(input:checked) {
  border-color: var(--pos-color-btn);
  background: var(--pos-color-btn);
  color: var(--pos-color-btn-text);
}

.pos-dm__choice-group--qr-icon {
  grid-column: 1 / -1;
  padding: 14px;
}

.pos-dm__qr-icon-option {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  color: currentColor;
}

.pos-dm__qr-icon-option--web {
  background: linear-gradient(currentColor, currentColor) center / 17px 1.5px no-repeat;
}

.pos-dm__qr-icon-option--web::before {
  content: "";
  width: 16px;
  height: 16px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
}

.pos-dm__qr-icon-option--web::after {
  content: "";
  position: absolute;
  width: 7px;
  height: 15px;
  border-left: 1.5px solid currentColor;
  border-right: 1.5px solid currentColor;
  border-radius: 50%;
}

.pos-dm__qr-icon-option--instagram::before {
  content: "";
  width: 15px;
  height: 15px;
  border: 1.5px solid currentColor;
  border-radius: 4px;
}

.pos-dm__qr-icon-option--instagram::after {
  content: "";
  position: absolute;
  width: 5px;
  height: 5px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  box-shadow: 4.5px -4.5px 0 -2.5px currentColor;
}

.pos-dm__qr-icon-option--line {
  width: auto;
  min-width: 22px;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1;
}

.pos-dm__qr-icon-option--line::before {
  content: "";
  position: absolute;
  inset: 1px 0 2px;
  border: 1.5px solid currentColor;
  border-radius: 8px;
}

.pos-dm__swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 1px solid var(--pos-color-border);
}

.pos-dm__swatch--ivory { background: #f3eee5; }
.pos-dm__swatch--black { background: #151515; }
.pos-dm__swatch--wood  { background: #b99267; }
.pos-dm__swatch--sage  { background: #9aa28d; }
.pos-dm__swatch--ink-black { background: #000; }
.pos-dm__swatch--ink-white { background: #fff; }

.pos-dm__choice-group label:has(input:checked) .pos-dm__swatch--ink-black {
  border-color: #fff;
}

/* ============================================================
   Actions / buttons
   ============================================================ */

.pos-dm__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 12px;
}

.pos-dm__card--export .pos-dm__actions {
  margin-top: 22px;
  justify-content: flex-start;
}

.pos-dm__export-status {
  margin: 14px 0 0;
  font-size: 12px;
  line-height: 1.7;
  color: var(--pos-color-muted);
}

.pos-dm__export-status[data-status="success"] {
  color: #2f6b47;
}

.pos-dm__export-status[data-status="error"] {
  color: #9b3f3f;
}

.pos-dm__actions--split {
  justify-content: space-between;
}

.pos-dm__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  min-width: 184px;
  padding: 0 28px;
  border: 1px solid var(--pos-color-btn);
  border-radius: var(--pos-radius-input);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: var(--pos-btn-spacing);
  text-transform: uppercase;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.12s ease;
}

.pos-dm__btn:disabled {
  cursor: progress;
  opacity: 0.62;
}

.pos-dm__btn--primary {
  background: var(--pos-color-accent);
  border-color: var(--pos-color-accent);
  color: #fff;
  box-shadow: 0 10px 22px -14px rgba(54, 83, 68, 0.55);
}

.pos-dm__btn--primary:hover,
.pos-dm__btn--primary:focus-visible {
  background: var(--pos-color-accent-strong);
  border-color: var(--pos-color-accent-strong);
  transform: translateY(-1px);
  outline: none;
}

.pos-dm__btn--ghost {
  background: var(--pos-color-paper);
  border-color: var(--pos-color-border);
  color: var(--pos-color-text);
}

.pos-dm__btn--ghost:hover,
.pos-dm__btn--ghost:focus-visible {
  border-color: var(--pos-color-text);
  background: var(--pos-color-body-dim);
  outline: none;
}

.pos-dm__icon-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border: 1px solid var(--pos-color-border);
  border-radius: var(--pos-radius-input);
  background: var(--pos-color-paper);
  color: var(--pos-color-text);
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.12s ease;
}

.pos-dm__icon-btn:hover,
.pos-dm__icon-btn:focus-visible {
  border-color: var(--pos-color-text);
  background: var(--pos-color-body-dim);
  transform: translateY(-1px);
  outline: none;
}

.pos-dm__icon {
  position: relative;
  display: block;
  width: 18px;
  height: 18px;
}

.pos-dm__icon--zoom::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 2px;
  width: 10px;
  height: 10px;
  border: 1.8px solid currentColor;
  border-radius: 50%;
}

.pos-dm__icon--zoom::after {
  content: "";
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 7px;
  height: 1.8px;
  background: currentColor;
  transform: rotate(45deg);
  transform-origin: center;
}

/* 折りたたみトグル用のシェブロン（既定は上向き＝上にしまう / 折りたたみ中は下向き＝開く） */
.pos-dm__icon--chevron::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 6px;
  width: 9px;
  height: 9px;
  border-top: 1.8px solid currentColor;
  border-right: 1.8px solid currentColor;
  transform: rotate(-45deg);
}

body.is-dm-preview-collapsed .pos-dm__icon--chevron::before {
  top: 2px;
  transform: rotate(135deg);
}

.pos-dm__icon--close::before,
.pos-dm__icon--close::after {
  content: "";
  position: absolute;
  left: 2px;
  top: 8px;
  width: 14px;
  height: 1.8px;
  background: currentColor;
}

.pos-dm__icon--close::before { transform: rotate(45deg); }
.pos-dm__icon--close::after { transform: rotate(-45deg); }

/* ============================================================
   Preview pane (right column)
   ============================================================ */

.pos-dm__preview {
  position: sticky;
  top: 110px;
}

.pos-dm__preview-card {
  border: 1px solid var(--pos-color-border);
  border-radius: var(--pos-radius-card);
  background: var(--pos-color-paper);
  padding: 22px;
  box-shadow: var(--pos-shadow-card);
}

.pos-dm__preview-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.pos-dm__preview-head h2 {
  margin: 0;
  font-family: var(--pos-font-display);
  font-size: 17px;
  font-weight: 700;
  line-height: 1.4;
}

/* 拡大と折りたたみは並べて右端に置く（間が空くと虫眼鏡だけ中央寄りに見える） */
.pos-dm__preview-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.pos-dm__preview-zoom { display: none; }

/* 折りたたみはSPのプレビュー表示時のみ（PCは常時表示で邪魔にならない） */
.pos-dm__preview-collapse { display: none; }

.pos-dm__stage {
  display: grid;
  place-items: center;
  min-height: 500px;
  padding: 28px;
  border-radius: 6px;
  background: var(--pos-color-stage);
  position: relative;
  overflow: hidden;
}

.pos-dm__stage::before,
.pos-dm__stage::after,
.pos-dm__preview-modal-stage::before,
.pos-dm__preview-modal-stage::after {
  content: "";
  position: absolute;
  z-index: 3;
  display: block;
  pointer-events: none;
  opacity: 0;
  background: rgba(54, 83, 68, 0.78);
  transition: opacity 0.12s ease;
}

.pos-dm__stage::before,
.pos-dm__preview-modal-stage::before {
  top: 10px;
  bottom: 10px;
  left: 50%;
  width: 1px;
}

.pos-dm__stage::after,
.pos-dm__preview-modal-stage::after {
  left: 10px;
  right: 10px;
  top: 50%;
  height: 1px;
}

.pos-dm__stage.is-logo-snap-x::before,
.pos-dm__stage.is-logo-snap-y::after,
.pos-dm__preview-modal-stage.is-logo-snap-x::before,
.pos-dm__preview-modal-stage.is-logo-snap-y::after {
  opacity: 1;
}

.pos-dm__hint {
  margin: 12px 0 0;
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--pos-color-muted);
}

.pos-dm__hint.is-white-preview {
  color: var(--pos-color-text-soft);
}

.pos-dm__preview-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  place-items: center;
  padding: 24px;
}

.pos-dm__preview-modal.is-open { display: grid; }

.pos-dm__preview-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(29, 33, 30, 0.46);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.pos-dm__preview-modal-panel {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 16px;
  width: min(760px, calc(100vw - 32px));
  max-height: calc(100dvh - 48px);
  padding: 18px;
  border: 1px solid var(--pos-color-border);
  border-radius: var(--pos-radius-card);
  background: var(--pos-color-paper);
  box-shadow: 0 24px 80px -36px rgba(20, 24, 22, 0.45);
}

.pos-dm__preview-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.pos-dm__preview-modal-head h2 {
  margin: 0;
  font-family: var(--pos-font-display);
  font-size: 18px;
  line-height: 1.4;
}

.pos-dm__preview-modal-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: min(68dvh, 680px);
  padding: 22px;
  border-radius: 6px;
  background: var(--pos-color-stage);
  overflow: hidden;
}

.pos-dm__preview-modal-stage .pos-dm__sign {
  flex: 0 0 auto;
  width: min(100%, 640px, calc(100dvh - 170px));
  max-width: none;
  margin: 0 auto;
}

.pos-dm__preview-modal-stage .pos-dm__sign--portrait {
  width: min(100%, 420px);
}

.pos-dm__editable-logo-image {
  cursor: grab;
  touch-action: none;
}

.pos-dm__logo-placeholder-image {
  cursor: pointer;
  transition: opacity 0.16s ease, filter 0.16s ease;
}

.is-logo-placeholder-dragover .pos-dm__logo-placeholder-image {
  opacity: 0.72;
  filter: drop-shadow(0 0 18px rgba(255, 255, 255, 0.58));
}

.is-logo-dragging .pos-dm__editable-logo-image {
  cursor: grabbing;
}

.pos-dm__logo-selection {
  pointer-events: none;
  opacity: 0.78;
  transition: opacity 0.16s ease;
}

.pos-dm__logo-selection-frame {
  fill: none;
  stroke: rgba(42, 67, 55, 0.92);
  stroke-width: 2;
  stroke-dasharray: 18 12;
  vector-effect: non-scaling-stroke;
}

.pos-dm__logo-selection-handle {
  fill: #fbfaf5;
  stroke: rgba(42, 67, 55, 0.96);
  stroke-width: 2.2;
  filter: drop-shadow(0 1px 2px rgba(20, 24, 22, 0.24));
  pointer-events: none;
  vector-effect: non-scaling-stroke;
}

.pos-dm__logo-selection-hitarea {
  fill: transparent;
  stroke: transparent;
  cursor: nwse-resize;
  pointer-events: all;
  touch-action: none;
}

.pos-dm__logo-selection-hitarea[data-logo-selection-handle="ne"],
.pos-dm__logo-selection-hitarea[data-logo-selection-handle="sw"] {
  cursor: nesw-resize;
}

.pos-dm__sign:hover .pos-dm__logo-selection,
.is-logo-dragging .pos-dm__logo-selection {
  opacity: 1;
}

.is-logo-dragging .pos-dm__logo-selection-frame {
  stroke: rgba(42, 67, 55, 0.98);
  stroke-dasharray: 0;
}

.pos-dm__logo-selection--pulse .pos-dm__logo-selection-frame,
.pos-dm__logo-selection--pulse .pos-dm__logo-selection-handle {
  animation: pos-dm-logo-selection-pulse 1.7s ease both;
}

@keyframes pos-dm-logo-selection-pulse {
  0% {
    opacity: 0;
    stroke-width: 1.5;
  }
  22% {
    opacity: 1;
    stroke-width: 4;
  }
  100% {
    opacity: 1;
    stroke-width: 2;
  }
}

.pos-dm__logo-editor {
  display: grid;
  gap: 12px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--pos-color-border-soft);
  border-radius: var(--pos-radius-input);
  background: rgba(247, 245, 239, 0.72);
}

.pos-dm__logo-editor[hidden] {
  display: none;
}

.pos-dm__logo-editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.pos-dm__logo-editor-head > span,
.pos-dm__logo-scale > span {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--pos-color-text);
}

.pos-dm__logo-editor-head > span {
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: none;
}

.pos-dm__logo-editor-toggle {
  display: none;
}

.pos-dm__logo-editor-body {
  display: grid;
  gap: 12px;
}

.pos-dm__logo-editor-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.pos-dm__logo-editor button {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--pos-color-border);
  border-radius: var(--pos-radius-input);
  background: var(--pos-color-paper);
  color: var(--pos-color-text);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.35;
  transition: border-color 0.16s ease, background 0.16s ease;
}

.pos-dm__logo-editor button:hover,
.pos-dm__logo-editor button:focus-visible {
  border-color: var(--pos-color-text);
  background: var(--pos-color-body-dim);
  outline: none;
}

.pos-dm__logo-scale {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) 44px;
  align-items: center;
  gap: 10px;
}

.pos-dm__logo-scale input[type="range"] {
  width: 100%;
  accent-color: var(--pos-color-accent);
  touch-action: pan-x;
}

.pos-dm__logo-scale output {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0;
  text-align: right;
  color: var(--pos-color-text-soft);
}

/* ============================================================
   A-FRAME sign visual — black wooden stand + plate
   ============================================================ */

.pos-dm__sign {
  --frame-color: #181613;
  --frame-shadow: rgba(20, 17, 13, 0.42);
  --board-bg: #e7d4ad;
  --board-fg: #161513;
  --plate-shadow: 0 12px 26px rgba(20, 17, 13, 0.18);
  position: relative;
  width: min(82%, 320px);
  aspect-ratio: 1 / 1.18;
  font-family: var(--pos-font-display);
}

.pos-dm__sign--mini {
  width: 100%;
  max-width: 168px;
}

.pos-dm__sign--small {
  width: 100%;
  max-width: 184px;
}

/* ---------- A-frame stand structure ---------- */

.pos-dm__stand {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.pos-dm__stand__bar {
  position: absolute;
  top: 5%;
  left: 6%;
  right: 6%;
  height: 2.1%;
  background: var(--frame-color);
  border-radius: 1px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.08) inset;
}

.pos-dm__stand__leg {
  position: absolute;
  top: 5%;
  height: 91%;
  width: 2.6%;
  background: var(--frame-color);
  border-radius: 1px;
}

.pos-dm__stand__leg--left {
  left: 17%;
  transform-origin: top center;
  transform: rotate(8deg);
}

.pos-dm__stand__leg--right {
  right: 17%;
  transform-origin: top center;
  transform: rotate(-8deg);
}

.pos-dm__stand__hanger {
  position: absolute;
  top: 5%;
  width: 3.4%;
  height: 13%;
  background: var(--frame-color);
  border-radius: 1px;
}

.pos-dm__stand__hanger--left { left: 21.4%; }
.pos-dm__stand__hanger--right { right: 21.4%; }

.pos-dm__stand__shadow {
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: 1.5%;
  height: 1.6%;
  background: radial-gradient(ellipse at center, rgba(20, 17, 13, 0.32), transparent 72%);
  filter: blur(0.5px);
}

/* ---------- plate / board (hangs from stand) ---------- */

.pos-dm__board {
  position: absolute;
  top: 16.5%;
  left: 50%;
  transform: translateX(-50%);
  width: 60%;
  aspect-ratio: 360 / 540;
  background: var(--board-bg);
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(0, 0, 0, 0.04)),
    repeating-linear-gradient(96deg, rgba(140, 96, 46, 0.06) 0 1px, rgba(255, 255, 255, 0.05) 1px 5px);
  color: var(--board-fg);
  box-shadow: var(--plate-shadow);
  display: grid;
  align-content: stretch;
  justify-items: stretch;
  text-align: center;
  z-index: 2;
  container-type: inline-size;
  overflow: hidden;
}

.pos-dm__design {
  display: grid;
  align-content: start;
  justify-items: center;
  gap: 5cqw;
  width: 100%;
  height: 100%;
  min-width: 0;
  padding: 16cqw 8cqw;
  box-sizing: border-box;
  text-align: center;
}

.pos-dm__design > * {
  max-width: 100%;
  min-width: 0;
}

/* ---------- text styles inside plate ---------- */

.pos-dm__main {
  font-size: clamp(10px, 18cqw, 56px);
  font-weight: 800;
  line-height: 0.95;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.pos-dm__caption {
  font-size: clamp(5px, 6.4cqw, 16px);
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.pos-dm__micro {
  font-size: clamp(4px, 4.4cqw, 11px);
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.pos-dm__stairs-mark {
  font-size: clamp(10px, 14cqw, 38px);
  line-height: 0.8;
  font-weight: 700;
  letter-spacing: 0;
}

/* ---------- logo frame (square outline around logo) ---------- */

.pos-dm__logo-frame {
  position: relative;
  display: grid;
  place-items: center;
  width: 38%;
  aspect-ratio: 1 / 1;
  padding: 5%;
  border: 1.4px solid currentColor;
  box-sizing: border-box;
  overflow: hidden;
}

.pos-dm__logo-frame__text {
  display: grid;
  justify-items: center;
  gap: 4%;
  width: 100%;
  font-size: clamp(4px, 5.2cqw, 13px);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.pos-dm__logo-frame__text > span {
  display: block;
  white-space: nowrap;
}

.pos-dm__logo-frame__image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

/* L-bracket variant (used in template 1) — corner accent rather than full box */
.pos-dm__logo-frame--lbracket {
  border: 0;
  padding: 0 8% 6% 0;
  width: 34%;
  aspect-ratio: 1.4 / 1;
  justify-self: start;
}

.pos-dm__logo-frame--lbracket::before {
  content: "";
  position: absolute;
  right: 0;
  top: 0;
  bottom: 16%;
  width: 1.4px;
  background: currentColor;
}

.pos-dm__logo-frame--lbracket::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1.4px;
  background: currentColor;
}

.pos-dm__logo-frame--lbracket .pos-dm__logo-frame__text {
  font-size: clamp(7px, 5.0cqw, 12px);
  justify-items: start;
  text-align: left;
  letter-spacing: 0.04em;
}

/* QR placeholder inside plate */

.pos-dm__qr {
  display: grid;
  place-items: center;
  width: 26%;
  aspect-ratio: 1;
  padding: 3%;
  background: #ffffff;
}

.pos-dm__qr img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.pos-dm__qr-fallback {
  width: 100%;
  height: 100%;
  background:
    linear-gradient(90deg, #111 16%, transparent 16% 32%, #111 32% 48%, transparent 48% 64%, #111 64% 80%, transparent 80%),
    linear-gradient(#111 16%, transparent 16% 32%, #111 32% 48%, transparent 48% 64%, #111 64% 80%, transparent 80%);
  background-size: 22% 22%;
}

/* ---------- per-template tweaks ---------- */

.pos-dm__sign--template-logoText1 .pos-dm__design {
  align-content: start;
  gap: 14cqw;
  padding-top: 10cqw;
}
.pos-dm__sign--template-logoText1 .pos-dm__logo-frame {
  justify-self: start;
}

.pos-dm__sign--template-logoText2 .pos-dm__design {
  gap: 7cqw;
}
.pos-dm__sign--template-logoText2 .pos-dm__logo-frame {
  width: 30%;
}
.pos-dm__sign--template-logoText2 .pos-dm__main {
  font-size: 16cqw;
}

.pos-dm__sign--template-logoText3 .pos-dm__design {
  gap: 6cqw;
  padding-top: 12cqw;
}
.pos-dm__sign--template-logoText3 .pos-dm__logo-frame {
  width: 22%;
  padding: 4%;
}
.pos-dm__sign--template-logoText3 .pos-dm__logo-frame__text {
  font-size: 3.2cqw;
}
.pos-dm__sign--template-logoText3 .pos-dm__main {
  font-size: 26cqw;
  line-height: 0.9;
  letter-spacing: 0.02em;
}

.pos-dm__sign--template-logoText4 .pos-dm__design {
  align-content: start;
  gap: 12cqw;
  padding-top: 12cqw;
}
.pos-dm__sign--template-logoText4 .pos-dm__logo-frame {
  width: 26%;
  padding: 4%;
}
.pos-dm__sign--template-logoText4 .pos-dm__logo-frame__text {
  font-size: 3.6cqw;
}

.pos-dm__sign--template-qr .pos-dm__design {
  gap: 7cqw;
}
.pos-dm__sign--template-qr .pos-dm__logo-frame {
  width: 32%;
  padding: 4%;
}
.pos-dm__sign--template-qr .pos-dm__qr {
  width: 26%;
}

.pos-dm__sign--template-stairs .pos-dm__design {
  gap: 5cqw;
}
.pos-dm__sign--template-stairs .pos-dm__logo-frame {
  width: 28%;
  padding: 4%;
}
.pos-dm__sign--template-stairs .pos-dm__logo-frame__text {
  font-size: 3.6cqw;
}

.pos-dm__sign--template-editableLogo .pos-dm__design {
  align-content: center;
  padding-top: 8cqw;
}
.pos-dm__sign--template-editableLogo .pos-dm__logo-frame {
  width: 60%;
  padding: 7%;
}
.pos-dm__sign--template-editableLogo .pos-dm__logo-frame__text {
  font-size: 10cqw;
  gap: 5%;
}

/* ---------- uploaded-logo size overrides ---------- */

.pos-dm__logo-frame--has-image {
  border-color: transparent;
  padding: 2%;
}

.pos-dm__sign--template-logoText1 .pos-dm__logo-frame--lbracket.pos-dm__logo-frame--has-image {
  width: 46%;
  aspect-ratio: 1.4 / 1;
  padding: 0 6% 4% 0;
}
.pos-dm__sign--template-logoText2 .pos-dm__logo-frame--has-image { width: 52%; }
.pos-dm__sign--template-logoText3 .pos-dm__logo-frame--has-image { width: 38%; }
.pos-dm__sign--template-logoText4 .pos-dm__logo-frame--has-image { width: 44%; }
.pos-dm__sign--template-qr .pos-dm__logo-frame--has-image { width: 48%; }
.pos-dm__sign--template-stairs .pos-dm__logo-frame--has-image { width: 44%; }
.pos-dm__sign--template-editableLogo .pos-dm__logo-frame--has-image { width: 78%; padding: 3%; }

/* ---------- layout variants ---------- */

.pos-dm__sign--variant-hero .pos-dm__main {
  font-size: clamp(32px, 26cqw, 72px);
}

.pos-dm__sign--variant-frame .pos-dm__design {
  border: 1.2px solid currentColor;
  padding: 7% 6%;
  width: 92%;
}

.pos-dm__sign--variant-compact .pos-dm__design {
  gap: 4%;
}

/* ---------- plate / ink themes ---------- */

.pos-dm__plate-ivory { --board-bg: #f1ead9; }
.pos-dm__plate-black { --board-bg: #181613; }
.pos-dm__plate-wood  { --board-bg: #e7d4ad; }
.pos-dm__plate-sage  { --board-bg: #9aa28d; }

.pos-dm__ink-black { --board-fg: #161513; }
.pos-dm__ink-white { --board-fg: #ffffff; }

/* ---------- font themes (board only) ---------- */

.pos-dm__font-gothic .pos-dm__board { font-family: var(--pos-font-display); }
.pos-dm__font-bold .pos-dm__board { font-family: Impact, "Arial Black", var(--pos-font-display); font-weight: 900; }
.pos-dm__font-mincho .pos-dm__board { font-family: var(--pos-font-mincho); }
.pos-dm__font-slab .pos-dm__board { font-family: var(--pos-font-slab); font-weight: 800; }

/* ============================================================
   Upload artboard visual — transparent print surface
   ============================================================ */

.pos-dm__sign {
  --board-bg: transparent;
  --board-fg: #111111;
  position: relative;
  width: min(100%, 420px);
  aspect-ratio: var(--pos-dm-artboard-ratio, 1 / 1);
  padding: 0;
  font-family: var(--pos-font-display);
}

.pos-dm__sign--portrait {
  width: min(100%, 340px);
}

.pos-dm__sign--mini {
  width: 100%;
  max-width: 154px;
}

.pos-dm__sign--portrait.pos-dm__sign--mini {
  max-width: 132px;
}

.pos-dm__sign--small {
  width: 100%;
  max-width: 172px;
}

.pos-dm__sign--portrait.pos-dm__sign--small {
  max-width: 148px;
}

.pos-dm__stand { display: none; }

.pos-dm__board {
  position: relative;
  top: auto;
  left: auto;
  transform: none;
  width: 100%;
  height: 100%;
  aspect-ratio: var(--pos-dm-artboard-ratio, 1 / 1);
  margin: 0;
  border: 0;
  background: transparent;
  background-image: none;
  color: var(--board-fg);
  box-shadow: none;
  display: grid;
  align-content: stretch;
  justify-items: stretch;
  text-align: center;
  container-type: inline-size;
  overflow: hidden;
}

.pos-dm__sign:not(.pos-dm__sign--print) .pos-dm__board {
  background: #ffffff;
  outline: 1px solid rgba(17, 17, 17, 0.18);
}

.pos-dm__sign.pos-dm__ink-white:not(.pos-dm__sign--print) .pos-dm__board {
  background: #7b7d75;
  outline-color: rgba(255, 255, 255, 0.32);
}

.pos-dm__design {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 4cqw;
  width: 100%;
  height: 100%;
  min-width: 0;
  padding: 13cqw;
  box-sizing: border-box;
  text-align: center;
}

.pos-dm__design > * {
  max-width: 100%;
  min-width: 0;
}

.pos-dm__design--asset {
  display: block;
  padding: 0;
}

.pos-dm__asset-template {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  object-fit: contain;
  pointer-events: none;
}

.pos-dm__inline-svg {
  display: block;
  width: 100%;
  height: 100%;
}

.pos-dm__main {
  font-size: 14cqw;
  font-weight: 800;
  line-height: 0.95;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.pos-dm__caption {
  font-size: 4.8cqw;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.pos-dm__micro {
  font-size: 3.2cqw;
  font-weight: 600;
  line-height: 1.45;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.pos-dm__stairs-mark {
  font-size: 18cqw;
  line-height: 0.85;
  font-weight: 800;
  letter-spacing: 0;
}

.pos-dm__logo-frame {
  position: relative;
  display: grid;
  place-items: center;
  width: 22%;
  aspect-ratio: 1 / 1;
  padding: 3%;
  border: 1.8px solid currentColor;
  background: transparent;
  box-sizing: border-box;
  overflow: hidden;
}

.pos-dm__logo-frame__text {
  display: grid;
  justify-items: center;
  gap: 3%;
  width: 100%;
  font-size: 2.8cqw;
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.pos-dm__logo-frame__text > span {
  display: block;
  white-space: nowrap;
}

.pos-dm__logo-frame__image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

.pos-dm__logo-frame--lbracket {
  border: 0;
  padding: 0 7% 5% 0;
  width: 28%;
  aspect-ratio: 1.4 / 1;
  justify-self: start;
}

.pos-dm__logo-frame--lbracket::before {
  content: "";
  position: absolute;
  right: 0;
  top: 0;
  bottom: 16%;
  width: 1.8px;
  background: currentColor;
}

.pos-dm__logo-frame--lbracket::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1.8px;
  background: currentColor;
}

.pos-dm__logo-frame--lbracket .pos-dm__logo-frame__text {
  justify-items: start;
  text-align: left;
}

.pos-dm__logo-frame--has-image {
  border: 0;
  padding: 0;
}

.pos-dm__qr {
  display: grid;
  place-items: center;
  width: 18%;
  aspect-ratio: 1;
  padding: 0;
  background: transparent;
}

.pos-dm__qr img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.pos-dm__qr-fallback {
  width: 100%;
  height: 100%;
  background:
    linear-gradient(90deg, #111 16%, transparent 16% 32%, #111 32% 48%, transparent 48% 64%, #111 64% 80%, transparent 80%),
    linear-gradient(#111 16%, transparent 16% 32%, #111 32% 48%, transparent 48% 64%, #111 64% 80%, transparent 80%);
  background-size: 22% 22%;
}

.pos-dm__sign--template-logoText1 .pos-dm__design {
  align-content: start;
  justify-items: start;
  gap: 15cqw;
  padding: 14cqw;
}

.pos-dm__sign--template-logoText1 .pos-dm__caption,
.pos-dm__sign--template-logoText1 .pos-dm__micro {
  justify-self: center;
}

.pos-dm__sign--template-logoText2 .pos-dm__design { gap: 4.5cqw; }
.pos-dm__sign--template-logoText2 .pos-dm__logo-frame { width: 18%; }
.pos-dm__sign--template-logoText2 .pos-dm__main { font-size: 14cqw; }

.pos-dm__sign--template-logoText3 .pos-dm__design { gap: 3.6cqw; }
.pos-dm__sign--template-logoText3 .pos-dm__logo-frame {
  width: 14%;
  padding: 3%;
}
.pos-dm__sign--template-logoText3 .pos-dm__logo-frame__text { font-size: 1.8cqw; }
.pos-dm__sign--template-logoText3 .pos-dm__main {
  font-size: 21cqw;
  line-height: 0.9;
  letter-spacing: 0.02em;
}

.pos-dm__sign--template-logoText4 .pos-dm__design { gap: 8cqw; }
.pos-dm__sign--template-logoText4 .pos-dm__logo-frame {
  width: 19%;
  padding: 3.5%;
}
.pos-dm__sign--template-logoText4 .pos-dm__logo-frame__text { font-size: 2cqw; }

.pos-dm__sign--template-qr .pos-dm__design { gap: 6cqw; }
.pos-dm__sign--template-qr .pos-dm__logo-frame { width: 20%; }

.pos-dm__sign--template-stairs .pos-dm__design { gap: 5cqw; }
.pos-dm__sign--template-stairs .pos-dm__logo-frame {
  width: 18%;
  padding: 3.5%;
}

.pos-dm__sign--template-editableLogo .pos-dm__design { align-content: center; }
.pos-dm__sign--template-editableLogo .pos-dm__logo-frame {
  width: 44%;
  padding: 5.5%;
}
.pos-dm__sign--template-editableLogo .pos-dm__logo-frame__text {
  font-size: 7cqw;
  gap: 5%;
}

.pos-dm__sign--template-logoText1 .pos-dm__logo-frame--has-image {
  width: 34%;
  aspect-ratio: 1.4 / 1;
  padding: 0;
}

.pos-dm__sign--template-logoText2 .pos-dm__logo-frame--has-image { width: 34%; }
.pos-dm__sign--template-logoText3 .pos-dm__logo-frame--has-image { width: 26%; }
.pos-dm__sign--template-logoText4 .pos-dm__logo-frame--has-image { width: 32%; }
.pos-dm__sign--template-qr .pos-dm__logo-frame--has-image { width: 32%; }
.pos-dm__sign--template-stairs .pos-dm__logo-frame--has-image { width: 30%; }
.pos-dm__sign--template-editableLogo .pos-dm__logo-frame--has-image { width: 62%; }

.pos-dm__sign--variant-hero .pos-dm__main { font-size: 19cqw; }

.pos-dm__sign--variant-frame .pos-dm__design {
  width: auto;
  height: calc(100% - 20cqw);
  margin: 10cqw;
  padding: 8cqw;
  border: 2px solid currentColor;
}

.pos-dm__sign--variant-compact .pos-dm__design {
  gap: 2.6cqw;
  padding: 16cqw;
}

.pos-dm__sign .pos-dm__design--asset {
  display: block;
  align-content: stretch;
  justify-items: stretch;
  gap: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
}

.pos-dm__plate-transparent,
.pos-dm__plate-ivory,
.pos-dm__plate-black,
.pos-dm__plate-wood,
.pos-dm__plate-sage {
  --board-bg: transparent;
}

.pos-dm__ink-black { --board-fg: #111111; }
.pos-dm__ink-white { --board-fg: #ffffff; }

/* ============================================================
   Export sheet (transparent PNG source)
   ============================================================ */

.pos-dm__print-root {
  position: fixed;
  left: -10000px;
  top: 0;
  width: 3500px;
  height: 3500px;
  visibility: hidden;
  pointer-events: none;
}

.pos-dm__print-sheet {
  width: fit-content;
  height: fit-content;
  background: transparent;
  position: relative;
}

.pos-dm__sign--print {
  width: var(--pos-dm-export-width, 3500px);
  height: var(--pos-dm-export-height, 3500px);
  aspect-ratio: var(--pos-dm-artboard-ratio, 1 / 1);
  padding: 0;
}

.pos-dm__sign--print .pos-dm__board {
  position: static;
  transform: none;
  width: 100%;
  height: 100%;
  aspect-ratio: var(--pos-dm-artboard-ratio, 1 / 1);
  margin: 0;
  border: 0;
  box-shadow: none;
  outline: 0;
  background: transparent;
  background-image: none;
}

@page {
  size: 3500px 3500px;
  margin: 0;
}

@media print {
  html, body {
    width: 3500px;
    height: 3500px;
    background: transparent;
  }
  body { margin: 0; }
  .pos-dm__header,
  .pos-dm__shell { display: none !important; }
  .pos-dm__print-root {
    position: static;
    width: 3500px;
    height: 3500px;
    visibility: visible;
    pointer-events: auto;
  }
  .pos-dm__print-sheet { page-break-after: avoid; }
  .pos-dm__print-sheet * {
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }
}

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 960px) {
  .pos-dm__header {
    position: static;
  }

  .pos-dm__header-inner {
    grid-template-columns: auto auto;
    justify-content: space-between;
    padding: 12px 18px;
    gap: 12px;
  }
  .pos-dm__product { display: none; }
  .pos-dm__return { height: 36px; padding: 0 14px; font-size: 10.5px; }
  .pos-dm__shell { padding-top: 0; }

  .pos-dm__workspace {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .pos-dm__preview {
    order: -1;
    position: sticky;
    top: 0;
    z-index: 15;
    margin: 0 -32px;
  }
  .pos-dm__preview-card {
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    border-top: 0;
    padding: 10px 18px 12px;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 6px 18px -14px rgba(20, 24, 22, 0.25);
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto;
    gap: 8px 16px;
    align-items: center;
  }
  .pos-dm__preview-head {
    grid-column: 1 / -1;
    grid-row: 1 / 2;
    margin-bottom: 0;
    align-items: center;
  }
  .pos-dm__preview-head h2 { font-size: 15px; }
  .pos-dm__preview-head .pos-dm__eyebrow { font-size: 10px; letter-spacing: 0.24em; }
  .pos-dm__preview-zoom { display: inline-flex; }
  .pos-dm__logo-editor {
    margin-top: 0;
    padding: 10px;
    gap: 0;
  }
  .pos-dm__logo-editor-head {
    align-items: center;
  }
  .pos-dm__logo-editor-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
  }
  .pos-dm__logo-editor-body {
    display: none;
    gap: 10px;
    padding-top: 10px;
  }
  .pos-dm__logo-editor.is-expanded .pos-dm__logo-editor-body {
    display: grid;
  }
  .pos-dm__logo-editor button {
    min-height: 40px;
    padding: 0 12px;
    font-size: 12px;
  }
  .pos-dm__stage {
    grid-column: 1 / -1;
    grid-row: 2 / 3;
    min-height: 170px;
    max-height: 24vh;
    padding: 10px;
    border-radius: 4px;
  }
  .pos-dm__sign { width: min(48%, 190px); }
  .pos-dm__sign--portrait { width: min(36%, 120px); }
  .pos-dm__hint { display: none; }
  .pos-dm__hint.is-white-preview {
    display: block;
    grid-column: 1 / -1;
    margin: -2px 0 0;
    font-size: 11px;
    line-height: 1.45;
  }

  .pos-dm__template-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .pos-dm__template-thumb { min-height: 210px; padding: 14px; }
  .pos-dm__template-thumb .pos-dm__sign--mini { max-width: 190px; }
  .pos-dm__template-thumb .pos-dm__sign--portrait.pos-dm__sign--mini { max-width: 132px; }
}

@media (max-width: 600px) {
  .pos-dm__shell { padding: 0 18px 64px; }
  .pos-dm__card--padded { padding: 22px 20px; }

  /* スマホは2列。1枚ずつ縦に流すより見比べやすい（2026-07-28 に正規化） */
  .pos-dm__template-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .pos-dm__template-card { padding: 8px; gap: 8px; }
  .pos-dm__template-thumb { min-height: 210px; padding: 12px; }
  .pos-dm__template-thumb .pos-dm__sign--mini { max-width: none; width: 74%; }
  .pos-dm__template-thumb .pos-dm__sign--portrait.pos-dm__sign--mini { width: min(48%, 132px); max-width: 132px; }
  .pos-dm__template-text { display: grid; align-items: baseline; gap: 8px 14px; }
  .pos-dm__template-text strong { font-size: 12px; line-height: 1.35; }
  /* 2列では説明文まで出すと窮屈になるため、名前だけ見せる */
  .pos-dm__template-text span { display: none; }

  .pos-dm__btn { min-width: 0; width: 100%; }
  .pos-dm__card--export .pos-dm__actions { flex-direction: column; }
  .pos-dm__preview { margin: 0 -18px; }
  .pos-dm__preview-card { padding: 8px 14px 10px; }
  .pos-dm__stage { min-height: 150px; max-height: 22vh; }
  .pos-dm__sign { width: min(44%, 150px); }
  .pos-dm__sign--portrait { width: min(34%, 108px); }
  .pos-dm__logo-editor-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
  }
  .pos-dm__logo-editor-head > span {
    font-size: 13px;
  }
  .pos-dm__logo-editor-actions {
    display: grid;
    grid-template-columns: 1fr;
    justify-content: stretch;
    justify-self: stretch;
    gap: 8px;
    width: 100%;
  }
  .pos-dm__logo-editor-actions button {
    width: 100%;
    min-height: 44px;
    font-size: 12.5px;
  }
  .pos-dm__logo-scale {
    grid-template-columns: auto minmax(0, 1fr) 42px;
  }

  .pos-dm__preview-modal {
    padding: 14px;
  }
  .pos-dm__preview-modal-panel {
    width: calc(100vw - 28px);
    max-height: calc(100dvh - 28px);
    padding: 14px;
  }
  .pos-dm__preview-modal-stage {
    min-height: min(66dvh, 520px);
    padding: 10px;
  }
  .pos-dm__preview-modal-stage .pos-dm__sign {
    width: min(100%, calc(100dvh - 190px));
    max-width: none;
  }
  .pos-dm__preview-modal-stage .pos-dm__sign--portrait {
    width: min(100%, 260px, calc(100dvh - 250px));
  }

  .pos-dm__field-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   2026-07 SP UI ブラッシュアップ
   （プレビュー後出し・右端密着パネル・決定バー・写真サムネ・
     文字色プリセット・iOSズーム対策）
   ============================================================ */

/* 明るいカスタム文字色は白インクと同じプレビュー下地で見せる */
.pos-dm__sign.pos-dm__ink-is-light:not(.pos-dm__sign--print) .pos-dm__board {
  background: #7b7d75;
  outline-color: rgba(255, 255, 255, 0.32);
}

/* 完成イメージ写真サムネ */
.pos-dm__template-thumb--photo {
  min-height: 0;
  padding: 0;
  background: var(--pos-color-body-dim);
}

.pos-dm__template-thumb--photo img {
  display: block;
  width: 100%;
  height: 100%;
  aspect-ratio: 650 / 830;
  object-fit: cover;
}

/* 文字色プリセット・カスタムパレット */
.pos-dm__choice-group--ink .pos-dm__swatch {
  width: 14px;
  height: 14px;
  border-radius: 50%;
}

.pos-dm__choice-group--ink label:has(input:checked) .pos-dm__swatch {
  border-color: #fff;
}

.pos-dm__swatch--custom { display: none; }

/* カスタム色は商品ページのカラーホイールに合わせる（外周＝12色相のリング、中心＝白で固定） */
.pos-dm__ink-custom input[type="color"] {
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--pos-color-border);
  border-radius: 50%;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background:
    radial-gradient(circle at 50% 50%, #fff 0 34%, transparent 34%),
    conic-gradient(
      from -90deg,
      #d94b3f 0deg 30deg,
      #e2803a 30deg 60deg,
      #e9ad3c 60deg 90deg,
      #e7cf45 90deg 120deg,
      #b9c94a 120deg 150deg,
      #6fb457 150deg 180deg,
      #3aa87d 180deg 210deg,
      #2f9aa6 210deg 240deg,
      #3579b5 240deg 270deg,
      #4a56a6 270deg 300deg,
      #7f4b9e 300deg 330deg,
      #b8437a 330deg 360deg
    );
}

/* 選択中の色は中心に出さない（色替えのたびにチップの見た目が変わるのを避ける） */
.pos-dm__ink-custom input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.pos-dm__ink-custom input[type="color"]::-webkit-color-swatch { border: none; opacity: 0; }
.pos-dm__ink-custom input[type="color"]::-moz-color-swatch { border: none; opacity: 0; }

/* 選択中はピルが反転するので、リングは明色で回す */
.pos-dm__choice-group--ink label:has(input[value="custom"]:checked) input[type="color"] {
  border-color: rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.45);
}

/* プレビュー空状態（PC: テンプレ選択前） */
.pos-dm__preview-empty {
  display: none;
  padding: 26px 8px;
  text-align: center;
  color: var(--pos-color-text-soft);
  font-size: 13px;
  line-height: 1.7;
}

.pos-dm__preview[data-empty="1"] .pos-dm__preview-empty { display: block; }

.pos-dm__preview[data-empty="1"] .pos-dm__preview-head,
.pos-dm__preview[data-empty="1"] .pos-dm__stage,
.pos-dm__preview[data-empty="1"] .pos-dm__logo-editor,
.pos-dm__preview[data-empty="1"] .pos-dm__hint {
  display: none;
}

/* テンプレ決定バー */
.pos-dm__confirm-bar { display: none; }

/* PC: 左カラム幅に揃えた固定バー。SPと同じ「選択 → 決定 → Step02へ」の導線を出す。
   PCはプレビューが右カラムに常設されるため、プレビュー自体は選択と同時に表示する。
   workspace と同じグリッド定義をそのまま使うことで、100vw計算やスクロールバー幅に
   依存せず左カラムと必ず一致させる */
@media (min-width: 961px) {
  .pos-dm__confirm-bar {
    display: grid;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    max-width: 1320px;
    margin: 0 auto;
    padding: 0 32px 24px;
    grid-template-columns: minmax(0, 1fr) minmax(400px, 460px);
    gap: 32px;
    /* 右カラム側の余白でクリックを奪わない */
    pointer-events: none;
  }

  .pos-dm__confirm-bar[hidden] { display: none; }

  .pos-dm__confirm-bar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 13px 14px 13px 22px;
    border: 1px solid var(--pos-color-border);
    border-radius: var(--pos-radius-card);
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 18px 36px -22px rgba(20, 24, 22, 0.5);
    pointer-events: auto;
    animation: pos-dm-confirm-bar-in 0.24s ease;
  }

  .pos-dm__confirm-bar-label {
    min-width: 0;
    overflow: hidden;
    color: var(--pos-color-text-soft);
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .pos-dm__confirm-bar-label strong {
    color: var(--pos-color-text);
    font-weight: 700;
  }

  .pos-dm__confirm-bar .pos-dm__btn {
    min-height: 44px;
    white-space: nowrap;
  }
}

@keyframes pos-dm-confirm-bar-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 960px) {
  .pos-dm__confirm-bar {
    display: block;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--pos-color-border);
    box-shadow: 0 -10px 24px -18px rgba(20, 24, 22, 0.4);
  }

  .pos-dm__confirm-bar[hidden] { display: none; }

  .pos-dm__confirm-bar-inner {
    display: grid;
    gap: 8px;
    max-width: 560px;
    margin: 0 auto;
  }

  .pos-dm__confirm-bar-label {
    font-size: 12px;
    color: var(--pos-color-text-soft);
    text-align: center;
  }

  .pos-dm__confirm-bar-label strong {
    color: var(--pos-color-text);
    font-weight: 700;
  }

  .pos-dm__confirm-bar .pos-dm__btn {
    width: 100%;
    min-height: 48px;
  }

  /* プレビューはテンプレ決定後にだけ表示する */
  .pos-dm__preview { display: none; }

  body.is-dm-preview-revealed .pos-dm__preview {
    display: block;
    position: sticky;
    top: 8px;
    width: 88vw;
    margin: 0 -32px 0 auto;
    animation: pos-dm-preview-in 0.32s ease;
  }

  /* 右端密着パネル型: 左だけ角丸＋影 */
  body.is-dm-preview-revealed .pos-dm__preview-card {
    border: 1px solid var(--pos-color-border);
    border-right: 0;
    border-radius: 14px 0 0 14px;
    box-shadow: -14px 16px 34px -24px rgba(20, 24, 22, 0.5);
  }

  /* 入力の邪魔になるときに畳めるようにする（虫眼鏡の隣） */
  body.is-dm-preview-revealed .pos-dm__preview-collapse {
    display: inline-flex;
  }

  /* 畳むときは横ではなく上へ巻き取る（見出しバーだけ残す） */
  body.is-dm-preview-revealed .pos-dm__preview-card {
    transition: padding 0.24s ease;
  }

  body.is-dm-preview-collapsed .pos-dm__preview {
    animation: none;
  }

  body.is-dm-preview-collapsed .pos-dm__preview-card {
    padding: 8px 12px;
  }

  body.is-dm-preview-collapsed .pos-dm__preview-head {
    margin-bottom: 0;
    align-items: center;
  }

  body.is-dm-preview-collapsed .pos-dm__preview-head h2 {
    font-size: 14px;
  }

  body.is-dm-preview-collapsed .pos-dm__preview-head .pos-dm__eyebrow {
    display: none;
  }

  body.is-dm-preview-collapsed .pos-dm__preview-zoom,
  body.is-dm-preview-collapsed .pos-dm__stage,
  body.is-dm-preview-collapsed .pos-dm__logo-editor,
  body.is-dm-preview-collapsed .pos-dm__hint {
    display: none;
  }

  /* iOS Safariの自動ズーム回避（16px未満の入力欄でフォーカスズームが発動するため） */
  .pos-dm__field input[type="text"],
  .pos-dm__field textarea {
    font-size: 16px;
  }
}

@media (max-width: 600px) {
  .pos-dm__menu-editor-head,
  .pos-dm__menu-row {
    grid-template-columns: minmax(0, 1fr) 96px;
  }

  body.is-dm-preview-revealed .pos-dm__preview {
    margin-right: -18px;
  }

  /* 決定バーに隠れないよう下部に余白を足す */
  .pos-dm__shell { padding-bottom: 120px; }
}

@keyframes pos-dm-preview-in {
  from { opacity: 0; transform: translateX(24px); }
  to { opacity: 1; transform: none; }
}

.pos-dm__choice-group--ink label { white-space: nowrap; }

/* 埋め込み（商品ページモーダル）時のチューニング
   - 親モーダルが枠とタイトルを持つため、アプリ内ヘッダーは二重になるので隠す
   - 親の閉じる（×）は左上に浮くので、その分だけ上に余白を作る */
body.is-embedded .pos-dm__return { display: none; }
body.is-embedded .pos-dm__header { display: none; }

body.is-embedded .pos-dm__shell {
  padding-top: 62px;
}

@media (max-width: 960px) {
  body.is-embedded .pos-dm__shell { padding-top: 58px; }

  /* 左上に浮く親モーダルの×（右端50px）にプレビューパネルが被らない幅にする */
  body.is-embedded.is-dm-preview-revealed .pos-dm__preview { width: 81vw; }
}

/* 文字色ピルをフォントと同じ横並びに（ラジオ丸は隠し、スウォッチ＋選択時の反転で状態を示す） */
.pos-dm__choice-group--ink input[type="radio"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.pos-dm__choice-group--ink label {
  gap: 8px;
  padding: 6px 12px;
}

.pos-dm__choice-group--ink label:has(input:focus-visible) {
  outline: 2px solid var(--pos-color-btn);
  outline-offset: 1px;
}
