.page-poster {
  background: linear-gradient(180deg, #eef5ff 0%, var(--app-bg) 36%);
}

.page-poster .subpage-topbar {
  background: linear-gradient(165deg, #c41e22 0%, #9a181c 55%, #7a1216 100%);
  box-shadow: 0 2px 12px rgba(154, 24, 28, 0.22);
}

.poster-topbar-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: -6px -6px -6px 0;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  border-radius: 8px;
  -webkit-tap-highlight-color: transparent;
}

.poster-topbar-link:active {
  background: rgba(255, 255, 255, 0.14);
}

.poster-main {
  padding: 12px 16px calc(28px + env(safe-area-inset-bottom, 0px));
}

.poster-stats {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  padding: 14px 16px;
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--card-shadow);
}

.poster-stats__item {
  flex: 1;
  min-width: 0;
  text-align: center;
}

.poster-stats__item strong {
  display: block;
  font-size: 26px;
  font-weight: 800;
  color: var(--gov-red);
  line-height: 1.1;
}

.poster-stats__item > span:last-child {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

.poster-stats__divider {
  width: 1px;
  align-self: stretch;
  min-height: 48px;
  background: #f0f2f5;
}

.poster-stats__item--code {
  flex: 1.4;
  text-align: left;
}

.poster-stats__label {
  display: block;
  margin-bottom: 6px;
  font-size: 11px;
  color: var(--muted);
}

.poster-code-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 6px 10px;
  color: var(--gov-blue);
  font: inherit;
  background: #eef4ff;
  border: 1px solid #d6e4ff;
  border-radius: 8px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.poster-code-chip em {
  font-size: 20px;
  font-weight: 800;
  font-style: normal;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.06em;
}

.poster-code-chip svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.7;
}

.poster-code-chip:active {
  background: #dce8ff;
}

.poster-preview {
  margin-bottom: 14px;
}

.poster-preview__tip {
  margin: 0 0 10px;
  padding: 8px 12px;
  font-size: 12px;
  color: #5a4020;
  text-align: center;
  line-height: 1.5;
  background: #fff8e8;
  border: 1px solid #ffe4b8;
  border-radius: var(--radius-md);
}

.poster-preview__frame {
  padding: 12px;
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--card-shadow);
}

.poster-stage {
  position: relative;
  min-height: 200px;
}

/* 离屏绘制，不参与页面排版 */
.poster-canvas-offscreen {
  position: fixed;
  left: -10000px;
  top: 0;
  width: 600px;
  height: auto;
  opacity: 0;
  pointer-events: none;
}

/* —— 状态：加载 / 错误 / 完成（只显示一种） —— */
.poster-loading,
.poster-error,
.poster-retry {
  display: none;
}

.poster-output {
  display: none;
  width: 100%;
  max-width: min(340px, 100%);
  margin: 0 auto;
  height: auto;
  border-radius: 10px;
  box-shadow: 0 6px 24px rgba(8, 21, 55, 0.12);
  -webkit-touch-callout: default;
  user-select: none;
  object-fit: contain;
}

.poster-preview__frame.is-loading .poster-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 280px;
  color: var(--muted);
  font-size: 14px;
}

.poster-loading__spin {
  width: 36px;
  height: 36px;
  border: 3px solid #e4e8ef;
  border-top-color: var(--gov-blue);
  border-radius: 50%;
  animation: poster-spin 0.75s linear infinite;
}

@keyframes poster-spin {
  to {
    transform: rotate(360deg);
  }
}

.poster-preview__frame.is-error .poster-error,
.poster-preview__frame.is-error .poster-retry {
  display: block;
}

.poster-preview__frame.is-error .poster-error {
  margin: 0 0 10px;
  padding: 20px 12px 0;
  color: var(--gov-red);
  font-size: 14px;
  text-align: center;
  line-height: 1.5;
}

.poster-preview__frame.is-error .poster-retry {
  width: 100%;
  margin: 0 0 8px;
  padding: 10px;
  color: var(--gov-blue);
  font-size: 14px;
  font-weight: 600;
  background: #eef4ff;
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
}

.poster-preview__frame.is-ready .poster-output {
  display: block;
}

.poster-steps {
  display: flex;
  gap: 8px;
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
}

.poster-steps li {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 6px;
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  line-height: 1.35;
  background: #fff;
  border-radius: var(--radius-md);
  box-shadow: var(--card-shadow);
}

.poster-steps li span {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  background: var(--gov-blue);
  border-radius: 50%;
}

.poster-steps li:nth-child(2) span {
  background: var(--gov-orange);
}

.poster-steps li:nth-child(3) span {
  background: var(--gov-green);
}

.poster-actions {
  display: grid;
  gap: 10px;
}

.poster-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 16px;
  font-size: 15px;
  font-weight: 600;
  border: 0;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}

.poster-btn svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.poster-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.poster-btn:not(:disabled):active {
  transform: scale(0.98);
}

.poster-btn--primary {
  color: #fff;
  background: linear-gradient(135deg, var(--gov-red) 0%, var(--gov-red-deep) 100%);
  box-shadow: 0 4px 14px rgba(196, 30, 34, 0.28);
}

.poster-btn--share {
  color: #fff;
  background: linear-gradient(135deg, #0052d9 0%, #003a9e 100%);
  box-shadow: 0 4px 14px rgba(0, 82, 217, 0.22);
}

.poster-actions__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.poster-btn--ghost {
  color: var(--gov-blue);
  background: #fff;
  border: 1px solid #d6e4ff;
  box-shadow: var(--card-shadow);
}

.poster-footnote {
  margin: 14px 0 0;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  line-height: 1.6;
}
