:root {
  /* 参考稿取色：近黑底 + 中性灰阶，靠照片本身做视觉 */
  --bg: #1a1a1a;
  --bg-elev: #202020;
  --surface: #242424;
  --surface-2: #2b2b2b;
  --surface-3: #343434;
  --border: #3a3a3a;
  --border-soft: #2e2e2e;
  --text: #ededed;
  --text-dim: #9c9c9c;
  --text-faint: #6e6e6e;
  --accent: #e4e4e4;
  --accent-hi: #ffffff;
  --accent-soft: rgba(255, 255, 255, .09);
  --danger: #e2685f;
  --danger-soft: rgba(226, 104, 95, .12);
  --ok: #5fb98a;
  /* 四种选片标记（与导出到 C1 / LR 的颜色标签一一对应） */
  --mark-selected: #5fb98a;
  --mark-must: #e2685f;
  --mark-alt: #d9a75c;
  --mark-retouch: #5b93d6;
  --radius: 10px;
  --radius-sm: 8px;
  --radius-lg: 14px;
  --shadow: 0 18px 50px rgba(0, 0, 0, .45);
  --shadow-sm: 0 6px 18px rgba(0, 0, 0, .3);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans SC", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; line-height: 1.3; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }

.hidden { display: none !important; }
.muted { color: var(--text-dim); }
.faint { color: var(--text-faint); }
.row { display: flex; align-items: center; gap: 8px; }
.spacer { flex: 1; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #3a3a3a; border-radius: 999px; border: 3px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #4a4a4a; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* ─────────── 按钮 ─────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background .16s, border-color .16s, transform .1s, opacity .16s;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { background: var(--surface-3); border-color: #464646; }
.btn:active { transform: scale(.975); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

.btn-primary {
  background: linear-gradient(180deg, var(--accent-hi), var(--accent));
  border-color: #cfcfcf;
  color: #1a1a1a;
  font-weight: 650;
}
.btn-primary:hover { background: linear-gradient(180deg, #ffffff, #dcdcdc); border-color: #cfcfcf; }

.btn-ghost { background: transparent; border-color: var(--border); color: var(--text-dim); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

.btn-danger-ghost { background: transparent; border-color: transparent; color: var(--danger); }
.btn-danger-ghost:hover { background: var(--danger-soft); border-color: rgba(239,115,106,.3); }

.btn-danger { background: var(--danger); border-color: #cf5c54; color: #1a1a1a; font-weight: 650; }

.btn-block { width: 100%; }
.btn-sm { padding: 6px 11px; font-size: 13px; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; flex: 0 0 auto;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--text); cursor: pointer; font-size: 16px;
  transition: background .16s;
}
.icon-btn:hover { background: var(--surface-3); }

.link-btn {
  background: none; border: 0; padding: 4px 2px; color: var(--text-faint);
  font-size: 13px; cursor: pointer; transition: color .16s;
}
.link-btn:hover { color: var(--accent); }
.dot-sep { color: var(--text-faint); margin: 0 2px; }

.inline-link {
  background: none; border: 0; padding: 0; color: var(--accent);
  cursor: pointer; font-size: inherit; text-decoration: underline;
  text-underline-offset: 3px;
}

/* ─────────── 表单 ─────────── */
.field { display: block; margin-bottom: 14px; }
.field > span {
  display: block; margin-bottom: 6px; font-size: 13px;
  color: var(--text-dim); font-weight: 500;
}
.field .req { color: var(--accent); }

/* 覆盖所有文本类输入框（number 之前被漏掉，导致白底浅灰字看不清） */
input:not([type="range"]):not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]),
textarea, select {
  width: 100%;
  padding: 10px 13px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 15px;
  transition: border-color .16s, box-shadow .16s;
  -webkit-appearance: none;
  appearance: none;
}
textarea { resize: vertical; min-height: 84px; line-height: 1.6; }
input::placeholder, textarea::placeholder { color: #5e5e5e; }
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
select {
  background-image: linear-gradient(45deg, transparent 50%, var(--text-dim) 50%),
                    linear-gradient(135deg, var(--text-dim) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 34px;
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.check {
  display: flex; align-items: flex-start; gap: 9px; cursor: pointer;
  padding: 10px 12px; border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm); background: var(--bg-elev);
}
.check input { width: 17px; height: 17px; margin: 3px 0 0; accent-color: var(--accent); flex: 0 0 auto; }
.check-text strong { display: block; font-size: 14px; font-weight: 550; }
.check-text small { color: var(--text-faint); font-size: 12px; }
.form-error { color: var(--danger); font-size: 13px; min-height: 20px; margin-top: 10px; text-align: center; }

/* ─────────── 卡片 ─────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 18px;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 16px; flex-wrap: wrap;
}
.card-title { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 9px; }
.pill {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 24px; height: 21px; padding: 0 8px;
  background: var(--accent-soft); color: var(--accent);
  border-radius: 999px; font-size: 12px; font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.hint { color: var(--text-faint); font-size: 12.5px; }

/* ─────────── Toast ─────────── */
.toast-wrap {
  position: fixed; z-index: 9000;
  left: 50%; bottom: calc(24px + var(--safe-b));
  transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none; width: min(92vw, 420px);
}
.toast {
  max-width: 100%;
  padding: 10px 18px; border-radius: 999px;
  background: #2b2b2b; color: var(--text);
  border: 1px solid #444;
  box-shadow: var(--shadow-sm);
  font-size: 14px; text-align: center;
  animation: toastIn .22s cubic-bezier(.2,.9,.3,1.2);
}
.toast.ok { border-color: rgba(95,185,138,.45); background: #1d2a22; }
.toast.err { border-color: rgba(226,104,95,.45); background: #2e1d1c; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px) scale(.96); } to { opacity: 1; } }

/* ─────────── Modal ─────────── */
.modal-root { position: relative; z-index: 8000; }
.modal-mask {
  position: fixed; inset: 0;
  background: rgba(6, 8, 11, .84);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; overflow-y: auto;
  animation: fadeIn .18s ease;
}
.modal {
  width: min(100%, 520px); margin: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  animation: modalIn .24s cubic-bezier(.2,.9,.3,1.05);
  max-height: calc(100vh - 40px);
  max-height: calc(100dvh - 40px);   /* iOS：dvh 才不含 Safari 工具栏 */
  display: flex; flex-direction: column;
}
.modal-head {
  padding: 20px 22px 0;
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
}
.modal-head h3 { font-size: 18px; }
.modal-head p { color: var(--text-dim); font-size: 13px; margin-top: 4px; }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-foot {
  padding: 0 22px 20px; display: flex; gap: 10px; justify-content: flex-end;
}
.modal-close {
  background: none; border: 0; color: var(--text-faint); font-size: 20px;
  cursor: pointer; line-height: 1; padding: 2px 4px; border-radius: 6px;
}
.modal-close:hover { color: var(--text); }
@keyframes modalIn { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ─────────── Spinner ─────────── */
.spinner {
  width: 30px; height: 30px; border-radius: 50%;
  border: 2.5px solid var(--border);
  border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 640px) {
  body { font-size: 14.5px; }
  .card { padding: 16px; border-radius: 12px; }
  .modal { border-radius: 18px; }
  .modal-mask { padding: 12px; padding-bottom: calc(12px + var(--safe-b)); align-items: flex-end; }
  .modal { width: 100%; max-height: calc(100vh - 24px - var(--safe-b)); max-height: calc(100dvh - 24px - var(--safe-b)); }
  .field-row { grid-template-columns: 1fr; gap: 0; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* ─────────── 照片水印 ─────────── */
.wm-layer {
  position: absolute; z-index: 3; pointer-events: none; overflow: hidden;
}
/* 自由定位：内缩一圈留白，水印按 X / Y 百分比摆放（0=最左/最上，100=最右/最下） */
.wm-inner { position: absolute; inset: 3.4%; }
.wm-item {
  position: absolute;
  left: calc(var(--wm-x, 96) * 1%);
  top: calc(var(--wm-y, 96) * 1%);
  transform: translate(calc(var(--wm-x, 96) * -1%), calc(var(--wm-y, 96) * -1%));
  opacity: var(--wm-opacity, .35);
  user-select: none; pointer-events: none;
}
.wm-text {
  color: #fff; font-weight: 600; line-height: 1.15;
  white-space: nowrap; letter-spacing: .02em;
  text-shadow: 0 1px 4px rgba(0, 0, 0, .55);
}
.wm-img {
  display: block; height: auto; max-width: none;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, .4));
  -webkit-user-drag: none;
}
/* 平铺整张 */
.wm-tile-wrap {
  position: absolute; inset: 0;
  display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(4, 1fr);
}
.wm-cell { display: flex; align-items: center; justify-content: center; overflow: hidden; }
.wm-cell .wm-item { position: static; transform: none; }

/* ─────────── 品牌字标 +- ─────────── */
.brand-logo-img { display: block; width: auto; max-width: none; object-fit: contain; }
.auth-logo .brand-logo-img { height: 42px; }
.brand-mark .brand-logo-img { height: 26px; }
.empty-art .brand-logo-img { height: 52px; }
.g-brand-name { letter-spacing: .07em; }
.g-foot-brand { margin-top: 5px; color: var(--text-faint); font-size: 11.5px; letter-spacing: .03em; }

/* ─────────── 图钉批注（共用） ─────────── */
.pin-mark {
  position: absolute; width: 24px; height: 24px; margin: -12px 0 0 -12px;
  border-radius: 50%; display: grid; place-items: center;
  background: var(--accent); color: #1a1a1a;
  font-size: 11.5px; font-weight: 700; line-height: 1;
  border: 2px solid rgba(255, 255, 255, .9);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .55);
  transition: transform .15s;
}
.pin-mark:hover { transform: scale(1.12); }
