/* ワイヤーフレーム パターン集 — Precision White（白地・モノクロ・構造） */
:root {
  --bg: #ffffff;
  --bg-subtle: #fafafa;
  --bg-muted: #f2f2f2;
  --line: #e5e5e5;
  --line-strong: #d4d4d4;
  --text: #0a0a0a;
  --text-2: #4d4d4d;
  --muted: #737373;
  --cta: #0a0a0a;
  --link: #0070f3;
  --radius: 12px;
  --font: "Geist", "Noto Sans JP", system-ui, sans-serif;
  --mono: "Geist Mono", ui-monospace, Menlo, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg-subtle);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
}
button, select { font: inherit; }
[hidden] { display: none !important; }
.muted { color: var(--muted); margin: 0; }

/* ---- header ---- */
.site-head { background: var(--bg); border-bottom: 1px solid var(--line); }
.site-head__inner {
  max-width: 1440px; margin: 0 auto; padding: clamp(24px, 4vw, 40px) 16px 0;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 24px 16px;
}
.site-head__inner .view-tabs { grid-column: 1 / -1; }
.howto-link {
  padding: 8px 14px; border: 1px solid var(--line-strong); border-radius: 8px;
  color: var(--text); text-decoration: none; font-weight: 600; white-space: nowrap;
}
.howto-link:hover { border-color: var(--text); }
.site-head__inner { padding-inline: clamp(16px, 3vw, 32px); }
.site-head h1 { margin: 0; font-size: clamp(28px, 4vw, 44px); line-height: 1.15; letter-spacing: -0.04em; font-weight: 700; }
.site-head p { margin: 8px 0 0; color: var(--text-2); }
.view-tabs { display: flex; gap: 4px; }
.view-tab {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 16px; border: 0; border-bottom: 2px solid transparent; background: none;
  color: var(--muted); font-weight: 600; cursor: pointer;
}
.view-tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--text); }
.view-tab__count {
  min-width: 28px; padding: 0 8px; border-radius: 999px; background: var(--bg-muted);
  color: var(--text); font-family: var(--mono); text-align: center;
}

main { max-width: 1440px; margin: 0 auto; padding: 24px clamp(16px, 3vw, 32px) 64px; }

/* ---- buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 8px 14px; border: 1px solid var(--cta); border-radius: 8px;
  background: var(--cta); color: #fff; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.btn:hover { opacity: 0.85; }
.btn--ghost { background: var(--bg); color: var(--text); border-color: var(--line-strong); }
.btn--ghost:hover { opacity: 1; border-color: var(--text); }
.btn--block { width: 100%; }
.icon-btn {
  width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg);
  font-size: 22px; line-height: 1; cursor: pointer;
}
.badge {
  display: inline-block; padding: 0 8px; border: 1px solid var(--line-strong); border-radius: 6px;
  color: var(--text-2); font-size: 16px;
}

/* ---- category chips ---- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.chip {
  padding: 6px 14px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--bg);
  color: var(--text-2); cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: #fff; }
.chip span { margin-left: 6px; font-family: var(--mono); opacity: 0.7; }

/* ---- gallery ---- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr)); gap: 20px; }
.card {
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius);
  transition: border-color 0.15s;
}
.card:hover { border-color: var(--line-strong); }
.card__thumb {
  display: block; width: 100%; padding: 0; border: 0; border-bottom: 1px solid var(--line);
  background: var(--bg-muted); cursor: zoom-in; text-align: left;
}
/* 高さを揃え、低いパターン（ヘッダー等）は上下中央、高いものは上端から見せる */
.card__thumb .frame { display: flex; align-items: safe center; height: 220px; border: 0; border-radius: 0; }
.card__body { display: flex; flex-direction: column; gap: 4px; padding: 16px; flex: 1; }
.card__id { font-family: var(--mono); color: var(--muted); }
.card__name { margin: 0; font-size: 18px; line-height: 1.4; letter-spacing: -0.01em; }
.card__use { margin: 0; color: var(--text-2); }
.card__actions { display: flex; gap: 8px; padding: 0 16px 16px; }
.card__actions .btn { flex: 1; }

/* ---- wireframe frame（縮小表示の枠） ---- */
.frame {
  position: relative; overflow: hidden; background: #fff;
  border: 1px solid var(--line); border-radius: 8px;
}
.frame__stage { transform-origin: top left; }
.frame--page { overflow: auto; max-height: calc(100vh - 180px); background: var(--bg-muted); }
.frame--page .frame__stage, .frame--narrow .frame__stage { margin: 0 auto; background: #fff; }
.frame--narrow { background: var(--bg-muted); padding: 16px 0; }

/* ---- segmented control ---- */
.seg { display: inline-flex; padding: 3px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--bg); }
.seg button { padding: 4px 14px; border: 0; border-radius: 6px; background: none; color: var(--muted); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--text); color: #fff; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.toolbar__actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---- detail dialog ---- */
.detail {
  width: min(1320px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 0;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); color: var(--text);
}
.detail::backdrop { background: rgba(10, 10, 10, 0.45); }
.detail__head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding: 20px 24px; border-bottom: 1px solid var(--line);
}
.detail__head h2 { margin: 6px 0 0; font-size: clamp(20px, 2.4vw, 28px); line-height: 1.3; letter-spacing: -0.02em; }
.detail__body { display: grid; grid-template-columns: minmax(0, 1fr) 420px; }
.detail__preview { padding: 20px 24px; min-width: 0; }
.detail__preview .frame { max-height: 62vh; overflow: auto; }
.detail__info { display: flex; flex-direction: column; gap: 20px; padding: 20px 24px; border-left: 1px solid var(--line); background: var(--bg-subtle); min-width: 0; }
.facts { margin: 0; display: grid; gap: 6px; }
.facts dt { font-weight: 700; margin-top: 8px; }
.facts dt:first-child { margin-top: 0; }
.facts dd { margin: 0; color: var(--text-2); }
.facts ul { margin: 0; padding-left: 1.2em; }
.code { display: flex; flex-direction: column; gap: 8px; }
.code__tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); }
.code__tabs button {
  padding: 8px 12px; border: 0; border-bottom: 2px solid transparent; background: none;
  color: var(--muted); font-weight: 600; cursor: pointer;
}
.code__tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--text); }
.code__body {
  margin: 0; max-height: 300px; overflow: auto; padding: 14px;
  border: 1px solid var(--line); border-radius: 8px; background: #0a0a0a; color: #ededed;
  font-family: var(--mono); font-size: 16px; line-height: 1.55; white-space: pre;
}

/* ---- builder ---- */
.builder { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 24px; align-items: start; }
.builder__side { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 16px; }
.side-block { display: flex; flex-direction: column; gap: 10px; padding: 18px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); }
.side-block h2 { margin: 0; font-size: 18px; letter-spacing: -0.01em; }
.stack { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.stack li {
  display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: center; gap: 6px 8px;
  grid-template-areas: "no cat ops" "no sel sel";
  padding: 8px 8px 10px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg-subtle);
}
.stack__no { grid-area: no; align-self: start; padding-top: 6px; font-family: var(--mono); color: var(--muted); }
/* カテゴリ名と操作ボタンを1行目、プルダウンを2行目いっぱいに置く */
.stack__main { display: contents; }
.stack__cat { grid-area: cat; color: var(--muted); }
.stack__main select { grid-area: sel; }
.stack__ops { grid-area: ops; }
.stack select, .add-row select {
  width: 100%; min-height: 40px; padding: 6px 8px; border: 1px solid var(--line-strong); border-radius: 6px;
  background: var(--bg); color: var(--text);
}
.stack__ops { display: flex; gap: 4px; }
.stack__ops button {
  width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg);
  cursor: pointer; color: var(--text-2);
}
.stack__ops button:disabled { opacity: 0.35; cursor: default; }
.add-row { display: flex; gap: 8px; }
.add-row select { flex: 1; min-width: 0; }

/* ---- toast ---- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); z-index: 200;
  padding: 10px 18px; border-radius: 8px; background: var(--text); color: #fff;
  opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ---- footer ---- */
.site-foot {
  display: flex; justify-content: flex-start; flex-wrap: wrap; align-items: center; gap: 12px 24px;
  padding: 24px 40px; color: #64748b; font-size: 1rem; border-top: 1px solid #e2e8f0; background: #fff;
}
.site-foot a { color: #1e293b; text-decoration: none; transition: color 0.2s; }
.site-foot a:hover { color: #3b82f6; }
.footer-links { display: flex; gap: 16px; }
.footer-links a { border: 1px solid #e2e8f0; padding: 8px 16px; border-radius: 6px; font-size: 1rem; transition: all 0.2s; }
.footer-links a:hover { border-color: #3b82f6; color: #3b82f6; }

/* ---- 右下フローティング広告（ツール規格 320×100） ---- */
.footer-ad {
  position: fixed; right: 0; bottom: 0; z-index: 90;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 0;
  width: 320px; overflow: hidden; /* AdSenseレスポンシブの横伸び防止＋×を右端に固定 */
  background: transparent; border: none; box-shadow: none;
}
.footer-ad.is-closed { display: none; }
.ad-widget__head { display: flex; align-items: center; justify-content: space-between; width: 100%; position: relative; z-index: 1; }
.ad-widget__label { color: #64748b; font-size: 12px; letter-spacing: 0.04em; background: #f1f5f9; padding: 2px 8px; border-radius: 999px; }
.ad-widget__close {
  appearance: none; border: none; background: #f1f5f9; color: #64748b;
  width: 18px; height: 18px; border-radius: 50%; font-size: 12px; line-height: 1;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background 0.2s, color 0.2s;
}
.ad-widget__close:hover { background: #e2e8f0; color: #1e293b; }
.footer-ad ins.adsbygoogle { display: block; width: 320px; height: 100px; }

/* ---- responsive（段組みの切り替えのみ） ---- */
@media (max-width: 1040px) {
  .builder { grid-template-columns: 1fr; }
  .builder__side { position: static; }
  .detail__body { grid-template-columns: 1fr; }
  .detail__info { border-left: 0; border-top: 1px solid var(--line); }
}
@media (max-width: 768px) {
  .site-foot { flex-direction: column; gap: 16px; padding: 24px 16px; text-align: center; }
  .footer-links { flex-wrap: wrap; justify-content: center; }
  .detail__head, .detail__preview, .detail__info { padding: 16px; }
  .site-head__inner { grid-template-columns: 1fr; }
  .head-links { justify-self: start; }
  .footer-ad {
    position: static; align-self: center; margin: 24px auto;
    gap: 0; padding: 0; background: none; border: none; border-radius: 0; box-shadow: none; z-index: auto;
  }
  .footer-ad.is-closed { display: flex; } /* PCで閉じてもSPでは表示 */
  .ad-widget__head { display: none; }     /* SPはラベル・×を隠す */
}

/* ---- 使い方ページ（howto.html） ---- */
.doc { max-width: 860px; }
.doc section { margin-top: 48px; }
.doc h2 { margin: 0 0 16px; font-size: clamp(22px, 2.6vw, 28px); line-height: 1.3; letter-spacing: -0.02em; }
.doc p { margin: 0 0 12px; color: var(--text-2); line-height: 1.8; }
.doc a { color: var(--link); }
.doc code { font-family: var(--mono); background: var(--bg-muted); padding: 0 4px; border-radius: 4px; }
.doc pre code { background: none; padding: 0; } /* プロンプト例（黒い枠）の中では地の色を付けない */
.doc-crumb { margin: 0 0 8px; color: var(--muted); }
.doc-crumb a { color: var(--muted); }
.doc-lead { padding: 20px 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); }
.doc-lead strong { color: var(--text); }
.doc-toc { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
.doc-toc a { padding: 6px 14px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--bg); color: var(--text-2); text-decoration: none; }
.doc-steps { margin: 0 0 12px; padding: 0; list-style: none; counter-reset: step; display: grid; gap: 12px; }
.doc-steps li {
  counter-increment: step; display: grid; grid-template-columns: 40px 1fr; gap: 4px 16px;
  padding: 16px 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg);
}
.doc-steps li::before {
  content: counter(step); grid-row: span 2; display: grid; place-items: center;
  width: 40px; height: 40px; border-radius: 50%; background: var(--text); color: #fff; font-family: var(--mono); font-weight: 600;
}
.doc-steps span { color: var(--text-2); }
.doc-table { overflow-x: auto; }
.doc-table table { width: 100%; border-collapse: collapse; background: var(--bg); }
.doc-table th, .doc-table td { padding: 12px 14px; border: 1px solid var(--line); text-align: left; vertical-align: top; }
.doc-table th { background: var(--bg-muted); }
.doc-table td:first-child { white-space: nowrap; font-weight: 600; }
.doc-faq { display: grid; gap: 8px; }
.doc-faq details { padding: 14px 18px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
.doc-faq summary { font-weight: 700; cursor: pointer; }
.doc-faq details p { margin: 10px 0 0; }
.doc-links { margin: 0; padding-left: 1.2em; display: grid; gap: 8px; color: var(--text-2); }
.doc-cta { margin-top: 48px; text-align: center; }
.doc-cta .btn { text-decoration: none; color: #fff; min-height: 52px; padding: 12px 28px; }
.head-links { display: flex; flex-wrap: wrap; gap: 8px; }

/* ===== 絵コンテ ショット集の追加分 ===== */
.card__thumb { cursor: zoom-in; line-height: 0; }
.card__thumb svg { display: block; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.tag { padding: 0 8px; border: 1px solid var(--line-strong); border-radius: 999px; color: var(--text-2); font-size: 16px; }

.detail__frame { line-height: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.vocab { width: 100%; margin-top: 16px; border-collapse: collapse; }
.vocab th, .vocab td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; }
.vocab th { width: 9em; color: var(--muted); font-weight: 600; }
.code__label { margin: 0; font-weight: 700; }
.code__body { white-space: pre-wrap; }

.toolbar__start { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.board { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 20px; margin: 16px 0 0; padding: 0; list-style: none; }
.cell { display: flex; flex-direction: column; gap: 8px; padding: 12px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); }
.cell__frame { line-height: 0; border-radius: 6px; overflow: hidden; }
.cell__head { display: flex; align-items: center; gap: 10px; }
.cell__no { font-family: var(--mono); font-weight: 600; }
.cell__time { font-family: var(--mono); color: var(--muted); }
.cell__ops { display: flex; gap: 4px; margin-left: auto; }
.cell__ops button { width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--text-2); cursor: pointer; }
.cell__ops button:disabled { opacity: 0.35; cursor: default; }
.cell select, .cell textarea, .cell input {
  width: 100%; padding: 6px 8px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--bg); color: var(--text); font: inherit;
}
.cell textarea { resize: vertical; line-height: 1.5; }
.cell__dur { display: flex; align-items: center; gap: 8px; color: var(--text-2); }
.cell__dur input { width: 6em; }
.board-note { margin-top: 20px; }
.board-note a { color: var(--link); }

/* ---- 写真のショット（カメラの動きは写真の拡大・移動で見せる） ---- */
.photo-frame { position: relative; overflow: hidden; aspect-ratio: 16 / 9; line-height: 0; background: #e5e5e5; }
.photo-frame__img { display: block; width: 100%; height: 100%; object-fit: cover; transform-origin: 50% 50%; }
.photo-frame__overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.mv-in .photo-frame__img { animation: pf-in 3.2s ease-in-out infinite alternate; }
.mv-out .photo-frame__img { animation: pf-out 3.2s ease-in-out infinite alternate; }
.mv-pan .photo-frame__img, .mv-track .photo-frame__img { animation: pf-pan 4s ease-in-out infinite alternate; }
.mv-tilt .photo-frame__img { animation: pf-tilt 4s ease-in-out infinite alternate; }
.mv-hand .photo-frame__img { animation: pf-hand 0.9s ease-in-out infinite; }
.mv-drone .photo-frame__img { animation: pf-drone 4s ease-in-out infinite alternate; }
.mv-orbit .photo-frame__img { animation: pf-orbit 6s ease-in-out infinite alternate; }
@keyframes pf-in { from { transform: scale(1); } to { transform: scale(1.35); } }
@keyframes pf-out { from { transform: scale(1.35); } to { transform: scale(1); } }
@keyframes pf-pan { from { transform: scale(1.2) translateX(7%); } to { transform: scale(1.2) translateX(-7%); } }
@keyframes pf-tilt { from { transform: scale(1.2) translateY(6%); } to { transform: scale(1.2) translateY(-6%); } }
@keyframes pf-hand { 0%, 100% { transform: scale(1.06) translate(0, 0) rotate(0); } 25% { transform: scale(1.06) translate(0.6%, -0.4%) rotate(0.3deg); } 50% { transform: scale(1.06) translate(-0.4%, 0.5%) rotate(-0.2deg); } 75% { transform: scale(1.06) translate(0.4%, 0.6%) rotate(0.15deg); } }
@keyframes pf-drone { from { transform: scale(1.25) translate(4%, 4%); } to { transform: scale(1.05) translate(-2%, -2%); } }
@keyframes pf-orbit { from { transform: scale(1.25) translateX(6%) rotate(-1.5deg); } to { transform: scale(1.25) translateX(-6%) rotate(1.5deg); } }
@media (prefers-reduced-motion: reduce) { .photo-frame__img { animation: none !important; } }
