:root {
  color-scheme: light;
  --bg: #f3f6f8;
  --panel: #ffffff;
  --text: #172033;
  --muted: #657084;
  --line: #d8deea;
  --accent: #0f766e;
  --accent-dark: #0a5c56;
  --selection: rgba(15, 118, 110, 0.18);
  --shadow: 0 18px 48px rgba(23, 32, 51, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

.app {
  min-height: 100vh;
  padding: 32px 16px;
}

.workspace {
  width: min(1120px, 100%);
  margin: 0 auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 28px;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 16px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(30px, 5vw, 44px);
  line-height: 1.1;
  letter-spacing: 0;
}

.drop-zone {
  min-height: 260px;
  border: 2px dashed #98a6b9;
  border-radius: 8px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  background: #fbfcff;
  cursor: pointer;
}

.drop-zone.is-dragging {
  border-color: var(--accent);
  background: #eef8f6;
}

.drop-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.drop-icon {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #e3f2ef;
  color: var(--accent);
  font-size: 34px;
}

.drop-title {
  font-size: 20px;
  font-weight: 800;
}

.drop-subtitle,
.status,
.preview-card span {
  color: var(--muted);
}

.editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 20px;
}

.canvas-wrap {
  position: relative;
  min-height: 420px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #edf1f6;
  border: 1px solid var(--line);
  border-radius: 8px;
}

#canvas {
  max-width: 100%;
  max-height: 72vh;
  display: block;
}

.selection {
  position: absolute;
  border: 2px solid var(--accent);
  background: var(--selection);
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.32);
  cursor: move;
  display: none;
}

.selection::after {
  content: "";
  position: absolute;
  right: -7px;
  bottom: -7px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  cursor: nwse-resize;
}

.controls {
  display: grid;
  gap: 14px;
  align-content: start;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 14px;
}

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

.control-row,
.button-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.primary-button,
.secondary-button {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 800;
  padding: 0 14px;
}

.primary-button {
  background: var(--accent);
  color: #fff;
}

.primary-button:hover {
  background: var(--accent-dark);
}

.secondary-button {
  background: #edf1f6;
  color: var(--text);
}

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

.preview-card {
  display: grid;
  gap: 8px;
}

#previewCanvas {
  width: 100%;
  aspect-ratio: 1 / 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #edf1f6;
  object-fit: contain;
}

.status {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
}

@media (max-width: 860px) {
  .workspace {
    padding: 18px;
  }

  .header,
  .editor {
    grid-template-columns: 1fr;
  }

  .header {
    display: grid;
  }

  .canvas-wrap {
    min-height: 300px;
  }
}
