:root {
  --ink: #123b2a;
  --leaf: #1d6f43;
  --gold: #ffda45;
  --field: #f8f3d7;
  --paper: #fffdf4;
  --line: #d7c783;
  --muted: #5d725e;
  --shadow: 0 18px 50px rgba(18, 59, 42, .16);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background:
    radial-gradient(circle at 12% 8%, rgba(255, 218, 69, .28), transparent 30%),
    linear-gradient(180deg, #f9f6df 0%, #eef3e2 100%);
  color: var(--ink);
  font-family: "Avenir Next", system-ui, sans-serif;
}

button,
input {
  font: inherit;
}

button,
.upload-button {
  border: 2px solid var(--ink);
  border-radius: 12px;
  background: #fff9d8;
  color: var(--ink);
  font-weight: 850;
  padding: 11px 14px;
  cursor: pointer;
  box-shadow: 3px 3px 0 var(--ink);
}

button:hover,
.upload-button:hover {
  transform: translateY(-1px);
}

button:disabled {
  opacity: .5;
  cursor: not-allowed;
  transform: none;
}

.primary {
  background: var(--gold);
}

.subtle {
  background: #f2f0df;
  box-shadow: none;
}

.wide {
  width: 100%;
}

.hidden {
  display: none !important;
}

.app-shell {
  width: min(1184px, calc(100% - 32px));
  margin: 22px auto 0;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: end;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 20px;
  padding: clamp(22px, 5vw, 44px);
  box-shadow: 8px 8px 0 var(--ink);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--leaf);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: .12em;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 780px;
  margin-bottom: 12px;
  font-size: clamp(2.1rem, 6vw, 4.8rem);
  line-height: .95;
  letter-spacing: 0;
}

.hero p:not(.eyebrow) {
  max-width: 720px;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.6;
  margin-bottom: 0;
}

.drop-zone {
  margin: 24px 0;
  display: grid;
  place-items: center;
  min-height: 180px;
  padding: 26px;
  border: 3px dashed #7d8f60;
  border-radius: 20px;
  background: rgba(255, 253, 244, .78);
  text-align: center;
  cursor: pointer;
}

.drop-zone.dragover {
  background: #fff5b4;
  border-color: var(--ink);
}

.drop-icon {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  margin-bottom: 10px;
  border-radius: 16px;
  background: var(--gold);
  border: 2px solid var(--ink);
  font-size: 1.7rem;
}

.drop-zone strong {
  display: block;
  font-size: 1.35rem;
}

.drop-zone span {
  color: var(--muted);
}

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

.panel {
  background: rgba(255, 253, 244, .96);
  border: 2px solid var(--ink);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.controls-panel,
.queue-panel {
  padding: 16px;
}

.panel-heading,
.editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-heading h2 {
  margin: 0;
  font-size: 1.15rem;
}

.status-badge {
  border-radius: 999px;
  background: #e6f2d4;
  color: #245435;
  padding: 6px 10px;
  font-size: .8rem;
  font-weight: 850;
}

.control-group {
  padding: 16px 0;
  border-top: 1px solid #d8d0a2;
}

.control-group:first-of-type {
  border-top: 0;
}

.control-group > label,
.label-row label {
  display: block;
  margin-bottom: 10px;
  color: #405943;
  font-size: .84rem;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

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

.label-row output {
  font-weight: 900;
}

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

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

.segmented button,
.button-grid button,
.toolbar-actions button,
.queue-panel button {
  box-shadow: none;
}

.segmented button.active {
  background: var(--gold);
}

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

.hint {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: .9rem;
  line-height: 1.45;
}

.export-group {
  padding-bottom: 0;
}

.export-group .primary {
  margin-top: 10px;
}

.editor-panel {
  overflow: hidden;
}

.editor-toolbar {
  padding: 14px 16px;
  border-bottom: 1px solid #d8d0a2;
}

.editor-toolbar strong {
  display: block;
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.editor-toolbar span {
  color: var(--muted);
  font-size: .9rem;
}

.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.canvas-stage {
  position: relative;
  min-height: 420px;
  display: grid;
  place-items: center;
  background:
    linear-gradient(45deg, rgba(18, 59, 42, .05) 25%, transparent 25%),
    linear-gradient(135deg, rgba(18, 59, 42, .05) 25%, transparent 25%),
    #f0f2e6;
  background-size: 24px 24px;
}

canvas {
  max-width: 100%;
  height: auto;
  display: block;
}

#overlay {
  position: absolute;
  inset: 0;
  margin: auto;
  touch-action: none;
}

.empty-editor {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: rgba(248, 243, 215, .76);
  font-weight: 800;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  padding: 12px 16px 16px;
  color: var(--muted);
  font-size: .9rem;
}

.dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 5px;
}

.blurred { background: #e45d4f; }
.visible { background: #2f9c5a; }
.manual { background: #3d69d8; }

.queue {
  display: grid;
  gap: 10px;
  margin: 14px 0;
}

.queue-item {
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 10px;
  align-items: center;
  padding: 8px;
  border: 1px solid #d8d0a2;
  border-radius: 12px;
  background: #fffaf0;
  cursor: pointer;
  text-align: left;
}

.queue-item.active {
  outline: 3px solid var(--gold);
}

.queue-item img {
  width: 58px;
  height: 58px;
  object-fit: cover;
  border-radius: 8px;
}

.queue-item strong,
.queue-item span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.queue-item strong {
  font-size: .92rem;
}

.queue-item span {
  color: var(--muted);
  font-size: .82rem;
}

.privacy-note {
  margin-top: 24px;
  padding: 18px 20px;
  border: 2px solid #d5c16a;
  border-radius: 14px;
  background: #fff5bf;
  line-height: 1.55;
}

.privacy-note strong {
  margin-right: 4px;
}

.kit-tool-note {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
}

@media (max-width: 1020px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .controls-panel,
  .queue-panel {
    order: 2;
  }

  .editor-panel {
    order: 1;
  }
}

@media (max-width: 700px) {
  .app-shell {
    width: min(100% - 24px, 1184px);
  }

  .hero {
    grid-template-columns: 1fr;
    box-shadow: 5px 5px 0 var(--ink);
  }

  h1 {
    font-size: clamp(2rem, 13vw, 3.3rem);
  }

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

  .editor-toolbar,
  .kit-tool-note {
    display: grid;
  }
}
