:root {
  --bg: #071018;
  --bg-deep: #04070d;
  --panel: rgba(10, 16, 28, 0.9);
  --panel-strong: rgba(7, 12, 22, 0.96);
  --surface: rgba(11, 18, 31, 0.82);
  --surface-soft: rgba(18, 29, 48, 0.72);
  --border: rgba(120, 143, 178, 0.18);
  --border-strong: rgba(138, 162, 199, 0.28);
  --text: #f4f7fb;
  --text-soft: #c4cedd;
  --text-muted: #8d9ab0;
  --accent: #f3c46d;
  --accent-strong: #d99a3e;
  --accent-soft: #ffe1ae;
  --secondary: #6fd0bb;
  --secondary-strong: #3ba893;
  --success: #52d18c;
  --danger: #ff6b78;
  --warning: #f6c657;
  --shadow-lg: 0 30px 80px rgba(0, 0, 0, 0.45);
  --shadow-md: 0 18px 50px rgba(0, 0, 0, 0.34);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 18px;
  --radius-sm: 14px;
  --font-display: "Space Grotesk", "Segoe UI", sans-serif;
  --font-body: "Manrope", "Segoe UI", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(111, 208, 187, 0.12), transparent 30%),
    radial-gradient(circle at top right, rgba(243, 196, 109, 0.12), transparent 34%),
    linear-gradient(180deg, #09111b 0%, #05080e 100%);
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: auto;
  width: 28rem;
  height: 28rem;
  border-radius: 999px;
  pointer-events: none;
  z-index: -1;
  filter: blur(18px);
  opacity: 0.35;
}

body::before {
  top: -8rem;
  right: -10rem;
  background: radial-gradient(circle, rgba(243, 196, 109, 0.28), transparent 65%);
}

body::after {
  bottom: -10rem;
  left: -8rem;
  background: radial-gradient(circle, rgba(111, 208, 187, 0.22), transparent 68%);
}

img,
video,
audio {
  max-width: 100%;
  display: block;
}

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

button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 18px;
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  background: rgba(15, 24, 40, 0.9);
  color: var(--text);
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition:
    transform 0.18s ease,
    border-color 0.18s ease,
    background 0.18s ease,
    box-shadow 0.18s ease,
    opacity 0.18s ease;
}

button:hover,
button:focus-visible {
  transform: translateY(-1px);
  background: rgba(21, 33, 54, 0.96);
  border-color: rgba(111, 208, 187, 0.45);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.2);
}

button:disabled {
  opacity: 0.65;
  cursor: wait;
  transform: none;
  box-shadow: none;
}

button[aria-busy="true"]::after {
  content: "";
  width: 14px;
  height: 14px;
  margin-left: 10px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: currentColor;
  animation: spin 0.7s linear infinite;
}

.btnPrimary {
  color: #1f1507;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
  border-color: rgba(255, 243, 219, 0.3);
  box-shadow: 0 16px 34px rgba(217, 154, 62, 0.22);
}

.btnPrimary:hover,
.btnPrimary:focus-visible {
  background: linear-gradient(135deg, #f8cf82 0%, #e2a650 100%);
}

.btnGhost {
  background: rgba(11, 18, 31, 0.9);
}

.btnDanger {
  color: #fff;
  background: linear-gradient(135deg, #ff7c84 0%, #c73d58 100%);
  border-color: transparent;
  box-shadow: 0 14px 32px rgba(199, 61, 88, 0.2);
}

a.link {
  color: var(--accent-soft);
  text-decoration: none;
  transition: color 0.18s ease, opacity 0.18s ease;
}

a.link:hover,
a.link:focus-visible {
  color: #fff;
}

.hidden {
  display: none !important;
}

.container {
  width: min(1200px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 56px;
}

.app-shell {
  display: grid;
  gap: 24px;
}

.hero,
.card {
  animation: rise-in 0.55s ease both;
}

.hero {
  position: relative;
  overflow: hidden;
  padding: 32px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  background:
    linear-gradient(135deg, rgba(19, 31, 51, 0.92) 0%, rgba(9, 14, 25, 0.98) 100%);
  box-shadow: var(--shadow-lg);
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 12% 18%, rgba(243, 196, 109, 0.1), transparent 24%),
    radial-gradient(circle at 86% 22%, rgba(111, 208, 187, 0.1), transparent 20%),
    linear-gradient(120deg, rgba(255, 255, 255, 0.04), transparent 55%);
  pointer-events: none;
}

.hero__eyebrow,
.btnRow {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.pill,
.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(9, 14, 24, 0.86);
  color: #eef2f8;
  font-size: 0.82rem;
  font-weight: 600;
}

.pill--accent {
  color: var(--accent-soft);
  border-color: rgba(243, 196, 109, 0.35);
  background: rgba(243, 196, 109, 0.1);
}

.badge.good {
  color: #d8ffea;
  border-color: rgba(82, 209, 140, 0.4);
  background: rgba(20, 58, 40, 0.5);
}

.badge.bad {
  color: #ffe0e4;
  border-color: rgba(255, 107, 120, 0.4);
  background: rgba(74, 18, 28, 0.5);
}

.badge.warn {
  color: #fff0ca;
  border-color: rgba(246, 198, 87, 0.38);
  background: rgba(74, 49, 6, 0.46);
}

.hero__grid {
  position: relative;
  display: grid;
  gap: 24px;
  margin-top: 22px;
}

.hero__content,
.hero__panel {
  position: relative;
  z-index: 1;
}

.hero__kicker,
.sectionLabel,
.cardTitle,
.statusChip span,
.metric__label {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.74rem;
  color: var(--text-muted);
}

.hero h1 {
  max-width: 11ch;
  margin: 10px 0 0;
  font-family: var(--font-display);
  font-size: clamp(2.35rem, 5vw, 4.4rem);
  line-height: 0.98;
}

.hero__lead,
.sectionCopy,
.cardSubtitle,
.miniNote,
.tip,
.promptPreview,
.hero__panel-copy {
  color: var(--text-soft);
}

.hero__lead {
  max-width: 58ch;
  margin: 18px 0 0;
  font-size: 1.03rem;
  line-height: 1.7;
}

.hero__stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 24px;
}

.metric,
.statusChip {
  padding: 16px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: rgba(8, 13, 23, 0.78);
}

.metric strong,
.statusChip strong {
  display: block;
  margin-top: 8px;
  font-size: 1.02rem;
}

.hero__panel-card {
  height: 100%;
  padding: 24px;
  border-radius: 24px;
  border: 1px solid rgba(138, 162, 199, 0.22);
  background:
    linear-gradient(180deg, rgba(10, 16, 28, 0.9) 0%, rgba(6, 11, 20, 0.95) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.hero__panel-title {
  display: block;
  margin-top: 10px;
  font-family: var(--font-display);
  font-size: 1.55rem;
}

.hero__panel-copy {
  margin: 10px 0 0;
  line-height: 1.7;
}

.promptPreviewWrap {
  display: grid;
  gap: 10px;
  margin-top: 22px;
}

.promptPreview {
  min-height: 160px;
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: rgba(4, 9, 17, 0.88);
  line-height: 1.72;
  white-space: pre-wrap;
}

.workspace-grid {
  display: grid;
  gap: 24px;
  align-items: start;
}

.card {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background:
    linear-gradient(180deg, rgba(11, 18, 31, 0.96) 0%, rgba(7, 12, 22, 0.98) 100%);
  box-shadow: var(--shadow-md);
}

.cardHeader {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent);
}

.cardTitle {
  font-family: var(--font-display);
}

.cardSubtitle {
  margin: 8px 0 0;
  max-width: 52ch;
  font-size: 0.94rem;
  line-height: 1.6;
}

.cardBody {
  padding: 24px;
}

.stack {
  display: grid;
  gap: 22px;
}

.stack--tight {
  gap: 16px;
}

.dividerBlock {
  padding-top: 6px;
  border-top: 1px solid var(--border);
}

.sectionHeadingWrap {
  display: grid;
  gap: 6px;
}

.sectionHeadingWrap--inline {
  align-items: end;
}

.sectionHeading {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.28rem;
}

.sectionCopy {
  margin: 0;
  line-height: 1.65;
}

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

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

.field {
  min-width: 0;
}

.field--wide {
  grid-column: 1 / -1;
}

label {
  display: block;
  margin: 0 0 8px;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
}

input,
textarea,
select {
  width: 100%;
  min-height: 52px;
  padding: 14px 16px;
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  background: rgba(5, 10, 18, 0.88);
  color: var(--text);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.03),
    0 0 0 1px transparent;
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease;
}

input::placeholder,
textarea::placeholder {
  color: rgba(196, 206, 221, 0.52);
}

input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: none;
  border-color: rgba(111, 208, 187, 0.5);
  box-shadow: 0 0 0 4px rgba(111, 208, 187, 0.12);
  background: rgba(7, 13, 23, 0.94);
}

textarea {
  min-height: 148px;
  resize: vertical;
}

.textareaCompact {
  min-height: 96px;
}

select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--text-muted) 50%),
    linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
  background-position:
    calc(100% - 20px) calc(50% - 3px),
    calc(100% - 14px) calc(50% - 3px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 42px;
}

.miniNote,
.tip {
  font-size: 0.9rem;
  line-height: 1.6;
}

.miniNote {
  margin: 8px 0 0;
}

.tip {
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(243, 196, 109, 0.24);
  background: rgba(56, 40, 8, 0.22);
}

.fusionSection {
  display: grid;
  gap: 14px;
}

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

.presetCard {
  display: grid;
  gap: 8px;
  min-height: 148px;
  padding: 18px;
  text-align: left;
  border-radius: 20px;
  border: 1px solid var(--border);
  background:
    linear-gradient(180deg, rgba(15, 24, 40, 0.95) 0%, rgba(8, 14, 24, 0.96) 100%);
}

.presetCard.is-active {
  border-color: rgba(243, 196, 109, 0.4);
  background:
    linear-gradient(180deg, rgba(44, 34, 12, 0.62) 0%, rgba(15, 20, 30, 0.98) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 18px 34px rgba(0, 0, 0, 0.22);
}

.presetCard__eyebrow {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-muted);
}

.presetCard__title {
  font-family: var(--font-display);
  font-size: 1rem;
}

.presetCard__desc {
  color: var(--text-soft);
  line-height: 1.55;
}

.btnRow--compact {
  gap: 10px;
}

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

.switch,
.field--inline {
  min-height: 60px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(8, 13, 23, 0.76);
}

.switch {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

.switch span {
  line-height: 1.5;
}

.switch input {
  width: 20px;
  height: 20px;
  min-height: 20px;
  margin: 0;
  accent-color: var(--secondary);
  flex: 0 0 auto;
}

.field--inline label {
  margin-bottom: 8px;
}

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

.statusBanner {
  display: flex;
  align-items: center;
  min-height: 78px;
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid var(--border-strong);
  background: rgba(10, 17, 30, 0.82);
  line-height: 1.6;
}

.statusBanner[data-kind="good"] {
  color: #d8ffea;
  border-color: rgba(82, 209, 140, 0.34);
  background: rgba(16, 56, 38, 0.38);
}

.statusBanner[data-kind="bad"] {
  color: #ffe0e4;
  border-color: rgba(255, 107, 120, 0.34);
  background: rgba(65, 15, 25, 0.4);
}

.statusBanner[data-kind="warn"] {
  color: #fff0ca;
  border-color: rgba(246, 198, 87, 0.3);
  background: rgba(71, 46, 8, 0.32);
}

.logBox {
  min-height: 240px;
  max-height: 380px;
  overflow: auto;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: #03070d;
  color: #cdd7e5;
  white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.82rem;
  line-height: 1.65;
}

.previewPanel,
.audioPreview {
  display: grid;
  gap: 12px;
}

.audioPreview {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(8, 13, 23, 0.72);
}

video,
audio {
  border-radius: 18px;
  border: 1px solid var(--border);
  background: #02060c;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

audio {
  min-height: 54px;
}

.card--status {
  position: sticky;
  top: 24px;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@media (min-width: 960px) {
  .hero__grid {
    grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.85fr);
  }

  .workspace-grid {
    grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.9fr);
  }
}

@media (max-width: 959px) {
  .card--status {
    position: static;
  }
}

@media (max-width: 820px) {
  .container {
    width: min(100% - 20px, 1200px);
    padding: 20px 0 40px;
  }

  .hero,
  .cardBody,
  .cardHeader {
    padding-left: 18px;
    padding-right: 18px;
  }

  .hero {
    padding-top: 24px;
    padding-bottom: 24px;
  }

  .hero h1 {
    max-width: 12ch;
  }

  .hero__stats,
  .field-grid,
  .field-grid--triple,
  .presetGrid,
  .switchRow,
  .statusSummary {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .hero h1 {
    font-size: 2.3rem;
  }

  .hero__lead,
  .sectionCopy,
  .cardSubtitle {
    font-size: 0.95rem;
  }

  button,
  .pill,
  .badge {
    width: 100%;
  }

  .btnRow {
    flex-direction: column;
  }

  .switch {
    align-items: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
