/* 请柬工作室 · 白底浅色主题 · 自包含无 CDN */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: #f5f6f8;
  color: #1f2329;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; }
input { font-family: inherit; }

/* ── 登录门 ─────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
}
.login-card {
  width: 100%; max-width: 340px; background: #fff; border-radius: 16px;
  box-shadow: 0 8px 30px rgba(0,0,0,.08); padding: 36px 28px; text-align: center;
}
.login-logo { font-size: 40px; margin-bottom: 8px; }
.login-card h1 { font-size: 20px; margin: 0 0 4px; font-weight: 600; }
.login-sub { color: #8a9099; margin: 0 0 22px; font-size: 13px; }
.login-card input {
  width: 100%; padding: 12px 14px; border: 1px solid #dcdfe6; border-radius: 10px;
  font-size: 15px; margin-bottom: 14px; outline: none; transition: border-color .15s;
}
.login-card input:focus { border-color: #1a73e8; }
.login-card button {
  width: 100%; padding: 12px; border: none; border-radius: 10px;
  background: #1a73e8; color: #fff; font-size: 15px; font-weight: 600; transition: opacity .15s;
}
.login-card button:disabled { opacity: .6; cursor: default; }
.login-err { color: #e34d59; font-size: 13px; min-height: 18px; margin-top: 10px; }

/* ── 音乐图标设置条 ─────────────────────────────────── */
.icon-setting { display: flex; align-items: center; gap: 10px; margin: 14px 2px 0; font-size: 13px; color: #5a6169; }
.is-preview { width: 34px; height: 34px; border-radius: 50%; background: #f2f3f5; border: 1px solid #eaecef; }
.btn-mini { padding: 5px 10px; border: 1px solid #dcdfe6; background: #fff; border-radius: 8px; font-size: 12px; color: #4a5058; cursor: pointer; }
.btn-mini:hover { border-color: #1a73e8; color: #1a73e8; }

/* ── 顶栏 ───────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 10; background: #fff; border-bottom: 1px solid #eaecef;
  display: flex; align-items: center; gap: 16px; padding: 0 18px; height: 54px;
}
.brand { font-weight: 700; font-size: 16px; white-space: nowrap; }
.tabs { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.tab {
  border: none; background: transparent; padding: 8px 14px; border-radius: 8px;
  color: #5a6169; font-size: 14px; white-space: nowrap;
  display: inline-flex; align-items: center; text-decoration: none;
}
.tab:hover { background: #f2f3f5; }
.tab.active { background: #fdeef2; color: #e8567a; font-weight: 600; }
.logout { border: 1px solid #dcdfe6; background: #fff; color: #5a6169; padding: 6px 14px; border-radius: 8px; }
.logout:hover { border-color: #e8567a; color: #e8567a; }

/* ── 面板 ───────────────────────────────────────────── */
main { max-width: 900px; margin: 0 auto; padding: 20px 18px 60px; }
.panel { display: none; }
.panel.active { display: block; }

/* ── 拖拽区 ─────────────────────────────────────────── */
.dropzone {
  border: 2px dashed #d0d4da; border-radius: 14px; background: #fff;
  padding: 34px 20px; text-align: center; transition: all .15s; outline: none;
}
.dropzone:hover, .dropzone:focus { border-color: #e8567a; background: #fffafb; }
.dropzone.dragover { border-color: #e8567a; background: #fdeef2; }
.dz-icon { font-size: 34px; margin-bottom: 8px; }
.dz-title { font-size: 15px; font-weight: 500; }
.dz-link { color: #e8567a; }
.dz-hint { color: #9096a0; font-size: 12px; margin-top: 8px; line-height: 1.7; }

/* ── 卡片 ───────────────────────────────────────────── */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; margin-top: 16px; }
.card {
  background: #fff; border: 1px solid #eaecef; border-radius: 12px; overflow: hidden;
  display: flex; flex-direction: column;
}
.card-thumb {
  height: 150px; background: #f2f3f5 center/contain no-repeat; position: relative;
}
.card-remove {
  position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border-radius: 50%;
  border: none; background: rgba(0,0,0,.5); color: #fff; font-size: 15px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.card-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 8px; }
.card-meta { font-size: 12px; color: #9096a0; }
.card-body label { font-size: 12px; color: #5a6169; display: block; margin-bottom: 3px; }
.card-body input[type=text], .card-body select {
  width: 100%; padding: 7px 9px; border: 1px solid #dcdfe6; border-radius: 8px; font-size: 13px; outline: none;
}
.card-body input[type=text]:focus, .card-body select:focus { border-color: #e8567a; }
.dur-row { display: flex; align-items: center; gap: 8px; }
.dur-row input[type=range] { flex: 1; accent-color: #e8567a; }
.dur-val { font-size: 12px; color: #5a6169; min-width: 52px; text-align: right; }
.card-status { font-size: 12px; }
.card-status.ok { color: #18a058; }
.card-status.err { color: #e34d59; }
.card.invalid { opacity: .65; }

/* ── 操作栏 ─────────────────────────────────────────── */
.actionbar {
  position: sticky; bottom: 0; margin-top: 18px; background: #fff; border: 1px solid #eaecef;
  border-radius: 12px; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  box-shadow: 0 -2px 12px rgba(0,0,0,.04);
}
.ab-info { font-size: 13px; color: #5a6169; }
.ab-actions { display: flex; align-items: center; gap: 8px; }
.server-render-entry { display: none !important; }
.btn-secondary {
  border: 1px solid #e8567a; background: #fff; color: #e8567a; font-weight: 600; font-size: 14px;
  padding: 9px 18px; border-radius: 10px; transition: background .15s, opacity .15s;
}
.btn-secondary:hover { background: #fff3f6; }
.btn-secondary:disabled { opacity: .55; cursor: default; }
.btn-primary {
  border: none; background: #e8567a; color: #fff; font-weight: 600; font-size: 14px;
  padding: 10px 22px; border-radius: 10px; transition: opacity .15s;
}
.btn-primary:disabled { opacity: .55; cursor: default; }
.local-render-tip { margin: 8px 4px 0; color: #c26a00; font-size: 12px; line-height: 1.6; }
.local-render-modal {
  position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center;
  padding: 20px; background: rgba(20, 24, 30, .48);
}
.local-render-dialog { width: min(100%, 390px); padding: 24px; border-radius: 16px; background: #fff; box-shadow: 0 16px 44px rgba(0,0,0,.2); text-align: center; }
.local-render-icon { font-size: 36px; }
.local-render-dialog h2 { margin: 8px 0 6px; font-size: 18px; }
.local-render-dialog p { margin: 0; color: #5a6169; font-size: 13px; line-height: 1.7; }
.local-render-status { min-height: 20px; margin-top: 12px !important; color: #e8567a !important; font-weight: 600; }
.local-render-cancel { margin-top: 16px; padding: 8px 20px; border: 1px solid #dcdfe6; border-radius: 8px; background: #fff; color: #5a6169; }

/* ── 任务列表 ───────────────────────────────────────── */
.jobs { margin-top: 22px; display: flex; flex-direction: column; gap: 10px; }
.job {
  background: #fff; border: 1px solid #eaecef; border-radius: 10px; padding: 12px 14px;
  display: flex; align-items: center; gap: 14px;
}
.job-main { flex: 1; min-width: 0; }
.job-title { font-size: 13px; font-weight: 500; }
.job-sub { font-size: 12px; color: #9096a0; margin-top: 2px; }
.bar { height: 6px; background: #eef0f2; border-radius: 4px; overflow: hidden; margin-top: 8px; }
.bar > i { display: block; height: 100%; width: 0; background: #e8567a; transition: width .4s; }
.chip { font-size: 12px; padding: 3px 9px; border-radius: 20px; white-space: nowrap; }
.chip.queued { background: #f2f3f5; color: #8a9099; }
.chip.running { background: #fff4e6; color: #d98a00; }
.chip.done { background: #e8f7ee; color: #18a058; }
.chip.error { background: #fdeceb; color: #e34d59; }
.job .dl {
  border: none; background: #18a058; color: #fff; padding: 7px 16px; border-radius: 8px;
  font-size: 13px; font-weight: 600; text-decoration: none; white-space: nowrap;
}
.job .dl:hover { opacity: .9; }

/* ── iframe / 占位 ──────────────────────────────────── */
.invitation-video-frame, .moments-frame, .ins-frame, .memo-frame { display: block; width: 100%; height: 70vh; border: 1px solid #eaecef; border-radius: 12px; background: #fff; }
body.immersive-tab { overflow: hidden; }
body.immersive-tab main { max-width: none; height: calc(100dvh - 54px); margin: 0; padding: 0; }
body.immersive-tab #tabInvitationVideo, body.immersive-tab #tab2, body.immersive-tab #tabIns, body.immersive-tab #tab3 { height: 100%; }
body.immersive-tab .invitation-video-frame, body.immersive-tab .moments-frame, body.immersive-tab .ins-frame, body.immersive-tab .memo-frame { height: 100%; border: none; border-radius: 0; }

/* ── 头像库管理 ─────────────────────────────────────────────── */
.avatar-manager { background: #fff; border: 1px solid #eaecef; border-radius: 14px; padding: 20px; }
.avatar-manager-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.avatar-manager h1 { margin: 0; font-size: 20px; line-height: 1.35; }
.avatar-manager-head p { margin: 6px 0 0; color: #7a818a; font-size: 13px; }
.avatar-manager-add { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.avatar-manager-clear { color: #e34d59; border-color: #f4c9cc; white-space: nowrap; }
.avatar-manager-clear:hover { color: #fff; border-color: #e34d59; background: #e34d59; }
.avatar-manager-label, .avatar-manager-toolbar input {
  min-width: 0; padding: 9px 10px; border: 1px solid #dcdfe6; border-radius: 8px; outline: none; font-size: 13px;
}
.avatar-manager-label { width: 168px; }
.avatar-manager-label:focus, .avatar-manager-toolbar input:focus { border-color: #e8567a; }
.avatar-manager-add .btn-primary { padding: 9px 14px; font-size: 13px; white-space: nowrap; }
.avatar-manager-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 20px 0 14px; }
.avatar-manager-toolbar input { width: min(280px, 100%); }
#avatarManagerCount { color: #9096a0; font-size: 12px; white-space: nowrap; }
.avatar-manager-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.avatar-manager-card { position: relative; border: 1px solid #e5e7eb; border-radius: 10px; overflow: hidden; background: #fff; }
.avatar-manager-card.is-default { border-color: #e8567a; box-shadow: 0 0 0 1px #fde0e8; }
.avatar-manager-image { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; background: #f2f3f5; }
.avatar-manager-default { position: absolute; top: 7px; left: 7px; padding: 2px 6px; border-radius: 20px; background: #e8567a; color: #fff; font-size: 11px; }
.avatar-manager-card-body { padding: 8px; }
.avatar-manager-name { overflow: hidden; color: #3b4047; font-size: 13px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.avatar-manager-kind { margin-top: 1px; color: #9298a1; font-size: 11px; }
.avatar-manager-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; margin-top: 8px; }
.avatar-manager-actions button { min-width: 0; padding: 5px 4px; border: 1px solid #dcdfe6; border-radius: 6px; background: #fff; color: #5a6169; font-size: 11px; white-space: nowrap; }
.avatar-manager-actions button:hover { border-color: #e8567a; color: #e8567a; }
.avatar-manager-actions .avatar-delete:hover { border-color: #e34d59; color: #e34d59; }
.avatar-manager-empty { padding: 52px 20px; color: #9096a0; text-align: center; }
.avatar-manager-pagination { display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 42px; margin-top: 12px; color: #7a818a; font-size: 12px; }
.avatar-manager-pagination button:disabled { opacity: .45; cursor: default; }
.avatar-manager-status { min-height: 20px; margin: 0; color: #69707a; font-size: 12px; text-align: center; }
.placeholder { text-align: center; padding: 80px 20px; color: #9096a0; }
.ph-icon { font-size: 44px; }
.ph-title { font-size: 18px; font-weight: 600; color: #5a6169; margin-top: 10px; }
.ph-sub { font-size: 13px; margin-top: 6px; }

@media (max-width: 560px) {
  .brand { display: none; }
  .cards { grid-template-columns: 1fr 1fr; }
  .actionbar { align-items: flex-start; flex-direction: column; }
  .ab-actions { width: 100%; }
  .ab-actions button { flex: 1; }
  .avatar-manager { padding: 14px; }
  .avatar-manager-head, .avatar-manager-add { align-items: stretch; flex-direction: column; }
  .avatar-manager-add { width: 100%; }
  .avatar-manager-label { width: 100%; }
  .avatar-manager-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
}
