:root {
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --primary-soft: #eef2ff;
  --bg: #f6f7fb;
  --card: #ffffff;
  --text: #1f2430;
  --text-2: #5b6472;
  --text-3: #8b93a1;
  --border: #e6e8ef;
  --success: #10b981;
  --warn: #f59e0b;
  --danger: #ef4444;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 4px 16px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; }

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
               "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

code {
  background: #f1f2f7;
  padding: 1px 6px;
  border-radius: 5px;
  font-size: 12px;
}

/* ---------- 登录注册 ---------- */
#authView {
  position: fixed;
  inset: 0;
  z-index: 50;
  overflow: hidden;
  background: #1a2233; /* 视频加载前的兜底底色 */
}

.auth-bg-video {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  animation: authZoom 40s ease-in-out infinite alternate;
}

/* 视频被浏览器暂停/加载失败时，poster 仍然铺满 */
#authView::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url('bg/bg_login.png') center / cover no-repeat;
  z-index: 0;
}

/* 暗化遮罩：保证登录卡片可读 */
.auth-bg-mask {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: linear-gradient(180deg, rgba(15, 23, 42, .25) 0%, rgba(15, 23, 42, .10) 45%, rgba(15, 23, 42, .38) 100%);
}

@keyframes authZoom {
  from { transform: scale(1); }
  to   { transform: scale(1.08); }
}

@media (prefers-reduced-motion: reduce) {
  .auth-bg-video { animation: none; }
}

.auth-body {
  position: relative;
  z-index: 3;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card-glass {
  background: rgba(255, 255, 255, .82);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, .55);
  box-shadow: 0 18px 60px rgba(15, 23, 42, .35);
}

.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 32px 28px;
}
.auth-card.wide { max-width: 460px; }

.auth-title {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -.3px;
}
.auth-sub {
  margin: 0 0 22px;
  color: var(--text-3);
  font-size: 13px;
}

.auth-tabs {
  display: flex;
  gap: 4px;
  background: #f1f2f7;
  padding: 4px;
  border-radius: 10px;
  margin-bottom: 20px;
}
.auth-tabs button {
  flex: 1;
  border: 0;
  background: transparent;
  padding: 8px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
  font-family: inherit;
}
.auth-tabs button.active {
  background: #fff;
  color: var(--text);
  font-weight: 500;
  box-shadow: 0 1px 3px rgba(16, 24, 40, .08);
}

.auth-hint {
  margin-top: 16px;
  font-size: 13px;
  color: var(--text-3);
  text-align: center;
}

/* ---------- 表单 ---------- */
.form { display: block; }

.field { display: block; margin-bottom: 16px; }
.label {
  display: block;
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 6px;
  font-weight: 500;
}
.req { color: var(--danger); margin-left: 2px; }

input[type=text], input[type=password], input[type=number], select, textarea {
  width: 100%;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  color: var(--text);
  font-family: inherit;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, .1);
}
textarea { resize: vertical; min-height: 90px; line-height: 1.6; }

.row { display: flex; gap: 12px; }
.row > * { flex: 1; min-width: 0; }

.btn {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 10px 18px;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  transition: all .15s;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-block { width: 100%; }
.btn-ghost {
  background: #fff;
  border-color: var(--border);
  color: var(--text-2);
}
.btn-ghost:hover:not(:disabled) { border-color: var(--text-3); color: var(--text); }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }

.alert {
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  margin-bottom: 16px;
  line-height: 1.5;
}
.alert-error { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.alert-success { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.alert-warn { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; }

/* ---------- 布局 ---------- */
.navbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.navbar-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 20px;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 20px;
}
.logo {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -.3px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.logo-mark {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
}
.nav-tabs { display: flex; gap: 2px; }
.nav-tabs button {
  border: 0;
  background: transparent;
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 14px;
  color: var(--text-2);
  cursor: pointer;
  font-family: inherit;
}
.nav-tabs button:hover { background: #f4f5f9; color: var(--text); }
.nav-tabs button.active { background: var(--primary-soft); color: var(--primary); font-weight: 500; }

.nav-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.user-chip {
  font-size: 13px;
  color: var(--text-2);
  background: #f4f5f9;
  padding: 5px 12px;
  border-radius: 20px;
}

.layout {
  max-width: 1240px;
  margin: 0 auto;
  padding: 24px 20px 60px;
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 24px;
  align-items: start;
}
@media (max-width: 960px) {
  .layout { grid-template-columns: 1fr; }
}

.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.panel-head {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.panel-body { padding: 18px; }

.sticky-side { position: sticky; top: 84px; }

/* 类型选择卡片 */
.type-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 16px; }
.type-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 6px;
  text-align: center;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-2);
  transition: all .15s;
  user-select: none;
}
.type-item:hover { border-color: #c7cbd6; }
.type-item.active {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 500;
}

/* 开关行 */
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 13px;
  color: var(--text-2);
}
.switch {
  position: relative;
  width: 40px;
  height: 22px;
  flex: 0 0 auto;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute;
  inset: 0;
  background: #d4d7e0;
  border-radius: 22px;
  cursor: pointer;
  transition: .2s;
}
.slider:before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  left: 2px;
  top: 2px;
  background: #fff;
  border-radius: 50%;
  transition: .2s;
}
.switch input:checked + .slider { background: var(--primary); }
.switch input:checked + .slider:before { transform: translateX(18px); }

/* 上传 */
.uploader {
  border: 1.5px dashed #d5d8e2;
  border-radius: 10px;
  padding: 18px 14px;
  text-align: center;
  cursor: pointer;
  color: var(--text-3);
  font-size: 13px;
  transition: all .15s;
}
.uploader:hover { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }

.thumb-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.thumb {
  position: relative;
  width: 58px;
  height: 58px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #f4f5f9;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb video { width: 100%; height: 100%; object-fit: cover; background: #000; }
.thumb .del {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(0, 0, 0, .6);
  color: #fff;
  font-size: 11px;
  line-height: 16px;
  text-align: center;
  cursor: pointer;
}
.thumb .badge-mini {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, .55);
  color: #fff;
  font-size: 10px;
  text-align: center;
  line-height: 14px;
}

.hint { font-size: 12px; color: var(--text-3); margin-top: 6px; line-height: 1.5; }

.credit-chip {
  font-size: 13px;
  color: var(--primary);
  background: var(--primary-soft);
  padding: 5px 12px;
  border-radius: 20px;
  font-weight: 500;
}

.calc {
  background: #f8f9fc;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 16px;
  line-height: 1.8;
}
.calc b { color: var(--text); font-weight: 500; }
.calc .profit { color: #047857; font-weight: 500; }

/* 统计卡片 */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  padding: 18px 18px 0;
}
.stat {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  background: #fff;
}
.stat-label { font-size: 12px; color: var(--text-3); }
.stat-value { font-size: 20px; font-weight: 600; margin-top: 2px; letter-spacing: -.5px; }
.stat-value.green { color: #047857; }
.stat-value.blue { color: #1d4ed8; }

/* 用户表 */
.table-wrap { padding: 0 18px 18px; overflow-x: auto; }
table.ut { width: 100%; border-collapse: collapse; font-size: 13px; }
table.ut th, table.ut td {
  padding: 9px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.ut th { color: var(--text-3); font-weight: 500; font-size: 12px; }
table.ut tr:hover td { background: #fafbfd; }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(15, 23, 42, .55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
}
.modal {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, .35);
  overflow: hidden;
  animation: modalIn .18s ease-out;
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(12px) scale(.98); }
  to   { opacity: 1; transform: none; }
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
  font-weight: 600;
}
.modal-close {
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  color: var(--text-3);
  padding: 0 4px;
}
.modal-close:hover { color: var(--text); }
.modal-body { padding: 20px; max-height: 78vh; overflow-y: auto; }

/* ---------- 充值 ---------- */
.pay-price {
  font-size: 13px;
  color: var(--text-2);
  text-align: center;
  margin-bottom: 14px;
}
.pay-price b { color: var(--text); }
.pay-qr {
  width: 220px;
  height: 220px;
  margin: 0 auto 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #fafbfd;
}
.pay-qr img { width: 100%; height: 100%; object-fit: contain; }
.pay-qr-empty {
  text-align: center;
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.7;
  padding: 0 20px;
}
.pay-qr-empty span { color: var(--text-3); font-size: 12px; }
.pay-payee {
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
}
.pay-tips {
  text-align: center;
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.7;
  margin-bottom: 14px;
  white-space: pre-wrap;
}
.pay-account {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  font-size: 13px;
  color: var(--text-2);
  background: #f6f7fb;
  border-radius: 10px;
  padding: 8px 12px;
  margin-bottom: 8px;
}
.pay-account b { color: var(--text); }
.pay-preview {
  width: 120px;
  height: 120px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  margin-bottom: 16px;
  background: #fafbfd;
}
.pay-preview img { width: 100%; height: 100%; object-fit: contain; }
.pay-preview .hint { font-size: 12px; }

@media (max-width: 520px) {
  .modal-mask { padding: 12px; }
  .pay-qr { width: 180px; height: 180px; }
}

/* ---------- 作品区 ---------- */
.toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.empty {
  padding: 60px 20px;
  text-align: center;
  color: var(--text-3);
  font-size: 14px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
  padding: 18px;
}

.card {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  display: flex;
  flex-direction: column;
}
.card-media {
  position: relative;
  aspect-ratio: 1 / 1;
  background: #f4f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.card-media img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; }
.card-media video { width: 100%; height: 100%; object-fit: cover; background: #000; }
.card-media .multi-dot {
  position: absolute;
  right: 8px;
  bottom: 8px;
  background: rgba(0, 0, 0, .6);
  color: #fff;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 20px;
}
.card-body { padding: 10px 12px 12px; }
.card-prompt {
  font-size: 13px;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.5;
  min-height: 39px;
}
.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  gap: 8px;
}
.card-time { font-size: 12px; color: var(--text-3); }
.card-actions { display: flex; gap: 6px; }

.status {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 20px;
  white-space: nowrap;
}
.status-0, .status-1 { background: #eff6ff; color: #1d4ed8; }
.status-2 { background: #ecfdf5; color: #047857; }
.status-3, .status-4 { background: #fef2f2; color: #b91c1c; }

.spinner {
  width: 22px;
  height: 22px;
  border: 2.5px solid #dbeafe;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 裁剪器 ---------- */
.crop-modal { max-width: 900px; }
.modal-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: #fafbfc;
}
.crop-hint { margin-right: auto; font-size: 12px; color: var(--text-3); }

.crop-body {
  display: flex;
  gap: 20px;
  padding: 18px 20px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.crop-stage {
  position: relative;
  display: inline-block;
  line-height: 0;
  background: #f1f3f6 repeating-conic-gradient(#e6e9ef 0% 25%, #fff 0% 50%) 50% / 18px 18px;
  border-radius: 8px;
  overflow: hidden;
  user-select: none;
  touch-action: none;
}
.crop-stage img {
  display: block;
  max-width: 520px;
  max-height: 52vh;
  width: auto;
  -webkit-user-drag: none;
  pointer-events: none;
}
.crop-box {
  position: absolute;
  box-sizing: border-box;
  border: 1px solid rgba(255, 255, 255, .95);
  box-shadow: 0 0 0 9999px rgba(15, 23, 42, .5);
  cursor: move;
}
.crop-grid::before,
.crop-grid::after {
  content: '';
  position: absolute;
  background: rgba(255, 255, 255, .4);
}
.crop-grid::before { left: 33.33%; width: 1px; top: 0; bottom: 0; }
.crop-grid::after { top: 33.33%; height: 1px; left: 0; right: 0; }
.crop-handle {
  position: absolute;
  right: -7px;
  bottom: -7px;
  width: 14px;
  height: 14px;
  background: #fff;
  border: 2px solid var(--primary, #4f46e5);
  border-radius: 50%;
  cursor: nwse-resize;
}

.crop-side { flex: 1; min-width: 260px; display: flex; flex-direction: column; gap: 14px; }
.crop-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.crop-label { font-size: 13px; color: var(--text-2); min-width: 60px; }
.crop-ratios { display: flex; gap: 6px; flex-wrap: wrap; }
.crop-ratios button {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-2);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
}
.crop-ratios button.active {
  border-color: var(--primary, #4f46e5);
  background: rgba(79, 70, 229, .08);
  color: var(--primary, #4f46e5);
  font-weight: 600;
}
.crop-size { display: flex; align-items: center; gap: 6px; }
.crop-size input {
  width: 88px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
}
.crop-lock { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); cursor: pointer; }
.crop-meta { font-size: 12px; color: var(--text-3); line-height: 1.7; }
.crop-tip {
  font-size: 12px;
  color: var(--text-3);
  background: #f7f8fa;
  border-radius: 8px;
  padding: 10px 12px;
  line-height: 1.7;
}
@media (max-width: 720px) {
  .crop-body { flex-direction: column; }
  .crop-stage img { max-width: 100%; }
}

/* ---------- 提示词方案选择 ---------- */
.sg-modal { max-width: 640px; }
.sg-tip {
  font-size: 13px;
  color: var(--text-2);
  background: #f7f8fa;
  border-radius: 8px;
  padding: 10px 12px;
  line-height: 1.7;
  margin-bottom: 14px;
}
.sg-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.sg-item:hover { border-color: #c7cbd6; }
.sg-item.active {
  border-color: var(--primary, #4f46e5);
  background: rgba(79, 70, 229, .05);
}
.sg-head { display: flex; align-items: baseline; gap: 8px; }
.sg-title { font-size: 14px; font-weight: 600; }
.sg-desc { font-size: 12px; color: var(--text-3); }
.sg-prompt {
  width: 100%;
  box-sizing: border-box;
  margin-top: 8px;
  min-height: 62px;
  resize: vertical;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  line-height: 1.65;
  color: var(--text-2);
  background: #fff;
  font-family: inherit;
}
.sg-prompt:focus { outline: none; border-color: var(--primary, #4f46e5); color: var(--text); }

/* 灯箱操作条 */
.lb-actions {
  position: absolute;
  top: 20px;
  right: 56px;
  display: flex;
  gap: 8px;
}
.lb-actions button {
  background: rgba(255, 255, 255, .14);
  border: 1px solid rgba(255, 255, 255, .28);
  color: #fff;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
}
.lb-actions button:hover { background: rgba(255, 255, 255, .26); }

/* 灯箱 */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(15, 18, 26, .82);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 32px;
}
.lightbox img, .lightbox video { max-width: 100%; max-height: 100%; border-radius: 8px; }
.lightbox-close {
  position: absolute;
  top: 20px;
  right: 24px;
  color: #fff;
  font-size: 28px;
  cursor: pointer;
  line-height: 1;
}

/* toast */
.toast-wrap {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}
.toast {
  background: #1f2430;
  color: #fff;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 13px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
  animation: fadein .18s ease;
  max-width: 80vw;
}
.toast.error { background: #b91c1c; }
.toast.success { background: #047857; }
@keyframes fadein { from { opacity: 0; transform: translateY(-6px); } }
