/*! 表情包工坊（toolbox/sticker.html）样式合集
 *  由 assets/kuaile.css + assets/style.css 合并，字体在 ../fonts/ZCOOLKuaiLe.ttf
 *  改动请直接改本文件；不要再去改 toolbox/sticker/ 下的旧副本。
 */
@font-face{font-family:"ZCOOL KuaiLe";font-style:normal;font-weight:400;font-display:swap;src:url(../fonts/ZCOOLKuaiLe.ttf) format("truetype")}

:root {
  color-scheme: light;
  --paper: #faf7ef;
  --card: #fffdf8;
  --white: #fff;
  --ink: #292330;
  --muted: #675f70;
  --border: #e7dedf;
  --purple: #6540c5;
  --dark-purple: #4d2ba5;
  --lavender: #f1eafa;
  --font: "Inter", "Noto Sans CJK SC", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 14px/1.5 var(--font)
}

h2,
p {
  margin: 0
}

a {
  color: inherit;
  text-decoration: none
}

button,
input,
select {
  font: inherit
}

button {
  cursor: pointer
}

button,
a,
input,
select {
  -webkit-tap-highlight-color: transparent
}

:focus-visible {
  outline: 2px solid var(--purple);
  outline-offset: 2px
}

[hidden] {
  display: none !important
}

svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none
}

.shell {
  width: min(1180px, calc(100% - 44px));
  margin-inline: auto
}

.masthead {
  border-bottom: 1px solid var(--border);
  padding-top: env(safe-area-inset-top, 0px);
  background: var(--paper)
}

.masthead-inner,
.brand {
  display: flex;
  align-items: center
}

.masthead-inner {
  min-height: 52px
}

.brand {
  gap: 9px;
  white-space: nowrap
}

.brand-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  background: var(--purple);
  border-radius: 9px;
  color: white;
  transform: rotate(-5deg)
}

.brand-icon svg {
  fill: currentColor;
  stroke: none;
  width: 20px;
  height: 20px
}

.brand strong {
  font-size: 20px;
  font-weight: 900
}

.brand-label {
  border-left: 1px solid #d8cdd9;
  padding-left: 10px;
  color: var(--muted);
  font-size: 13px
}

.workbench {
  display: grid;
  grid-template-areas: "preview editor" "catalog catalog";
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.13fr);
  gap: 12px
}

.card {
  min-width: 0;
  min-height: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 15px;
  box-shadow: 0 6px 18px #39225a0a
}

.preview {
  grid-area: preview;
  display: flex;
  flex-direction: column
}

.editor {
  grid-area: editor
}

.catalog {
  grid-area: catalog;
  display: flex;
  flex-direction: column
}

.section-title,
.preview-footer,
.caption-label,
.range span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px
}

.section-title h2,
.result h2,
.dialog-header h2 {
  font-size: 16px;
  font-weight: 850
}

.section-title h2 {
  display: flex;
  align-items: center;
  gap: 9px
}

.section-title output {
  background: var(--lavender);
  color: var(--dark-purple);
  border-radius: 6px;
  padding: 3px 7px;
  font-size: 11px;
  white-space: nowrap
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #38a986;
  box-shadow: 0 0 0 4px #dcf1e8
}

.preview-stage {
  position: relative;
  margin-top: 9px;
  display: grid;
  place-items: center;
  min-height: 0;
  flex: 1;
  background: #fff;
  border: 1px solid #e8dfeb;
  border-radius: 12px;
  overflow: hidden
}

.preview-stage.is-transparent {
  background-color: #fbf8fb;
  background-image: conic-gradient(#efe8f2 25%, transparent 0 50%, #efe8f2 0 75%, transparent 0);
  background-size: 24px 24px
}

.preview-stage canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain
}

.icon-button {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  border: 1px solid #e6dcef;
  border-radius: 9px;
  background: var(--card);
  color: var(--dark-purple);
  padding: 0
}

.icon-button:hover {
  background: var(--lavender)
}

.play {
  position: absolute;
  bottom: 8px;
  right: 8px
}

.preview-footer {
  margin-top: 6px;
  min-height: 23px;
  color: var(--muted);
  font-size: 12px
}

#selected-name {
  font-weight: 750;
  color: var(--ink)
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  white-space: nowrap;
  color: #564660;
  font-size: 12px
}

.check input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--purple);
  cursor: pointer
}

.text-button {
  border: 0;
  background: transparent;
  padding: 3px 0;
  color: var(--dark-purple);
  font-size: 12px
}

.text-button:hover {
  text-decoration: underline
}

.caption-label {
  margin-top: 8px
}

.caption-label,
.fields label,
.fields .range {
  color: #54495f;
  font-size: 12px;
  font-weight: 650
}

.caption-label output,
.range output {
  color: var(--muted);
  font-size: 11px;
  font-weight: 400
}

#tx,
select,
input[type=color] {
  width: 100%;
  min-width: 0;
  border: 1px solid #e1d7e6;
  border-radius: 8px;
  background: var(--white);
  color: var(--ink)
}

#tx {
  font-size: 16px;
  padding: 6px 9px;
  margin-top: 3px
}

select {
  padding: 5px;
  font-size: 13px;
  height: 32px
}

input[type=color] {
  height: 31px;
  padding: 3px;
  cursor: pointer
}

.fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 9px;
  margin-top: 8px
}

.fields label,
.fields .range {
  display: grid;
  align-content: start;
  gap: 3px;
  min-width: 0
}

.range input {
  min-width: 0;
  width: 100%;
  height: 30px;
  margin: 0;
  accent-color: var(--purple)
}

.export-check {
  display: flex;
  width: fit-content;
  margin: 9px 0 8px
}

.primary,
.secondary {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 7px;
  border-radius: 9px;
  padding: 6px 11px;
  font-weight: 750;
  min-height: 36px;
  text-align: center
}

.primary {
  background: var(--purple);
  color: white;
  border: 1px solid var(--purple);
  box-shadow: 0 3px 0 #4e2ba4
}

.primary:hover {
  background: var(--dark-purple)
}

.primary:disabled {
  opacity: .66;
  cursor: wait
}

#go {
  width: 100%
}

.secondary {
  color: var(--dark-purple);
  background: #f5effd;
  border: 1px solid #e6daf6
}

.secondary:hover {
  background: #eee4fb
}

progress {
  width: 100%;
  height: 6px;
  accent-color: var(--purple);
  margin-top: 8px
}

#status {
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
  text-align: center
}

#status:empty {
  display: none
}

.catalog-head {
  flex: none;
  margin-bottom: 8px
}

.catalog-head .browse {
  min-height: 29px;
  padding: 3px 9px;
  font-size: 12px
}

.template-catalog,
.picker-scroll {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 7px;
  align-content: start
}

.template {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-width: 0;
  border: 1px solid #e6dce7;
  border-radius: 9px;
  background: var(--white);
  color: #544359;
  padding: 3px 3px 5px;
  font-weight: 700;
  text-align: center
}

.template:hover {
  border-color: #b190e7
}

.template[aria-pressed=true] {
  border-color: var(--purple);
  box-shadow: 0 0 0 1px var(--purple);
  color: var(--dark-purple);
  background: #f6efff
}

.template canvas {
  width: 100%;
  height: auto;
  aspect-ratio: 1.52;
  object-fit: contain;
  display: block;
  border-radius: 6px
}

.template span {
  padding-top: 3px;
  font-size: 12px;
  line-height: 1.32;
  overflow-wrap: anywhere
}

.mark {
  display: none;
  position: absolute;
  right: 5px;
  top: 5px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--purple);
  color: white;
  padding: 2px
}

.template[aria-pressed=true] .mark {
  display: block
}

/* 上传本地模板：按钮组 + 上传模板的删除角标 */
.catalog-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none
}

.catalog-head .upload {
  min-height: 29px;
  padding: 3px 9px;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap
}

.catalog-head .upload svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round
}

.upload .t-short {
  display: none
}

.template span.template__del {
  display: none;
  position: absolute;
  left: 4px;
  top: 4px;
  width: 18px;
  height: 18px;
  padding: 0;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid #e6dce7;
  background: #fff;
  color: #8b7c91;
  cursor: pointer;
  z-index: 2
}

.template:hover .template__del,
.template:focus-within .template__del,
.template[aria-pressed=true] .template__del {
  display: flex
}

.template span.template__del:hover {
  background: #ffe9e9;
  border-color: #f0aeb0;
  color: #cf3f46
}

.template__del svg {
  width: 10px;
  height: 10px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round
}

.more {
  display: none
}

dialog {
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--card);
  color: var(--ink);
  max-width: calc(100vw - 24px);
  max-height: 90dvh
}

dialog::backdrop {
  background: #29203675
}

body:has(dialog[open]) {
  overflow: hidden
}

.dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 15px;
  background: var(--card);
  border-bottom: 1px solid var(--border)
}

.dialog-header p {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px
}

#picker {
  width: min(760px, 95vw);
  background: var(--paper)
}

#picker[open] {
  display: flex;
  flex-direction: column
}

.picker-scroll {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 12px 15px max(14px, env(safe-area-inset-bottom, 0px))
}

#quick-preview {
  flex: none;
  margin: 8px 11px 0;
  border: 1px solid #e6dcef;
  border-radius: 12px;
  background: var(--card)
}

.quick-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 6px 9px
}

.quick-header h3 {
  margin: 0;
  font-size: 14px
}

.quick-header .icon-button {
  width: 30px;
  height: 30px
}

.quick-art {
  display: grid;
  width: 100%;
  justify-items: center;
  gap: 5px;
  padding: 0 8px 7px;
  background: transparent;
  color: var(--dark-purple);
  border: 0;
  font-size: 12px;
  font-weight: 750
}

.quick-art canvas {
  display: block;
  width: min(100%, 215px, 29dvh);
  height: auto;
  aspect-ratio: 1;
  border-radius: 10px;
  background: var(--lavender)
}

.result {
  width: min(550px, calc(100vw - 24px))
}

.result-layout {
  display: flex;
  align-items: center;
  gap: 14px
}

.result img {
  flex: none;
  display: block;
  max-width: 100%;
  object-fit: contain;
  background: white;
  border: 1px solid var(--border);
  border-radius: 10px
}

.result-info {
  min-width: 0;
  flex: 1
}

.result p {
  color: var(--muted);
  margin: 4px 0 8px;
  font-size: 12px
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px
}

@media(min-width:701px) {
  body {
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    /* 兜底：极端矮窗口时整页滚动，绝不把滚动条塞进「编辑台词」面板里 */
    overflow-x: hidden;
    overflow-y: auto
  }

  .masthead {
    flex: none
  }

  main.shell {
    min-height: 0;
    display: flex;
    flex: 1;
    padding-block: 10px 12px
  }

  .workbench {
    width: 100%;
    min-height: 0;
    /* 上排按内容高度自适应（编辑器永远撑得开 → 面板内没有滚动条），
       下排吃掉剩余高度，模板区自己滚 */
    grid-template-rows: auto minmax(110px, 1fr)
  }

  .editor {
    display: flex;
    flex-direction: column;
    overflow: visible;
    /* 极端矮窗口里 grid 会压缩 auto 行 → 面板又得滚动。
       钉住内容最小高度，宁可整页溢出由 body 滚，也不在面板里出滚动条 */
    min-height: min-content;
    padding: 18px 20px
  }

  .editor>* {
    flex: none
  }

  .editor .section-title h2 {
    font-size: 17px
  }

  .editor .caption-label {
    margin-top: 13px
  }

  .editor .caption-label,
  .editor .fields label,
  .editor .fields .range {
    font-size: 13px
  }

  .editor .caption-label output,
  .editor .range output {
    font-size: 12px
  }

  .editor #tx {
    padding: 9px 10px;
    margin-top: 4px
  }

  .editor .fields {
    gap: 9px 12px;
    margin-top: 10px
  }

  .editor .fields label,
  .editor .fields .range {
    gap: 4px
  }

  .editor select,
  .editor input[type=color],
  .editor input[type=range] {
    height: 36px
  }

  .editor select {
    padding: 6px 8px;
    font-size: 15px
  }

  .editor .export-check {
    margin: 10px 0
  }

  .editor #go {
    min-height: 41px
  }

  .template-catalog {
    grid-template-columns: repeat(auto-fill, minmax(133px, 1fr));
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    padding: 2px 3px 3px
  }

  .workbench.is-browsing {
    grid-template-areas: "catalog";
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr)
  }

  .is-browsing .preview,
  .is-browsing .editor {
    display: none
  }
}

@media(min-width:701px) and (max-height:825px) {
  .workbench {
    grid-template-rows: auto minmax(96px, 1fr)
  }

  .editor {
    padding: 12px 15px
  }

  .editor .caption-label {
    margin-top: 8px
  }

  .editor #tx {
    padding: 6px 9px
  }

  .editor .fields {
    gap: 6px 11px;
    margin-top: 7px
  }

  .editor select,
  .editor input[type=color],
  .editor input[type=range] {
    height: 31px
  }

  .editor .export-check {
    margin: 7px 0
  }

  .editor #go {
    min-height: 36px
  }
}

@media(min-width:701px) and (max-height:625px) {
  .workbench {
    grid-template-rows: auto minmax(84px, 1fr)
  }

  .card {
    padding: 10px
  }

  .editor .caption-label {
    margin-top: 5px
  }

  .editor .caption-label,
  .editor .fields label,
  .editor .fields .range {
    font-size: 12px
  }

  .editor #tx {
    padding: 4px 8px;
    margin-top: 3px
  }

  .editor .fields {
    gap: 4px 9px;
    margin-top: 5px
  }

  .editor .fields label,
  .editor .fields .range {
    gap: 2px;
    line-height: 1.35
  }

  .editor select,
  .editor input[type=color],
  .editor input[type=range] {
    height: 24px
  }

  .editor select {
    font-size: 13px;
    padding: 3px 6px
  }

  .editor .export-check {
    margin: 5px 0
  }

  .editor #go {
    min-height: 32px
  }
}

@media(max-width:700px) {
  .shell {
    width: calc(100% - 22px)
  }

  .masthead-inner {
    min-height: 45px
  }

  .workbench {
    grid-template-areas: "preview" "catalog" "editor";
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    padding: 8px 0 max(11px, env(safe-area-inset-bottom, 0px))
  }

  .card {
    border-radius: 13px;
    padding: 10px
  }

  .preview {
    position: sticky;
    top: 0;
    z-index: 2
  }

  .preview-stage {
    flex: none;
    height: clamp(105px, 24dvh, 185px);
    margin-top: 6px
  }

  .preview-footer {
    margin-top: 4px
  }

  .play {
    width: 32px;
    height: 32px;
    right: 6px;
    bottom: 6px
  }

  #editor-heading {
    scroll-margin-top: calc(clamp(105px, 24dvh, 185px) + 91px)
  }

  select {
    font-size: 16px;
    height: 36px
  }

  .template-catalog,
  .picker-scroll {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px
  }

  #th .template:not(.quick) {
    display: none
  }

  .template span {
    font-size: 11px
  }

  .browse {
    display: none
  }

  /* 手机上「浏览全部模板」交给底部「更多模板」，上传按钮保留但收成两字 */
  .catalog-head .upload {
    padding: 3px 8px;
    font-size: 11px
  }

  .catalog-head .upload .t-long {
    display: none
  }

  .upload .t-short {
    display: inline
  }

  .more {
    display: flex;
    width: 100%;
    margin-top: 8px;
    min-height: 32px;
    padding: 4px 7px
  }

  .more span {
    font-size: 11px;
    font-weight: 600
  }

  .more svg {
    width: 15px;
    height: 15px
  }

  .result img {
    width: 98px;
    height: 98px
  }

  #picker {
    position: fixed;
    inset: 0;
    margin: 0;
    width: 100%;
    max-width: none;
    height: 100vh;
    height: 100dvh;
    max-height: none;
    border: 0;
    border-radius: 0
  }

  .dialog-header {
    padding: calc(9px + env(safe-area-inset-top, 0px)) 12px 9px
  }

  .picker-scroll {
    flex: 1;
    padding: 9px 11px max(12px, env(safe-area-inset-bottom, 0px))
  }
}

@media(max-width:330px) {
  .result-layout {
    flex-wrap: wrap
  }

  .template span {
    font-size: 10px
  }
}
/* ---------- 本地模板：图片动效 / 擦除原图文字 ---------- */
.erase-btn {
  align-self: end;
  min-height: 32px;
  padding: 3px 8px;
  gap: 4px;
  font-size: 12px;
  white-space: nowrap
}

.erase-btn svg {
  width: 15px;
  height: 15px;
  flex: none
}

.eraser {
  width: min(520px, calc(100vw - 24px));
  max-height: 92dvh;
  flex-direction: column
}

.eraser[open] {
  display: flex
}

.erase-body {
  display: grid;
  flex: 1 1 auto;
  align-content: start;
  justify-items: center;
  gap: 9px;
  min-height: 0;
  overflow: auto;
  padding: 12px 15px 4px
}

.erase-stage {
  position: relative;
  overflow: hidden;
  border: 1px solid #e6dcf0;
  border-radius: 12px;
  background-color: #fff;
  background-image: linear-gradient(45deg, #f2ecf9 25%, transparent 25%, transparent 75%, #f2ecf9 75%), linear-gradient(45deg, #f2ecf9 25%, transparent 25%, transparent 75%, #f2ecf9 75%);
  background-size: 18px 18px;
  background-position: 0 0, 9px 9px;
  touch-action: none;
  cursor: crosshair
}

.erase-stage canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%
}

.erase-brush {
  display: grid;
  gap: 2px;
  width: 100%
}

.erase-brush span {
  color: #54495f;
  font-size: 12px;
  font-weight: 650
}

.erase-actions {
  display: flex;
  gap: 8px;
  width: 100%
}

.erase-actions .secondary {
  flex: 1;
  min-height: 34px;
  font-size: 13px
}

.erase-actions .secondary:disabled {
  opacity: .5;
  cursor: default
}

.erase-tip {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  text-align: center
}

.erase-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px 15px max(10px, env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border)
}

.erase-footer .primary,
.erase-footer .secondary {
  min-width: 96px
}

@media(max-width:700px) {
  .eraser[open] {
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: none;
    border: 0;
    border-radius: 0
  }
}

/* ---------- 生成 / 打赏按钮并排 ---------- */
.run-actions {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr);
  gap: 8px
}

.run-actions #go {
  width: 100%
}

.tip-btn {
  width: 100%;
  gap: 6px;
  padding: 6px 10px;
  font-size: 13.5px;
  font-weight: 800;
  letter-spacing: .4px;
  white-space: nowrap;
  color: #fff;
  background: linear-gradient(135deg, #ffa14a 0%, #ff6b4a 46%, #ee3d5b 100%);
  border: 1px solid #e8494f;
  box-shadow: 0 3px 0 #c3303f, 0 7px 16px -8px rgba(238, 61, 91, .85);
  text-shadow: 0 1px 1px rgba(140, 22, 40, .35)
}

.tip-btn:hover {
  background: linear-gradient(135deg, #ff9333 0%, #ff5c3d 46%, #e5304f 100%)
}

.tip-btn:active {
  transform: translateY(1px);
  box-shadow: 0 2px 0 #c3303f
}

.tip-btn svg {
  width: 16px;
  height: 16px;
  fill: #fff;
  stroke: #fff;
  stroke-width: 1.6
}

/* ---------- 打赏弹窗 ---------- */
.tip-dialog {
  width: min(340px, calc(100vw - 24px))
}

.tip-dialog[open] {
  display: flex;
  flex-direction: column
}

.tip-body {
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 14px 16px 18px;
  overflow: auto
}

.tip-qr {
  display: block;
  width: 100%;
  max-width: 250px;
  height: auto;
  border: 0;
  border-radius: 8px;
  background: #fff;
  /* 🔴 长按菜单（识别 / 保存）依赖这三项：全局若有 user-select:none 或 callout:none 会直接压掉原生菜单 */
  -webkit-touch-callout: default;
  -webkit-user-select: auto;
  user-select: auto;
  pointer-events: auto;
  touch-action: manipulation
}

.tip-guide {
  margin: 0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
  line-height: 1.6;
  text-align: center
}

/* 小程序 web-view 环境：说清「只能保存」的原因，再给三步兜底 */
.tip-guide.is-warn {
  color: #a8480c;
  font-weight: 700
}

.tip-steps {
  display: grid;
  gap: 5px;
  margin: 0;
  padding: 9px 12px 9px 30px;
  border: 1px dashed #f0c9a8;
  border-radius: 10px;
  background: #fff6ee;
  color: #6b4224;
  font-size: 12.5px;
  line-height: 1.55
}

.tip-steps li {
  padding-left: 2px
}

.tip-steps li::marker {
  color: #e8703a;
  font-weight: 800
}

.tip-steps b {
  color: #b4520f
}

.tip-steps[hidden] {
  display: none
}

.tip-note {
  display: grid;
  gap: 7px
}

.tip-note p {
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.62;
  text-align: center
}

.tip-note .tip-strong {
  color: var(--ink);
  font-size: 14px;
  font-weight: 750
}

.tip-note .tip-thanks {
  color: var(--dark-purple);
  font-weight: 700
}

@media(max-width:700px) {
  .run-actions {
    gap: 7px
  }

  .tip-btn {
    padding: 6px 11px
  }

  .tip-dialog {
    width: calc(100vw - 20px);
    max-height: 92dvh
  }

  .tip-qr {
    max-width: 260px
  }

  .tip-steps {
    font-size: 12px
  }

  .tip-note p {
    font-size: 12px
  }
}

/* 矮屏（320×568 这类老机 / 横屏）：二维码缩到 180px 也不影响付款 ——
   走「保存到相册」时存的是 540px 原图，跟屏幕上的显示尺寸无关；缩小只为把整个弹窗塞进一屏。 */
@media(max-height:640px) {
  .tip-dialog {
    max-height: 94dvh
  }

  .tip-body {
    gap: 8px;
    padding: 12px 14px 14px
  }

  .tip-qr {
    max-width: 180px
  }

  .tip-guide {
    font-size: 12.5px;
    line-height: 1.5
  }

  .tip-steps {
    gap: 3px;
    padding: 8px 10px 8px 25px;
    font-size: 11.5px;
    line-height: 1.45
  }

  .tip-note {
    gap: 4px
  }

  .tip-note p {
    font-size: 11.5px;
    line-height: 1.5
  }

  .tip-note .tip-strong {
    font-size: 12.5px
  }
}

/* ---------- 输出尺寸：三档节点滑块（240 / 360 / 480） ---------- */
.size-slider {
  position: relative;
  display: flex;
  align-items: center;
  height: 30px
}

.size-slider::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 6px;
  margin-top: -3px;
  border-radius: 99px;
  background: #e8deee
}

.size-slider .size-dots {
  position: absolute;
  left: 9px;
  right: 9px;
  top: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0;
  padding: 0;
  pointer-events: none
}

.size-slider .size-dots i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #b3a0c6;
  transition: background .18s ease
}

.size-slider .size-dots i.on {
  background: var(--purple);
  box-shadow: 0 0 0 3px rgba(103, 68, 197, .14)
}

.size-slider input[type=range] {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 30px;
  margin: 0;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer
}

.size-slider input[type=range]::-webkit-slider-runnable-track {
  height: 6px;
  border: 0;
  border-radius: 99px;
  background: transparent
}

.size-slider input[type=range]::-moz-range-track {
  height: 6px;
  border: 0;
  border-radius: 99px;
  background: transparent
}

.size-slider input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  margin-top: -6px;
  border-radius: 50%;
  border: 0;
  background: var(--purple);
  box-shadow: 0 2px 4px rgba(103, 68, 197, .35)
}

.size-slider input[type=range]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 0;
  background: var(--purple);
  box-shadow: 0 2px 4px rgba(103, 68, 197, .35)
}

.size-ticks {
  display: flex;
  justify-content: space-between;
  margin: -1px 0 0;
  color: #9c8fa6;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .2px;
  line-height: 1.2
}

.size-ticks b {
  font-weight: 600;
  transition: color .18s ease
}

.size-ticks b.on {
  color: var(--purple)
}

@media(min-width:701px) {
  .size-slider,
  .size-slider input[type=range] {
    height: 36px
  }
}

@media(min-width:701px) and (max-height:825px) {
  .size-slider,
  .size-slider input[type=range] {
    height: 31px
  }
}

@media(min-width:701px) and (max-height:625px) {
  .size-slider,
  .size-slider input[type=range] {
    height: 24px
  }
}

/* 手机端给右下角浮动的「返回工具箱」留出净空：
   否则滚到底时打赏按钮正好被它压住 */
@media(max-width:700px) {
  .workbench {
    padding-bottom: max(78px, calc(env(safe-area-inset-bottom, 0px) + 72px))
  }
}

/* ---------- SEO / 无障碍：仅读屏与搜索引擎可见的主标题 ---------- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0
}


/* ---------- 顶栏「制作说明与常见问题」按钮 ---------- */
.masthead-inner {
  justify-content: space-between;
  gap: 12px
}

.guide-open {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 6px;
  padding: 6px 12px 6px 10px;
  border: 1px solid #e3d5f2;
  border-radius: 99px;
  background: #faf6ff;
  color: var(--purple);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background .18s ease, border-color .18s ease, box-shadow .18s ease
}

.guide-open svg {
  width: 15px;
  height: 15px;
  stroke-width: 2.1
}

.guide-open:hover {
  background: var(--lavender);
  border-color: #d2bdee
}

.guide-open:active {
  background: #f0e6ff
}

.guide-open:focus-visible {
  outline: 2px solid var(--purple);
  outline-offset: 2px
}

.guide-open__short {
  display: none
}

/* ---------- 说明抽屉：从屏幕右侧滑出 ---------- */
.guide-mask {
  position: fixed;
  inset: 0;
  z-index: 8999;
  background: rgba(37, 31, 45, .44);
  opacity: 0;
  visibility: hidden;
  transition: opacity .26s ease, visibility .26s
}

.guide {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 9000;
  display: flex;
  flex-direction: column;
  width: min(432px, 100vw);
  max-width: 100vw;
  background: var(--card);
  border-left: 1px solid var(--border);
  box-shadow: -18px 0 48px rgba(41, 35, 48, .2);
  transform: translate3d(102%, 0, 0);
  visibility: hidden;
  transition: transform .3s cubic-bezier(.32, .72, .24, 1), visibility .3s;
  will-change: transform
}

body.guide-lock .guide-mask {
  opacity: 1;
  visibility: visible
}

body.guide-lock .guide {
  transform: translate3d(0, 0, 0);
  visibility: visible
}

body.guide-lock {
  overflow: hidden
}

/* 抽屉打开时藏起右下角浮动的「返回工具箱」，避免压住关闭按钮 */
body.guide-lock .yyhub-back-wrap {
  opacity: 0 !important;
  pointer-events: none !important
}

@media(prefers-reduced-motion:reduce) {

  .guide,
  .guide-mask {
    transition: none
  }
}

.guide-head {
  display: flex;
  flex: none;
  align-items: center;
  gap: 10px;
  padding: 12px 12px 12px 18px;
  padding-top: calc(env(safe-area-inset-top, 0px) + 14px);
  border-bottom: 1px solid var(--border)
}

.guide-head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  color: var(--ink)
}

.guide-close {
  display: grid;
  flex: none;
  place-items: center;
  width: 34px;
  height: 34px;
  margin-left: auto;
  padding: 0;
  border: 1px solid #e6dcef;
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background .18s ease, border-color .18s ease
}

.guide-close svg {
  width: 17px;
  height: 17px
}

.guide-close:hover {
  background: var(--lavender);
  border-color: #d2bdee
}

.guide-close:focus-visible {
  outline: 2px solid var(--purple);
  outline-offset: 2px
}

.guide-body {
  flex: 1;
  min-height: 0;
  padding: 16px 18px calc(30px + env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  color: var(--muted);
  font-size: 13px
}

.guide-body .guide-lead {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.7
}

.guide-body h3 {
  margin: 16px 0 4px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700
}

.guide-body p {
  margin: 0;
  line-height: 1.85
}

.guide-links {
  margin-top: 16px !important;
  padding-top: 12px;
  border-top: 1px dashed var(--border)
}

.guide-links a {
  color: var(--purple);
  text-decoration: underline
}

/* 手机：抽屉接近全宽，按钮收成短文字 */
@media(max-width:700px) {
  .guide {
    width: min(100vw, 430px)
  }

  .guide-open {
    padding: 5px 10px;
    font-size: 12px
  }

  .guide-open__full {
    display: none
  }

  .guide-open__short {
    display: inline
  }

  .guide-body {
    padding-inline: 16px;
    font-size: 13.5px
  }
}
