:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-muted: #eef2f5;
  --text: #17202a;
  --muted: #64717f;
  --line: #d6dde4;
  --accent: #1677c8;
  --accent-strong: #0f5d9f;
  --danger: #b84a4a;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  min-height: 100vh;
  padding: 18px;
}

.workspace {
  min-width: 0;
}

.drop-zone {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: calc(100vh - 36px);
  min-height: 420px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(45deg, #dfe5ea 25%, transparent 25%),
    linear-gradient(-45deg, #dfe5ea 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #dfe5ea 75%),
    linear-gradient(-45deg, transparent 75%, #dfe5ea 75%);
  background-color: #edf1f4;
  background-position:
    0 0,
    0 12px,
    12px -12px,
    -12px 0;
  background-size: 24px 24px;
}

.drop-zone.is-dragover {
  outline: 3px solid rgba(22, 119, 200, 0.25);
  border-color: var(--accent);
}

#editorCanvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
  cursor: crosshair;
}

.empty-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 8px;
  text-align: center;
  color: var(--muted);
  background: rgba(244, 246, 248, 0.78);
}

.empty-state h1 {
  margin: 0;
  color: var(--text);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0;
}

.empty-state p {
  margin: 0;
  font-size: 14px;
}

.upload-mark {
  display: grid;
  place-items: center;
  justify-self: center;
  width: 56px;
  height: 56px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--accent);
  font-size: 34px;
  line-height: 1;
}

.file-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.drop-zone.has-image .file-input,
.drop-zone.has-image .empty-state {
  display: none;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
  height: calc(100vh - 36px);
  min-height: 420px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.panel-heading h2 {
  margin: 0 0 4px;
  font-size: 22px;
  letter-spacing: 0;
}

.panel-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.control-group,
.control-grid label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.range-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 52px;
  align-items: center;
  gap: 10px;
}

input[type="range"] {
  width: 100%;
}

input[type="number"],
select {
  width: 100%;
  min-width: 0;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  background: #fff;
  color: var(--text);
}

input:disabled,
select:disabled,
button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.control-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.button-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  margin-top: auto;
}

button {
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-muted);
  color: var(--text);
  cursor: pointer;
}

button:not(:disabled):hover {
  border-color: #b8c3cd;
  background: #e3e9ee;
}

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

button.primary:not(:disabled):hover {
  border-color: var(--accent-strong);
  background: var(--accent-strong);
}

@media (max-width: 820px) {
  .app-shell {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .drop-zone,
  .sidebar {
    height: auto;
    min-height: 320px;
  }

  .sidebar {
    min-height: 0;
  }
}
