:root {
  --ink: #191919;
  --muted: #777777;
  --line: #dddddd;
  --soft-line: #eeeeee;
  --panel: #ffffff;
  --lime: #dfff5a;
  --black: #151515;
  --grid: rgba(0, 0, 0, 0.035);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: #ffffff;
}

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

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

.launch-bar {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  height: 42px;
  padding: 0 16px;
  color: #111111;
  background: var(--lime);
  font-size: 14px;
  font-weight: 700;
}

.launch-bar span {
  justify-self: center;
}

.launch-bar button {
  width: 28px;
  height: 28px;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.app-nav {
  display: grid;
  grid-template-columns: 129px 1fr auto;
  align-items: center;
  height: 58px;
  padding: 0 16px;
  background: rgba(255, 255, 255, 0.98);
  border-bottom: 1px solid #e4e4e4;
}

.brand,
.main-nav,
.nav-actions {
  display: flex;
  align-items: center;
}

.brand {
  gap: 11px;
  font-size: 16px;
}

.brand-badge {
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  color: #151515;
  background: #ffe266;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 900;
}

.main-nav {
  gap: 20px;
  color: #666666;
  font-size: 14px;
}

.main-nav a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 15px;
  border-radius: 6px;
}

.main-nav a.is-active {
  color: #222222;
  background: #f4f4f4;
  font-weight: 800;
}

.nav-actions {
  gap: 18px;
  font-size: 13px;
}

.nav-actions button {
  border: 0;
  background: transparent;
  color: #666666;
  cursor: pointer;
}

.account-dot {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  color: #ffffff;
  background: #0d1117;
  border-radius: 50%;
  font-weight: 800;
}

.creator-shell {
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr);
  min-height: calc(100vh - 100px);
}

.generator-panel {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 100px);
  padding: 12px 16px;
  background: #ffffff;
  border-right: 1px solid #dedede;
}

.panel-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 24px;
}

.panel-top h1 {
  margin: 0;
  font-size: 20px;
  line-height: 1;
}

.mode-tabs {
  display: inline-flex;
  gap: 6px;
}

.mode-tabs button {
  height: 28px;
  padding: 0 10px;
  border: 0;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
}

.mode-tabs button.is-active {
  color: #ffffff;
  background: var(--black);
}

.field,
.prompt-field,
.upload-section {
  display: grid;
  gap: 10px;
  margin-bottom: 20px;
}

.video-mode-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 2px;
  background: #f2f2f4;
  border-radius: 8px;
}

.video-mode-tabs button,
.two-option-control button,
.aspect-control button {
  border: 0;
  color: #777777;
  background: transparent;
  border-radius: 7px;
  cursor: pointer;
}

.video-mode-tabs button {
  height: 30px;
  font-size: 12px;
}

.video-mode-tabs button.is-active,
.two-option-control button.is-active,
.aspect-control button.is-active {
  color: #222222;
  background: #ffffff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.field > span,
.prompt-field > span,
.section-label {
  color: #111111;
  font-size: 14px;
  font-weight: 700;
}

.section-label {
  display: flex;
  gap: 4px;
}

select,
.ratio-select,
.count-field input {
  width: 100%;
  min-height: 41px;
  padding: 0 12px;
  color: #222222;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

select {
  appearance: none;
  background:
    linear-gradient(45deg, transparent 50%, #777777 50%) calc(100% - 18px) 17px / 6px 6px no-repeat,
    linear-gradient(135deg, #777777 50%, transparent 50%) calc(100% - 13px) 17px / 6px 6px no-repeat,
    #ffffff;
}

.upload-tile {
  display: grid;
  width: 62px;
  height: 62px;
  place-items: center;
  color: #777777;
  border: 2px dashed #dddddd;
  border-radius: 9px;
  cursor: pointer;
}

.upload-tile input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.upload-tile span {
  font-size: 28px;
}

.reference-preview-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.reference-chip {
  max-width: 148px;
  overflow: hidden;
  padding: 5px 8px;
  color: #555555;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: #f4f4f4;
  border: 1px solid #e1e1e1;
  border-radius: 6px;
  font-size: 12px;
}

.prompt-field {
  gap: 9px;
}

.prompt-field textarea {
  width: 100%;
  height: 164px;
  padding: 16px 12px;
  resize: none;
  color: #222222;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  outline: none;
}

.prompt-field textarea::placeholder {
  color: #aaaaaa;
}

.prompt-field button {
  justify-self: stretch;
  height: 38px;
  padding-right: 14px;
  color: #b7b7b7;
  text-align: right;
  background: #ffffff;
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 8px 8px;
  cursor: pointer;
}

.panel-spacer {
  flex: 1;
  min-height: 80px;
}

.video-settings {
  display: grid;
  gap: 0;
}

.speed-field,
.duration-field,
.quality-field,
.aspect-field,
.switch-field {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.switch-field span,
.speed-field > span,
.duration-field > span,
.quality-field > span,
.aspect-field > span {
  color: #111111;
  font-size: 14px;
  font-weight: 400;
}

.two-option-control {
  display: grid;
  grid-template-columns: repeat(2, 50px);
  padding: 2px;
  background: #f2f2f4;
  border-radius: 8px;
}

.two-option-control button {
  height: 30px;
  font-size: 12px;
}

.duration-control {
  display: grid;
  grid-template-columns: 96px 32px;
  align-items: center;
  gap: 9px;
}

.duration-control input {
  width: 96px;
  height: 18px;
  accent-color: #151515;
}

.duration-control strong {
  color: #777777;
  font-size: 12px;
  font-weight: 400;
}

.aspect-control {
  display: grid;
  grid-template-columns: repeat(6, 38px);
  padding: 2px;
  background: #f2f2f4;
  border-radius: 8px;
}

.aspect-control button {
  height: 30px;
  font-size: 12px;
}

.toggle-switch {
  position: relative;
  display: inline-grid;
  width: 36px;
  height: 21px;
  cursor: pointer;
}

.toggle-switch input {
  position: absolute;
  opacity: 0;
}

.toggle-switch i {
  position: relative;
  display: block;
  width: 36px;
  height: 21px;
  background: #d2d6dc;
  border-radius: 999px;
  transition: background 0.2s ease;
}

.toggle-switch i::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 15px;
  height: 15px;
  background: #ffffff;
  border-radius: 50%;
  transition: transform 0.2s ease;
}

.toggle-switch input:checked + i {
  background: #151515;
}

.toggle-switch input:checked + i::after {
  transform: translateX(15px);
}

.ratio-field {
  position: relative;
  grid-template-columns: 136px 1fr;
  align-items: center;
}

.ratio-field > span,
.resolution-field > span,
.count-field > span {
  font-weight: 400;
}

.ratio-select {
  display: grid;
  grid-template-columns: 18px auto 1fr auto;
  align-items: center;
  gap: 7px;
  cursor: pointer;
}

.ratio-icon {
  width: 14px;
  height: 14px;
  border: 2px solid #777777;
  border-radius: 4px;
}

.ratio-select small {
  color: #888888;
}

.ratio-menu {
  position: absolute;
  z-index: 4;
  right: 0;
  top: 38px;
  display: grid;
  width: 188px;
  gap: 4px;
  padding: 6px;
  background: #ffffff;
  border: 1px solid #dddddd;
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12);
}

.ratio-menu[hidden] {
  display: none;
}

.ratio-menu button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 32px;
  padding: 0 8px;
  color: #222222;
  background: transparent;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}

.ratio-menu button:hover {
  background: #f4f4f4;
}

.ratio-menu small {
  color: #888888;
}

.resolution-field {
  grid-template-columns: 1fr auto;
  align-items: center;
}

.segment-control {
  display: grid;
  grid-template-columns: repeat(3, 40px);
  padding: 2px;
  background: #f2f2f4;
  border-radius: 8px;
}

.segment-control button {
  height: 30px;
  border: 0;
  color: #777777;
  background: transparent;
  border-radius: 7px;
  cursor: pointer;
}

.segment-control button.is-active {
  color: #222222;
  background: #ffffff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.count-field {
  grid-template-columns: 1fr 34px;
  align-items: center;
}

.count-field input {
  min-height: 34px;
  padding: 0;
  text-align: center;
}

.generate-button {
  min-height: 40px;
  color: #ffffff;
  background: #949494;
  border: 0;
  border-radius: 5px;
  font-weight: 800;
  cursor: pointer;
}

.generate-button.is-ready {
  background: #222222;
}

.preview-workspace {
  position: relative;
  min-height: calc(100vh - 100px);
  overflow: hidden;
  background:
    linear-gradient(var(--grid) 1px, transparent 1px) 0 0 / 20px 20px,
    linear-gradient(90deg, var(--grid) 1px, transparent 1px) 0 0 / 20px 20px,
    #ffffff;
}

@media (min-width: 981px) {
  body {
    display: flex;
    height: 100vh;
    flex-direction: column;
    overflow: hidden;
  }

  .launch-bar,
  .app-nav {
    flex: 0 0 auto;
  }

  .creator-shell {
    flex: 1 1 auto;
    height: auto;
    min-height: 0;
    overflow: hidden;
  }

  .generator-panel,
  .preview-workspace {
    height: 100%;
    min-height: 0;
  }

  .generator-panel {
    overflow: hidden;
  }

  .panel-top {
    margin-bottom: 23px;
  }

  .field,
  .prompt-field,
  .upload-section {
    margin-bottom: 20px;
  }

  .generator-panel > .field:not(.count-field) {
    grid-template-columns: 136px 1fr;
    align-items: center;
    gap: 11px;
  }

  .generator-panel > .video-mode-field {
    grid-template-columns: 112px 1fr;
    margin-bottom: 22px;
  }

  select,
  .ratio-select,
  .count-field input {
    min-height: 41px;
  }

  .upload-section {
    gap: 20px;
    margin-bottom: 30px;
  }

  .upload-tile {
    width: 62px;
    height: 62px;
  }

  .prompt-field textarea {
    height: 164px;
    padding: 16px 12px;
  }

  .prompt-field button {
    height: 38px;
  }

  .panel-spacer {
    min-height: 0;
  }

  .video-mode-tabs button,
  .two-option-control button,
  .aspect-control button,
  .segment-control button {
    height: 30px;
  }

  .speed-field,
  .duration-field,
  .quality-field,
  .aspect-field,
  .switch-field {
    margin-bottom: 18px;
  }

  .image-settings .field {
    margin-bottom: 16px;
  }

  .video-settings {
    margin-bottom: 0;
  }

  .is-video-mode .video-settings {
    margin-top: 0;
  }

  .duration-field {
    margin-bottom: 20px;
  }

  .switch-field {
    margin-bottom: 20px;
  }

  .count-field {
    margin-bottom: 14px;
  }

  .count-field input {
    min-height: 34px;
  }

  .generate-button {
    min-height: 40px;
  }
}

.credit-pill {
  position: absolute;
  top: 11px;
  left: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  height: 36px;
  padding: 0 12px;
  background: #ffffff;
  border: 1px solid #e2e2e2;
  border-radius: 14px;
  box-shadow: 0 4px 13px rgba(0, 0, 0, 0.08);
  color: #555555;
  font-size: 13px;
}

.preview-frame {
  position: absolute;
  inset: 48px 184px 116px;
  display: grid;
  place-items: center;
  border: 2px dashed #dddddd;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.34);
}

.preview-empty,
.preview-result {
  text-align: center;
}

.image-icon {
  display: block;
  width: 54px;
  height: 54px;
  margin: 0 auto 20px;
  border: 5px solid #dddddd;
  border-radius: 8px;
  background:
    radial-gradient(circle at 28% 35%, #dddddd 0 6px, transparent 7px),
    linear-gradient(135deg, transparent 48%, #dddddd 49% 55%, transparent 56%);
}

.preview-empty strong,
.preview-result strong {
  display: block;
  margin-bottom: 10px;
  font-size: 18px;
}

.preview-empty p,
.preview-result p {
  margin: 0;
  color: #777777;
  font-size: 14px;
}

.mock-image {
  width: 220px;
  height: 220px;
  aspect-ratio: 1 / 1;
  margin: 0 auto 22px;
  border-radius: 16px;
  background:
    radial-gradient(circle at 38% 30%, rgba(255, 255, 255, 0.65), transparent 18%),
    linear-gradient(135deg, #f4d6a4, #c4d4ff 45%, #f3b2b2);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.12);
}

.quick-dock {
  position: absolute;
  left: 50%;
  bottom: 14px;
  display: grid;
  grid-template-columns: repeat(4, 64px);
  gap: 0;
  transform: translateX(-50%);
  padding: 9px 10px 8px;
  background: rgba(255, 255, 255, 0.84);
  border-radius: 18px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.12);
  backdrop-filter: blur(16px);
}

.quick-dock a {
  display: grid;
  justify-items: center;
  gap: 4px;
  color: #6e6e6e;
}

.quick-dock span {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  background: #e3e5e8;
  border-radius: 50%;
  font-size: 20px;
}

.quick-dock small {
  font-size: 11px;
}

@media (max-width: 980px) {
  .app-nav {
    grid-template-columns: 1fr auto;
    height: auto;
    min-height: 58px;
  }

  .main-nav {
    grid-column: 1 / -1;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 0 12px;
  }

  .creator-shell {
    grid-template-columns: 1fr;
    height: auto;
    min-height: auto;
    overflow: visible;
  }

  .generator-panel {
    height: auto;
    min-height: auto;
    overflow: visible;
    border-right: 0;
    border-bottom: 1px solid #dedede;
  }

  .preview-workspace {
    height: auto;
    min-height: 620px;
  }

  .preview-frame {
    inset: 58px 20px 104px;
  }
}

@media (max-width: 620px) {
  .launch-bar {
    height: auto;
    min-height: 42px;
    font-size: 12px;
  }

  .panel-top,
  .ratio-field,
  .resolution-field,
  .count-field,
  .speed-field,
  .duration-field,
  .quality-field,
  .aspect-field,
  .switch-field {
    grid-template-columns: 1fr;
  }

  .panel-top {
    display: grid;
  }

  .quick-dock {
    grid-template-columns: repeat(4, 54px);
  }

  .aspect-control {
    grid-template-columns: repeat(3, 1fr);
  }
}
