:root {
  color-scheme: light;
  --bg: #f5f8fa;
  --bg-2: #edf4f2;
  --panel: rgba(255, 255, 255, 0.84);
  --panel-border: rgba(15, 23, 42, 0.1);
  --text: #0f172a;
  --muted: #526070;
  --line: rgba(15, 23, 42, 0.08);
  --accent: #0f766e;
  --accent-2: #ea580c;
  --accent-3: #1d4ed8;
  --shadow: 0 20px 60px rgba(15, 23, 42, 0.14);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(14, 165, 233, 0.12), transparent 34%),
    radial-gradient(circle at top right, rgba(234, 88, 12, 0.11), transparent 30%),
    linear-gradient(180deg, #ffffff 0%, var(--bg) 52%, var(--bg-2) 100%);
}

button,
input,
textarea,
a {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  width: min(1200px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 40px;
}

.hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  padding: 16px 4px 28px;
}

.eyebrow,
.panel-kicker {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.74rem;
  color: var(--accent);
  font-weight: 700;
}

h1 {
  margin: 0;
  max-width: 14ch;
  font-size: clamp(2.2rem, 5vw, 4.4rem);
  line-height: 0.98;
  letter-spacing: 0;
}

.lede {
  margin: 16px 0 0;
  max-width: 62ch;
  font-size: 1.03rem;
  line-height: 1.65;
  color: var(--muted);
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.74);
  box-shadow: var(--shadow);
  color: var(--muted);
  white-space: nowrap;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #22c55e);
  box-shadow: 0 0 0 6px rgba(15, 118, 110, 0.12);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 0.98fr) minmax(0, 1.02fr);
  gap: 22px;
  align-items: start;
}

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

.controls,
.preview {
  padding: 18px;
}

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

.panel-head h2 {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.15;
}

.ghost-button,
.primary-button,
.mode-button,
.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.ghost-button:hover,
.primary-button:hover,
.mode-button:hover,
.chip:hover {
  transform: translateY(-1px);
}

.ghost-button,
.mode-button,
.chip {
  background: rgba(255, 255, 255, 0.72);
  border-color: var(--line);
  color: var(--text);
}

.ghost-button {
  padding: 10px 12px;
  min-height: 42px;
  text-decoration: none;
}

.ghost-button svg,
.primary-button svg,
.mode-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.download-link[aria-disabled="true"] {
  opacity: 0.5;
  pointer-events: none;
}

.dropzone {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 16px;
  align-items: center;
  padding: 18px;
  border: 1.5px dashed rgba(15, 118, 110, 0.3);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(15, 118, 110, 0.06), rgba(255, 255, 255, 0.58));
  margin-bottom: 10px;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.dropzone.is-dragover {
  border-color: var(--accent);
  background: linear-gradient(180deg, rgba(15, 118, 110, 0.12), rgba(255, 255, 255, 0.74));
  transform: translateY(-1px);
}

.dropzone-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(15, 118, 110, 0.16), rgba(29, 78, 216, 0.12));
  color: var(--accent);
}

.dropzone-icon svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.dropzone strong {
  display: block;
  margin-bottom: 4px;
  font-size: 1rem;
}

.dropzone p,
.meta,
.hint,
.footer-note p,
.status {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.meta {
  font-size: 0.92rem;
  margin-bottom: 14px;
}

.mode-group {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.mode-button {
  padding: 12px 10px;
  min-height: 46px;
  color: var(--muted);
}

.mode-button.is-active {
  border-color: rgba(15, 118, 110, 0.34);
  background: rgba(15, 118, 110, 0.11);
  color: var(--text);
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.field span {
  font-weight: 700;
  font-size: 0.96rem;
}

textarea,
input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.88);
  color: var(--text);
  padding: 13px 14px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

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

textarea:focus,
input:focus {
  border-color: rgba(15, 118, 110, 0.45);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.12);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.chip {
  padding: 10px 12px;
  min-height: 40px;
  color: var(--muted);
}

.advanced {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 16px;
  background: rgba(255, 255, 255, 0.52);
}

.advanced summary {
  list-style: none;
  padding: 12px 14px;
  cursor: pointer;
  font-weight: 700;
}

.advanced summary::-webkit-details-marker {
  display: none;
}

.advanced-body {
  padding: 0 14px 14px;
}

.hint {
  font-size: 0.9rem;
}

.primary-button {
  width: 100%;
  padding: 14px 16px;
  min-height: 48px;
  background: linear-gradient(135deg, var(--accent), #14b8a6);
  color: white;
  border-color: rgba(15, 118, 110, 0.2);
  font-weight: 700;
}

.status {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
}

.status.is-busy {
  border-color: rgba(29, 78, 216, 0.24);
  color: #1e3a8a;
}

.status.is-error {
  border-color: rgba(220, 38, 38, 0.24);
  color: #991b1b;
}

.status.is-success {
  border-color: rgba(22, 163, 74, 0.24);
  color: #166534;
}

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

.preview-card {
  margin: 0;
}

.preview-card figcaption {
  margin-bottom: 8px;
  font-size: 0.92rem;
  color: var(--muted);
}

.image-frame {
  aspect-ratio: 1 / 1;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  background:
    linear-gradient(45deg, rgba(15, 23, 42, 0.05) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(15, 23, 42, 0.05) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(15, 23, 42, 0.05) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(15, 23, 42, 0.05) 75%);
  background-size: 24px 24px;
  background-position:
    0 0,
    0 12px,
    12px -12px,
    -12px 0;
  display: grid;
  place-items: center;
  position: relative;
}

.image-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: rgba(255, 255, 255, 0.2);
}

.output-frame {
  background:
    linear-gradient(45deg, rgba(15, 23, 42, 0.05) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(15, 23, 42, 0.05) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(15, 23, 42, 0.05) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(15, 23, 42, 0.05) 75%),
    linear-gradient(135deg, rgba(15, 118, 110, 0.08), rgba(234, 88, 12, 0.08));
  background-size: 24px 24px, 24px 24px, 24px 24px, 24px 24px, auto;
}

.empty-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  text-align: center;
  color: var(--muted);
}

.empty-state span {
  display: inline-block;
  max-width: 18ch;
  padding: 10px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(15, 23, 42, 0.08);
}

.footer-note {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

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

  .hero {
    display: grid;
  }

  .hero-badge {
    width: fit-content;
  }
}

@media (max-width: 720px) {
  .shell {
    width: min(100% - 20px, 1200px);
    padding-top: 16px;
  }

  .controls,
  .preview {
    padding: 14px;
  }

  .preview-grid,
  .mode-group,
  .dropzone {
    grid-template-columns: 1fr;
  }

  .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }
}
