:root {
  --bg: #0d0d0c;
  --panel: #191918;
  --panel-2: #111110;
  --line: #2b2b29;
  --text: #ededdf;
  --muted: #8d8d84;
  --accent: #6ab294;
  --accent-2: #e4c46d;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 50% -30%, rgba(106, 178, 148, .12), transparent 36rem),
    var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", Arial, sans-serif;
}

button, input, select, textarea { font: inherit; }

.wrap {
  width: min(1880px, calc(100vw - 12px));
  margin: 0 auto;
  padding: 14px 0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 12px;
}

h1 {
  margin: 0 0 6px;
  font-size: 24px;
  line-height: 1;
  letter-spacing: .01em;
}

p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .03em;
}

.inline-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.inline-actions {
  margin-bottom: 11px;
}

.watermark-actions {
  margin-top: -4px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  width: auto;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #141413;
}

.multi-toggle {
  position: relative;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: .04em;
  cursor: pointer;
}

.multi-toggle input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
}

.switch-track {
  position: relative;
  width: 34px;
  height: 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #0f0f0e;
}

.switch-track span {
  position: absolute;
  left: 3px;
  top: 3px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform .16s ease, background .16s ease;
}

.multi-toggle input:checked + .switch-track {
  background: var(--accent);
  border-color: var(--accent);
}

.multi-toggle input:checked + .switch-track span {
  transform: translateX(15px);
  background: #08130f;
}

.layout {
  display: grid;
  grid-template-columns: minmax(205px, 286px) minmax(215px, 300px) minmax(260px, 1fr);
  gap: 12px;
  align-items: stretch;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255,255,255,.025), transparent), var(--panel);
  padding: 14px;
  box-shadow: 0 20px 70px rgba(0,0,0,.22);
}

.panel h2 {
  margin: 0 0 10px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .2em;
}

label, .label-text, .field {
  display: block;
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: .04em;
}

.field-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.field-label-row.label-text {
  margin-bottom: 9px;
}

.label-actions {
  display: flex;
  gap: 6px;
}

input, select, textarea {
  width: 100%;
  margin-top: 5px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel-2);
  color: var(--text);
  outline: none;
}

input, select {
  height: 34px;
  padding: 0 10px;
  font-size: 13px;
}

textarea {
  min-height: 62px;
  resize: vertical;
  padding: 9px 10px;
  line-height: 1.42;
  font-size: 13px;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(106, 178, 148, .13);
}

input[type="range"] {
  height: 24px;
  padding: 0;
  accent-color: var(--accent);
}

.hint {
  display: block;
  margin-top: 6px;
  color: #686860;
  font-size: 11px;
  line-height: 1.5;
}

button {
  min-height: 34px;
  border-radius: 9px;
  cursor: pointer;
}

.tiny-random {
  display: inline-grid;
  place-items: center;
  min-width: 26px;
  min-height: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #121211;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}

.tiny-random svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}

.tiny-random circle {
  fill: currentColor;
  stroke: none;
}

.primary {
  width: 100%;
  margin-top: 12px;
  margin-bottom: 10px;
  border: 0;
  background: var(--accent);
  color: #07110e;
  font-size: 14px;
  font-weight: 800;
}

.ghost {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  min-height: 32px;
}

.ghost:hover,
.multi-toggle:hover,
.tiny-random:hover {
  border-color: #44443f;
  background-color: rgba(255,255,255,.03);
}

.palette-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.swatch {
  position: relative;
  height: 36px;
  border: 2px solid transparent;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
}

.swatch.active { border-color: var(--accent); }

.swatch b {
  position: absolute;
  left: 8px;
  bottom: 7px;
  color: white;
  font-size: 9px;
  text-shadow: 0 1px 3px #000;
}

.preview-panel {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.preview-head,
.batch-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  color: var(--muted);
}

.preview-head h2 {
  flex: 1;
  margin-bottom: 14px;
}

.preview-head span,
.batch-head {
  font-size: 12px;
  letter-spacing: .04em;
}

.canvas-stage {
  display: grid;
  place-items: center;
  height: min(50vh, 500px);
  min-height: 280px;
  padding: 12px;
  border-radius: 10px;
  background: #090909;
  overflow: hidden;
}

.canvas-stage > canvas {
  object-fit: contain;
  border-radius: 8px;
}

.batch-head {
  margin: 10px 0 8px;
  padding-top: 9px;
  border-top: 1px solid var(--line);
}

.variant-grid {
  display: flex;
  gap: 9px;
  overflow-x: auto;
  padding-bottom: 6px;
  scroll-snap-type: x proximity;
}

.variant {
  flex: 0 0 118px;
  display: flex;
  flex-direction: column;
  min-height: 138px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #10100f;
  overflow: hidden;
  cursor: pointer;
  scroll-snap-align: start;
}

.variant.active { border-color: var(--accent); }

.variant-thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 88px;
  padding: 6px;
  background: #080808;
}

.variant canvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  border-radius: 0;
}

.variant span {
  display: -webkit-box;
  margin-top: auto;
  min-height: 32px;
  padding: 5px 6px 6px;
  color: var(--muted);
  font-size: 10px;
  overflow: hidden;
  line-height: 1.3;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

@media (min-width: 1200px) {
  .variant {
    flex-basis: 138px;
    min-height: 154px;
  }
  .variant-thumb { height: 96px; }
  .variant span {
    min-height: 43px;
    -webkit-line-clamp: 3;
  }
}

@media (max-width: 700px) {
  .wrap { width: min(100vw - 24px, 620px); padding-top: 16px; }
  .topbar { display: block; }
  .top-actions { margin-top: 16px; width: 100%; }
  .layout { grid-template-columns: 1fr; }
  .preview-panel { grid-column: auto; }
  .variant-grid { grid-template-columns: repeat(2, 1fr); }
  .canvas-stage { height: 360px; }
}
