:root {
  color: #f5f7ff;
  background: #070915;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 10% 0%, rgba(103, 90, 255, 0.2), transparent 32%),
    radial-gradient(circle at 92% 32%, rgba(15, 201, 178, 0.12), transparent 32%),
    #070915;
}

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

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

.hero,
.connection-card,
.model-tabs,
.workspace,
.section-heading,
.result-heading {
  display: flex;
}

.hero {
  justify-content: space-between;
  align-items: flex-start;
  gap: 30px;
  margin-bottom: 28px;
}

.hero h1 {
  margin: 0;
  font-size: clamp(40px, 7vw, 76px);
  letter-spacing: -0.055em;
  line-height: 0.98;
}

.eyebrow {
  margin: 0 0 9px;
  color: #8e82ff;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.18em;
}

.subtitle {
  margin: 18px 0 0;
  color: #9da4bf;
  font-size: 16px;
}

nav {
  display: flex;
  gap: 10px;
}

nav a {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 10px 14px;
  color: #cbd0e5;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.04);
}

.connection-card,
.model-tabs,
.forms,
.result-panel,
.api-guide {
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(12, 15, 33, 0.82);
  box-shadow: 0 20px 80px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(18px);
}

.connection-card {
  align-items: end;
  gap: 18px;
  border-radius: 18px;
  padding: 18px 20px;
}

.connection-card > div {
  min-width: 330px;
}

.connection-card label {
  flex: 1;
}

.connection-card span,
label > span,
.guide-grid span {
  display: block;
  margin-bottom: 7px;
  color: #858da9;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
}

code {
  color: #9ef5dd;
  font-family: "Cascadia Code", Consolas, monospace;
}

.connection-card code {
  display: block;
  overflow: hidden;
  padding: 12px 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 12px;
  outline: 0;
  padding: 12px 14px;
  color: #f4f6ff;
  background: #090c1d;
}

input:focus,
textarea:focus,
select:focus {
  border-color: #8e82ff;
  box-shadow: 0 0 0 3px rgba(142, 130, 255, 0.12);
}

textarea {
  resize: vertical;
  line-height: 1.65;
}

.status {
  border-radius: 999px;
  padding: 9px 12px;
  color: #b6bdd4;
  background: rgba(255, 255, 255, 0.05);
  font-size: 12px;
  white-space: nowrap;
}

.status.ready {
  color: #7af0c9;
  background: rgba(40, 215, 160, 0.1);
}

.model-tabs {
  gap: 12px;
  margin-top: 18px;
  border-radius: 18px;
  padding: 10px;
}

.model-tab {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 12px;
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 14px;
  color: #b9bfd3;
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.model-tab.active {
  border-color: rgba(142, 130, 255, 0.35);
  color: #fff;
  background: rgba(124, 108, 255, 0.14);
}

.model-tab strong,
.model-tab small {
  display: block;
}

.model-tab small {
  margin-top: 4px;
  color: #747e9e;
  font-family: "Cascadia Code", Consolas, monospace;
}

.model-icon {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 11px;
  color: #0c0d19;
  background: linear-gradient(135deg, #9d91ff, #52e0c1);
  font-weight: 900;
}

.workspace {
  align-items: stretch;
  gap: 18px;
  margin-top: 18px;
}

.forms,
.result-panel {
  min-width: 0;
  border-radius: 22px;
  padding: 26px;
}

.forms {
  flex: 0.9;
}

.result-panel {
  flex: 1.1;
  min-height: 570px;
}

.generator-form {
  width: 100%;
}

.section-heading,
.result-heading {
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

h2 {
  margin: 0;
  font-size: 25px;
}

.section-heading > code {
  border-radius: 999px;
  padding: 7px 10px;
  background: rgba(83, 226, 193, 0.08);
  font-size: 11px;
}

label {
  display: grid;
  gap: 1px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 14px;
}

.form-row.image-options {
  grid-template-columns: 1fr 1fr 0.75fr;
}

.submit-button {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  margin-top: 22px;
  border: 0;
  border-radius: 13px;
  padding: 14px 17px;
  color: #090b16;
  background: linear-gradient(100deg, #9d91ff, #55e3c3);
  font-weight: 900;
  cursor: pointer;
}

.submit-button:disabled {
  cursor: wait;
  filter: grayscale(0.4);
  opacity: 0.6;
}

#latency {
  color: #7e87a5;
  font-size: 12px;
}

.empty-result {
  display: grid;
  min-height: 430px;
  place-items: center;
  align-content: center;
  color: #717a99;
  text-align: center;
}

.empty-result span {
  color: #8e82ff;
  font-size: 46px;
}

.empty-result p {
  max-width: 320px;
  line-height: 1.7;
}

#textResult,
#rawResult {
  overflow: auto;
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: #dce1f4;
  font-family: inherit;
  line-height: 1.75;
}

#textResult {
  min-height: 410px;
  max-height: 650px;
  border-radius: 14px;
  padding: 20px;
  background: #080b1a;
}

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

.media-grid img,
#videoPlayer {
  width: 100%;
  border-radius: 15px;
  background: #050711;
}

.media-grid img {
  min-height: 240px;
  object-fit: contain;
}

.progress-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.progress-track span {
  display: block;
  width: 4%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #8e82ff, #52e0c1);
  transition: width 0.3s ease;
}

#videoStatus {
  color: #a0a8c2;
}

details {
  margin-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 14px;
}

summary {
  color: #7f89a6;
  cursor: pointer;
  font-size: 12px;
}

#rawResult {
  max-height: 260px;
  margin-top: 12px;
  font-size: 12px;
}

.api-guide {
  display: grid;
  grid-template-columns: 0.6fr 2fr;
  gap: 28px;
  margin-top: 18px;
  border-radius: 22px;
  padding: 26px;
}

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

.guide-grid article {
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 12px;
  padding: 13px;
  background: rgba(255, 255, 255, 0.025);
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  max-width: min(380px, calc(100% - 48px));
  border: 1px solid rgba(142, 130, 255, 0.3);
  border-radius: 12px;
  padding: 13px 16px;
  color: #e8e5ff;
  background: #17162c;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.45);
}

[hidden] {
  display: none !important;
}

@media (max-width: 900px) {
  .workspace,
  .api-guide {
    display: grid;
    grid-template-columns: 1fr;
  }

  .connection-card {
    display: grid;
    align-items: stretch;
  }

  .connection-card > div {
    min-width: 0;
  }
}

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

  .hero,
  .model-tabs {
    display: grid;
  }

  nav {
    width: 100%;
  }

  nav a,
  .model-tab {
    flex: 1;
  }

  .model-tabs,
  .form-row,
  .form-row.image-options,
  .guide-grid,
  .media-grid {
    grid-template-columns: 1fr;
  }

  .forms,
  .result-panel,
  .api-guide {
    padding: 20px;
  }
}
