:root {
  --text: #111827;
  --muted: #8b909a;
  --line: #c9dced;
  --soft: rgba(255, 255, 255, 0.82);
  --shadow: 0 18px 60px rgba(58, 123, 213, 0.16);
  --blue: #0ea5e9;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Inter", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background:
    radial-gradient(circle at 22% 18%, rgba(255, 222, 240, 0.72), transparent 26%),
    radial-gradient(circle at 78% 22%, rgba(215, 246, 255, 0.88), transparent 28%),
    radial-gradient(circle at 45% 72%, rgba(225, 238, 255, 0.94), transparent 36%),
    linear-gradient(180deg, #ffffff 0%, #f3f8ff 100%);
}

.stage {
  width: min(1360px, calc(100vw - 40px));
  margin: 0 auto;
  padding: 44px 0 64px;
}

.hero {
  text-align: center;
}

.hero h1 {
  margin: 0;
  font-size: clamp(30px, 4vw, 56px);
  line-height: 1.05;
  letter-spacing: 0;
  font-weight: 900;
}

.hero h1 span {
  background: linear-gradient(90deg, #ff7a00 0%, #f01878 34%, #2658ff 68%, #10c56b 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 8px 24px rgba(49, 107, 255, 0.12);
}

.hero p {
  margin: 14px 0 32px;
  color: var(--muted);
  font-size: 17px;
}

.composer {
  width: min(1080px, 100%);
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--soft);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
  overflow: hidden;
}

.api-key-row {
  width: min(680px, 100%);
  margin: 0 auto 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 10px 26px rgba(58, 123, 213, 0.1);
  color: #475467;
  font-size: 15px;
  font-weight: 800;
}

.api-key-row input {
  min-width: 0;
  flex: 1;
  border: 1px solid #d7e3f0;
  border-radius: 10px;
  padding: 9px 11px;
  background: rgba(255, 255, 255, 0.86);
  color: #111827;
  font: inherit;
  outline: none;
}

.api-key-row input:focus {
  border-color: #60a5fa;
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.18);
}

textarea {
  display: block;
  width: 100%;
  min-height: 108px;
  border: 0;
  padding: 20px 26px 8px;
  background: transparent;
  color: #3f4652;
  font: inherit;
  font-size: 18px;
  resize: vertical;
  outline: none;
}

textarea::placeholder {
  color: #6e7480;
}

.reference-preview {
  display: none;
  gap: 10px;
  padding: 0 30px 12px;
  flex-wrap: wrap;
}

.reference-preview.has-images {
  display: flex;
}

.reference-item {
  position: relative;
}

.reference-item img {
  width: 76px;
  height: 76px;
  object-fit: cover;
  border-radius: 16px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
}

.remove-reference {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 24px;
  height: 24px;
  border: 1px solid rgba(255, 255, 255, 0.86);
  border-radius: 999px;
  background: #111827;
  color: #fff;
  cursor: pointer;
  font-size: 18px;
  font-weight: 900;
  line-height: 20px;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.2);
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px 16px 18px;
}

.pill,
.tool-label,
.select-pill {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #111827;
  font-size: 16px;
  font-weight: 800;
}

.pill {
  padding: 0 13px;
  cursor: pointer;
}

.pill.active {
  background: #eef2f7;
}

.upload-pill input {
  display: none;
}

.select-pill select {
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 800;
  outline: none;
}

.send-button {
  margin-left: auto;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  background: #eef0f4;
  color: #8a8f9a;
  cursor: pointer;
  font-size: 28px;
  line-height: 1;
  transition: transform 160ms ease, background 160ms ease, color 160ms ease;
}

.send-button:hover {
  transform: translateY(-2px);
  background: #dfeafe;
  color: #2563eb;
}

.download-card {
  display: grid;
  justify-items: center;
  gap: 18px;
  margin-top: 32px;
}

.download-title {
  min-width: 210px;
  min-height: 64px;
  border: 1px solid #d8e6f5;
  border-radius: 42px;
  background: rgba(255, 255, 255, 0.78);
  color: #111827;
  box-shadow: 0 14px 34px rgba(58, 123, 213, 0.14);
  cursor: pointer;
  font-size: 21px;
  font-weight: 900;
}

.status-text {
  color: #667085;
  font-size: 16px;
}

.error-message {
  width: min(760px, 100%);
  border: 1px solid #fecaca;
  border-radius: 18px;
  padding: 14px 18px;
  background: rgba(254, 242, 242, 0.82);
  color: #b42318;
  font-size: 16px;
  font-weight: 700;
  text-align: center;
}

.download-result {
  width: min(860px, 100%);
}

.link-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid #dbe8f6;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.75);
}

.video-link {
  overflow: hidden;
  color: #475467;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.download-button {
  border: 0;
  border-radius: 14px;
  padding: 12px 18px;
  background: #111827;
  color: #fff;
  text-decoration: none;
  cursor: pointer;
  font-weight: 800;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: 420px;
  border-radius: 16px;
  padding: 14px 16px;
  background: #111827;
  color: #fff;
  box-shadow: 0 14px 40px rgba(15, 23, 42, 0.22);
}

.hidden {
  display: none !important;
}

@media (max-width: 760px) {
  .stage {
    width: min(100vw - 24px, 100%);
    padding-top: 42px;
  }

  .hero p {
    margin-bottom: 36px;
  }

  .toolbar {
    gap: 8px;
    flex-wrap: wrap;
  }

  .send-button {
    margin-left: 0;
  }

  .link-row {
    grid-template-columns: 1fr;
  }
}
