/* 投稿画像のセリフ用フォント: Mochiy Pop One(SIL OFL 1.1。ライセンスは assets/fonts/OFL-MochiyPopOne.txt)。
   JIS第1・第2水準+英数・記号に絞ったwoff2を、このサイトから配信する(外部のサーバーには、通信しない)。 */
@font-face { font-family: "Mochiy Pop One"; src: url("../fonts/MochiyPopOne-subset.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
/* 投稿フォーム。Figma「ひとこと投稿フォーム」(63:2512)、完了画面(94:458)、利用条件モーダル(136:493)に合わせる。 */
:root {
  --red: #e6003c;
  --red-dark: #c40033;
  --pink: #ffe9ef;
  --pink-mid: #f9bfd0;
  --text: #222;
  --muted: #666;
  --line: #ddd;
  color-scheme: light;
}
* { box-sizing: border-box; }
body {
  margin: 0; color: var(--text); background: #fff;
  font-family: "Noto Sans JP", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
  line-height: 1.7; font-size: 16px;
}
body.modal-open { overflow: hidden; }
.page { max-width: 1120px; margin: 0 auto; padding: 48px 20px 80px; }
h1, h2, h3 { line-height: 1.4; margin: 0; }
.title { color: var(--red); font-size: 40px; font-weight: 900; text-align: center; letter-spacing: .02em; }
.lead { text-align: center; margin: 16px 0 40px; }
.help { color: var(--muted); font-size: 13px; margin: 6px 0 0; }
.link { color: var(--red); font-weight: 700; text-decoration: none; }
.link:hover { text-decoration: underline; }

/* レイアウト */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 40px; align-items: start; }
.step { border: 0; padding: 0; margin: 0 0 32px; min-width: 0; }
.step legend, .step-title { display: flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 700; padding: 0; margin-bottom: 14px; }
.num { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; background: var(--red); color: #fff; font-size: 14px; font-weight: 700; }

/* イラスト選択 */
.illusts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.illust { position: relative; display: block; cursor: pointer; border-radius: 10px; overflow: hidden; border: 3px solid transparent; background: var(--pink-mid); }
.illust input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.illust img { display: block; width: 100%; aspect-ratio: 1 / 1; object-fit: cover; object-position: top; }
/* 選択の画像のガイド枠を覆う白い面(位置は form.js が、設定の cover から計算する) */
.illust-cover { position: absolute; display: block; pointer-events: none; }
.illust span { position: absolute; left: 0; right: 0; bottom: 0; padding: 2px 4px; font-size: 12px; font-weight: 700; text-align: center; color: #fff; background: rgba(230, 0, 60, .85); }
.illust:has(input:checked) { border-color: var(--red); box-shadow: 0 0 0 2px #fff inset; }
.illust:has(input:focus-visible) { outline: 3px solid #1a73e8; outline-offset: 2px; }

/* コメント */
textarea {
  width: 100%; padding: 16px; border: 2px solid var(--text); border-radius: 10px; font: inherit; font-size: 18px; line-height: 1.7; resize: vertical; min-height: 120px;
}
textarea:focus-visible { outline: 3px solid #1a73e8; outline-offset: 2px; }
textarea[aria-invalid="true"] { border-color: var(--red); }
.comment-meta { display: flex; justify-content: space-between; gap: 16px; align-items: baseline; }
.counter { font-weight: 700; font-size: 14px; margin: 6px 0 0; white-space: nowrap; }
.counter.over { color: var(--red); }
.error { color: var(--red-dark); font-weight: 700; font-size: 14px; margin: 8px 0 0; }
.error[hidden] { display: none; }

/* 注意書き・同意 */
.notice { background: #f7f7f7; border-radius: 8px; padding: 12px 16px; font-size: 13px; color: #444; margin: 0 0 20px; }
.notice p { margin: 0 0 6px; }
.notice p:last-child { margin-bottom: 0; }
.agree { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 15px; }
.check input { width: 22px; height: 22px; accent-color: var(--red); margin: 0; }
.check input:focus-visible { outline: 3px solid #1a73e8; outline-offset: 2px; }
.link-button { background: none; border: 0; padding: 4px; color: var(--red); font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; }
.recaptcha-note { font-size: 12px; color: var(--muted); margin: 20px 0 8px; }
.recaptcha-note a { color: var(--muted); }
.grecaptcha-badge { visibility: hidden; } /* バッジの代わりに、上の文言をフォーム付近に表示する */

/* ボタン */
.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 24px;
  border-radius: 6px; border: 2px solid var(--red); font: inherit; font-weight: 700; font-size: 16px; text-decoration: none; cursor: pointer;
}
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-dark); border-color: var(--red-dark); }
.btn-outline { background: #fff; color: var(--red); }
.btn-outline:hover:not(:disabled) { background: var(--pink); }
.btn-wide { width: 276px; max-width: 100%; min-height: 62px; font-size: 20px; margin-top: 8px; }
.btn-small { min-height: 36px; padding: 0 14px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn:focus-visible, .chip:focus-visible { outline: 3px solid #1a73e8; outline-offset: 2px; }

/* プレビュー */
.preview { background: var(--pink); border-radius: 12px; padding: 20px; position: sticky; top: 16px; }
.preview-title { color: var(--red); font-weight: 700; font-size: 13px; margin: 0 0 12px; }
.preview-frame { border: 4px solid var(--red); background: #fff; padding: 12px; }
.preview-frame canvas, .preview-frame img { display: block; width: 100%; height: auto; }
.preview-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; }

/* 完了画面 */
#done-view { text-align: center; }
.badge { display: inline-block; background: var(--pink); color: var(--red); font-weight: 700; font-size: 13px; padding: 2px 16px; border-radius: 999px; margin: 0 0 16px; }
.check-circle { width: 72px; height: 72px; line-height: 72px; margin: 0 auto 20px; border-radius: 50%; background: var(--red); color: #fff; font-size: 40px; font-weight: 700; }
#done-view .title:focus { outline: none; }
.done-layout { display: grid; grid-template-columns: 400px minmax(0, 1fr); gap: 48px; text-align: left; margin-top: 16px; }
.done-image { background: var(--pink); border-radius: 10px; padding: 24px 24px 16px; text-align: center; align-self: start; }
.done-actions h2 { font-size: 24px; margin-bottom: 12px; }
.done-actions p { margin: 0 0 16px; font-size: 14px; }
.button-row { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 20px; }
.sub-title { font-size: 13px; color: var(--muted); font-weight: 700; margin: 8px 0; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.chip { display: inline-flex; align-items: center; min-height: 40px; padding: 0 16px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--text); font: inherit; font-weight: 700; font-size: 14px; text-decoration: none; cursor: pointer; }
.chip:disabled { opacity: .5; cursor: not-allowed; }
.notes { color: var(--muted); font-size: 13px; padding-left: 20px; margin: 0 0 16px; }

/* 「続けて作成」は、サイトのトップへ戻るリンクの上に置く(目立たせる) */
.again-row { margin: 24px 0 16px; }
.again-row .btn { margin-top: 0; min-height: 56px; font-size: 18px; }

/* 受付状態 */
.state { text-align: center; padding: 80px 0; }
.state h1 { color: var(--red); font-size: 32px; margin-bottom: 16px; }

/* 利用条件のモーダル */
dialog { border: 0; padding: 0; border-radius: 14px; width: min(760px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow: hidden; color: var(--text); }
dialog[open] { display: flex; flex-direction: column; }
dialog::backdrop { background: rgba(0, 0, 0, .55); }
.dialog-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 28px 32px 16px; border-bottom: 1px solid var(--line); }
.dialog-head h2 { color: var(--red); font-size: 24px; font-weight: 900; }
.dialog-x { flex: none; width: 40px; height: 40px; border: 0; border-radius: 50%; background: #eee; font-size: 24px; line-height: 1; cursor: pointer; }
.dialog-body { flex: 1 1 auto; overflow-y: auto; padding: 8px 32px 24px; font-size: 14px; }
.dialog-body h3 { font-size: 15px; margin: 22px 0 8px; }
.dialog-body ol { padding-left: 1.8em; margin: 0 0 8px; list-style-type: decimal; }
/* 入れ子の項目は、(1)(2)…の括弧数字 */
@counter-style paren-decimal { system: extends decimal; prefix: "("; suffix: ") "; }
.dialog-body ol ol, .dialog-body ol.paren { list-style-type: paren-decimal; margin-top: 8px; padding-left: 2.4em; }
.dialog-body li { margin-bottom: 8px; }
.dialog-body p { margin: 0 0 8px; }
.dialog-foot { padding: 16px; background: #fafafa; text-align: center; }
.dialog-foot .btn { min-width: 240px; }

/* プレビューのボタン(スマホだけ。PCでは、右にプレビューが常に見える) */
.step-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.step-head .step-title { margin: 0; }
.preview-open { display: none; margin-left: auto; flex: none; }
.dialog-preview { width: min(440px, calc(100vw - 32px)); }
.dialog-preview .dialog-body { padding: 16px 20px 20px; }

/* スマホ(縦並び) */
@media (max-width: 860px) {
  .page { padding: 32px 16px 64px; }
  .title { font-size: 30px; }
  .layout, .done-layout { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .preview { position: static; }
  .preview-open { display: inline-flex; }
  .illusts { gap: 8px; }
  .btn-wide { width: 100%; }
  .button-row .btn { flex: 1 1 100%; }
  .dialog-head { padding: 20px 20px 12px; }
  .dialog-body { padding: 4px 20px 20px; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }

/* 左上の「トップに戻る」(どの状態の画面でも出す) */
.back-top { display: inline-flex; align-items: center; min-height: 44px; margin: 8px 0 0 clamp(8px, 2vw, 24px); padding: 0 12px; color: var(--red); font-weight: 700; font-size: 15px; text-decoration: none; }
.back-top:hover { text-decoration: underline; }
.back-top:focus-visible { outline: 3px solid #1a73e8; outline-offset: 2px; }
