/* 网页转应用 —— 移动端蓝白风格（优化版） */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { background: #eef1f5; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 15px; color: #2b2f36;
  max-width: 560px; margin: 0 auto;
  min-height: 100vh; min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

/* 顶栏 */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: linear-gradient(135deg, #2e7cf6, #1f6ae0);
  color: #fff; display: flex; align-items: center; justify-content: center;
  height: 52px; position: relative;
  box-shadow: 0 2px 10px rgba(46,124,246,.25);
}
.topbar-title { font-size: 18px; letter-spacing: 2px; font-weight: 600; }
.topbar-menu {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: none; border: 0; padding: 12px; cursor: pointer;
  display: flex; flex-direction: column; gap: 3px;
}
.topbar-menu span { width: 4px; height: 4px; border-radius: 50%; background: #fff; display: block; transition: transform .2s; }
.topbar-menu:active span { transform: scale(1.4); }

/* 分区标题 */
.group-title {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 16px 6px;
  font-size: 12px; font-weight: 600; color: #8a93a0; letter-spacing: .5px;
}
.group-title::before {
  content: ""; width: 3px; height: 13px; border-radius: 2px; background: #2e7cf6;
}

/* 卡片与表单 */
.card {
  background: #fff; padding: 16px;
  border-radius: 14px; margin: 0 10px;
  box-shadow: 0 1px 3px rgba(20,40,80,.05);
}
.divider { height: 10px; background: transparent; }
.form-row { display: flex; align-items: flex-start; margin-bottom: 16px; }
.form-row:last-child { margin-bottom: 0; }
.form-row > label {
  flex: 0 0 104px; padding-top: 11px; color: #6b7280; font-size: 14px;
}
.form-row .ctrl { flex: 1; min-width: 0; }

input[type="text"], input[type="number"], textarea {
  width: 100%; border: 1.5px solid #e2e6ec; border-radius: 10px;
  padding: 10px 12px; font-size: 14px; color: #2b2f36; background: #fafbfc;
  outline: none; transition: border-color .18s, box-shadow .18s, background .18s;
}
input::placeholder, textarea::placeholder { color: #aab1bd; }
input:focus, textarea:focus {
  border-color: #2e7cf6; background: #fff;
  box-shadow: 0 0 0 3px rgba(46,124,246,.12);
}
textarea { resize: vertical; line-height: 1.5; }
.unit { font-size: 12px; color: #aab1bd; margin-left: 8px; align-self: center; }

/* 图标 + 生成 */
.row-icon { display: flex; align-items: center; gap: 16px; padding: 18px; }
.icon-box {
  flex: 0 0 76px; height: 76px; border-radius: 16px; background: linear-gradient(135deg, #2e7cf6, #1f6ae0);
  display: flex; align-items: center; justify-content: center; overflow: hidden; cursor: pointer;
  box-shadow: 0 4px 12px rgba(46,124,246,.35); transition: transform .15s;
}
.icon-box:active { transform: scale(.94); }
.icon-box img { width: 100%; height: 100%; object-fit: cover; }
.btn-generate {
  flex: 1; height: 76px; border: 0; border-radius: 14px;
  background: linear-gradient(135deg, #2e7cf6, #1f6ae0); color: #fff;
  font-size: 18px; letter-spacing: 3px; cursor: pointer;
  box-shadow: 0 4px 14px rgba(46,124,246,.35); transition: transform .12s, opacity .12s;
}
.btn-generate:active { transform: scale(.98); opacity: .9; }
.btn-generate:disabled { opacity: .5; cursor: not-allowed; }

/* 大蓝按钮（手机版/竖屏/选择文件…） */
.btn-wide {
  width: 100%; height: 48px; border: 0; border-radius: 10px;
  background: #2e7cf6; color: #fff; font-size: 16px; cursor: pointer;
  transition: transform .12s, background .18s, box-shadow .18s;
}
.btn-wide:active { transform: scale(.98); background: #1f6ae0; }
.btn-mid {
  height: 44px; padding: 0 22px; border: 0; border-radius: 10px;
  background: #2e7cf6; color: #fff; font-size: 15px; cursor: pointer;
  transition: transform .12s, background .18s;
}
.btn-mid:active { transform: scale(.97); background: #1f6ae0; }
.btn-folder {
  flex: 0 0 52px; height: 48px; margin-left: 8px; border: 0; border-radius: 10px;
  background: #2e7cf6; display: flex; align-items: center; justify-content: center; cursor: pointer;
  transition: background .18s;
}
.btn-folder:active { background: #1f6ae0; }
.ctrl-with-btn { display: flex; align-items: center; }
.ctrl-with-btn input { flex: 1; }

/* 单选 / 复选 */
.radios { display: flex; gap: 18px; flex-wrap: wrap; padding-top: 9px; }
.radio, .check { display: inline-flex; align-items: center; gap: 8px; color: #4b5563; font-size: 14px; cursor: pointer; }
.radio input, .check input { display: none; }
.radio i, .check i {
  width: 20px; height: 20px; border: 1.5px solid #c3cad4; border-radius: 50%;
  background: #fff; position: relative; flex: 0 0 auto; transition: border-color .15s;
}
.check i { border-radius: 5px; }
.radio input:checked + i { border-color: #2e7cf6; box-shadow: inset 0 0 0 5px #2e7cf6; }
.check input:checked + i { background: #2e8b57; border-color: #2e8b57; }
.check input:checked + i::after {
  content: ""; position: absolute; left: 6px; top: 2px; width: 5px; height: 10px;
  border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.ctrl-inline { display: flex; align-items: center; gap: 14px; padding-top: 4px; }
.input-color {
  width: 132px; height: 44px; border: 1.5px solid #e2e6ec; border-radius: 10px;
  padding: 3px; background: #fafbfc; cursor: pointer; transition: border-color .18s;
}
.input-color:focus { border-color: #2e7cf6; }

/* 弹窗 */
.mask {
  position: fixed; inset: 0; z-index: 100; background: rgba(15,23,42,.5);
  display: flex; align-items: center; justify-content: center; padding: 22px;
  animation: fade .2s ease;
}
.mask[hidden] { display: none; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.dialog {
  background: #fff; border-radius: 18px; width: 100%; max-width: 480px;
  max-height: 84vh; display: flex; flex-direction: column; overflow: hidden;
  animation: pop .22s cubic-bezier(.2,.9,.3,1.2);
}
@keyframes pop { from { transform: scale(.92) translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }
.dialog-title { font-size: 17px; font-weight: 700; padding: 18px 20px 10px; color: #1f2937; }
.dialog-body { padding: 4px 20px 14px; overflow-y: auto; line-height: 1.7; }
.dialog-foot { display: flex; justify-content: flex-end; gap: 6px; padding: 10px 14px 14px; }
.dlg-btn {
  border: 0; background: none; color: #2e7cf6; font-size: 16px; padding: 10px 18px;
  cursor: pointer; border-radius: 10px; transition: background .15s;
}
.dlg-btn:active { background: #eef4ff; }
.dlg-btn.primary { font-weight: 600; }
.help-text p { margin-bottom: 11px; font-size: 13.5px; color: #3b4452; }

/* 统计 */
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat-item {
  background: linear-gradient(135deg, #f4f8ff, #eef3ff); border-radius: 12px;
  padding: 16px 8px; text-align: center; display: flex; flex-direction: column; gap: 5px;
}
.stat-item b { font-size: 24px; color: #2e7cf6; }
.stat-item span { font-size: 12px; color: #7b8593; }

/* 导航数据编辑 */
.nav-row { display: flex; gap: 8px; margin-bottom: 8px; }
.nav-row input[name="nv_name"] { flex: 0 0 34%; }
.nav-row input[name="nv_url"] { flex: 1; }
.nav-row .nav-del {
  flex: 0 0 42px; border: 0; border-radius: 8px; background: #ff4d4f; color: #fff;
  cursor: pointer; transition: opacity .15s;
}
.nav-row .nav-del:active { opacity: .8; }

/* 结果 */
.result-info { font-size: 13px; color: #7b8593; margin-bottom: 14px; }
.download-link { display: block; text-align: center; text-decoration: none; }
.err { color: #e64340; font-size: 14px; line-height: 1.6; }

/* 加载 */
.mask.loading { flex-direction: column; gap: 16px; color: #fff; font-size: 15px; }
.spinner {
  width: 44px; height: 44px; border-radius: 50%;
  border: 4px solid rgba(255,255,255,.3); border-top-color: #fff;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 12%; transform: translateX(-50%);
  background: rgba(15,23,42,.82); color: #fff; padding: 11px 20px; border-radius: 10px;
  font-size: 14px; z-index: 200; max-width: 80vw; text-align: center;
}
.toast[hidden] { display: none; }
