/* 鉢形 — 色は用土と植物から：軽石・石灰・炭・アガベ・鹿沼土 */
:root {
  --pumice: #C9CCC6;      /* 舞台（3D の背景） */
  --pumice-deep: #B7BBB4;
  --lime: #ECEDE8;        /* 操作欄 */
  --lime-2: #E1E3DD;
  --ink: #1F2420;         /* 文字（炭） */
  --ink-2: #545B55;       /* 補足の文字 */
  --rule: #C3C7C0;        /* 区切りの線 */
  --agave: #4C6B63;       /* 選んでいるもの */
  --agave-ink: #F3F6F4;
  --agave-soft: #D3DED9;
  --kanuma: #B5841F;      /* 注意（鹿沼土） */
  --kanuma-soft: #F1E2BF;
  --tag: #FAFAF5;         /* 名札 */
  --tag-ink: #2C332E;
  --focus: #2C6E9E;
  --r-s: 6px;
  --font: 'Murecho', 'Hiragino Sans', 'Yu Gothic UI', system-ui, sans-serif;
  --hand: 'Klee One', 'Hiragino Maru Gothic ProN', serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  display: grid; grid-template-rows: auto minmax(0, 1fr); height: 100dvh;
  background: var(--lime);
  color: var(--ink);
  font: 400 14px/1.6 var(--font);
  font-feature-settings: 'palt' 1;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ---- 上の帯 ---- */
.bar {
  display: flex; align-items: baseline; gap: 14px;
  padding: 10px 20px 9px;
  background: var(--lime);
  border-bottom: 1px solid var(--rule);
}
.logo {
  margin: 0; font-size: 22px; font-weight: 800; letter-spacing: 0.08em; line-height: 1;
}
.lede { margin: 0; color: var(--ink-2); font-size: 13px; }

/* ---- 全体 ---- */
.app {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 392px;
  min-height: 0;
}

/* ---- 舞台 ---- */
.stage {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(120% 80% at 50% 38%, #D6D9D3 0%, var(--pumice) 55%, var(--pumice-deep) 100%);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto;
}
.view-wrap { position: relative; min-height: 0; display: grid; grid-template-rows: minmax(0, 1fr); }
.mini-tag { display: none; }
.view { position: relative; min-height: 0; }
#view { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
#view:active { cursor: grabbing; }

.stage-tools {
  position: absolute; top: 14px; left: 16px;
  display: flex; flex-wrap: wrap; gap: 6px;
}
.chip {
  border: 1px solid rgba(31, 36, 32, 0.22);
  background: rgba(236, 237, 232, 0.72);
  backdrop-filter: blur(6px);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 13px;
  cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--agave); color: var(--agave-ink); border-color: var(--agave); }

.busy {
  position: absolute; top: 16px; right: 18px; margin: 0;
  font-size: 12px; color: var(--ink-2);
  display: flex; align-items: center; gap: 8px;
}
.busy::before {
  content: ''; width: 8px; height: 8px; border-radius: 50%;
  background: var(--agave);
  animation: pulse 0.9s ease-in-out infinite alternate;
}
[hidden] { display: none !important; }
@keyframes pulse { from { opacity: 0.25; } to { opacity: 1; } }

/* ---- 名札（園芸ラベル） ---- */
.tag {
  position: absolute; right: 26px; bottom: 160px;
  width: 226px;
  padding: 16px 16px 46px;
  background: var(--tag);
  color: var(--tag-ink);
  font-family: var(--hand);
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 34px), 50% 100%, 0 calc(100% - 34px));
  transform: rotate(-2.2deg);
  transform-origin: 50% 100%;
  filter: drop-shadow(0 6px 10px rgba(31, 36, 32, 0.18));
}
.tag::before { /* つるした穴でなく、さし込む札なので上は平ら。うすい罫線だけ */
  content: ''; position: absolute; left: 14px; right: 14px; top: 66px; height: 1px;
  background: repeating-linear-gradient(90deg, #A9B0AA 0 6px, transparent 6px 10px);
}
.tag-name { margin: 0 0 12px; font-size: 20px; font-weight: 600; line-height: 1.2; min-height: 26px; }
.tag-name small { display: block; font-size: 13px; font-weight: 400; color: #59625B; margin-top: 2px; }
.tag-rows { margin: 0; display: grid; gap: 1px; }
.tag-rows > div { display: grid; grid-template-columns: 4.4em 1fr; align-items: baseline; }
.tag-rows dt { font-size: 13px; color: #59625B; }
.tag-rows dd { margin: 0; font-size: 14px; font-weight: 600; display: flex; gap: 8px; align-items: baseline; white-space: nowrap; }
.tag .num { font-size: 12px; font-weight: 400; color: #59625B; }
.dots { letter-spacing: 1px; font-size: 13px; color: var(--agave); }
.dots i { font-style: normal; color: #C9CFCA; }
.tag .warn { color: var(--kanuma); }

/* ---- 見本の棚 ---- */
.shelf {
  border-top: 1px solid rgba(31, 36, 32, 0.12);
  background: rgba(236, 237, 232, 0.55);
  backdrop-filter: blur(8px);
}
.shelf-head { display: flex; align-items: center; gap: 10px; padding: 8px 14px 0; }
.cats { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; flex: 1 1 auto; min-width: 0; }
.cats button {
  border: 0; background: none; padding: 4px 10px; font-size: 12.5px; border-radius: 999px; cursor: pointer; white-space: nowrap; color: var(--ink-2);
}
.cats button:hover { background: rgba(255, 255, 255, 0.5); }
.cats button[aria-selected="true"] { background: var(--ink); color: var(--lime); }
.dice {
  flex: 0 0 auto; border: 1px solid var(--agave); color: var(--agave); background: rgba(255, 255, 255, 0.6);
  border-radius: 999px; padding: 4px 12px; font-size: 12.5px; font-weight: 500; cursor: pointer; white-space: nowrap;
}
.dice:hover { background: var(--agave); color: var(--agave-ink); }
.shelf ul {
  list-style: none; margin: 0; padding: 6px 14px 10px;
  display: flex; gap: 4px; overflow-x: auto; scrollbar-width: thin;
}
.shelf button {
  display: grid; justify-items: center; gap: 2px;
  width: 92px; padding: 4px 2px 6px;
  border: 0; background: none; border-radius: var(--r-s);
  cursor: pointer;
}
.shelf img, .shelf .ph {
  width: 72px; height: 72px; display: block; object-fit: contain;
}
.shelf .ph { border-radius: 50%; background: radial-gradient(circle at 50% 60%, rgba(31,36,32,0.10), transparent 62%); }
.shelf .nm { font-size: 12.5px; font-weight: 500; line-height: 1.25; }
.shelf .md { font-size: 11px; color: var(--ink-2); line-height: 1.2; }
.shelf button:hover { background: rgba(255, 255, 255, 0.45); }
.shelf button[aria-pressed="true"] { background: #fff; box-shadow: inset 0 -3px 0 var(--agave); }
.shelf button[aria-pressed="true"] .nm { font-weight: 700; }

/* ---- 操作欄 ---- */
.panel {
  overflow-y: auto;
  border-left: 1px solid var(--rule);
  padding: 4px 22px 28px;
  scrollbar-width: thin;
}
.group { padding: 16px 0 18px; border-bottom: 1px solid var(--rule); }
.group h2 { font-size: 15px; font-weight: 700; letter-spacing: 0.04em; }
.field { margin: 0 0 12px; }
.field:empty { display: none; }
.field[hidden] { display: none; }
.label { display: block; font-size: 12.5px; color: var(--ink-2); margin-bottom: 5px; }
.hint { margin: 6px 0 0; font-size: 12px; color: var(--ink-2); line-height: 1.55; }
.hint.warn { color: #8A6413; }

.seg { display: flex; border: 1px solid var(--rule); border-radius: var(--r-s); background: var(--lime-2); padding: 2px; gap: 2px; }
.seg-wrap { flex-wrap: wrap; }
.seg-wrap button { flex: 1 0 auto; }
.seg button {
  flex: 1 1 auto; min-width: 0;
  border: 0; background: none; border-radius: 4px;
  padding: 6px 8px; font-size: 13px; cursor: pointer; white-space: nowrap;
}
.seg button:hover { background: rgba(255, 255, 255, 0.6); }
.seg button[aria-checked="true"] { background: var(--agave); color: var(--agave-ink); font-weight: 500; }
.seg button small { display: block; font-size: 10.5px; opacity: 0.8; line-height: 1.2; }

/* スライダー */
.sl { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 2px 10px; }
.sl label { font-size: 12.5px; color: var(--ink-2); }
.sl output { font-size: 13px; font-weight: 500; font-variant-numeric: tabular-nums; }
.sl input { grid-column: 1 / -1; width: 100%; margin: 2px 0 0; accent-color: var(--agave); height: 22px; }
.sl .hint { grid-column: 1 / -1; margin-top: 0; }

.tog { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13px; }
.tog input { width: 18px; height: 18px; accent-color: var(--agave); margin: 0; }

.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatches button {
  width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--lime); cursor: pointer;
  box-shadow: 0 0 0 1px var(--rule);
}
.swatches button[aria-checked="true"] { box-shadow: 0 0 0 2px var(--agave); }

.act {
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--ink); background: transparent; border-radius: var(--r-s);
  padding: 8px 14px; font-size: 13.5px; font-weight: 500; cursor: pointer;
}
.act:hover { background: rgba(31, 36, 32, 0.06); }
.act.primary { background: var(--ink); color: var(--lime); }
.act.primary:hover { background: #333a35; }
.act:disabled { opacity: 0.45; cursor: progress; }
#maxAir { width: 100%; margin-top: 4px; border-color: var(--agave); color: var(--agave); }
#maxAir:hover { background: var(--agave-soft); }
.save { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.save .primary { flex: 1 1 100%; }

.checks { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 4px; font-size: 12.5px; }
.checks li { display: grid; grid-template-columns: 16px 1fr; gap: 6px; line-height: 1.5; }
.checks li::before { content: '✓'; color: var(--agave); font-weight: 700; }
.checks li.ng::before { content: '!'; color: var(--kanuma); }
.checks li.ng { color: #6F5210; }
.checks li.pending { color: var(--ink-2); }
.checks li.pending::before { content: '…'; color: var(--ink-2); }

.costs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; margin: 4px 0 10px; }
.num-in { display: grid; gap: 2px; font-size: 12px; color: var(--ink-2); }
.num-in input { font: inherit; font-size: 13.5px; color: var(--ink); padding: 5px 8px; border: 1px solid var(--rule); border-radius: var(--r-s); background: #fff; width: 100%; font-variant-numeric: tabular-nums; }
.breakdown { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.breakdown th { text-align: left; font-weight: 400; color: var(--ink-2); padding: 3px 0; }
.breakdown td { text-align: right; padding: 3px 0; }
.breakdown td:nth-child(2) { color: var(--ink-2); font-size: 12px; padding-right: 10px; }
.breakdown tr.sum th, .breakdown tr.sum td { border-top: 1px solid var(--rule); font-weight: 700; color: var(--ink); padding-top: 5px; }
.sizes-pick { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 6px 0 10px; }
#listing { width: 100%; font: 12.5px/1.6 var(--font); padding: 8px 10px; border: 1px solid var(--rule); border-radius: var(--r-s); background: #fff; color: var(--ink); resize: vertical; margin-bottom: 6px; }
.copies { max-width: 220px; }
.file-btn { position: relative; }
.logo-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.logo-row .hint { flex: 1 1 100%; }
#embText { font: inherit; font-size: 14px; color: var(--ink); padding: 7px 9px; border: 1px solid var(--rule); border-radius: var(--r-s); background: #fff; width: 100%; }
.bar { align-items: center; }
.bar-act { margin-left: auto; display: flex; gap: 6px; }
.act.small { padding: 4px 10px; font-size: 12.5px; }
h3.sub { font-size: 13.5px; margin: 18px 0 4px; }
dialog { border: 0; border-radius: 10px; padding: 18px 20px 20px; width: min(560px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); background: var(--lime); color: var(--ink); box-shadow: 0 20px 60px rgba(31, 36, 32, 0.3); }
dialog::backdrop { background: rgba(31, 36, 32, 0.4); }
.dlg-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.dlg-head h2 { margin: 0; font-size: 17px; }
.lib { list-style: none; margin: 12px 0; padding: 0; display: grid; gap: 8px; max-height: 56dvh; overflow-y: auto; }
.lib li { display: grid; grid-template-columns: 64px 1fr auto; gap: 10px; align-items: center; background: #fff; border-radius: 8px; padding: 6px 10px 6px 6px; }
.lib li.empty { display: block; background: none; color: var(--ink-2); font-size: 13px; padding: 8px 0; }
.lib img { width: 64px; height: 64px; border-radius: 6px; }
.lib-meta { display: grid; font-size: 12px; color: var(--ink-2); }
.lib-meta strong { font-size: 14px; color: var(--ink); }
.lib-act { display: flex; gap: 6px; }
#orderText { width: 100%; font: 13px/1.6 var(--font); padding: 8px 10px; border: 1px solid var(--rule); border-radius: var(--r-s); background: #fff; margin: 8px 0; }
.order-bar { position: absolute; left: 16px; top: 52px; }
.shop-only { display: none; }
.shop .shop-only { display: block; }
.shop .seller, .shop .seller-lite { display: none !important; }
.shop.no-emb .group:has(#fEmbOn) { display: none; }
.steps { margin: 12px 0; padding-left: 1.4em; display: grid; gap: 8px; font-size: 13.5px; line-height: 1.65; }
.steps strong { font-weight: 700; }
.group h2 { margin: 0; }
.g-toggle {
  all: unset; box-sizing: border-box; width: 100%; display: flex; align-items: center; justify-content: space-between;
  font-size: 15px; font-weight: 700; letter-spacing: 0.04em; cursor: pointer; padding: 2px 0;
}
.g-toggle::after { content: ''; width: 8px; height: 8px; border-right: 2px solid var(--ink-2); border-bottom: 2px solid var(--ink-2); transform: rotate(45deg); margin-right: 4px; transition: transform 0.15s; }
.g-toggle[aria-expanded="false"]::after { transform: rotate(-45deg); }
.g-toggle:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.group-body { padding-top: 12px; }
.group.closed { padding-bottom: 14px; }
@media (prefers-reduced-motion: reduce) { .g-toggle::after { transition: none; } }
.checklist { margin: 6px 0 0; padding-left: 1.2em; display: grid; gap: 4px; font-size: 13px; line-height: 1.6; }
.foot { padding: 18px 0 0; font-size: 12px; color: var(--ink-2); }
.foot p { margin: 0 0 8px; max-width: 34em; }

.thumb-stage { position: fixed; left: -10000px; top: 0; width: 192px; height: 192px; pointer-events: none; }
.thumb-stage canvas { width: 192px; height: 192px; }

/* ---- スマホ ---- */
@media (max-width: 880px) {
  .lede { display: none; }
  .logo, .bar-act .act { white-space: nowrap; }
  .bar { padding: 8px 12px; }
  .order-bar { top: 48px; left: 12px; }
  body { display: block; height: auto; }
  .app { display: block; }
  .stage { grid-template-rows: 58svh auto auto; }
  .tag {
    position: relative; right: auto; bottom: auto; transform: none;
    width: auto; margin: 0; clip-path: none; padding: 14px 16px;
    filter: none; border-bottom: 1px solid var(--rule);
  }
  .tag::before { top: 60px; }
  .tag-rows { grid-template-columns: 1fr; }
  .panel { border-left: 0; padding: 0 16px 32px; overflow: visible; }
  .stage-tools { left: 12px; top: 10px; }
  /* お客様用ページ（?shop= と注文サイト）：3D を上に貼りつけたまま、名札・見本・設定を下で動かせる */
  .shop .stage { display: contents; }
  .shop .view-wrap {
    position: sticky; top: 0; z-index: 20; height: 44svh;
    background: radial-gradient(120% 80% at 50% 38%, #D6D9D3 0%, var(--pumice) 55%, var(--pumice-deep) 100%);
    border-bottom: 1px solid var(--rule); box-shadow: 0 6px 14px rgba(31, 36, 32, 0.12);
  }
  .shop .shelf { background: var(--lime); }
  .shop .mini-tag:not(:empty) { display: block; position: absolute; left: 12px; bottom: 10px; margin: 0; padding: 4px 10px; border-radius: 99px; background: rgba(250, 250, 245, 0.9); font-size: 12.5px; font-weight: 600; color: var(--tag-ink); max-width: calc(100% - 24px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .shop .panel .group { scroll-margin-top: calc(44svh + 8px); } /* 見出しへ飛んでも 貼りついた 3D の下に隠れない */
}
@media (prefers-reduced-motion: reduce) {
  .busy::before { animation: none; }
}

/* 色分け（AMS） */
.ams-colors { display: flex; flex-wrap: wrap; gap: 10px 16px; margin: 4px 0 6px; }
.ams-colors label { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.ams-colors input[type="color"] { width: 30px; height: 30px; padding: 0; border: 1px solid var(--line, #ccc); border-radius: 50%; background: none; cursor: pointer; }
.ams-colors input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.ams-colors input[type="color"]::-webkit-color-swatch { border: none; border-radius: 50%; }

/* ---------- 注文サイト（hachigata-order）。<meta name="hg-order"> のときだけ body に order-site ---------- */
.order-only { display: none; }
.order-site .order-only:not([hidden]) { display: block; }
.order-site .tag-note:not([hidden]) { display: -webkit-box; }
.order-site .copy-only { display: none; }
body.shop.order-site .seller-lite { display: block !important; } /* 通気と水はけ・底も お客様が選べる */
.order-site .logo-row { display: none; } /* ロゴの画像は注文で送れないので 文字だけ */
/* お店のお知らせ：3D に重ならないよう 名札の値段の下に 3行まで（全文は注文の窓に） */
.tag-note { margin: 8px 0 0; padding-top: 6px; border-top: 1px dashed #C9CCC0; font-size: 12px; line-height: 1.55; color: var(--tag-ink); white-space: pre-line; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.shop-note { margin: 0; padding: 8px 10px; border-radius: 8px; background: #fff; font-size: 13px; line-height: 1.6; white-space: pre-line; }
.order-form { gap: 10px; margin-top: 6px; } /* 見せるのは注文サイトの時だけ（下の .order-site …） */
.order-site .order-form:not([hidden]) { display: grid; }
.of-row { display: grid; gap: 4px; font-size: 13.5px; font-weight: 700; }
.of-row input[type="text"], .of-row select, .of-row textarea { font: inherit; font-size: 15px; font-weight: 400; color: var(--ink); padding: 8px 10px; border: 1px solid var(--rule); border-radius: var(--r-s); background: #fff; width: 100%; box-sizing: border-box; }
.of-radios { display: flex; flex-wrap: wrap; gap: 4px 14px; font-weight: 400; }
.of-agree { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; line-height: 1.6; }
.of-agree input { margin-top: 4px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.linklike { all: unset; color: var(--focus, #2a6); text-decoration: underline; cursor: pointer; margin-left: 4px; }
.warn-box { margin: 0; padding: 8px 10px; border-radius: 8px; background: #fff4e0; color: #7a4a00; font-size: 13px; line-height: 1.6; }
.order-done .done-no { font-size: 15px; margin: 10px 0 4px; }
.order-done .done-no strong { font-size: 22px; letter-spacing: 0.08em; }
.law-text { white-space: pre-line; font-size: 13.5px; line-height: 1.8; margin-top: 10px; max-height: 60dvh; overflow-y: auto; }
#orderBtn:disabled { opacity: 0.55; cursor: not-allowed; }
