/* 拾光绘 draw.boringlab.xin — 暗夜画室风格 */

:root {
  --bg: #07080d;
  --panel: rgba(255, 255, 255, 0.045);
  --panel-strong: rgba(20, 22, 34, 0.72);
  --border: rgba(255, 255, 255, 0.09);
  --border-soft: rgba(255, 255, 255, 0.06);
  --text: #eceef6;
  --muted: #97a0b6;
  --faint: #6a7288;
  --violet: #7c5cff;
  --cyan: #38d0f0;
  --grad: linear-gradient(135deg, #7c5cff 0%, #5a7bff 55%, #38d0f0 100%);
  --danger: #ff6b81;
  --ok: #2dd4a7;
  --radius: 18px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC",
    "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ---- 极光背景 ---- */
.aurora {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}
.aurora::before, .aurora::after {
  content: "";
  position: absolute;
  width: 60vmax;
  height: 60vmax;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.22;
}
.aurora::before {
  background: radial-gradient(circle at 30% 30%, #7c5cff, transparent 60%);
  top: -25vmax;
  left: -15vmax;
  animation: drift1 26s ease-in-out infinite alternate;
}
.aurora::after {
  background: radial-gradient(circle at 70% 70%, #1f8fb8, transparent 60%);
  bottom: -28vmax;
  right: -18vmax;
  animation: drift2 32s ease-in-out infinite alternate;
}
@keyframes drift1 {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(9vmax, 7vmax) scale(1.15); }
}
@keyframes drift2 {
  from { transform: translate(0, 0) scale(1.1); }
  to { transform: translate(-8vmax, -6vmax) scale(0.95); }
}
@media (prefers-reduced-motion: reduce) {
  .aurora::before, .aurora::after { animation: none; }
}

a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; }

::selection { background: rgba(124, 92, 255, 0.45); }

/* ---- 布局 ---- */
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 22px; }

/* ---- 顶栏 ---- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  background: rgba(7, 8, 13, 0.66);
  border-bottom: 1px solid var(--border-soft);
}
.topbar-inner {
  display: flex;
  align-items: center;
  gap: 20px;
  height: 62px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 19px;
  letter-spacing: 1px;
  color: var(--text);
}
.logo:hover { text-decoration: none; }
.logo svg { width: 26px; height: 26px; }
.logo .grad-text {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.topbar nav { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.topbar nav a {
  color: var(--muted);
  font-size: 14.5px;
  padding: 7px 13px;
  border-radius: 999px;
  transition: 0.18s;
}
.topbar nav a:hover { color: var(--text); background: var(--panel); text-decoration: none; }
.topbar nav a.active { color: var(--text); background: var(--panel); }
.nav-user {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--muted);
}
.nav-user .avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--grad);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
}
.nav-user a { color: var(--muted); font-size: 13px; }
@media (max-width: 640px) {
  .topbar nav a { padding: 6px 9px; font-size: 13.5px; }
  .nav-user .email-text { display: none; }
}

/* ---- 按钮 ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 12px 26px;
  font-size: 15.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s, background 0.15s;
  user-select: none;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px) scale(0.99); }
.btn-primary {
  background: var(--grad);
  color: #fff;
  box-shadow: 0 8px 26px rgba(102, 92, 255, 0.35);
}
.btn-primary:hover { box-shadow: 0 10px 34px rgba(102, 92, 255, 0.5); transform: translateY(-1px); }
.btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
.btn-ghost {
  background: var(--panel);
  border-color: var(--border);
  color: var(--text);
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.09); }
.btn-sm { padding: 7px 14px; font-size: 13.5px; border-radius: 10px; }
.btn-block { width: 100%; }

/* ---- 输入 ---- */
.input, textarea.input {
  width: 100%;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--text);
  font-family: inherit;
  font-size: 15.5px;
  padding: 13px 16px;
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
}
.input::placeholder { color: var(--faint); }
.input:focus {
  border-color: rgba(124, 92, 255, 0.65);
  box-shadow: 0 0 0 4px rgba(124, 92, 255, 0.16);
}
textarea.input { resize: vertical; min-height: 96px; line-height: 1.65; }
label.field-label {
  display: block;
  font-size: 13.5px;
  color: var(--muted);
  margin: 0 0 7px 2px;
}

/* ---- 卡片 ---- */
.card {
  background: var(--panel-strong);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

/* ---- 徽标 / 状态点 ---- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--muted);
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  padding: 6px 14px;
}
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--faint);
  flex: none;
}
.dot.online { background: var(--ok); box-shadow: 0 0 8px rgba(45, 212, 167, 0.8); }
.dot.offline { background: var(--faint); }
.dot.warn { background: var(--danger); }

.badge {
  display: inline-flex;
  align-items: center;
  font-size: 12.5px;
  padding: 3px 11px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
}
.badge.done { color: var(--ok); border-color: rgba(45, 212, 167, 0.4); background: rgba(45, 212, 167, 0.08); }
.badge.processing { color: var(--cyan); border-color: rgba(56, 208, 240, 0.4); background: rgba(56, 208, 240, 0.08); }
.badge.queued { color: #c9a86a; border-color: rgba(201, 168, 106, 0.4); background: rgba(201, 168, 106, 0.08); }
.badge.failed { color: var(--danger); border-color: rgba(255, 107, 129, 0.4); background: rgba(255, 107, 129, 0.08); }

/* ---- 首页 ---- */
.hero { text-align: center; padding: 64px 0 30px; }
.hero h1 {
  font-size: clamp(30px, 5.4vw, 46px);
  line-height: 1.25;
  margin: 0 0 14px;
  font-weight: 800;
}
.hero h1 .grad-text {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero p { color: var(--muted); font-size: 16.5px; margin: 0; }

.composer { margin: 26px auto 0; max-width: 780px; padding: 22px; }
.composer-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.composer-bottom { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.char-hint { font-size: 12.5px; color: var(--faint); }
.char-hint.over { color: var(--danger); }

.notice {
  max-width: 780px;
  margin: 14px auto 0;
  font-size: 13.5px;
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: 11px 16px;
  display: flex;
  gap: 9px;
  align-items: flex-start;
}
.notice.danger { color: #ffb3be; border-color: rgba(255, 107, 129, 0.45); }
.notice a { flex: none; }

/* ---- 结果区 ---- */
.results { max-width: 780px; margin: 26px auto 0; }
.results-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.results-head .prompt-echo {
  color: var(--muted);
  font-size: 13.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 60%;
}
.img-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 560px) { .img-grid { grid-template-columns: 1fr; } }

.img-card {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border-soft);
  background: rgba(0, 0, 0, 0.3);
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.img-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  animation: fadeIn 0.6s ease;
  cursor: zoom-in;
}
@keyframes fadeIn { from { opacity: 0; transform: scale(1.02); } to { opacity: 1; transform: none; } }

.placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--faint);
  font-size: 13.5px;
  background:
    linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, 0.05) 50%, transparent 70%),
    rgba(0, 0, 0, 0.25);
  background-size: 220% 100%, 100% 100%;
  animation: shimmer 1.8s linear infinite;
}
@keyframes shimmer {
  from { background-position: 120% 0, 0 0; }
  to { background-position: -120% 0, 0 0; }
}
.spinner {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.12);
  border-top-color: var(--violet);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.img-actions {
  position: absolute;
  right: 10px;
  bottom: 10px;
  display: flex;
  gap: 8px;
  opacity: 0;
  transition: 0.2s;
}
.img-card:hover .img-actions { opacity: 1; }
.img-actions a, .img-actions button {
  background: rgba(10, 11, 18, 0.78);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 12.5px;
  padding: 6px 12px;
  border-radius: 9px;
  cursor: pointer;
  backdrop-filter: blur(6px);
  font-family: inherit;
}
.img-actions a:hover, .img-actions button:hover { text-decoration: none; background: rgba(30, 32, 48, 0.9); }

.task-error {
  margin-top: 2px;
  color: #ffb3be;
  font-size: 14px;
  background: rgba(255, 107, 129, 0.09);
  border: 1px solid rgba(255, 107, 129, 0.35);
  border-radius: 12px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

/* ---- 我的作品 ---- */
.page-head { padding: 46px 0 8px; }
.page-head h1 { font-size: clamp(24px, 4vw, 32px); margin: 0 0 6px; font-weight: 800; }
.page-head p { color: var(--muted); margin: 0; font-size: 15px; }

.gallery-grid {
  margin: 24px 0 40px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
}
.work-card { overflow: hidden; display: flex; flex-direction: column; transition: transform 0.18s; }
.work-card:hover { transform: translateY(-3px); }
.work-cover {
  aspect-ratio: 1 / 1;
  background: rgba(0, 0, 0, 0.3);
  position: relative;
  cursor: zoom-in;
  overflow: hidden;
}
.work-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.work-cover .duo {
  position: absolute;
  right: 10px;
  top: 10px;
  font-size: 11.5px;
  color: var(--text);
  background: rgba(10, 11, 18, 0.7);
  border: 1px solid var(--border);
  padding: 2px 9px;
  border-radius: 999px;
}
.work-cover .ph {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--faint);
  font-size: 13px;
}
.work-meta { padding: 13px 15px 15px; display: flex; flex-direction: column; gap: 9px; flex: 1; }
.work-prompt {
  font-size: 13.8px;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.5;
  min-height: 2.9em;
}
.work-foot { display: flex; align-items: center; justify-content: space-between; margin-top: auto; }
.work-time { font-size: 12px; color: var(--faint); }

.empty-state {
  text-align: center;
  padding: 70px 20px;
  color: var(--muted);
}
.empty-state .big { font-size: 44px; margin-bottom: 10px; }

/* ---- 登录/注册 ---- */
.auth-wrap { max-width: 430px; margin: 60px auto 70px; padding: 0 22px; }
.auth-card { padding: 30px 28px 30px; }
.auth-tabs {
  display: flex;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 24px;
}
.auth-tabs button {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  padding: 10px;
  border-radius: 9px;
  cursor: pointer;
  transition: 0.18s;
}
.auth-tabs button.active { background: var(--grad); color: #fff; }
.auth-form { display: flex; flex-direction: column; gap: 16px; }
.code-row { display: flex; gap: 10px; }
.code-row .input { flex: 1; }
.code-row .btn { flex: none; }
.auth-err {
  color: #ffb3be;
  font-size: 13.5px;
  background: rgba(255, 107, 129, 0.09);
  border: 1px solid rgba(255, 107, 129, 0.35);
  border-radius: 10px;
  padding: 9px 13px;
  display: none;
}
.auth-err.show { display: block; }
.auth-tip { font-size: 13px; color: var(--faint); text-align: center; margin-top: 18px; }
.auth-tip a { color: var(--cyan); cursor: pointer; }

/* ---- 页脚 ---- */
.footer {
  border-top: 1px solid var(--border-soft);
  margin-top: 60px;
  padding: 26px 0 34px;
  color: var(--faint);
  font-size: 13px;
}
.footer .wrap { display: flex; flex-direction: column; gap: 8px; text-align: center; }
.footer .terms { color: var(--muted); }
.footer a { color: var(--faint); }
.footer a:hover { color: var(--muted); }

/* ---- 灯箱 ---- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(4, 5, 9, 0.9);
  backdrop-filter: blur(10px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 30px 16px 70px;
}
.lightbox.open { display: flex; }
.lightbox .lb-body {
  max-width: 1100px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 100%;
}
.lightbox .lb-prompt { text-align: center; color: var(--muted); font-size: 14px; flex: none; }
.lightbox .lb-imgs {
  display: flex;
  gap: 14px;
  justify-content: center;
  overflow: auto;
  min-height: 0;
}
.lightbox .lb-imgs img {
  max-height: 72vh;
  max-width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border);
  object-fit: contain;
}
.lightbox .lb-close {
  position: fixed;
  top: 18px;
  right: 22px;
  font-size: 30px;
  color: var(--muted);
  cursor: pointer;
  background: none;
  border: none;
  line-height: 1;
  font-family: inherit;
}
.lightbox .lb-close:hover { color: var(--text); }
@media (max-width: 640px) {
  .lightbox .lb-imgs { flex-direction: column; align-items: center; }
  .lightbox .lb-imgs img { max-height: 40vh; }
}

/* ---- Toast ---- */
.toasts {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  width: max-content;
  max-width: 92vw;
}
.toast {
  background: rgba(22, 24, 36, 0.92);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 14px;
  border-radius: 12px;
  padding: 11px 20px;
  box-shadow: var(--shadow);
  animation: toastIn 0.25s ease;
  max-width: 100%;
}
.toast.err { border-color: rgba(255, 107, 129, 0.5); color: #ffc4cd; }
.toast.ok { border-color: rgba(45, 212, 167, 0.5); }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
