/* ============================================================
   AI Target Flyer Generator — app shell design system
   ============================================================ */

:root {
  /* type */
  --font-ui: "Zen Kaku Gothic New", system-ui, sans-serif;
  --font-num: "Zen Kaku Gothic New", system-ui, sans-serif;

  /* neutrals (cool near-white, water/clean theme) */
  --bg:        oklch(0.985 0.004 245);
  --bg-2:      oklch(0.965 0.006 245);
  --surface:   #ffffff;
  --ink:       oklch(0.255 0.022 260);
  --ink-soft:  oklch(0.455 0.020 260);
  --ink-faint: oklch(0.625 0.016 260);
  --line:      oklch(0.915 0.007 260);
  --line-soft: oklch(0.945 0.006 260);

  /* accents — share L/C, vary hue */
  --accent:       oklch(0.555 0.155 256);
  --accent-press: oklch(0.485 0.155 256);
  --accent-soft:  oklch(0.955 0.030 256);
  --accent-line:  oklch(0.870 0.060 256);
  --teal:         oklch(0.620 0.090 205);
  --teal-soft:    oklch(0.960 0.028 205);

  --ok:    oklch(0.62 0.13 155);
  --ok-soft: oklch(0.955 0.035 155);
  --warn:  oklch(0.66 0.13 65);
  --warn-soft: oklch(0.960 0.045 75);

  --radius: 14px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px oklch(0.5 0.02 260 / 0.06), 0 1px 3px oklch(0.5 0.02 260 / 0.05);
  --shadow-md: 0 4px 14px oklch(0.45 0.03 260 / 0.08), 0 1px 4px oklch(0.45 0.03 260 / 0.05);
  --shadow-lg: 0 18px 50px oklch(0.40 0.04 260 / 0.16), 0 4px 14px oklch(0.40 0.04 260 / 0.08);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.6;
}
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; }
::selection { background: var(--accent-soft); }

/* ---------- app frame ---------- */
.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* top bar */
.topbar {
  height: 60px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 22px;
  background: oklch(1 0 0 / 0.82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 40;
}
.brandmark {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; letter-spacing: -0.01em; font-size: 15px;
  white-space: nowrap; flex: none;
}
.brandmark .glyph {
  width: 26px; height: 26px; border-radius: 8px;
  background: linear-gradient(150deg, var(--accent), var(--teal));
  display: grid; place-items: center; color: #fff; flex: none;
  box-shadow: var(--shadow-sm);
}
.brandmark .glyph svg { width: 15px; height: 15px; }
.brandmark .sub { color: var(--ink-faint); font-weight: 500; font-size: 12px; }
.topbar .poc-tag {
  margin-left: 4px; font-size: 11px; font-weight: 600;
  color: var(--accent); background: var(--accent-soft);
  border: 1px solid var(--accent-line); padding: 2px 8px; border-radius: 999px;
}
.topbar .spacer { flex: 1; }
.topbar .ghost-btn {
  border: 1px solid var(--line); background: var(--surface);
  color: var(--ink-soft); font-size: 13px; font-weight: 600;
  padding: 7px 13px; border-radius: 9px;
  display: inline-flex; align-items: center; gap: 7px;
}
.topbar .ghost-btn:hover { border-color: var(--ink-faint); color: var(--ink); }

/* ---------- mode tabs (条件指定 / 改善 の入力モード切替・v3 準拠) ---------- */
.mode-tabs {
  display: flex; align-items: stretch; gap: 8px;
  padding: 8px 22px 0; height: 64px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 60px; z-index: 39;
}
.mode-tab {
  position: relative; flex: none;
  display: flex; align-items: center; gap: 11px;
  padding: 0 20px 9px; border: none; background: none; cursor: pointer;
  border-bottom: 2.5px solid transparent; transition: all .16s;
}
.mode-tab .mt-ico {
  width: 38px; height: 38px; border-radius: 11px; flex: none;
  display: grid; place-items: center;
  background: var(--bg-2); color: var(--ink-faint);
  border: 1px solid var(--line); transition: all .16s;
}
.mode-tab .mt-text { text-align: left; }
.mode-tab .mt-title {
  font-size: 14px; font-weight: 700; color: var(--ink-soft); line-height: 1.2;
  display: flex; align-items: center; gap: 7px;
}
.mode-tab .mt-sub { font-size: 11px; color: var(--ink-faint); margin-top: 2px; font-weight: 500; }
.mode-tab:hover .mt-ico { border-color: var(--accent-line); }
.mode-tab:hover .mt-title { color: var(--ink); }
.mode-tab.on { border-bottom-color: var(--accent); }
.mode-tab.on .mt-ico { background: var(--accent); color: #fff; border-color: var(--accent); box-shadow: var(--shadow-sm); }
.mode-tab.on .mt-title { color: var(--ink); }
.mode-tab .mt-badge {
  font-size: 9.5px; font-weight: 800; letter-spacing: .03em;
  color: var(--accent-press); background: var(--accent-soft);
  border: 1px solid var(--accent-line); padding: 1px 7px; border-radius: 999px;
}
.mode-tabs .mt-spacer { flex: 1; }
.mode-tabs .mt-side { display: flex; align-items: center; gap: 10px; padding-bottom: 9px; }

/* ---------- stepper ---------- */
.stepper {
  display: flex; align-items: center; gap: 0;
  padding: 0 22px; height: 52px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}
.step {
  display: flex; align-items: center; gap: 9px;
  padding: 6px 4px; flex: none;
  color: var(--ink-faint); font-size: 13px; font-weight: 600;
  background: none; border: none;
}
.step .dot {
  width: 23px; height: 23px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 11.5px; font-weight: 700;
  background: var(--bg-2); color: var(--ink-faint);
  border: 1.5px solid var(--line); transition: all .2s;
}
.step.done .dot { background: var(--accent); color: #fff; border-color: var(--accent); }
.step.active { color: var(--ink); }
.step.active .dot { background: var(--accent); color: #fff; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.step:disabled { cursor: default; }
.step:not(:disabled):hover .dot { border-color: var(--accent-line); }
.step-sep { width: 26px; height: 1.5px; background: var(--line); flex: none; margin: 0 4px; }
.step-sep.done { background: var(--accent); }

/* ---------- canvas / scroll body ---------- */
.canvas {
  flex: 1;
  overflow-y: auto;
  padding: 30px 22px 90px;
}
.canvas-inner { max-width: 1080px; margin: 0 auto; }
.canvas-inner.wide { max-width: 1240px; }

/* section heading */
.page-head { margin-bottom: 22px; }
.page-head h1 {
  font-size: 22px; font-weight: 800; letter-spacing: -0.02em; margin: 0 0 5px;
}
.page-head p { margin: 0; color: var(--ink-soft); font-size: 14px; max-width: 60ch; }
.eyebrow {
  font-size: 11.5px; font-weight: 700; letter-spacing: 0.08em;
  color: var(--accent); text-transform: uppercase; margin-bottom: 9px;
}

/* ---------- product select ---------- */
.product-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.product-card {
  text-align: left; border: 1.5px solid var(--line); background: var(--surface);
  border-radius: 12px; padding: 15px 16px; transition: all .15s; position: relative;
  display: flex; align-items: flex-start; gap: 12px;
}
.product-card:hover { border-color: var(--accent-line); }
.product-card.on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.product-card .pr-ico { width: 38px; height: 38px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; flex: none; }
.product-card .pr-ico svg { width: 20px; height: 20px; }
.product-card .pr-name { font-weight: 800; font-size: 14.5px; }
.product-card .pr-desc { font-size: 11.5px; color: var(--ink-faint); line-height: 1.5; margin-top: 2px; }
.product-card .pr-check { position: absolute; top: 12px; right: 12px; width: 19px; height: 19px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; opacity: 0; transform: scale(.6); transition: all .18s; }
.product-card.on .pr-check { opacity: 1; transform: scale(1); }

/* url fetch row */
.url-row { display: flex; gap: 8px; align-items: stretch; }
.url-row .input { flex: 1; }
.info-box { margin-top: 10px; background: var(--teal-soft); border: 1px solid oklch(0.88 0.05 205); border-radius: 10px; padding: 11px 13px; font-size: 12.5px; color: var(--ink-soft); line-height: 1.6; display: flex; gap: 9px; }
.info-box .ib-ico { color: var(--teal); flex: none; margin-top: 1px; }

/* add-appeal */
.appeal-add { display: flex; gap: 8px; margin-top: 10px; max-width: 340px; }
.appeal-add .input { flex: 1; padding: 7px 11px; font-size: 12.5px; }

/* ---------- sliders ---------- */
.slider-field { display: flex; flex-direction: column; gap: 10px; }
.slider-head { display: flex; align-items: baseline; justify-content: space-between; }
.slider-val { font-weight: 800; font-size: 15px; color: var(--accent-press); }
.slider-val small { font-weight: 600; font-size: 11.5px; color: var(--ink-faint); margin-left: 5px; }
input[type=range].rng {
  -webkit-appearance: none; appearance: none; width: 100%; height: 6px; border-radius: 999px;
  background: var(--line); outline: none; cursor: pointer; margin: 6px 0;
}
input[type=range].rng::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent); border: 3px solid #fff; box-shadow: var(--shadow-md); cursor: pointer; transition: transform .1s;
}
input[type=range].rng::-webkit-slider-thumb:active { transform: scale(1.12); }
input[type=range].rng::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: var(--accent); border: 3px solid #fff; box-shadow: var(--shadow-md); cursor: pointer; }
.slider-ticks { display: flex; justify-content: space-between; font-size: 11px; font-weight: 600; color: var(--ink-faint); }
.slider-ticks span { flex: 1; text-align: center; }
.slider-ticks span:first-child { text-align: left; }
.slider-ticks span:last-child { text-align: right; }
.slider-ticks span.on { color: var(--accent-press); }

@media (max-width: 720px) { .product-grid { grid-template-columns: 1fr; } }

/* ---------- card ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: 22px 24px; }

/* ---------- form ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px 26px; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field.full { grid-column: 1 / -1; }
.field > label {
  font-size: 12.5px; font-weight: 700; color: var(--ink);
  display: flex; align-items: center; gap: 7px;
}
.field .hint { font-weight: 500; color: var(--ink-faint); font-size: 11.5px; }
.req { color: var(--accent); font-size: 10px; }

.input, .textarea, .select {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13.5px; color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .textarea:focus, .select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.textarea { resize: vertical; min-height: 64px; line-height: 1.55; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5' stroke='%23667' stroke-width='1.4' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; padding-right: 30px; }

/* chip select */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--line); background: var(--surface);
  color: var(--ink-soft); font-size: 12.5px; font-weight: 600;
  padding: 7px 13px; border-radius: 999px; transition: all .15s;
  display: inline-flex; align-items: center; gap: 7px;
}
.chip:hover { border-color: var(--accent-line); color: var(--ink); }
.chip.on {
  background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-press);
}
.chip .x { opacity: .6; font-size: 14px; line-height: 1; }
.chip.add { border-style: dashed; color: var(--ink-faint); }

/* segmented */
.seg { display: inline-flex; background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 3px; }
.seg button {
  border: none; background: none; color: var(--ink-soft);
  font-size: 12.5px; font-weight: 600; padding: 6px 14px; border-radius: 7px; transition: all .15s;
}
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

/* persona cards */
.persona-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.persona-card {
  text-align: left; border: 1.5px solid var(--line); background: var(--surface);
  border-radius: 12px; padding: 14px; transition: all .15s; position: relative;
  display: flex; flex-direction: column; gap: 7px;
}
.persona-card:hover { border-color: var(--accent-line); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.persona-card.on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.persona-card .pc-emoji { font-size: 22px; }
.persona-card .pc-ico { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; }
.persona-card .pc-ico svg { width: 17px; height: 17px; }
.persona-card .pc-name { font-weight: 800; font-size: 14px; }
.persona-card .pc-desc { font-size: 11.5px; color: var(--ink-faint); line-height: 1.5; }
.persona-card .pc-check {
  position: absolute; top: 11px; right: 11px; width: 19px; height: 19px; border-radius: 50%;
  background: var(--accent); color: #fff; display: grid; place-items: center; opacity: 0; transform: scale(.6); transition: all .18s;
}
.persona-card.on .pc-check { opacity: 1; transform: scale(1); }

/* ---------- buttons ---------- */
.btn {
  border: 1px solid transparent; border-radius: 10px;
  font-size: 13.5px; font-weight: 700; padding: 11px 20px;
  display: inline-flex; align-items: center; gap: 8px; transition: all .15s;
}
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--accent); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--accent-press); box-shadow: var(--shadow-md); }
.btn-primary:disabled { background: var(--line); color: var(--ink-faint); box-shadow: none; cursor: default; }
.btn-ghost { background: var(--surface); border-color: var(--line); color: var(--ink-soft); }
.btn-ghost:hover { border-color: var(--ink-faint); color: var(--ink); }
.btn-soft { background: var(--accent-soft); color: var(--accent-press); }
.btn-soft:hover { background: var(--accent-line); }
.btn-lg { padding: 13px 26px; font-size: 14.5px; }

/* sticky footer actions */
.footer-bar {
  position: sticky; bottom: 0; left: 0; right: 0;
  background: oklch(1 0 0 / 0.85); backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  padding: 13px 22px; display: flex; align-items: center; gap: 12px; z-index: 30;
}
.footer-bar .meta { font-size: 12.5px; color: var(--ink-faint); }
.footer-bar .spacer { flex: 1; }

/* ---------- prompt preview ---------- */
.prompt-wrap { display: grid; grid-template-columns: 1.35fr 1fr; gap: 22px; align-items: start; }
.prompt-box {
  background: oklch(0.22 0.02 260); color: oklch(0.92 0.01 250);
  border-radius: var(--radius); padding: 0; overflow: hidden;
  border: 1px solid oklch(0.32 0.02 260); box-shadow: var(--shadow-md);
}
.prompt-box .pb-head {
  display: flex; align-items: center; gap: 9px; padding: 11px 15px;
  border-bottom: 1px solid oklch(0.30 0.02 260); font-size: 12px; color: oklch(0.70 0.01 250); font-weight: 600;
}
.prompt-box .pb-dots { display: flex; gap: 6px; }
.prompt-box .pb-dots i { width: 10px; height: 10px; border-radius: 50%; display: block; }
.prompt-box textarea {
  width: 100%; background: none; border: none; color: oklch(0.90 0.015 250);
  font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12.5px; line-height: 1.7;
  padding: 16px 18px; resize: vertical; min-height: 360px;
}
.prompt-box textarea:focus { outline: none; }
.prompt-side .ps-card { margin-bottom: 14px; }
.spec-row { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line-soft); font-size: 13px; }
.spec-row:last-child { border-bottom: none; }
.spec-row .k { color: var(--ink-faint); font-weight: 600; flex: none; }
.spec-row .v { color: var(--ink); text-align: right; font-weight: 600; }

.ai-badge { display: inline-flex; align-items: center; gap: 7px; font-size: 11.5px; font-weight: 700; color: var(--teal); background: var(--teal-soft); border: 1px solid oklch(0.88 0.05 205); padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.ai-badge .pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--teal); }
.ai-badge.live .pulse { animation: pulse 1.4s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .3; } }

/* ---------- generating ---------- */
.gen-stage { display: grid; place-items: center; padding: 60px 0; }
.gen-card { text-align: center; max-width: 460px; }
.gen-orbit { width: 96px; height: 96px; margin: 0 auto 26px; position: relative; }
.gen-orbit .core { position: absolute; inset: 32px; border-radius: 50%; background: linear-gradient(150deg, var(--accent), var(--teal)); box-shadow: var(--shadow-md); }
.gen-orbit .ring { position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--accent-soft); border-top-color: var(--accent); animation: spin 1s linear infinite; }
.gen-orbit .ring.r2 { inset: 14px; border-color: var(--teal-soft); border-top-color: var(--teal); animation-duration: 1.5s; animation-direction: reverse; }
@keyframes spin { to { transform: rotate(360deg); } }
.gen-steps { margin-top: 24px; display: flex; flex-direction: column; gap: 10px; text-align: left; }
.gen-step { display: flex; align-items: center; gap: 11px; font-size: 13px; color: var(--ink-faint); transition: color .3s; }
.gen-step.active { color: var(--ink); font-weight: 600; }
.gen-step.done { color: var(--ink-soft); }
.gen-step .gs-ico { width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--line); display: grid; place-items: center; flex: none; }
.gen-step.done .gs-ico { background: var(--ok); border-color: var(--ok); color: #fff; }
.gen-step.active .gs-ico { border-color: var(--accent); color: var(--accent); }

/* ---------- results grid ---------- */
.results-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; align-items: start; }
.result-col { display: flex; flex-direction: column; gap: 12px; }
.result-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.result-tag { font-size: 12px; font-weight: 700; color: var(--ink); display: inline-flex; align-items: center; gap: 8px; }
.result-tag .ab { width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; color: #fff; font-size: 12px; font-weight: 800; }
.result-frame {
  position: relative; border-radius: 12px; overflow: hidden;
  border: 1px solid var(--line); box-shadow: var(--shadow-md); transition: all .2s; cursor: pointer; background: #fff;
}
.result-frame:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.result-frame.sel { box-shadow: 0 0 0 3px var(--accent), var(--shadow-lg); }
.result-actions { display: flex; gap: 8px; }
.result-actions .btn { flex: 1; justify-content: center; padding: 9px; font-size: 12.5px; }
.result-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.tagpill { font-size: 11px; font-weight: 600; color: var(--ink-soft); background: var(--bg-2); border: 1px solid var(--line); padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.sel-flag { position: absolute; top: 10px; left: 10px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 999px; z-index: 5; display: flex; align-items: center; gap: 5px; box-shadow: var(--shadow-sm); }
.sel-pill { display: inline-flex; align-items: center; gap: 5px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 999px; box-shadow: var(--shadow-sm); }

/* ---------- edit screen ---------- */
.edit-layout { display: grid; grid-template-columns: 1fr 392px; gap: 24px; align-items: start; }
.edit-stage { display: flex; flex-direction: column; gap: 16px; }
.ba-toggle { display: inline-flex; background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 3px; }
.ba-toggle button { border: none; background: none; padding: 7px 16px; font-size: 12.5px; font-weight: 700; color: var(--ink-soft); border-radius: 7px; }
.ba-toggle button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.ba-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.ba-cell { display: flex; flex-direction: column; gap: 9px; }
.ba-label { font-size: 12px; font-weight: 700; display: flex; align-items: center; gap: 7px; }
.ba-label .tg { font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.ba-label .tg.before { background: var(--bg-2); color: var(--ink-faint); border: 1px solid var(--line); }
.ba-label .tg.after { background: var(--ok-soft); color: var(--ok); border: 1px solid oklch(0.85 0.06 155); }
.ba-frame { border-radius: 12px; overflow: hidden; border: 1px solid var(--line); box-shadow: var(--shadow-md); background: #fff; }
.ba-frame.changed { box-shadow: 0 0 0 2px var(--ok), var(--shadow-md); }

.edit-panel { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 14px; }
.panel-block { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.panel-block .pb-title { padding: 13px 16px; font-size: 13px; font-weight: 800; border-bottom: 1px solid var(--line-soft); display: flex; align-items: center; gap: 9px; }
.panel-block .pb-body { padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }
.pb-title .ico { width: 22px; height: 22px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; }
.pb-title .ico svg { width: 13px; height: 13px; }

.nl-input { display: flex; flex-direction: column; gap: 9px; }
.nl-suggest { display: flex; flex-wrap: wrap; gap: 6px; }
.nl-suggest button { font-size: 11.5px; font-weight: 600; color: var(--ink-soft); background: var(--bg-2); border: 1px solid var(--line); border-radius: 999px; padding: 5px 11px; transition: all .15s; }
.nl-suggest button:hover { border-color: var(--accent-line); color: var(--accent-press); background: var(--accent-soft); }

.item-edit { display: flex; flex-direction: column; gap: 4px; }
.item-edit label { font-size: 11.5px; font-weight: 700; color: var(--ink-soft); }
.item-row { display: flex; gap: 8px; align-items: center; }

/* integrity check */
.integrity { display: flex; flex-direction: column; gap: 7px; }
.intg-row { display: flex; align-items: center; gap: 10px; font-size: 12.5px; padding: 7px 10px; border-radius: 8px; background: var(--bg-2); }
.intg-row .ic { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.intg-row.ok .ic { background: var(--ok); color: #fff; }
.intg-row.changed .ic { background: var(--warn); color: #fff; }
.intg-row .nm { font-weight: 600; flex: 1; }
.intg-row .st { font-size: 11px; font-weight: 700; white-space: nowrap; flex: none; }
.intg-row.ok .st { color: var(--ok); }
.intg-row.changed .st { color: var(--warn); }
.intg-summary { font-size: 12px; color: var(--ink-soft); padding: 9px 11px; border-radius: 8px; background: var(--ok-soft); border: 1px solid oklch(0.88 0.05 155); display: flex; gap: 9px; align-items: flex-start; line-height: 1.5; }

.history-row { display: flex; align-items: flex-start; gap: 10px; font-size: 12px; padding: 8px 0; border-bottom: 1px solid var(--line-soft); }
.history-row:last-child { border: none; }
.history-row .hidx { width: 18px; height: 18px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-press); font-size: 10px; font-weight: 800; display: grid; place-items: center; flex: none; margin-top: 1px; }
.history-row .htext { color: var(--ink-soft); line-height: 1.5; }
.history-row .htext b { color: var(--ink); font-weight: 700; }

/* ---------- export ---------- */
.export-layout { display: grid; grid-template-columns: 1fr 360px; gap: 28px; align-items: start; }
.export-preview { display: grid; place-items: center; padding: 24px; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); }
.export-opt { display: flex; flex-direction: column; gap: 14px; }
.fmt-card { display: flex; align-items: center; gap: 13px; padding: 14px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface); transition: all .15s; text-align: left; }
.fmt-card:hover { border-color: var(--accent-line); }
.fmt-card.on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.fmt-card .fc-ico { width: 40px; height: 40px; border-radius: 9px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; flex: none; }
.fmt-card .fc-ico svg { width: 20px; height: 20px; }
.fmt-card .fc-name { font-weight: 800; font-size: 14px; }
.fmt-card .fc-desc { font-size: 11.5px; color: var(--ink-faint); }
.fmt-card .fc-check { margin-left: auto; width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--line); flex: none; display: grid; place-items: center; }
.fmt-card.on .fc-check { background: var(--accent); border-color: var(--accent); color: #fff; }

.done-toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; font-size: 13px; font-weight: 600; padding: 12px 20px; border-radius: 11px; box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 10px; z-index: 100; animation: toastIn .3s; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 12px); } }

/* ② 部分修正の処理中オーバーレイ（AFTER プレビューに重ねる） */
.edit-busy-overlay { position: absolute; inset: 0; z-index: 6; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 11px; background: oklch(1 0 0 / .82); backdrop-filter: blur(1.5px); border-radius: 6px; text-align: center; padding: 16px; animation: fadeIn .2s; }
.edit-busy-spinner { width: 38px; height: 38px; border-radius: 50%; border: 3px solid var(--accent-soft); border-top-color: var(--accent); animation: editspin .8s linear infinite; }
@keyframes editspin { to { transform: rotate(360deg); } }
.edit-busy-label { font-size: 13px; font-weight: 800; color: var(--accent-press); display: inline-flex; align-items: center; gap: 6px; }
.edit-busy-sub { font-size: 11px; color: var(--ink-faint); max-width: 220px; line-height: 1.5; }

/* ⑤ ギャラリー（一覧 + 詳細モーダル） */
.gallery-empty { text-align: center; padding: 70px 0; display: flex; flex-direction: column; align-items: center; }
.gallery-empty .ge-ico { width: 70px; height: 70px; border-radius: 18px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; margin-bottom: 18px; }
.gallery-empty .ge-title { font-size: 17px; font-weight: 800; margin-bottom: 6px; }
.gallery-empty .ge-desc { font-size: 13.5px; color: var(--ink-soft); max-width: 440px; line-height: 1.6; }

.gallery-list { display: flex; flex-direction: column; gap: 12px; }
.gen-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; text-align: left; width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 13px; padding: 15px 18px; box-shadow: var(--shadow-sm); cursor: pointer; transition: all .18s; }
.gen-row:hover { border-color: var(--accent-line); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.gen-row-main { display: flex; flex-direction: column; gap: 7px; min-width: 0; flex: 1; }
.gen-row-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.gen-row-prompt { font-size: 12px; color: var(--ink-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 560px; }
.gen-row-side { display: flex; flex-direction: column; align-items: flex-end; gap: 7px; flex: none; }
.gen-row-open { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: var(--accent-press); }
.gbh-prod { font-size: 13.5px; font-weight: 800; white-space: nowrap; }
.gbh-persona { font-size: 12px; font-weight: 600; color: var(--accent-press); background: var(--accent-soft); padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.gbh-count { font-size: 12px; font-weight: 600; color: var(--ink-faint); white-space: nowrap; }
.gbh-date { font-size: 12px; color: var(--ink-faint); display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }

.gmodal-backdrop { position: fixed; inset: 0; background: oklch(0.25 0.03 260 / .5); backdrop-filter: blur(4px); display: grid; place-items: center; z-index: 200; padding: 28px; animation: fadeIn .2s; }
.gmodal { background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg); display: grid; grid-template-columns: auto 392px; max-width: 880px; width: 100%; max-height: 88vh; overflow: hidden; position: relative; }
.gmodal-close { position: absolute; top: 14px; right: 14px; width: 34px; height: 34px; border-radius: 9px; border: none; background: oklch(1 0 0 / .9); color: var(--ink); display: grid; place-items: center; z-index: 5; box-shadow: var(--shadow-sm); cursor: pointer; }
.gmodal-close:hover { background: var(--bg-2); }
.gmodal-preview { background: var(--bg-2); padding: 28px; display: flex; flex-direction: column; align-items: center; justify-content: center; border-right: 1px solid var(--line); min-width: 300px; }
.gmodal-side { padding: 24px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.gms-tag { font-size: 12.5px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.gms-tag .ab { width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; color: #fff; font-size: 12px; font-weight: 800; flex: none; }
.gms-title { font-size: 17px; font-weight: 800; margin: 0; letter-spacing: -.01em; }
.gms-specs { border: 1px solid var(--line); border-radius: 11px; padding: 4px 14px; }
.gms-label { font-size: 12px; font-weight: 800; display: flex; align-items: center; gap: 7px; margin-bottom: 8px; }
.gms-props-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.gms-prop { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px; border: 1.5px solid var(--line); border-radius: 9px; background: var(--surface); cursor: pointer; transition: all .15s; }
.gms-prop:hover { border-color: var(--accent-line); }
.gms-prop.on { border-color: var(--accent); background: var(--accent-soft); }
.gms-prop-lbl { font-size: 11px; font-weight: 700; color: var(--ink-soft); }
.gms-prompt { border: 1px solid var(--line); border-radius: 11px; overflow: hidden; }
.gms-prompt-toggle { width: 100%; display: flex; align-items: center; gap: 8px; padding: 12px 14px; background: var(--bg-2); border: none; font-size: 13px; font-weight: 800; color: var(--ink); cursor: pointer; }
.gms-prompt-toggle:hover { background: var(--line-soft); }
.gms-prompt-body { border-top: 1px solid var(--line); }
.gpb-head { display: flex; align-items: center; gap: 8px; padding: 8px 12px; font-size: 11px; font-weight: 600; color: var(--ink-faint); background: var(--bg); border-bottom: 1px solid var(--line-soft); }
.gpb-copy { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-soft); font-size: 11px; font-weight: 700; padding: 4px 9px; border-radius: 7px; cursor: pointer; }
.gpb-copy:hover { border-color: var(--accent-line); color: var(--accent-press); }
.gms-prompt-body pre { margin: 0; padding: 14px; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 11.5px; line-height: 1.7; color: var(--ink-soft); white-space: pre-wrap; word-break: break-word; max-height: 240px; overflow-y: auto; }
.gms-actions { display: flex; gap: 8px; margin-top: auto; padding-top: 4px; }

/* responsive */
@media (max-width: 1080px) {
  .results-grid { grid-template-columns: 1fr 1fr; }
  .prompt-wrap, .edit-layout, .export-layout { grid-template-columns: 1fr; }
  .edit-panel { position: static; }
}
@media (max-width: 720px) {
  .form-grid, .persona-grid, .results-grid, .ba-compare { grid-template-columns: 1fr; }
  /* ⑤ 詳細モーダルは縦積みにする。 */
  .gmodal { grid-template-columns: 1fr; max-width: 440px; }
  .gmodal-preview { border-right: none; border-bottom: 1px solid var(--line); min-width: 0; }
}

/* subtle entrance (no opacity gate — must stay visible if animation never runs) */
.fade-in { animation: fadeIn .35s ease; }
@keyframes fadeIn { from { transform: translateY(6px); } to { transform: none; } }

/* ===== ⑦ ギャラリー刷新（案単位・バッチ束ね・採用/修正済バッジ・確認ダイアログ） ===== */
.gallery-toolbar { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.gallery-toolbar .chip .cnt { margin-left: 6px; font-size: 11px; background: var(--bg-2); border-radius: 999px; padding: 1px 7px; color: var(--ink-faint); }
.gallery-toolbar .chip.on .cnt { background: oklch(1 0 0 / .5); color: var(--accent-press); }
.filter-rows { display: flex; flex-direction: column; gap: 10px; flex: 1; min-width: 280px; }
.filter-row { display: flex; align-items: flex-start; gap: 12px; }
.filter-label { font-size: 12px; font-weight: 700; color: var(--ink-soft); display: inline-flex; align-items: center; gap: 6px; padding-top: 7px; flex: none; width: 72px; }
.filter-label svg { color: var(--ink-faint); }
.filter-row .chips { flex: 1; }
.gclear-btn { flex: none; margin-left: auto; }

.gallery-batches { display: flex; flex-direction: column; gap: 30px; }
.gbatch-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; padding-bottom: 11px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.gbh-left { display: flex; align-items: center; gap: 10px; }

.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 18px; }
.gcard { display: flex; flex-direction: column; gap: 9px; }
.gcard-frame { position: relative; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); box-shadow: var(--shadow-sm); cursor: pointer; background: #fff; transition: all .2s; }
.gcard-frame:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.gcard-overlay { position: absolute; inset: 0; background: oklch(0.3 0.03 260 / 0); display: grid; place-items: center; transition: background .2s; opacity: 0; }
.gcard-frame:hover .gcard-overlay { background: oklch(0.3 0.03 260 / .32); opacity: 1; }
.gov-btn { display: inline-flex; align-items: center; gap: 7px; background: #fff; color: var(--ink); font-size: 12.5px; font-weight: 700; padding: 9px 15px; border-radius: 9px; border: none; box-shadow: var(--shadow-md); cursor: pointer; }
.gcard-flag { position: absolute; top: 9px; font-size: 10.5px; font-weight: 700; padding: 3px 9px; border-radius: 999px; display: flex; align-items: center; gap: 4px; box-shadow: var(--shadow-sm); z-index: 3; }
.gcard-flag.adopted { left: 9px; background: var(--ok); color: #fff; }
.gcard-flag.edited { right: 9px; background: var(--warn); color: #fff; }
.gcard-meta { display: flex; flex-direction: column; gap: 3px; }
.gcm-tag { font-size: 12px; font-weight: 700; display: flex; align-items: center; gap: 7px; }
.gcm-tag .ab { width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; color: #fff; font-size: 11px; font-weight: 800; flex: none; }
.gcm-sub { font-size: 11.5px; color: var(--ink-faint); }
.gcard-actions { display: flex; gap: 7px; }
.gcard-actions .btn { padding: 8px 10px; font-size: 12px; }
.gcard-actions .btn:first-child { flex: 1; justify-content: center; white-space: nowrap; }
.gcard-actions .gicon { padding: 8px; flex: none; }

.gms-history { background: var(--warn-soft); border: 1px solid oklch(0.88 0.06 75); border-radius: 11px; padding: 12px 14px; }
.gms-label { font-size: 12px; font-weight: 800; display: flex; align-items: center; gap: 7px; margin-bottom: 8px; }
.gms-hrow { font-size: 12px; color: var(--ink-soft); padding: 3px 0; }
.gms-hrow b { color: var(--ink); font-weight: 700; }
.gms-actions .gicon { padding: 11px; flex: none; }

.gconfirm-backdrop { position: fixed; inset: 0; background: oklch(0.25 0.03 260 / .55); backdrop-filter: blur(4px); display: grid; place-items: center; z-index: 260; padding: 28px; animation: fadeIn .18s; }
.gconfirm { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg); width: 100%; max-width: 380px; padding: 26px 24px 22px; text-align: center; animation: confpop .2s ease; }
@keyframes confpop { from { transform: scale(.94); opacity: .4; } to { transform: scale(1); opacity: 1; } }
.gconfirm .gc-ico { width: 48px; height: 48px; border-radius: 50%; background: var(--warn-soft); color: var(--warn); display: grid; place-items: center; margin: 0 auto 14px; }
.gconfirm .gc-title { font-size: 16px; font-weight: 800; margin-bottom: 8px; }
.gconfirm .gc-desc { font-size: 13px; color: var(--ink-soft); line-height: 1.65; margin-bottom: 20px; }
.gconfirm .gc-desc b { color: var(--ink); font-weight: 700; }
.gconfirm .gc-actions { display: flex; gap: 10px; }
.btn.gc-danger { background: var(--warn); color: #fff; box-shadow: var(--shadow-sm); }
.btn.gc-danger:hover { background: oklch(0.58 0.14 55); }
