:root {
  color-scheme: light;
  --ink: #17201b;
  --muted: #5a665f;
  --line: #d8ddd7;
  --paper: #f7f5ee;
  --panel: #ffffff;
  --accent: #0f766e;
  --accent-dark: #0a514d;
  --rose: #b4475b;
  --shadow: 0 18px 60px rgba(33, 45, 39, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: linear-gradient(135deg, #f7f5ee 0%, #e8f0ec 55%, #f5ecec 100%);
}

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

.shell {
  display: grid;
  grid-template-columns: minmax(360px, 440px) minmax(0, 1fr);
  gap: 24px;
  width: min(1280px, calc(100vw - 40px));
  min-height: calc(100vh - 40px);
  margin: 20px auto;
}

.workspace,
.preview {
  border: 1px solid rgba(23, 32, 27, 0.1);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.workspace {
  display: flex;
  flex-direction: column;
  padding: 24px;
  border-radius: 8px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--rose);
  font-size: 0.78rem;
  font-weight: 760;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(2.1rem, 7vw, 3.4rem);
  line-height: 0.95;
}

h2 {
  max-width: 560px;
  font-size: 1.5rem;
  line-height: 1.2;
}

.icon-button {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--panel);
  cursor: pointer;
}

.panel {
  display: grid;
  gap: 16px;
}

.field {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.field span,
.toggle {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 680;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--panel);
  outline: none;
}

input,
select {
  min-height: 44px;
  padding: 0 12px;
}

textarea {
  resize: vertical;
  min-height: 160px;
  padding: 12px;
  line-height: 1.45;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.16);
}

.model-row {
  display: grid;
  gap: 10px;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  user-select: none;
}

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

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

.primary,
.secondary {
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  font-weight: 760;
  cursor: pointer;
}

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

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

.secondary {
  color: var(--ink);
  border: 1px solid var(--line);
  background: var(--panel);
}

button:disabled {
  cursor: wait;
  opacity: 0.68;
}

.status-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  padding-top: 18px;
  color: var(--muted);
  font-size: 0.88rem;
}

.preview {
  position: relative;
  display: grid;
  align-content: center;
  min-height: 520px;
  overflow: auto;
  border-radius: 8px;
  padding: 24px;
}

.empty-state {
  display: grid;
  justify-items: center;
  gap: 22px;
  text-align: center;
}

.empty-mark {
  width: min(380px, 70vw);
  aspect-ratio: 1;
  border-radius: 8px;
  background:
    radial-gradient(circle at 35% 35%, rgba(15, 118, 110, 0.9) 0 12%, transparent 13%),
    radial-gradient(circle at 67% 43%, rgba(180, 71, 91, 0.72) 0 10%, transparent 11%),
    linear-gradient(135deg, #f4d35e, #0f766e 48%, #2f4858);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.55), 0 22px 80px rgba(23, 32, 27, 0.2);
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
  align-self: start;
}

figure {
  margin: 0;
  display: grid;
  gap: 10px;
}

figure img {
  display: block;
  width: 100%;
  border-radius: 8px;
  border: 1px solid rgba(23, 32, 27, 0.12);
  background: #fff;
}

figure a {
  color: var(--accent-dark);
  font-weight: 760;
}

.text-result {
  margin: 18px 0 0;
  padding: 14px;
  white-space: pre-wrap;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.72);
}

@media (max-width: 860px) {
  .shell {
    grid-template-columns: 1fr;
    width: min(100vw - 24px, 620px);
    margin: 12px auto;
  }

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

  .preview {
    min-height: 420px;
  }

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