:root {
  color-scheme: light;
  --bg: #f5f7f6;
  --panel: #ffffff;
  --text: #1c2421;
  --muted: #69736e;
  --line: #dce4df;
  --accent: #1f7a5a;
  --accent-dark: #14563f;
  --accent-soft: #e4f2ec;
  --warn: #b85c38;
  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:
    linear-gradient(135deg, rgba(31, 122, 90, 0.08), transparent 34%),
    linear-gradient(315deg, rgba(184, 92, 56, 0.1), transparent 32%),
    var(--bg);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

.app {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0;
}

.workspace {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.panel,
.preview-area {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  box-shadow: 0 18px 50px rgba(28, 36, 33, 0.08);
}

.controls {
  position: sticky;
  top: 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 20px;
  border-radius: 8px;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  font-weight: 800;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 22px;
  line-height: 1.2;
}

h2 {
  font-size: 20px;
}

p {
  color: var(--muted);
  line-height: 1.5;
}

.upload {
  display: grid;
  gap: 6px;
  padding: 18px;
  border: 1px dashed #9eb3a9;
  border-radius: 8px;
  background: var(--accent-soft);
  cursor: pointer;
}

.upload input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.upload-title {
  font-weight: 750;
  color: var(--accent-dark);
}

.upload-subtitle {
  color: var(--muted);
  overflow-wrap: anywhere;
}

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

.field-head,
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

label {
  color: var(--text);
  font-weight: 650;
}

select,
input[type="range"],
.text-input {
  width: 100%;
}

select,
.text-input {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: white;
  color: var(--text);
}

.file-control {
  display: grid;
  place-items: center;
  min-height: 42px;
  border: 1px dashed #9eb3a9;
  border-radius: 8px;
  background: #fbfcfb;
  color: var(--accent-dark);
  cursor: pointer;
}

.file-control input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.field-note {
  font-size: 13px;
}

input[type="range"] {
  accent-color: var(--accent);
}

.toggle-row label,
.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-weight: 650;
}

input[type="checkbox"] {
  width: 17px;
  height: 17px;
  accent-color: var(--accent);
}

button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  padding: 0 15px;
  font-weight: 750;
  cursor: pointer;
}

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

.primary {
  background: var(--accent);
  color: white;
}

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

.ghost {
  border: 1px solid var(--line);
  background: white;
  color: var(--accent-dark);
}

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

.stats div {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.stats span {
  color: var(--muted);
  font-size: 12px;
}

.stats strong {
  font-size: 14px;
  overflow-wrap: anywhere;
}

.preview-area {
  min-height: calc(100vh - 56px);
  padding: 20px;
  border-radius: 8px;
}

.preview-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.canvas-shell {
  display: grid;
  place-items: center;
  min-height: 620px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(45deg, #eef2ef 25%, transparent 25%),
    linear-gradient(-45deg, #eef2ef 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #eef2ef 75%),
    linear-gradient(-45deg, transparent 75%, #eef2ef 75%);
  background-position:
    0 0,
    0 10px,
    10px -10px,
    -10px 0;
  background-size: 20px 20px;
}

canvas {
  width: min(100%, 720px);
  height: auto;
  border-radius: 6px;
  background: white;
  box-shadow: 0 12px 32px rgba(28, 36, 33, 0.14);
}

@media (max-width: 860px) {
  .app {
    width: min(100vw - 20px, 680px);
    padding: 10px 0;
  }

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

  .controls {
    position: static;
  }

  .preview-area {
    min-height: auto;
  }

  .preview-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .canvas-shell {
    min-height: 360px;
    padding: 10px;
  }
}
