:root {
  --bg: #090909;
  --panel: rgba(24, 24, 24, 0.78);
  --panel-strong: #151515;
  --text: #f7f7f7;
  --muted: #9b9b9b;
  --line: rgba(255, 255, 255, 0.12);
  --yellow: #f4c84c;
  --cyan: #66d9ff;
  --pink: #ff66b3;
  --violet: #8d7bff;
  color-scheme: dark;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 20% 12%, rgba(244, 200, 76, 0.16), transparent 28%),
    radial-gradient(circle at 76% 16%, rgba(102, 217, 255, 0.15), transparent 30%),
    linear-gradient(180deg, #0b0b0b, #111 52%, #080808);
}

body.image-create-page {
  min-height: 100vh;
  background: #101010;
}

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

a {
  color: inherit;
  text-decoration: none;
}

.studio-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 68px;
  padding: 14px clamp(16px, 5vw, 64px);
  background: rgba(9, 9, 9, 0.78);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 900;
}

.logo-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #101010;
  color: var(--yellow);
  font-size: 13px;
}

.studio-topbar nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  font-size: 14px;
  font-weight: 800;
}

.nav-pill.is-active {
  color: #101010;
  background: var(--text);
}

.studio-page {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: 54px 0 80px;
}

.studio-hero {
  display: grid;
  grid-template-columns: minmax(0, 0.94fr) minmax(320px, 0.72fr);
  gap: 22px;
  align-items: stretch;
}

.studio-copy {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 640px;
  border: 1px solid var(--line);
  border-radius: 30px;
  padding: clamp(24px, 4vw, 42px);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02)),
    var(--panel);
  box-shadow: 0 28px 100px rgba(0, 0, 0, 0.45);
}

.image-workspace {
  justify-content: flex-start;
  min-height: auto;
  background:
    linear-gradient(145deg, rgba(96, 154, 202, 0.2), rgba(35, 71, 102, 0.72)),
    rgba(28, 59, 84, 0.92);
}

.video-workspace {
  justify-content: flex-start;
}

.studio-kicker {
  margin: 0 0 14px;
  color: var(--yellow);
  font-size: 13px;
  font-weight: 950;
  text-transform: uppercase;
}

.studio-copy h1 {
  max-width: 720px;
  margin: 0;
  font-size: clamp(42px, 6vw, 76px);
  line-height: 0.98;
  letter-spacing: 0;
}

.studio-copy > p {
  max-width: 640px;
  margin: 20px 0 30px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.8;
}

.creator-form {
  display: grid;
  gap: 18px;
}

.prompt-card {
  display: grid;
  gap: 14px;
}

.prompt-card label,
.field label {
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
  font-weight: 900;
}

.prompt-card .creator-title {
  color: rgba(255, 255, 255, 0.86);
  font-size: 16px;
  font-weight: 500;
}

.prompt-card textarea {
  width: 100%;
  min-height: 142px;
  border: 1px solid var(--line);
  border-radius: 22px;
  resize: vertical;
  outline: 0;
  padding: 18px;
  color: var(--text);
  background: rgba(0, 0, 0, 0.22);
  line-height: 1.7;
}

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

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

.field select,
.field input {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 15px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
  outline: 0;
}

.field option {
  color: var(--text);
  background: #171717;
}

.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.segmented button,
.upload-box,
.chip-button,
.submit-button {
  border: 0;
  cursor: pointer;
}

.segmented button,
.chip-button {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  font-weight: 800;
}

.segmented button.is-active {
  color: #101010;
  background: #f7f7f7;
}

.quick-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.upload-box {
  display: grid;
  min-height: 96px;
  place-items: center;
  border: 1px dashed rgba(255, 255, 255, 0.22);
  border-radius: 20px;
  color: rgba(255, 255, 255, 0.66);
  background: rgba(255, 255, 255, 0.04);
  font-weight: 800;
}

.submit-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.submit-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 22px;
  border-radius: 999px;
  color: #101010;
  background: var(--text);
  font-weight: 950;
}

.submit-row span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.result-panel {
  display: grid;
  gap: 10px;
  border: 1px solid rgba(102, 217, 255, 0.18);
  border-radius: 18px;
  padding: 16px;
  background: rgba(102, 217, 255, 0.08);
}

.result-panel[hidden] {
  display: none;
}

.result-panel h2 {
  margin: 0;
  font-size: 18px;
}

.result-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.result-panel code {
  display: block;
  overflow-wrap: anywhere;
  border-radius: 12px;
  padding: 12px;
  color: #d7f3ff;
  background: rgba(0, 0, 0, 0.28);
}

.generated-image {
  display: block;
  width: 100%;
  max-height: 620px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(0, 0, 0, 0.28);
}

.result-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  width: fit-content;
  border-radius: 999px;
  padding: 0 14px;
  color: #101010;
  background: var(--text);
  font-size: 13px;
  font-weight: 900;
}

.image-composer-page {
  min-height: calc(100vh - 68px);
  display: grid;
  place-items: center;
  padding: 42px 18px 76px;
}

.image-create-page.has-result .image-composer-page,
.composer-create-page.has-result .image-composer-page {
  min-height: calc(100vh - 68px);
  place-items: stretch center;
  padding: 24px 18px 20px;
}

.image-composer-hero {
  width: min(980px, 100%);
  display: grid;
  justify-items: center;
  gap: 24px;
}

.composer-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.banana-icon {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border-radius: 14px;
  color: #1b1b1b;
  background: linear-gradient(145deg, #ffe86b, #ffc72b);
  font-size: 34px;
  font-weight: 950;
  transform: rotate(12deg);
}

.composer-brand h1 {
  margin: 0;
  color: #f5f5f5;
  font-size: clamp(34px, 5vw, 56px);
  line-height: 1.05;
  letter-spacing: 0;
}

.composer-form {
  width: min(920px, 100%);
  display: grid;
  gap: 18px;
}

.image-create-page.has-result .composer-form,
.composer-create-page.has-result .composer-form {
  min-height: calc(100vh - 112px);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.image-create-page.has-result .composer-brand,
.composer-create-page.has-result .composer-brand {
  display: none;
}

.image-create-page.has-result .composer-box,
.composer-create-page.has-result .composer-box {
  order: 2;
  position: sticky;
  bottom: 18px;
  z-index: 30;
}

.composer-box {
  position: relative;
  display: grid;
  gap: 14px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 32px;
  padding: 18px 18px 14px;
  background: #232323;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
}

.composer-box textarea {
  min-height: 34px;
  width: 100%;
  border: 0;
  outline: 0;
  resize: vertical;
  color: #f7f7f7;
  background: transparent;
  font-size: 17px;
  line-height: 1.6;
}

.composer-box textarea::placeholder {
  color: rgba(255, 255, 255, 0.44);
}

.composer-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.tool-popover {
  position: relative;
}

.tool-chip,
.upload-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  gap: 8px;
  border: 0;
  border-radius: 999px;
  padding: 0 16px;
  color: #f2f2f2;
  background: #333;
  cursor: pointer;
  font-weight: 800;
}

.upload-chip {
  max-width: 180px;
}

.upload-chip [data-upload-label] {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-chip {
  padding: 0 14px;
}

.tool-menu {
  position: absolute;
  left: 0;
  bottom: calc(100% + 10px);
  z-index: 40;
  display: grid;
  min-width: 210px;
  gap: 6px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  background: #292929;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.42);
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: 150ms ease;
}

.tool-popover:hover .tool-menu,
.tool-popover:focus-within .tool-menu,
.tool-popover.is-open .tool-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.tool-menu p {
  margin: 0 0 6px;
  color: rgba(255, 255, 255, 0.45);
  font-size: 12px;
}

.tool-menu button {
  min-height: 36px;
  border: 0;
  border-radius: 10px;
  padding: 0 10px;
  color: #f3f3f3;
  background: transparent;
  text-align: left;
  cursor: pointer;
  font-weight: 800;
}

.tool-menu button:hover,
.tool-menu button.is-selected {
  background: rgba(255, 255, 255, 0.08);
}

.tool-menu button.is-selected::before {
  content: "◉ ";
}

.tool-menu button:not(.is-selected)::before {
  content: "○ ";
  color: rgba(255, 255, 255, 0.35);
}

.compact-menu {
  min-width: 136px;
}

.icon-submit {
  width: 44px;
  min-height: 44px;
  margin-left: auto;
  padding: 0;
  color: #101010;
  background: #c7c7c7;
  font-size: 24px;
}

.icon-submit[disabled] {
  color: #101010;
  opacity: 0.72;
}

.image-create-page .result-panel {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
}

.image-create-page.has-result .result-panel,
.composer-create-page.has-result .result-panel {
  order: 1;
  width: min(720px, 100%);
  margin: 0 auto 18px;
}

.preview-panel {
  position: relative;
  overflow: hidden;
  min-height: 640px;
  border: 1px solid var(--line);
  border-radius: 30px;
  background:
    radial-gradient(circle at 62% 24%, rgba(255, 255, 255, 0.16), transparent 18%),
    linear-gradient(180deg, #172435, #111);
  box-shadow: 0 28px 100px rgba(0, 0, 0, 0.48);
}

.preview-panel.image-preview {
  background:
    radial-gradient(circle at 62% 24%, rgba(255, 255, 255, 0.22), transparent 16%),
    linear-gradient(145deg, #4e315e, #1c3a47 52%, #121212);
}

.preview-panel.video-preview {
  background:
    linear-gradient(to top, rgba(5, 8, 12, 0.8), rgba(5, 8, 12, 0.12)),
    url("assets/hero-ai-market.png");
  background-size: cover;
  background-position: center;
}

.preview-head {
  position: relative;
  z-index: 1;
  padding: 24px;
}

.preview-head span {
  color: rgba(255, 255, 255, 0.56);
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
}

.preview-head h2 {
  margin: 8px 0 0;
  font-size: clamp(28px, 3vw, 42px);
  line-height: 1.06;
}

.image-grid {
  position: absolute;
  inset: auto 22px 22px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.image-tile {
  min-height: 164px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 22px;
  background:
    radial-gradient(circle at 68% 34%, rgba(255, 255, 255, 0.75), transparent 13%),
    linear-gradient(145deg, rgba(244, 200, 76, 0.55), rgba(255, 102, 179, 0.34), rgba(102, 217, 255, 0.2));
}

.image-tile:nth-child(2) {
  background:
    radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.7), transparent 12%),
    linear-gradient(145deg, #173b53, #5c52b7);
}

.image-tile:nth-child(3) {
  grid-column: span 2;
  min-height: 120px;
  background:
    linear-gradient(to right, rgba(0, 0, 0, 0.22), transparent),
    url("assets/hero-ai-market.png");
  background-size: cover;
  background-position: center;
}

.video-frame {
  position: absolute;
  left: 22px;
  right: 22px;
  bottom: 22px;
  min-height: 330px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 26px;
  background: rgba(0, 0, 0, 0.24);
}

.video-frame::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to top, rgba(0, 0, 0, 0.64), transparent),
    url("assets/hero-ai-market.png");
  background-size: cover;
  background-position: center;
}

.play-mark {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 1;
  display: grid;
  width: 74px;
  height: 74px;
  place-items: center;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  color: #101010;
  background: rgba(255, 255, 255, 0.82);
  font-size: 28px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 30;
  transform: translateX(-50%) translateY(22px);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(28, 28, 28, 0.94);
  color: var(--text);
  padding: 12px 18px;
  opacity: 0;
  transition: 0.22s ease;
}

.toast.is-visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

@media (max-width: 900px) {
  .studio-hero {
    grid-template-columns: 1fr;
  }

  .studio-copy,
  .preview-panel {
    min-height: auto;
  }

  .preview-panel {
    min-height: 520px;
  }
}

@media (max-width: 620px) {
  .studio-page {
    width: min(100%, calc(100% - 20px));
    padding-top: 24px;
  }

  .studio-topbar {
    align-items: center;
    flex-direction: row;
    gap: 12px;
    min-height: 100px;
    padding: 14px 20px;
  }

  .studio-topbar nav {
    flex: 1;
    min-width: 0;
  }

  .nav-pill {
    flex: 1;
    padding: 0 10px;
  }

  .brand {
    flex: 0 0 auto;
  }

  .studio-copy {
    border-radius: 24px;
    padding: 22px;
  }

  .video-create-page .studio-page {
    padding-top: 24px;
  }

  .video-create-page .video-copy-head {
    display: none;
  }

  .video-create-page .studio-copy {
    min-height: auto;
    padding: 22px;
    background:
      linear-gradient(145deg, rgba(96, 154, 202, 0.2), rgba(35, 71, 102, 0.72)),
      rgba(28, 59, 84, 0.92);
  }

  .video-create-page .quick-row,
  .video-create-page .submit-row span {
    display: none;
  }

  .video-create-page .prompt-card textarea {
    min-height: 140px;
  }

  .image-workspace {
    padding: 28px 22px 22px;
  }

  .control-grid {
    grid-template-columns: 1fr;
  }

  .submit-button {
    width: 100%;
  }

  .preview-panel {
    border-radius: 24px;
    min-height: 440px;
  }

  .image-grid {
    inset: auto 14px 14px;
  }

  .image-tile {
    min-height: 132px;
  }

  .video-frame {
    left: 14px;
    right: 14px;
    bottom: 14px;
    min-height: 260px;
  }

  .image-composer-page {
    min-height: calc(100vh - 100px);
    place-items: start center;
    padding: 150px 12px 48px;
  }

  .image-create-page.has-result .image-composer-page,
  .composer-create-page.has-result .image-composer-page {
    min-height: calc(100vh - 100px);
    padding: 14px 10px 12px;
  }

  .image-create-page.has-result .composer-form,
  .composer-create-page.has-result .composer-form {
    min-height: calc(100vh - 126px);
  }

  .image-create-page.has-result .composer-box,
  .composer-create-page.has-result .composer-box {
    bottom: 12px;
  }

  .image-create-page.has-result .result-panel,
  .composer-create-page.has-result .result-panel {
    margin-bottom: 12px;
  }

  .composer-brand {
    gap: 10px;
  }

  .banana-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    font-size: 28px;
  }

  .composer-brand h1 {
    font-size: clamp(30px, 10vw, 42px);
  }

  .composer-box {
    border-radius: 28px;
    padding: 16px;
  }

  .composer-box textarea {
    min-height: 88px;
    font-size: 16px;
  }

  .composer-tools {
    gap: 8px;
  }

  .tool-chip,
  .upload-chip {
    min-height: 38px;
    padding: 0 12px;
    font-size: 13px;
  }

  .tool-menu {
    left: 50%;
    min-width: 190px;
    transform: translate(-50%, 8px);
  }

  .tool-popover:hover .tool-menu,
  .tool-popover:focus-within .tool-menu,
  .tool-popover.is-open .tool-menu {
    transform: translate(-50%, 0);
  }

  .icon-submit {
    width: 42px;
    min-height: 42px;
  }
}
