:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --panel: #ffffff;
  --text: #1f2937;
  --muted: #5a6474;
  --accent: #0d9488;
  --accent-hover: #0f766e;
  --line: #dbe3ef;
  --shadow: 0 12px 30px rgba(10, 25, 47, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top right, rgba(13, 148, 136, 0.09), transparent 45%),
    radial-gradient(circle at bottom left, rgba(37, 99, 235, 0.08), transparent 45%),
    var(--bg);
  color: var(--text);
  font-family: "SF Pro Display", "Segoe UI", "PingFang SC", "Noto Sans SC", sans-serif;
}

.layout {
  max-width: 1280px;
  margin: 0 auto;
  padding: 22px;
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr);
  gap: 18px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.controls {
  padding: 20px;
  max-height: calc(100vh - 44px);
  overflow: auto;
}

h1 {
  font-size: 1.35rem;
  margin: 0;
}

.subtitle {
  color: var(--muted);
  margin: 8px 0 18px;
  line-height: 1.45;
}

.field {
  display: block;
  margin-bottom: 12px;
}

.field.compact {
  margin-bottom: 8px;
}

.field span {
  display: block;
  margin-bottom: 6px;
  font-size: 0.9rem;
}

input[type="file"],
select,
input[type="number"],
input[type="range"],
input[type="color"] {
  width: 100%;
}

input[type="file"],
select,
input[type="number"],
input[type="color"] {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 8px 10px;
  color: var(--text);
}

.group {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 10px 6px;
  margin: 10px 0;
}

.group legend {
  color: var(--muted);
  font-size: 0.86rem;
  padding: 0 6px;
}

.hidden {
  display: none;
}

.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.actions-editor {
  margin-top: 8px;
  margin-bottom: 8px;
}

button {
  border: none;
  border-radius: 10px;
  padding: 10px 12px;
  font-weight: 600;
  cursor: pointer;
  color: #fff;
  background: var(--accent);
  transition: background 0.2s ease, transform 0.2s ease;
}

button:hover:not(:disabled) {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.status {
  margin-top: 12px;
  padding: 10px;
  border-radius: 10px;
  background: #edfdfb;
  color: #0f766e;
  font-size: 0.9rem;
  line-height: 1.4;
}

.previews {
  padding: 16px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.preview-block {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  min-height: 280px;
  display: flex;
  flex-direction: column;
}

h2 {
  margin: 0 0 8px;
  font-size: 1rem;
}

#sourceCanvas,
.svg-preview {
  width: 100%;
  flex: 1;
  border-radius: 8px;
  border: 1px dashed #c7d2e6;
  background:
    linear-gradient(45deg, #f8fafc 25%, #eef2f7 25%, #eef2f7 50%, #f8fafc 50%, #f8fafc 75%, #eef2f7 75%, #eef2f7);
  background-size: 16px 16px;
}

#sourceCanvas {
  height: auto;
  image-rendering: pixelated;
}

.svg-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #7b8797;
  overflow: auto;
  position: relative;
}

.svg-preview svg,
.svg-preview canvas {
  max-width: 100%;
  height: auto;
  display: block;
  background: #fff;
}

.svg-preview svg {
  touch-action: none;
}

.hint {
  margin: 8px 0 4px;
  font-size: 0.84rem;
  color: var(--muted);
  line-height: 1.35;
}

.compat-hidden {
  display: none;
}

@media (max-width: 1080px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .controls {
    max-height: none;
  }

  .previews {
    grid-template-columns: 1fr;
  }
}
