:root {
  --bg: #f5efe4;
  --bg-strong: #efe1cb;
  --ink: #182126;
  --ink-soft: #4f5a61;
  --panel: rgba(255, 251, 245, 0.84);
  --line: rgba(24, 33, 38, 0.12);
  --accent: #1d6a5a;
  --accent-strong: #174f44;
  --warning: #b45622;
  --danger: #af3b32;
  --shadow: 0 24px 80px rgba(32, 45, 54, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Trebuchet MS", "Verdana", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(255, 194, 111, 0.35), transparent 32%),
    radial-gradient(circle at top right, rgba(28, 102, 88, 0.18), transparent 26%),
    linear-gradient(180deg, #fffaf2 0%, var(--bg) 44%, #f1eadc 100%);
}

h1,
h2,
h3 {
  margin: 0;
  font-family: "Georgia", "Times New Roman", serif;
  letter-spacing: 0.01em;
}

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

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

.hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-end;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 0.82rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
}

.hero h1 {
  font-size: clamp(2.3rem, 4vw, 4.2rem);
  line-height: 0.94;
}

.hero-copy {
  max-width: 760px;
  margin: 14px 0 0;
  color: var(--ink-soft);
  font-size: 1.02rem;
  line-height: 1.6;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.meta-pill,
.chip,
.ghost-button,
.primary-button {
  border-radius: 999px;
}

.meta-pill {
  display: inline-flex;
  align-items: center;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(24, 33, 38, 0.08);
  font-size: 0.9rem;
}

.meta-pill.ok {
  color: var(--accent-strong);
}

.meta-pill.warn {
  color: var(--warning);
}

.layout-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(360px, 0.75fr);
  gap: 22px;
  align-items: start;
}

.panel {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  border-radius: 28px;
}

.form-panel,
.output-panel {
  padding: 24px;
}

.output-panel {
  position: sticky;
  top: 20px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.section-head p,
.muted {
  margin: 0;
  color: var(--ink-soft);
}

.section-head.compact {
  margin-top: 20px;
}

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

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

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

.field-grid.three-col {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

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

.field small {
  color: var(--ink-soft);
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: rgba(29, 106, 90, 0.48);
  box-shadow: 0 0 0 4px rgba(29, 106, 90, 0.12);
  transform: translateY(-1px);
}

.is-missing {
  border-color: rgba(175, 59, 50, 0.55);
  box-shadow: 0 0 0 4px rgba(175, 59, 50, 0.1);
}

.subpanel {
  margin-bottom: 16px;
  padding: 18px;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.62), rgba(239, 225, 203, 0.4));
  border: 1px solid rgba(24, 33, 38, 0.08);
}

.subpanel-head {
  margin-bottom: 12px;
}

.subpanel-head p {
  margin: 6px 0 0;
  color: var(--ink-soft);
}

.chip-row,
.button-row,
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.chip,
.ghost-button,
.primary-button {
  border: 0;
  cursor: pointer;
}

.chip {
  padding: 10px 12px;
  background: rgba(29, 106, 90, 0.09);
  color: var(--accent-strong);
  transition: transform 0.18s ease, background 0.18s ease;
}

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

.primary-button {
  padding: 14px 22px;
  background: linear-gradient(135deg, var(--accent) 0%, #0f4d41 100%);
  color: #fff;
  font-weight: 700;
}

.primary-button:disabled {
  opacity: 0.72;
  cursor: progress;
}

.ghost-button {
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
  border: 1px solid var(--line);
}

.preview-box {
  min-height: 74px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 18px;
  border: 1px dashed rgba(24, 33, 38, 0.18);
  background: rgba(255, 255, 255, 0.56);
  color: var(--ink-soft);
}

.preview-box img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 14px;
}

.status-banner {
  padding: 14px 16px;
  border-radius: 18px;
  font-weight: 700;
  margin-bottom: 14px;
}

.status-banner.neutral {
  background: rgba(255, 255, 255, 0.88);
}

.status-banner.success {
  background: rgba(29, 106, 90, 0.14);
  color: var(--accent-strong);
}

.status-banner.warning {
  background: rgba(180, 86, 34, 0.13);
  color: #8a491f;
}

.status-banner.error {
  background: rgba(175, 59, 50, 0.13);
  color: #8d2d26;
}

.clarification-box {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}

.prompt-group {
  margin-bottom: 16px;
}

.pose-json-list {
  display: grid;
  gap: 14px;
  margin-bottom: 14px;
}

.pose-json-card {
  padding: 14px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(24, 33, 38, 0.08);
  animation: reveal 0.28s ease;
}

.pose-json-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.clarification-card {
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(24, 33, 38, 0.08);
  animation: reveal 0.28s ease;
}

.clarification-card p {
  margin: 4px 0 0;
  color: var(--ink-soft);
}

.clarification-card .chip-row {
  margin-top: 10px;
}

.json-output {
  min-height: 300px;
  margin: 0;
  padding: 18px;
  overflow: auto;
  border-radius: 22px;
  background: #1a2127;
  color: #f9f7ef;
  line-height: 1.55;
  font-family: "Courier New", monospace;
  white-space: pre-wrap;
  word-break: break-word;
}

.pose-json-output {
  min-height: auto;
  max-height: 320px;
}

.history-list {
  display: grid;
  gap: 10px;
}

.history-item {
  width: 100%;
  text-align: left;
  border: 1px solid rgba(24, 33, 38, 0.08);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.84);
  padding: 14px;
  cursor: pointer;
}

.history-item strong,
.history-item span {
  display: block;
}

.history-item span {
  margin-top: 6px;
  color: var(--ink-soft);
}

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

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

  .output-panel {
    position: static;
  }
}

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

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

  .field-grid.two-col,
  .field-grid.three-col {
    grid-template-columns: 1fr;
  }

  .form-panel,
  .output-panel {
    padding: 18px;
  }
}
