/* リッチメニュー画像の設定表（/richmenu-check/）。上に全体図、下にボタンごとの切り抜きと入力、最後に設定表と書き出し */
[hidden] { display: none !important; }
.rm { --r-line: var(--hairline, #e5e7eb); --r-acc: var(--accent, #b45309); --r-soft: var(--ink-soft, #4b5563); --r-line-g: #06c755;
  border: 1px solid var(--r-line); background: var(--panel, #fff); padding: 18px; margin-bottom: 8px; position: relative; }
.rm.is-drag { outline: 2px dashed var(--r-acc); outline-offset: -8px; }
.rm.is-drag::after { content: attr(data-drop); position: absolute; inset: 0; display: grid; place-items: center; background: rgba(31,41,55,.78); color: #fff; font-size: 16px; font-weight: 700; z-index: 5; }

/* 読み込みの帯 */
.rm-in { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 0 0 14px; border-bottom: 1px solid var(--r-line); margin-bottom: 14px; }
.rm-file { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.rm-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 18px; border: 1px solid var(--r-acc); background: var(--r-acc); color: #fff;
  font-family: inherit; font-size: 15px; font-weight: 700; line-height: 1.2; text-align: center; text-decoration: none; cursor: pointer; transition: transform .08s ease, background-color .15s; }
.rm-btn:hover { background: var(--accent-dark, #92400e); color: #fff; }
.rm-btn:active { transform: scale(.97); }
.rm-btn.sub { background: #fff; color: var(--ink, #1f2937); border-color: var(--hairline-strong, #d1d5db); font-weight: 500; }
.rm-btn.sub:hover { border-color: var(--r-acc); color: var(--r-acc); }
.rm-btn.is-done, .rm-btn.sub.is-done { background: var(--ok, #2e7d43); border-color: var(--ok, #2e7d43); color: #fff; }
.rm-btn[disabled] { opacity: .65; cursor: progress; }
label.rm-btn:focus-within { outline: 2px solid var(--r-acc); outline-offset: 2px; }
.rm-in-t { margin: 0; font-size: 13px; line-height: 1.6; color: var(--r-soft); flex: 1 1 220px; }
.rm-in-t b { color: var(--ink, #1f2937); font-size: 15px; display: block; }
.rm-samples { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12px; color: var(--r-soft); }
.rm-samples button { min-height: 36px; padding: 0 12px; border: 1px solid var(--hairline-strong, #d1d5db); background: #fff; font: inherit; font-size: 13px; color: var(--ink, #1f2937); cursor: pointer; }
.rm-samples button[aria-pressed="true"] { border-color: var(--ink, #1f2937); box-shadow: inset 0 0 0 1px var(--ink, #1f2937); font-weight: 700; }

/* 完成例（元画像→境界の確認→設定表）。OG 画像と同じ1枚 */
.rm-demo { flex: 1 1 100%; margin: 4px 0 0; }
.rm-demo img { display: block; width: 100%; height: auto; border: 1px solid var(--r-line); }
.rm-demo figcaption { display: grid; grid-template-columns: 372fr 372fr 408fr; align-items: baseline; gap: 2px 0; padding: 6px 0 0 4%; font-size: 12px; font-weight: 700; color: var(--ink, #1f2937); }
.rm-demo figcaption span::before { content: counter(rm-step) " "; counter-increment: rm-step; font: 500 11px/1 var(--mono); color: var(--r-acc); }
.rm-demo figcaption { counter-reset: rm-step; }
.rm-demo figcaption a { grid-column: 1 / -1; justify-self: start; margin-left: -4%; font-weight: 500; font-size: 13px; color: var(--r-acc); }
/* 広い画面では、選ぶボタン・説明・見本の右に完成例を置き、操作欄を押し下げない */
@media (min-width: 861px) {
  .rm-in { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); grid-template-rows: auto auto 1fr; align-items: start; gap: 12px 20px; }
  .rm-in > .rm-btn, .rm-in-t, .rm-samples { grid-column: 1; }
  .rm-demo { grid-column: 2; grid-row: 1 / 4; margin: 0; }
}
/* 図の中の見出しが読める幅では、下の見出しは重複なので出さない */
@media (min-width: 561px) { .rm-demo figcaption span { display: none; } }

/* 型と余白 */
.rm-bar { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 6px 24px; margin-bottom: 12px; }
.rm-row { display: grid; grid-template-columns: 5.6em minmax(0, 1fr); align-items: center; gap: 10px; min-height: 44px; font-size: 14px; }
.rm-row > span { font-size: 12px; font-weight: 700; color: var(--r-soft); letter-spacing: .04em; }
.rm-seg { display: flex; }
.rm-seg button { flex: 1 1 0; min-height: 44px; padding: 4px 8px; border: 1px solid var(--hairline-strong, #d1d5db); background: #fff; font: inherit; font-size: 14px; font-weight: 700; color: var(--ink, #1f2937); cursor: pointer; line-height: 1.25; }
.rm-seg button small { display: block; font: 500 11px/1.2 var(--mono); color: var(--r-soft); }
.rm-seg button + button { border-left: 0; }
.rm-seg button[aria-pressed="true"] { background: var(--ink, #1f2937); color: #fff; border-color: var(--ink, #1f2937); }
.rm-seg button[aria-pressed="true"] small { color: rgba(255,255,255,.75); }
.rm-colors { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.rm-colors button { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 10px 0 6px; border: 1px solid var(--hairline-strong, #d1d5db); background: #fff; font: inherit; font-size: 13px; color: var(--ink, #1f2937); cursor: pointer; }
.rm-colors button::before { content: ""; width: 20px; height: 20px; border-radius: 50%; background: var(--c, #fff); box-shadow: inset 0 0 0 1px rgba(0,0,0,.18); }
.rm-colors button[aria-pressed="true"] { border-color: var(--ink, #1f2937); box-shadow: inset 0 0 0 1px var(--ink, #1f2937); font-weight: 700; }
.rm-colors label { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--r-soft); cursor: pointer; }
.rm-colors input[type=color] { width: 34px; height: 30px; padding: 0; border: 1px solid var(--hairline-strong, #d1d5db); background: #fff; cursor: pointer; }

/* 全体図 */
.rm-pane-h { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin: 0 0 6px; font-size: 13px; font-weight: 700; }
.rm-pane-h span { font: 500 11px/1.3 var(--mono); color: var(--r-soft); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.rm-ov-box { background: #fff repeating-conic-gradient(#eceae5 0 25%, #fff 0 50%) 0 0 / 16px 16px; border: 1px solid var(--r-line); }
#rm-ov { display: block; width: 100%; height: auto; }
.rm-fit { margin: 8px 0 0; font-size: 13px; line-height: 1.6; color: var(--r-soft); }
.rm-fit.is-pad::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 6px; background: var(--r-acc); vertical-align: 1px; }
.rm-msg { margin: 4px 0 0; min-height: 1.4em; font-size: 13px; line-height: 1.6; color: var(--ok, #2e7d43); }
.rm-msg.is-bad { color: #9a3412; }

/* スマホの移動ボタン（A〜F・設定表へ）。上の共通ヘッダーの下に貼りつき、右下のチャットのボタンと重ならない */
.rm-jump { display: none; }
.rm-cell, #result { scroll-margin-top: calc(var(--rm-nav-h, 60px) + 64px); }

/* ボタンごと */
.rm-cells-h { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 16px 0 10px; padding-top: 14px; border-top: 1px solid var(--r-line); }
.rm-cells-h h3 { margin: 0; font-size: 15px; flex: 1 1 auto; }
.rm-title { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--r-soft); white-space: nowrap; }
.rm-title input { width: 13em; min-height: 36px; padding: 0 8px; border: 1px solid var(--hairline-strong, #d1d5db); font: inherit; font-size: 14px; color: var(--ink, #1f2937); }
.rm-clear { min-height: 36px; padding: 0 10px; border: 1px solid var(--hairline-strong, #d1d5db); background: #fff; font: inherit; font-size: 12px; color: var(--r-soft); cursor: pointer; }
.rm-clear:hover { color: var(--r-acc); border-color: var(--r-acc); }
.rm-cells { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.rm-cells.is-small { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.rm-cell { min-width: 0; display: flex; flex-direction: column; gap: 8px; padding-bottom: 12px; border-bottom: 1px solid var(--r-line); }
.rm-cell-h { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.rm-id { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--r-line-g); color: #fff; font-weight: 700; font-size: 14px; }
.rm-pos { font-weight: 700; }
.rm-area { margin-left: auto; font: 500 10.5px/1.2 var(--mono); color: var(--r-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.rm-crop { display: block; width: 100%; height: auto; border: 1px solid var(--r-line); background: #fff; }
.rm-f { display: grid; gap: 3px; font-size: 12px; color: var(--r-soft); }
.rm-f select, .rm-f input, .rm-f textarea { width: 100%; box-sizing: border-box; min-height: 40px; padding: 6px 8px; border: 1px solid var(--hairline-strong, #d1d5db); background: #fff; font: inherit; font-size: 14px; color: var(--ink, #1f2937); border-radius: 0; }
.rm-f input { font-family: var(--mono); font-size: 13px; }
.rm-f textarea { resize: vertical; min-height: 56px; line-height: 1.5; }
.rm-f input:disabled { background: #f3f4f6; color: #9ca3af; }
.rm-cell.is-none .rm-crop { opacity: .55; }
.rm-hint, .rm-hints { margin: 0; font-size: 12px; line-height: 1.5; color: #9a3412; }
.rm-hints { margin-top: 10px; padding: 8px 10px; background: #fff7ed; }

/* 結果と書き出し */
.rm-out { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 18px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--r-line); }
.rm-out h3 { margin: 0 0 6px; font-size: 15px; }
.rm-sheet-box { max-height: 640px; overflow: auto; border: 1px solid var(--r-line); background: #f6f4ef; padding: 10px; }
#rm-sheet { display: block; width: 100%; height: auto; box-shadow: 0 1px 3px rgba(0,0,0,.12); cursor: zoom-in; }
.rm-zoom-go { width: 100%; margin-top: 8px; }

/* 設定表の拡大（原寸の画像を全行。狭い画面でも文字が読める幅を保ち、はみ出す分は横に送る） */
.rm-zoom { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; padding: 0; border: 0; background: #f6f4ef; }
.rm-zoom[open] { display: flex; flex-direction: column; }
.rm-zoom::backdrop { background: rgba(31,41,55,.6); }
.rm-zoom-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; background: #fff; border-bottom: 1px solid var(--r-line, #e5e7eb); }
.rm-zoom-bar p { margin: 0; font-size: 14px; font-weight: 700; line-height: 1.4; }
.rm-zoom-bar p span { display: block; font-size: 12px; font-weight: 400; color: var(--r-soft, #4b5563); }
.rm-zoom-bar .rm-btn { flex: 0 0 auto; min-height: 44px; }
.rm-zoom-body { flex: 1 1 auto; overflow: auto; padding: 14px; -webkit-overflow-scrolling: touch; }
.rm-zoom-bar div { display: flex; gap: 8px; }
.rm-zoom.is-fit .rm-zoom-body canvas { width: 100%; }
.rm-zoom-body canvas { display: block; width: max(100%, 720px); max-width: 1080px; height: auto; margin: 0 auto; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.rm-acts { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.rm-acts > .rm-btn { width: 100%; }
.rm-mark { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--r-soft); }
.rm-textd summary { cursor: pointer; font-size: 13px; color: var(--r-soft); min-height: 32px; display: flex; align-items: center; }
.rm-textd textarea { width: 100%; box-sizing: border-box; margin-top: 6px; padding: 8px; border: 1px solid var(--r-line); font: 12.5px/1.6 var(--mono); color: var(--ink, #1f2937); background: #fafafa; resize: vertical; }
.rm-jpg { margin-top: 6px; padding: 14px; background: #f6f4ef; display: grid; gap: 8px; }
.rm-jpg > p { margin: 0; font-size: 13px; line-height: 1.6; color: var(--r-soft); }
.rm-prog { height: 6px; background: #e7e2d7; overflow: hidden; }
.rm-prog span { display: block; height: 100%; background: var(--r-acc); transform: scaleX(0); transform-origin: left; transition: transform .2s ease; }
.rm-jpg.is-done .rm-prog span { background: var(--ok, #2e7d43); }
.rm-jpg-msg { margin: 0; min-height: 1.4em; font-size: 13px; line-height: 1.6; color: var(--ink, #1f2937); }
.rm-jpg-msg.is-bad { color: #9a3412; }
.rm-jpg dl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 12px; margin: 0 0 8px; font-size: 13px; }
.rm-jpg dt { color: var(--r-soft); }
.rm-jpg dd { margin: 0; font: 500 15px/1.4 var(--mono); color: var(--ink, #1f2937); overflow-wrap: anywhere; }
.rm-jpg dd.is-over { color: #9a3412; }
.rm-jpg-res { display: grid; gap: 8px; }
.rm-src { margin: 0; font-size: 12px; line-height: 1.7; color: var(--r-soft); }
.rm-src a { color: inherit; }
.rm-fine { margin: 14px 0 0; font-size: 12px; line-height: 1.7; color: var(--r-soft); }
.rm-all { margin: 14px 0 0; font-size: 14px; }
.rm-about-h { margin: 18px 0 6px; font-size: 15px; }
.rm-about-h:first-of-type { margin-top: 4px; }

@media (max-width: 860px) {
  .rm { padding: 14px; }
  .rm-jump { position: sticky; top: var(--rm-nav-h, 60px); z-index: 20; display: flex; gap: 6px; margin: 0 -14px 4px; padding: 8px 14px; background: rgba(255,255,255,.96);
    border-bottom: 1px solid var(--r-line); }
  .rm-jump button { flex: 1 1 0; min-width: 0; max-width: 64px; min-height: 44px; padding: 0 4px; border: 1px solid var(--hairline-strong, #d1d5db); background: #fff; font-family: inherit; font-size: 15px; font-weight: 700; line-height: 1; color: var(--ink, #1f2937); cursor: pointer; }
  .rm-jump button.is-here { border-color: var(--r-line-g); background: var(--r-line-g); color: #fff; }
  .rm-jump .rm-jump-out { flex: 0 0 auto; max-width: none; margin-left: auto; padding: 0 10px; font-size: 14px; border-color: var(--r-acc); color: var(--r-acc); }
  .rm-jump .rm-jump-out.is-here { background: var(--r-acc); border-color: var(--r-acc); color: #fff; }
  .rm-bar { grid-template-columns: minmax(0, 1fr); }
  .rm-cells { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rm-out { grid-template-columns: minmax(0, 1fr); }
  .rm-sheet-box { max-height: 520px; }
}
@media (max-width: 560px) {
  .rm { padding: 12px; }
  .rm-cells, .rm-cells.is-small { grid-template-columns: minmax(0, 1fr); }
  .rm-in .rm-btn { flex: 1 1 100%; }
  .rm-row { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .rm-title { width: 100%; }
  .rm-title input { flex: 1 1 auto; width: auto; min-width: 0; }
  .rm-jump { margin: 0 -12px 4px; padding: 6px 12px; gap: 4px; }
  .rm-demo figcaption { font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) {
  .rm-btn, .rm-prog span { transition: none; }
  html { scroll-behavior: auto; }
}
