:root {
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  --ink: #1f2933;
  --muted: #697586;
  --line: #d7dee7;
  --panel: #fbfcfe;
  --surface: #f4f7fb;
  --button: #27364a;
  --button-hover: #1b2635;
  --accent: #0f6aa9;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--surface);
  color: var(--ink);
  overflow: hidden;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  border-radius: 6px;
  background: var(--button);
  color: #fff;
  cursor: pointer;
  min-height: 38px;
  padding: 0 14px;
}

button:hover {
  background: var(--button-hover);
}

button:disabled {
  background: #aab4c1;
  cursor: not-allowed;
}

button.secondary {
  background: #ffffff;
  border: 1px solid var(--line);
  color: var(--ink);
}

button.secondary:hover {
  background: #edf2f8;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(0, 1fr) minmax(0, 1fr);
  height: 100vh;
  width: 100vw;
}

.control-panel {
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 16px;
  height: 100vh;
  overflow-y: auto;
  padding: 22px;
}

.control-panel h1 {
  font-size: 24px;
  line-height: 1.1;
  margin: 0 0 4px;
}

.panel-section,
.advanced-body {
  display: grid;
  gap: 12px;
}

.field {
  display: grid;
  gap: 7px;
}

.field span {
  color: var(--muted);
  font-size: 13px;
}

.field input,
.field select {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  height: 38px;
  min-width: 0;
  padding: 0 10px;
  width: 100%;
}

.field input[type="color"] {
  padding: 4px;
}

.field input[type="file"] {
  height: auto;
  padding: 8px;
}

.optional-field {
  display: none;
}

.optional-field.visible {
  display: grid;
}

.shape-section {
  grid-template-columns: 1fr 1fr;
}

.shape-button {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink);
  display: grid;
  gap: 7px;
  justify-items: center;
  min-height: 116px;
  padding: 12px 10px;
  user-select: none;
}

.shape-button:hover {
  background: #eef5fb;
  border-color: #9bc5df;
}

.shape-button svg {
  height: 62px;
  width: 84px;
}

.shape-button span {
  font-size: 13px;
}

.selected-actions {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.export-actions {
  margin-top: auto;
}

.advanced {
  border-block: 1px solid var(--line);
  padding-block: 12px;
}

.advanced summary {
  color: var(--ink);
  cursor: pointer;
  font-weight: 650;
  list-style-position: outside;
  margin-left: 18px;
}

.advanced-body {
  padding-top: 14px;
}

.status {
  color: #9a3412;
  font-size: 13px;
  min-height: 20px;
  white-space: pre-wrap;
}

.status.ok {
  color: #166534;
}

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

.preview-column + .preview-column {
  border-left: 1px solid var(--line);
}

.preview-column header {
  align-items: center;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
  display: flex;
  font-weight: 700;
  height: 52px;
  justify-content: center;
}

.preview-shell {
  align-items: center;
  display: flex;
  flex: 1;
  justify-content: center;
  min-height: 0;
  overflow: hidden;
  padding: 18px;
}

.canvas-stack {
  background: #fff;
  box-shadow: 0 18px 40px rgb(28 39 52 / 14%);
  line-height: 0;
  position: relative;
}

.canvas-stack canvas {
  display: block;
  height: 100%;
  width: 100%;
}

.tile-overlay {
  display: block;
  left: 0;
  overflow: hidden;
  pointer-events: none;
  position: absolute;
  top: 0;
}

.tile-overlay.interactive {
  pointer-events: auto;
  touch-action: none;
}

.tile {
  cursor: grab;
  vector-effect: non-scaling-stroke;
}

.tile.selected path {
  stroke: #111827;
  stroke-width: 0.7;
}

.tile path {
  stroke: #384456;
  stroke-linejoin: round;
  stroke-width: 0.38;
}

.drag-ghost {
  height: 74px;
  left: 0;
  pointer-events: none;
  position: fixed;
  top: 0;
  transform: translate(-50%, -50%);
  width: 86px;
  z-index: 20;
}

.drag-ghost svg {
  filter: drop-shadow(0 10px 16px rgb(15 23 42 / 20%));
  height: 100%;
  width: 100%;
}

@media (max-width: 900px) {
  body {
    overflow: auto;
  }

  .workspace {
    grid-template-columns: 1fr;
    height: auto;
  }

  .control-panel {
    height: auto;
    min-height: 100vh;
  }

  .preview-column {
    min-height: 100vh;
  }
}
