/* ============================================================
 * 网页转APP生成器 —— 样式
 * ============================================================ */
:root {
  --bg: #eef1f6;
  --card: #ffffff;
  --text: #16181d;
  --text-2: #4a5260;
  --muted: #8b93a1;
  --accent: #2979ff;
  --accent-soft: #eaf2ff;
  --line: #e5e9f0;
  --danger: #e5484d;
  --ok: #12a150;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", Roboto, sans-serif;
  overflow: hidden;
}

.hidden { display: none !important; }

/* ---------------- 布局 ---------------- */
.layout {
  display: flex;
  gap: 22px;
  padding: 22px;
  height: 100%;
  justify-content: center;
  align-items: stretch;
}

.phone-shell {
  width: 100%;
  max-width: 468px;
  background: var(--card);
  border-radius: 22px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(16, 24, 40, .05);
}

.side {
  width: 392px;
  flex: 0 0 392px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-right: 4px;
}

.side-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid rgba(16, 24, 40, .05);
  padding: 16px;
}

.side-card h2 {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ---------------- 顶栏 ---------------- */
.appbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(180%) blur(10px);
  flex: 0 0 auto;
  z-index: 5;
}

.appbar h1 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  flex: 1;
  text-align: center;
}

.top-actions { display: flex; gap: 4px; }

.icon-btn {
  border: 0;
  background: transparent;
  color: var(--text-2);
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  transition: background .15s;
}
.icon-btn:hover { background: #f1f3f8; }
.icon-btn.danger { color: var(--muted); font-size: 20px; }
.icon-btn.danger:hover { color: var(--danger); background: #fdecec; }

/* ---------------- 屏幕 ---------------- */
.screen {
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: #f7f8fb;
}

.screen-pad { padding: 18px 18px 40px; }

.hero {
  margin: 6px 0 20px;
  font-size: 22px;
  line-height: 1.35;
  font-weight: 700;
  text-align: center;
  letter-spacing: -.2px;
}

/* ---------------- 分段控件 ---------------- */
.seg {
  display: grid;
  gap: 4px;
  background: #eceff5;
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 18px;
}
.seg-2 { grid-template-columns: repeat(2, 1fr); }
.seg-4 { grid-template-columns: repeat(4, 1fr); }
.seg-tight { margin-bottom: 12px; background: #f1f3f8; }

.seg-item {
  border: 0;
  background: transparent;
  padding: 9px 6px;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  transition: all .15s;
  font-family: inherit;
}
.seg-item.active {
  background: #fff;
  color: var(--accent);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(16, 24, 40, .1);
}

/* ---------------- 表单 ---------------- */
.block { margin-bottom: 20px; transition: opacity .2s; }
.block.dim { opacity: .5; }

.label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  margin: 0 0 7px;
}
.label-sm {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  margin: 14px 0 6px;
}

.input {
  width: 100%;
  border: 1px solid var(--line);
  background: #fbfcfe;
  border-radius: 11px;
  padding: 11px 13px;
  font-size: 15px;
  font-family: inherit;
  color: var(--text);
  outline: none;
  transition: border-color .15s, background .15s, box-shadow .15s;
  margin-bottom: 14px;
}
.input:focus {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(41, 121, 255, .12);
}
.input-sm { font-size: 14px; padding: 10px 12px; margin-bottom: 0; }
.input-error { border-color: var(--danger); background: #fff8f8; }

.hint {
  font-size: 12.5px;
  color: var(--muted);
  margin: 7px 0 16px;
  line-height: 1.5;
}
.hint.no-margin { margin-bottom: 0; }
.hint-error { color: var(--danger); }

.input-row { display: flex; gap: 8px; align-items: flex-start; }
.input-row .input { flex: 1; margin-bottom: 0; }

.two-col { display: grid; grid-template-columns: 1fr 100px; gap: 10px; }

.color-row { display: grid; grid-template-columns: 52px 1fr; gap: 10px; align-items: center; }
.color-row input[type="color"] {
  width: 52px;
  height: 42px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  cursor: pointer;
}

/* ---------------- 按钮 ---------------- */
.btn {
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 11px 16px;
  font-size: 14.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all .15s;
  background: #f1f3f8;
  color: var(--text);
  white-space: nowrap;
}
.btn:hover { filter: brightness(.97); }
.btn:active { transform: scale(.985); }

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 14px rgba(41, 121, 255, .3);
}
.btn-primary:hover { filter: brightness(1.05); }

.btn-line {
  background: #fff;
  border-color: var(--line);
  color: var(--text-2);
}
.btn-line:hover { border-color: #d3d9e4; background: #fbfcfe; }

.btn-lg { width: 100%; padding: 14px; font-size: 15.5px; margin-bottom: 10px; }
.block-btn { width: 100%; }

.btn-mini { padding: 8px 12px; font-size: 13px; border-radius: 10px; }

.btn-ghost {
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 13.5px;
  font-weight: 600;
  padding: 11px 8px;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}

.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-row.gap { margin-bottom: 16px; }

.text-danger {
  border: 0;
  background: transparent;
  color: var(--danger);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 6px;
  font-family: inherit;
}

/* ---------------- 图标选择 ---------------- */
.icon-row {
  display: flex;
  gap: 14px;
  align-items: center;
  background: #fbfcfe;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 12px;
  margin-bottom: 4px;
}

.icon-preview {
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  border-radius: 14px;
  background: linear-gradient(135deg, #5b9cff, #2979ff);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: #fff;
}
.icon-preview.lg { width: 64px; height: 64px; flex-basis: 64px; border-radius: 17px; }
.icon-preview img { width: 100%; height: 100%; object-fit: cover; }

.icon-actions { display: flex; flex-direction: column; gap: 7px; flex: 1; }

.icon-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  max-height: 190px;
  overflow-y: auto;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfcfe;
}
.icon-cell {
  border: 1px solid transparent;
  background: #fff;
  border-radius: 10px;
  padding: 7px 2px 5px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  color: var(--text-2);
  font-size: 10px;
  font-family: inherit;
  transition: all .12s;
}
.icon-cell:hover { border-color: #d3d9e4; }
.icon-cell.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

/* ---------------- 开关 ---------------- */
.switch-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 0;
  border-top: 1px solid var(--line);
}
.switch-row:first-of-type { border-top: 0; }

.switch-text { flex: 1; }
.switch-text span { display: block; font-size: 14.5px; font-weight: 500; }
.switch-text small { display: block; font-size: 12.5px; color: var(--muted); line-height: 1.45; margin-top: 2px; }

.switch { position: relative; flex: 0 0 46px; width: 46px; height: 28px; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #d8dde6;
  transition: background .18s;
  cursor: pointer;
}
.slider::before {
  content: "";
  position: absolute;
  width: 22px;
  height: 22px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform .18s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
}
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider::before { transform: translateX(18px); }

/* ---------------- 卡片 / 页面卡 ---------------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  padding: 16px;
  margin-bottom: 16px;
}

.card-title { margin: 0 0 4px; font-size: 15.5px; font-weight: 650; }
.card-desc { margin: 0 0 6px; font-size: 12.5px; color: var(--muted); line-height: 1.5; }

.page-card {
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 13px;
  margin: 14px 0;
  background: #fcfdff;
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}
.page-name { font-size: 13.5px; font-weight: 650; color: var(--accent); }

/* ---------------- 文件 / KV ---------------- */
.file-chip {
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: relative;
  background: var(--accent-soft);
  border: 1px solid #cfe0ff;
  border-radius: 11px;
  padding: 10px 32px 10px 12px;
  margin-top: 10px;
}
.file-name { font-size: 13.5px; font-weight: 600; word-break: break-all; }
.file-meta { font-size: 12px; color: var(--muted); }
.file-chip .x {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  font-size: 20px;
  color: var(--muted);
  cursor: pointer;
  line-height: 1;
  padding: 4px 8px;
}

.kv {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
}
.kv:last-of-type { border-bottom: 0; }
.kv span { color: var(--muted); }
.kv b { font-weight: 600; text-align: right; word-break: break-all; }

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

.steps { margin: 6px 0 12px; padding-left: 20px; font-size: 13.5px; color: var(--text-2); }
.steps li { margin-bottom: 10px; line-height: 1.6; }
.steps.compact li { margin-bottom: 7px; }
.steps code, code {
  background: #f1f3f8;
  padding: 1.5px 6px;
  border-radius: 5px;
  font-size: 12.5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.small { font-size: 12.5px; }
.dim { color: var(--muted); }

/* ---------------- 项目列表 ---------------- */
.project-list { display: flex; flex-direction: column; gap: 8px; }

.project-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
  cursor: pointer;
  transition: all .15s;
}
.project-row:hover { border-color: #ccd6e6; background: #fbfcfe; }
.project-row.active { border-color: var(--accent); background: var(--accent-soft); }

.project-icon {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 11px;
  background: linear-gradient(135deg, #5b9cff, #2979ff);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: #fff;
}
.project-icon img { width: 100%; height: 100%; object-fit: cover; }

.project-meta { flex: 1; min-width: 0; }
.project-meta b { display: block; font-size: 14px; font-weight: 600; }
.project-meta small { display: block; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.empty { text-align: center; color: var(--muted); font-size: 13.5px; padding: 30px 0; }

/* ---------------- 手机预览 ---------------- */
.preview-slot { display: flex; flex-direction: column; align-items: center; }
.preview-slot:empty::after {
  content: "暂无预览";
  color: var(--muted);
  font-size: 13px;
  padding: 30px 0;
}

.phone {
  width: 100%;
  max-width: 300px;
  aspect-ratio: 300 / 590;
  background: #fff;
  border-radius: 26px;
  border: 9px solid #1c1f26;
  box-shadow: 0 12px 30px rgba(16, 24, 40, .18);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
}
.phone.dark { background: #0f0f0f; border-color: #05070a; }

.pv-status {
  flex: 0 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 14px 5px;
  font-size: 11px;
  font-weight: 600;
  color: #16181d;
  background: #fff;
}
.phone.dark .pv-status { color: #f2f3f5; background: #0f0f0f; }
.pv-status-right { display: inline-flex; align-items: center; gap: 2.5px; }
.pv-status-right .bar {
  display: inline-block;
  width: 3px;
  border-radius: 1px;
  background: currentColor;
  opacity: .85;
}
.pv-status-right .bar:nth-child(1) { height: 4px; }
.pv-status-right .bar:nth-child(2) { height: 6px; }
.pv-status-right .bar:nth-child(3) { height: 8px; }
.pv-status-right .bar:nth-child(4) { height: 10px; }
.pv-status-right b { margin-left: 4px; font-weight: 600; }

.pv-body { flex: 1 1 auto; position: relative; overflow: hidden; background: #fff; }
.phone.dark .pv-body { background: #0f0f0f; }

.pv-frame { width: 100%; height: 100%; border: 0; display: block; }

.pv-overlay {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 10px 12px;
  background: linear-gradient(to top, rgba(255, 255, 255, .97), rgba(255, 255, 255, .82));
  text-align: center;
  font-size: 11.5px;
  color: var(--muted);
  pointer-events: auto;
}
.phone.dark .pv-overlay { background: linear-gradient(to top, rgba(15, 15, 15, .97), rgba(15, 15, 15, .8)); }
.pv-overlay p { margin: 0; font-weight: 600; color: var(--text-2); font-size: 12px; }
.phone.dark .pv-overlay p { color: #cfd3da; }
.pv-overlay small { display: block; margin: 2px 0 4px; }
.pv-overlay a { color: var(--accent); text-decoration: none; font-weight: 600; }

.pv-blank {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 20px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}
.phone.dark .pv-blank { color: #8b93a1; }
.pv-blank b { font-size: 14px; color: var(--text-2); }
.phone.dark .pv-blank b { color: #e6e8ec; }
.pv-blank .dim { opacity: .7; font-size: 11px; }

.pv-nav {
  flex: 0 0 auto;
  display: flex;
  background: #fff;
  border-top: 1px solid var(--line);
}
.phone.dark .pv-nav { background: #141414; border-top-color: #262626; }
.pv-nav.edge {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  background: rgba(255, 255, 255, .93);
  backdrop-filter: blur(8px);
  border-top: 0;
}
.phone.dark .pv-nav.edge { background: rgba(20, 20, 20, .93); }

.pv-nav-item {
  flex: 1;
  border: 0;
  background: transparent;
  padding: 7px 2px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  font-size: 10px;
  color: #8a8a8a;
  cursor: pointer;
  font-family: inherit;
}
.pv-nav-item.active { color: var(--accent); font-weight: 600; }

.pv-note {
  font-size: 11.5px;
  color: var(--muted);
  text-align: center;
  margin: 10px 0 0;
  line-height: 1.5;
}

/* ---------------- 弹层 ---------------- */
.sheet {
  position: fixed;
  inset: 0;
  background: rgba(12, 16, 24, .48);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
  z-index: 100;
}
.sheet.open { opacity: 1; pointer-events: auto; }

.sheet-box {
  background: #fff;
  border-radius: 20px;
  padding: 22px;
  width: 100%;
  max-width: 420px;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: 0 24px 60px rgba(16, 24, 40, .3);
  transform: translateY(10px) scale(.98);
  transition: transform .2s;
}
.sheet.open .sheet-box { transform: none; }

.sheet-box h3 { margin: 0 0 6px; font-size: 17px; }

/* 打包进度 */
.build-box { text-align: center; }
.build-box h3 { margin-bottom: 16px; }
.progress-track {
  height: 8px;
  background: #eceff5;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 10px;
}
.progress-bar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #5b9cff, #2979ff);
  border-radius: 999px;
  transition: width .25s;
}
.build-line { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); }

.result-head { text-align: center; margin-bottom: 14px; }
.result-ok {
  width: 52px; height: 52px;
  margin: 0 auto 10px;
  border-radius: 50%;
  background: #e8f8ee;
  color: var(--ok);
  font-size: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.result-head h3 { margin: 0 0 4px; }

/* ---------------- Toast ---------------- */
#toasts {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  z-index: 200;
  pointer-events: none;
}
.toast {
  background: rgba(22, 24, 29, .94);
  color: #fff;
  font-size: 13.5px;
  padding: 10px 18px;
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .22);
  max-width: 84vw;
  text-align: center;
  animation: toast-in .22s ease;
}
.toast.out { opacity: 0; transform: translateY(8px); transition: all .4s; }
.toast-ok { background: rgba(16, 138, 76, .95); }
.toast-error { background: rgba(198, 45, 50, .95); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

/* ---------------- 响应式 ---------------- */
@media (max-width: 1080px) {
  .side { width: 340px; flex-basis: 340px; }
}

@media (max-width: 900px) {
  body { overflow: auto; }
  .layout { padding: 0; gap: 0; height: 100%; }
  .phone-shell {
    max-width: none;
    border-radius: 0;
    box-shadow: none;
    border: 0;
    height: 100%;
  }
  .side { display: none; }
  .sheet-box { border-radius: 18px; }
}

/* ============================================================
 * 卡密激活遮罩（未授权时全屏拦截）
 * ============================================================ */
.lock {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: linear-gradient(160deg, #eef3ff 0%, #f7f8fb 45%, #e9effa 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 26px 22px;
  overflow-y: auto;
}
.lock.hidden { display: none; }

.lock-inner { width: 100%; max-width: 404px; text-align: center; padding: 10px 0; }

.lock-logo {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  border-radius: 19px;
  background: linear-gradient(135deg, #5b9cff, #1c5fd6);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 26px rgba(41, 121, 255, .32);
}

.lock-title { font-size: 22px; margin: 0 0 7px; letter-spacing: -.2px; }
.lock-sub { color: var(--muted); font-size: 13.5px; margin: 0 0 22px; }

.lock-form { display: flex; flex-direction: column; gap: 10px; }

.lock-input {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 13px;
  padding: 15px 16px;
  font-size: 17px;
  letter-spacing: 2px;
  text-align: center;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  text-transform: uppercase;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.lock-input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(41, 121, 255, .13); }
.lock-input.error { border-color: var(--danger); background: #fff8f8; }

.lock-msg { min-height: 20px; margin: 12px 0 0; font-size: 13px; color: var(--danger); line-height: 1.5; }
.lock-msg.ok { color: var(--ok); }

.lock-tiers { margin-top: 26px; display: flex; flex-direction: column; gap: 8px; text-align: left; }
.lock-tier {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 14px;
  font-size: 13px;
}
.lock-tier b { font-size: 13.5px; }
.lock-tier .tier-meta { margin-left: auto; color: var(--muted); font-size: 12px; text-align: right; line-height: 1.45; }
.lock-tier .tier-price { color: #e8590c; font-weight: 700; font-size: 14px; }

.lock-foot { margin-top: 26px; font-size: 12px; color: var(--muted); line-height: 1.75; }

/* 顶栏授权徽标 */
.quota-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.quota-badge.low { background: #fff1f0; color: #e5484d; }

/* 授权信息弹层 */
.auth-rows { margin: 4px 0 16px; }
