:root {
  --bg: #f3f5f9;
  --card: #ffffff;
  --text: #1c2333;
  --muted: #6b7280;
  --accent: #3b6ef6;
  --accent-weak: #e7eeff;
  --border: #e3e7ef;
  --danger: #d64545;
  --ok: #2e9e5b;
  --radius: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

/* 主页背景极光光斑（登录页除外） */
body:not(.auth-body) { position: relative; }
body:not(.auth-body)::before,
body:not(.auth-body)::after {
  content: ""; position: fixed; z-index: -1; border-radius: 50%;
  filter: blur(90px); opacity: .32; pointer-events: none;
}
body:not(.auth-body)::before {
  width: 560px; height: 560px; left: -160px; top: -140px;
  background: radial-gradient(circle, #6a8dff, transparent 70%);
  animation: drift1 14s ease-in-out infinite alternate;
}
body:not(.auth-body)::after {
  width: 640px; height: 640px; right: -180px; top: 26%;
  background: radial-gradient(circle, #b06af6, transparent 70%);
  animation: drift2 18s ease-in-out infinite alternate;
}
@keyframes drift1 { to { transform: translate(140px, 90px) scale(1.18); } }
@keyframes drift2 { to { transform: translate(-120px, -70px) scale(1.12); } }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; position: relative; }

.topbar {
  background: linear-gradient(120deg, #131c42, #22367f 45%, #2c2a7a 70%, #131c42);
  background-size: 300% 300%;
  animation: hueflow 14s ease infinite;
  color: #fff;
  padding: 22px 0 20px;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}
@keyframes hueflow { 0%,100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
.topbar::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px;
  background: linear-gradient(90deg, transparent, #60a5fa, #a78bfa, #22d3ee, transparent);
  background-size: 200% 100%;
  animation: shimmerline 4s linear infinite;
}
@keyframes shimmerline { to { background-position: -200% 0; } }
.brand-row { display: flex; align-items: center; gap: 16px; }
.brand-logo { height: 54px; width: 54px; object-fit: contain; filter: drop-shadow(0 2px 8px rgba(0,0,0,.25)); }
.topbar h1 {
  font-size: 22px; font-weight: 700; letter-spacing: 1px;
  background: linear-gradient(90deg, #ffffff, #b9d2ff);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.subtitle { opacity: .85; font-size: 13px; margin-top: 4px; }

.banner {
  margin-top: 14px;
  background: #fff7e0;
  color: #8a5b00;
  border: 1px solid #f2dfae;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(20, 30, 60, .05);
  transition: transform .18s, box-shadow .18s;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 12px 32px rgba(35, 60, 140, .12); }
.card h2 { font-size: 16px; font-weight: 600; display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.step {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  box-shadow: 0 2px 10px rgba(79, 102, 241, .45);
  color: #fff; font-size: 13px; flex: none;
}
.counter { color: var(--accent); font-size: 14px; font-weight: 600; }

.scrape-row { display: flex; gap: 12px; }
.scrape-row input {
  flex: 1; min-width: 0;
  padding: 14px 18px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.scrape-row input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 110, 246, .12);
}
.scrape-row .btn {
  padding: 14px 26px;
  font-size: 15px;
  font-weight: 600;
  flex: none;
}

.btn {
  border: none; border-radius: 8px; padding: 10px 18px;
  font-size: 14px; cursor: pointer; background: #eef1f6; color: var(--text);
  transition: filter .15s;
}
.btn:hover { filter: brightness(.96); }
.btn.primary {
  background: linear-gradient(90deg, #3b82f6, #6366f1); color: #fff;
  box-shadow: 0 6px 18px rgba(79, 102, 241, .35);
}
.btn.primary:hover:not(:disabled) { filter: brightness(1.08); transform: translateY(-1px); box-shadow: 0 8px 24px rgba(79, 102, 241, .45); }
.btn.big { padding: 12px 26px; font-size: 15px; font-weight: 600; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.status { font-size: 13px; color: var(--muted); margin-top: 10px; }
.status.error { color: var(--danger); }

.gallery-tools { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.page-title { font-size: 13px; color: var(--muted); max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chk { font-size: 14px; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }

.gallery {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}
.pic-card {
  position: relative; border: 2px solid var(--border); border-radius: 10px;
  overflow: hidden; cursor: pointer; background: #fafbfd;
  transition: border-color .12s, transform .12s, box-shadow .12s;
}
.pic-card:hover { transform: translateY(-3px); box-shadow: 0 10px 24px rgba(35, 60, 140, .16); }
.pic-card:hover img { transform: scale(1.06); }
.pic-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 110, 246, .22), 0 10px 24px rgba(35, 60, 140, .16);
}
.pic-card img {
  display: block; width: 100%; height: 140px; object-fit: cover;
  transition: transform .2s ease;
}

.pic-check {
  position: absolute; top: 8px; left: 8px;
  width: 22px; height: 22px; border-radius: 6px;
  border: 2px solid #fff; background: rgba(255,255,255,.75);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; color: transparent; font-weight: 700;
}
.pic-card.selected .pic-check { background: var(--accent); color: #fff; border-color: var(--accent); }
.pic-meta {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,.55));
  color: #fff; font-size: 11px; padding: 14px 8px 6px;
  display: flex; justify-content: space-between;
}

.options { display: flex; flex-direction: column; gap: 12px; }
.option-item {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px;
  cursor: pointer;
}
.option-item:has(input:checked) { border-color: var(--accent); background: var(--accent-weak); }
.option-name { font-weight: 600; font-size: 14px; min-width: 96px; }
.desc-input {
  flex: 1; min-width: 240px; padding: 8px 12px; font-size: 13px;
  border: 1px solid var(--border); border-radius: 8px; outline: none;
}
.desc-input:focus { border-color: var(--accent); }

.submit-row { display: flex; align-items: center; gap: 14px; margin-top: 16px; }

.results { display: flex; flex-direction: column; gap: 16px; }
.result-item {
  border: 1px solid var(--border); border-radius: 10px; padding: 14px;
  display: flex; flex-direction: column; gap: 10px;
}
.result-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tag {
  font-size: 12px; padding: 2px 10px; border-radius: 999px;
  background: var(--accent-weak); color: var(--accent); font-weight: 600;
}
.tag.pending { background: #f1f2f6; color: var(--muted); }
.tag.running { background: #fff4e0; color: #b06a00; }
.tag.done { background: #e4f6ec; color: var(--ok); }
.tag.failed { background: #fdeaea; color: var(--danger); }
.tag.mock { background: #f1f2f6; color: var(--muted); }
.result-error { font-size: 13px; color: var(--danger); white-space: pre-wrap; word-break: break-all; }

.result-body { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.result-body figure { text-align: center; }
.result-body figcaption { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.result-body img {
  max-width: 100%; max-height: 320px; border-radius: 8px;
  border: 1px solid var(--border); object-fit: contain;
}
.placeholder-box {
  height: 160px; border: 1px dashed var(--border); border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 13px;
}

/* 生成中动效：深蓝渐变流动 + 旋转光环 + 打字点 */
.gen-box {
  height: 160px; border-radius: 8px; position: relative; overflow: hidden;
  background: linear-gradient(120deg, #101a3c, #1d2f6b 45%, #2a2470 60%, #101a3c);
  background-size: 220% 220%;
  animation: genShift 3.2s ease infinite;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; color: #9cc3fb; font-size: 13px; letter-spacing: 1px;
}
@keyframes genShift { 0%,100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
.gen-spinner {
  width: 36px; height: 36px; border-radius: 50%;
  border: 3px solid rgba(96, 165, 250, .22); border-top-color: #60a5fa;
  animation: genSpin .9s linear infinite;
}
@keyframes genSpin { to { transform: rotate(360deg); } }
.gen-text .dots i { font-style: normal; animation: genBlink 1.2s infinite; }
.gen-text .dots i:nth-child(2) { animation-delay: .2s; }
.gen-text .dots i:nth-child(3) { animation-delay: .4s; }
@keyframes genBlink { 0%, 100% { opacity: .2; } 50% { opacity: 1; } }

.result-actions { display: flex; justify-content: flex-end; gap: 10px; }

.hidden { display: none !important; }

/* ---------- 登录 / 注册（深色玻璃拟态，参考全屏底图布局） ---------- */
.auth-body { min-height: 100vh; }

.auth-stage {
  position: relative; min-height: 100vh;
  background: url(/bg-login.jpg) center / cover no-repeat fixed #0e1533;
  display: flex; align-items: center;   /* 左右两栏均垂直居中 */
  padding: 130px 64px 48px;             /* 顶部为绝对定位的 logo 预留 */
  box-sizing: border-box;
}
.auth-stage::before {
  content: ""; position: fixed; inset: 0; pointer-events: none;
  background: linear-gradient(115deg, rgba(8, 13, 38, .58) 0%, rgba(8, 13, 38, .28) 45%, rgba(8, 13, 38, .46) 100%);
}

.auth-topbar { position: absolute; top: 34px; left: 64px; z-index: 1; }
.auth-logo { height: 76px; display: block; }

.brand-side {
  position: relative; z-index: 1;
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; align-items: center;  /* 文案在页面左侧区域内水平居中 */
  justify-content: center;
  color: #fff;
  text-shadow: 0 2px 24px rgba(5, 10, 30, .55);
  text-align: center;
}
.brand-side h1 { font-size: 48px; font-weight: 700; letter-spacing: 3px; }
.brand-side p { margin-top: 16px; font-size: 20px; opacity: .82; letter-spacing: 6px; }

.auth-card {
  position: relative; z-index: 1;
  flex: none;
  width: 420px; max-width: 100%;
  background: rgba(13, 19, 42, .72);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 20px;
  padding: 30px 32px 26px;
  box-shadow: 0 18px 60px rgba(3, 8, 26, .55);
}

.card-tabs {
  display: flex; gap: 6px;
  background: rgba(255, 255, 255, .08);
  border-radius: 12px; padding: 4px; margin-bottom: 22px;
}
.card-tabs .tab {
  flex: 1; border: none; background: transparent; padding: 10px 0;
  font-size: 15px; font-weight: 600; color: rgba(255, 255, 255, .65);
  border-radius: 9px; cursor: pointer; transition: all .15s;
}
.card-tabs .tab.active {
  background: linear-gradient(90deg, #3b82f6, #6366f1);
  color: #fff; box-shadow: 0 4px 14px rgba(59, 130, 246, .4);
}

.form-title { font-size: 22px; font-weight: 700; color: #fff; margin-bottom: 16px; }

.mode-tabs { display: flex; gap: 22px; margin-bottom: 18px; }
.mode-tab { display: inline-flex; align-items: center; cursor: pointer; }
.mode-tab input { display: none; }
.mode-tab span {
  font-size: 14px; color: rgba(255, 255, 255, .55);
  padding-bottom: 5px; border-bottom: 2px solid transparent; transition: all .15s;
}
.mode-tab input:checked + span { color: #fff; border-bottom-color: #60a5fa; font-weight: 600; }

.auth-form .field { margin-bottom: 15px; }
.auth-form .field > label {
  display: block; font-size: 13px; color: rgba(255, 255, 255, .6); margin-bottom: 7px;
}
.auth-form input[type=text], .auth-form input[type=password], .auth-form input[type=tel] {
  width: 100%; padding: 12px 14px; font-size: 14px; color: #fff;
  background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(255, 255, 255, .14); border-radius: 10px; outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
  box-sizing: border-box;
}
.auth-form input::placeholder { color: rgba(255, 255, 255, .32); }
.auth-form input:focus {
  border-color: #60a5fa; background: rgba(255, 255, 255, .1);
  box-shadow: 0 0 0 3px rgba(96, 165, 250, .18);
}

.sms-row { display: flex; gap: 10px; align-items: stretch; }
.sms-row input { flex: 1; min-width: 0; }
.send-btn {
  flex: none; min-width: 116px; padding: 0 14px; font-size: 14px;
  background: rgba(96, 165, 250, .16); color: #9cc3fb;
  border: 1px solid rgba(96, 165, 250, .35); border-radius: 10px;
  cursor: pointer; transition: all .15s;
}
.send-btn:hover:not(:disabled) { background: rgba(96, 165, 250, .28); }
.send-btn:disabled { opacity: .55; cursor: not-allowed; }
.captcha-img {
  height: 46px; border-radius: 10px; cursor: pointer; flex: none;
  border: 1px solid rgba(255, 255, 255, .14);
}

.auth-submit {
  width: 100%; margin-top: 10px; padding: 13px 0;
  background: linear-gradient(90deg, #3b82f6, #6366f1);
  border: none; border-radius: 12px; color: #fff;
  font-size: 16px; font-weight: 600; letter-spacing: 6px; cursor: pointer;
  box-shadow: 0 8px 24px rgba(59, 130, 246, .35);
  transition: filter .15s, transform .1s;
}
.auth-submit:hover:not(:disabled) { filter: brightness(1.1); }
.auth-submit:active:not(:disabled) { transform: scale(.99); }
.auth-submit:disabled { opacity: .6; cursor: not-allowed; }

.auth-form .status { min-height: 18px; margin-top: 10px; font-size: 13px; }
.auth-form .status.error { color: #ff9d9d; }

@media (max-width: 960px) {
  .auth-stage { padding: 130px 20px 32px; align-items: flex-start; }
  .auth-topbar { left: 20px; }
  .brand-side { display: none; }
  .auth-card { margin: 4vh auto 0; }
}

/* ---------- 主页顶栏用户区 ---------- */
.topbar-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.user-chip {
  display: flex; align-items: center; gap: 10px; flex: none;
  background: rgba(255, 255, 255, .14); border-radius: 999px;
  padding: 6px 8px 6px 14px; font-size: 14px; font-weight: 600;
}
.logout-btn {
  background: rgba(255, 255, 255, .22); color: #fff;
  border-radius: 999px; padding: 5px 14px; font-size: 13px;
}
.logout-btn:hover { background: rgba(255, 255, 255, .32); }
.quota-badge {
  background: linear-gradient(90deg, #3b82f6, #6366f1);
  border-radius: 999px; padding: 5px 14px; font-size: 13px; font-weight: 600;
  box-shadow: 0 2px 10px rgba(79, 102, 241, .4);
}

/* ---------- 额度不足弹窗 ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(8, 12, 30, .55);
  display: flex; align-items: center; justify-content: center;
}
.modal-box {
  background: #fff; border-radius: 16px; padding: 30px 36px 26px;
  width: 360px; max-width: calc(100vw - 48px);
  text-align: center; box-shadow: 0 20px 60px rgba(3, 8, 26, .4);
}
.modal-icon { font-size: 40px; }
.modal-box h3 { font-size: 18px; font-weight: 700; margin: 10px 0 8px; }
.modal-box p { font-size: 14px; color: var(--muted); line-height: 1.7; margin-bottom: 18px; }
.modal-btn { width: 100%; padding: 11px 0; border-radius: 10px; }

@media (max-width: 640px) {
  .topbar-head { flex-direction: column; }
}

@media (max-width: 640px) {
  .result-body { grid-template-columns: 1fr; }
  .scrape-row { flex-direction: column; }
}
