/* ===== PicID 样式 —— 简约专业 · 墨蓝系 ===== */

:root {
  /* 色板 */
  --ink: #0f1f33;            /* 主文字 / 深墨蓝 */
  --ink-soft: #43536b;       /* 次级文字 */
  --ink-mute: #8896a8;       /* 提示文字 */
  --accent: #1c5bb8;         /* 主色：渐变蓝 */
  --accent-deep: #13407d;    /* 主色深 */
  --accent-soft: #e8f0fb;    /* 主色浅底 */
  --line: #e3e8ef;           /* 分割线 */
  --line-strong: #c9d3e0;
  --bg: #f6f8fc;             /* 页面背景 */
  --surface: #ffffff;        /* 卡片背景 */
  --danger: #d23b3b;
  --ok: #1f9d6a;
  --shadow-sm: 0 1px 2px rgba(15, 31, 51, 0.04), 0 1px 3px rgba(15, 31, 51, 0.06);
  --shadow-md: 0 4px 16px rgba(15, 31, 51, 0.08);
  --shadow-lg: 0 12px 40px rgba(15, 31, 51, 0.14);
  --radius: 14px;
  --radius-sm: 9px;

  /* 字体：英文用 Inter，中文优先 Noto Sans SC；显示字用 Serif 变体 */
  --font-body: 'Inter', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'PingFang SC',
    'Microsoft YaHei', sans-serif;
  --font-display: 'Noto Serif SC', 'Songti SC', serif;
}

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

html,
body {
  height: 100%;
}

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

/* 背景纹理：极淡的网格 + 渐变光晕，营造专业感而非花哨 */
.bg-grain {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(28, 91, 184, 0.10), transparent 60%),
    radial-gradient(700px 500px at -5% 110%, rgba(19, 64, 125, 0.08), transparent 55%);
}
.bg-grain::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(15, 31, 51, 0.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 31, 51, 0.022) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: radial-gradient(circle at 50% 30%, black, transparent 90%);
}

/* ===== 顶栏 ===== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(12px);
  background: rgba(255, 255, 255, 0.82);
  border-bottom: 1px solid var(--line);
}
.topbar__inner {
  max-width: 1320px;
  margin: 0 auto;
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.topbar__right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.lang-switch {
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.4px;
  color: var(--ink-soft);
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 7px 13px;
  border-radius: 100px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  min-width: 44px;
}
.lang-switch:hover {
  color: var(--accent);
  border-color: var(--line-strong);
  background: var(--accent-soft);
}
.lang-switch:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand__mark {
  color: var(--accent);
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  background: var(--accent-soft);
  border-radius: 12px;
}
.brand__text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}
.brand__name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: 0.5px;
  color: var(--ink);
}
.brand__sub {
  font-size: 12px;
  color: var(--ink-mute);
  letter-spacing: 1px;
}
.topbar__badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--ink-soft);
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 7px 13px;
  border-radius: 100px;
  box-shadow: var(--shadow-sm);
}
.topbar__badge .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(31, 157, 106, 0.18);
  animation: pulse 2.2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

/* ===== 三栏布局 ===== */
.layout {
  position: relative;
  z-index: 1;
  max-width: 1320px;
  margin: 0 auto;
  padding: 26px 28px 60px;
  display: grid;
  grid-template-columns: 320px 1fr 320px;
  gap: 22px;
  align-items: start;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}

/* ===== 上传区（合并到中栏的 placeholder） ===== */
.placeholder--dropzone {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 360px;
  border: 1.8px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, #fbfcfe, #f4f7fc);
  color: var(--ink-soft);
  cursor: pointer;
  text-align: center;
  padding: 24px 18px;
  transition: border-color 0.18s, background 0.18s, transform 0.18s;
}
.placeholder--dropzone:hover,
.placeholder--dropzone:focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-deep);
  outline: none;
}
.placeholder--dropzone.placeholder--drag,
.placeholder--dropzone.dropzone--drag {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: scale(1.01);
}
.placeholder--dropzone .placeholder__frame {
  width: 110px;
  height: 145px;
  border: none;
  background: none;
}
.placeholder--dropzone .placeholder__silhouette {
  width: 100%;
  height: 100%;
  color: var(--line-strong);
  transition: color 0.18s;
}
.placeholder--dropzone:hover .placeholder__silhouette,
.placeholder--dropzone:focus-visible .placeholder__silhouette,
.placeholder--dropzone.placeholder--drag .placeholder__silhouette {
  color: var(--accent);
}
.placeholder--dropzone .placeholder__text {
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
}
.placeholder--dropzone .placeholder__sub {
  font-size: 12.5px;
  color: var(--ink-mute);
  margin-top: -4px;
}

/* ===== 分组 ===== */
.group {
  margin-top: 22px;
}
.group:first-child {
  margin-top: 0;
}
.group__title {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-soft);
  letter-spacing: 1px;
  margin-bottom: 12px;
  text-transform: uppercase;
  position: relative;
  padding-left: 10px;
}
.group__title::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 13px;
  background: var(--accent);
  border-radius: 2px;
}

/* ===== 尺寸规格 chips ===== */
.chips {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.chip {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 10px 6px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  transition: all 0.16s;
}
.chip:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}
.chip--active {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 3px rgba(28, 91, 184, 0.12);
}
.chip__name {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}
.chip__desc {
  font-size: 11px;
  color: var(--ink-mute);
}

/* ===== 背景色 swatches ===== */
.swatches {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}
.swatch {
  appearance: none;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 1px var(--line), var(--shadow-sm);
  background: var(--swatch-color, #fff);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  padding: 0;
}
.swatch:hover {
  transform: scale(1.1);
}
.swatch--active {
  box-shadow: 0 0 0 2px var(--accent), 0 0 0 4px rgba(28, 91, 184, 0.2);
  transform: scale(1.08);
}
.custom-color {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  font-size: 13px;
  color: var(--ink-soft);
}
.custom-color input[type='color'] {
  width: 44px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: none;
  cursor: pointer;
  padding: 2px;
}

/* ===== 预览区 ===== */
.panel--center {
  display: flex;
  flex-direction: column;
  min-height: 560px;
}
.preview-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 18px;
}
.preview-head__title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
}
.preview-head__hint {
  font-size: 12.5px;
  color: var(--ink-mute);
}

.preview-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    repeating-conic-gradient(#eef2f7 0% 25%, #ffffff 0% 50%) 0 0 / 22px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 26px;
  min-height: 360px;
  position: relative;
}
.preview-wrap::after {
  content: '';
  position: absolute;
  inset: 10px;
  border: 1px dashed rgba(15, 31, 51, 0.12);
  border-radius: 6px;
  pointer-events: none;
}
.preview-canvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
  border-radius: 4px;
  box-shadow: var(--shadow-md);
  touch-action: none;
  position: relative;
  z-index: 1;
}

/* 占位区基础样式 —— 保留作为 fallback（当前未使用） */
.placeholder {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  min-height: 360px;
  color: var(--ink-mute);
}

/* ===== 按钮 ===== */
.actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}
.btn {
  appearance: none;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  padding: 11px 18px;
  cursor: pointer;
  transition: all 0.16s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.btn--primary {
  background: linear-gradient(180deg, var(--accent), var(--accent-deep));
  color: #fff;
  box-shadow: 0 2px 8px rgba(19, 64, 125, 0.28);
}
.btn--primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(19, 64, 125, 0.38);
}
.btn--ghost {
  background: var(--surface);
  color: var(--ink-soft);
  border-color: var(--line-strong);
}
.btn--ghost:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent-deep);
  background: var(--accent-soft);
}
.btn--block {
  width: 100%;
  margin-top: 10px;
}
.btn[data-state='loading'] {
  pointer-events: none;
  position: relative;
}
.btn[data-state='loading']::before {
  content: '';
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== 滑块 ===== */
.transform-controls {
  display: grid;
  gap: 12px;
}
.slider-row {
  display: grid;
  grid-template-columns: 48px 1fr;
  align-items: center;
  gap: 12px;
}
.slider-row label {
  font-size: 13px;
  color: var(--ink-soft);
}
input[type='range'] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: var(--line);
  border-radius: 2px;
  outline: none;
}
input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #fff;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 0.12s;
}
input[type='range']::-webkit-slider-thumb:hover {
  transform: scale(1.18);
}
input[type='range']::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #fff;
  cursor: pointer;
}

/* ===== 右栏字段 ===== */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--ink-soft);
  margin-top: 12px;
}
.field--inline {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}
.field select {
  appearance: none;
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
  padding: 9px 32px 9px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface)
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path d='M2 4l4 4 4-4' fill='none' stroke='%2343536b' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/></svg>")
    no-repeat right 10px center;
  cursor: pointer;
}
.field--inline input[type='checkbox'] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}
.layout-info {
  margin-top: 12px;
  padding: 10px 12px;
  font-size: 13px;
  color: var(--accent-deep);
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
  text-align: center;
}

/* ===== 提示卡片 ===== */
.tips {
  margin-top: 22px;
  padding: 16px;
  background: #fbfcfe;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.tips h4 {
  font-size: 13px;
  color: var(--ink-soft);
  margin-bottom: 8px;
}
.tips ul {
  list-style: none;
  display: grid;
  gap: 6px;
}
.tips li {
  font-size: 12.5px;
  color: var(--ink-mute);
  padding-left: 16px;
  position: relative;
  line-height: 1.55;
}
.tips li::before {
  content: '';
  position: absolute;
  left: 2px;
  top: 8px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

/* ===== 加载遮罩 ===== */
.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(15, 31, 51, 0.42);
  backdrop-filter: blur(3px);
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
  color: #fff;
}
.loading-overlay.overlay--show {
  display: flex;
}
.spinner {
  width: 42px;
  height: 42px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.loading-text {
  font-size: 14px;
  letter-spacing: 0.5px;
}

/* ===== Toast ===== */
.toast-host {
  position: fixed;
  top: 76px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  pointer-events: none;
}
.toast {
  padding: 11px 20px;
  border-radius: 100px;
  font-size: 13.5px;
  font-weight: 500;
  color: #fff;
  background: var(--ink);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(-12px);
  transition: opacity 0.25s, transform 0.25s;
}
.toast--show {
  opacity: 1;
  transform: translateY(0);
}
.toast--error {
  background: var(--danger);
}
.toast--success {
  background: var(--ok);
}

/* ===== 响应式 ===== */
@media (max-width: 1080px) {
  .layout {
    grid-template-columns: 1fr 1fr;
  }
  .panel--center {
    grid-column: 1 / -1;
    order: -1;
    min-height: auto;
  }
}
@media (max-width: 720px) {
  .topbar__inner,
  .layout {
    padding-left: 16px;
    padding-right: 16px;
  }
  .layout {
    grid-template-columns: 1fr;
    padding-top: 16px;
  }
  .panel {
    padding: 18px;
  }
  .chips {
    grid-template-columns: repeat(3, 1fr);
  }
  .swatches {
    grid-template-columns: repeat(6, 1fr);
  }
  .topbar__badge {
    display: none;
  }
  .preview-wrap {
    min-height: 300px;
  }
}

/* 减弱动画偏好 */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
