:root {
  color-scheme: light dark;
  --bg: #0f172a;
  --panel: #111827;
  --border: #1f2937;
  --muted: #9ca3af;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --dash: #334155;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, 'Microsoft Yahei', sans-serif;
  background: var(--bg); color: #e2e8f0;
}
.site-header, .site-footer { text-align: center; padding: 20px; }
.header-bar { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: center; justify-items: center; }
.header-bar h1 { margin: 0; grid-column: 2; }
.header-actions { grid-column: 3; justify-self: end; display: flex; gap: 12px; align-items: center; }
.lang-switch.field { flex-direction: row; align-items: center; gap: 8px; }
.lang-switch.field span { white-space: nowrap; color: var(--muted); }
main { max-width: 920px; margin: 0 auto; padding: 24px; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 24px; box-shadow: 0 8px 24px rgba(0,0,0,0.3); }
.controls { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; align-items: end; margin-bottom: 16px; }
.span-4 { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field span { font-size: 14px; color: var(--muted); }
.select, .slider, .input { width: 100%; }
.input {
  appearance: none;
  background: #0b1220;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  color: #e2e8f0;
}
.input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.select { appearance: none; background: #0b1220; border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; color: #e2e8f0; }
.header-actions .select { width: auto; min-width: 140px; }
.actions { display: flex; gap: 10px; justify-content: flex-end; grid-column: 1 / -1; flex-wrap: wrap; align-items: center; }
.preview { display: grid; place-items: center; border: 1px dashed var(--dash); border-radius: 12px; padding: 12px; background: #0b1220; position: relative; }
canvas { max-width: 100%; height: auto; background: #0b1220; }
.btn { display: inline-flex; align-items: center; justify-content: center; padding: 10px 16px; border-radius: 8px; border: 1px solid var(--border); background: #0b1220; color: #e2e8f0; cursor: pointer; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); }
.btn:hover { border-color: var(--dash); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; border-color: var(--border); }
.site-footer .legal { margin-top: 8px; display: grid; gap: 4px; justify-items: center; color: var(--muted); font-size: 12px; }
.site-footer .legal a { color: var(--muted); text-decoration: none; }
.site-footer .legal a:hover { text-decoration: underline; }
@media (max-width: 768px) {
  .controls { grid-template-columns: 1fr 1fr; }
}
.color-picker { display: flex; align-items: center; gap: 8px; }
.color-dot { width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--border); box-shadow: 0 0 0 1px rgba(255,255,255,0.05) inset; }
.color-dot { cursor: pointer; outline: none; }
.color-dot:focus { box-shadow: 0 0 0 2px var(--accent); }
.color-dot { display: none; }
/* 让颜色输入条展示当前颜色为整条色块 */
.color-picker input[type="color"].input {
  appearance: none;
  padding: 0;
  height: 14px;
  border-radius: 8px;
  background: transparent;
}
.color-picker input[type="color"].input::-webkit-color-swatch-wrapper { padding: 0; }
.color-picker input[type="color"].input::-webkit-color-swatch {
  border: none;
  border-radius: 6px;
}
