* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif; background: linear-gradient(180deg, #FBE9E2 0%, #FFF8F0 100%); color: #4a3a2e; min-height: 100vh; display: flex; flex-direction: column; }
.topbar { background: rgba(255,248,240,.92); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid #F3E0D2; padding: 12px 24px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.brand-row { display: flex; align-items: center; gap: 9px; }
.brand-logo { width: 36px; height: 36px; border-radius: 12px; background: #fff; padding: 6px; box-shadow: 0 2px 10px rgba(255,120,90,.25); display: block; }
.brand { font-size: 22px; font-weight: 800; color: #FF5E62; }
.tagline { color: #B98A6A; font-size: 13px; }
main { flex: 1; padding: 28px; max-width: 1080px; width: 100%; margin: 0 auto; }
footer { text-align: center; color: #C9A58C; font-size: 12px; padding: 18px; line-height: 1.8; }


.uploadbar { display: flex; align-items: center; justify-content: center; gap: 14px; border: 2px dashed #EBC6AE; background: #FFF8F0; border-radius: 18px; padding: 30px 40px; cursor: pointer; transition: all .2s; box-shadow: 0 6px 24px rgba(255,120,90,.06); }
.uploadbar.dragging { border-color: #FF5E62; background: #FFEFE5; }
.ub-inner { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; justify-content: center; }
.ub-icon { font-size: 38px; }
.ub-title { font-size: 20px; color: #5A4A3A; }
.ub-hint { font-size: 15px; color: #B98A6A; }

.tpl-intro { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; background: linear-gradient(135deg,#FBEFE3,#FFF8F0); border: 1px solid #F3E0D2; border-radius: 16px; padding: 14px 18px; margin: 0 0 20px; }
.tpl-intro-main { display: flex; align-items: center; gap: 12px; }
.tpl-intro-icon { font-size: 30px; }
.tpl-intro h3 { font-size: 15px; font-weight: 800; color: #5A4A3A; }
.tpl-intro p { font-size: 12px; color: #B98A6A; margin-top: 3px; }

.tpl-intro-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tpl-dl { border: 1px solid #EBC6AE; background: #FFF8F0; color: #FF5E62; border-radius: 999px; padding: 7px 12px; font-size: 12px; font-weight: 700; cursor: pointer; }
.tpl-dl:hover { background: #FF5E62; color: #FFF8F0; border-color: #FF5E62; }
.tpl-intro-tag { background: #FF5E62; color: #FFF8F0; font-size: 12px; font-weight: 700; padding: 6px 12px; border-radius: 999px; white-space: nowrap; }
.tpl-covers { display: flex; gap: 12px; margin: 0 0 20px; flex-wrap: wrap; }
.tpl-cover { flex: 1; min-width: 170px; background: #FFF; border: 1px solid #F3E0D2; border-radius: 12px; overflow: hidden; cursor: pointer; transition: transform .15s, box-shadow .15s; }
.tpl-cover:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,.08); }
.tpl-cover img { width: 100%; display: block; aspect-ratio: 16/9; object-fit: cover; }
.tpl-cover span { display: block; text-align: center; font-size: 12px; font-weight: 700; color: #5A4A3A; padding: 7px; }

.dropzone { border: 2px dashed #EBC6AE; border-radius: 20px; background: #FFF8F0; padding: 56px 24px; text-align: center; cursor: pointer; transition: all .2s; box-shadow: 0 6px 24px rgba(255,120,90,.06); }
.dropzone.dragging { border-color: #FF5E62; background: #FFEFE5; }
.drop-icon { font-size: 48px; }
.drop-title { font-size: 18px; margin-top: 12px; color: #5A4A3A; }
.drop-hint { color: #B98A6A; font-size: 13px; margin-top: 6px; }
.link { color: #FF5E62; text-decoration: underline; cursor: pointer; }
.hidden { display: none !important; }

.work { display: grid; grid-template-columns: 1fr; gap: 20px; align-items: stretch; }
.panel { background: #FFF8F0; border-radius: 16px; padding: 18px; box-shadow: 0 6px 20px rgba(255,120,90,.08); border: 1px solid #F6E4D6; }
.preview-panel { display: flex; flex-direction: column; }
.preview-panel h3, .actions-panel h3 { font-size: 14px; color: #8A6A50; margin-bottom: 12px; }
.canvas-wrap { border: 1px solid #F3E0D2; border-radius: 12px; overflow: auto; max-height: 70vh; background: #fff; }
#preview-canvas { display: block; width: 100%; }
.preview-panel .canvas-wrap { flex: 1; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.actions-panel { width: auto; }
.btn-row { display: flex; gap: 8px; }
button { border: 1px solid #EBC6AE; background: #FFF8F0; border-radius: 10px; padding: 8px 12px; cursor: pointer; font-size: 14px; color: #5A4A3A; transition: all .15s; }
button:hover:not(:disabled) { border-color: #FF5E62; color: #FF5E62; }
button:disabled { opacity: .45; cursor: not-allowed; }
.gen-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }
.gen-row button.primary { margin-top: 0; font-size: 13px; padding: 8px 4px; }
button.primary { width: 100%; margin-top: 8px; background: linear-gradient(135deg,#FF5E62,#FF9A5A); color: #fff; border: none; font-weight: 700; box-shadow: 0 4px 14px rgba(255,94,98,.3); }
button.primary:hover:not(:disabled) { background: linear-gradient(135deg,#F04B50,#F98B4A); color: #fff; }
hr { border: none; border-top: 1px solid #F3E0D2; margin: 14px 0; }
.hint { font-size: 13px; color: #B98A6A; margin-top: 10px; min-height: 18px; word-break: break-all; }

.unlock-box { background: #FBEFE3; border: 1px solid #EBC6AE; border-radius: 12px; padding: 14px; margin-top: 0; min-width: 230px; }
.unlock-box h3 { font-size: 15px; font-weight: 700; color: #5A4A3A; margin-bottom: 10px; }
.unlock-box input { width: 100%; padding: 9px 10px; border: 1px solid #E5C9B2; border-radius: 8px; margin-bottom: 8px; font-size: 14px; box-sizing: border-box; background: #FFF8F0; }
.unlock-box.unlocked { border-color: #FF5E62; background: #FFEFE5; }
.unlock-box.unlocked input, .unlock-box.unlocked button { display: none; }
.cover-opts { margin-top: 10px; padding: 10px; background: #FBEFE3; border: 1px solid #EBC6AE; border-radius: 12px; }
.cover-opts label { font-size: 13px; color: #8A6A50; display: block; margin-bottom: 4px; }
.cover-opts select, .opt-select { width: 100%; padding: 8px; border: 1px solid #E5C9B2; border-radius: 8px; font-size: 14px; margin-bottom: 10px; box-sizing: border-box; background: #FFF8F0; color: #5A4A3A; }
.cover-opts select:last-of-type { margin-bottom: 0; }
/* ===== 移动端适配 ===== */
@media (max-width: 820px) {
  .topbar { padding: 12px 16px; flex-wrap: wrap; }
  .brand { font-size: 20px; }
  .tagline { font-size: 12px; }
  main { padding: 14px; }
  
.uploadbar { display: flex; align-items: center; justify-content: center; gap: 10px; border: 2px dashed #EBC6AE; background: #FFF8F0; border-radius: 16px; padding: 16px 20px; cursor: pointer; transition: all .2s; box-shadow: 0 6px 24px rgba(255,120,90,.06); }
.uploadbar.dragging { border-color: #FF5E62; background: #FFEFE5; }
.ub-inner { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center; }
.ub-icon { font-size: 22px; }
.ub-title { font-size: 15px; color: #5A4A3A; }
.ub-hint { font-size: 13px; color: #B98A6A; }

.tpl-intro { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; background: linear-gradient(135deg,#FBEFE3,#FFF8F0); border: 1px solid #F3E0D2; border-radius: 16px; padding: 14px 18px; margin: 0 0 20px; }
.tpl-intro-main { display: flex; align-items: center; gap: 12px; }
.tpl-intro-icon { font-size: 30px; }
.tpl-intro h3 { font-size: 15px; font-weight: 800; color: #5A4A3A; }
.tpl-intro p { font-size: 12px; color: #B98A6A; margin-top: 3px; }

.tpl-intro-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tpl-dl { border: 1px solid #EBC6AE; background: #FFF8F0; color: #FF5E62; border-radius: 999px; padding: 7px 12px; font-size: 12px; font-weight: 700; cursor: pointer; }
.tpl-dl:hover { background: #FF5E62; color: #FFF8F0; border-color: #FF5E62; }
.tpl-intro-tag { background: #FF5E62; color: #FFF8F0; font-size: 12px; font-weight: 700; padding: 6px 12px; border-radius: 999px; white-space: nowrap; }
.dropzone { padding: 44px 14px; }
  .drop-icon { font-size: 40px; }
  .drop-title { font-size: 16px; }
  .drop-hint { font-size: 12px; }
  .work { flex-direction: column; align-items: stretch; }
  .actions-panel { width: 100%; }
  .preview-panel { padding: 14px; }
  .actions-panel { padding: 14px; }
  .canvas-wrap { max-height: 56vh; }
  button { min-height: 46px; font-size: 15px; }
  .btn-row { flex-wrap: wrap; }
  .cover-opts select { font-size: 16px; }   /* 避免 iOS 聚焦缩放 */
  .unlock-box input { font-size: 16px; }
  .unlock-box { padding: 12px; }
  #cover-preview .canvas-wrap { max-height: none; }

.result-panel { margin-top: 20px; text-align: center; }
.act-groups { display: flex; flex-direction: column; gap: 14px; }
.act-group.cover-opts { background: #FBEFE3; border: 1px solid #EBC6AE; border-radius: 12px; padding: 10px; }
.result-panel h3 { text-align: left; }
.result-panel .canvas-wrap { max-height: 60vh; margin: 0 auto; }

}
.swatches { display: flex; gap: 8px; margin-bottom: 10px; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 3px solid #FFF8F0; box-shadow: 0 0 0 1px #EBC6AE; cursor: pointer; padding: 0; min-height: 0; }
.swatch.active { box-shadow: 0 0 0 2px #FF5E62; }
.opt-label { display: block; font-size: 13px; color: #8A6A50; margin: 10px 0 4px; }
/* ===== 移动端：禁止双击缩放 ===== */
* { touch-action: manipulation; -webkit-touch-callout: none; }
#save-modal { position: fixed; inset: 0; background: rgba(60,30,20,.9); z-index: 999; display: flex; align-items: center; justify-content: center; }
#save-modal .save-modal-box { background: #FFF8F0; border-radius: 16px; padding: 16px; max-width: 92vw; max-height: 88vh; overflow-y: auto; text-align: center; -webkit-overflow-scrolling: touch; }
#save-modal img { max-width: 85vw; height: auto; border-radius: 8px; -webkit-touch-callout: default; }
#save-modal p { margin: 10px 0; color: #5A4A3A; font-size: 14px; }
.unlock-box button { width: 100%; margin-top: 0; }
#save-modal button { width: 100%; min-height: 44px; }

/* 通用提示弹窗 */
#toast-modal { position: fixed; inset: 0; background: rgba(60,30,20,.55); z-index: 1000; display: flex; align-items: center; justify-content: center; }
#toast-modal .toast-box { background: #FFF8F0; border-radius: 18px; padding: 26px 28px; max-width: 86vw; width: 330px; text-align: center; box-shadow: 0 18px 48px rgba(120,50,20,.28); border: 1px solid #F3E0D2; }
#toast-modal .toast-icon { font-size: 42px; margin-bottom: 6px; }
#toast-modal h3 { font-size: 18px; font-weight: 800; color: #5A4A3A; margin: 6px 0 8px; }
#toast-modal p { font-size: 14px; color: #8A6A50; line-height: 1.7; word-break: break-word; }
#toast-modal button { margin-top: 18px; width: 100%; background: linear-gradient(135deg,#FF7A59,#FF5E62); color: #FFF; border: none; border-radius: 999px; padding: 12px; font-size: 15px; font-weight: 700; cursor: pointer; min-height: 44px; }
#toast-modal button:active { opacity: .85; }

/* ===== 桌面端：预览 | 结果并排，操作台下方一长条 ===== */
@media (min-width: 821px) {
  .work { grid-template-columns: 1fr 1fr; grid-template-rows: minmax(420px, 56vh); }
  .preview-panel { grid-column: 1; grid-row: 1; }
  #cover-preview.result-panel { grid-column: 2; grid-row: 1; margin-top: 0; align-self: stretch; }
  .actions-panel { grid-column: 1 / -1; grid-row: 2; }
  .actions-panel > h3 { display: none; }
  .act-groups { display: flex; flex-wrap: wrap; gap: 16px 26px; align-items: flex-start; }
  .act-group { flex: 1 1 180px; min-width: 170px; }
  .act-group.cover-opts { flex: 2 1 320px; min-width: 280px; }
  .act-group.gen-act { flex: 1 1 240px; min-width: 220px; }
  .actions-panel #status { width: 100%; }
  .result-panel .canvas-wrap { max-height: 60vh; }
}
.result-empty { color: #C9A58C; font-size: 13px; padding: 60px 12px; border: 2px dashed #EBC6AE; border-radius: 12px; margin-top: 10px; text-align: center; }
#cover-preview .canvas-wrap { min-height: 200px; }

.carousel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; margin-top: 10px; }
.card-cell { text-align: center; }
.card-img { width: 100%; border-radius: 10px; cursor: pointer; box-shadow: 0 4px 12px rgba(180,90,50,.15); display: block; }
.card-cap { font-size: 12px; color: #B98A6A; margin-top: 6px; }
.carousel-nav { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.nav-btn { border: 1px solid #EBC6AE; background: #FFF8F0; border-radius: 10px; padding: 8px 14px; cursor: pointer; font-size: 13px; color: #5A4A3A; }
.nav-btn:hover { border-color: #FF5E62; color: #FF5E62; }
.nav-btn.primary { background: linear-gradient(135deg,#FF5E62,#FF9A5A); color: #fff; border: none; font-weight: 700; }
.nav-info { font-size: 13px; color: #8A6A50; }
