@font-face {
  font-family: "Yozai";
  src: url("./assets/fonts/Yozai-Medium.ttf") format("truetype");
  font-style: normal;
  font-weight: 500;
  font-display: swap;
}

:root {
  color-scheme: light;
  font-family:
    -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Microsoft YaHei",
    sans-serif;
  font-synthesis: none;
  --page: #eef1ef;
  --panel: rgba(255, 255, 255, 0.9);
  --ink: #102020;
  --muted: #647171;
  --line: rgba(16, 32, 32, 0.1);
  --accent: #0f3f3c;
  --accent-hover: #0a312f;
  --focus: #2f7f79;
  --radius-large: 28px;
  --radius-medium: 18px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-width: 0;
  background: var(--page);
  -webkit-text-size-adjust: 100%;
}

body {
  min-width: 0;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 0%, rgba(198, 218, 213, 0.7), transparent 28rem),
    var(--page);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 12px;
  left: 12px;
  padding: 10px 14px;
  border-radius: 12px;
  color: #fff;
  background: var(--accent);
  font-weight: 750;
  text-decoration: none;
  transform: translateY(-160%);
  transition: transform 160ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

button,
input,
textarea,
select {
  font: inherit;
}

button,
summary,
input[type="color"],
input[type="file"],
select {
  cursor: pointer;
  touch-action: manipulation;
}

button,
summary,
input,
textarea,
select,
.history-upload-button {
  -webkit-tap-highlight-color: rgba(47, 127, 121, 0.14);
}

.app-shell {
  width: min(1540px, calc(100% - 40px));
  margin: 0 auto;
  padding: max(38px, env(safe-area-inset-top)) 0
    calc(64px + env(safe-area-inset-bottom));
}

.app-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 28px;
}

.eyebrow,
.preview-kicker {
  margin: 0 0 8px;
  color: var(--focus);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.app-header h1 {
  margin: 0;
  font-size: clamp(30px, 4vw, 48px);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.05;
}

.header-copy {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.header-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 10px;
}

.button {
  min-height: 46px;
  padding: 0 18px;
  border: 0;
  border-radius: 14px;
  font-weight: 700;
  transition:
    transform 160ms ease,
    background-color 160ms ease,
    color 160ms ease;
}

.button:active {
  transform: scale(0.96);
}

.button:focus-visible,
.note-type-button:focus-visible,
.custom-style-button:focus-visible,
.parameter-nav a:focus-visible,
.font-preset-button:focus-visible,
.history-upload-button:focus-within,
.history-clear-button:focus-visible,
.theme-chip:focus-visible,
.photo-layout-button:focus-visible,
.photo-edit-mode-button:focus-visible,
.photo-transform-overlay:focus-visible,
.preview-mode-button:focus-visible,
.floating-preview-position button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(47, 127, 121, 0.25);
  outline-offset: 2px;
}

.button-primary {
  color: #fff;
  background: var(--accent);
}

@media (hover: hover) {
  .button-primary:hover {
    background: var(--accent-hover);
  }
}

.button-secondary {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.8);
  box-shadow: inset 0 0 0 1px var(--line);
}

/* 3:4 竖版预览不需要占据大半屏宽：把宽度让给参数区，让参数能横向平铺、少上下滚动。 */
.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(330px, 34%);
  align-items: start;
  gap: 28px;
}

/* 参数区变宽后横向平铺：五个小节分栏排布，面板高度显著下降，调参不用反复上下滑。
   每个小节整块参与分栏，标题不会和自己的控件被拆到两栏。 */
.control-sections {
  display: block;
}

@media (min-width: 1180px) {
  .control-sections {
    columns: 2;
    column-gap: 12px;
  }

  .control-section {
    break-inside: avoid;
  }
}

/* 三栏时每栏约 315px，双列的控件会挤到换行；这些控件在三栏模式下改成单列。 */
@media (min-width: 1560px) {
  .control-sections {
    columns: 3;
  }

  .control-sections .note-type-grid,
  .control-sections .color-grid,
  .control-sections .field-grid-two,
  .control-sections .footer-field-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.control-panel {
  position: sticky;
  top: 24px;
  display: grid;
  max-height: calc(100dvh - 48px);
  gap: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 32px;
  background: var(--panel);
  box-shadow:
    0 16px 42px rgba(27, 54, 52, 0.08),
    inset 0 0 0 1px var(--line);
  backdrop-filter: blur(18px);
  scrollbar-gutter: stable;
  scroll-behavior: smooth;
}

.control-section {
  padding: 20px 16px 24px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  scroll-margin-block-start: 88px;
}

#photoParameters,
#layoutParameters {
  scroll-margin-block-start: 88px;
}

.control-section + .control-section {
  margin-top: 4px;
}

.parameter-nav {
  position: sticky;
  z-index: 6;
  top: 0;
  display: grid;
  gap: 8px;
  padding: 11px 12px 10px;
  border: 1px solid rgba(15, 63, 60, 0.1);
  border-radius: 23px;
  background: rgba(248, 250, 249, 0.94);
  box-shadow: 0 10px 24px rgba(18, 40, 39, 0.08);
  backdrop-filter: blur(16px) saturate(135%);
}

.parameter-nav > strong {
  color: var(--ink);
  font-size: 13px;
  letter-spacing: -0.01em;
}

.parameter-nav-links {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding-block-end: 2px;
  scrollbar-width: none;
}

.parameter-nav-links::-webkit-scrollbar {
  display: none;
}

.parameter-nav a {
  display: grid;
  min-width: max-content;
  min-height: 34px;
  padding-inline: 11px;
  place-items: center;
  border: 1px solid rgba(15, 63, 60, 0.11);
  border-radius: 11px;
  color: var(--focus);
  background: rgba(255, 255, 255, 0.82);
  font-size: 11px;
  font-weight: 750;
  text-decoration: none;
  transition:
    border-color 160ms ease,
    background-color 160ms ease,
    transform 120ms ease;
}

.parameter-nav a:active {
  transform: scale(0.96);
}

@media (hover: hover) {
  .parameter-nav a:hover {
    border-color: rgba(15, 63, 60, 0.28);
    background: #fff;
  }
}

.section-heading {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 20px;
}

.step {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 11px;
  color: #fff;
  background: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.section-heading h2,
.preview-toolbar h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.025em;
}

.section-heading p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.note-type-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.note-type-button {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  align-items: center;
  gap: 11px;
  min-width: 0;
  min-height: 84px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--ink);
  background: rgba(246, 248, 247, 0.66);
  text-align: left;
  transition:
    transform 120ms ease,
    border-color 160ms ease,
    background-color 160ms ease,
    box-shadow 160ms ease;
}

.note-type-button:active,
.custom-style-button:active,
.history-upload-button:active,
.history-clear-button:active {
  transform: scale(0.96);
}

.note-type-button > span:nth-child(2) {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.note-type-button strong {
  font-size: 12px;
  line-height: 1.3;
}

.note-type-button small {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
}

.note-type-button.is-active {
  border-color: rgba(15, 63, 60, 0.34);
  background: #fff;
  box-shadow: 0 8px 22px rgba(15, 63, 60, 0.08);
}

.note-type-preview {
  position: relative;
  display: block;
  width: 54px;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  border: 4px solid var(--preview-outer);
  border-radius: 8px;
  background: var(--preview-card);
  box-shadow: 0 5px 12px rgba(16, 32, 32, 0.12);
}

.note-type-preview i,
.note-type-preview b,
.note-type-preview em {
  position: absolute;
  display: block;
  border-radius: 999px;
  background: var(--preview-ink);
}

.note-type-preview i {
  top: 7px;
  left: 6px;
  width: 15px;
  height: 2px;
  opacity: 0.78;
}

.note-type-preview b {
  top: 25px;
  left: 6px;
  width: 37px;
  height: 6px;
}

.note-type-preview b + b {
  top: 34px;
  width: 29px;
}

.note-type-preview em {
  right: 6px;
  bottom: 7px;
  left: 6px;
  height: 2px;
  opacity: 0.52;
}

/* 五张缩略图跟随各模板的默认配色，避免选样式时看到的颜色和实际成图不一致。 */

.preview-evidence {
  --preview-outer: #02181a;
  --preview-card: #41cfd8;
  --preview-ink: #04201f;
  --preview-media: #02181a;
}

.preview-split {
  --preview-outer: #141010;
  --preview-card: #f2542c;
  --preview-ink: #210a03;
  --preview-media: #141010;
}

.preview-evidence i,
.preview-split i {
  right: 6px;
  width: auto;
  border-radius: 4px;
}

.preview-evidence i {
  top: 39px;
  bottom: 7px;
  height: auto;
  opacity: 1;
  background:
    linear-gradient(rgba(7, 30, 29, 0.08), rgba(7, 30, 29, 0.18)),
    url("./assets/presets/editorial-workbench-sample-v1.jpg") center / cover;
}

.preview-evidence b {
  top: 18px;
  height: 7px;
}

.preview-evidence b + b {
  top: 28px;
  width: 32px;
}

.preview-split i {
  top: 7px;
  right: 6px;
  bottom: auto;
  left: 6px;
  height: 30px;
  border-radius: 4px;
  opacity: 1;
  background:
    linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.52)),
    url("./assets/presets/editorial-workbench-sample-v1.jpg") center / cover;
}

.preview-split b {
  top: 43px;
  width: 35px;
  height: 5px;
}

.preview-split b + b {
  top: 51px;
  width: 27px;
  height: 4px;
}

.preview-split em {
  display: none;
}

.preview-split::after {
  position: absolute;
  right: 7px;
  top: 19px;
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: -0.08em;
  line-height: 1;
  content: "5.6";
}

@media (hover: hover) {
  .note-type-button:hover {
    border-color: rgba(15, 63, 60, 0.22);
    background: rgba(255, 255, 255, 0.88);
    transform: translateY(-1px);
  }
}

.brand-mode-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 12px;
  padding: 13px 14px;
  border: 1px solid rgba(15, 63, 60, 0.12);
  border-radius: 16px;
  background: rgba(15, 63, 60, 0.055);
}

.brand-mode-card > div {
  min-width: 0;
}

.brand-mode-card strong {
  display: block;
  font-size: 12px;
}

.brand-mode-card p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.template-copy-guide {
  display: grid;
  gap: 12px;
  margin-top: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
}

.template-copy-guide-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.template-copy-guide-heading > div:first-child {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.template-copy-guide-heading strong {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.3;
}

.template-copy-guide-heading span {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
}

.template-copy-guide-actions {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.template-copy-guide-actions button {
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid rgba(15, 63, 60, 0.18);
  border-radius: 10px;
  color: var(--accent);
  background: #fff;
  font-size: 10px;
  font-weight: 780;
  transition:
    transform 120ms ease,
    border-color 160ms ease,
    background-color 160ms ease;
}

.template-copy-guide-actions button:first-child {
  color: #fff;
  background: var(--accent);
}

.template-copy-guide-actions button:disabled {
  cursor: default;
  opacity: 0.52;
}

.template-copy-guide-actions button:active:not(:disabled) {
  transform: scale(0.96);
}

.template-copy-guide-summary,
.template-copy-guide-note {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
  text-wrap: pretty;
}

/* 逐字段规则默认折叠：同一份内容已经贴在下面每个输入框上，展开只用于一次性通读。 */
.template-copy-guide-details {
  margin-top: 8px;
}

.template-copy-guide-details > summary {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}

.template-copy-guide-details > summary::-webkit-details-marker {
  display: none;
}

.template-copy-guide-details > summary::before {
  display: inline-block;
  margin-inline-end: 5px;
  transition: transform 140ms ease;
  content: "▸";
}

.template-copy-guide-details[open] > summary::before {
  transform: rotate(90deg);
}

@media (hover: hover) {
  .template-copy-guide-details > summary:hover {
    color: var(--accent);
  }
}

.template-copy-guide-list {
  display: grid;
  gap: 7px;
}

.template-copy-guide-row {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 9px 10px;
  border-radius: 11px;
  background: rgba(15, 63, 60, 0.045);
}

.template-copy-guide-row > strong {
  color: var(--ink);
  font-size: 10px;
  line-height: 1.45;
}

.template-copy-guide-row > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.template-copy-guide-rule {
  color: var(--muted);
  font-size: 9px;
  line-height: 1.45;
}

.template-copy-guide-sample {
  margin: 0;
  overflow-wrap: break-word;
  color: var(--ink);
  font-size: 11px;
  font-weight: 720;
  line-height: 1.45;
}

.template-copy-guide-note {
  padding-top: 2px;
  font-size: 10px;
}

@media (hover: hover) {
  .template-copy-guide-actions button:hover:not(:disabled) {
    border-color: rgba(15, 63, 60, 0.34);
    background: rgba(15, 63, 60, 0.08);
  }

  .template-copy-guide-actions button:first-child:hover:not(:disabled) {
    color: #fff;
    background: #174d49;
  }
}

.custom-style-button {
  min-height: 34px;
  flex: 0 0 auto;
  padding: 0 10px;
  border: 1px solid rgba(15, 63, 60, 0.18);
  border-radius: 10px;
  color: var(--accent);
  background: rgba(255, 255, 255, 0.78);
  font-size: 11px;
  font-weight: 750;
  transition:
    transform 120ms ease,
    background-color 160ms ease;
}

.field-grid {
  display: grid;
  gap: 12px;
}

.field-grid-two {
  grid-template-columns: 1fr 1fr;
}

.field,
.color-field,
.range-field {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.field > span,
.color-field > span,
.range-field > span {
  color: #344242;
  font-size: 13px;
  font-weight: 700;
}

/* 字段名与字数计数占一行，模板写法与示例单独一行；两者都贴着输入框，不用回上面查原稿。 */
.field > span {
  display: grid;
  gap: 3px;
}

.field > span > b {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-weight: inherit;
}

.field > span small,
.field-hint {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.45;
}

/* 左上角/右上角与底部文字是并排两列，提示挂在整组下面而不是某一个框上。 */
.field-hint {
  margin-top: 6px;
}

.field-count {
  flex: 0 0 auto;
  padding: 1px 7px;
  border-radius: 999px;
  color: var(--muted);
  background: rgba(15, 63, 60, 0.06);
  font-size: 10px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.field-count[data-state="ok"] {
  color: #1c6b58;
  background: rgba(28, 107, 88, 0.11);
}

.field-count[data-state="warn"] {
  color: #9a5406;
  background: rgba(197, 122, 16, 0.14);
}

input[type="text"],
input[type="number"],
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 13px;
  color: var(--ink);
  background: rgba(246, 248, 247, 0.92);
  transition:
    border-color 160ms ease,
    background-color 160ms ease,
    box-shadow 160ms ease;
}

input[type="text"],
input[type="number"],
select {
  min-height: 44px;
  padding: 0 13px;
}

textarea {
  min-height: 76px;
  padding: 11px 13px;
  resize: vertical;
  line-height: 1.5;
}

/* 文案区一屏放不下，主因是几个固定高度的文本域各自留着空行。
   交给浏览器原生的 field-sizing 按内容伸缩：用 JS 读 scrollHeight 会在 columns 参数面板里
   触发整块多栏重排（实测单次 112ms），比省下的那点高度代价大得多。 */
textarea[data-autosize] {
  min-height: 46px;
  max-height: 10em;
  overflow-y: auto;
  resize: none;
  field-sizing: content;
}

/* 不支持 field-sizing 的浏览器回到固定高度，并把手动拖拽还给用户。 */
@supports not (field-sizing: content) {
  textarea[data-autosize] {
    min-height: 76px;
    resize: vertical;
  }
}

input[type="text"]:focus,
input[type="number"]:focus,
textarea:focus,
select:focus {
  border-color: rgba(47, 127, 121, 0.45);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(47, 127, 121, 0.08);
}

.theme-list {
  display: grid;
  gap: 16px;
}

.theme-group {
  display: grid;
  gap: 9px;
}

.theme-group-heading {
  display: grid;
  gap: 3px;
}

.theme-group-heading strong {
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

.theme-group-heading span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 550;
  line-height: 1.45;
}

.theme-group-chips {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.theme-chip {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  min-height: 62px;
  padding: 9px 30px 9px 9px;
  border: 1px solid var(--line);
  border-radius: 16px;
  color: #435050;
  background: rgba(255, 255, 255, 0.52);
  box-shadow: 0 1px 2px rgba(16, 32, 32, 0.03);
  font-size: 12px;
  font-weight: 700;
  text-align: left;
  transition:
    transform 120ms ease,
    border-color 160ms ease,
    background-color 160ms ease,
    box-shadow 160ms ease;
}

.theme-chip:active {
  transform: scale(0.96);
}

.font-preset-button:active {
  transform: scale(0.96);
}

/* 色卡按海报本身的三层结构画：满幅色场 + 承载卡 + 一道墨线，切换时能直接预判成图。 */
.theme-chip-preview {
  position: relative;
  flex: 0 0 auto;
  width: 34px;
  height: 44px;
  border-radius: 8px;
  background: var(--chip-field);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}

.theme-chip-preview::before {
  position: absolute;
  inset: 4px 3px;
  border-radius: 5px;
  background: var(--chip-card);
  content: "";
}

.theme-chip-preview::after {
  position: absolute;
  top: 17px;
  left: 7px;
  width: 20px;
  height: 8px;
  border-radius: 2px;
  background: var(--chip-ink);
  content: "";
}

.theme-chip-preview[data-decorator="editorialTech"]::after {
  top: 18px;
  height: 3px;
  border-radius: 999px;
  background: var(--chip-accent);
}

.theme-chip-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.theme-chip-copy strong,
.theme-chip-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.theme-chip-copy strong {
  color: var(--ink);
  font-size: 11px;
}

.theme-chip-copy small {
  color: var(--muted);
  font-size: 9px;
  font-weight: 550;
}

@media (hover: hover) {
  .theme-chip:hover {
    border-color: rgba(15, 63, 60, 0.22);
    background: rgba(255, 255, 255, 0.82);
    box-shadow: 0 3px 9px rgba(16, 32, 32, 0.06);
  }
}

.theme-chip.is-active {
  color: var(--accent);
  border-color: rgba(15, 63, 60, 0.46);
  background: #fff;
  box-shadow:
    0 0 0 3px rgba(15, 63, 60, 0.08),
    0 4px 12px rgba(16, 32, 32, 0.07);
}

.theme-chip.is-active::after {
  position: absolute;
  top: 50%;
  right: 10px;
  display: grid;
  width: 16px;
  height: 16px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--accent);
  content: "✓";
  font-size: 10px;
  transform: translateY(-50%);
}

.color-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.color-inputs {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 7px;
}

input[type="color"] {
  width: 42px;
  height: 42px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

input[type="color"]::-webkit-color-swatch {
  border: 0;
  border-radius: 8px;
}

.color-inputs input[type="text"] {
  min-width: 0;
  padding-inline: 9px;
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 12px;
  text-transform: uppercase;
}

.color-inputs input.is-invalid {
  border-color: #bd3a2e;
  box-shadow: 0 0 0 3px rgba(189, 58, 46, 0.1);
}

.color-contrast-status {
  margin: 10px 0 0;
  padding: 9px 11px;
  border-radius: 11px;
  color: #31534d;
  background: rgba(47, 127, 121, 0.08);
  font-size: 10px;
  line-height: 1.45;
}

.color-contrast-status.is-warning {
  color: #7a3d21;
  background: rgba(205, 103, 52, 0.11);
}

.footer-field-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 112px;
  gap: 12px;
}

/* 模块开关：关掉只是不渲染，输入框里的文字仍在，所以这里用勾选而不是删除按钮。 */
.module-card {
  display: grid;
  gap: 11px;
  margin-top: 14px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.56);
}

.module-card-heading strong {
  display: block;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

.module-card-heading small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 550;
}

.module-list {
  display: grid;
  gap: 6px;
}

.module-row {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 38px;
  padding: 5px 9px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  transition: background-color 160ms ease, opacity 160ms ease;
}

.module-row input {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.module-row span {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.module-row b {
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}

.module-row small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
}

.module-row.is-off {
  opacity: 0.52;
}

/* 模块开着但对应字段是空的：提示这一块不会出现，免得以为是 bug。 */
.module-row.is-empty b::after {
  margin-inline-start: 6px;
  color: #9a5406;
  content: "· 该字段为空";
  font-size: 10px;
  font-weight: 600;
}

@media (hover: hover) {
  .module-row:hover {
    background: #fff;
  }
}

.module-slot-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 2px;
}

.module-slot-row > span {
  color: #344242;
  font-size: 11px;
  font-weight: 700;
}

.module-slot-picker {
  display: flex;
  gap: 6px;
}

.module-slot-picker > button {
  padding: 6px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #435050;
  background: rgba(255, 255, 255, 0.7);
  font-size: 11px;
  font-weight: 700;
}

.module-slot-picker > button.is-active {
  color: var(--accent);
  border-color: rgba(15, 63, 60, 0.42);
  background: #fff;
}

.module-slot-picker > button:active {
  transform: scale(0.96);
}

.photo-upload-card {
  display: grid;
  gap: 11px;
  margin-top: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(246, 248, 247, 0.72);
}

.photo-upload-heading,
.photo-upload-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.photo-upload-heading strong {
  display: block;
  font-size: 13px;
}

.photo-upload-heading small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.photo-upload-heading > span {
  flex: 0 0 auto;
  padding: 4px 7px;
  border-radius: 999px;
  color: var(--accent);
  background: rgba(15, 63, 60, 0.08);
  font-size: 10px;
  font-weight: 800;
}

.photo-layout-picker {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.photo-layout-button {
  display: grid;
  gap: 3px;
  min-width: 0;
  min-height: 90px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 13px;
  color: #4a5757;
  background: rgba(255, 255, 255, 0.72);
  text-align: left;
  transition:
    transform 120ms ease,
    border-color 160ms ease,
    background-color 160ms ease;
}

.photo-layout-button:active {
  transform: scale(0.96);
}

.photo-layout-button::before {
  display: block;
  width: 100%;
  height: 28px;
  border-radius: 7px;
  background-color: #e7ecea;
  box-shadow: inset 0 0 0 1px rgba(15, 63, 60, 0.08);
  content: "";
}

.photo-layout-button[data-photo-layout="text"]::before {
  background:
    linear-gradient(#173027 0 0) 8px 8px / 54% 5px no-repeat,
    linear-gradient(#173027 0 0) 8px 17px / 70% 4px no-repeat,
    #f0e6cf;
}

.photo-layout-button[data-photo-layout="editorial"]::before {
  background:
    linear-gradient(#173027 0 0) 8px 6px / 50% 4px no-repeat,
    linear-gradient(#173027 0 0) 8px 13px / 68% 3px no-repeat,
    linear-gradient(135deg, #d8d6e2, #8fa49c) 8px 20px / calc(100% - 16px) 5px no-repeat,
    #f0e6cf;
}

.photo-layout-button[data-photo-layout="album"]::before {
  background:
    linear-gradient(135deg, #8fa49c, #d8d6e2) 7px 5px / calc(100% - 14px) 13px no-repeat,
    linear-gradient(#173027 0 0) 8px 22px / 58% 3px no-repeat,
    #f0e6cf;
}

.photo-layout-button strong {
  font-size: 12px;
}

.photo-layout-button span {
  color: var(--muted);
  font-size: 10px;
}

.photo-layout-button.is-active {
  border-color: rgba(15, 63, 60, 0.32);
  background: rgba(15, 63, 60, 0.075);
  box-shadow: 0 0 0 2px rgba(15, 63, 60, 0.05);
}

.photo-workflow {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.photo-workflow li {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.25;
}

.photo-workflow b {
  display: grid;
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 7px;
  color: var(--accent);
  background: rgba(15, 63, 60, 0.08);
  font-size: 9px;
}

.photo-input {
  width: 100%;
  min-width: 0;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--muted);
  background: #fff;
  font-size: 11px;
}

.photo-input::file-selector-button {
  min-height: 32px;
  margin-right: 9px;
  padding: 0 11px;
  border: 0;
  border-radius: 9px;
  color: #fff;
  background: var(--accent);
  font-weight: 750;
  cursor: pointer;
}

.photo-upload-meta {
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
}

.photo-upload-meta > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.photo-remove-button {
  flex: 0 0 auto;
  padding: 4px 8px;
  border: 0;
  color: #8d3028;
  background: transparent;
  font-size: 11px;
  font-weight: 750;
}

.photo-transform-controls {
  display: grid;
  gap: 10px;
  padding-top: 2px;
}

.photo-transform-controls[hidden] {
  display: none;
}

.photo-transform-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.photo-transform-summary button {
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--focus);
  background: rgba(255, 255, 255, 0.78);
  font-size: 10px;
  font-weight: 750;
}

.photo-transform-controls p {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.photo-edit-mode-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.photo-edit-mode-button {
  display: grid;
  gap: 3px;
  min-width: 0;
  min-height: 48px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: #4a5757;
  background: rgba(255, 255, 255, 0.72);
  text-align: left;
  transition:
    transform 120ms ease,
    border-color 160ms ease,
    background-color 160ms ease;
}

.photo-edit-mode-button:active {
  transform: scale(0.96);
}

.photo-edit-mode-button strong {
  font-size: 11px;
}

.photo-edit-mode-button span {
  color: var(--muted);
  font-size: 10px;
}

.photo-edit-mode-button.is-active {
  border-color: rgba(15, 63, 60, 0.32);
  background: rgba(15, 63, 60, 0.075);
}

.platform-format-card {
  display: grid;
  gap: 10px;
  margin-top: 2px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(15, 63, 60, 0.055);
}

.platform-format-heading,
.platform-format-card p {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.platform-format-heading strong {
  font-size: 13px;
}

.platform-format-heading span {
  padding: 4px 7px;
  border-radius: 999px;
  color: var(--accent);
  background: rgba(15, 63, 60, 0.09);
  font-size: 10px;
  font-weight: 800;
}

.platform-format-card p {
  margin: 0;
}

.platform-format-card p strong {
  font-size: 17px;
  font-variant-numeric: tabular-nums;
}

.platform-format-card p span {
  color: var(--focus);
  font-size: 12px;
  font-weight: 750;
}

.platform-format-card small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.quick-style-section {
  display: grid;
  gap: 11px;
  margin-top: 18px;
  padding-top: 17px;
  border-top: 1px solid var(--line);
}

.quick-style-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.quick-style-heading > div {
  display: grid;
  gap: 3px;
}

.quick-style-heading strong {
  font-size: 13px;
}

.quick-style-heading span {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
}

.font-guidance {
  display: grid;
  gap: 6px;
  padding: 11px 12px;
  border: 1px solid rgba(15, 63, 60, 0.12);
  border-radius: 13px;
  color: #314744;
  background: rgba(15, 63, 60, 0.045);
}

.font-guidance > strong {
  color: var(--focus);
  font-size: 11px;
  line-height: 1.3;
}

.font-guidance p {
  display: grid;
  gap: 3px;
  margin: 0;
  font-size: 11px;
  font-weight: 750;
  line-height: 1.45;
}

.font-guidance small {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.font-preset-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.font-preset-button {
  display: grid;
  min-width: 0;
  min-height: 68px;
  align-content: center;
  gap: 5px;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 13px;
  color: #435050;
  background: rgba(246, 248, 247, 0.68);
  text-align: left;
  transition:
    transform 120ms ease,
    border-color 160ms ease,
    background-color 160ms ease,
    box-shadow 160ms ease;
}

.font-preset-button b {
  overflow: hidden;
  color: var(--ink);
  font-size: 20px;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.font-preset-button span {
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.font-preset-button.is-active {
  border-color: rgba(15, 63, 60, 0.34);
  background: #fff;
  box-shadow: 0 6px 16px rgba(15, 63, 60, 0.08);
}

.font-preview-system b {
  font-family: "Helvetica Neue", "PingFang SC", sans-serif;
  font-weight: 800;
}

.font-preview-grotesk b {
  font-family: Arial, "Helvetica Neue", "PingFang SC", sans-serif;
  font-weight: 900;
  letter-spacing: -0.06em;
}

.font-preview-rounded b {
  font-family: "Arial Rounded MT Bold", "SF Pro Rounded", "PingFang SC", sans-serif;
  font-weight: 800;
}

.font-preview-handwritten b {
  font-family: "Yozai", "PingFang SC", sans-serif;
  font-weight: 500;
}

.font-preview-editorial b {
  font-family: "Songti SC", "STSong", Georgia, serif;
  font-weight: 700;
}

.custom-style-controls {
  display: grid;
  gap: 16px;
  margin-top: 14px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.custom-style-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.custom-style-heading strong {
  font-size: 13px;
}

.custom-style-heading span {
  color: var(--muted);
  font-size: 10px;
  text-align: right;
}

.range-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.range-field span {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.range-field output {
  color: var(--focus);
  font-variant-numeric: tabular-nums;
}

/* 轻微收敛属于正常排版，保持中性；只有滑杆基本空转时才用琥珀色提示“再拖也不会更大”。 */
.range-field output[data-state="fitted"] {
  color: var(--muted);
}

.range-field output[data-state="shrunk"] {
  color: #9a5406;
}

.range-field-label {
  align-items: center;
}

.range-field-label > b {
  display: flex;
  min-width: 0;
  align-items: baseline;
  gap: 8px;
  font-weight: inherit;
}

.range-field-label > button {
  flex: 0 0 auto;
  padding: 3px 10px;
  border: 1px solid rgba(15, 63, 60, 0.16);
  border-radius: 999px;
  color: #2f5f59;
  background: rgba(255, 255, 255, 0.72);
  font-size: 11px;
  font-weight: 700;
}

.range-field-label > button:active {
  transform: scale(0.95);
}

@media (hover: hover) {
  .range-field-label > button:hover {
    border-color: rgba(15, 63, 60, 0.34);
    background: #fff;
  }
}

/* 行距、组间距和副标题字号一起给三个落点；单拖一根滑杆很难一次调到位。 */
.rhythm-preset-block {
  display: grid;
  gap: 9px;
  margin-bottom: 4px;
}

.rhythm-preset-heading {
  display: grid;
  gap: 3px;
}

.rhythm-preset-heading strong {
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

.rhythm-preset-heading span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 550;
}

.rhythm-preset-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.rhythm-preset-grid > button {
  display: grid;
  gap: 2px;
  padding: 9px 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.52);
  text-align: center;
  transition:
    transform 120ms ease,
    border-color 160ms ease,
    background-color 160ms ease;
}

.rhythm-preset-grid > button:active {
  transform: scale(0.96);
}

.rhythm-preset-grid strong {
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

.rhythm-preset-grid span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 550;
}

@media (hover: hover) {
  .rhythm-preset-grid > button:hover {
    border-color: rgba(15, 63, 60, 0.22);
    background: rgba(255, 255, 255, 0.82);
  }
}

.rhythm-preset-grid > button.is-active {
  border-color: rgba(15, 63, 60, 0.46);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(15, 63, 60, 0.08);
}

.rhythm-preset-grid > button.is-active strong {
  color: var(--accent);
}

.title-line-size-controls {
  display: grid;
  gap: 10px;
  margin-top: 8px;
  padding: 12px;
  border: 1px solid rgba(15, 63, 60, 0.12);
  border-radius: 14px;
  background: rgba(246, 248, 247, 0.72);
}

.title-line-size-controls[hidden] {
  display: none;
}

.title-line-size-heading,
.title-line-size-heading > div {
  display: flex;
  align-items: center;
}

.title-line-size-heading {
  justify-content: space-between;
  gap: 12px;
}

.title-line-size-heading > div {
  min-width: 0;
  flex-wrap: wrap;
  gap: 4px 8px;
}

.title-line-size-heading strong {
  color: #344242;
  font-size: 13px;
}

.title-line-size-heading span,
.title-line-size-controls > p {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.title-line-size-heading button {
  min-height: 34px;
  flex: 0 0 auto;
  padding: 0 10px;
  border: 1px solid rgba(15, 63, 60, 0.14);
  border-radius: 10px;
  color: var(--focus);
  background: #fff;
  font-size: 11px;
  font-weight: 750;
}

.title-line-size-heading button:disabled {
  color: var(--muted);
  background: transparent;
}

.title-line-size-list {
  display: grid;
  gap: 4px;
}

.title-line-size-field {
  margin-top: 4px;
}

.title-line-size-field span > b {
  min-width: 0;
  overflow: hidden;
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.title-line-size-field span > b small {
  margin-left: 6px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
}

.title-line-size-controls > p {
  margin: 0;
}

input[type="range"] {
  min-height: 44px;
  width: 100%;
  margin: 0;
  accent-color: var(--accent);
  touch-action: pan-y;
}

.advanced-settings {
  margin-top: 20px;
  border-top: 1px solid var(--line);
}

.advanced-settings summary {
  display: flex;
  min-height: 44px;
  align-items: center;
  padding-top: 12px;
  color: var(--focus);
  font-size: 13px;
  font-weight: 750;
}

.advanced-body {
  padding-top: 4px;
}

.preview-shell {
  position: sticky;
  top: 24px;
  min-width: 0;
  padding: 22px;
  border-radius: 32px;
  color: #eef7f5;
  background: #122827;
  box-shadow: 0 22px 56px rgba(22, 49, 47, 0.18);
}

.floating-preview {
  display: none;
}

/* 预览列收窄到 1/3 后横排会把标题挤成断行，改为上下两段：标题在上、控件在下。 */
.preview-toolbar {
  display: flex;
  align-items: flex-start;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 18px;
}

.preview-toolbar-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
}

.preview-mode-switch {
  display: flex;
  padding: 3px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
}

.preview-mode-button {
  min-height: 28px;
  padding: 0 10px;
  border: 0;
  border-radius: 7px;
  color: #9fb6b3;
  background: transparent;
  font-size: 11px;
  font-weight: 750;
  transition:
    transform 140ms ease,
    color 160ms ease,
    background-color 160ms ease;
}

.preview-mode-button:active {
  transform: scale(0.96);
}

.preview-mode-button.is-active {
  color: #102827;
  background: #eaf3f1;
}

.preview-kicker {
  color: #9fc6c2;
}

.ratio-badge {
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  color: #bed3d1;
  background: rgba(255, 255, 255, 0.05);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.canvas-stage {
  display: grid;
  min-height: min(75vh, 820px);
  place-items: center;
  padding: 22px;
  border-radius: 22px;
  background:
    linear-gradient(45deg, rgba(255, 255, 255, 0.025) 25%, transparent 25%) 0 0 / 18px 18px,
    linear-gradient(-45deg, rgba(255, 255, 255, 0.025) 25%, transparent 25%) 0 0 / 18px 18px,
    #0b1c1b;
}

.poster-canvas-wrap {
  position: relative;
  width: min(100%, 54vh, 585px);
  aspect-ratio: 3 / 4;
}

#posterCanvas {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 3px;
  box-shadow: 0 22px 48px rgba(0, 0, 0, 0.32);
}

.photo-alignment-guides {
  position: absolute;
  z-index: 4;
  inset: 0;
  color: #fff;
  pointer-events: none;
}

.photo-alignment-line {
  position: absolute;
  display: none;
  background: #ff365f;
  box-shadow:
    0 0 0 1px rgba(76, 5, 22, 0.3),
    0 0 10px rgba(255, 54, 95, 0.42);
}

.photo-alignment-line-x {
  top: 6%;
  bottom: 6%;
  left: 50%;
  width: 2px;
  transform: translateX(-1px);
}

.photo-alignment-line-y {
  top: 50%;
  right: 8%;
  left: 8%;
  height: 2px;
  transform: translateY(-1px);
}

.photo-alignment-guides.is-x-aligned .photo-alignment-line-x,
.photo-alignment-guides.is-y-aligned .photo-alignment-line-y {
  display: block;
}

.photo-alignment-guides strong {
  position: absolute;
  top: 50%;
  left: 50%;
  padding: 5px 8px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 999px;
  color: #fff;
  background: #e92952;
  box-shadow: 0 7px 18px rgba(76, 5, 22, 0.26);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1;
  transform: translate(-50%, -50%);
  white-space: nowrap;
}

.photo-transform-overlay {
  position: absolute;
  z-index: 3;
  border: 2px solid rgba(255, 255, 255, 0.94);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
  box-shadow:
    0 0 0 1px rgba(7, 31, 32, 0.72),
    0 10px 28px rgba(0, 0, 0, 0.16);
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.photo-transform-overlay[hidden] {
  display: none;
}

.photo-transform-overlay.is-transforming {
  cursor: grabbing;
}

.photo-transform-overlay.is-crop-mode {
  border-style: dashed;
  cursor: grab;
}

.photo-transform-overlay.is-crop-mode .photo-resize-handle {
  display: none;
}

.photo-transform-label {
  position: absolute;
  top: 9px;
  left: 9px;
  padding: 5px 8px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 999px;
  color: #fff;
  background: rgba(8, 24, 24, 0.68);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.16);
  backdrop-filter: blur(12px) saturate(140%);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.04em;
  line-height: 1;
  pointer-events: none;
}

.photo-resize-handle {
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--focus);
  box-shadow:
    0 0 0 1px rgba(7, 31, 32, 0.8),
    0 4px 10px rgba(0, 0, 0, 0.22);
}

.photo-resize-handle::before {
  position: absolute;
  inset: -14px;
  content: "";
}

.photo-resize-handle-nw {
  top: -8px;
  left: -8px;
  cursor: nwse-resize;
}

.photo-resize-handle-ne {
  top: -8px;
  right: -8px;
  cursor: nesw-resize;
}

.photo-resize-handle-sw {
  bottom: -8px;
  left: -8px;
  cursor: nesw-resize;
}

.photo-resize-handle-se {
  right: -8px;
  bottom: -8px;
  cursor: nwse-resize;
}

.feed-stage {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
  min-height: min(75vh, 820px);
  justify-items: center;
  align-items: start;
  padding: 22px;
  border-radius: 22px;
  background: #0b1c1b;
}

.feed-stage[hidden],
.canvas-stage[hidden] {
  display: none;
}

.history-preview-toolbar {
  display: flex;
  width: min(100%, 420px);
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.055);
}

.history-preview-toolbar > div:first-child {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.history-preview-toolbar strong {
  color: #eef7f5;
  font-size: 11px;
}

.history-preview-toolbar span {
  color: #91aaa7;
  font-size: 9px;
  line-height: 1.35;
}

.history-preview-actions {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.history-sample-button,
.history-upload-button,
.history-clear-button {
  display: grid;
  min-height: 30px;
  place-items: center;
  padding: 0 9px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 9px;
  color: #eaf3f1;
  background: rgba(255, 255, 255, 0.08);
  font-size: 9px;
  font-weight: 750;
  transition:
    transform 120ms ease,
    background-color 160ms ease;
}

.history-upload-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.history-clear-button {
  color: #b9cfcc;
}

.history-sample-button:disabled {
  cursor: progress;
  opacity: 0.58;
}

.feed-phone {
  width: min(100%, 420px);
  max-height: min(72vh, 780px);
  overflow: auto;
  overscroll-behavior: contain;
  border-radius: 22px;
  color: #1e2525;
  background: #fff;
  box-shadow: 0 22px 48px rgba(0, 0, 0, 0.32);
  scrollbar-width: none;
}

.feed-phone::-webkit-scrollbar {
  display: none;
}

.feed-header {
  position: sticky;
  z-index: 2;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 30px;
  min-height: 52px;
  border-bottom: 1px solid rgba(16, 32, 32, 0.06);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(18px);
  font-size: 13px;
}

.feed-header span {
  color: #969d9c;
}

.feed-header strong {
  position: relative;
  font-weight: 800;
}

.feed-header strong::after {
  position: absolute;
  right: 4px;
  bottom: -9px;
  left: 4px;
  height: 3px;
  border-radius: 999px;
  background: #ff365f;
  content: "";
}

.feed-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 16px 8px;
  padding: 10px 8px 22px;
}

.feed-card {
  min-width: 0;
}

.feed-card-history {
  position: relative;
}

.feed-source-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  z-index: 1;
  padding: 3px 6px;
  border-radius: 999px;
  color: #fff;
  background: rgba(10, 25, 24, 0.72);
  box-shadow: 0 2px 8px rgba(5, 18, 17, 0.16);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1.2;
  backdrop-filter: blur(8px);
}

#feedPosterCanvas,
.feed-card-history img {
  display: block;
  width: 100%;
  height: auto;
  overflow: hidden;
  border-radius: 8px;
  background: #edf0ef;
}

.feed-card-history img {
  aspect-ratio: 3 / 4;
  object-fit: cover;
}

.feed-card h3 {
  display: -webkit-box;
  overflow: hidden;
  margin: 8px 3px 7px;
  font-size: 13px;
  font-weight: 650;
  letter-spacing: -0.01em;
  line-height: 1.42;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.feed-meta {
  display: flex;
  align-items: center;
  min-height: 22px;
  margin: 0 3px;
  color: #8a9190;
  font-size: 10px;
}

.feed-avatar {
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
  margin-right: 5px;
  border-radius: 50%;
  background: #dce2e0;
}

.feed-avatar-current {
  display: grid;
  place-items: center;
  color: #fff;
  background: #163b38;
  font-size: 9px;
  font-weight: 800;
}

.feed-like {
  margin-left: auto;
  color: #767e7c;
  font-size: 15px;
}

.feed-empty-state {
  display: grid;
  min-height: 150px;
  align-content: center;
  gap: 6px;
  padding: 14px;
  border: 1px dashed #d8dfdd;
  border-radius: 9px;
  color: #737d7b;
  background: #f5f7f6;
}

.feed-empty-state strong {
  color: #485250;
  font-size: 11px;
  line-height: 1.4;
}

.feed-empty-state span {
  font-size: 9px;
  line-height: 1.5;
}

.preview-note {
  margin: 13px 4px 0;
  color: #91aaa7;
  font-size: 12px;
  line-height: 1.5;
}

.toast {
  position: fixed;
  z-index: 10;
  right: calc(24px + env(safe-area-inset-right));
  bottom: calc(24px + env(safe-area-inset-bottom));
  max-width: min(360px, calc(100vw - 48px));
  padding: 12px 16px;
  border-radius: 14px;
  color: #fff;
  background: rgba(16, 32, 32, 0.94);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.18);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1050px) {
  .workspace {
    grid-template-columns: minmax(0, 1fr) minmax(300px, 38%);
  }

  .color-grid {
    grid-template-columns: 1fr;
  }

  .canvas-stage {
    min-height: 640px;
  }

  .feed-stage {
    min-height: 640px;
  }
}

@media (max-width: 900px) {
  .app-shell {
    width: min(100% - 24px, 760px);
    padding-top: max(22px, env(safe-area-inset-top));
  }

  .app-header {
    align-items: stretch;
    flex-direction: column;
  }

  .header-actions .button {
    flex: 1;
  }

  .workspace {
    grid-template-columns: minmax(0, 1fr);
  }

  .control-panel {
    position: relative;
    top: auto;
    max-height: none;
    overflow: visible;
    overscroll-behavior: auto;
    scrollbar-gutter: auto;
  }

  .parameter-nav {
    top: calc(8px + env(safe-area-inset-top));
  }

  .preview-shell {
    position: static;
    order: -1;
  }

  .canvas-stage {
    min-height: 0;
  }

  .feed-stage {
    min-height: 0;
  }

  #posterCanvas {
    width: 100%;
  }

  .poster-canvas-wrap {
    width: min(100%, 420px);
  }
}

@media (min-width: 601px) and (max-width: 900px) {
  .canvas-stage,
  .feed-stage {
    padding: 14px;
  }

  .poster-canvas-wrap {
    width: min(100%, 38vh, 400px);
  }
}

@media (min-width: 601px) and (max-width: 900px) and (any-pointer: coarse) {
  .floating-preview {
    position: fixed;
    z-index: 30;
    top: calc(12px + env(safe-area-inset-top));
    display: block;
    width: clamp(148px, 22vw, 190px);
    padding: 7px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 18px;
    color: #eef7f5;
    background: rgba(10, 31, 30, 0.9);
    box-shadow: 0 18px 42px rgba(5, 20, 19, 0.32);
    backdrop-filter: blur(18px) saturate(140%);
  }

  .floating-preview[data-side="left"] {
    left: calc(12px + env(safe-area-inset-left));
  }

  .floating-preview[data-side="right"] {
    right: calc(12px + env(safe-area-inset-right));
  }

  .floating-preview-toolbar {
    display: flex;
    min-height: 44px;
    align-items: center;
    gap: 6px;
    padding-bottom: 6px;
  }

  .floating-preview-toolbar > strong {
    display: none;
  }

  .floating-preview-position {
    display: flex;
    flex: 0 0 auto;
    gap: 4px;
    margin-inline-start: auto;
  }

  .floating-preview-position button {
    display: grid;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 11px;
    color: #b8cfcc;
    background: rgba(255, 255, 255, 0.06);
    font-size: 12px;
    font-weight: 800;
  }

  .floating-preview-position button[aria-pressed="true"] {
    color: #102827;
    background: #eaf3f1;
  }

  #floatingPreviewCanvas {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 3 / 4;
    border-radius: 11px;
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.28);
  }
}

@media (max-width: 480px) {
  .control-panel {
    padding: 6px;
    border-radius: 22px;
  }

  .control-section,
  .preview-shell {
    padding: 18px;
    border-radius: 22px;
  }

  .field-grid-two {
    grid-template-columns: 1fr;
  }

  .note-type-grid {
    grid-template-columns: 1fr;
  }  .brand-mode-card,
  .history-preview-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .template-copy-guide-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .template-copy-guide-actions {
    justify-content: stretch;
  }

  .template-copy-guide-actions button {
    flex: 1 1 150px;
    font-size: 12px;
  }

  .template-copy-guide-row {
    grid-template-columns: 72px minmax(0, 1fr);
  }

  .history-preview-actions {
    width: 100%;
  }

  .history-upload-button,
  .history-clear-button {
    flex: 1;
  }

  .theme-group-chips {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .canvas-stage {
    padding: 12px;
  }

  .feed-stage {
    padding: 12px;
  }

  .footer-field-grid {
    grid-template-columns: 1fr;
  }
}

@media (any-pointer: coarse) {
  button,
  summary,
  select,
  input[type="color"],
  .history-upload-button,
  .history-clear-button {
    min-height: 44px;
  }

  input[type="text"],
  input[type="number"],
  textarea,
  select,
  .photo-input,
  .color-inputs input[type="text"] {
    font-size: 16px;
  }

  textarea {
    min-height: 96px;
    padding: 13px 14px;
  }

  input[type="color"] {
    width: 48px;
    height: 48px;
  }

  .color-inputs {
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 10px;
  }

  .custom-style-button,
  .parameter-nav a,
  .theme-chip,
  .photo-remove-button,
  .photo-transform-summary button,
  .preview-mode-button,
  .history-upload-button,
  .history-clear-button {
    padding-inline: 12px;
  }

  .custom-style-button,
  .photo-remove-button,
  .preview-mode-button {
    font-size: 13px;
  }

  .note-type-button strong,
  .brand-mode-card strong,
  .photo-layout-button strong,
  .photo-edit-mode-button strong,
  .font-guidance > strong {
    font-size: 13px;
  }

  .note-type-button small,
  .brand-mode-card p,
  .photo-upload-heading small,
  .photo-upload-heading > span,
  .photo-layout-button span,
  .photo-upload-meta,
  .photo-transform-summary,
  .photo-transform-controls p,
  .photo-edit-mode-button span,
  .platform-format-heading span,
  .platform-format-card small,
  .quick-style-heading span,
  .font-guidance p,
  .font-guidance small,
  .font-preset-button span,
  .custom-style-heading span {
    font-size: 12px;
  }

  .photo-transform-summary button,
  .history-upload-button,
  .history-clear-button {
    font-size: 12px;
  }

  .preview-mode-button {
    min-width: 72px;
  }

  .photo-input::file-selector-button {
    min-height: 44px;
    padding-inline: 14px;
  }

  .range-list {
    gap: 12px;
  }

  .theme-group-chips,
  .font-preset-grid,
  .photo-layout-picker,
  .photo-edit-mode-picker {
    gap: 10px;
  }

  .photo-resize-handle {
    width: 20px;
    height: 20px;
  }

  .photo-resize-handle-nw {
    top: -10px;
    left: -10px;
  }

  .photo-resize-handle-ne {
    top: -10px;
    right: -10px;
  }

  .photo-resize-handle-sw {
    bottom: -10px;
    left: -10px;
  }

  .photo-resize-handle-se {
    right: -10px;
    bottom: -10px;
  }
}

@media (max-width: 480px) {
  .preview-mode-button {
    min-width: 44px;
    padding-inline: 8px;
    white-space: nowrap;
  }

  .ratio-badge {
    min-width: 0;
    padding-inline: 8px;
    font-size: 9px;
    white-space: nowrap;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

@media (prefers-reduced-transparency: reduce) {
  .control-panel,
  .parameter-nav {
    background: #fff;
    backdrop-filter: none;
  }

  .control-section {
    background: transparent;
  }

  .floating-preview {
    background: #122827;
    backdrop-filter: none;
  }
}

@media (prefers-contrast: more) {
  .note-type-button,
  .control-section,
  .floating-preview {
    border-color: currentColor;
  }
}
