:root {
  --bg-deep: #06070c;
  --bg: #0a0c14;
  --surface: rgba(18, 22, 34, 0.45);
  --surface-elevated: rgba(22, 28, 44, 0.55);
  --border: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #eef1f8;
  --muted: #9aa3b5;
  --accent: #e8884a;
  --accent-dim: #b85a28;
  --accent-glow: rgba(232, 136, 74, 0.35);
  --success: #4ecf9a;
  --radius: 16px;
  --radius-sm: 12px;
  --font: "DM Sans", system-ui, sans-serif;
  --font-display: "Sora", "DM Sans", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --glass-blur: 20px;
  --glass-saturate: 1.35;
  --shadow-soft: 0 8px 32px rgba(0, 0, 0, 0.45);
  --shadow-glow: 0 0 0 1px rgba(255, 255, 255, 0.06) inset,
    0 1px 0 rgba(255, 255, 255, 0.08) inset;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  background-color: var(--bg-deep);
  background-image:
    radial-gradient(ellipse 100% 70% at 0% -10%, rgba(99, 102, 241, 0.28), transparent 52%),
    radial-gradient(ellipse 80% 60% at 100% 0%, rgba(236, 72, 153, 0.14), transparent 48%),
    radial-gradient(ellipse 70% 45% at 50% 110%, rgba(45, 212, 191, 0.1), transparent 50%),
    linear-gradient(168deg, #05060a 0%, #0b0e18 42%, #070910 100%);
  background-attachment: fixed;
}

.app {
  max-width: 1480px;
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
  position: relative;
}

.header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding: 1.15rem 1.35rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.09) 0%,
    rgba(255, 255, 255, 0.03) 50%,
    rgba(255, 255, 255, 0.06) 100%
  );
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  box-shadow: var(--shadow-soft), var(--shadow-glow);
}

.brand {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.logo {
  font-size: 1.75rem;
  color: var(--accent);
  line-height: 1;
  text-shadow: 0 0 28px var(--accent-glow);
  filter: drop-shadow(0 0 12px rgba(232, 136, 74, 0.35));
}

.header h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.38rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  background: linear-gradient(120deg, #fff 0%, #c8d0e5 55%, rgba(232, 136, 74, 0.95) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.tagline {
  margin: 0.35rem 0 0;
  font-size: 0.84rem;
  color: var(--muted);
}

.doc-link {
  color: var(--text);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.5rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  align-self: center;
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition:
    border-color 0.2s,
    background 0.2s,
    box-shadow 0.2s;
}

.doc-link:hover {
  border-color: rgba(232, 136, 74, 0.45);
  background: rgba(232, 136, 74, 0.1);
  box-shadow: 0 0 24px var(--accent-glow);
}

.header-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.header-user {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.55rem 0.3rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.header-user-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-credits {
  font-size: 0.75rem;
  font-weight: 600;
  color: #8bd49a;
  white-space: nowrap;
}

.btn-sm {
  padding: 0.32rem 0.6rem !important;
  font-size: 0.78rem !important;
  border-radius: 999px !important;
  margin-top: 0 !important;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 1.25rem;
  padding: 0.45rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(8, 10, 18, 0.35);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow-glow);
}

.tab {
  font-family: var(--font);
  font-size: 0.86rem;
  font-weight: 600;
  padding: 0.6rem 1rem;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition:
    color 0.2s,
    background 0.2s,
    border-color 0.2s,
    box-shadow 0.2s;
}

.tab:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.tab.active {
  color: #fff;
  background: linear-gradient(135deg, rgba(232, 136, 74, 0.35) 0%, rgba(232, 136, 74, 0.12) 100%);
  border-color: rgba(232, 136, 74, 0.45);
  box-shadow: 0 0 28px var(--accent-glow);
}

.layout-body {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  align-items: start;
}

@media (min-width: 1040px) {
  .layout-body {
    grid-template-columns: minmax(260px, 300px) minmax(0, 1fr);
    gap: 1.5rem;
    align-items: stretch;
    min-height: calc(100vh - 10.5rem);
  }
}

.layout-center {
  min-width: 0;
}

.panels-main {
  margin: 0;
  padding: 1.35rem 1.45rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: linear-gradient(
    160deg,
    rgba(255, 255, 255, 0.07) 0%,
    rgba(255, 255, 255, 0.02) 40%,
    rgba(12, 16, 28, 0.5) 100%
  );
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  box-shadow: var(--shadow-soft), var(--shadow-glow);
}

.history-sidebar {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(
    165deg,
    rgba(255, 255, 255, 0.08) 0%,
    rgba(255, 255, 255, 0.02) 45%,
    rgba(10, 12, 22, 0.55) 100%
  );
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
  box-shadow: var(--shadow-soft), var(--shadow-glow);
  padding: 1rem 0.85rem;
  height: calc(100vh - 5.2rem);
  max-height: none;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0.75rem;
}

@media (max-width: 1039px) {
  .history-sidebar {
    height: auto;
    max-height: min(85vh, 900px);
    position: relative;
    top: 0;
  }
}

.history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.history-title {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.history-clear {
  font-family: var(--font);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.history-clear:hover {
  color: var(--text);
  border-color: rgba(232, 136, 74, 0.45);
}

.history-sync {
  width: 100%;
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.5rem 0.65rem;
  margin-bottom: 0.45rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(232, 136, 74, 0.4);
  background: linear-gradient(180deg, rgba(232, 136, 74, 0.2) 0%, rgba(232, 136, 74, 0.06) 100%);
  color: var(--text);
  cursor: pointer;
  transition:
    border-color 0.15s,
    background 0.15s;
}

.history-sync:hover:not(:disabled) {
  border-color: var(--accent);
  background: rgba(232, 136, 74, 0.16);
}

.history-sync:disabled {
  opacity: 0.55;
  cursor: wait;
}

.history-sync-status {
  margin: 0 0 0.6rem;
  font-size: 0.68rem;
  color: var(--muted);
  line-height: 1.35;
  min-height: 1.2em;
}

.history-subtitle {
  margin: 0.35rem 0 0.4rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.history-list {
  max-height: none;
  flex: 1;
  min-height: 200px;
  overflow-y: auto;
  padding-right: 0.2rem;
  margin-right: -0.2rem;
  margin-bottom: 0.5rem;
}

@media (min-width: 1040px) {
  .history-list {
    min-height: 260px;
  }
}

.history-empty {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.45;
  display: none;
}

.history-empty.visible {
  display: block;
}

.history-item {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 0.6rem;
  background: rgba(6, 8, 14, 0.45);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  text-align: left;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}

.history-item:last-child {
  margin-bottom: 0;
}

.history-item.selected {
  border-color: rgba(232, 136, 74, 0.55);
  box-shadow: 0 0 0 1px rgba(232, 136, 74, 0.18), 0 8px 28px rgba(232, 136, 74, 0.12);
}

.history-item--active {
  border-color: rgba(232, 136, 74, 0.45);
  box-shadow: 0 0 0 1px rgba(232, 136, 74, 0.14), 0 6px 22px rgba(232, 136, 74, 0.1);
}

.history-item-preview {
  display: block;
  width: 100%;
  padding: 0;
  border: none;
  background: #000;
  cursor: pointer;
  line-height: 0;
}

.history-btn-extend {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  font-family: var(--font);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0.45rem 0.5rem;
  margin: 0;
  border: none;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(196, 92, 38, 0.22) 0%, rgba(196, 92, 38, 0.08) 100%);
  color: #fff;
  cursor: pointer;
  transition:
    filter 0.15s,
    background 0.15s;
}

.history-btn-extend:hover {
  filter: brightness(1.08);
}

.history-btn-extend:active {
  filter: brightness(0.95);
}

.history-dual-btns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 100%;
  border-top: 1px solid var(--border);
}

.history-dual-btns .history-btn-extend,
.history-dual-btns .history-btn-edit {
  width: 100%;
  border-top: none;
  border-bottom: 1px solid var(--border);
}

.history-dual-btns .history-btn-extend {
  border-right: 1px solid var(--border);
}

.history-btn-edit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  font-family: var(--font);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0.45rem 0.5rem;
  margin: 0;
  border: none;
  background: linear-gradient(180deg, rgba(90, 120, 180, 0.2) 0%, rgba(90, 120, 180, 0.06) 100%);
  color: #fff;
  cursor: pointer;
  transition:
    filter 0.15s,
    background 0.15s;
}

.history-btn-edit:hover {
  filter: brightness(1.08);
}

.history-btn-edit:active {
  filter: brightness(0.95);
}

.ref-videos-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
}

@media (min-width: 640px) {
  .ref-videos-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.upload-limit-notice {
  margin: 0.5rem 0 0;
  max-width: 36rem;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--muted);
  opacity: 0.95;
}

.upload-limit-notice code {
  font-size: 0.72em;
  padding: 0.1em 0.25em;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.2);
}

.history-gate-details {
  margin: 0.65rem 0 0;
  font-size: 0.75rem;
  color: var(--muted);
}

.history-gate-hint {
  margin: 0.35rem 0 0.5rem;
  line-height: 1.4;
}

.history-gate-input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.45rem 0.5rem;
  font-size: 0.78rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.2);
  color: var(--text);
}

.field-url,
.field-url-text {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin-top: 0.55rem;
  padding: 0.55rem 0.65rem;
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 0.78rem;
  color: var(--text);
  background: rgba(4, 6, 12, 0.4);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.field-url:focus,
.field-url-text:focus {
  outline: none;
  border-color: rgba(232, 136, 74, 0.45);
}

.field-url-label {
  display: block;
  margin-top: 0.65rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.field-url-text {
  resize: vertical;
  min-height: 4.5rem;
  line-height: 1.4;
}

.batch-i2v-box {
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 0.75rem;
  background: rgba(0, 0, 0, 0.12);
}

.batch-i2v-summary {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.batch-i2v-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.6rem;
}

.panel-lead {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--muted);
}

.panel-lead a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.ref-images-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

@media (max-width: 520px) {
  .ref-images-row {
    grid-template-columns: 1fr;
  }
}

.checks--inline {
  display: flex;
  align-items: flex-end;
  padding-bottom: 0.15rem;
}

.checks--inline .check {
  margin: 0;
}

.history-thumb {
  width: 100%;
  height: min(200px, 28vw);
  min-height: 168px;
  object-fit: cover;
  display: block;
  background: #000;
  pointer-events: none;
}

.history-thumb--placeholder {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4, 6, 12, 0.65);
  color: var(--muted);
  font-size: 0.78rem;
  text-align: center;
  padding: 0.75rem;
}

.history-thumb--generating {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse 85% 72% at 50% 35%, rgba(232, 136, 74, 0.22), rgba(4, 6, 12, 0.92) 72%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.01));
  overflow: hidden;
}

.history-gen-ring {
  position: absolute;
  inset: 10%;
  border-radius: inherit;
  background: conic-gradient(
    var(--accent) calc(var(--p, 0) * 1%),
    rgba(255, 255, 255, 0.04) 0
  );
  opacity: 0.5;
  filter: drop-shadow(0 0 10px rgba(232, 136, 74, 0.32));
  animation: history-gen-pulse 1.8s ease-in-out infinite;
  pointer-events: none;
}

/* queued：不定进度环，不暗示具体百分比 */
.history-gen-ring--busy {
  opacity: 0.55;
  animation: history-gen-ring-spin 1.25s linear infinite;
  background: conic-gradient(
    from 0deg,
    rgba(255, 255, 255, 0.03) 0deg,
    var(--accent) 52deg,
    rgba(255, 255, 255, 0.08) 104deg,
    rgba(255, 255, 255, 0.03) 360deg
  );
}

.history-gen-shine {
  position: absolute;
  width: 220%;
  height: 160%;
  top: -30%;
  left: -150%;
  transform: rotate(16deg);
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.02) 34%,
    rgba(255, 255, 255, 0.22) 50%,
    rgba(255, 255, 255, 0.02) 66%,
    transparent 100%
  );
  animation: history-gen-shine 2.6s ease-in-out infinite;
  pointer-events: none;
}

@keyframes history-gen-shine {
  0% {
    left: -170%;
  }
  60%,
  100% {
    left: 120%;
  }
}

@keyframes history-gen-ring-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes history-gen-pulse {
  0%,
  100% {
    opacity: 0.26;
  }
  50% {
    opacity: 0.4;
  }
}

.history-gen-core {
  position: relative;
  z-index: 1;
  width: 96px;
  height: 96px;
  border-radius: 999px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background:
    radial-gradient(circle at 50% 32%, rgba(255, 255, 255, 0.18), rgba(18, 22, 36, 0.88) 68%),
    rgba(8, 10, 18, 0.75);
  box-shadow:
    inset 0 1px 2px rgba(255, 255, 255, 0.14),
    0 8px 24px rgba(0, 0, 0, 0.45),
    0 0 18px rgba(232, 136, 74, 0.25);
  backdrop-filter: blur(6px);
}

.history-gen-spinner {
  position: relative;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, 0.12);
  border-top-color: var(--accent);
  border-right-color: rgba(255, 255, 255, 0.35);
  animation: history-spin 0.85s linear infinite;
}

@keyframes history-spin {
  to {
    transform: rotate(360deg);
  }
}

.history-gen-pct {
  position: relative;
  font-family: var(--mono);
  font-size: 0.96rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.02em;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.55);
}

.history-gen-pct--label {
  font-family: var(--font);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.06em;
}

.history-gen-sub {
  font-size: 0.6rem;
  color: rgba(238, 241, 248, 0.72);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

@media (prefers-reduced-motion: reduce) {
  .history-gen-ring,
  .history-gen-ring--busy,
  .history-gen-spinner,
  .history-gen-shine {
    animation: none !important;
  }
}

.history-status-tag {
  font-weight: 700;
  letter-spacing: 0.05em;
  font-size: 0.72rem;
  color: var(--accent);
}

.history-error {
  margin: 0.3rem 0 0;
  font-size: 0.68rem;
  line-height: 1.35;
  color: #f0a0a0;
}

@media (min-width: 1040px) {
  .history-thumb {
    height: 200px;
    min-height: 200px;
  }
}

.history-body {
  padding: 0.45rem 0.55rem 0.55rem;
}

.history-tag {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.04em;
  margin-bottom: 0.2rem;
}

.history-prompt {
  margin: 0 0 0.45rem;
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.history-time {
  font-size: 0.65rem;
  color: var(--muted);
  opacity: 0.85;
  margin-bottom: 0.4rem;
}

.history-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.history-actions button {
  font-family: var(--font);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.3rem 0.55rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  cursor: pointer;
}

.history-actions button:hover {
  border-color: rgba(196, 92, 38, 0.5);
}

.history-actions .history-remove {
  margin-left: auto;
  padding: 0.25rem 0.45rem;
  color: var(--muted);
  border-style: dashed;
}

.history-actions .history-remove:hover {
  color: #c94a4a;
  border-color: rgba(201, 74, 74, 0.45);
}

.preview-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.75rem;
  align-items: center;
}

.preview-actions--t2i {
  margin-top: 0.5rem;
}

.t2i-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.65rem;
}

.t2i-thumb-wrap {
  padding: 0;
  border: 2px solid transparent;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  background: #000;
  line-height: 0;
}

.t2i-thumb-wrap.selected {
  border-color: var(--accent);
}

.t2i-thumb-wrap img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  display: block;
}

.preview-dl {
  margin-top: 0 !important;
  flex: 1 1 auto;
  min-width: 120px;
  text-align: center;
}

#btn-extend-from-result,
#btn-edit-from-result {
  flex: 1 1 auto;
  min-width: 140px;
  justify-content: center;
}

.panel {
  display: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem;
}

.panel.active {
  display: block;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.field textarea,
.field input[type="number"],
.field select {
  width: 100%;
  font-family: var(--font);
  font-size: 0.95rem;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(4, 6, 12, 0.45);
  color: var(--text);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.field textarea:focus,
.field input:focus,
.field select:focus {
  outline: none;
  border-color: rgba(232, 136, 74, 0.5);
  box-shadow: 0 0 0 2px rgba(232, 136, 74, 0.15);
}

.row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.dropzone {
  border: 1px dashed rgba(255, 255, 255, 0.18);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition:
    border-color 0.2s,
    background 0.2s,
    box-shadow 0.2s;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: rgba(232, 136, 74, 0.55);
  background: rgba(232, 136, 74, 0.08);
  box-shadow: 0 0 32px rgba(232, 136, 74, 0.12);
}

.dropzone.small {
  padding: 0.85rem;
}

.dropzone-preview {
  margin-bottom: 0.5rem;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #000;
  line-height: 0;
  max-height: 120px;
}

.dropzone.small .dropzone-preview {
  max-height: 88px;
}

.dropzone-preview-media {
  width: 100%;
  max-height: 120px;
  object-fit: cover;
  display: block;
}

.dropzone.small .dropzone-preview-media {
  max-height: 88px;
}

.dropzone-preview video.dropzone-preview-media {
  width: 100%;
  max-height: 120px;
  object-fit: cover;
}

.drop-hint {
  margin: 0;
  font-size: 0.875rem;
  color: var(--muted);
}

.file-name {
  margin: 0.5rem 0 0;
  font-size: 0.8rem;
  font-family: var(--mono);
  color: var(--success);
  word-break: break-all;
}

.file-name:empty {
  display: none;
}

.checks {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--text);
  cursor: pointer;
  text-transform: none;
  font-weight: 500;
  letter-spacing: 0;
}

.check input {
  accent-color: var(--accent);
}

.btn {
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.75rem 1.25rem;
  border-radius: 12px;
  border: 1px solid transparent;
  cursor: pointer;
  transition:
    opacity 0.15s,
    transform 0.12s ease,
    box-shadow 0.18s ease,
    border-color 0.18s ease,
    background 0.18s ease;
}

.btn:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 2px rgba(6, 8, 14, 0.9),
    0 0 0 4px rgba(232, 136, 74, 0.45);
}

.btn:active:not(:disabled) {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn.primary {
  background: linear-gradient(155deg, #f4a574 0%, #e07842 38%, #c45a22 72%, #8a3a12 100%);
  color: #fff;
  margin-top: 0.25rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow:
    0 6px 24px rgba(232, 120, 66, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.btn.primary:hover:not(:disabled) {
  filter: brightness(1.06);
  box-shadow:
    0 8px 32px rgba(232, 120, 66, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.prompt-field-wrap {
  position: relative;
}

.kbd-hint {
  display: inline-block;
  padding: 0.08em 0.35em;
  margin: 0 0.1em;
  font-family: var(--mono);
  font-size: 0.78em;
  font-weight: 600;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.25);
  color: var(--accent);
  vertical-align: middle;
}

.asset-mention {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 50;
  max-height: min(280px, 42vh);
  overflow-y: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: linear-gradient(
    165deg,
    rgba(22, 26, 40, 0.96) 0%,
    rgba(10, 12, 20, 0.96) 100%
  );
  backdrop-filter: blur(20px) saturate(1.3);
  -webkit-backdrop-filter: blur(20px) saturate(1.3);
  box-shadow:
    0 16px 40px rgba(0, 0, 0, 0.5),
    var(--shadow-glow);
}

.asset-mention-empty {
  padding: 0.75rem 0.85rem;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.45;
}

.asset-mention-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  text-align: left;
  padding: 0.45rem 0.55rem;
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s;
}

.asset-mention-item:last-child {
  border-bottom: none;
}

.asset-mention-item:hover,
.asset-mention-item:focus-visible {
  background: rgba(232, 136, 74, 0.12);
  outline: none;
}

.asset-mention-thumb {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 8px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: var(--muted);
}

.asset-mention-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.asset-mention-meta {
  min-width: 0;
  flex: 1;
}

.asset-mention-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
}

.asset-mention-token {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--accent);
  margin-top: 0.15rem;
}

.prompt-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.6rem;
}

.btn-tool {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.btn-tool__icon {
  font-size: 0.95rem;
  opacity: 0.9;
  line-height: 1;
}

.btn-tool--refine {
  color: #fff;
  background: linear-gradient(135deg, #3d4a62 0%, #2a3140 100%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow:
    0 2px 10px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.btn-tool--refine:hover:not(:disabled) {
  border-color: rgba(196, 92, 38, 0.45);
  box-shadow:
    0 4px 16px rgba(196, 92, 38, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.btn-tool--fill {
  color: var(--text);
  background: linear-gradient(180deg, #1c1f28 0%, #14161c 100%);
  border: 1px solid var(--border);
}

.btn-tool--fill:hover:not(:disabled) {
  border-color: rgba(196, 92, 38, 0.5);
  background: linear-gradient(180deg, #232733 0%, #181b24 100%);
}

.btn-tool--merge {
  color: var(--muted);
  background: transparent;
  border: 1px dashed rgba(139, 145, 156, 0.45);
  box-shadow: none;
}

.btn-tool--merge:hover:not(:disabled) {
  color: var(--text);
  border-color: rgba(196, 92, 38, 0.55);
  background: rgba(196, 92, 38, 0.06);
}

.hint-details {
  margin-top: 0.65rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(4, 6, 14, 0.4);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-size: 0.8rem;
  color: var(--muted);
  box-shadow: var(--shadow-glow);
}

.hint-details summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text);
  list-style-position: outside;
}

.hint-details ul {
  margin: 0.5rem 0 0;
  padding-left: 1.2rem;
}

.hint-details li {
  margin-bottom: 0.35rem;
}

.hint-details code {
  font-family: var(--mono);
  font-size: 0.78em;
  padding: 0.1em 0.35em;
  border-radius: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
}

.btn.ghost {
  display: inline-block;
  margin-top: 0.75rem;
  text-align: center;
  text-decoration: none;
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}

.btn.ghost:hover {
  border-color: var(--accent-dim);
}

.status-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  position: sticky;
  top: 1rem;
}

.status-card h2 {
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.status-idle {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.status-running {
  color: var(--accent);
}

.status-ok {
  color: var(--success);
}

.status-err {
  color: #c94a4a;
}

.json-out {
  margin: 0.75rem 0 0;
  padding: 0.75rem;
  background: var(--bg);
  border-radius: 8px;
  border: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 0.7rem;
  line-height: 1.45;
  overflow: auto;
  max-height: 200px;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--muted);
}

.preview-wrap {
  margin-top: 1rem;
}

.preview-wrap.hidden {
  display: none;
}

#result-video {
  width: 100%;
  border-radius: 8px;
  background: #000;
}

#result-image {
  width: 100%;
  border-radius: 8px;
  background: #000;
  display: block;
}

.footer {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--muted);
}

.footer a {
  color: var(--accent);
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

/* Seedance 2.0 队列与多模态栅格 */
.queue-stats-block {
  font-size: 0.82rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.75rem;
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  margin-bottom: 0.75rem;
  box-shadow: var(--shadow-glow);
}

.queue-stat-row {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.2rem 0;
  color: var(--muted);
}

.queue-stat-row strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.job-debug {
  font-family: var(--mono);
  font-size: 0.65rem;
  line-height: 1.35;
  max-height: 220px;
  overflow: auto;
  padding: 0.5rem;
  margin: 0 0 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(4, 6, 12, 0.65);
  color: #b8c4d8;
  white-space: pre-wrap;
  word-break: break-all;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.asset-panel-title {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
  font-weight: 600;
}

.mm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}

.mm-videos-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
  margin-bottom: 0.65rem;
}

@media (max-width: 520px) {
  .mm-videos-grid {
    grid-template-columns: 1fr;
  }
}

.mm-cell .mm-label {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

.mm-cell .field-url {
  margin-top: 0.35rem;
  font-size: 0.75rem;
}

.history-meta {
  padding: 0.45rem 0.5rem 0.55rem;
  border-top: 1px solid var(--border);
  font-size: 0.72rem;
}

.status-line {
  margin-top: 0.75rem;
  font-size: 0.88rem;
  min-height: 1.25em;
}

.status-line.status-ok {
  color: var(--success);
}

.status-line.status-err {
  color: #e85a5a;
}

.status-line.status-running {
  color: #c9a227;
}

.result-wrap {
  margin-top: 1rem;
}

.submit-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: flex-start;
  margin-top: 0.25rem;
}

.submit-primary-col {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
}

.credit-cost-hint {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
  max-width: min(440px, 100%);
  line-height: 1.35;
}

.upload-size-inline {
  display: block;
  margin-top: 0.2rem;
  font-weight: 500;
  color: #c9a227;
  font-size: 0.8rem;
  white-space: pre-line;
  line-height: 1.45;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

.btn-outline:hover:not(:disabled) {
  border-color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
}

.btn.danger {
  background: #7a2e2e;
  border: 1px solid #a04545;
  color: #fff;
}

.btn.danger:hover:not(:disabled) {
  filter: brightness(1.08);
}

.btn.danger:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal[hidden] {
  display: none !important;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 6, 12, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  cursor: pointer;
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(520px, 100%);
  max-height: min(88vh, 640px);
  overflow: auto;
  padding: 1.25rem 1.35rem;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: linear-gradient(
    165deg,
    rgba(28, 32, 48, 0.92) 0%,
    rgba(14, 16, 26, 0.88) 100%
  );
  backdrop-filter: blur(28px) saturate(1.4);
  -webkit-backdrop-filter: blur(28px) saturate(1.4);
  box-shadow:
    0 24px 64px rgba(0, 0, 0, 0.55),
    var(--shadow-glow);
}

.modal-title {
  margin: 0 0 0.75rem;
  font-size: 1.1rem;
}

.modal-body {
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--text);
}

.modal-body p {
  margin: 0 0 0.75rem;
}

.cancel-refund-emphasis {
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  border: 1px solid rgba(232, 90, 90, 0.45);
  background: rgba(232, 90, 90, 0.08);
  color: #f0b4b4;
  font-weight: 600;
}

.cancel-ack-row {
  margin: 0.75rem 0 0;
  align-items: flex-start;
  gap: 0.5rem;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1rem;
}

.modal-doc-links {
  margin-top: 0.5rem;
  font-size: 0.82rem;
}

.modal-doc-links a {
  color: var(--accent);
  margin-right: 0.75rem;
}
