:root {
  color-scheme: dark;
  --bg: #101112;
  --panel: #191b1f;
  --panel-strong: #22252b;
  --text: #f4f5f7;
  --muted: #a9afbd;
  --line: #30343c;
  --accent: #38d39f;
  --accent-strong: #25b985;
  --danger: #ff6b6b;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(56, 211, 159, 0.16), transparent 34rem),
    linear-gradient(135deg, #101112 0%, #151719 50%, #111317 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
textarea,
select {
  font: inherit;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 36px 0 56px;
}

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

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

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

h1 {
  font-size: clamp(2rem, 4vw, 3.6rem);
  line-height: 1;
}

h2 {
  font-size: 1rem;
}

.status-pill {
  min-width: 96px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(25, 27, 31, 0.8);
  color: var(--muted);
  text-align: center;
  white-space: nowrap;
}

.card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(25, 27, 31, 0.92);
  box-shadow: var(--shadow);
}

.form-card {
  padding: 22px;
}

form {
  display: grid;
  gap: 18px;
}

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

.field span {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

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

textarea {
  min-height: 180px;
  padding: 15px;
  resize: vertical;
  line-height: 1.5;
}

select {
  min-height: 46px;
  padding: 0 12px;
}

textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(56, 211, 159, 0.12);
}

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

.primary-button,
.secondary-button,
.copy-button,
.small-button {
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 800;
}

.primary-button {
  min-height: 52px;
  padding: 0 20px;
  background: var(--accent);
  color: #07110d;
}

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

.primary-button:disabled {
  cursor: wait;
  opacity: 0.68;
}

.secondary-button {
  min-height: 42px;
  padding: 0 16px;
  background: #30343c;
  color: var(--text);
}

.secondary-button:hover,
.small-button:hover {
  background: #3b414c;
}

.secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.saved-card {
  margin-top: 18px;
  overflow: hidden;
}

.saved-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(34, 37, 43, 0.68);
}

.saved-header p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.saved-list {
  display: grid;
  gap: 1px;
  background: var(--line);
}

.saved-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  background: rgba(25, 27, 31, 0.94);
}

.saved-info {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.saved-info strong,
.saved-info span,
.saved-info small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.saved-info span,
.saved-info small,
.empty-state {
  color: var(--muted);
}

.saved-info small {
  font-size: 0.78rem;
}

.saved-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

.small-button {
  min-height: 34px;
  padding: 0 12px;
  background: #30343c;
  color: var(--text);
}

.danger-button {
  color: #ffd0d0;
}

.danger-button:hover {
  background: rgba(255, 107, 107, 0.18);
}

.empty-state {
  margin: 0;
  padding: 16px;
  background: rgba(25, 27, 31, 0.94);
}

.results {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 20px;
}

.output-card {
  min-width: 0;
  overflow: hidden;
}

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

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(34, 37, 43, 0.8);
}

.copy-button {
  min-width: 72px;
  min-height: 34px;
  padding: 0 12px;
  background: #30343c;
  color: var(--text);
}

.copy-button:hover {
  background: #3b414c;
}

pre {
  min-height: 150px;
  max-height: 430px;
  margin: 0;
  padding: 16px;
  overflow: auto;
  color: #e8ebf0;
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  font-size: 0.92rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.error-box {
  margin-top: 18px;
  padding: 14px 16px;
  border: 1px solid rgba(255, 107, 107, 0.5);
  border-radius: 8px;
  background: rgba(255, 107, 107, 0.1);
  color: #ffd0d0;
  white-space: pre-wrap;
}

.hidden {
  display: none;
}

@media (max-width: 920px) {
  .grid,
  .results {
    grid-template-columns: 1fr 1fr;
  }
}

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

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

  .saved-header,
  .saved-item {
    align-items: stretch;
    flex-direction: column;
  }

  .saved-actions {
    width: 100%;
  }

  .small-button {
    flex: 1;
  }

  .grid,
  .results {
    grid-template-columns: 1fr;
  }

  .form-card {
    padding: 16px;
  }
}
