:root {
  color-scheme: light;
  --bg: #f4f5f1;
  --ink: #151917;
  --muted: #69736e;
  --line: #d7ddd5;
  --panel: #ffffff;
  --panel-soft: #fafbf8;
  --accent: #176b5d;
  --accent-strong: #0e493f;
  --accent-soft: #e6f2ed;
  --warm: #b87534;
  --shadow: 0 18px 45px rgba(21, 25, 23, 0.08);
  --shadow-soft: 0 8px 24px rgba(21, 25, 23, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  font-family:
    ui-sans-serif, Inter, "SF Pro Display", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 12%, rgba(23, 107, 93, 0.12), transparent 26%),
    radial-gradient(circle at 90% 20%, rgba(184, 117, 52, 0.1), transparent 24%),
    var(--bg);
}

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

.shell {
  width: min(1220px, calc(100% - 36px));
  margin: 0 auto;
  padding: 24px 0;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(360px, 0.88fr) minmax(0, 1.12fr);
  gap: 16px;
  align-items: start;
}

.topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid rgba(21, 25, 23, 0.1);
  padding: 6px 0 18px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.8rem, 3vw, 3rem);
  line-height: 1;
  letter-spacing: 0;
}

.topbar-copy {
  max-width: 520px;
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
  text-align: right;
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow);
}

.input-panel,
.output-panel {
  padding: 16px;
}

.panel-head {
  display: flex;
  min-width: 0;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.panel-head h2 {
  margin-bottom: 3px;
  font-size: 1.02rem;
  letter-spacing: 0;
}

.panel-head p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

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

.field span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

textarea:focus,
input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(37, 111, 97, 0.12);
}

textarea {
  min-height: 360px;
  resize: vertical;
  padding: 16px;
  line-height: 1.58;
  font-family:
    "SF Mono", "Cascadia Code", Consolas, ui-monospace, monospace;
  font-size: 0.93rem;
}

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

.file-button,
.ghost,
.primary {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0 14px;
  box-shadow: var(--shadow-soft);
  font-weight: 800;
  cursor: pointer;
  transition:
    transform 140ms ease,
    background 140ms ease,
    border-color 140ms ease;
}

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

.file-button {
  border-color: var(--line);
  background: #f8faf6;
  color: var(--accent-strong);
}

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

.primary {
  position: relative;
  width: 100%;
  margin-top: 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff;
}

.primary:hover {
  background: linear-gradient(135deg, #1d7566, var(--accent-strong));
}

.primary:disabled {
  cursor: wait;
  opacity: 0.72;
}

.loader {
  display: none;
  width: 18px;
  height: 18px;
  margin-left: 10px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 999px;
  animation: spin 700ms linear infinite;
}

.primary.is-loading .loader {
  display: inline-block;
}

.ghost {
  border-color: var(--line);
  background: #fff;
  color: var(--accent-strong);
}

.ghost:disabled {
  cursor: not-allowed;
  color: #9aa49f;
}

.output-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

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

.output-block {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--panel-soft);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.output-block.wide {
  grid-column: 1 / -1;
}

.output-block h3 {
  margin: 0;
  padding: 11px 13px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff, var(--accent-soft));
  font-size: 0.82rem;
  letter-spacing: 0;
  text-transform: uppercase;
}

.output-content {
  min-height: 130px;
  max-height: 320px;
  overflow: auto;
  padding: 13px;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.55;
  font-size: 0.91rem;
}

.output-content.empty {
  color: var(--muted);
}

.prompt-list {
  display: grid;
  gap: 12px;
}

.prompt-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.prompt-card h4 {
  margin: 0;
  border-bottom: 1px solid var(--line);
  background: #f8faf6;
  padding: 10px 12px;
  color: var(--accent-strong);
  font-size: 0.88rem;
}

.prompt-text {
  max-height: none;
  margin: 0;
  border-radius: 0;
  background: #17211e;
  padding: 12px;
  font-size: 0.84rem;
}

.asset-list {
  display: grid;
  gap: 12px;
  min-height: 130px;
  max-height: 420px;
  overflow: auto;
  padding: 14px;
}

.asset-list.empty {
  color: var(--muted);
  font-size: 0.92rem;
}

.asset-skeleton {
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: 8px;
  background: linear-gradient(90deg, #edf2ee, #f8faf6, #edf2ee);
  background-size: 220% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}

.pending-label {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.92rem;
}

.asset-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.asset-preview {
  width: 100%;
  aspect-ratio: 16 / 10;
  max-height: 220px;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: contain;
  background: #f2f5f0;
}

.asset-link {
  display: block;
  color: var(--accent-strong);
  font-weight: 800;
  overflow-wrap: anywhere;
}

.asset-type {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
}

.asset-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.asset-actions a {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  color: var(--accent-strong);
  font-size: 0.86rem;
  font-weight: 800;
  text-decoration: none;
}

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

.raw summary {
  color: var(--accent-strong);
  cursor: pointer;
  font-weight: 800;
}

pre {
  max-height: 280px;
  overflow: auto;
  margin: 12px 0 0;
  border-radius: 8px;
  background: #18211f;
  color: #e9f3ef;
  padding: 14px;
  white-space: pre-wrap;
  word-break: break-word;
}

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

@keyframes shimmer {
  0% {
    background-position: 120% 0;
  }

  100% {
    background-position: -120% 0;
  }
}

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

  .topbar {
    align-items: start;
    flex-direction: column;
    gap: 8px;
  }

  .topbar-copy {
    max-width: none;
    text-align: left;
  }

  .output-block.wide {
    grid-column: auto;
  }

  h1 {
    font-size: clamp(1.8rem, 10vw, 2.6rem);
  }

  textarea {
    min-height: 280px;
  }
}

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

  .panel-head {
    flex-direction: column;
  }

  .file-button,
  .ghost,
  .output-actions {
    width: 100%;
  }

  .output-actions {
    display: grid;
  }

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

  .asset-actions {
    display: grid;
  }
}
