:root {
  --page: #f3f5ef;
  --ink: #18211d;
  --muted: #647067;
  --surface: #fffef9;
  --surface-2: #edf4ec;
  --line: #cad5cc;
  --line-strong: #aebcaf;
  --green: #007a3d;
  --green-soft: #cfe7d5;
  --blue: #365c84;
  --coral: #bd674d;
  --shadow: 0 18px 50px rgba(24, 33, 29, 0.12);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    linear-gradient(90deg, rgba(54, 92, 132, 0.08) 1px, transparent 1px),
    linear-gradient(rgba(6, 76, 52, 0.07) 1px, transparent 1px),
    linear-gradient(150deg, #fbfaf4 0%, var(--page) 54%, #e5ece6 100%);
  background-size: 34px 34px, 34px 34px, auto;
}

button,
input {
  font: inherit;
}

button {
  min-height: 44px;
  border: 0;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 800;
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
}

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

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

.tool-panel {
  overflow: hidden;
  border: 1px solid rgba(24, 33, 29, 0.14);
  border-radius: var(--radius);
  background: rgba(255, 254, 249, 0.94);
  box-shadow: var(--shadow);
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(230px, 320px);
  gap: 18px;
  align-items: end;
  padding: 24px;
  color: #f8fcf6;
  background:
    linear-gradient(135deg, rgba(189, 103, 77, 0.28), transparent 38%),
    linear-gradient(120deg, #14211c, #1b3428 62%, #233d54);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--green-soft);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  max-width: 720px;
  font-size: clamp(2rem, 5vw, 4.2rem);
  line-height: 0.98;
  letter-spacing: 0;
}

h2 {
  font-size: 0.88rem;
  letter-spacing: 0;
  text-transform: uppercase;
  color: var(--muted);
}

.status-card {
  display: grid;
  gap: 8px;
  min-height: 104px;
  align-content: center;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.08);
}

.status-card span {
  color: #d7e4dc;
  font-size: 0.9rem;
}

.status-card strong {
  font-size: 1.05rem;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(260px, 330px) minmax(0, 1fr);
  gap: 18px;
  padding: 18px;
}

.controls,
.preview-shell {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

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

.drop-zone {
  display: grid;
  gap: 10px;
  justify-items: center;
  min-height: 190px;
  padding: 26px 18px;
  border: 2px dashed var(--line-strong);
  border-radius: var(--radius);
  text-align: center;
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease;
}

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

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

.drop-zone strong {
  font-size: 1.1rem;
}

.drop-zone small {
  max-width: 220px;
  color: var(--muted);
  line-height: 1.45;
}

.upload-icon {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border-radius: 50%;
  color: var(--green);
  background: #ffffff;
  box-shadow: 0 8px 22px rgba(24, 33, 29, 0.1);
}

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

.field label {
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 850;
}

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

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

output,
.color-row span {
  min-height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  background: #ffffff;
  font-size: 0.85rem;
  font-weight: 800;
}

input[type="color"] {
  width: 100%;
  height: 42px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.color-row {
  grid-template-columns: 58px minmax(0, 1fr);
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.primary-button,
.secondary-button,
.icon-button {
  display: inline-grid;
  grid-auto-flow: column;
  gap: 8px;
  align-items: center;
  justify-content: center;
}

.primary-button {
  color: #ffffff;
  background: var(--green);
  box-shadow: 0 12px 24px rgba(6, 76, 52, 0.22);
}

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

.preview-shell {
  min-width: 0;
  padding: 14px;
}

.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding-bottom: 14px;
}

.icon-button {
  width: 42px;
  min-height: 42px;
  color: var(--ink);
  border: 1px solid var(--line);
  background: #ffffff;
}

#page-indicator {
  min-width: 110px;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.preview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.preview-grid article {
  display: grid;
  gap: 10px;
  min-width: 0;
}

canvas {
  display: block;
  width: 100%;
  min-height: 340px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(45deg, #f1f1ec 25%, transparent 25%),
    linear-gradient(-45deg, #f1f1ec 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #f1f1ec 75%),
    linear-gradient(-45deg, transparent 75%, #f1f1ec 75%),
    #ffffff;
  background-position: 0 0, 0 9px, 9px -9px, -9px 0;
  background-size: 18px 18px;
}

.is-busy {
  cursor: wait;
}

@media (max-width: 860px) {
  .topbar,
  .workspace,
  .preview-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: stretch;
  }
}

@media (max-width: 520px) {
  .app-shell {
    width: min(100vw - 18px, 1180px);
    padding: 9px 0;
  }

  .topbar,
  .workspace {
    padding: 14px;
  }

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

  canvas {
    min-height: 240px;
  }
}
