:root {
  color-scheme: light;
  --ink: #4b3a3b;
  --muted: #766264;
  --cream: #fffaf3;
  --paper: #ffffff;
  --peach: #f6b58f;
  --peach-deep: #df7f67;
  --pink: #f5a9b8;
  --line: #ecd9d1;
  --warning: #a42b35;
  --warning-bg: #fff0f1;
  --shadow: 0 14px 35px rgba(104, 70, 62, 0.11);
  font-family: "Yu Gothic UI", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--cream); }
body { margin: 0; color: var(--ink); background: radial-gradient(circle at 80% 0%, #ffe5d5 0, transparent 30rem), var(--cream); line-height: 1.75; }
a { color: #a94f4d; text-underline-offset: 0.18em; }
button, input, select { font: inherit; }
button, select, input[type="range"], input[type="checkbox"] { accent-color: var(--peach-deep); }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible { outline: 3px solid #f4a261; outline-offset: 3px; }

.page-width { width: min(1160px, calc(100% - 40px)); margin-inline: auto; }
.back-link { display: inline-block; margin: 22px 24px 0; padding: 7px 12px; border-radius: 999px; background: rgba(255,255,255,.78); font-size: .9rem; text-decoration: none; }
.hero { padding: 38px 0 28px; }
.title-line { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; }
h1 { margin: 0; font-size: clamp(2rem, 4vw, 3.25rem); letter-spacing: .03em; }
h2 { margin: 0 0 18px; font-size: 1.25rem; }
.trial-badge, .mode-badge { display: inline-flex; align-items: center; border-radius: 999px; font-weight: 700; }
.trial-badge { padding: 5px 13px; color: #8a3d32; background: #ffe0cc; border: 1px solid #f3b18d; }
.lead { margin: 8px 0 20px; font-size: 1.08rem; color: var(--muted); }
/* 2026-08-11: スマホ実機で「プレビューが上にあり設定を見比べにくい」と判明したため、
   ページ冒頭で先に伝える。使えないとは書かない(実際に作れて保存もできる)。 */
.device-note { max-width: 850px; margin: 6px 0 0; padding: 11px 14px; border-radius: 12px; background: #fff1e7; color: #865445; font-size: .88rem; }
.trial-note { max-width: 850px; padding: 15px 18px; border-left: 4px solid var(--peach); background: rgba(255,255,255,.65); border-radius: 0 12px 12px 0; font-size: .9rem; }
.trial-note p { margin: 0; }
.trial-note p + p { margin-top: 7px; }

.tool-layout { display: grid; grid-template-columns: minmax(430px, 1.05fr) minmax(390px, .95fr); align-items: start; gap: 26px; padding-bottom: 30px; }
.controls-column { display: grid; gap: 20px; }
.card { background: rgba(255,255,255,.94); border: 1px solid var(--line); border-radius: 20px; padding: 24px; box-shadow: var(--shadow); }
.preview-card { position: sticky; top: 18px; }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.eyebrow { margin: 0 0 2px; color: var(--peach-deep); font-size: .72rem; font-weight: 800; letter-spacing: .16em; }
.mode-badge { padding: 3px 10px; color: #865445; background: #fff1e7; font-size: .78rem; white-space: nowrap; }
.preview-stage { display: grid; place-items: center; min-width: 0; min-height: 260px; overflow: hidden; padding: 16px; border: 1px solid #e6d7cf; border-radius: 15px; background: #fff; }
#preview-canvas { display: block; max-width: 100%; max-height: 500px; }
.kirakira-preview-stage { min-height: 520px; background-color: #fff; background-image: linear-gradient(45deg,#eee 25%,transparent 25%),linear-gradient(-45deg,#eee 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#eee 75%),linear-gradient(-45deg,transparent 75%,#eee 75%); background-size: 22px 22px; background-position: 0 0,0 11px,11px -11px,-11px 0; }
.kirakira-preview-stage #preview-canvas { width: min(360px, 100%); height: auto; aspect-ratio: 3 / 4; }
.preview-empty { max-width: 22em; margin: 0; padding: 18px; border-radius: 12px; color: var(--muted); background: rgba(255,255,255,.88); text-align: center; }
.size-note { margin: 9px 0 0; color: var(--muted); font-size: .82rem; }

.privacy-callout { padding: 13px 15px; border-radius: 12px; background: #edf8f3; color: #355e50; font-size: .88rem; }
.rights-box { margin: 16px 0; border: 1px solid var(--line); border-radius: 12px; background: #fffcf9; }
.rights-trigger { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 7px; align-items: baseline; width: 100%; padding: 12px 14px; border: 0; border-radius: 12px; color: var(--ink); background: transparent; font-weight: 700; text-align: left; cursor: pointer; }
.rights-trigger:hover { background: #fff7f1; }
.rights-marker { font-size: .68rem; }
.rights-dialog { width: min(720px, calc(100% - 32px)); max-height: min(84vh, 780px); overflow: hidden; padding: 0; border: 1px solid var(--line); border-radius: 18px; color: var(--ink); background: var(--paper); box-shadow: 0 24px 70px rgba(72, 45, 42, .28); }
.rights-dialog::backdrop { background: rgba(65, 47, 48, .52); }
.rights-dialog-panel { max-height: min(84vh, 780px); overflow-y: auto; padding: 22px; }
.rights-dialog-header { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; align-items: start; margin-bottom: 15px; }
.rights-dialog-header h2 { margin: 0; padding-right: 4px; }
.dialog-close-icon { display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 1px solid var(--line); border-radius: 50%; color: var(--ink); background: #fffaf7; font-size: 1.35rem; line-height: 1; cursor: pointer; }
.rights-copy { font-size: .9rem; }
.rights-copy p { margin: 9px 0; }
.rights-lead { padding: 13px 15px; border-left: 4px solid var(--peach-deep); border-radius: 0 10px 10px 0; background: #fff8f3; font-size: 1rem; }
.rights-group { margin: 16px 0; padding: 12px 14px; border-radius: 12px; }
.rights-group h3, .creator-note h3 { margin: 0 0 7px; font-size: 1rem; }
.rights-group ul, .rights-copy > ul { margin: 0; padding-left: 1.35em; }
.rights-group li + li, .rights-copy > ul li + li { margin-top: 5px; }
.rights-allowed { border: 1px solid #b8ddce; background: #edf8f3; }
.rights-denied { border: 1px solid #edc4c6; background: #fff2f3; }
.creator-note { margin: 17px 0; padding: 13px 15px; border-radius: 12px; background: #fff0e6; }
.rights-terms-link { padding-top: 5px; font-weight: 700; }
.rights-close-bottom { display: flex; margin: 20px auto 0; min-width: 130px; }
body.has-modal { overflow: hidden; }
.drop-zone { display: grid; place-items: center; gap: 4px; min-height: 145px; padding: 18px; border: 2px dashed #df9c82; border-radius: 15px; text-align: center; cursor: pointer; transition: background .18s, border-color .18s; }
.drop-zone:hover, .drop-zone.is-dragging { border-color: var(--peach-deep); background: #fff4ec; }
.drop-zone span:last-child { color: var(--muted); font-size: .82rem; }
.drop-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; background: #ffe3d2; color: #9c4f41; font-weight: 800; font-size: .75rem; }
.input-limits { margin: 8px 0; color: var(--muted); font-size: .75rem; }
.message { min-height: 1.5em; margin: 8px 0; color: var(--muted); font-size: .88rem; }
.message.is-error { color: var(--warning); font-weight: 700; }
.message.is-success { color: #277255; font-weight: 700; }
.image-list { display: grid; gap: 8px; margin-top: 12px; }
.image-item { display: grid; grid-template-columns: 42px 48px minmax(0,1fr) auto; gap: 9px; align-items: center; padding: 7px; border: 1px solid var(--line); border-radius: 11px; }
.image-order { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: #fff0e7; font-weight: 800; }
.image-item img { width: 48px; height: 48px; object-fit: contain; background: #f1eeee; border-radius: 8px; }
.image-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .82rem; }
.image-actions { display: flex; gap: 3px; }
.icon-button { width: 30px; height: 30px; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: white; cursor: pointer; }
.icon-button:disabled { opacity: .35; cursor: default; }
.text-button { margin-top: 10px; padding: 5px 0; border: 0; color: #a94f4d; background: transparent; text-decoration: underline; cursor: pointer; }

.field-label, .slider-field label { font-weight: 700; font-size: .9rem; }
select { width: 100%; min-height: 44px; padding: 7px 10px; border: 1px solid #d9c4bb; border-radius: 10px; color: var(--ink); background: white; }
.slider-field { margin-top: 18px; }
.slider-field > div { display: flex; justify-content: space-between; gap: 16px; }
.slider-field output { color: #a95145; font-weight: 800; }
.slider-field input { width: 100%; }
.slider-field input:disabled { opacity: .35; }
/* 01 §4.2: 前面演出の2つは4段階スライダー。1本目だけ上の余白を詰めて凡例へ寄せる。 */
.level-slider { margin-top: 12px; }
.level-slider:first-of-type { margin-top: 4px; }
/* 01 §9-5: 入力前デモの案内。サンプルでは生成できないことを明示する。 */
.demo-note { margin: 10px 0 0; padding: 9px 12px; border-radius: 10px; color: #865445; background: #fff1e7; font-size: .82rem; line-height: 1.6; }
.drop-zone.is-disabled { opacity: .5; pointer-events: none; }
.consent-box { display: grid; gap: 12px; margin: 18px 0; padding: 15px; border: 1px solid var(--line); border-radius: 12px; }
.consent-box legend { padding: 0 6px; font-weight: 800; }
.consent-box label { display: flex; align-items: flex-start; gap: 8px; font-size: .84rem; }
.consent-box input { flex: 0 0 auto; margin-top: .35em; }
.choice-box { margin: 0 0 16px; padding: 13px 15px; border: 1px solid var(--line); border-radius: 12px; }
.choice-box legend { padding: 0 6px; }
.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px 12px; }
.choice-grid label { display: flex; align-items: flex-start; gap: 7px; min-width: 0; padding: 6px 8px; border-radius: 9px; font-size: .86rem; line-height: 1.45; cursor: pointer; }
.choice-grid label:hover { background: #fff7f1; }
.choice-grid input { flex: 0 0 auto; margin-top: .3em; }
.topping-groups { display: grid; gap: 12px; margin: 16px 0 20px; }
.topping-group { margin: 0; }
.topping-group .choice-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.subheading { margin: 21px 0 0; padding-top: 18px; border-top: 1px solid var(--line); font-size: 1rem; }
.compact-actions { align-items: baseline; }
.action-row { display: flex; gap: 9px; flex-wrap: wrap; }
.primary-button, .secondary-button, .download-button { display: inline-flex; justify-content: center; align-items: center; min-height: 45px; padding: 9px 18px; border-radius: 11px; font-weight: 800; text-decoration: none; cursor: pointer; }
.primary-button { border: 1px solid #ca6657; color: white; background: linear-gradient(135deg, #ec9c78, #dc7165); box-shadow: 0 7px 16px rgba(203,100,83,.2); }
.secondary-button { border: 1px solid #d1bbb1; color: var(--ink); background: white; }
.download-button { width: 100%; margin-top: 10px; color: #225c49; background: #dff4eb; border: 1px solid #a9d8c7; }
progress { width: 100%; height: 13px; margin-top: 13px; }
.browser-note { margin-top: 8px; margin-bottom: 35px; color: var(--muted); font-size: .82rem; text-align: center; }
footer { padding: 26px 0; border-top: 1px solid var(--line); background: rgba(255,255,255,.65); }
.footer-inner { display: grid; gap: 8px; font-size: .82rem; text-align: center; }
.footer-inner nav { display: flex; justify-content: center; flex-wrap: wrap; gap: 18px; }
.footer-inner p { margin: 0; }
.copyright { color: var(--muted); }
.legal-page { max-width: 880px; margin-top: 28px; margin-bottom: 50px; }
.legal-page h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); }
.legal-page h2 { margin-top: 2.1em; padding-bottom: .3em; border-bottom: 1px solid var(--line); }
.legal-page h3 { margin-top: 1.5em; font-size: 1.05rem; }
.legal-page li + li { margin-top: .45em; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }

/* 制作者欄: プロフィールを中央、その真下へゆるふわじんろうの導線を置く(2026-08-05確定)。
   width:fit-content で「中身がいちばん広いカード」に枠を合わせ、子を100%にすることで
   2枚のカード幅を揃える(固定px値を置かないので、文言を変えても崩れない) */
.author-area { display: grid; gap: 10px; width: fit-content; max-width: 100%; margin-inline: auto; margin-bottom: 10px; }
.author-card, .jinrou-card, .tool-link-card { width: 100%; }
/* アイコン列は max-content で固定する。auto にすると、画面が狭いときに文字側へ
   幅を取られて枠ごと潰れる(2026-08-05にスマホで発覚) */
.author-card { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 15px; align-items: center; max-width: 100%; padding: 15px 20px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.94); box-shadow: var(--shadow); }
/* 枠に高さを持たせない。canvasの寸法はJS(DECORATION_SIZE)が決めるので、CSSで別の
   高さを指定すると食い違って絵がはみ出す。幅だけ揃えてテキストの開始位置を合わせる */
.author-icon, .jinrou-icon { display: grid; align-items: center; justify-items: center; width: 96px; }
/* 飾りcanvasの寸法はJS側が96px以内で計算済み。ここで max-width/max-height を掛けると、
   枠が縮んだときに幅だけ潰れて高さが残り、絵が縦長に歪む。CSSでは制限しない */
.author-icon canvas, .jinrou-icon canvas { display: block; }
.author-name { margin: 0; font-size: 1.15rem; font-weight: 800; }
.author-role { margin: 2px 0 8px; color: var(--muted); font-size: .84rem; }
.author-links { display: flex; flex-wrap: wrap; gap: 8px; }
.author-links a { padding: 4px 13px; border: 1px solid #e3c9be; border-radius: 999px; background: #fffaf7; font-size: .82rem; font-weight: 700; text-decoration: none; }
.author-links a:hover { background: #fff1e7; }
/* 列を内容幅にして justify-content で中央へ寄せる。1fr にすると文字列が伸びて
   画像だけが右端へ押し出されるため(2026-08-05修正) */
.jinrou-card { display: grid; grid-template-columns: minmax(0, auto) max-content; gap: 10px; align-items: center; justify-content: center; max-width: 100%; padding: 11px 15px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.94); color: var(--ink); text-decoration: none; box-shadow: var(--shadow); transition: background .18s, transform .18s; }
.jinrou-card:hover { background: #fff6ef; transform: translateY(-2px); }
/* 姉妹ツールへのリンクカード。指定のモーションMP4を左、説明を右へ置く。 */
.tool-link-card { display: grid; grid-template-columns: max-content minmax(0, auto); gap: 12px; align-items: center; justify-content: center; max-width: 100%; padding: 11px 15px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.94); color: var(--ink); text-decoration: none; box-shadow: var(--shadow); transition: background .18s, transform .18s; }
.tool-link-card:hover { background: #fff6ef; transform: translateY(-2px); }
.tool-link-preview { display: grid; place-items: center; width: 96px; }
.tool-link-preview video { display: block; width: 96px; height: auto; }
.jinrou-text { font-size: .86rem; font-weight: 700; line-height: 1.6; text-align: center; }
.jinrou-note { display: inline-block; margin-top: 1px; color: var(--muted); font-size: .72rem; font-weight: 400; }

@media (max-width: 900px) {
  .tool-layout { grid-template-columns: 1fr; }
  .preview-card { position: static; }
}

@media (max-width: 560px) {
  .page-width { width: min(100% - 22px, 1160px); }
  .back-link { max-width: calc(100% - 22px); margin: 12px 11px 0; overflow-wrap: anywhere; }
  .hero { padding: 26px 0 20px; }
  .title-line { gap: 8px; }
  h1 { font-size: clamp(1.72rem, 9vw, 2.25rem); }
  h2 { margin-bottom: 14px; }
  .lead { font-size: .98rem; }
  .trial-note { padding: 12px 13px; }
  .tool-layout, .controls-column { min-width: 0; gap: 14px; }
  .card { padding: 17px; border-radius: 16px; }
  .section-heading { flex-wrap: wrap; gap: 8px; }
  .preview-stage { min-height: 0; padding: 8px; }
  .kirakira-preview-stage { min-height: 360px; }
  .drop-zone { min-height: 125px; padding: 14px 9px; }
  .input-limits, .size-note, .browser-note { overflow-wrap: anywhere; }
  .image-item { grid-template-columns: 34px 42px minmax(0,1fr); }
  .image-item img { width: 42px; height: 42px; }
  .image-actions { grid-column: 2 / -1; justify-content: flex-end; }
  .slider-field > div { gap: 8px; }
  .slider-field output { flex: 0 0 auto; }
  .action-row > *, .primary-button, .secondary-button { width: 100%; }
  .choice-grid, .topping-group .choice-grid { grid-template-columns: 1fr; }
  .footer-inner, .footer-inner nav { overflow-wrap: anywhere; }
  .rights-dialog { width: calc(100% - 18px); max-height: 90vh; border-radius: 15px; }
  .rights-dialog-panel { max-height: 90vh; padding: 17px; }
  /* 狭い画面ではカードを幅いっぱいに広げて、文字が詰まらないようにする */
  .author-card, .jinrou-card, .tool-link-card { justify-self: stretch; width: 100%; }
  /* アイコンの寸法はここで上書きしない。JS側の描画サイズと食い違うと絵がはみ出す */
  .author-card { padding: 13px 15px; }
  .jinrou-card, .tool-link-card { padding: 11px 13px; }
  .tool-link-card { gap: 9px; }
  .tool-link-preview, .tool-link-preview video { width: 76px; }
  .jinrou-text { font-size: .8rem; }
  .author-links a { padding: 4px 11px; font-size: .78rem; }
}

@media (max-width: 340px) {
  .page-width { width: calc(100% - 14px); }
  .card { padding: 13px; }
  .preview-stage { padding: 5px; }
  .mode-badge { white-space: normal; }
}
