/* ============================================================
   アトリエ — エディタUI（Studio風）
   配色: パネル #fff / キャンバス #f5f5f6 / 文字 #111 / 補助 #8a8a8e / 罫線 #e8e8ea
   ============================================================ */
:root {
  --ink: #111114;
  --sub: #8a8a8e;
  --line: #e8e8ea;
  --line-soft: #f0f0f2;
  --panel: #ffffff;
  --canvas: #f5f5f6;
  --blue: #4d7cfe;
  --radius: 8px;
  --font: "Noto Sans JP", "Hiragino Sans", sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--canvas);
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button { font-family: inherit; font-size: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 12px; color: var(--ink); }
[hidden] { display: none !important; }
.ic { width: 18px; height: 18px; display: block; }
.ic-s { width: 13px; height: 13px; display: inline-block; vertical-align: -2px; }

/* ============ 共通部品 ============ */
.logo-sq {
  width: 26px; height: 26px; border-radius: 7px;
  background: var(--ink); color: #fff;
  font-size: 13px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  flex: 0 0 auto;
}
.mainbtn {
  background: var(--ink); color: #fff;
  border-radius: var(--radius);
  padding: 10px 22px; font-weight: 700; font-size: 13px;
  transition: opacity .15s;
}
.mainbtn:hover { opacity: .82; }
.ghostbtn {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 9px 16px; font-size: 12.5px; color: var(--ink); background: #fff;
  transition: border-color .15s, background .15s;
}
.ghostbtn:hover { border-color: #c9c9ce; background: #fafafa; }
.ghostbtn-s { padding: 6px 10px; font-size: 11.5px; }
.toast {
  position: fixed; left: 50%; bottom: 64px; transform: translateX(-50%);
  background: rgba(17,17,20,.92); color: #fff;
  font-size: 12.5px; padding: 11px 20px; border-radius: 99px;
  z-index: 300; pointer-events: none;
  animation: toast-in .25s ease;
  max-width: min(560px, 90vw); text-align: center;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }

/* ============ エディタ全体 ============ */
.editor { display: flex; flex-direction: column; height: 100vh; }
.ebody { display: flex; flex: 1 1 0; min-height: 0; }

/* ============ トップバー ============ */
.topbar {
  height: 44px; background: var(--panel);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 10px 0 12px; position: relative; z-index: 60;
  flex: 0 0 auto;
}
.tb-left, .tb-right { display: flex; align-items: center; gap: 8px; position: relative; white-space: nowrap; }
.tb-proj { font-size: 12.5px; font-weight: 600; margin-left: 4px; }
.tb-sep { color: #cfcfd4; }
.tb-page {
  font-size: 12.5px; display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 8px; border-radius: 6px; color: var(--ink);
  max-width: 150px;
}
.tb-page { overflow: hidden; }
.tb-publish { white-space: nowrap; }
.tb-page:hover { background: var(--line-soft); }
.tb-zoom {
  font-size: 12px; color: var(--sub);
  padding: 5px 8px; border-radius: 6px;
  display: inline-flex; align-items: center; gap: 3px;
}
.tb-zoom:hover { background: var(--line-soft); }
.tb-iconbtn {
  width: 28px; height: 28px; border-radius: 6px; color: var(--sub);
  display: inline-flex; align-items: center; justify-content: center;
}
.tb-iconbtn:hover { background: var(--line-soft); color: var(--ink); }
.tb-collapse { margin-left: 6px; }
.tb-add {
  width: 28px; height: 28px; border-radius: 50%;
  border: 1px solid var(--line); color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center;
}
.tb-add:hover { background: var(--line-soft); }
.tb-add .ic { width: 14px; height: 14px; }
.tb-avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: radial-gradient(circle at 32% 30%, #ffb36b, #f08c3a);
  display: inline-block; flex: 0 0 auto;
  box-shadow: 0 0 0 1.5px #fff, 0 0 0 2.5px #f0c39b;
}
.tb-preview {
  width: 30px; height: 28px; border: 1px solid var(--line); border-radius: 7px;
  display: inline-flex; align-items: center; justify-content: center; color: var(--ink);
}
.tb-preview:hover { background: var(--line-soft); }
.tb-preview .ic { width: 15px; height: 15px; }
.tb-publish {
  background: var(--ink); color: #fff;
  font-size: 12.5px; font-weight: 700;
  border-radius: 8px; padding: 8px 18px;
  transition: opacity .15s;
}
.tb-publish:hover { opacity: .82; }

.menu {
  position: absolute; top: 36px; left: 0;
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 10px 38px rgba(16,18,28,.14);
  padding: 6px; min-width: 200px; z-index: 100;
}
.menu-r { left: auto; right: 0; min-width: 110px; }
.menu button {
  display: flex; align-items: center; gap: 8px; width: 100%;
  text-align: left; font-size: 12.5px;
  padding: 8px 10px; border-radius: 7px; color: var(--ink);
}
.menu button:hover { background: var(--line-soft); }
.menu button.active { font-weight: 700; }
.menu .menu-div { height: 1px; background: var(--line-soft); margin: 5px 4px; }
.menu .menu-label { font-size: 10.5px; color: var(--sub); padding: 6px 10px 2px; }

/* ============ アイコンレール ============ */
.rail {
  width: 44px; background: var(--panel); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; align-items: center;
  padding: 8px 0; gap: 2px; flex: 0 0 auto;
}
.rail-btn {
  width: 32px; height: 32px; border-radius: 8px; color: #5d5d63;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s;
}
.rail-btn:hover { background: var(--line-soft); color: var(--ink); }
.rail-btn.active { background: var(--ink); color: #fff; }
.rail-sp { flex: 1 1 auto; }

/* ============ 追加パネル ============ */
.addpanel {
  width: 256px; background: var(--panel); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; flex: 0 0 auto; min-height: 0;
}
.editor.left-collapsed .addpanel { display: none; }
.ap-head { font-size: 13px; font-weight: 700; padding: 14px 14px 10px; }
.ap-tabs {
  display: flex; background: #f1f1f3; border-radius: 8px;
  margin: 0 14px 12px; padding: 3px; gap: 2px;
}
.ap-tab {
  flex: 1 1 0; font-size: 11.5px; color: var(--sub);
  padding: 6px 0; border-radius: 6px; font-weight: 500;
}
.ap-tab.active { background: #fff; color: var(--ink); font-weight: 700; box-shadow: 0 1px 3px rgba(16,18,28,.1); }
.ap-body { flex: 1 1 0; overflow-y: auto; padding: 2px 14px 20px; min-height: 0; }
.ap-group { font-size: 11px; font-weight: 700; color: var(--ink); margin: 14px 0 8px; }
.ap-group:first-child { margin-top: 4px; }
.ap-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.ap-card {
  border: 1px solid var(--line); border-radius: 8px; background: #fff;
  aspect-ratio: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 5px;
  color: var(--ink); padding: 4px 2px;
  transition: border-color .15s, box-shadow .15s;
}
.ap-card .ic { width: 20px; height: 20px; color: #3c3c42; }
.ap-card span { font-size: 8.5px; color: var(--sub); line-height: 1.2; text-align: center; }
.ap-card:hover { border-color: #b9b9c0; box-shadow: 0 2px 8px rgba(16,18,28,.08); }
.ap-card:active { transform: scale(.97); }
.ap-card.brand-yt .ic { color: #ff0000; }
.ap-card.brand-vimeo .ic { color: #1ab7ea; }
.ap-card.brand-map .ic { color: #34a853; }
.ap-card.brand-lottie .ic { color: #00c4a7; }
.ap-card.brand-ig .ic { color: #d6336c; }
.ap-card.brand-fb .ic { color: #1877f2; }
.ap-card.is-on { border-color: var(--blue); box-shadow: inset 0 0 0 1px var(--blue); }
.ap-card.is-on::after { content: "表示中"; font-size: 8px; color: var(--blue); font-weight: 700; }
.ap-note {
  font-size: 11px; color: var(--sub); line-height: 1.7;
  background: var(--line-soft); border-radius: 8px; padding: 10px 12px; margin: 10px 0 4px;
}
/* セクションタブのリスト型カード */
.ap-list { display: grid; gap: 6px; }
.ap-row {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px;
  background: #fff; text-align: left; width: 100%;
  transition: border-color .15s;
}
.ap-row:hover { border-color: #b9b9c0; }
.ap-row .ic { width: 17px; height: 17px; color: #3c3c42; flex: 0 0 auto; }
.ap-row-t { font-size: 11.5px; font-weight: 600; flex: 1 1 auto; }
.ap-row-s { font-size: 9px; color: var(--sub); }
.ap-row .pill { font-size: 9px; border-radius: 99px; padding: 2px 8px; font-weight: 700; flex: 0 0 auto; }
.ap-row .pill.on { background: rgba(77,124,254,.12); color: var(--blue); }
.ap-row .pill.off { background: var(--line-soft); color: var(--sub); }

/* ============ キャンバス ============ */
.canvas { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; position: relative; }
.canvas-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px 6px; flex: 0 0 auto;
}
.page-chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; color: #6e6e74;
}
.canvas-tools { display: inline-flex; gap: 2px; }
.ct-btn {
  width: 26px; height: 26px; border-radius: 6px; color: #85858b;
  display: inline-flex; align-items: center; justify-content: center;
}
.ct-btn:hover { background: #ebebee; color: var(--ink); }
.ct-btn .ic { width: 15px; height: 15px; }
.canvas-scroll { flex: 1 1 0; overflow: auto; padding: 4px 28px 90px; min-height: 0; }
.artboard-wrap {
  margin: 0 auto; position: relative;
  transform-origin: top center;
  transition: width .2s ease;
}
.artboard {
  display: block; width: 100%; height: 100%;
  background: #fff; border: 0;
  outline: 1.5px solid var(--blue);
  box-shadow: 0 2px 14px rgba(16,18,28,.07);
}
.banner-board {
  position: relative; background: #fff; overflow: hidden;
  outline: 1.5px solid var(--blue);
  box-shadow: 0 2px 14px rgba(16,18,28,.07);
  transform-origin: top left;
}

/* バナーレイヤー */
.bn-layer { position: absolute; cursor: grab; user-select: none; -webkit-user-select: none; }
.bn-layer.dragging { cursor: grabbing; }
.bn-layer.selected { outline: 1.5px solid var(--blue); outline-offset: 1px; }
.bn-layer .bn-text { white-space: pre-wrap; word-break: break-word; }
.bn-handle {
  position: absolute; right: -7px; bottom: -7px; width: 12px; height: 12px;
  background: #fff; border: 1.5px solid var(--blue); border-radius: 3px;
  cursor: nwse-resize; z-index: 5;
}

/* デバイスバー */
.devicebar {
  position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%);
  background: #fff; border-radius: 99px;
  box-shadow: 0 4px 22px rgba(16,18,28,.16), 0 0 0 1px var(--line-soft);
  display: flex; align-items: center; gap: 4px;
  padding: 7px 14px; z-index: 40;
}
.db-handle { width: 34px; height: 4px; border-radius: 2px; background: #2c2c30; margin-right: 8px; }
.db-size { font-size: 11.5px; color: var(--sub); min-width: 52px; text-align: center; }
.db-sep { width: 1px; height: 16px; background: var(--line); margin: 0 5px; }
.db-dev {
  width: 28px; height: 28px; border-radius: 7px; color: #85858b;
  display: inline-flex; align-items: center; justify-content: center;
}
.db-dev:hover { background: var(--line-soft); color: var(--ink); }
.db-dev.active { color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--ink); }
.db-dev .ic { width: 15px; height: 15px; }
.db-more { width: 26px; height: 26px; border-radius: 6px; color: #85858b; display: inline-flex; align-items: center; justify-content: center; }
.db-more:hover { background: var(--line-soft); }

/* ============ プロパティパネル ============ */
.props {
  width: 256px; background: var(--panel); border-left: 1px solid var(--line);
  display: flex; flex-direction: column; flex: 0 0 auto; min-height: 0;
}
.editor.right-collapsed .props .props-body,
.editor.right-collapsed .props .ptabs { display: none; }
.editor.right-collapsed .props { width: 44px; }
.props-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px 6px;
}
.ptabs { display: flex; gap: 14px; padding-right: 4px; }
.ptab { font-size: 12px; color: #b3b3b8; font-weight: 600; padding: 4px 2px; position: relative; }
.ptab.active { color: var(--ink); }
.ptab.active::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -3px;
  height: 2px; background: var(--ink); border-radius: 1px;
}
.props-body { flex: 1 1 0; overflow-y: auto; padding: 6px 16px 30px; min-height: 0; }
.pp-sec { font-size: 11px; font-weight: 700; margin: 16px 0 7px; }
.pp-sec:first-child { margin-top: 8px; }
.pp-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.pp-row-sb { justify-content: space-between; }
.pp-label { font-size: 11px; color: var(--sub); }
.pp-status { font-size: 10.5px; color: var(--sub); display: inline-flex; align-items: center; gap: 5px; }
.pp-dot { width: 7px; height: 7px; border-radius: 50%; background: #c9c9ce; display: inline-block; }
.pp-dot.live { background: #35c26a; }
.pp-link {
  font-size: 11.5px; color: var(--blue); text-decoration: none;
  display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  margin-bottom: 4px;
}
.pp-link:hover { text-decoration: underline; }
.pp-input {
  width: 100%; border: 1px solid var(--line); border-radius: 7px;
  background: #fafafa; padding: 8px 10px; font-size: 12px;
  outline: none; transition: border-color .15s, background .15s;
}
.pp-input:focus { border-color: var(--blue); background: #fff; }
.pp-input-s { width: 90px; }
.pp-ta { resize: vertical; min-height: 60px; margin-top: 8px; font-family: ui-monospace, monospace; font-size: 11px; }
.pp-color-row { display: flex; gap: 8px; align-items: center; }
.pp-color {
  width: 38px; height: 34px; border: 1px solid var(--line); border-radius: 7px;
  background: #fff; padding: 3px; cursor: pointer;
}
.swatches { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.swatch {
  width: 22px; height: 22px; border-radius: 6px; cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.08);
  transition: transform .12s;
}
.swatch:hover { transform: scale(1.15); }
.pp-check {
  display: flex; align-items: center; gap: 8px;
  font-size: 11.5px; color: var(--ink); padding: 5px 0; cursor: pointer;
}
.pp-check input { accent-color: var(--ink); width: 14px; height: 14px; }
.pp-badge {
  font-size: 9.5px; color: var(--sub); background: var(--line-soft);
  border-radius: 5px; padding: 2px 7px; font-weight: 500;
}
.pp-acc { margin-top: 16px; }
.pp-acc summary {
  font-size: 11px; font-weight: 700; cursor: pointer;
  display: flex; align-items: center; gap: 7px; list-style: none;
}
.pp-acc summary::-webkit-details-marker { display: none; }
.pp-acc summary::after { content: "⌄"; color: var(--sub); margin-left: auto; }
.pp-acc[open] summary::after { content: "⌃"; }

/* デザインタイプ選択 */
.dt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.dt-card {
  border: 1px solid var(--line); border-radius: 9px; overflow: hidden;
  text-align: left; background: #fff; padding: 0;
  transition: border-color .15s, box-shadow .15s;
}
.dt-card:hover { border-color: #b9b9c0; }
.dt-card.active { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.dt-thumb { height: 44px; display: flex; flex-direction: column; justify-content: center; gap: 4px; padding: 0 10px; }
.dt-thumb i { display: block; border-radius: 2px; }
.dt-name { font-size: 10px; font-weight: 700; padding: 6px 9px 2px; display: block; }
.dt-desc { font-size: 8.5px; color: var(--sub); padding: 0 9px 7px; display: block; line-height: 1.4; }

/* カバー画像ボックス */
.cover-box {
  border: 1px dashed #cfcfd4; border-radius: 9px; background: #fafafa;
  min-height: 92px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 6px;
  color: var(--sub); cursor: pointer; position: relative; overflow: hidden;
  transition: border-color .15s;
}
.cover-box:hover { border-color: var(--blue); }
.cover-hint { font-size: 10.5px; }
.cover-box img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

.favicon-box {
  width: 34px; height: 34px; border: 1px dashed #cfcfd4; border-radius: 8px;
  background: #fafafa; display: inline-flex; align-items: center; justify-content: center;
  color: var(--sub); position: relative; overflow: hidden; flex: 0 0 auto;
}
.favicon-box:hover { border-color: var(--blue); }
.favicon-box img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.pp-divider { border: 0; border-top: 1px solid var(--line-soft); margin: 18px -16px 2px; }
.sec-item-ic { width: 16px; height: 16px; color: #8a8a8e; flex: 0 0 16px; }
.sec-item-ic .ic { width: 16px; height: 16px; }

/* ページタブ（セクション一覧・詳細） */
.sec-list { display: grid; gap: 6px; margin-top: 8px; }
.sec-item {
  display: flex; align-items: center; gap: 7px;
  border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 9px; background: #fff;
}
.sec-item.fixed { background: #fafafa; }
.sec-item.off { opacity: .55; }
.sec-item.selected { border-color: var(--blue); box-shadow: inset 0 0 0 1px var(--blue); }
.sec-item-t { font-size: 11.5px; font-weight: 600; flex: 1 1 auto; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sec-item-tag { font-size: 9px; color: var(--sub); }
.sec-mini {
  width: 22px; height: 22px; border-radius: 5px; color: #85858b;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; flex: 0 0 auto;
}
.sec-mini:hover:not(:disabled) { background: var(--line-soft); color: var(--ink); }
.sec-mini:disabled { opacity: .3; cursor: default; }
.pp-back {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; color: var(--sub); padding: 6px 0; margin-top: 4px;
}
.pp-back:hover { color: var(--ink); }
.pp-itemcard {
  border: 1px solid var(--line); border-radius: 9px; padding: 10px;
  display: grid; gap: 6px; margin-bottom: 8px; background: #fff;
}
.pp-itemcard-head { display: flex; align-items: center; justify-content: space-between; }
.pp-itemcard-n { font-size: 10px; font-weight: 700; color: var(--sub); }
.pp-addrow {
  border: 1px dashed #cfcfd4; border-radius: 9px; padding: 9px;
  font-size: 11.5px; color: var(--sub); width: 100%;
  transition: border-color .15s, color .15s;
}
.pp-addrow:hover { border-color: var(--blue); color: var(--blue); }
.pp-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.pp-3col { display: grid; grid-template-columns: auto 1fr auto; gap: 6px; align-items: center; }

/* ============ テンプレートストア ============ */
.store {
  position: fixed; inset: 0; background: #fbfbfc; z-index: 200;
  overflow-y: auto;
}
.store-head {
  position: sticky; top: 0; background: rgba(251,251,252,.9);
  backdrop-filter: blur(10px);
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 28px; border-bottom: 1px solid var(--line-soft); z-index: 5;
}
.store-brand { display: flex; align-items: center; gap: 10px; }
.store-name { font-size: 15px; font-weight: 700; }
.store-tag { font-size: 11px; color: var(--sub); border-left: 1px solid var(--line); padding-left: 10px; }
.store-actions { display: flex; gap: 8px; }
.store-lead { text-align: center; padding: 44px 24px 8px; }
.store-lead h1 { font-size: clamp(22px, 3.4vw, 32px); font-weight: 900; letter-spacing: .01em; }
.store-lead p { color: var(--sub); font-size: 13px; margin-top: 10px; }
.store-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 26px; padding: 36px 36px 70px; max-width: 1380px; margin: 0 auto;
}
.tpl-card {
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  overflow: hidden; text-align: left; padding: 0;
  transition: transform .2s ease, box-shadow .2s ease;
  display: flex; flex-direction: column;
}
.tpl-card:hover { transform: translateY(-4px); box-shadow: 0 18px 44px rgba(16,18,28,.12); }
.tpl-prev {
  aspect-ratio: 4 / 4.6; position: relative; overflow: hidden;
  background: #f3f3f5; pointer-events: none;
}
.tpl-prev iframe {
  width: 1280px; height: 2200px;
  transform: scale(var(--tpl-scale, .25)); transform-origin: top left;
  border: 0; position: absolute; top: 0; left: 0;
}
.tpl-meta { padding: 14px 16px 15px; display: flex; flex-direction: column; gap: 3px; }
.tpl-name { font-size: 13.5px; font-weight: 700; }
.tpl-tagline { font-size: 11px; color: var(--sub); }
.tpl-use {
  margin-top: 10px; align-self: flex-start;
  background: var(--ink); color: #fff; border-radius: 99px;
  font-size: 11.5px; font-weight: 700; padding: 7px 16px;
}
.tpl-card:hover .tpl-use { opacity: .85; }

/* ============ 内容ファースト導線（イントロ／チューザー） ============ */
.intro-box { max-width: 760px; margin: 28px auto 70px; padding: 0 24px; }
.intro-box textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 12px;
  padding: 18px; font-size: 13px; line-height: 1.9; resize: vertical;
  min-height: 280px; background: #fff; outline: none;
  box-shadow: 0 2px 14px rgba(16,18,28,.05);
}
.intro-box textarea:focus { border-color: var(--blue); }
.intro-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.intro-foot-r { display: flex; gap: 8px; }
.chooser-grid { max-width: 1240px; }
.chooser-card { cursor: pointer; text-align: left; }
.chooser-prev { aspect-ratio: 4 / 5; }
.chooser-card .tpl-name { font-size: 14.5px; }

/* ============ ホーム（作成物ダッシュボード） ============ */
#home { z-index: 190; }
.home-card { cursor: pointer; text-align: left; }
.home-prev { aspect-ratio: 4 / 3; display: block; position: relative; overflow: hidden; background: #f3f3f5; pointer-events: none; }
.home-prev iframe {
  width: 1280px; height: 1600px;
  transform: scale(var(--tpl-scale, .25)); transform-origin: top left;
  border: 0; position: absolute; top: 0; left: 0;
}
.home-prev-bn .bn-prevboard { display: block; transform-origin: top left; outline: none; box-shadow: none; }
.home-actions { display: flex; gap: 6px; margin-top: 10px; }
.home-actions .ghostbtn { position: relative; z-index: 2; }
.home-del { color: #c0392b; }
.home-del:hover { border-color: #e6b3ac; background: #fdf4f2; }
.home-empty { text-align: center; padding: 60px 20px 90px; color: var(--sub); font-size: 13px; }
.home-empty .mainbtn { margin-top: 16px; }
.create-grid { display: grid; gap: 10px; margin: 6px 0 4px; }
.create-card {
  border: 1px solid var(--line); border-radius: 12px; background: #fff;
  padding: 16px; text-align: left; display: grid; gap: 4px;
  transition: border-color .15s, background .15s;
}
.create-card:hover { border-color: var(--ink); background: #fafafa; }
.create-card .ic { width: 22px; height: 22px; margin-bottom: 4px; color: #3c3c42; }
.create-card b { font-size: 13.5px; }
.create-card small { font-size: 11px; color: var(--sub); line-height: 1.6; }

/* ============ 参考LPナレッジ ============ */
.home-tabs { display: inline-flex; gap: 4px; background: #f1f1f3; border-radius: 10px; padding: 4px; margin-bottom: 10px; }
.home-tab { font-size: 12.5px; font-weight: 600; color: var(--sub); padding: 8px 22px; border-radius: 7px; }
.home-tab.active { background: #fff; color: var(--ink); font-weight: 700; box-shadow: 0 1px 3px rgba(16,18,28,.1); }
.refs-bar { max-width: 1380px; margin: 0 auto; padding: 0 36px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.refs-filter { display: inline-flex; gap: 4px; background: #f1f1f3; border-radius: 9px; padding: 3px; }
.refs-filter .home-tab { padding: 6px 14px; font-size: 11.5px; }
.ref-badge {
  position: absolute; top: 8px; right: 8px; font-size: 9.5px; font-weight: 700;
  background: rgba(124,92,252,.92); color: #fff; border-radius: 5px; padding: 3px 8px;
}
.ref-analysis { margin-top: 10px; }
.ref-analysis .ap-note { margin: 0; }
.ref-analysis dl { display: grid; grid-template-columns: 64px 1fr; gap: 4px 10px; font-size: 11.5px; background: var(--line-soft); border-radius: 9px; padding: 12px 14px; }
.ref-analysis dt { color: var(--sub); font-weight: 700; }
.ref-analysis dd { margin: 0; }
.ref-analysis ul { margin: 4px 0 0; padding-left: 1.2em; }
.ref-thumb { aspect-ratio: 4 / 3; display: block; position: relative; overflow: hidden; background: #f3f3f5; }
.ref-thumb img { width: 100%; display: block; }
.ref-thumb-url {
  display: flex; align-items: center; justify-content: center; height: 100%;
  font-size: 12px; color: var(--sub); padding: 0 16px; text-align: center; word-break: break-all;
}
.ref-kind {
  position: absolute; top: 8px; left: 8px; font-size: 9.5px; font-weight: 700;
  background: rgba(17,17,20,.78); color: #fff; border-radius: 5px; padding: 3px 8px;
}
.ref-viewer-card { width: min(920px, 100%); }
.ref-pages { margin-top: 12px; display: grid; gap: 10px; max-height: 62vh; overflow-y: auto; }
.ref-pages img { width: 100%; border: 1px solid var(--line); border-radius: 8px; display: block; }

/* ============ バナー5案チューザー ============ */
.bn-size-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.bn-size {
  border: 1px solid var(--line); border-radius: 10px; background: #fff;
  padding: 11px 12px; text-align: left; cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.bn-size b { display: block; font-size: 12px; }
.bn-size small { font-size: 10px; color: var(--sub); }
.bn-size.active { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.bn-chooser-grid { max-width: 1280px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.bn-card { cursor: pointer; text-align: left; }
.bn-prevwrap { display: block; position: relative; overflow: hidden; background: #f3f3f5; pointer-events: none; }
.bn-prevboard { display: block; outline: none; box-shadow: none; transform-origin: top left; }
.bn-prevboard .bn-layer { cursor: default; }

/* ============ モーダル ============ */
.modal {
  position: fixed; inset: 0; z-index: 250;
  background: rgba(16,18,24,.45);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.modal-card {
  background: #fff; border-radius: 16px;
  width: min(640px, 100%); max-height: 90vh; overflow-y: auto;
  padding: 28px 30px 24px;
  box-shadow: 0 24px 80px rgba(10,12,20,.3);
}
.modal-card-s { width: min(460px, 100%); }
.modal-step { font-size: 10.5px; font-weight: 800; color: var(--blue); letter-spacing: .12em; margin-bottom: 8px; }
.modal-title { font-size: 19px; font-weight: 800; margin-bottom: 8px; }
.modal-hint { font-size: 12.5px; color: var(--sub); line-height: 1.8; margin-bottom: 16px; }
.modal textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 10px;
  padding: 14px; font-size: 12.5px; line-height: 1.8; resize: vertical;
  min-height: 200px; background: #fafafa; outline: none;
}
.modal textarea:focus { border-color: var(--blue); background: #fff; }
.modal-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 16px; }
.modal-foot-r { display: flex; gap: 8px; }
.publish-actions { display: grid; gap: 9px; margin: 6px 0 4px; }
.publish-actions .pa-btn {
  display: flex; align-items: center; gap: 12px;
  border: 1px solid var(--line); border-radius: 11px; padding: 13px 16px;
  text-align: left; transition: border-color .15s, background .15s;
}
.publish-actions .pa-btn:hover { border-color: var(--ink); background: #fafafa; }
.pa-btn b { font-size: 13px; display: block; }
.pa-btn small { font-size: 11px; color: var(--sub); }
.pa-btn .ic { flex: 0 0 auto; width: 20px; height: 20px; }

/* ============ AI画像生成 ============ */
.ai-btn {
  width: 100%; margin-top: 8px;
  border: 1px solid var(--line); border-radius: 8px;
  background: linear-gradient(120deg, #faf7ff, #f3f6ff);
  padding: 9px 12px; font-size: 11.5px; font-weight: 700; color: var(--ink);
  display: flex; align-items: center; justify-content: center; gap: 7px;
  transition: border-color .15s, box-shadow .15s;
}
.ai-btn:hover { border-color: #b9b0e8; box-shadow: 0 2px 10px rgba(124,92,252,.14); }
.ai-spark { color: #7c5cfc; font-size: 13px; }
.ai-styles { display: flex; gap: 6px; margin-bottom: 4px; }
.ai-style {
  flex: 1 1 0; cursor: pointer;
}
.ai-style input { display: none; }
.ai-style span {
  display: block; text-align: center; font-size: 11.5px; font-weight: 600;
  border: 1px solid var(--line); border-radius: 8px; padding: 9px 4px;
  transition: border-color .15s, background .15s;
}
.ai-style input:checked + span { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); background: #fafafa; }
#aiPrompt { min-height: 96px; }
.ai-actions { display: flex; align-items: center; gap: 14px; margin-top: 12px; flex-wrap: wrap; }
.ai-status { font-size: 11.5px; color: var(--sub); flex: 1 1 200px; line-height: 1.6; }
.ai-status[data-kind="err"] { color: #c0392b; }
.ai-status[data-kind="ok"] { color: #1e7e4e; }
.ai-result { margin-top: 14px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--line-soft); }
.ai-result img { display: block; width: 100%; }
.ai-engine { font-size: 10.5px; color: var(--sub); margin-top: 10px; line-height: 1.6; }
.ai-fb { margin-top: 14px; }
.ai-fb-row { display: flex; gap: 8px; }
.ai-fb-row .pp-input { flex: 1 1 auto; }
.ai-fb-row .mainbtn { flex: 0 0 auto; white-space: nowrap; padding: 10px 16px; }
.ai-history { display: flex; align-items: center; gap: 7px; margin-top: 10px; flex-wrap: wrap; }
.ai-history-label { font-size: 10.5px; color: var(--sub); }
.ai-history-thumb {
  width: 64px; height: 42px; object-fit: cover; border-radius: 6px; cursor: pointer;
  border: 2px solid transparent; transition: border-color .15s, transform .12s;
}
.ai-history-thumb:hover { transform: scale(1.06); }
.ai-history-thumb.active { border-color: var(--ink); }
.aib-list { display: grid; gap: 7px; margin-top: 14px; max-height: 320px; overflow-y: auto; }
.aib-row {
  display: flex; align-items: center; gap: 12px;
  border: 1px solid var(--line); border-radius: 9px; padding: 9px 12px;
}
.aib-status { flex: 0 0 96px; font-size: 11px; font-weight: 700; color: var(--sub); }
.aib-status[data-kind="run"] { color: var(--blue); }
.aib-status[data-kind="ok"] { color: #1e7e4e; }
.aib-status[data-kind="err"] { color: #c0392b; font-weight: 500; }
.aib-label { flex: 1 1 auto; font-size: 12px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aib-thumb { width: 56px; height: 36px; object-fit: cover; border-radius: 5px; flex: 0 0 auto; }

/* ============ AI修正アシスタント ============ */
.ai-fab {
  position: fixed; right: 22px; bottom: 76px; z-index: 120;
  background: var(--ink); color: #fff;
  border-radius: 999px; padding: 12px 20px;
  font-size: 12.5px; font-weight: 700;
  display: inline-flex; align-items: center; gap: 8px;
  box-shadow: 0 8px 28px rgba(16,18,28,.3);
  transition: transform .15s, opacity .15s;
}
.ai-fab:hover { transform: translateY(-2px); }
.ai-fab .ai-spark { color: #b9a4ff; }
.ai-chat {
  position: fixed; right: 22px; bottom: 132px; z-index: 130;
  width: min(380px, calc(100vw - 44px));
  height: min(480px, calc(100vh - 200px));
  background: #fff; border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 24px 70px rgba(10,12,20,.28);
  display: flex; flex-direction: column; overflow: hidden;
}
.aic-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px 8px;
}
.aic-title { font-size: 13px; font-weight: 800; display: inline-flex; align-items: center; gap: 7px; }
.aic-title .ai-spark { color: #7c5cfc; }
.aic-engine { margin: 0 14px 6px; }
.aic-log {
  flex: 1 1 0; overflow-y: auto; padding: 6px 14px 10px;
  display: flex; flex-direction: column; gap: 8px; min-height: 0;
}
.aic-msg {
  font-size: 12px; line-height: 1.75; border-radius: 12px; padding: 9px 12px;
  max-width: 92%; white-space: pre-wrap; word-break: break-word;
}
.aic-user { align-self: flex-end; background: var(--ink); color: #fff; border-bottom-right-radius: 4px; }
.aic-ai { align-self: flex-start; background: var(--line-soft); color: var(--ink); border-bottom-left-radius: 4px; }
.aic-thinking { color: var(--sub); }
.aic-thinking::after { content: ""; display: inline-block; width: 1em; animation: aicdots 1.4s steps(4) infinite; overflow: hidden; vertical-align: bottom; }
@keyframes aicdots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }
.aic-err { color: #c0392b; background: #fdf0ee; }
.aic-input {
  display: flex; gap: 8px; padding: 10px 12px 12px;
  border-top: 1px solid var(--line-soft);
}
.aic-input textarea {
  flex: 1 1 auto; border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 11px; font-size: 12px; resize: none; outline: none; background: #fafafa;
}
.aic-input textarea:focus { border-color: var(--blue); background: #fff; }
.aic-input .mainbtn { flex: 0 0 auto; padding: 8px 16px; align-self: flex-end; }

/* ============ レスポンシブ（エディタ自体） ============ */
@media (max-width: 1100px) {
  .addpanel { width: 220px; }
  .props { width: 230px; }
}
@media (max-width: 900px) {
  .addpanel { display: none; }
  .editor.left-open .addpanel {
    display: flex; position: absolute; left: 44px; top: 44px; bottom: 0; z-index: 50;
    box-shadow: 12px 0 30px rgba(16,18,28,.08);
  }
  .props { width: 220px; }
}
@media (max-width: 720px) {
  .props { display: none; }
  .editor.right-open .props {
    display: flex; position: absolute; right: 0; top: 44px; bottom: 0; z-index: 50;
    width: min(280px, 86vw);
    box-shadow: -12px 0 30px rgba(16,18,28,.12);
  }
  .tb-proj, .tb-sep, #collapseRightTop, .tb-add, .tb-collapse { display: none; }
  .tb-page { max-width: 110px; }
  .topbar { padding: 0 8px; }
  .tb-left, .tb-right { gap: 5px; }
  .canvas-scroll { padding: 4px 12px 90px; }
}

/* v2.9 UXブラッシュアップ */
.mainbtn-s { padding: 6px 12px; font-size: 11.5px; border-radius: 8px; }
.ap-card small { display: block; font-size: 9.5px; color: var(--sub); line-height: 1.25; margin-top: 2px; }
.intro-foot .ai-status { font-size: 12px; color: var(--sub); margin-right: 10px; }
