/* /create ページ専用スタイル。モバイルファースト、基準ビューポート 375x667。
   プレビューを首屏（スクロールなしの初期表示範囲）に収め、購入 CTA は
   常に画面下部に固定表示する。 */

/* t-smokefix: .create__cta-bar は position: fixed; bottom: 0 の不透明バー。
   固定区は CTA 2 ボタンのみ（総高 ≤120px）。scrollIntoView()（フォーカス
   移動・キーボード操作・E2E の page.click() が内部で使う
   scrollIntoViewIfNeeded 相当も含む）はこの固定バーの存在を知らないため、
   フォント/配色カードのような要素をこのバーの真下（見えているのに実は
   タップが素通りしてバーのボタンに吸われる状態）に揃えてしまうことが
   あった（本番 390×844 で create-font-switch が「canvas のピクセルデータが
   変化しませんでした」で失敗した実根本原因）。scroll-padding-bottom で
   バーの高さぶんの余白をスクロール先頭寄せの計算に含めることで、
   scrollIntoView がバーの下に要素を置かなくなる。 */
html {
  scroll-padding-bottom: 7.5rem;
}

@media (min-width: 992px) {
  html {
    scroll-padding-bottom: 6.5rem;
  }
}

.create {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  min-width: 0;
  max-width: 100%;
}

/* 常駐する下部 CTA バーの高さぶん、/create の最後のコンテンツ（フォームの
   後に続くフッターも含む）が隠れないようにする。 */
.create,
.page-create .footer {
  padding-bottom: 7.5rem;
}

.create__form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.create__section {
  border: none;
  margin: 0;
  padding: 0;
  min-width: 0;
}

.create__label {
  display: block;
  margin: 0 0 0.5rem;
  padding: 0;
  font-weight: bold;
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

.create__text-input {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 0.75rem;
  font-size: 1.1rem;
  border: 1px solid #ccc;
  border-radius: 0.5rem;
}

/* 入力エラーと欠字ヒントは同一スロットに重ねる。空态は 2.4em だけ予約し、
   エラー出現でスロットを伸ばして配色／ガイドを押し下げない（U5）。 */
.create__input-status {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: minmax(2.4em, auto);
  margin: 0.4rem 0 0;
}
.create__input-status > * {
  grid-column: 1;
  grid-row: 1;
  min-height: 0;
  margin: 0;
}
.create__error {
  z-index: 1;
  font-size: 0.85rem;
  line-height: 1.2;
  color: #c0392b;
}

/* 欠字ヒントは hidden でも visibility で隠し、スロット高さを動かさない。 */
.create__glyph-hint {
  font-size: 0.85rem;
  line-height: 1.2;
  color: #666;
}
.create__glyph-hint[hidden] {
  display: block;
  visibility: hidden;
}

.create__options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.create__option {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid #ddd;
  border-radius: 0.5rem;
  font-size: 0.9rem;
  background: #fff;
}

.create__option--swatch {
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 0.5rem;
}

.create__font-loading {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.2;
  color: #666;
  min-height: 1.2em;
}

/* hidden でも高さを保つ。オプション区のレイアウトを動かさない。 */
.create__font-loading[hidden] {
  display: block;
  visibility: hidden;
}

/* PXH-004b: フォント選択を「フォント名の文字」ではなく実サンプル文字の
   実様レンダリングで提示する。モバイルでは横スクロールの1行帯にする。 */
.create__font-scroller {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.6rem;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  overscroll-behavior-y: auto;
  touch-action: pan-x pan-y;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
  padding: 0.15rem 0.15rem 0.5rem;
  margin: 0 -0.15rem;
}

button.create__font-option {
  margin: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.create__font-option {
  cursor: pointer;
  /* position: relative は次のルールで非表示化する input[type=radio]
     （position: absolute）の containing block をこの要素自身に固定するため。
     指定が無いと最寄りの positioned 祖先（無ければ初期包含ブロック＝
     ページ全体）が containing block になり、この要素は
     .create__font-scroller の overflow-x:auto で視覚的にはクリップされて
     いても、absolute 化した子要素の static position（横スクロール行内で
     実際に流れていた座標＝右の項目ほど大きな値）が clip を無視して
     documentElement.scrollWidth に漏れ、ページ全体が横スクロール可能に
     なってしまう（tools/e2e で発見: /create の scrollWidth !== innerWidth）。 */
  position: relative;
  flex: 0 0 auto;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  width: 6.5rem;
  min-height: 44px;
  padding: 0.6rem 0.4rem;
  border: 1px solid #ddd;
  border-radius: 0.6rem;
  background: #fff;
  box-sizing: border-box;
}

.create__font-option.create__font-option--static {
  cursor: default;
}

.create__font-option:has(input:checked),
.create__font-option.is-selected {
  border-color: #ff3d77;
  background: #fff0f5;
}

.create__font-option input[type='radio'] {
  /* ラジオ本体は非表示にし、カード全体をタップ領域にする（visuallyは隠すが
     スクリーンリーダー・キーボード操作からは除外しない）。 */
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.create__font-specimen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
  width: 100%;
  min-height: 3.2rem;
  color: #1a1a1a;
}

.create__font-specimen--loading {
  opacity: 0.35;
}

.create__font-specimen-primary {
  font-size: 1.6rem;
  line-height: 1.1;
}

.create__font-specimen-secondary {
  font-size: 0.85rem;
  line-height: 1.1;
  color: #555;
}

.create__font-name {
  font-size: 0.7rem;
  color: #888;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.create__more-fonts-btn {
  display: block;
  margin: 0 0 0.45rem auto;
  min-height: 2.25rem;
  padding: 0.25rem 0.65rem;
  border: 1px solid #ff3d77;
  border-radius: 999px;
  background: #fff;
  color: #b52258;
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
}
.create__more-fonts-btn.is-selected {
  background: #fff0f5;
  font-weight: 700;
}
.create__font-current {
  margin: 0.15rem 0 0;
  font-size: 0.82rem;
  line-height: 1.5;
  min-height: 1.5em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #555;
}
/* Reserve the status line while keeping an unselected name inaccessible. */
.create__font-current[hidden] {
  display: block;
  visibility: hidden;
}
.create__font-dialog:not([open]),
.create__font-card[hidden] { display: none; }

.create__font-dialog {
  box-sizing: border-box;
  width: min(42rem, calc(100vw - 1.5rem));
  max-width: none;
  max-height: min(85vh, 46rem);
  max-height: min(85dvh, 46rem);
  padding: 1rem;
  border: 0;
  border-radius: 1rem;
  box-shadow: 0 1rem 3rem #24121d55;
  color: #222;
}
.create__font-dialog::backdrop { background: #191019aa; }
.create__font-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.create__font-dialog-header h2 { margin: 0; font-size: 1.2rem; }
.create__font-dialog-close {
  flex: 0 0 auto;
  width: 2.75rem;
  height: 2.75rem;
  border: 0;
  border-radius: 50%;
  background: #f5edf0;
  color: #333;
  font-size: 1.5rem;
  cursor: pointer;
}
.create__font-tabs {
  display: flex;
  gap: 0.35rem;
  margin-top: 0.8rem;
  overflow-x: auto;
}
.create__font-tabs button {
  flex: 1 0 auto;
  min-height: 2.75rem;
  padding: 0.45rem 0.8rem;
  border: 1px solid #ddd;
  border-radius: 0.6rem;
  background: #fff;
  font: inherit;
  cursor: pointer;
}
.create__font-tabs button[aria-selected="true"] {
  border-color: #ff3d77;
  background: #fff0f5;
  color: #a5194b;
  font-weight: 700;
}
.create__font-dialog-hint {
  margin: 0.65rem 0;
  color: #666;
  font-size: 0.85rem;
}
.create__font-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr));
  gap: 0.65rem;
  max-height: min(52vh, 30rem);
  max-height: min(52dvh, 30rem);
  overflow-y: auto;
  padding: 0.15rem;
}
.create__font-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  min-height: 6.75rem;
  padding: 0.65rem;
  border: 1px solid #ddd;
  border-radius: 0.65rem;
  background: #fff;
  color: #222;
  cursor: pointer;
}
.create__font-card[aria-pressed="true"] {
  border: 2px solid #ff3d77;
  background: #fff0f5;
}
.create__font-card-sample {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 1.5rem;
  line-height: 1.25;
}
.create__font-card-name { font-size: 0.75rem; color: #555; text-align: center; }

/* 縁取りタイル：標本エリアに太さの違いを見せ、下の名称行と対にする。 */
.create__font-specimen--border-none .create__font-specimen-primary {
  color: #1a1a1a;
}

.create__font-specimen--border-thin .create__font-specimen-primary {
  color: #fff;
  text-shadow:
    -1px -1px 0 #1a1a1a,
    1px -1px 0 #1a1a1a,
    -1px 1px 0 #1a1a1a,
    1px 1px 0 #1a1a1a;
}

.create__font-specimen--border-thick .create__font-specimen-primary {
  color: #fff;
  text-shadow:
    -2px -2px 0 #1a1a1a,
    2px -2px 0 #1a1a1a,
    -2px 2px 0 #1a1a1a,
    2px 2px 0 #1a1a1a,
    -2px 0 0 #1a1a1a,
    2px 0 0 #1a1a1a,
    0 -2px 0 #1a1a1a,
    0 2px 0 #1a1a1a;
}

.create__sublabel {
  display: block;
  margin: 0 0 0.4rem;
  padding: 0;
  font-weight: bold;
  font-size: 0.8rem;
  color: #444;
}

.create__subhint {
  font-weight: normal;
  font-size: 0.72rem;
  color: #888;
}

.create__fallback-note {
  margin: 0 0 0.5rem;
  font-size: 0.75rem;
  color: #666;
}

.create__fallback-group,
.create__subfieldset {
  border: none;
  margin: 0;
  padding: 0;
  min-width: 0;
}

.create__option:has(input:checked) {
  border-color: #ff3d77;
  background: #fff0f5;
}

.create__swatch {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  border: 2px solid;
  font-weight: bold;
}

/* t-73094: 二栏レイアウトの外枠。モバイル（<992px）は縦積みで、
   .create__preview-col が最初の子要素として画面上部に sticky 表示される。
   デスクトップ（≥992px）は右カラムを sticky にする横並びに切り替える
   （下の @media (min-width: 992px) 参照）。 */
.create__layout {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  min-width: 0;
  max-width: 100%;
}

/* t-4535: flex item のデフォルト min-width は auto（コンテンツの内在幅）。
   .create__font-scroller / .create__color-preset-list のような
   overflow-x:auto の横スクロール帯が中に含まれる列は、明示的に
   min-width:0 を指定しないと内容の実寸まで縮小を拒否し、列そのものが
   レイアウトビューポートを押し広げてしまう（縦積みでも横並びでも同様）。 */
.create__layout > * {
  min-width: 0;
}

.create__controls-col {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  min-width: 0;
  max-width: 100%;
}

/* モバイル: プレビューは画面上部に貼り付け、その下で操作パネルがスクロール
   する。ナビゲーションバーはこのページに存在しない（ヒーロー見出しは
   通常フローで一緒にスクロールして消える）ため top は 0 でよい。
   背景色を敷いて、下を通過するコントロール類がプレビューの下に
   透けて重ならないようにする。 */
.create__preview-col {
  position: sticky;
  top: 0;
  z-index: 15;
  background: #fafafa;
  padding: 0.5rem 0 0.35rem;
}

.create__preview-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.create__preview-frame {
  position: relative;
  width: 100%;
  max-width: 100%;
  aspect-ratio: 8 / 5;
  background: #f0f0f0;
  border-radius: 0.75rem;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (max-width: 991.98px) {
  html {
    scroll-padding-top: 42vh;
  }

  .create__preview-frame {
    aspect-ratio: unset;
    height: 36vh;
    height: 36dvh;
    min-height: 32vh;
    max-height: 40vh;
    transition: height 0.15s ease;
  }

  /* 折りたたみ: ボタンで高さ0にし、下のコントロールをすぐ見せる。
     ステータス行・トグルボタン自体は隠さない。 */
  .create__preview-wrap--collapsed .create__preview-frame {
    aspect-ratio: unset;
    width: 100%;
    height: 0;
    min-height: 0;
    max-height: 0;
    border-radius: 0;
  }

  /* ソフトウェアキーボード表示中はプレビューをさらに縮めて、入力欄や
     ボタンが隠れないようにする（create.js が visualViewport で検出）。 */
  body.create--kb-open .create__preview-frame {
    aspect-ratio: unset;
    width: 100%;
    height: 18vh;
    height: 18dvh;
    min-height: 0;
    max-height: 22vh;
  }

  .create__preview-toggle {
    display: inline-flex;
  }
}

/* ≤768px：预览画布高度上限约 34vh（不低于 180px），保持 8:5 等比。桌面（≥992px）规则不变。 */
@media (max-width: 768px) {
  html {
    scroll-padding-top: 38vh;
  }

  .page-create .hero--compact {
    padding: 0.45rem 1rem;
  }

  .page-create .hero--compact .hero__title {
    margin-bottom: 0;
    font-size: 1.15rem;
  }

  main.content.create {
    padding-top: 0.6rem;
  }

  /* 样本行回到输入框下之后，首屏仍要露出配色名称（U1 / t-9d4148c9 V2）。 */
  .create__layout,
  .create__form,
  .create__controls-col {
    gap: 0.4rem;
  }

  .create__preview-col {
    padding: 0.25rem 0 0.2rem;
  }

  .create__preview-wrap {
    gap: 0.35rem;
  }

  .create__preview-frame {
    aspect-ratio: 8 / 5;
    /* 顶栏吸顶后预览少 2.6rem，配色行仍留在固定 CTA 之上。 */
    width: min(100%, calc(max(calc(34vh - 2.6rem), 156px) * 8 / 5));
    width: min(100%, calc(max(calc(34dvh - 2.6rem), 156px) * 8 / 5));
    height: auto;
    min-height: 0;
    max-height: max(calc(34vh - 2.6rem), 156px);
    max-height: max(calc(34dvh - 2.6rem), 156px);
  }

  .create__preview-wrap--collapsed .create__preview-frame {
    aspect-ratio: unset;
    width: 100%;
    height: 0;
    min-height: 0;
    max-height: 0;
  }

  body.create--kb-open .create__preview-frame {
    aspect-ratio: unset;
    width: 100%;
    height: 18vh;
    height: 18dvh;
    min-height: 0;
    max-height: 22vh;
  }

  .create__label,
  .create__presets .create__label {
    margin-bottom: 0.35rem;
  }

  .create__text-input {
    padding: 0.55rem 0.75rem;
  }

  .create__input-status {
    margin-top: 0.2rem;
  }

  /* サンプル行は入力の補助。首屏で配色名称を CTA より上に残すため標本を一段縮める。 */
  .create__presets .create__font-option {
    width: 5.4rem;
    padding: 0.35rem 0.25rem;
  }
  .create__presets .create__font-specimen {
    min-height: 2.2rem;
  }
  .create__presets .create__font-specimen-primary {
    font-size: 1.2rem;
  }
  .create__presets .create__font-specimen-secondary {
    display: none;
  }

  .create__font-scroller {
    padding-bottom: 0.3rem;
  }

  .create__font-option {
    padding: 0.3rem 0.3rem;
  }

  .create__font-specimen {
    min-height: 2.2rem;
  }

  .create__font-specimen-primary {
    font-size: 1.35rem;
  }

  /* 二次标本占首屏高度。名称保留（与样本行一致）。 */
  [data-option-group='font'] .create__font-specimen-secondary {
    display: none;
  }

  /* 配色同心圆默认 3.2rem。字体标本缩小后名称仍被固定 CTA 挡住
     （生产 390×844: nameBottoms≈794, ctaTop≈781）。标本高度与字体行对齐。 */
  .create__color-preset-swatch {
    width: 2.2rem;
    height: 2.2rem;
  }

  .create__preview-footer {
    gap: 0.35rem;
  }

  .create__preview-toggle {
    min-height: 32px;
    padding: 0.25rem 0.6rem;
  }
}

.create__preview-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.create__preview-img[hidden] {
  display: none;
}

/* preview.js（PXH-001c）のクライアント側四層 canvas 描画。成功時のみ
   表示し、フレーム全体に重ねて img/placeholder の上を覆う。フォント
   取得失敗など canvas 側が描画できないときは hidden のままになり、
   下の preview-img（サーバー描画、create.js が既存どおり更新）が
   そのまま見える＝フォールバック。 */
.create__preview-canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.create__preview-canvas[hidden] {
  display: none;
}

.create__preview-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  /* 修复: 该要素是 .create__preview-frame（display:flex）的子项，flex item
     的默认 min-width は auto（コンテンツの内在幅）となり、長い文言だと
     縮まずに枠からはみ出して overflow:hidden で不自然に欠ける。
     min-width:0 で明示的に縮小を許可し、正しく折り返させる。 */
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
  padding: 0 1.25rem;
  text-align: center;
}

.create__preview-placeholder[hidden] {
  display: none;
}

.create__preview-placeholder-icon {
  width: 2.75rem;
  height: 2.75rem;
  color: #d0d0d0;
}
@media (max-width: 768px) {
  .create__preview-placeholder-icon {
    width: 2rem;
    height: 2rem;
  }
}

.create__preview-placeholder-text {
  margin: 0;
  min-width: 0;
  max-width: 100%;
  font-size: 0.85rem;
  color: #b3b3b3;
  overflow-wrap: break-word;
  word-break: break-word;
}

/* 转化：预览空态内的 3 步瓷砖（数字在上、名称在下）。高度预留，切 is-current 不抖动。 */
.create__preview-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.3rem;
  width: 100%;
  max-width: 20rem;
  margin: 0;
  padding: 0;
  list-style: none;
  min-height: 3.2rem;
}
.create__preview-steps li {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
  min-width: 0;
  min-height: 3.2rem;
  padding: 0.25rem 0.15rem;
  box-sizing: border-box;
  border: 1px solid #e5e5e5;
  border-radius: 0.45rem;
  background: #fff;
  color: #888;
}
.create__preview-steps li.is-current {
  border-color: #ff3d77;
  background: #fff0f5;
  color: #1a1a1a;
}
.create__preview-steps-num {
  font-size: 0.85rem;
  font-weight: bold;
  line-height: 1.1;
}
.create__preview-steps-name {
  font-size: 0.62rem;
  line-height: 1.2;
  overflow-wrap: anywhere;
  text-align: center;
}

.create__status {
  margin: 0;
  font-size: 0.85rem;
  color: #666;
  min-height: 1.2em;
}

/* 导出进度/错误会写成两行日文；预留下高度，避免点免费保存时把付费墙顶下去（U5）。 */
.create__export-status {
  min-height: calc(0.85rem * 1.4 * 2);
}

.create__preview-footer {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
}

.create__preview-status-stack {
  flex: 1 1 auto;
  min-width: 0;
}

.create__preview-footer .create__status {
  flex: 1 1 auto;
  min-width: 0;
}

/* デスクトップでは常に展開表示なのでトグル不要。モバイル用の
   display:inline-flex は @media (max-width: 991.98px) 側で有効化する。 */
.create__preview-toggle {
  display: none;
  flex: 0 0 auto;
  min-height: 36px;
  padding: 0.35rem 0.75rem;
  border: 1px solid #ddd;
  border-radius: 999px;
  background: #fff;
  color: #ff3d77;
  font-size: 0.78rem;
  font-weight: bold;
  white-space: nowrap;
}

/* シェア欄は hidden でも高さを予約し、入力後にガイドリンクを押し下げない。 */
.create__share {
  min-height: calc(0.9rem + 0.5rem + 40px);
}
.create__share[hidden] {
  display: block !important;
  visibility: hidden;
  pointer-events: none;
}

.create__share-buttons {
  display: flex;
  gap: 0.5rem;
  min-width: 0;
  max-width: 100%;
}

.create__share-btn {
  flex: 1 1 0;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0.5rem 0.5rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: bold;
  line-height: 1.3;
  text-align: center;
  text-decoration: none;
  color: #fff;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  box-sizing: border-box;
}

.create__share-btn--x {
  background: #000;
}

.create__share-btn--line {
  background: #06c755;
}

.create__presets {
  border: none;
  margin: 0.55rem 0 0;
  padding: 0;
  min-width: 0;
}

.create__presets .create__label {
  margin-bottom: 0.6rem;
}

/* スタイルサンプルはフォントタイルと同じカード（specimen 上・名称下・横スクロール・同一選中态）。
   配色は data-palette（style.go の presetSamples 3種）で標本エリアの塗り/背景を見せる。
   縁取りは data-border の text-shadow。選中は .create__font-option.is-selected。 */
.create__preset-btn .create__font-specimen {
  border-radius: 0.35rem;
}

.create__preset-btn[data-palette='sakura'] .create__font-specimen {
  background: #fff0f5;
  color: #ff3d77;
}

.create__preset-btn[data-palette='sakura'] .create__font-specimen-secondary {
  color: #ff3d77;
}

.create__preset-btn[data-palette='kin'] .create__font-specimen {
  background: #1a1a1a;
  color: #ffd700;
}

.create__preset-btn[data-palette='kin'] .create__font-specimen-secondary {
  color: #ffd700;
}

.create__preset-btn[data-palette='aozora'] .create__font-specimen {
  background: #f0f8ff;
  color: #1e88e5;
}

.create__preset-btn[data-palette='aozora'] .create__font-specimen-secondary {
  color: #1e88e5;
}

.create__preset-btn[data-palette='sakura'][data-border='thin'] .create__font-specimen-primary,
.create__preset-btn[data-palette='aozora'][data-border='thin'] .create__font-specimen-primary {
  text-shadow:
    -1px -1px 0 #fff,
    1px -1px 0 #fff,
    -1px 1px 0 #fff,
    1px 1px 0 #fff;
}

.create__preset-btn[data-palette='kin'][data-border='thick'] .create__font-specimen-primary {
  text-shadow:
    -2px -2px 0 #3a2400,
    2px -2px 0 #3a2400,
    -2px 2px 0 #3a2400,
    2px 2px 0 #3a2400,
    -2px 0 0 #3a2400,
    2px 0 0 #3a2400,
    0 -2px 0 #3a2400,
    0 2px 0 #3a2400;
}

/* PXH-001d: 折叠细调区（塗り/フチ1/フチ2/外フチの色・幅）。<details> は
   デフォルトで閉じており（HTML側に open 属性を付けない）、開いても
   フォームの通常フローに沿って下方向に伸びるだけなので、上部の
   .create__preview-frame を覆うことはない。 */
.create__tuning {
  border: 1px solid #ddd;
  border-radius: 0.5rem;
  background: #fff;
}

.create__tuning-summary {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0.5rem 0.9rem;
  font-weight: bold;
  font-size: 0.9rem;
  cursor: pointer;
  list-style: none;
}

.create__tuning-summary::-webkit-details-marker {
  display: none;
}

.create__tuning-summary::before {
  content: '▸';
  display: inline-block;
  margin-right: 0.5rem;
  transition: transform 0.15s ease;
}

.create__tuning[open] > .create__tuning-summary::before {
  transform: rotate(90deg);
}

.create__tuning-note {
  margin: 0;
  padding: 0 0.9rem 0.5rem;
  font-size: 0.78rem;
  color: #888;
}

.create__tuning-body {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 0 0.9rem 1rem;
}

/* PXH-004b: 配色プリセット（塗り/フチ1/フチ2/外フチの一括セット）。折叠细调区
   の内側、手動調整の上に置く。横スクロールの1行帯にして、
   .create__preview-frame（画面上部で常に見えている）を絶対に覆わない。 */
.create__color-presets {
  padding: 0 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 0;
}

/* 配色リストは .create__font-scroller / .create__font-option を再利用する。
   四層リングはフォント specimen と同じ占位（min-height 3.2rem）に収める。 */
.create__color-preset-swatch {
  position: relative;
  display: block;
  width: 3.2rem;
  height: 3.2rem;
  margin: 0 auto;
}

.create__color-preset-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.create__color-preset-ring--outerEdge {
  width: 100%;
  height: 100%;
}

.create__color-preset-ring--edge2 {
  width: 76%;
  height: 76%;
}

.create__color-preset-ring--edge1 {
  width: 54%;
  height: 54%;
}

.create__color-preset-ring--fill {
  width: 32%;
  height: 32%;
}

.create__layer-fieldset {
  border: none;
  margin: 0;
  padding: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.create__layer-fieldset legend {
  padding: 0;
  font-weight: bold;
  font-size: 0.85rem;
}

/* PXH-001d: 12色タイルはフォント基準（specimen 上・名称下・横スクロール）。 */
.create__layer-swatches {
  margin: 0;
}

.create__layer-swatch {
  width: 5.25rem;
}

.create__layer-swatch-chip {
  display: block;
  width: 2.4rem;
  height: 2.4rem;
  margin: 0 auto;
  border-radius: 0.45rem;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.16);
}

.create__layer-hex-label,
.create__layer-width-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
  font-size: 0.85rem;
}

.create__layer-hex-input {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 44px;
  box-sizing: border-box;
  padding: 0 0.6rem;
  font-size: 0.95rem;
  border: 1px solid #ccc;
  border-radius: 0.4rem;
  text-transform: uppercase;
}

.create__layer-width-label span {
  flex: 0 0 auto;
  min-width: 4.2em;
}

.create__layer-width-input {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 44px;
  cursor: pointer;
}

.create__cta-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  background: #fff;
  border-top: 1px solid #eee;
  padding: 0.45rem 0.75rem calc(0.45rem + env(safe-area-inset-bottom));
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.08);
}

/* t-c356b94c（t-68aee00a R2-02）: 免费按钮の长文は 390px で二行に折れて
   有料 CTA と見た目の高さが揃わなかった。ボタン文言は短くし、
   「透かし入り・低解像度」はこの一行小字に移す（webapp-ux.md 等高 CTA）。 */
.create__cta-note {
  margin: 0.3rem 0 0;
  font-size: 0.68rem;
  line-height: 1.35;
  color: #999;
  text-align: center;
}

/* t-c356b94c（t-68aee00a R2-02）: supportkit のフィードバック浮動ボタンは
   既定で right:16px / bottom:16px の固定配置で、390×844 では本ページの
   固定 CTA バー「印刷キットを購入」に重なってタップ領域を塞いでいた。
   挂件侧（embed.js）の既定位置は全サイト共通なので変えず、本ページ内だけ
   CTA バー（ボタン＋一行小字で実測約 4.5〜5.5rem）の上に上げる。
   embed.js はインラインスタイルで配置するため !important で上書きする。 */
.page-create #sk-feedback-btn {
  bottom: calc(6rem + env(safe-area-inset-bottom)) !important;
}

/* 面板も浮動ボタンの上に開くように合わせて上げる（開いている間は
   CTA が隠れるが、ダイアログとしてはそれでよい）。 */
.page-create #sk-feedback-panel {
  bottom: calc(8.5rem + env(safe-area-inset-bottom)) !important;
}

/* 390×844：抬到 CTA 上方的 Feedback 胶囊会盖住配色行右侧瓷砖。
   窄屏把胶囊放进吸顶标题栏右侧（标题区让出宽度），预览改贴在标题栏下，
   避免胶囊再压到配色。桌面仍用上面的 bottom 抬升，不挡双栏。 */
@media (max-width: 991.98px) {
  .page-create .hero--compact {
    position: sticky;
    top: 0;
    z-index: 25;
    display: flex;
    align-items: center;
    box-sizing: border-box;
    min-height: 2.6rem;
    padding: 0.35rem 8.75rem 0.35rem 0.75rem;
    background: #fff3f5;
  }

  .page-create .hero--compact .hero__title {
    width: 100%;
    margin: 0;
  }

  .page-create .create__preview-col {
    top: 2.6rem;
  }

  .page-create #sk-feedback-btn {
    top: 0.35rem !important;
    right: 0.6rem !important;
    bottom: auto !important;
    left: auto !important;
  }

  .page-create #sk-feedback-panel {
    top: 3.1rem !important;
    right: 0.6rem !important;
    bottom: auto !important;
    left: auto !important;
    max-height: min(70vh, 32rem);
  }
}

.create__cta-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-auto-rows: minmax(44px, auto);
  align-items: stretch;
  gap: 0.4rem;
}

/* 免费按钮的容器也参与拉伸；长文换行后，内部按钮仍会填满与付费按钮相同的格子高度。 */
.create__cta-free {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-width: 0;
  height: 100%;
}

/* CTA バー内の無料/有料ボタンは同じ盒模型（min-height / padding / 字号）。
   以前は .create__export-btn（padding 0.6rem・0.9rem・min-height 44px）と
   .create__download-btn（padding 0.9rem・1.05rem・min-height なし）が並び、
   デスクトップ横並びで高低が揃わなかった。主次は実底 vs 描辺で出す。 */
.create__cta-bar .create__export-btn,
.create__cta-bar .create__download-btn {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  min-width: 0;
  margin: 0;
  min-height: 44px;
  padding: 0.3rem 0.5rem;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: bold;
  line-height: 1.25;
  text-align: center;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  border-radius: 0.5rem;
  border: 2px solid #ff3d77;
  -webkit-appearance: none;
  appearance: none;
}

/* 长文占满可用宽度并正常换行，避免 400px 宽度下末尾被裁切。 */
.create__cta-bar .create__export-btn > span {
  display: block;
  width: 100%;
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-all;
  text-align: center;
}

.create__cta-free .create__export-btn {
  flex: 1 1 auto;
  background: #fff;
  color: #ff3d77;
  border-color: #ff3d77;
}

.create__download-btn {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 0.9rem;
  text-align: center;
  border-radius: 0.5rem;
  background: #ff3d77;
  color: #fff;
  font-weight: bold;
  font-size: 1.05rem;
  text-decoration: none;
}

.create__cta-bar .create__download-btn {
  background: #ff3d77;
  color: #fff;
  border-color: #ff3d77;
  text-decoration: none;
}

.create__download-btn--disabled {
  background: #ccc;
  color: #666;
  cursor: not-allowed;
}

.create__cta-bar .create__download-btn--disabled {
  background: #ccc;
  color: #666;
  border-color: #ccc;
}

.create__note {
  margin: 0;
  font-size: 0.72rem;
  line-height: 1.4;
  color: #888;
  text-align: center;
  overflow-wrap: anywhere;
}

/* t-9d4148c9 V3: 附录价格注记は hidden でも高さを予約し、入力でガイドリンクを押し下げない。 */
#cta-price-note {
  min-height: calc(0.72rem * 1.4 * 2);
}
#cta-price-note[hidden] {
  display: block !important;
  visibility: hidden;
}

.create__kit-value-line {
  min-height: calc(0.72rem * 1.4 * 2);
  color: #555;
}

.create__note a {
  color: #888;
}

.create__cta-appendix {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.75rem;
  margin-top: 0.25rem;
  padding-top: 1rem;
  border-top: 1px solid #eee;
}

.create__help-link {
  margin: 0;
  font-size: 0.8rem;
  text-align: center;
  overflow-wrap: anywhere;
}

.create__help-link a {
  color: #0066cc;
  text-decoration: none;
  margin: 0 0.5rem;
}

.create__help-link a:hover {
  text-decoration: underline;
}

/* PXH-003b: クライアント側 300dpi PDF/PNG エクスポート。固定 CTA バーとは
   独立したフォーム内セクションとして置き、.create__preview-frame（画面上部
   で常に見えている）を覆わない。 */
.create__export {
  padding: 0.9rem;
  border: 1px solid #ddd;
  border-radius: 0.5rem;
  background: #fff;
}

.create__export-note {
  margin: 0 0 0.75rem;
  min-height: calc(0.78rem * 1.4 * 5);
  font-size: 0.78rem;
  line-height: 1.4;
  color: #888;
  overflow-wrap: anywhere;
}

.create__export-paper,
.create__export-uchiwa,
.create__export-bg {
  margin-bottom: 0.75rem;
}

.create__font-specimen--bg-white {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 0.35rem;
}

.create__font-specimen--bg-custom {
  background: linear-gradient(135deg, #ff3d77 0 33%, #00bcd4 33% 66%, #ffd700 66%);
  border: 1px solid #ddd;
  border-radius: 0.35rem;
}

.create__custom-bg-controls {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
  margin: 0.25rem 0 0.5rem;
}

.create__custom-bg-controls[hidden] {
  display: flex;
  visibility: hidden;
}

.create__custom-bg-controls input[type="color"] {
  width: 3rem;
  height: 2.5rem;
  padding: 0.1rem;
  cursor: pointer;
}

.create__custom-bg-controls output {
  font-variant-numeric: tabular-nums;
}

.create__font-specimen--flip-back .create__font-specimen-primary {
  display: inline-block;
  transform: scaleX(-1);
}

.create__font-specimen--bg-transparent {
  border: 1px solid #ddd;
  border-radius: 0.35rem;
  background-color: #fff;
  background-image:
    linear-gradient(45deg, #ccc 25%, transparent 25%),
    linear-gradient(-45deg, #ccc 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #ccc 75%),
    linear-gradient(-45deg, transparent 75%, #ccc 75%);
  background-size: 12px 12px;
  background-position: 0 0, 0 6px, 6px -6px, -6px 0;
}

.create__preview-canvas--transparent {
  background-color: #fff;
  background-image:
    linear-gradient(45deg, #ccc 25%, transparent 25%),
    linear-gradient(-45deg, #ccc 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #ccc 75%),
    linear-gradient(-45deg, transparent 75%, #ccc 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}

.create__export-bg-note {
  margin: 0.25rem 0 0;
  min-height: calc(0.78rem * 1.4);
  font-size: 0.78rem;
  line-height: 1.4;
  color: #888;
  overflow-wrap: anywhere;
}

.create__font-option.is-disabled,
.create__font-option[aria-disabled='true'],
.create__font-option:has(input:disabled) {
  cursor: not-allowed;
  opacity: 0.55;
  pointer-events: none;
}

.create__paywall {
  margin-top: 0.9rem;
  padding-top: 0.9rem;
  border-top: 1px dashed #ddd;
}

.create__paywall-price {
  margin: 0 0 0.4rem;
  font-size: 1rem;
  font-weight: bold;
  color: #d32f2f;
}

.create__paywall-note {
  margin: 0 0 0.3rem;
  font-size: 0.78rem;
  color: #888;
}

.create__paywall-list {
  margin: 0;
  padding-left: 1.2rem;
  font-size: 0.78rem;
  line-height: 1.5;
  color: #666;
}

.create__export-actions {
  display: flex;
  gap: 0.5rem;
}

.create__export-btn {
  flex: 1 1 0;
  min-width: 0;
  min-height: 44px;
  padding: 0.6rem 0.5rem;
  border: 1px solid #ff3d77;
  border-radius: 0.5rem;
  background: #fff;
  color: #ff3d77;
  font-weight: bold;
  font-size: 0.9rem;
  cursor: pointer;
}

.create__export-btn:disabled {
  border-color: #ccc;
  color: #999;
  cursor: not-allowed;
}

/* PXH-003c: 保存パネルの無料/付费二段階。ボタンは横幅いっぱいにして
   タップ領域を確保する（min-height は .create__export-btn の44pxを継承）。 */
.create__export-tier {
  margin-top: 0.5rem;
}

.create__export-btn--wide {
  width: 100%;
}

/* t-73094: デスクトップ（≥992px）は二栏。左＝コントロール（通常スクロール）、
   右＝プレビュー（sticky）。このページに固定ナビゲーションバーは無い
   （ヒーロー見出しはページ本文と一緒にスクロールする）ため、sticky の
   top は単純な余白でよい。下部に常駐する .create__cta-bar（固定表示、
   実測で約4.5rem＋余白）に隠れないよう、その高さぶんを max-height から
   差し引く。 */
@media (min-width: 992px) {
  .create,
  .page-create .footer {
    padding-bottom: 6.5rem;
  }

  .create__cta-bar .create__export-btn,
  .create__cta-bar .create__download-btn {
    font-size: 1rem;
    padding: 0.4rem 1rem;
  }

  .create__cta-actions {
    display: flex;
    flex-direction: row;
    align-items: stretch;
  }

  .create__cta-actions > * {
    flex: 1 1 0;
    min-width: 0;
  }

  .create__layout {
    flex-direction: row;
    align-items: flex-start;
    gap: 2rem;
  }

  .create__preview-col {
    position: sticky;
    top: 1.5rem;
    z-index: auto;
    flex: 0 0 44%;
    max-width: 44%;
    background: transparent;
    padding: 0;
    max-height: calc(100vh - 1.5rem - 6.5rem);
    max-height: calc(100dvh - 1.5rem - 6.5rem);
    display: flex;
  }

  .create__preview-wrap {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
  }

  /* t-4535: aspect-ratio を unset して height: auto にしてしまうと、
     プレースホルダのみ（img/canvas が非表示）の初期状態ではフレームの
     内在高さがプレースホルダの中身の高さ（約72px）まで潰れる。基準の
     aspect-ratio: 8/5（このメディアクエリ外のルール参照）をデスクトップ
     でも維持し、列幅（44%）から一定の高さを保つ。 */
  .create__preview-frame {
    flex: 0 0 auto;
    width: 100%;
    min-height: 0;
  }

  .create__controls-col {
    flex: 1 1 56%;
    min-width: 0;
  }

  .create__preview-toggle {
    display: none !important;
  }
}

/* 付費墙區塊：内容物清单、対比表、購買流程 */
.create__paywall {
  margin-top: 0.9rem;
  padding-top: 0.9rem;
  border-top: 1px dashed #ddd;
}

.create__paywall-header {
  margin-bottom: 0.9rem;
}

.create__paywall-price {
  margin: 0 0 0.4rem;
  font-size: 1rem;
  font-weight: bold;
  color: #d32f2f;
}

.create__paywall-price-amount {
  font-size: 1.3em;
  /* 具体金额（如 NT$89.00）在 390 宽下不折行（t-5b7a4046） */
  white-space: nowrap;
}

.create__paywall-subtitle {
  margin: 0.6rem 0 0;
  font-size: 0.9rem;
  font-weight: bold;
  color: #333;
}

.create__paywall-items {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-bottom: 1.2rem;
  padding: 0.75rem;
  background: #f9f9f9;
  border-radius: 0.5rem;
}

.create__paywall-item {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.85rem;
  line-height: 1.4;
  color: #333;
}

.create__paywall-icon {
  width: 1.2rem;
  height: 1.2rem;
  flex: 0 0 auto;
  margin-top: 0.1rem;
  color: #ff3d77;
}

.create__paywall-item-text {
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
}

.create__paywall-comparison {
  margin-bottom: 1.2rem;
  min-width: 0;
  max-width: 100%;
}

.create__paywall-comparison-title {
  margin: 0 0 0.6rem;
  font-size: 0.9rem;
  font-weight: bold;
  color: #333;
}

.create__paywall-table {
  width: 100%;
  max-width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 0.75rem;
  background: #fff;
}

.create__paywall-table th {
  padding: 0.5rem 0.35rem;
  text-align: center;
  border: 1px solid #ddd;
  background: #f5f5f5;
  font-weight: bold;
  line-height: 1.3;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.create__paywall-table td {
  padding: 0.45rem 0.3rem;
  text-align: center;
  border: 1px solid #ddd;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.create__paywall-table-header {
  font-size: 0.75rem;
  color: #666;
}

.create__paywall-table-header--paid {
  background: #fff5f7;
  color: #d32f2f;
}

.create__paywall-table-sub {
  display: block;
  font-size: 0.7rem;
  font-weight: normal;
  color: #999;
  margin-top: 0.2rem;
}

.create__paywall-table-label {
  text-align: left;
  font-weight: 500;
  background: #fafafa;
}

.create__paywall-table-cell {
  color: #666;
}

.create__paywall-table-cell--paid {
  background: #f9f0f2;
  font-weight: 500;
}

.create__paywall-flow {
  margin-top: 1.2rem;
  padding-top: 1rem;
  border-top: 1px solid #eee;
}

.create__paywall-flow-title {
  margin: 0 0 0.6rem;
  font-size: 0.9rem;
  font-weight: bold;
  color: #333;
}

.create__paywall-flow-steps {
  margin: 0 0 0.8rem;
  padding-left: 0;
  list-style: none;
}

.create__paywall-flow-steps li {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
  font-size: 0.85rem;
  line-height: 1.4;
  color: #555;
}

.create__paywall-flow-step-num {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 1.6rem;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  background: #ff3d77;
  color: #fff;
  font-size: 0.8rem;
  font-weight: bold;
  margin-top: 0.05rem;
}

.create__paywall-flow-step-text {
  flex: 1 1 auto;
  min-width: 0;
  padding-top: 0.1rem;
  overflow-wrap: anywhere;
}

.create__paywall-flow-note {
  margin: 0;
  font-size: 0.78rem;
  color: #888;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.create__paywall-flow-link {
  color: #0066cc;
  text-decoration: none;
}

.create__paywall-flow-link:hover {
  text-decoration: underline;
}
