:root {
  /* 主题色(默认:罗兰紫) */
  --accent: #6c5ce7;
  --accent-2: #a55eea;
  --accent-3: #e05fa4;

  /* 中性色(日间) */
  --bg: #f5f6fb;
  --card: #ffffff;
  --ink: #232838;
  --muted: #8a90a2;
  --line: #e8eaf2;
  --surface: #fafbfe;
  --btn-bg: #ffffff;
  --track: #e6e8f2;
  --tint: #eeebff;
  --tint-border: #d6d0ff;
  --ok: #1fa87a;
  --ok-bg: #e4f7ee;
  --warn: #d98a00;
  --warn-bg: #fff4e2;
  --error: #d64545;
  --error-bg: #fdecec;
  --radius: 18px;
  --shadow: 0 2px 14px rgba(35, 40, 70, 0.06);
}

/* ---------- 主题色 ---------- */
[data-theme="blue"]   { --accent: #3b82f6; --accent-2: #6366f1; --accent-3: #06b6d4; }
[data-theme="green"]  { --accent: #10b981; --accent-2: #059669; --accent-3: #84cc16; }
[data-theme="orange"] { --accent: #f97316; --accent-2: #f59e0b; --accent-3: #ef4444; }
[data-theme="pink"]   { --accent: #ec4899; --accent-2: #d946ef; --accent-3: #f43f5e; }

/* ---------- 夜间模式 ---------- */
[data-mode="dark"] {
  --bg: #14161d;
  --card: #1e2129;
  --ink: #e9ebf2;
  --muted: #98a0b3;
  --line: #30343f;
  --surface: #242834;
  --btn-bg: #262a35;
  --track: #343945;
  --tint: rgba(255, 255, 255, 0.07);
  --tint-border: rgba(255, 255, 255, 0.14);
  --ok: #34c48c;
  --ok-bg: rgba(52, 196, 140, 0.14);
  --warn: #e5a13c;
  --warn-bg: rgba(229, 161, 60, 0.14);
  --error: #e06c6c;
  --error-bg: rgba(224, 108, 108, 0.14);
  --shadow: 0 2px 14px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  transition: background 0.25s, color 0.25s;
}

.page { max-width: 1720px; margin: 0 auto; }

/* ---------- 顶部品牌栏 ---------- */
.topbar {
  padding: 20px 24px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo-icon { width: 46px; height: 46px; display: block; }
.brand h1 { margin: 0; font-size: 26px; letter-spacing: 0.2px; font-weight: 700; }

.topbar-actions { display: flex; align-items: center; gap: 10px; }

.about-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--btn-bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: border-color 0.15s, color 0.15s, background 0.25s;
}
.about-btn:hover { border-color: var(--accent); color: var(--accent); }
.about-dot {
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-style: normal;
}

/* ---------- 主题切换 ---------- */
.theme-switcher { position: relative; }
.theme-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 60;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 10px 32px rgba(20, 24, 36, 0.16);
  padding: 14px 16px;
  width: 208px;
}
.theme-menu-title {
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 8px;
}
.theme-menu-title:not(:first-child) { margin-top: 12px; }
.theme-dots { display: flex; gap: 9px; }
.theme-dot {
  width: 24px; height: 24px;
  border-radius: 50%;
  border: 2px solid transparent;
  background: var(--dot);
  cursor: pointer;
  padding: 0;
  transition: transform 0.12s;
}
.theme-dot:hover { transform: scale(1.15); }
.theme-dot.active { border-color: var(--card); box-shadow: 0 0 0 2px var(--dot); }
.mode-toggle {
  display: flex;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 4px;
}
.mode-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 6px 0;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.mode-btn.active {
  background: var(--card);
  color: var(--accent);
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(20, 24, 36, 0.12);
}

/* ---------- 布局 ---------- */
.layout {
  display: flex;
  gap: 20px;
  padding: 0 24px 32px;
  align-items: flex-start;
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  transition: background 0.25s, border-color 0.25s;
}

.col-left {
  width: 400px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.left { width: 100%; }
.right { flex: 1; min-width: 0; }

/* ---------- 步骤块 ---------- */
.step { margin-bottom: 24px; }
.step-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.step-num {
  width: 30px; height: 30px;
  flex-shrink: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.step-head h2 { margin: 0; font-size: 17px; }
.step-head p { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }

/* ---------- 上传区 ---------- */
.dropzone {
  border: 2px dashed var(--tint-border);
  border-radius: 14px;
  padding: 30px 18px;
  text-align: center;
  color: var(--muted);
  cursor: pointer;
  background: var(--surface);
  transition: border-color 0.15s, background 0.15s;
}
.dropzone:hover, .dropzone.dragging {
  border-color: var(--accent);
  background: var(--tint);
}
.dz-icon {
  width: 40px; height: 40px;
  color: var(--accent);
  background: var(--tint);
  border-radius: 12px;
  padding: 8px;
  margin-bottom: 12px;
}
.dz-title { font-size: 14px; color: var(--ink); font-weight: 600; }
.dz-sub { font-size: 12px; color: var(--muted); margin-top: 5px; }
.dropzone img {
  max-width: 100%;
  max-height: 240px;
  border-radius: 10px;
  display: block;
  margin: 0 auto;
}

/* ---------- 参数 ---------- */
.params label { display: block; margin-bottom: 16px; font-size: 14px; }
.range-row { display: flex; justify-content: space-between; margin-bottom: 8px; }
.range-row output { color: var(--ink); font-weight: 600; }

input[type="range"] {
  width: 100%;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--track);
  border-radius: 999px;
  outline: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--card);
  box-shadow: 0 1px 5px rgba(20, 24, 36, 0.35);
  cursor: pointer;
  transition: background 0.25s;
}
input[type="range"]::-moz-range-thumb {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--card);
  box-shadow: 0 1px 5px rgba(20, 24, 36, 0.35);
  cursor: pointer;
  transition: background 0.25s;
}
input[type="range"]:disabled::-webkit-slider-thumb { background: #b9bdd0; box-shadow: none; }
input[type="range"]:disabled::-moz-range-thumb { background: #b9bdd0; box-shadow: none; }
input[type="range"]:disabled { cursor: not-allowed; }

.param-hint { font-size: 12px; color: var(--muted); margin: 6px 0 0; line-height: 1.6; }
.params label.disabled { opacity: 0.55; }

/* 更多选项 */
.more-options {
  border-top: 1px solid var(--line);
  padding-top: 4px;
  margin-top: 4px;
}
.more-options summary {
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 2px;
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}
.more-options summary::-webkit-details-marker { display: none; }
.more-options summary:hover { color: var(--ink); }
.more-options .chev { width: 16px; height: 16px; transition: transform 0.18s; }
.more-options[open] .chev { transform: rotate(180deg); }
.more-body { padding: 6px 0 4px; }

select, input[type="number"], input[type="text"] {
  width: 100%;
  padding: 9px 11px;
  margin-top: 5px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--btn-bg);
  font-size: 14px;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s, background 0.25s;
}
select:focus, input[type="number"]:focus, input[type="text"]:focus { border-color: var(--accent); }

.pure-options {
  border-top: 1px dashed var(--line);
  padding-top: 12px;
  margin-top: 2px;
}
.pure-note { font-size: 12px; color: var(--muted); margin: 0 0 12px; }
.pure-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.check { display: flex !important; align-items: center; gap: 8px; cursor: pointer; margin-bottom: 12px !important; }
.check input { accent-color: var(--accent); width: 15px; height: 15px; }

/* ---------- 按钮 ---------- */
.btn {
  padding: 9px 16px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--btn-bg);
  font-size: 14px;
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, filter 0.15s, background 0.25s;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn.ghost { width: 100%; margin-top: 4px; color: var(--muted); }

.btn.generate {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 14px;
  border: none;
  border-radius: 13px;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(100deg, var(--accent) 0%, var(--accent-2) 55%, var(--accent-3) 100%);
  box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 35%, transparent);
  transition: filter 0.15s, transform 0.1s;
}
.btn.generate:hover { filter: brightness(1.06); color: #fff; }
.btn.generate:active { transform: scale(0.985); }

/* ---------- 状态横幅 ---------- */
.status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  margin-bottom: 20px;
  background: var(--surface);
  color: var(--muted);
  min-height: 20px;
}
.status.ok { background: var(--ok-bg); color: var(--ok); font-weight: 600; }
.status.ok::before {
  content: "✓";
  flex-shrink: 0;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--ok);
  color: #fff;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.status.warn { background: var(--warn-bg); color: var(--warn); }
.status.error { background: var(--error-bg); color: var(--error); }

/* ---------- 右侧内容 ---------- */
.right h2 { font-size: 16px; margin: 4px 0 12px; }

.card-wrap {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 22px;
  transition: background 0.25s, border-color 0.25s;
}
.card-wrap img { width: 100%; border-radius: 10px; display: block; }

/* ---------- 颜色列表(卡片式) ---------- */
.color-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
  gap: 14px;
  margin-bottom: 8px;
}
.color-card { text-align: left; }
.cc-swatch {
  width: 100%;
  height: 74px;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  cursor: pointer;
  font-size: 14px;
  padding: 0;
  display: block;
  transition: transform 0.12s;
}
.cc-swatch:hover { transform: translateY(-2px); }
.cc-swatch.locked { outline: 2px solid var(--accent); outline-offset: 2px; }
.cc-hex {
  margin-top: 7px;
  font-weight: 700;
  font-size: 13.5px;
  font-family: "Consolas", "Courier New", monospace;
  cursor: pointer;
}
.cc-hex:hover { color: var(--accent); }
.cc-rgb { font-size: 11.5px; color: var(--muted); margin-top: 2px; font-family: "Consolas", "Courier New", monospace; }
.hint { color: var(--muted); font-weight: 400; font-size: 12px; }

/* ---------- 导出卡片(左栏下方) ---------- */
.export-card { padding: 22px 24px; }
.export-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 16px;
}
.export-label svg { color: var(--accent); }

.actions.export {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.export-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px 10px 10px;
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 1px 6px rgba(35, 40, 70, 0.05);
}
.export-btn:hover { box-shadow: 0 3px 12px color-mix(in srgb, var(--accent) 20%, transparent); }
.exp-ico {
  width: 38px; height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.exp-ico svg { width: 19px; height: 19px; }
.ico-purple { background: color-mix(in srgb, #6c5ce7 13%, transparent); color: #6c5ce7; }
.ico-green  { background: color-mix(in srgb, #17a06c 13%, transparent); color: #17a06c; }
.ico-blue   { background: color-mix(in srgb, #3b82f6 13%, transparent); color: #3b82f6; }
.ico-orange { background: color-mix(in srgb, #e08a2d 15%, transparent); color: #e08a2d; }
.exp-text { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.35; }
.exp-text b { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.exp-text i { font-style: normal; font-size: 11.5px; color: var(--muted); }

/* ---------- 关于弹窗 ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 24, 36, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  width: min(680px, 100%);
  max-height: 82vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(20, 24, 36, 0.25);
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}
.modal-head h2 { margin: 0; font-size: 18px; }
.modal-close {
  background: none;
  border: none;
  font-size: 18px;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
}
.modal-close:hover { background: var(--surface); color: var(--ink); }
.tabs {
  display: flex;
  gap: 4px;
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
}
.tab {
  padding: 11px 14px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 14px;
  color: var(--muted);
  border-bottom: 2px solid transparent;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.modal-body {
  padding: 16px 22px 22px;
  overflow-y: auto;
  font-size: 14px;
  line-height: 1.75;
  color: var(--ink);
}
.modal-body h3 { font-size: 15px; margin: 18px 0 8px; }
.modal-body ol, .modal-body ul { margin: 0 0 10px; padding-left: 22px; }
.about-note { color: var(--muted); font-size: 13px; }
.ai-badge {
  display: inline-block;
  background: var(--tint);
  color: var(--accent);
  border: 1px solid var(--tint-border);
  border-radius: 999px;
  font-size: 11px;
  padding: 1px 8px;
  margin-right: 6px;
  vertical-align: 1px;
}
.contact-list { list-style: none; padding-left: 0; margin: 8px 0 0; }
.contact-list li { padding: 4px 0; }
.contact-list a { color: var(--accent); text-decoration: none; word-break: break-all; }
.contact-list a:hover { text-decoration: underline; }

/* ---------- 响应式 ---------- */
@media (max-width: 980px) {
  .layout { flex-direction: column; }
  .col-left { width: 100%; }
}

/* ---------- 标题编辑(全布局通用) ---------- */
.title-options {
  border-top: 1px dashed var(--line);
  padding-top: 12px;
  margin-top: 2px;
  margin-bottom: 4px;
}

/* 保证 hidden 属性始终生效(避免被组件 display 样式覆盖) */
[hidden] { display: none !important; }

/* ---------- 移动端汉堡菜单 ---------- */
.hamburger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--btn-bg);
  border: 1px solid var(--line);
  color: var(--ink);
  cursor: pointer;
  box-shadow: var(--shadow);
  flex-shrink: 0;
}

.mobile-menu-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(18, 20, 34, 0.38);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  justify-content: flex-end;
}
.mobile-menu-overlay[hidden] { display: none; }

.mobile-menu-panel {
  width: min(320px, 86vw);
  height: 100%;
  background: var(--card);
  border-left: 1px solid var(--line);
  padding: 20px 20px 30px;
  overflow-y: auto;
  animation: mSlideIn 0.22s ease;
}
@keyframes mSlideIn {
  from { transform: translateX(48px); opacity: 0; }
  to { transform: none; opacity: 1; }
}
.mobile-menu-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 18px;
}
.mobile-menu-close {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--btn-bg);
  color: var(--ink);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}
.mobile-menu-panel .theme-dots { gap: 12px; margin-bottom: 2px; }
.mobile-menu-panel .theme-dot { width: 32px; height: 32px; }
.mobile-menu-panel .mode-toggle { width: 100%; }
.mobile-menu-panel .mode-btn { padding: 9px 0; font-size: 14px; }
.mobile-menu-divider { height: 1px; background: var(--line); margin: 20px 0; }
.mobile-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 14px 15px;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  font-size: 15px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.mobile-menu-item:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- 移动端适配(小屏) ---------- */
@media (max-width: 768px) {
  .topbar { padding: 14px 16px 10px; }
  .logo-icon { width: 38px; height: 38px; }
  .brand { gap: 10px; }
  .brand h1 { font-size: 19px; }
  .layout { padding: 0 14px 24px; }
  /* 隐藏桌面三按钮,显示汉堡按钮 */
  .topbar-actions > .theme-switcher,
  .topbar-actions > #usageBtn,
  .topbar-actions > #aboutBtn { display: none; }
  .hamburger { display: inline-flex; }
}
