:root {
  --bg-main: #f2f8f6;
  --bg-secondary: #fff6eb;
  --ink: #16232d;
  --ink-soft: #4c5d66;
  --line: rgba(22, 35, 45, 0.16);
  --panel: rgba(255, 255, 255, 0.78);
  --accent: #058b74;
  --accent-strong: #046a58;
  --accent-warm: #ec8d42;
  --shadow: 0 18px 46px rgba(18, 40, 48, 0.14);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Public Sans", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 8%, rgba(5, 139, 116, 0.22), transparent 40%),
    radial-gradient(circle at 86% 12%, rgba(236, 141, 66, 0.22), transparent 45%),
    linear-gradient(140deg, var(--bg-main), var(--bg-secondary) 64%);
  padding: 1.4rem;
}

.ambient {
  position: fixed;
  pointer-events: none;
  border-radius: 999px;
  z-index: 0;
  filter: blur(24px);
}

.ambient-one {
  width: 280px;
  height: 280px;
  left: -90px;
  top: 45%;
  background: rgba(5, 139, 116, 0.17);
}

.ambient-two {
  width: 320px;
  height: 320px;
  right: -120px;
  top: 4%;
  background: rgba(236, 141, 66, 0.15);
}

.app-shell {
  position: relative;
  z-index: 1;
  max-width: 1320px;
  margin: 0 auto;
}

.hero {
  margin-bottom: 1rem;
}

.eyebrow {
  margin: 0;
  font-size: 0.74rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-strong);
  font-weight: 700;
}

h1 {
  font-family: "Sora", "Avenir Next", sans-serif;
  font-size: clamp(1.8rem, 4vw, 2.7rem);
  margin: 0.35rem 0 0.4rem;
  letter-spacing: -0.03em;
}

.subtitle {
  margin: 0;
  color: var(--ink-soft);
  max-width: 62ch;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.8fr);
  gap: 1rem;
  align-items: start;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.controls {
  padding: 1rem;
}

.section + .section {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(22, 35, 45, 0.08);
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

h2 {
  margin: 0;
  font-size: 1.01rem;
  font-family: "Sora", "Avenir Next", sans-serif;
  letter-spacing: -0.02em;
}

.field-label {
  display: inline-block;
  margin: 0.5rem 0 0.35rem;
  font-size: 0.82rem;
  color: var(--ink-soft);
}

textarea,
input[type="text"],
select,
input[type="file"] {
  width: 100%;
  border: 1px solid rgba(22, 35, 45, 0.2);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.8);
  color: var(--ink);
  padding: 0.64rem 0.72rem;
  font: inherit;
}

textarea {
  resize: vertical;
  min-height: 96px;
}

input[type="color"] {
  width: 100%;
  height: 42px;
  border: 1px solid rgba(22, 35, 45, 0.2);
  border-radius: 12px;
  padding: 0.2rem;
  background: rgba(255, 255, 255, 0.82);
}

input:focus-visible,
textarea:focus-visible,
select:focus-visible,
button:focus-visible {
  outline: 2px solid rgba(5, 139, 116, 0.35);
  outline-offset: 2px;
}

.preset-row {
  margin-top: 0.6rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.preset {
  border: 1px solid rgba(5, 139, 116, 0.35);
  background: rgba(5, 139, 116, 0.09);
  color: var(--accent-strong);
  border-radius: 999px;
  padding: 0.32rem 0.68rem;
  font-size: 0.77rem;
  cursor: pointer;
  transition: transform 0.14s ease, background 0.2s ease;
}

.preset:hover {
  transform: translateY(-1px);
  background: rgba(5, 139, 116, 0.16);
}

.grid {
  display: grid;
  gap: 0.7rem;
}

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.range-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.45rem;
}

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

.value-badge {
  min-width: 2.1rem;
  text-align: center;
  border-radius: 999px;
  border: 1px solid rgba(22, 35, 45, 0.2);
  background: rgba(255, 255, 255, 0.86);
  padding: 0.12rem 0.42rem;
  font-size: 0.74rem;
  color: var(--ink-soft);
}

.toggle-wrap {
  display: flex;
  align-items: end;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.46rem;
  font-size: 0.86rem;
  color: var(--ink-soft);
}

.toggle input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.group {
  margin-top: 0.75rem;
  padding: 0.72rem;
  border: 1px dashed rgba(22, 35, 45, 0.2);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.56);
}

.hidden {
  display: none;
}

.actions {
  margin-top: 1rem;
  display: flex;
  gap: 0.62rem;
  flex-wrap: wrap;
}

.btn {
  border-radius: 12px;
  border: 1px solid transparent;
  padding: 0.66rem 1rem;
  font-weight: 600;
  font-family: "Sora", "Avenir Next", sans-serif;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

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

.btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

.btn.primary {
  color: #ffffff;
  background: linear-gradient(140deg, var(--accent), var(--accent-strong));
  box-shadow: 0 10px 24px rgba(4, 106, 88, 0.26);
}

.btn.secondary {
  color: var(--ink);
  border-color: rgba(22, 35, 45, 0.2);
  background: rgba(255, 255, 255, 0.86);
}

.preview {
  position: sticky;
  top: 1.2rem;
  padding: 0.95rem;
}

.preview-head h2 {
  margin-bottom: 0.15rem;
}

.preview-head p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.82rem;
}

.preview-stage {
  margin-top: 0.74rem;
  min-height: 320px;
  border-radius: 18px;
  border: 1px dashed rgba(22, 35, 45, 0.2);
  background:
    linear-gradient(45deg, rgba(22, 35, 45, 0.045) 25%, transparent 25%, transparent 75%, rgba(22, 35, 45, 0.045) 75%),
    linear-gradient(45deg, rgba(22, 35, 45, 0.045) 25%, transparent 25%, transparent 75%, rgba(22, 35, 45, 0.045) 75%);
  background-position: 0 0, 16px 16px;
  background-size: 32px 32px;
  display: grid;
  place-items: center;
  padding: 1rem;
}

#preview-image {
  max-width: min(100%, 380px);
  width: 100%;
  height: auto;
  border-radius: 16px;
  box-shadow: 0 12px 28px rgba(18, 40, 48, 0.22);
}

#preview-placeholder {
  text-align: center;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.status {
  margin: 0.7rem 0 0;
  font-size: 0.84rem;
  color: var(--ink-soft);
}

.status.is-error {
  color: #a73a3a;
}

.status.is-busy {
  color: var(--accent-strong);
}

.reveal {
  opacity: 0;
  transform: translateY(16px);
  animation: reveal 0.65s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: var(--delay, 0s);
}

.delay-1 {
  --delay: 0.02s;
}

.delay-2 {
  --delay: 0.08s;
}

.delay-3 {
  --delay: 0.16s;
}

@keyframes reveal {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1080px) {
  body {
    padding: 1rem;
  }

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

  .preview {
    position: static;
  }
}

@media (max-width: 720px) {
  .controls {
    padding: 0.84rem;
  }

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

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

  .btn {
    width: 100%;
  }

  .preview-stage {
    min-height: 240px;
  }
}
