:root {
  color-scheme: dark;
  --text: #f5f5f7;
  --muted: rgba(245, 245, 247, 0.68);
  --subtle: rgba(245, 245, 247, 0.46);
  --line: rgba(255, 255, 255, 0.18);
  --line-strong: rgba(255, 255, 255, 0.32);
  --panel: rgba(20, 20, 24, 0.72);
  --panel-strong: rgba(8, 8, 10, 0.86);
  --field: rgba(255, 255, 255, 0.09);
  --field-hover: rgba(255, 255, 255, 0.14);
  --accent: #2997ff;
  --accent-hover: #0077ed;
  --warn: #ff9f0a;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  overflow-x: hidden;
  background: #000;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  position: relative;
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  background: #000;
  touch-action: pan-y;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
}

body::before {
  z-index: 0;
  background: url("./assets/hero-bg.jpg") top center / cover no-repeat;
  transform: translateZ(0);
  will-change: transform;
}

body::after {
  z-index: 1;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.1), #000 72%);
}

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

button {
  color: inherit;
}

.app-shell {
  position: relative;
  z-index: 2;
  width: min(1420px, calc(100% - 44px));
  margin: 0 auto;
  padding: 28px 0 48px;
  animation: pageReveal 220ms ease-out both;
}

@keyframes pageReveal {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 48px;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  margin-left: 4px;
}

.brand-mark img {
  display: block;
  max-width: 100%;
  height: auto;
}

.brand-mark-desktop {
  width: 108px;
}

.brand-mark-mobile {
  display: none;
  width: 85px;
}

.account-actions {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
}

.credit-pill {
  border-radius: 999px;
  padding: 9px 13px;
  color: rgba(255, 255, 255, 0.86);
  background: rgba(255, 255, 255, 0.12);
  font-size: 13px;
  font-weight: 800;
}

.secondary-button.compact {
  min-height: 36px;
  padding: 0 13px;
  font-size: 13px;
}

.account-menu {
  position: relative;
}

.account-popover {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 10;
  display: grid;
  min-width: 136px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 6px;
  background: rgba(28, 28, 30, 0.96);
  box-shadow: var(--shadow);
}

.account-popover button {
  border: 0;
  border-radius: 11px;
  padding: 10px 12px;
  color: var(--text);
  background: transparent;
  cursor: pointer;
  text-align: left;
  font-size: 13px;
  font-weight: 700;
}

.account-popover button:hover {
  background: rgba(255, 255, 255, 0.1);
}

.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  min-height: 320px;
  padding: 34px 4px 74px;
}

.hero-copy {
  max-width: 760px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--subtle);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  max-width: 720px;
  font-size: clamp(44px, 6vw, 84px);
  line-height: 1.08;
  font-weight: 700;
  letter-spacing: 0;
}

h2 {
  font-size: 24px;
  line-height: 1.18;
  font-weight: 700;
  letter-spacing: 0;
}

.hero-subtitle {
  max-width: 560px;
  margin-top: 26px;
  color: var(--muted);
  font-size: 19px;
  line-height: 1.68;
}

.hero-model-name {
  color: rgba(255, 255, 255, 0.86);
}

.mode-switch {
  display: inline-grid;
  grid-template-columns: repeat(3, minmax(84px, 1fr));
  gap: 4px;
  margin-top: 22px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(24px);
}

.mode-switch label {
  cursor: pointer;
}

.mode-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.mode-switch span {
  display: grid;
  min-height: 36px;
  place-items: center;
  border-radius: 999px;
  padding: 0 16px;
  color: rgba(245, 245, 247, 0.72);
  font-size: 14px;
  font-weight: 700;
  transition: background 160ms ease, color 160ms ease;
}

.mode-switch input:checked + span {
  color: #fff;
  background: rgba(255, 255, 255, 0.18);
}

.status-pill {
  min-width: 156px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 11px 16px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.1);
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  backdrop-filter: blur(24px);
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.secondary-button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 16px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.1);
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  backdrop-filter: blur(24px);
}

.secondary-button:hover {
  background: rgba(255, 255, 255, 0.16);
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.38fr) minmax(360px, 0.78fr);
  gap: 24px;
  align-items: start;
}

.brief-form {
  display: grid;
  gap: 18px;
  counter-reset: form-section;
}

.panel,
.prompt-card,
.result-card {
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(34px) saturate(125%);
}

.panel {
  position: relative;
  padding: 28px;
}

.brief-form > .panel:not([hidden]) {
  counter-increment: form-section;
}

.section-head {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding-right: 58px;
  margin-bottom: 22px;
}

.prompt-library-trigger {
  position: absolute;
  right: 16px;
  bottom: 12px;
  min-height: 24px;
  border: 0;
  border-radius: 0;
  padding: 0;
  color: var(--subtle);
  background: transparent;
  line-height: 24px;
}

.prompt-library-trigger:hover {
  color: rgba(255, 255, 255, 0.52);
  background: transparent;
}

.section-head::before {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.88);
  background: rgba(255, 255, 255, 0.08);
  content: counter(form-section);
  font-size: 15px;
  font-weight: 700;
}

body.is-edit-mode .general-panel .section-head::before,
body.is-edit-mode .general-panel .step {
  display: none;
}

.section-head p {
  margin-top: 7px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.45;
}

.step {
  display: grid;
  position: absolute;
  top: 28px;
  right: 30px;
  z-index: 1;
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: transparent;
  background: rgba(255, 255, 255, 0.04);
  font-size: 0;
  font-weight: 700;
  pointer-events: none;
}

.step.is-complete {
  color: transparent;
  background: #2ccd7f;
  font-size: 0;
}

.step.is-complete::before {
  content: "";
  width: 9px;
  height: 5px;
  border-left: 2px solid #06180f;
  border-bottom: 2px solid #06180f;
  transform: rotate(-45deg) translate(1px, -1px);
}

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

.field-grid > .field:not(.conditional-field),
.field-grid > .conditional-field.is-visible {
  min-width: 0;
}

.field-grid > .field:only-child,
.field-grid > .field:nth-last-child(2):has(+ .conditional-field:not(.is-visible)),
.field-grid > .conditional-field:not(.is-visible) + .field {
  grid-column: 1 / -1;
}

.color-pair-item {
  grid-column: span 1 !important;
}

.field {
  display: grid;
  gap: 9px;
  margin-top: 14px;
}

.conditional-field {
  display: none;
}

.conditional-field.is-visible {
  display: grid;
}

[hidden] {
  display: none !important;
}

.field:first-child {
  margin-top: 0;
}

.field span {
  color: var(--text);
  font-size: 14px;
  font-weight: 650;
}

#editQualityMount .field {
  margin-top: 16px;
}

#editQualityMount .field span {
  color: rgba(255, 255, 255, 0.52);
  font-weight: 400;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 15px;
  color: var(--text);
  background-color: rgba(255, 255, 255, 0.1);
  outline: none;
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

select {
  appearance: none;
  color: var(--text);
  color-scheme: dark;
  background-image:
    linear-gradient(45deg, transparent 50%, rgba(255, 255, 255, 0.72) 50%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.72) 50%, transparent 50%);
  background-position: calc(100% - 20px) 20px, calc(100% - 14px) 20px;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

select option {
  color: #f5f5f7;
  background: #1d1d1f;
}

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

.inspiration-field {
  position: relative;
}

.inspiration-field textarea {
  padding-bottom: 44px;
}

.general-panel textarea[name="inspiration"] {
  min-height: 150px;
}

input::placeholder,
textarea::placeholder {
  color: rgba(245, 245, 247, 0.38);
}

input:hover,
select:hover,
textarea:hover {
  background-color: var(--field-hover);
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(41, 151, 255, 0.9);
  box-shadow: 0 0 0 4px rgba(41, 151, 255, 0.18);
}

.chip-grid,
.ratio-grid {
  display: grid;
  gap: 10px;
}

.chip-grid {
  grid-template-columns: repeat(auto-fit, minmax(116px, 1fr));
}

.ratio-grid {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.chip-grid label,
.ratio-grid label {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 11px 12px;
  color: var(--text);
  background: var(--field);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: inset 0 0 0 0 rgba(41, 151, 255, 0);
  transition: background 160ms ease, box-shadow 160ms ease, color 160ms ease;
}

.chip-grid label:hover,
.ratio-grid label:hover,
.upload-box:hover {
  background: var(--field-hover);
}

.chip-grid label:has(input:checked),
.ratio-grid label:has(input:checked) {
  background: rgba(41, 151, 255, 0.2);
  box-shadow: inset 0 0 0 2px rgba(41, 151, 255, 0.72);
}

.chip-grid input,
.ratio-grid input {
  width: auto;
  accent-color: var(--accent);
}

.upload-box {
  display: grid;
  gap: 8px;
  margin-top: 16px;
  border: 1px dashed var(--line-strong);
  border-radius: 22px;
  padding: 22px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease;
}

.compact-upload {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 74px;
}

.upload-title {
  font-size: 16px;
  font-weight: 700;
  flex: 0 0 auto;
}

.upload-copy {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.upload-box input {
  min-width: 0;
  margin-top: 0;
  border: 0;
  border-radius: 0;
  padding: 0;
  color: var(--subtle);
  background: transparent;
  font-size: 13px;
}

.upload-box input::file-selector-button {
  margin-right: 8px;
  border: 0;
  border-radius: 8px;
  padding: 6px 10px;
  color: #1d1d1f;
  background: rgba(245, 245, 247, 0.72);
  cursor: pointer;
  font-weight: 650;
}

.file-list {
  display: grid;
  gap: 9px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.file-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 14px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
  font-size: 14px;
}

.file-list span:first-child {
  flex: 1 1 auto;
  overflow-wrap: anywhere;
  font-weight: 650;
}

.file-list span:last-child {
  flex: 0 0 auto;
  color: var(--muted);
}

.file-remove {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
  font-size: 12px;
}

.file-remove:hover {
  background: rgba(255, 255, 255, 0.16);
}

.result-column {
  position: sticky;
  top: 24px;
}

.prompt-card,
.result-card,
.history-card {
  padding: 24px;
  background: var(--panel-strong);
}

.history-card {
  border: 0;
  border-radius: 24px;
  background: #1c1c1e;
  box-shadow: none;
  backdrop-filter: none;
}

.prompt-card,
.result-card {
  margin-bottom: 18px;
}

.result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.primary-button {
  min-height: 46px;
  border: 0;
  border-radius: 999px;
  padding: 0 22px;
  color: #fff;
  background: var(--accent);
  cursor: pointer;
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  transition: background 160ms ease, transform 160ms ease, opacity 160ms ease;
}

.primary-button:hover {
  background: var(--accent-hover);
}

.primary-button:active {
  transform: scale(0.98);
}

.primary-button:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.prompt-output {
  max-height: 360px;
  overflow: auto;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 18px;
  color: rgba(255, 255, 255, 0.86);
  background: rgba(255, 255, 255, 0.06);
  white-space: pre-wrap;
  line-height: 1.7;
  font-family: inherit;
  font-size: 14px;
}

.ai-result {
  min-height: 360px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 18px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.06);
  white-space: pre-wrap;
  line-height: 1.65;
  font-size: 15px;
}

.generated-image {
  display: block;
  width: 100%;
  max-height: 720px;
  object-fit: contain;
  border-radius: 20px;
  background: #000;
}

.generated-gallery {
  display: grid;
  gap: 18px;
}

.generated-figure {
  margin: 0;
}

.result-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 14px;
}

.download-button {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.1);
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
}

.download-button:hover {
  background: rgba(255, 255, 255, 0.16);
}

.mobile-save-tip {
  cursor: default;
  pointer-events: none;
}

.text-button {
  border: 0;
  padding: 0;
  color: rgba(255, 255, 255, 0.86);
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.text-button:hover {
  color: rgba(255, 255, 255, 0.86);
}

.generated-image + p {
  margin-top: 14px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.ai-result.loading {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.ai-result.video-progress-loading {
  position: relative;
  overflow: hidden;
  min-height: 360px;
  padding: 18px;
  background: #050505;
  line-height: 1;
}

.video-progress-shell {
  position: relative;
  overflow: hidden;
  width: 100%;
  height: 260px;
  min-height: 260px;
  border-radius: inherit;
  background: #000;
}

.generation-intro-video {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  min-height: 260px;
  border-radius: inherit;
  object-fit: cover;
  object-position: center center;
  transform: translateY(-11%) scale(1.12);
  transform-origin: center center;
  background: #000;
}

.ai-result.error {
  color: #ffd9a3;
  background: rgba(255, 159, 10, 0.12);
}

.progress-shell {
  display: grid;
  gap: 10px;
  align-content: center;
  justify-items: stretch;
  min-height: auto;
  padding: 18px 4px 0;
}

.progress-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
}

.progress-label {
  color: rgba(255, 255, 255, 0.25);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.progress-percent {
  color: rgba(255, 255, 255, 0.72) !important;
  font-size: 20px;
  font-weight: 800;
  line-height: 0.95;
  letter-spacing: 0;
  text-shadow: none;
}

.progress-track {
  display: block;
  overflow: hidden;
  justify-self: stretch;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
}

.progress-bar {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2997ff, #66d9ff);
  transition: width 500ms ease;
}

.history-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.history-item {
  position: relative;
  overflow: hidden;
  border: 0;
  border-radius: 18px;
  padding: 0;
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
  text-align: left;
  transition: transform 160ms ease, background 160ms ease;
}

.history-item:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-1px);
}

.history-media {
  position: relative;
  overflow: hidden;
  aspect-ratio: 1;
  background: #000;
}

.history-thumb {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}

.history-actions {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  background: rgba(0, 0, 0, 0.56);
  opacity: 0;
  transition: opacity 160ms ease;
}

.history-item:hover .history-actions,
.history-item:focus-within .history-actions {
  opacity: 1;
}

.history-action {
  min-height: 34px;
  border: 0;
  border-radius: 999px;
  padding: 0 12px;
  color: #fff;
  background: rgba(255, 255, 255, 0.18);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  backdrop-filter: blur(16px);
}

.history-action:hover {
  background: rgba(255, 255, 255, 0.28);
}

.history-action.primary {
  background: rgba(41, 151, 255, 0.9);
}

.history-action.primary:hover {
  background: #2997ff;
}

.history-meta {
  display: grid;
  gap: 3px;
  padding: 10px 11px 11px;
}

.history-title {
  overflow: hidden;
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-subtitle {
  color: var(--muted);
  font-size: 12px;
}

body.modal-open {
  overflow: hidden;
}

.image-modal[hidden] {
  display: none;
}

.image-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 28px;
}

.image-modal-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(0, 0, 0, 0.72);
  cursor: zoom-out;
}

.image-modal-panel {
  position: relative;
  z-index: 1;
  display: grid;
  max-width: min(94vw, 1180px);
  max-height: 92vh;
  border-radius: 28px;
  padding: 18px;
  background: #1c1c1e;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.5);
}

.image-modal-close {
  justify-self: end;
  min-height: 34px;
  border: 0;
  border-radius: 999px;
  margin-bottom: 12px;
  padding: 0 14px;
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.image-modal-close:hover {
  background: rgba(255, 255, 255, 0.22);
}

.image-modal-panel img {
  display: block;
  max-width: calc(94vw - 36px);
  max-height: calc(92vh - 84px);
  object-fit: contain;
  border-radius: 18px;
  background: #000;
}

.dialog-modal[hidden] {
  display: none;
}

.dialog-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 28px;
}

.dialog-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(0, 0, 0, 0.72);
}

.dialog-panel {
  position: relative;
  z-index: 1;
  width: min(860px, 94vw);
  max-height: 88vh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 24px;
  background: rgba(28, 28, 30, 0.96);
  box-shadow: var(--shadow);
}

.prompt-library-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(980px, 94vw);
  max-height: min(760px, 88vh);
  overflow: hidden;
}

.small-dialog {
  width: min(430px, 94vw);
}

.recharge-dialog {
  background:
    linear-gradient(180deg, rgba(18, 18, 20, 0.88), rgba(12, 12, 14, 0.96)),
    url("./assets/hero-bg.jpg") top center / cover no-repeat;
}

.payment-dialog h2 {
  font-size: 18px;
  line-height: 1.25;
}

.payment-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.dialog-close {
  min-height: 34px;
  border: 0;
  border-radius: 999px;
  padding: 0 14px;
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.prompt-library-layout {
  display: grid;
  grid-template-columns: minmax(220px, 0.42fr) minmax(0, 1fr);
  gap: 16px;
  min-height: 0;
}

.prompt-library-list {
  display: grid;
  gap: 8px;
  align-content: start;
  max-height: 100%;
  overflow-y: auto;
  padding-right: 4px;
}

.prompt-library-group {
  display: grid;
  gap: 8px;
}

.prompt-library-group-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  border-radius: 14px;
  padding: 0 12px;
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
  cursor: pointer;
  font-size: 15px;
  font-weight: 900;
  list-style: none;
  line-height: 1;
}

.prompt-library-group-title span:last-child {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.prompt-library-group-title::-webkit-details-marker {
  display: none;
}

.prompt-library-group .fold-arrow {
  flex: 0 0 24px;
}

.prompt-library-group[open] .fold-arrow::before {
  transform: rotate(90deg) translateX(1px);
}

.prompt-library-group-list {
  display: grid;
  gap: 8px;
  padding-left: 8px;
}

.prompt-library-item {
  display: block;
  width: 100%;
  min-height: 48px;
  border: 0;
  border-radius: 14px;
  padding: 12px 14px;
  color: rgba(255, 255, 255, 0.58);
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.35;
}

.prompt-library-item:hover {
  background: rgba(255, 255, 255, 0.14);
}

.prompt-detail {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 14px;
  min-height: 0;
}

.prompt-detail h3 {
  margin: 0;
  overflow: hidden;
  font-size: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.prompt-detail pre {
  min-height: 0;
  margin: 0;
  border-radius: 18px;
  padding: 16px;
  color: rgba(255, 255, 255, 0.86);
  background: rgba(255, 255, 255, 0.07);
  overflow: auto;
  white-space: pre-wrap;
  line-height: 1.7;
  font-family: inherit;
}

.full-button {
  width: 100%;
  margin-top: 16px;
}

.code-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.login-tip {
  min-height: 22px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.rules-box {
  display: grid;
  gap: 8px;
  border-radius: 18px;
  padding: 14px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.07);
  font-size: 14px;
  line-height: 1.6;
}

.rules-box span {
  color: #fff;
  font-weight: 800;
}

.recharge-balance {
  margin: -6px 0 14px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 14px;
  font-weight: 800;
}

.recharge-help {
  color: rgba(255, 255, 255, 0.72);
}

.inline-link {
  border: 0;
  padding: 0;
  color: #2997ff;
  background: transparent;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
}

.recharge-preview {
  margin-top: 8px;
  min-height: 22px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

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

.pay-qr-grid figure {
  display: grid;
  gap: 8px;
  margin: 0;
  border-radius: 18px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.08);
}

.pay-qr-grid img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1.32;
  border-radius: 12px;
  object-fit: cover;
  background: #fff;
}

.pay-qr-grid figcaption {
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.recharge-history {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.recharge-history summary {
  cursor: pointer;
  list-style: none;
}

.recharge-history summary::-webkit-details-marker {
  display: none;
}

.mini-section-head,
.recharge-history-item {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mini-section-head h3 {
  flex: 1;
}

.mini-section-head h3 {
  margin: 0;
  font-size: 15px;
}

.fold-arrow {
  display: grid;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  place-items: center;
  background: rgba(255, 255, 255, 0.08);
}

.fold-arrow::before {
  content: "";
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 7px solid rgba(255, 255, 255, 0.56);
  transform: translateX(1px);
  transition: transform 160ms ease;
}

.recharge-history[open] .fold-arrow::before {
  transform: rotate(90deg) translateX(1px);
}

.recharge-history-list {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.recharge-history-item {
  border-radius: 14px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.07);
}

.recharge-history-item div {
  display: grid;
  gap: 3px;
}

.recharge-history-item div:last-child {
  text-align: right;
}

.recharge-history-item strong {
  color: var(--text);
  font-size: 13px;
}

.recharge-history-item span {
  color: var(--muted);
  font-size: 12px;
}

.recharge-history-item.is-pending span:last-child {
  color: #ffd9a3;
}

.recharge-history-item.is-rejected span:last-child {
  color: rgba(255, 120, 120, 0.86);
}

.contact-qr {
  display: block;
  width: min(100%, 360px);
  margin: 0 auto;
  border-radius: 18px;
  background: #fff;
}

.guide-content {
  display: grid;
  gap: 10px;
  color: rgba(245, 245, 247, 0.72);
  font-size: 14px;
  line-height: 1.7;
  max-height: min(72vh, 760px);
  overflow-y: auto;
  padding-right: 4px;
}

.guide-section {
  display: grid;
  gap: 8px;
}

.guide-section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  border-radius: 14px;
  padding: 0 14px;
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
  cursor: pointer;
  font-size: 16px;
  font-weight: 900;
  list-style: none;
  line-height: 1.2;
}

.guide-section-title::-webkit-details-marker {
  display: none;
}

.guide-section-title::marker {
  content: "";
}

.guide-section .fold-arrow {
  flex: 0 0 22px;
}

.guide-section .fold-arrow::before {
  content: "›";
  display: inline-block;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  transform: translateX(1px);
  transition: transform 0.18s ease;
}

.guide-section[open] .fold-arrow::before {
  transform: rotate(90deg) translateX(1px);
}

.guide-section-body {
  display: grid;
  gap: 10px;
  padding-left: 8px;
}

.guide-section-body p {
  border-radius: 16px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.07);
}

.guide-section-body strong {
  color: #fff;
  font-weight: 400;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

pre[hidden] {
  display: none;
}

@media (max-width: 1060px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .result-column {
    position: static;
  }
}

@media (max-width: 760px) {
  .guide-section-title {
    font-size: 15px;
    font-weight: 700;
  }

  .app-shell {
    width: min(100% - 28px, 1420px);
    padding-top: 28px;
  }

  .topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    min-height: 40px;
  }

  .brand-mark-desktop {
    display: none;
  }

  .brand-mark-mobile {
    display: inline-flex;
    width: 85px;
    margin-left: 4px;
  }

  .account-actions {
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    min-width: 0;
  }

  .credit-pill {
    width: auto;
    max-width: none;
    padding: 8px 10px;
    overflow: hidden;
    font-size: 11px;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
  }

  .account-actions > .text-button {
    display: none;
  }

  .secondary-button.compact {
    width: auto;
    min-height: 34px;
    padding: 0 13px;
    white-space: nowrap;
  }

  .account-popover {
    right: 0;
  }

  .hero {
    align-items: flex-start;
    flex-direction: column;
    min-height: 220px;
    padding: 42px 4px 58px;
  }

  .eyebrow {
    margin-bottom: 18px;
  }

  h1 {
    font-size: 42px;
    line-height: 1.08;
  }

  .hero-subtitle {
    margin-top: 18px;
    font-size: 18px;
    line-height: 1.35;
  }

  .field-grid,
  .ratio-grid {
    grid-template-columns: 1fr;
  }

  .panel,
  .result-card {
    border-radius: 24px;
    padding: 20px;
  }

  .section-head {
    gap: 12px;
    padding-right: 46px;
  }

  .prompt-library-layout {
    grid-template-columns: 1fr;
  }

  .prompt-library-panel {
    max-height: 86vh;
  }

  .prompt-library-list {
    max-height: 220px;
  }

  .prompt-detail pre {
    max-height: 32vh;
  }

  .result-toolbar {
    justify-content: center;
  }

  .mobile-save-tip {
    color: rgba(255, 255, 255, 0.72);
    background: rgba(255, 255, 255, 0.08);
  }

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

  .section-head::before {
    width: 30px;
    height: 30px;
    font-size: 13px;
  }

  .step {
    top: 20px;
    right: 22px;
  }

  .result-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .primary-button,
  .secondary-button {
    width: 100%;
  }

  .hero-actions {
    display: none;
  }

  .prompt-card {
    display: none;
  }

  .dialog-modal {
    align-items: center;
    padding: max(14px, env(safe-area-inset-top)) 14px max(92px, env(safe-area-inset-bottom));
  }

  .dialog-panel {
    width: min(100%, 430px);
    max-height: calc(100dvh - 122px);
    border-radius: 26px;
    padding: 18px;
  }

  .recharge-dialog {
    max-height: calc(100dvh - 122px);
  }

  .pay-qr-grid {
    gap: 10px;
  }

  .pay-qr-grid figure {
    padding: 10px;
  }

  .ai-result.video-progress-loading {
    min-height: 390px;
    padding: 14px;
  }

  .video-progress-shell {
    height: 250px;
    min-height: 250px;
    border-radius: 22px;
  }

  .generation-intro-video {
    min-height: 250px;
    object-fit: cover;
    object-position: center center;
    transform: none;
  }

  .progress-shell {
    padding: 18px 4px 0;
  }

  .history-actions {
    flex-direction: column;
    gap: 8px;
    padding: 14px;
  }

  .history-action {
    min-height: 32px;
    padding: 0 14px;
    font-size: 12px;
  }
}
