:root {
  --bg: #f3efe6;
  --bg-strong: #e7ddcb;
  --panel: rgba(255, 252, 246, 0.82);
  --panel-strong: rgba(255, 248, 238, 0.96);
  --text: #1f2025;
  --muted: #67665f;
  --line: rgba(31, 32, 37, 0.12);
  --accent: #0d4f43;
  --accent-2: #d8633f;
  --shadow: 0 24px 80px rgba(39, 31, 22, 0.14);
  --radius-xl: 28px;
  --radius-lg: 18px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: "Avenir Next", "PingFang SC", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(216, 99, 63, 0.22), transparent 28%),
    radial-gradient(circle at 85% 15%, rgba(13, 79, 67, 0.2), transparent 24%),
    linear-gradient(180deg, #f8f2e8 0%, #f1e8db 48%, #efe6d8 100%);
}

code {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.92em;
}

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

.hero {
  display: grid;
  grid-template-columns: 1.3fr 0.9fr;
  gap: 24px;
  align-items: stretch;
  margin-bottom: 24px;
}

.hero-copy,
.hero-card,
.panel {
  backdrop-filter: blur(18px);
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.hero-copy {
  padding: 32px;
}

.eyebrow {
  margin: 0 0 10px;
  letter-spacing: 0.22em;
  font-size: 0.8rem;
  color: var(--accent);
  font-weight: 700;
}

.hero h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.3rem, 4vw, 4.4rem);
  line-height: 0.98;
  max-width: 12ch;
}

.hero-text {
  margin: 18px 0 0;
  max-width: 54ch;
  line-height: 1.75;
  color: var(--muted);
}

.hero-card {
  padding: 24px;
  display: grid;
  gap: 14px;
  align-content: center;
  background:
    linear-gradient(155deg, rgba(13, 79, 67, 0.95), rgba(27, 52, 58, 0.92)),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04), transparent);
  color: #f7f2e7;
}

.stat {
  padding: 14px 0;
  border-bottom: 1px solid rgba(247, 242, 231, 0.12);
}

.stat:last-child {
  border-bottom: 0;
}

.stat span {
  display: block;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.72;
  margin-bottom: 6px;
}

.stat strong {
  font-size: 1rem;
  line-height: 1.5;
}

.layout {
  display: grid;
  grid-template-columns: minmax(360px, 440px) 1fr;
  gap: 24px;
}

.panel {
  padding: 24px;
  background: var(--panel-strong);
}

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

.panel-head h2 {
  margin: 0;
  font-size: 1.2rem;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

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

.field span {
  font-size: 0.92rem;
  font-weight: 600;
}

.field-span-2 {
  grid-column: span 2;
}

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

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.72);
  padding: 12px 14px;
  color: var(--text);
  transition: border-color 180ms ease, transform 180ms ease, background 180ms ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(13, 79, 67, 0.6);
  background: rgba(255, 255, 255, 0.96);
  transform: translateY(-1px);
}

textarea {
  resize: vertical;
}

.primary-button,
.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: 999px;
  padding: 12px 18px;
  border: 0;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, opacity 180ms ease;
}

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

.primary-button {
  color: #fff8ee;
  background: linear-gradient(135deg, var(--accent-2), #b24f34);
  box-shadow: 0 14px 32px rgba(216, 99, 63, 0.28);
}

.primary-button:disabled,
.ghost-button:disabled {
  cursor: not-allowed;
  opacity: 0.7;
  transform: none;
  box-shadow: none;
}

.ghost-button {
  background: rgba(255, 255, 255, 0.7);
  color: var(--text);
  border: 1px solid var(--line);
}

.button-spinner {
  width: 1em;
  height: 1em;
  border-radius: 50%;
  border: 2px solid rgba(255, 248, 238, 0.34);
  border-top-color: #fff8ee;
  display: none;
  flex: 0 0 auto;
}

.primary-button.loading .button-spinner {
  display: inline-block;
  animation: spin 700ms linear infinite;
}

.primary-button.loading .button-label::after {
  content: "...";
  display: inline-block;
  width: 1.2em;
  overflow: hidden;
  vertical-align: bottom;
  animation: dots 1.2s steps(4, end) infinite;
}

.hint-box {
  margin-top: 18px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(13, 79, 67, 0.14);
  background: linear-gradient(180deg, rgba(13, 79, 67, 0.08), rgba(255, 255, 255, 0.58));
  padding: 16px;
}

.hint-box strong {
  display: block;
  margin-bottom: 8px;
}

.hint-box p {
  margin: 0;
  line-height: 1.7;
  color: var(--muted);
}

.action-row {
  display: flex;
  gap: 12px;
  margin-top: 18px;
}

.result-panel {
  min-height: 720px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 78px;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 700;
}

.status-pill.idle {
  background: rgba(31, 32, 37, 0.08);
  color: var(--muted);
}

.status-pill.running {
  background: rgba(216, 99, 63, 0.14);
  color: #a24529;
}

.status-pill.success {
  background: rgba(13, 79, 67, 0.14);
  color: var(--accent);
}

.status-pill.error {
  background: rgba(170, 42, 42, 0.14);
  color: #9d2323;
}

.empty-state {
  min-height: 220px;
  display: grid;
  place-content: center;
  text-align: center;
  border: 1px dashed rgba(31, 32, 37, 0.14);
  border-radius: var(--radius-lg);
  color: var(--muted);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.6), rgba(255, 248, 238, 0.88)),
    repeating-linear-gradient(
      -45deg,
      transparent,
      transparent 12px,
      rgba(13, 79, 67, 0.04) 12px,
      rgba(13, 79, 67, 0.04) 24px
    );
}

.empty-state.loading {
  position: relative;
  overflow: hidden;
}

.empty-state.loading::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    105deg,
    transparent 22%,
    rgba(216, 99, 63, 0.14) 38%,
    rgba(255, 255, 255, 0.45) 50%,
    rgba(13, 79, 67, 0.12) 62%,
    transparent 78%
  );
  transform: translateX(-100%);
  animation: shimmer 1.5s ease-in-out infinite;
}

.empty-state.loading > * {
  position: relative;
  z-index: 1;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.image-card {
  overflow: hidden;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(31, 32, 37, 0.08);
  box-shadow: 0 16px 34px rgba(23, 22, 18, 0.08);
  animation: rise 360ms ease;
}

.image-card img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: #efe5d8;
}

.image-meta {
  padding: 12px;
  display: grid;
  gap: 10px;
}

.image-caption {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
}

.download-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 700;
}

.raw-panel {
  margin-top: 18px;
  border-top: 1px solid rgba(31, 32, 37, 0.1);
  padding-top: 18px;
}

.raw-panel pre {
  white-space: pre-wrap;
  word-break: break-word;
  overflow: auto;
  padding: 14px;
  border-radius: 16px;
  background: #1d2628;
  color: #f4efe6;
  max-height: 320px;
}

[hidden] {
  display: none !important;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes shimmer {
  to {
    transform: translateX(100%);
  }
}

@keyframes dots {
  0% {
    width: 0;
  }

  100% {
    width: 1.2em;
  }
}

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

  .hero h1 {
    max-width: unset;
  }
}

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

  .hero-copy,
  .hero-card,
  .panel {
    padding: 18px;
    border-radius: 22px;
  }

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

  .field-span-2 {
    grid-column: span 1;
  }

  .action-row,
  .panel-head {
    flex-direction: column;
    align-items: stretch;
  }
}
