/* 告知画像メーカー（d028、旧称 HARIGAMI）— 掲示板のある制作ツール。
 *
 * 左に要件、中央にコルクの掲示板（大きなプレビュー＋3案）、右に「直して、保存」。
 * 地は薄いグレー、パネルは白、文字は黒。色を持つのはクリエイティブとコルク板と主ボタンだけ。
 * 動き: 紙が落ちてきて画鋲が刺さる／AI 背景は走査光が通ってから現れる／保存でトースト。傾きは無し（2026-09-11 本人）。
 */
:root {
  --ground: #f3f4f6;
  --panel: #ffffff;
  --ink: #111214;
  --ink-2: #4b4f56;
  --ink-3: #8a8f98;
  --line: #e2e4e8;
  --line-2: #c9ccd2;
  --danger: #c0262a;
  --ok: #2f9e44;
  --warn: #f2b90a;
  --sans: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", YuGothic, Meiryo, sans-serif;
  --r: 8px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--ground); color: var(--ink); font-family: var(--sans); font-size: 14px; line-height: 1.6; min-height: 100dvh; }
a { color: var(--ink); }
b { font-weight: 700; }
[hidden] { display: none !important; }
button { font-family: inherit; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* ---- 上のバー ---- */
.top { background: var(--panel); border-bottom: 1px solid var(--line); padding: 10px 20px; display: flex; align-items: center; gap: 18px; flex-wrap: wrap; position: sticky; top: 0; z-index: 10; }
.brand { text-decoration: none; display: inline-flex; align-items: baseline; gap: 8px; white-space: nowrap; }
.brand-ja { font-size: 18px; font-weight: 800; letter-spacing: .08em; }
.brand-en { font-size: 11px; letter-spacing: .28em; color: var(--ink-3); }
.tag { margin: 0; color: var(--ink-2); font-size: 12.5px; flex: 1 1 320px; }
.tabs { display: flex; border: 1px solid var(--line-2); border-radius: 6px; overflow: hidden; }
.tabs button { padding: 6px 10px; font-size: 12.5px; border: 0; border-right: 1px solid var(--line); background: #fff; color: var(--ink-2); cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.tabs button:last-child { border-right: 0; }
.tabs button i { display: inline-block; width: 12px; height: 12px; border: 1.5px solid currentColor; border-radius: 2px; opacity: .8; }
.tabs button i.tall { width: 8px; height: 13px; }
.tabs button i.wide { width: 15px; height: 9px; }
.tabs button i.wider { width: 16px; height: 8px; }
.tabs button[aria-selected="true"] { background: var(--ink); color: #fff; }

/* ---- 何ができるか ---- */
.howto { list-style: none; margin: 14px auto 0; padding: 0 20px; max-width: 1500px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.howto li { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 14px; display: grid; grid-template-columns: 26px 1fr; grid-template-rows: auto auto; column-gap: 10px; align-items: center; animation: fadeup .5s both; }
.howto li:nth-child(2) { animation-delay: .1s } .howto li:nth-child(3) { animation-delay: .2s }
.howto .n { grid-row: 1 / 3; width: 26px; height: 26px; border-radius: 50%; background: var(--ink); color: #fff; font-weight: 800; font-size: 13px; display: flex; align-items: center; justify-content: center; }
.howto b { font-size: 13.5px; }
.howto span:last-child { font-size: 12px; color: var(--ink-2); }
@keyframes fadeup { from { opacity: 0; transform: translateY(6px) } to { opacity: 1; transform: none } }

/* ---- 3列 ---- */
.app { display: grid; grid-template-columns: 300px minmax(0, 1fr) 300px; gap: 16px; padding: 14px 20px 28px; max-width: 1500px; margin: 0 auto; align-items: start; }
@media (max-width: 1100px) { .app { grid-template-columns: 300px minmax(0, 1fr); } .panel-edit { grid-column: 2; } }
@media (max-width: 760px) { .app { grid-template-columns: 1fr; padding: 12px; } .panel-edit { grid-column: auto; } .tag { display: none; } .tabs { width: 100%; } .tabs button { flex: 1; padding: 8px 4px; justify-content: center; } .howto { grid-template-columns: 1fr; padding: 0 12px; gap: 6px; } .howto li { padding: 8px 12px; } }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
.ptitle { margin: 0 0 12px; font-size: 13px; letter-spacing: .1em; font-weight: 700; color: var(--ink-2); display: flex; align-items: center; gap: 8px; }
.step-n { width: 20px; height: 20px; border-radius: 50%; background: var(--ink); color: #fff; font-size: 11px; display: inline-flex; align-items: center; justify-content: center; letter-spacing: 0; flex: none; }
.f { display: block; margin-bottom: 12px; }
.f > span:first-child, .f legend { display: block; font-size: 12px; color: var(--ink-2); margin-bottom: 4px; }
.f small { color: var(--ink-3); font-weight: 400; }
.f em { font-style: normal; color: var(--danger); font-size: 11px; margin-left: 4px; }
input:not([type]), input[type="text"], select { width: 100%; font: inherit; font-size: 14px; padding: 8px 10px; border: 1px solid var(--line-2); background: #fff; color: var(--ink); border-radius: 6px; transition: box-shadow .15s; }
input:focus, select:focus { outline: 2px solid var(--ink); outline-offset: 1px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.presets { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: -4px 0 12px; }
.presets-l { font-size: 12px; color: var(--ink-3); }
.presets button { padding: 4px 10px; font-size: 12px; border: 1px dashed var(--line-2); border-radius: 999px; background: #fff; color: var(--ink-2); cursor: pointer; transition: all .15s; }
.presets button:hover { border-style: solid; border-color: var(--ink); color: var(--ink); transform: translateY(-1px); }

fieldset.chips { border: 0; padding: 0; margin: 0 0 12px; }
.chips label { display: inline-block; margin: 0 6px 6px 0; }
.chips input { position: absolute; opacity: 0; width: 0; height: 0; }
.chips span { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px 5px 7px; border: 1px solid var(--line-2); border-radius: 6px; font-size: 12.5px; cursor: pointer; background: #fff; color: var(--ink-2); transition: all .15s; }
.chips span:hover { border-color: var(--ink); }
.chips input:checked + span { background: var(--ink); color: #fff; border-color: var(--ink); }
.chips input:focus-visible + span { outline: 2px solid var(--ink); outline-offset: 2px; }
/* トーンの配色見本（差し色・地・文字の3点） */
.tones i { display: inline-block; width: 26px; height: 14px; border-radius: 3px; background: linear-gradient(90deg, var(--a) 0 45%, var(--b) 45% 80%, var(--c) 80%); border: 1px solid rgba(0,0,0,.15); }

.colorrow { display: flex; align-items: center; gap: 8px; }
.colorrow input[type="color"] { width: 40px; height: 34px; padding: 2px; border: 1px solid var(--line-2); background: #fff; border-radius: 6px; }
.ck { font-size: 12.5px; color: var(--ink-2); display: inline-flex; align-items: center; gap: 4px; }
.filebtn { display: block; }
.filebtn input { position: absolute; opacity: 0; width: 0; height: 0; }
.filebtn span { display: block; text-align: center; padding: 7px; border: 1px dashed var(--line-2); border-radius: 6px; font-size: 12.5px; color: var(--ink-2); cursor: pointer; }
.filebtn span:hover { border-color: var(--ink); color: var(--ink); }
.logo-state { display: flex; align-items: center; gap: 8px; margin: 6px 0 0; font-size: 12px; }
.logo-state img { height: 26px; max-width: 100px; object-fit: contain; border: 1px solid var(--line); background: #fff; padding: 2px; border-radius: 4px; }
.link { background: none; border: 0; padding: 0; text-decoration: underline; color: var(--ink-2); cursor: pointer; font-size: 12px; }

.primary { width: 100%; padding: 10px 12px; font-size: 14px; font-weight: 700; background: var(--ink); color: #fff; border: 1px solid var(--ink); border-radius: 6px; cursor: pointer; position: relative; transition: transform .12s; display: grid; gap: 1px; }
.primary:active { transform: scale(.98); }
.primary:disabled { opacity: .55; cursor: wait; }
.primary .btn-t { font-size: 15px; letter-spacing: .12em; }
.primary .btn-s { font-size: 11px; font-weight: 400; opacity: .75; }
.primary.pulse::after { content: ""; position: absolute; inset: -4px; border-radius: 9px; border: 2px solid var(--ink); animation: ring 1.6s ease-out infinite; pointer-events: none; }
@keyframes ring { 0% { opacity: .7; transform: scale(.98) } 100% { opacity: 0; transform: scale(1.06) } }
.ghost { width: 100%; padding: 9px; font-size: 13px; font-weight: 600; background: #fff; color: var(--ink); border: 1px solid var(--line-2); border-radius: 6px; cursor: pointer; transition: all .15s; }
.ghost:hover { border-color: var(--ink); }
.ghost:disabled { opacity: .45; cursor: default; }
.hint { margin: 10px 0 0; color: var(--ink-3); font-size: 12px; line-height: 1.5; }
.err { color: var(--danger); font-size: 13px; margin: 10px 0 0; }
.err.global { grid-column: 1 / -1; }

/* ---- 中央 ---- */
.stage { min-width: 0; }
.stage-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 8px; }
.stage-head .ptitle { margin: 0; }
.size-note { margin: 0; width: 100%; font-size: 12px; color: var(--ink-3); }
/* 進行: レシピ → 背景 → 仕上げ */
.steps { list-style: none; margin: 0; padding: 0; display: flex; gap: 4px; font-size: 12px; color: var(--ink-3); }
.steps li { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px 3px 6px; border-radius: 999px; border: 1px solid var(--line); background: #fff; transition: all .3s; }
.steps li i { width: 8px; height: 8px; border-radius: 50%; background: var(--line-2); display: inline-block; transition: all .3s; }
.steps li.active { color: var(--ink); border-color: var(--ink-2); }
.steps li.active i { background: var(--warn); animation: blink 1s infinite; }
.steps li.done { color: var(--ink); }
.steps li.done i { background: var(--ok); animation: pop .35s; }
@keyframes blink { 50% { opacity: .3 } }
@keyframes pop { 0% { transform: scale(.4) } 70% { transform: scale(1.4) } 100% { transform: scale(1) } }

/* コルク板 */
.board {
  padding: 22px 22px 18px; border: 10px solid #5b4632; border-radius: 6px;
  background-color: #c8a06e;
  background-image:
    radial-gradient(rgba(0,0,0,.09) 1px, transparent 1.5px),
    radial-gradient(rgba(255,255,255,.14) 1px, transparent 1.5px),
    radial-gradient(rgba(0,0,0,.06) 1.5px, transparent 2px),
    linear-gradient(135deg, #c8a06e, #b98d5c);
  background-size: 9px 9px, 13px 13px, 23px 23px, 100% 100%;
  background-position: 0 0, 4px 6px, 9px 2px, 0 0;
  box-shadow: inset 0 0 40px rgba(0,0,0,.18), 0 6px 20px rgba(0,0,0,.12);
}
.canvas { position: relative; display: flex; align-items: center; justify-content: center; min-height: 320px; height: min(64vh, 680px); padding: 12px 0 0; }
.paper { position: relative; background: #fff; padding: 8px; box-shadow: 0 1px 1px rgba(0,0,0,.2), 0 12px 18px -6px rgba(0,0,0,.45); max-height: 100%; display: flex; }
.paper.drop { animation: drop .55s cubic-bezier(.2,.9,.3,1.15) both; }
.paper.flash::after { content: ""; position: absolute; inset: 0; background: #fff; animation: flash .35s ease-out both; pointer-events: none; }
@keyframes drop { 0% { opacity: 0; transform: translateY(-26px) scale(.97) } 100% { opacity: 1; transform: none } }
@keyframes flash { 0% { opacity: .55 } 100% { opacity: 0 } }
.pin {
  position: absolute; left: 50%; top: -9px; width: 18px; height: 18px; margin-left: -9px; z-index: 2; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #f0e2b6, #a98a4f 55%, #6f5a2e);
  box-shadow: 0 2px 3px rgba(0,0,0,.45), 0 8px 8px -4px rgba(0,0,0,.35);
}
.paper.drop .pin, .thumb.drop .pin { animation: pinin .4s .35s cubic-bezier(.3,1.4,.5,1) both; }
@keyframes pinin { 0% { transform: translateY(-14px) scale(1.3); opacity: 0 } 60% { transform: translateY(2px) scale(.95); opacity: 1 } 100% { transform: none } }
.pin.wobble { animation: wob .5s; }
@keyframes wob { 0% { transform: rotate(0) } 30% { transform: rotate(-12deg) } 60% { transform: rotate(9deg) } 100% { transform: rotate(0) } }
.main-pic { max-width: 100%; max-height: calc(min(64vh, 680px) - 40px); width: auto; height: auto; background: #fff; display: block; }
.main-pic.reveal, .thumb img.reveal { animation: reveal .9s cubic-bezier(.2,.8,.2,1) both; }
@keyframes reveal { 0% { clip-path: inset(0 0 100% 0); filter: saturate(.2) } 100% { clip-path: inset(0); filter: none } }
/* AI が描いている間: 走査光が上から下へ */
.veil { position: absolute; inset: 8px; overflow: hidden; display: flex; align-items: flex-end; justify-content: center; background: rgba(255,255,255,.3); }
.veil .scan { position: absolute; left: 0; right: 0; height: 18%; top: -18%; background: linear-gradient(to bottom, rgba(255,255,255,0), rgba(255,255,255,.85) 50%, rgba(255,255,255,0)); border-bottom: 2px solid rgba(17,18,20,.6); animation: scan 1.6s linear infinite; }
@keyframes scan { to { top: 100% } }
.veil-t { position: relative; margin-bottom: 10px; font-size: 12px; background: rgba(17,18,20,.85); color: #fff; padding: 3px 10px; border-radius: 999px; }
.canvas.skeleton .main-pic { opacity: .6; }

.status { margin: 12px 0 0; font-size: 12.5px; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.5); min-height: 1.4em; }
.thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; margin-top: 14px; }
.thumb { position: relative; background: #fff; border: 0; padding: 6px; cursor: pointer; text-align: left; font: inherit; color: var(--ink); box-shadow: 0 1px 1px rgba(0,0,0,.2), 0 10px 16px -6px rgba(0,0,0,.45); transition: transform .15s; }
.thumb:hover { transform: translateY(-2px); }
.thumb[aria-selected="true"] { outline: 3px solid var(--ink); outline-offset: 2px; }
.thumb.drop { animation: drop .55s cubic-bezier(.2,.9,.3,1.15) both; }
.thumb img { display: block; width: 100%; height: auto; aspect-ratio: var(--ar, 1 / 1); object-fit: cover; background: #f0f1f3; }
.thumb.skeleton img { background: linear-gradient(90deg, #eeeeee 25%, #f8f8f8 40%, #eeeeee 55%); background-size: 300% 100%; animation: shimmer 1.2s infinite; opacity: .7; }
@keyframes shimmer { to { background-position: -300% 0 } }
.thumb .t-meta { display: flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 11.5px; color: var(--ink-2); }
.thumb .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line-2); flex: none; transition: background .3s; }
.thumb .dot.loading { background: var(--warn); animation: blink 1s infinite; }
.thumb .dot.ok { background: var(--ok); animation: pop .35s; }
.thumb .dot.flat { background: var(--line-2); }
.thumb .dot.blocked, .thumb .dot.failed, .thumb .dot.error { background: var(--danger); }
.thumb .t-name { font-weight: 700; }
.thumb .t-layout { color: var(--ink-3); margin-left: auto; white-space: nowrap; }
@media (max-width: 760px) { .board { padding: 16px 12px 14px; } .thumbs { gap: 14px; } .canvas { height: auto; min-height: 0; } .main-pic { max-height: none; } }

/* ---- 右 ---- */
.sel-label { font-weight: 400; color: var(--ink-3); letter-spacing: 0; margin-left: 2px; }
.scene { margin: 0 0 4px; font-size: 12.5px; color: var(--ink-2); line-height: 1.5; min-height: 1.5em; }
.bgstate { margin: 0 0 10px; font-size: 12px; color: var(--ink-3); }
.edit-fields { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 10px; }
/* 配置のピクト */
.layouts { border: 0; padding: 0; margin: 0 0 12px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.layouts legend { grid-column: 1 / -1; }
.layouts label { display: block; }
.layouts input { position: absolute; opacity: 0; width: 0; height: 0; }
.layouts span { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 2px 5px; border: 1px solid var(--line-2); border-radius: 6px; font-size: 10.5px; color: var(--ink-2); cursor: pointer; transition: all .15s; }
.layouts span:hover { border-color: var(--ink); }
.layouts svg { width: 34px; height: 34px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.layouts svg .k { fill: currentColor; stroke: none; }
.layouts svg .w { fill: #fff; stroke: none; }
.layouts input:checked + span { background: var(--ink); color: #fff; border-color: var(--ink); }
.layouts input:checked + span svg .w { fill: var(--ink); }
.layouts input:focus-visible + span { outline: 2px solid var(--ink); outline-offset: 2px; }
.acts { display: grid; gap: 8px; margin-top: 4px; }

.sheet-modal { position: fixed; inset: 0; background: rgba(0,0,0,.72); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px; }
.sheet-in { background: var(--panel); padding: 14px; max-width: 420px; width: 100%; text-align: center; border-radius: var(--r); }
.sheet-in p { margin: 0 0 10px; font-size: 13px; }
.sheet-in img { max-width: 100%; max-height: 60vh; display: block; margin: 0 auto 10px; }

/* トースト */
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 9px 16px; border-radius: 999px; font-size: 13px; z-index: 60; box-shadow: 0 8px 24px rgba(0,0,0,.25); animation: toastin .3s cubic-bezier(.2,.9,.3,1.2) both; }
@keyframes toastin { from { opacity: 0; transform: translate(-50%, 12px) } to { opacity: 1; transform: translate(-50%, 0) } }

/* ---- 足 ---- */
.foot { border-top: 1px solid var(--line); padding: 12px 20px 26px; display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--ink-3); }
#portal-badge { border: 1px solid var(--line-2); border-radius: 999px; padding: 2px 10px; text-decoration: none; color: var(--ink-2); }
