/* ==========================================================================
   お品書キングダム スタイルシート (Ver.1.02)
   ========================================================================== */

/* ---------- カラーテーマ定義 (初期値: ダークモード) ---------- */
:root,
body[data-ui-theme="dark"] {
  /* 落ち着いた深濃紺＆ブルー系（トーンダウン Ver.0.22） */
  --pink: #3b82f6;
  --pink2: #60a5fa;
  --pink-soft: rgba(59, 130, 246, 0.16);
  --bg: #070b14;
  --panel: #0d1322;
  --panel-alt: #121b30;
  --panel-2: var(--panel-alt);
  --line: #1a2640;
  --border: var(--line);
  --line-strong: #25375c;
  --text: #e2e8f5;
  --text-muted: #8397b8;
  --text-sub: var(--text-muted);
  --muted: #6b80a0;
  --accent-dark: #050810;
  --btn-bg: #162038;
  --btn-border: #233252;
  --btn-hover-bg: #1d2b4a;
  --btn-hover-text: #ffffff;
  --input-bg: #0a0f1d;
  --input-border: #1e2c48;
  --panel-nested: #090e1a;
  --stage-bg: #050810;
  --toolbar-bg: #0c1220;
  --placed-bg: #0c1220;
  --chip-bg: #162038;
  --chip-active-bg: #3b82f6;
  --modal-bg: #0d1322;
  --modal-head-bg: #131c32;
  --modal-foot-bg: #0a0f1d;
  --dropzone-bg: #0a0f1d;
  --dropzone-border: #233252;
  --card-bg-sample: #162038;
  --scrollbar-thumb: #233252;
}

body[data-ui-theme="classic"] {
  /* クラシックダーク（赤紫系・旧標準 Ver.0.22復活） */
  --pink: #e4007f;
  --pink2: #ff409f;
  --pink-soft: rgba(228, 0, 127, 0.16);
  --bg: #161219;
  --panel: #201a24;
  --panel-alt: #2a2230;
  --panel-2: var(--panel-alt);
  --line: #3a2e42;
  --border: var(--line);
  --line-strong: #503e5c;
  --text: #f5eff8;
  --text-muted: #bda8c5;
  --text-sub: var(--text-muted);
  --muted: #a38eb0;
  --accent-dark: #120e14;
  --btn-bg: #2d2434;
  --btn-border: #443550;
  --btn-hover-bg: #3b2f44;
  --btn-hover-text: #ffffff;
  --input-bg: #1b1520;
  --input-border: #443550;
  --panel-nested: #19141f;
  --stage-bg: #120e14;
  --toolbar-bg: #1d1722;
  --placed-bg: #1d1722;
  --chip-bg: #2d2434;
  --chip-active-bg: #e4007f;
  --modal-bg: #201a24;
  --modal-head-bg: #2a2230;
  --modal-foot-bg: #1b1520;
  --dropzone-bg: #1a1420;
  --dropzone-border: #443550;
  --card-bg-sample: #2d2434;
  --scrollbar-thumb: #443550;
}

body[data-ui-theme="light"] {
  --pink: #0099cc;
  --pink2: #33b5e5;
  --pink-soft: #f0f9ff;
  --bg: #f4f7fb;
  --panel: #ffffff;
  --panel-alt: #f8fafc;
  --panel-2: var(--panel-alt);
  --line: #d8e2ec;
  --border: var(--line);
  --line-strong: #c2d1e0;
  --text: #1a2332;
  --text-muted: #576579;
  --text-sub: var(--text-muted);
  --muted: #728298;
  --accent-dark: #0f2742;
  --btn-bg: #ffffff;
  --btn-border: #d8e2ec;
  --btn-hover-bg: #f0f7ff;
  --btn-hover-text: #0099cc;
  --input-bg: #ffffff;
  --input-border: #b8c7d9;
  --panel-nested: #edf2f7;
  --stage-bg: #e2e8f0;
  --toolbar-bg: #ffffff;
  --placed-bg: #ffffff;
  --chip-bg: #eaf1f8;
  --chip-active-bg: #0099cc;
  --modal-bg: #ffffff;
  --modal-head-bg: #1a2a42;
  --modal-foot-bg: #f8fafc;
  --dropzone-bg: #f8fafc;
  --dropzone-border: #c2d1e0;
  --card-bg-sample: #ffffff;
  --scrollbar-thumb: #cbd5e1;
}

body[data-ui-theme="slate"] {
  --pink: #9d72ff;
  --pink2: #bca0ff;
  --pink-soft: rgba(157, 114, 255, 0.16);
  --bg: #121316;
  --panel: #1c1d22;
  --panel-alt: #24252c;
  --panel-2: var(--panel-alt);
  --line: #2e3038;
  --border: var(--line);
  --line-strong: #40434e;
  --text: #f2f3f5;
  --text-muted: #9aa0ac;
  --text-sub: var(--text-muted);
  --muted: #848a96;
  --accent-dark: #0d0e10;
  --btn-bg: #24262d;
  --btn-border: #353742;
  --btn-hover-bg: #2f313a;
  --btn-hover-text: #ffffff;
  --input-bg: #17181c;
  --input-border: #333540;
  --panel-nested: #141518;
  --stage-bg: #0a0b0d;
  --toolbar-bg: #18191e;
  --placed-bg: #18191e;
  --chip-bg: #25272e;
  --chip-active-bg: #9d72ff;
  --modal-bg: #1c1d22;
  --modal-head-bg: #26272e;
  --modal-foot-bg: #16171b;
  --dropzone-bg: #16171b;
  --dropzone-border: #353742;
  --card-bg-sample: #24262d;
  --scrollbar-thumb: #3e414c;
}

/* ---------- ステージ背景バリエーション ---------- */
body[data-stage-bg="stage-black"] .center { background: #000000 !important; }
body[data-stage-bg="stage-dark"] .center { background: var(--stage-bg) !important; }
body[data-stage-bg="stage-light"] .center { background: #f0ecf2 !important; }
body[data-stage-bg="stage-checker"] .center {
  background-color: #171720 !important;
  background-image: linear-gradient(45deg, #222230 25%, transparent 25%),
                    linear-gradient(-45deg, #222230 25%, transparent 25%),
                    linear-gradient(45deg, transparent 75%, #222230 75%),
                    linear-gradient(-45deg, transparent 75%, #222230 75%) !important;
  background-size: 24px 24px !important;
  background-position: 0 0, 0 12px, 12px -12px, -12px 0px !important;
}

/* ---------- 基本リセット＆タイポグラフィ ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Noto Sans JP", "Yu Gothic UI", "Hiragino Sans", Meiryo, sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: 13px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  user-select: none;
}
button, .btn, input, select, textarea { font: inherit; }
button, .btn {
  border: 1px solid var(--btn-border);
  background: var(--btn-bg);
  color: var(--text);
  padding: 6px 11px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: all .15s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  justify-content: center;
  font-weight: 600;
}
button:hover, .btn:hover {
  border-color: var(--pink2);
  color: var(--pink);
  background: var(--btn-hover-bg);
}
button:active, .btn:active { transform: translateY(1px); }
button:disabled, .btn:disabled, button[disabled], .btn[disabled] {
  opacity: 0.42;
  cursor: not-allowed !important;
  pointer-events: none !important;
  transform: none !important;
  filter: grayscale(0.5);
}
/* ボタンの視覚的階層化 (UI_GUIDELINES.md Ver.0.25) */
button.primary, .btn.primary {
  background: var(--pink) !important;
  color: #ffffff !important;
  border: 1px solid transparent !important;
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
button.primary:hover, .btn.primary:hover {
  filter: brightness(1.1);
  color: #ffffff !important;
}

/* 最上位アクション（グラデーション強調） */
button.gradate, .btn.gradate {
  background: linear-gradient(135deg, var(--pink), var(--pink2)) !important;
  color: #ffffff !important;
  border: none !important;
  font-weight: 800;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25), 0 0 10px var(--pink-soft) !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  transition: all 0.15s ease;
}
button.gradate:hover, .btn.gradate:hover {
  filter: brightness(1.12);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35), 0 0 14px var(--pink-soft) !important;
  transform: translateY(-1px);
}

/* 危険・破壊的操作ボタン (CUD対応 朱赤) */
button.danger, .btn.danger {
  color: #ff4b00 !important;
  border: 1px solid rgba(255, 75, 0, 0.45) !important;
  background: rgba(255, 75, 0, 0.1) !important;
}
button.danger:hover, .btn.danger:hover {
  background: #ff4b00 !important;
  color: #ffffff !important;
  border-color: #ff4b00 !important;
}

/* ピル型（角丸）ボタンスタイル */
button.rounded, .btn.rounded {
  border-radius: 999px !important;
  padding-left: 10px !important;
  padding-right: 10px !important;
}
button.sm, .btn.sm {
  padding: 3px 8px;
  font-size: 11px;
  border-radius: 6px;
}
button.full { width: 100%; margin-top: 6px; }
input, select, textarea {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--input-border);
  border-radius: 6px;
  background: var(--input-bg);
  color: var(--text);
  user-select: text;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--pink2);
  border-color: var(--pink);
}
input[type=color] {
  padding: 2px;
  height: 30px;
  width: 44px;
  cursor: pointer;
  flex-shrink: 0;
  border: 1px solid var(--input-border);
  border-radius: 6px;
  background: var(--input-bg);
}
input[type=range] {
  padding: 0;
  accent-color: var(--pink);
  border: none;
  background: transparent;
}
input[type=checkbox] {
  width: 15px;
  height: 15px;
  accent-color: var(--pink);
  cursor: pointer;
  margin: 0;
}

/* スクロールバー */
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--line-strong);
}

/* ---------- トップバー ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 16px;
  background: #18191c;
  color: #e5e7eb;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.45);
  z-index: 20;
  border-bottom: 1px solid #28292e;
}
.logo {
  font-size: 18px;
  white-space: nowrap;
  display: flex;
  align-items: baseline;
  gap: 4px;
}
.logo b {
  font-weight: 900;
  letter-spacing: .04em;
  background: linear-gradient(90deg, #ffd86b, #ff8ac4);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.logo span {
  font-size: 12px;
  margin-left: 4px;
  opacity: .88;
}
.logo .ver-badge,
.ver-badge {
  font-size: 10px;
  background: rgba(255,255,255,0.16);
  border: 1px solid rgba(255,255,255,0.28);
  padding: 1px 7px;
  border-radius: 99px;
  margin-left: 6px;
  color: #ffd86b;
  font-weight: 700;
}
.topbar-links {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: 10px;
}
.topbar-link-btn {
  background: transparent;
  border: none;
  color: #ffc4e1;
  font-size: 11px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  text-decoration: underline;
  text-underline-offset: 3px;
  opacity: .88;
  transition: all .15s ease;
}
.topbar-link-btn:hover {
  opacity: 1;
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
}
.topbar-center-space {
  flex: 1;
}
.actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.actions button, .actions .btn {
  background: rgba(255,255,255,.10);
  color: #fff;
  border-color: rgba(255,255,255,.22);
  font-size: 12px;
  padding: 5px 10px;
}
.actions button:hover, .actions .btn:hover {
  background: rgba(255,255,255,.22);
  border-color: #ff8ac4;
  color: #fff;
}
.actions button.primary {
  background: linear-gradient(135deg, var(--pink), var(--pink2));
  border: none;
}

/* ---------- メイン3カラムレイアウト（幅自由リサイズ & 折り畳み対応） ---------- */
.app {
  flex: 1;
  display: grid;
  grid-template-columns: var(--left-width, 320px) 5px 1fr 5px var(--right-width, 340px);
  min-height: 0;
  transition: grid-template-columns .22s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}
.app.resizing {
  transition: none !important;
  user-select: none;
}
.app.left-collapsed {
  grid-template-columns: 0px 0px 1fr 5px var(--right-width, 340px);
}
.app.right-collapsed {
  grid-template-columns: var(--left-width, 320px) 5px 1fr 0px 0px;
}
.app.left-collapsed.right-collapsed {
  grid-template-columns: 0px 0px 1fr 0px 0px;
}

/* スプリッター（リサイズハンドル） */
.resizer {
  width: 5px;
  background: var(--line);
  cursor: col-resize;
  position: relative;
  z-index: 20;
  transition: background .15s ease;
  user-select: none;
}
.resizer:hover, .resizer.dragging {
  background: var(--pink);
  box-shadow: 0 0 5px var(--pink);
}
/* 水平スプリッター（左ペイン アイテム一覧/POPパネル高さ調整 Ver.0.67） */
.resizer-h {
  height: 5px;
  background: var(--line);
  cursor: row-resize;
  position: relative;
  z-index: 15;
  transition: background .15s ease;
  user-select: none;
  flex-shrink: 0;
}
.resizer-h:hover, .resizer-h.dragging {
  background: var(--pink);
  box-shadow: 0 0 5px var(--pink);
}
.app.left-collapsed #resizerLeft,
.app.right-collapsed #resizerRight {
  width: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
  overflow: hidden !important;
}

.left, .right {
  background: var(--panel);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  min-height: 0;
  min-width: 0;
  transition: opacity .18s ease, visibility .18s ease;
}
.left {
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
}
.right {
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
}
.app.left-collapsed .left,
.app.right-collapsed .right {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.panel {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.panel.grow {
  flex: 1;
  min-height: 220px;
}
h2 {
  font-size: 13.5px;
  margin: 0 0 2px;
  color: var(--pink);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
h2 small {
  color: var(--muted);
  font-weight: 600;
  font-size: 11px;
}
h3 {
  font-size: 12.5px;
  margin: 12px 0 5px;
  padding-left: 8px;
  border-left: 4px solid var(--pink);
  color: var(--text);
  font-weight: 800;
}
h3:first-child { margin-top: 2px; }
.hint {
  color: var(--muted);
  font-size: 11px;
  margin: 0;
  line-height: 1.4;
}
.row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.price-input {
  display: flex;
  align-items: center;
  gap: 6px;
}
.price-input span {
  font-weight: 700;
  color: var(--text);
  flex-shrink: 0;
}

/* ---------- ドロップゾーン ---------- */
.dropzone {
  border: 2px dashed var(--dropzone-border);
  border-radius: 10px;
  background: var(--dropzone-bg);
  min-height: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 8px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: .15s;
}
.dropzone:hover, .dropzone.dragover {
  border-color: var(--pink);
  background: var(--pink-soft);
}
.dropzone p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  pointer-events: none;
}
.dropzone p small {
  font-size: 10.5px;
  color: var(--pink);
}
.dropzone img {
  max-height: 110px;
  max-width: 100%;
  object-fit: contain;
  border-radius: 4px;
  display: none;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}
.dropzone.has-img img { display: block; }
.dropzone.has-img p {
  position: absolute;
  bottom: 4px;
  right: 6px;
  background: rgba(0,0,0,0.75);
  color: #fff;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
}
.dropzone.has-img p small { display: none; }

/* ---------- アイテムライブラリ一覧 ---------- */
.library {
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  flex: 1;
  padding-right: 2px;
}
.library.grid-2col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}
.library.grid-2col .lib-item {
  display: flex;
  flex-direction: column;
  padding: 6px;
  gap: 4px;
  min-width: 0;
  position: relative;
}
.library.grid-2col .lib-thumb {
  width: 100%;
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 4px;
}
.library.grid-2col .lib-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.library.grid-2col .lib-info {
  min-width: 0;
  width: 100%;
}
.library.grid-2col .lib-title {
  font-size: 11px;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.library.grid-2col .lib-badges {
  gap: 2px;
  margin: 2px 0;
}
.library.grid-2col .lib-badges .badge {
  font-size: 9px;
  padding: 1px 3px;
}
.library.grid-2col .lib-meta {
  font-size: 9.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}
.library.grid-2col .lib-price {
  font-size: 11px;
  font-weight: 700;
}
.library.grid-2col .lib-btns {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: auto;
}
.library.grid-2col .lib-btns .row {
  display: flex;
  gap: 2px;
  width: 100%;
}
.library.grid-2col .lib-btns button {
  font-size: 10px;
  padding: 2px 3px;
  flex: 1;
}
.lib-item {
  display: grid;
  grid-template-columns: 46px 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card-bg-sample);
  cursor: grab;
  transition: .15s;
}
.lib-item:hover {
  border-color: var(--pink2);
  box-shadow: 0 2px 8px rgba(255,51,153,0.12);
}
.lib-item.editing {
  border-color: var(--pink);
  background: var(--pink-soft);
}
.lib-thumb {
  width: 46px;
  height: 62px;
  border-radius: 4px;
  background: var(--input-bg);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-size: 10px;
  color: var(--muted);
  text-align: center;
}
.lib-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.lib-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.lib-title {
  font-weight: 700;
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}
.lib-meta {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lib-price {
  font-size: 12px;
  font-weight: 800;
  color: var(--pink);
}
.lib-btns {
  display: flex;
  flex-direction: column;
  gap: 3px;
}


/* ---------- フィルターバー ＆ バッジ ---------- */
.lib-filter-bar {
  background: var(--panel-alt);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 4px;
}
.lib-badges {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 2px;
}
.badge {
  font-size: 10px;
  line-height: 1.25;
  padding: 1px 5px;
  border-radius: 4px;
  font-weight: 700;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
}
.genre-badge {
  color: var(--pink);
  background: var(--pink-soft);
  border: 1px solid var(--pink2);
}
.unclassified-badge {
  color: var(--muted);
  background: var(--btn-bg);
  border: 1px solid var(--line);
}
.placed-badge {
  color: #03af7a;
  background: rgba(3, 175, 122, 0.14);
  border: 1px solid rgba(3, 175, 122, 0.4);
}
.unplaced-badge {
  color: var(--muted);
  background: var(--btn-bg);
  border: 1px solid var(--line);
}
.btn-unplace {
  color: var(--text-muted);
  background: var(--btn-bg);
  border: 1px solid var(--line);
}
.btn-unplace:hover {
  color: #ff4b00 !important;
  border-color: #ff4b00 !important;
  background: rgba(255, 75, 0, 0.12) !important;
}

/* ---------- 中央プレビューエリア ---------- */
.center {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--stage-bg);
  transition: background .2s ease;
}
.canvas-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--toolbar-bg);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
  flex-wrap: wrap;
}
.canvas-toolbar label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  color: var(--text);
  font-size: 12px;
}
.canvas-toolbar select, .canvas-toolbar input {
  width: auto;
  padding: 4px 8px;
  font-size: 12px;
}
.pane-toggle {
  font-size: 11px;
  padding: 4px 8px;
  background: var(--btn-bg);
  border: 1px solid var(--line);
  color: var(--text-muted);
}
.pane-toggle:hover {
  background: var(--btn-hover-bg);
  color: var(--pink);
  border-color: var(--pink2);
}
.pane-toggle.active {
  background: var(--pink-soft);
  color: var(--pink);
  border-color: var(--pink2);
}

.canvas-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 16px;
  position: relative;
  min-height: 280px;
}
.canvas-wrap {
  box-shadow: 0 10px 32px rgba(0,0,0,0.45);
  border-radius: 6px;
  overflow: hidden;
  line-height: 0;
  border: 1px solid var(--line);
  transition: transform .05s ease-out;
  background: transparent;
}
#preview {
  display: block;
  max-width: 100%;
  max-height: 100%;
}

/* ---------- 配置中アイテムインスペクタバー（上下位置切替対応 Ver.0.66） ---------- */
.placed-bar {
  background: var(--placed-bg);
  border-bottom: 1px solid var(--line);
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
  max-height: 160px;
  overflow-y: auto;
  overflow-x: hidden;
}
body[data-placed-bar-pos="bottom"] .placed-bar {
  border-top: 1px solid var(--line);
  border-bottom: none;
}
.placed-chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.placed-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: var(--chip-bg);
  font-size: 11px;
  cursor: pointer;
  white-space: nowrap;
  transition: .15s;
  color: var(--text);
}
.placed-chip:hover {
  border-color: var(--pink2);
}
.placed-chip.active {
  background: var(--chip-active-bg);
  color: #fff;
  border-color: var(--chip-active-bg);
  font-weight: 700;
}
.inspector-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 4px;
  border-top: 1px dashed var(--line);
}
.inspector-controls select, .inspector-controls input:not([type="color"]) {
  width: auto;
  padding: 3px 8px;
  font-size: 11px;
}
.inspector-controls input[type="color"] {
  width: 36px;
  height: 26px;
  padding: 2px;
  cursor: pointer;
}

/* ---------- 右カラム：タブ＆各設定 ---------- */
.rtabs-bar {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: var(--panel-alt);
  padding: 0;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 30;
  overflow: visible;
}
.rtabs {
  display: flex;
  background: transparent;
  flex: 1;
  overflow: visible;
}
.rtab {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  border-radius: 0;
  padding: 10px 4px 8px;
  font-size: 19px;
  line-height: 1.1;
  color: var(--text-muted);
  border-bottom: 3px solid transparent;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all .18s ease;
}
.rtab:hover {
  background: var(--btn-hover-bg);
  color: var(--text);
  transform: translateY(-1px);
}
.rtab.active {
  color: var(--pink);
  border-bottom: 3px solid var(--pink);
  background: var(--panel);
}

/* ホバー時のかわいいチップ（カスタムCSSツールチップ） */
.rtab[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: var(--panel-alt);
  color: var(--text);
  border: 1px solid var(--line-strong);
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  transition: opacity .18s ease, transform .18s ease, visibility .18s;
  z-index: 100;
}
.rtab[data-tooltip]::before {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-1px);
  border-width: 0 5px 5px 5px;
  border-style: solid;
  border-color: transparent transparent var(--line-strong) transparent;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease, visibility .18s;
  z-index: 101;
}

/* 左右両端のタブでチップが見切れないよう調整 */
.rtab:first-child[data-tooltip]::after {
  left: 4px;
  transform: translateY(4px);
}
.rtab:first-child[data-tooltip]::before {
  left: 18px;
  transform: translateX(-50%) translateY(-1px);
}
.rtab:last-child[data-tooltip]::after {
  left: auto;
  right: 4px;
  transform: translateY(4px);
}
.rtab:last-child[data-tooltip]::before {
  left: auto;
  right: 18px;
  transform: translateX(50%) translateY(-1px);
}

.rtab[data-tooltip]:hover::after,
.rtab[data-tooltip]:focus-visible::after {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(8px);
}
.rtab:first-child[data-tooltip]:hover::after,
.rtab:first-child[data-tooltip]:focus-visible::after {
  transform: translateY(8px);
}
.rtab:last-child[data-tooltip]:hover::after,
.rtab:last-child[data-tooltip]:focus-visible::after {
  transform: translateY(8px);
}

.rtab[data-tooltip]:hover::before,
.rtab[data-tooltip]:focus-visible::before {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(3px);
}
.rtab:first-child[data-tooltip]:hover::before,
.rtab:first-child[data-tooltip]:focus-visible::before {
  transform: translateX(-50%) translateY(3px);
}
.rtab:last-child[data-tooltip]:hover::before,
.rtab:last-child[data-tooltip]:focus-visible::before {
  transform: translateX(50%) translateY(3px);
}
.rtab-body {
  padding: 12px;
  display: none;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
}
.rtab-body.active { display: flex; }
.setting-card, .file-card, .output-card {
  background: var(--panel-alt);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.setting-card h3, .file-card h3, .output-card h3 {
  margin: 0;
  font-size: 13px;
  color: var(--text);
  border-bottom: 1px solid var(--line);
  padding-bottom: 6px;
}

/* 設定カード内の小グループ枠 (Ver.0.24) */
.setting-subgroup {
  background: var(--input-bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 2px;
}
.setting-subgroup-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  border-bottom: 1px dashed var(--line);
  padding-bottom: 4px;
  margin-bottom: 2px;
}
.file-card .hint {
  margin: 0;
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.45;
}
.danger-btn {
  border-color: rgba(255, 75, 0, 0.45);
  color: #ff4b00;
  background: rgba(255, 75, 0, 0.1);
  font-weight: 700;
}
.danger-btn:hover {
  background: rgba(255, 75, 0, 0.22);
  border-color: #ff4b00;
  color: #fff;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.field > span {
  font-weight: 700;
  font-size: 11.5px;
  color: var(--text-muted);
}
.chk-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 2px;
}
.chk-row label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text);
}

/* ---------- モーダル（別窓ダイアログ） ---------- */
.modal-backdrop,
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.modal-backdrop.open,
.modal-overlay.open {
  display: flex !important;
}
#modalBackdrop {
  z-index: 1500;
}
#modalBackdrop .modal {
  z-index: 1501;
}
.modal {
  background: var(--modal-bg);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  max-width: 960px;
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  color: var(--text);
  position: relative;
  z-index: 1001;
}
.modal-head {
  padding: 12px 16px;
  background: var(--modal-head-bg);
  color: #fff;
  font-weight: 700;
  font-size: 13.5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.modal-head #btnModalClose {
  background: rgba(255, 255, 255, 0.16) !important;
  color: #fff !important;
  border: 1px solid rgba(255, 255, 255, 0.28) !important;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 12px;
  transition: all .15s ease;
}
.modal-head #btnModalClose:hover {
  background: rgba(255, 255, 255, 0.3) !important;
  border-color: #ff8ac4 !important;
}
.modal-body {
  padding: 18px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  background: var(--panel-alt);
  color: var(--text);
}
.modal-body canvas {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.45);
  border-radius: 4px;
  max-width: 100%;
}
.modal-foot {
  padding: 10px 16px;
  background: var(--modal-foot-bg);
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

/* ---------- トースト通知 ---------- */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 2000;
  pointer-events: none;
}
.toast {
  background: rgba(22, 19, 29, 0.94);
  border: 1px solid var(--line-strong);
  color: #fff;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 12px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  gap: 8px;
  transform: translateY(10px);
  opacity: 0;
  transition: all .2s ease;
  pointer-events: auto;
}
.toast.show {
  transform: translateY(0);
  opacity: 1;
}
.toast.success { border-color: #03af7a; }
.toast.warn { border-color: #f6aa00; }
.toast.error { border-color: #ff4b00; }

/* ---------- レスポンシブ調整 ---------- */
@media (max-width: 900px) {
  .app,
  .app.left-collapsed,
  .app.right-collapsed,
  .app.left-collapsed.right-collapsed {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    overflow-y: auto;
  }
  .resizer, .resizer-h { display: none; }
  .app.left-collapsed .left,
  .app.right-collapsed .right { display: none; }
  .left { height: auto; max-height: none; }
  .left .panel.grow { min-height: 200px; max-height: 280px; }
  .pop-panel { height: auto; max-height: 240px; }
  .right { max-height: 440px; }
  .canvas-stage { min-height: 360px; }
}

/* ---------- Ver.0.16: 左ペイン広大化・モーダル・インライン削除・クイック登録 ---------- */
.lib-header {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 8px;
}

.lib-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.lib-header-top h2 {
  margin: 0;
  font-size: 13.5px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-new-item {
  background: var(--pink) !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  font-size: 12px !important;
  padding: 5px 11px !important;
  border-radius: 6px !important;
  border: 1px solid rgba(255, 255, 255, 0.25) !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
  white-space: nowrap;
  cursor: pointer;
  transition: all .15s ease;
}

.btn-new-item:hover {
  filter: brightness(1.14);
  transform: translateY(-1px);
}

.lib-panel.dragover {
  border-color: var(--pink) !important;
  background: var(--pink-soft) !important;
}

/* アイテム登録モーダル */
.modal-item-form {
  max-width: 480px;
}

.modal-item-form .modal-body {
  padding: 16px 20px;
  gap: 11px;
  align-items: stretch;
}

.modal-item-form .dropzone {
  min-height: 110px;
  padding: 12px;
}

/* インライン削除確認 */
.btn-del.confirming, .btn-del-pop.confirming {
  background: #ff4b00 !important;
  color: #ffffff !important;
  font-weight: 900 !important;
  border-color: #ff4b00 !important;
  box-shadow: 0 0 10px rgba(255, 75, 0, 0.8) !important;
  animation: pulse-del-danger 0.75s infinite alternate ease-in-out;
  padding: 2px 7px !important;
}

@keyframes pulse-del-danger {
  0% { transform: scale(1); filter: brightness(1); }
  100% { transform: scale(1.05); filter: brightness(1.2); }
}

/* ---------- Ver.0.17: 売り文句POP管理・表示スタイル（高さ可変対応 Ver.0.67） ---------- */
.pop-panel {
  padding: 10px 12px;
  background: var(--panel-alt);
  height: var(--pop-panel-height, 220px);
  min-height: 90px;
  max-height: 70%;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  box-sizing: border-box;
  overflow: hidden;
  border-bottom: none;
}

.pop-library {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.pop-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card-bg-sample);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 8px;
  cursor: grab;
  transition: all .15s ease;
}

.pop-item:hover {
  border-color: var(--pink);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.pop-item.placed {
  border-left: 3px solid var(--pink);
}

.pop-thumb {
  width: 48px;
  height: 36px;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  font-weight: 900;
  color: #ffffff;
  text-align: center;
  flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
  overflow: hidden;
  padding: 2px;
  line-height: 1.1;
}

.pop-thumb.burst {
  clip-path: polygon(50% 0%, 65% 15%, 85% 5%, 85% 25%, 100% 35%, 90% 55%, 100% 75%, 80% 85%, 75% 100%, 50% 90%, 25% 100%, 20% 85%, 0% 75%, 10% 55%, 0% 35%, 15% 25%, 15% 5%, 35% 15%);
}

.pop-thumb.banner {
  border-radius: 2px;
  border-top: 2px solid rgba(255,255,255,0.6);
  border-bottom: 2px solid rgba(0,0,0,0.3);
}

.pop-thumb.frame {
  background-color: #111116 !important;
  border: 2px solid var(--pink);
  box-shadow: 0 0 6px var(--pink);
}

.pop-thumb.simple_white {
  background-color: #ffffff !important;
  color: #111111 !important;
  border: 1px solid #d1d5db !important;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}

.pop-thumb.simple_black {
  background-color: #161616 !important;
  color: #ffffff !important;
  border: 1px solid #374151 !important;
  box-shadow: 0 1px 2px rgba(0,0,0,0.25);
}

.pop-thumb.ticket {
  border-radius: 4px;
  border: 1.5px dashed rgba(255, 255, 255, 0.85);
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.18), 0 2px 4px rgba(0,0,0,0.2);
}

.pop-thumb.speech {
  border-radius: 12px;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 5px rgba(0,0,0,0.25);
}

.pop-thumb.glass {
  background-color: rgba(255, 255, 255, 0.15) !important;
  border-left: 4px solid var(--pink) !important;
  border-top: 1px solid rgba(255, 255, 255, 0.45);
  border-right: 1px solid rgba(255, 255, 255, 0.2);
  border-bottom: 1px solid rgba(0, 0, 0, 0.25);
  box-shadow: 0 2px 6px rgba(0,0,0,0.18);
}

.pop-thumb.image_pop {
  border-radius: 6px;
  border: 2px dashed rgba(255, 255, 255, 0.65);
  box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

/* POP画像ドロップ領域 (Ver.0.29) */
.pop-img-dropzone {
  border: 2px dashed var(--border);
  border-radius: 8px;
  background: var(--bg);
  transition: border-color 0.15s ease, background-color 0.15s ease;
  cursor: pointer;
}
.pop-img-dropzone:hover {
  border-color: var(--pink);
}
.pop-img-dropzone.dragover {
  border-color: var(--pink);
  background: rgba(228, 0, 127, 0.08);
}

/* ジャンル別カラー設定リスト (Ver.0.23) */
.genre-color-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 8px;
  background: var(--input-bg);
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 12px;
}
.genre-color-item span {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.genre-color-item input[type="color"] {
  width: 32px;
  height: 24px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 3px;
  cursor: pointer;
  background: none;
}

.pop-info {
  flex: 1;
  min-width: 0;
}

.pop-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pop-sub {
  font-size: 10px;
  color: var(--text-sub);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pop-btns {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-shrink: 0;
}

.modal-pop-form {
  max-width: 440px;
}

/* ========== フォルダ（アコーディオン＋Sticky Header） (Ver.0.25b) ========== */
.ui-folder {
  padding: 0 !important;
  overflow: visible !important;
  position: relative;
  transition: border-color 0.15s ease;
}

.ui-folder-head {
  position: sticky;
  top: -12px;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  background: var(--panel-alt);
  border-bottom: 1px solid var(--line);
  border-top-left-radius: 8px;
  border-top-right-radius: 8px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s ease;
}

.ui-folder:not(.open) .ui-folder-head {
  border-bottom: none;
  border-radius: 8px;
}

.ui-folder-head:hover {
  background: var(--btn-hover-bg, rgba(255,255,255,0.06));
}

.ui-folder-title {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1;
}

.ui-folder-title h3 {
  margin: 0 !important;
  font-size: 13px !important;
  color: var(--text) !important;
  border-bottom: none !important;
  padding-bottom: 0 !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.folder-arrow {
  display: inline-block;
  font-size: 9px;
  color: var(--text-muted);
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
}

.ui-folder:not(.open) .folder-arrow {
  transform: rotate(-90deg);
}


.ui-folder-body {
  padding: 10px 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ui-folder:not(.open) .ui-folder-body {
  display: none !important;
}

/* ========== 入れ子パネル（ネスト構造）の交互配色 (Ver.0.25) ========== */
.setting-subgroup,
#twoDaysBox,
#customSize,
#bgImageControls {
  background: var(--panel-nested, var(--input-bg)) !important;
  border: 1px solid var(--line-strong, var(--line)) !important;
  border-radius: 6px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.08);
}

/* ========== ライトテーマ時の入力欄視認性強化 (Ver.0.25) ========== */
body[data-ui-theme="light"] input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="range"]),
body[data-ui-theme="light"] select,
body[data-ui-theme="light"] textarea {
  background: #ffffff !important;
  border: 1px solid var(--input-border, #b8c7d9) !important;
  color: #1a2332 !important;
}
body[data-ui-theme="light"] input:focus,
body[data-ui-theme="light"] select:focus,
body[data-ui-theme="light"] textarea:focus {
  border-color: var(--pink) !important;
  box-shadow: 0 0 0 2px var(--pink-soft) !important;
}

/* ========== ポップアップ・モーダル・ツールチップの前後関係明度強化 (Ver.0.25) ========== */
.modal {
  background: var(--modal-bg, var(--panel-alt)) !important;
  border: 1px solid var(--line-strong) !important;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5), 0 4px 16px rgba(0, 0, 0, 0.25) !important;
}

.rtab[data-tooltip]::after {
  background: var(--modal-bg, #1e2230) !important;
  border: 1px solid var(--line-strong) !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4) !important;
}

/* ========== 控えめな設定リセットボタン (Ver.0.27) ========== */
.btn-subtle-reset {
  align-self: flex-end;
  margin-top: 6px;
  font-size: 11px !important;
  padding: 3px 10px !important;
  background: transparent !important;
  border: 1px dashed var(--line-strong, rgba(255, 255, 255, 0.22)) !important;
  color: var(--text-muted, #8397b8) !important;
  border-radius: 4px !important;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.btn-subtle-reset:hover {
  background: var(--btn-hover-bg, rgba(255, 255, 255, 0.08)) !important;
  color: var(--text, #ffffff) !important;
  border-style: solid !important;
  border-color: var(--pink, #3b82f6) !important;
}

/* POPモーダルの複数行入力 (Ver.0.27) */
#popTitleInput {
  min-height: 68px;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.45;
  padding: 8px 10px;
}

/* ========== Ver.0.31: POPモーダルリアルタイムCanvasプレビュー ========== */
.pop-live-preview-wrap {
  position: relative;
  width: 100%;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border, rgba(255, 255, 255, 0.15));
  background-color: #181b22;
  background-image:
    linear-gradient(45deg, #242835 25%, transparent 25%),
    linear-gradient(-45deg, #242835 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #242835 75%),
    linear-gradient(-45deg, transparent 75%, #242835 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  user-select: none;
  min-height: 180px;
}

#popPreviewCanvas {
  width: 100%;
  height: auto;
  max-height: 220px;
  object-fit: contain;
  display: block;
  cursor: grab;
}

#popPreviewCanvas:active {
  cursor: grabbing;
}

.pop-preview-drag-hint {
  position: absolute;
  bottom: 6px;
  right: 8px;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.85);
  background: rgba(0, 0, 0, 0.65);
  padding: 2px 7px;
  border-radius: 4px;
  pointer-events: none;
  backdrop-filter: blur(2px);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

/* ---------- インラインSVGピクトグラムアイコン (EXPERIENCE JAPAN PICTOGRAMSスタイル) ---------- */
.icon-svg {
  display: inline-block;
  width: 1.15em;
  height: 1.15em;
  vertical-align: -0.18em;
  fill: currentColor;
  flex-shrink: 0;
}

.rtab .icon-svg {
  width: 1.35em;
  height: 1.35em;
  vertical-align: middle;
}

/* ========== ヘルプ・ご利用ガイド モーダルスタイル (Ver.0.59) ========== */
.modal-help {
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.65), 0 4px 20px rgba(0, 0, 0, 0.3) !important;
}

.help-toc-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  background: var(--panel-alt);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
  flex-shrink: 0;
}

.help-toc-label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-sub);
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.help-toc-links {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.help-toc-btn {
  background: var(--input-bg);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.help-toc-btn:hover {
  background: var(--btn-hover-bg, rgba(255, 255, 255, 0.1));
  border-color: var(--pink);
  color: var(--pink);
}

.help-modal-body {
  display: flex;
  flex-direction: column;
  gap: 24px;
  scroll-behavior: smooth;
}

.help-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-margin-top: 10px;
}

.help-section-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
  margin: 0;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--line);
  display: flex;
  align-items: center;
  gap: 6px;
}

.help-lead-desc {
  font-size: 12.5px;
  color: var(--text-sub);
  margin: -4px 0 0;
  line-height: 1.5;
}

.help-lead-box {
  background: var(--panel-alt);
  border: 1px solid var(--line);
  border-left: 4px solid var(--pink);
  padding: 14px 18px;
  border-radius: 0 8px 8px 0;
}

.help-lead-box p {
  font-size: 13.5px;
  line-height: 1.75;
  color: var(--text);
  margin: 0;
}

.help-step-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.help-step-card {
  background: var(--panel-alt);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.help-step-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.help-step-badge {
  background: linear-gradient(135deg, var(--pink), #ff4b00);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 10px;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.help-step-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.help-step-content {
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--text);
}

.help-step-content ul {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.help-tip-box {
  margin-top: 10px;
  background: rgba(234, 179, 8, 0.1);
  border: 1px dashed rgba(234, 179, 8, 0.4);
  border-radius: 6px;
  padding: 10px 12px;
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 12px;
  line-height: 1.55;
  color: var(--text);
}

.help-tip-icon {
  font-size: 16px;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 1px;
}

.help-tip-text {
  flex: 1;
}

.help-output-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
  margin-top: 8px;
}

.help-output-item {
  background: var(--panel-nested, var(--input-bg));
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.help-output-item-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--pink);
}

.help-output-item-desc {
  font-size: 11.5px;
  color: var(--text-sub);
  line-height: 1.5;
}

.help-backup-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.help-backup-card {
  background: var(--panel-alt);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.help-backup-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.help-backup-badge {
  background: var(--btn-hover-bg, rgba(255, 255, 255, 0.1));
  border: 1px solid var(--line);
  color: var(--pink);
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
}

.help-backup-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.help-backup-body {
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--text);
}

.help-backup-body ul {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.help-faq-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.help-faq-item {
  background: var(--panel-alt);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.help-faq-q {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-weight: 700;
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
}

.help-faq-a {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 12.5px;
  color: var(--text-sub);
  line-height: 1.6;
}

.faq-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 900;
  flex-shrink: 0;
  margin-top: 1px;
}

.faq-icon.q {
  background: var(--pink);
  color: #fff;
}

.faq-icon.a {
  background: var(--input-bg);
  border: 1px solid var(--line);
  color: var(--text-sub);
}

.faq-q-text {
  flex: 1;
}

.faq-a-text {
  flex: 1;
}

.help-terms-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}

.help-terms-item {
  background: var(--panel-alt);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.help-terms-head {
  display: flex;
  align-items: center;
  gap: 6px;
}

.help-terms-icon {
  font-size: 14px;
}

.help-terms-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.help-terms-body {
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-sub);
}

.help-terms-body p {
  margin: 0 0 6px;
}

.help-terms-body p:last-child {
  margin-bottom: 0;
}

/* ========== データ保存・バックアップ警告ボックス (Ver.0.60 / CUD対応 Ver.0.61) ========== */
.help-alert-box {
  background: rgba(255, 75, 0, 0.08);
  border: 1px solid rgba(255, 75, 0, 0.35);
  border-left: 5px solid #ff4b00;
  border-radius: 6px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.help-alert-head {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #ff4b00;
  font-size: 13.5px;
  font-weight: 800;
}

.help-alert-icon {
  font-size: 16px;
  line-height: 1;
  flex-shrink: 0;
}

.help-alert-body {
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.help-alert-body p {
  margin: 0;
}

.help-alert-body strong {
  color: #ff4b00;
  font-weight: 700;
}

.help-alert-body kbd {
  background: var(--input-bg);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 11px;
  font-family: inherit;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
  display: inline-block;
  vertical-align: middle;
}
