/* ========== Reset & 基础 ========== */
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: #F6F8FA;
  color: #1F2937;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; }
.hidden { display: none !important; }

/* ========== 顶栏 ========== */
.top {
  background: linear-gradient(135deg, #0EA5A4 0%, #0891B2 100%);
  color: #fff;
  padding: 14px 20px;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px;
  box-shadow: 0 2px 8px rgba(14, 165, 164, 0.15);
}
.brand { display: flex; align-items: baseline; gap: 10px; }
.logo {
  font-size: 22px; font-weight: 800; letter-spacing: 1px;
  background: rgba(255,255,255,.18);
  padding: 4px 12px; border-radius: 6px;
}
.tagline { font-size: 13px; opacity: .92; }
.card-area { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.card-input {
  height: 38px; width: 220px; padding: 0 12px;
  border: none; border-radius: 6px;
  background: rgba(255,255,255,.95); color: #0F172A;
  font-family: ui-monospace, "SFMono-Regular", monospace;
  font-size: 14px; letter-spacing: 1.5px;
  text-transform: uppercase;
}
.card-input:focus { outline: 2px solid #FBBF24; }
.quota-tag {
  font-size: 13px; padding: 4px 10px; border-radius: 12px;
  background: rgba(34, 197, 94, 0.18); color: #DCFCE7;
  border: 1px solid rgba(187, 247, 208, 0.4);
}

/* ========== 通用按钮 ========== */
.btn {
  height: 38px; padding: 0 18px; border-radius: 6px;
  font-size: 14px; font-weight: 600;
  border: none; transition: all .15s;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary {
  background: #FBBF24; color: #78350F;
}
.btn-primary:hover:not(:disabled) { background: #F59E0B; }
.btn-outline {
  background: #fff; color: #0EA5A4; border: 1.5px solid #0EA5A4;
}
.btn-outline:hover:not(:disabled) { background: #ECFEFF; }
.btn-ghost {
  background: transparent; color: #64748B; border: 1px solid #CBD5E1;
}
.btn-ghost:hover:not(:disabled) { background: #F1F5F9; }
.btn-generate {
  width: 100%; height: 56px; font-size: 17px;
  background: linear-gradient(135deg, #0EA5A4 0%, #0891B2 100%);
  color: #fff; border-radius: 10px; margin: 8px 0 16px;
  box-shadow: 0 4px 12px rgba(14,165,164,.3);
}
.btn-generate:disabled {
  background: #CBD5E1; box-shadow: none;
}

/* ========== 主体页面 ========== */
.page {
  max-width: 880px;
  margin: 24px auto;
  padding: 0 16px 80px;
}

.step-card {
  background: #fff;
  border-radius: 14px;
  padding: 22px 22px 24px;
  margin-bottom: 18px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
}
.step-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.step-num {
  width: 30px; height: 30px; border-radius: 50%;
  background: #0EA5A4; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px;
}
.step-head h2 { margin: 0; font-size: 17px; font-weight: 600; }

/* ========== 上传区 ========== */
.dropzone {
  border: 2px dashed #CBD5E1;
  border-radius: 12px;
  min-height: 220px;
  position: relative;
  cursor: pointer;
  transition: all .2s;
  background: #FAFBFC;
  overflow: hidden;
}
.dropzone:hover, .dropzone.drag-over {
  border-color: #0EA5A4;
  background: #ECFEFF;
}
.dropzone-empty {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; color: #64748B;
}
.dz-icon { font-size: 38px; }
.dz-text { font-size: 15px; font-weight: 500; }
.dz-hint { font-size: 12px; color: #94A3B8; }
.dz-preview {
  width: 100%; max-height: 360px; object-fit: contain;
  display: block;
}
.btn-clear {
  position: absolute; top: 8px; right: 8px;
  width: 30px; height: 30px; border-radius: 50%;
  background: rgba(15, 23, 42, .65); color: #fff; border: none;
  font-size: 18px; line-height: 28px; padding: 0;
}

/* ========== 项目两级菜单 ========== */
.cat-tabs {
  display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px;
  border-bottom: 1px solid #E2E8F0; padding-bottom: 12px;
}
.cat-btn {
  padding: 8px 16px; border-radius: 6px;
  background: #F1F5F9; color: #475569; border: none;
  font-size: 14px; font-weight: 500;
}
.cat-btn:hover { background: #E2E8F0; }
.cat-btn.active {
  background: #0EA5A4; color: #fff;
}
.cat-btn .cat-desc { font-size: 11px; opacity: .8; margin-left: 6px; }

.proj-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
}
.proj-btn {
  padding: 12px 10px; border-radius: 8px;
  background: #F8FAFC; border: 1.5px solid #E2E8F0;
  color: #334155; font-size: 13px; text-align: center;
  transition: all .15s;
}
.proj-btn:hover { border-color: #0EA5A4; background: #ECFEFF; }
.proj-btn.active {
  border-color: #0EA5A4; background: #0EA5A4; color: #fff;
  box-shadow: 0 2px 6px rgba(14,165,164,.3);
}
.picked-line {
  margin-top: 14px; font-size: 13px; color: #64748B;
}
.picked-line strong { color: #0F766E; }

/* ========== 效果程度滑块 ========== */
.slider-row {
  display: flex; align-items: center; gap: 12px;
}
.lvl-min, .lvl-max {
  font-size: 12px; color: #64748B; white-space: nowrap;
}
.lvl-slider {
  flex: 1; height: 6px;
  -webkit-appearance: none; appearance: none;
  background: linear-gradient(to right, #94D5D4 0%, #0EA5A4 100%);
  border-radius: 3px; outline: none;
}
.lvl-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px; height: 22px; border-radius: 50%;
  background: #fff; border: 3px solid #0EA5A4;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(14,165,164,.3);
}
.lvl-slider::-moz-range-thumb {
  width: 22px; height: 22px; border-radius: 50%;
  background: #fff; border: 3px solid #0EA5A4;
  cursor: pointer;
}
.lvl-display {
  margin-top: 14px; font-size: 14px; color: #334155;
}
.lvl-display strong {
  font-size: 22px; color: #0EA5A4; margin: 0 4px;
}
.lvl-desc { color: #64748B; margin-left: 8px; font-size: 13px; }

/* ========== 免责声明 ========== */
.disclaimer {
  background: #FEF3C7;
  border: 1px solid #FCD34D;
  color: #78350F;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.6;
  margin-bottom: 16px;
}
.disclaimer strong { color: #92400E; margin-right: 6px; }

/* ========== Loading ========== */
.loading-box {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  padding: 24px; background: #fff; border-radius: 10px;
  margin-bottom: 16px;
}
.spinner {
  width: 28px; height: 28px; border-radius: 50%;
  border: 3px solid #E0F2F1; border-top-color: #0EA5A4;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { color: #64748B; font-size: 14px; }

/* ========== 模式切换 ========== */
.compare-modes {
  display: inline-flex; gap: 4px;
  background: #F1F5F9;
  padding: 4px;
  border-radius: 8px;
  margin-bottom: 16px;
}
.mode-btn {
  padding: 8px 18px;
  border: none;
  background: transparent;
  color: #64748B;
  font-size: 14px;
  font-weight: 500;
  border-radius: 6px;
  transition: all .15s;
}
.mode-btn:hover { color: #0EA5A4; }
.mode-btn.active {
  background: #fff;
  color: #0EA5A4;
  box-shadow: 0 1px 3px rgba(15,23,42,.08);
}

/* ========== 左右并排（默认模式） ========== */
.side-by-side {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.sbs-card {
  position: relative;
  background: #0F172A;
  border-radius: 10px;
  overflow: hidden;
}
.sbs-card img {
  display: block;
  width: 100%;
  max-height: 520px;
  object-fit: contain;
  background: #0F172A;
}
.sbs-label {
  position: absolute;
  top: 10px; left: 10px;
  background: rgba(15,23,42,.75);
  color: #fff;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 4px;
  z-index: 2;
  letter-spacing: .5px;
}
.sbs-label-after {
  background: rgba(14,165,164,.85);
}
.watermark-corner {
  position: absolute;
  bottom: 8px; right: 8px;
  background: rgba(15,23,42,.65);
  color: #fff;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  z-index: 2;
}

/* ========== 对比结果（滑动模式） ========== */
.compare-box {
  position: relative; width: 100%;
  max-height: 600px;
  border-radius: 10px; overflow: hidden;
  background: #0F172A;
  user-select: none;
  touch-action: none;
}
.compare-img {
  display: block; width: 100%; height: auto;
}
.compare-after {
  width: 100%; max-height: 600px; object-fit: contain;
  background: #0F172A;
}
.compare-frame {
  position: absolute; inset: 0;
  width: 50%;
  overflow: hidden;
}
.compare-before {
  width: 200%; max-width: none; max-height: 600px; object-fit: contain;
}
/* 让 before 与 after 对齐 */
.compare-frame .compare-before {
  width: calc(100% / 0.5); /* will be controlled by JS via width and image natural */
}
.compare-handle {
  position: absolute; top: 0; bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 40px;
  display: flex; align-items: center; justify-content: center;
  cursor: ew-resize;
  z-index: 5;
}
.handle-line {
  position: absolute; top: 0; bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 3px; background: #fff;
  box-shadow: 0 0 6px rgba(0,0,0,.4);
}
.handle-knob {
  width: 36px; height: 36px; border-radius: 50%;
  background: #fff; color: #0EA5A4;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
}
.compare-label {
  position: absolute; top: 10px;
  background: rgba(15,23,42,.7); color: #fff;
  font-size: 12px; padding: 4px 10px; border-radius: 4px;
  z-index: 4; pointer-events: none;
}
.compare-label-left { left: 10px; }
.compare-label-right { right: 10px; }
.watermark {
  position: absolute; bottom: 10px; right: 10px;
  background: rgba(15,23,42,.6); color: #fff;
  font-size: 11px; padding: 3px 8px; border-radius: 4px;
  z-index: 4; pointer-events: none;
}
.result-actions {
  display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap;
}

/* ========== Toast ========== */
.toast {
  position: fixed; left: 50%; top: 80px;
  transform: translateX(-50%);
  background: #0F172A; color: #fff;
  padding: 12px 20px; border-radius: 8px;
  font-size: 14px;
  box-shadow: 0 6px 20px rgba(0,0,0,.2);
  z-index: 9999;
  max-width: 90%;
}
.toast.error { background: #DC2626; }
.toast.success { background: #16A34A; }

/* ========== 底部 ========== */
.foot {
  text-align: center; color: #94A3B8; font-size: 12px;
  margin-top: 32px; line-height: 1.8;
}
.foot-tip { color: #64748B; }

/* ========== 响应式 ========== */
@media (max-width: 600px) {
  .top { padding: 12px 14px; }
  .tagline { display: none; }
  .card-input { width: 170px; font-size: 13px; letter-spacing: 1px; }
  .step-card { padding: 18px 16px; }
  .proj-grid { grid-template-columns: repeat(2, 1fr); }
  .btn-generate { height: 50px; font-size: 16px; }
  .compare-box { max-height: 400px; }
  .side-by-side { grid-template-columns: 1fr; gap: 10px; }
  .sbs-card img { max-height: 320px; }
  .compare-modes { width: 100%; display: flex; }
  .mode-btn { flex: 1; padding: 8px 8px; font-size: 13px; }
}
