: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, 'Noto Sans', 'Microsoft Yahei', sans-serif;
  background: var(--bg);
  color: #e2e8f0;
}
.site-header, .site-footer {
  text-align: center;
  padding: 20px;
}
.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;
}
.site-footer .links {
  margin-top: 10px;
  display: inline-flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
}
.site-footer .links a {
  color: var(--muted);
  text-decoration: none;
}
.site-footer .links a:hover {
  text-decoration: underline;
}
.site-footer .links {
  margin-top: 10px;
  display: inline-flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
}
.site-footer .links a {
  color: var(--muted);
  text-decoration: none;
}
.site-footer .links a:hover {
  text-decoration: underline;
}
.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;
  justify-self: center;
}
.lang-switch {
  min-width: 180px;
}
.header-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  grid-column: 3;
  justify-self: end;
}
.lang-switch.field {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}
.lang-switch.field span {
  white-space: nowrap;
}
.header-actions .select {
  width: auto;
  min-width: 140px;
}
.lang-switch.field {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}
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 { width: 100%; }
.actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  grid-column: 1 / -1;
  flex-wrap: wrap;
}
.preview {
  display: grid;
  place-items: center;
  border: 1px dashed #334155;
  border-radius: 12px;
  padding: 12px;
  background: #0b1220;
}
canvas {
  max-width: 100%;
  height: auto;
  background: #0b1220;
}
/* Buttons */
.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: white;
}
.btn.primary:hover { background: var(--accent-hover); }
.btn:hover { border-color: var(--dash); }

/* Select */
.select {
  appearance: none;
  background: #0b1220;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  color: #e2e8f0;
}

/* Range slider */
.slider {
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent) 50%, #0b1220 50%);
  outline: none;
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid white;
  cursor: pointer;
}
.slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid white;
  cursor: pointer;
}

/* File upload */
.file-upload .file-button {
  display: flex;
  gap: 10px;
  align-items: center;
}
.file-upload .file-name {
  font-size: 12px;
  color: var(--muted);
}

/* Checkboxes */
.checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
}
.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #0b1220;
}
.checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

/* Collapsible panel */
.panel {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #0b1220;
  overflow: hidden;
}
.panel summary {
  list-style: none;
  cursor: pointer;
  padding: 10px 12px;
  font-weight: 600;
  color: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.panel summary::after {
  content: '▸';
  color: var(--muted);
  transition: transform 0.2s ease;
}
.panel[open] summary::after {
  transform: rotate(90deg);
}
.panel .panel-body {
  border-top: 1px dashed var(--dash);
  padding: 12px;
}
