:root {
  --bg: #05060a;
  --bg-2: #080b12;
  --panel: #0d1119;
  --panel-2: #121724;
  --panel-3: #161d2c;
  --line: rgba(148, 163, 184, 0.14);
  --line-strong: rgba(148, 163, 184, 0.24);
  --text: #e9eef7;
  --muted: #93a0b4;
  --faint: #5f6b7d;
  --cyan: #22d3ee;
  --lime: #b6f36b;
  --magenta: #f472b6;
  --amber: #f5b34c;
  --danger: #fb7185;
  --success: #4ade80;
  --radius: 8px;
  --mono: "Cascadia Code", Consolas, "SFMono-Regular", monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  font-family: "Segoe UI Variable", "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  letter-spacing: 0;
  line-height: 1.5;
  overflow-x: hidden;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

svg {
  flex: 0 0 auto;
}

.hidden {
  display: none !important;
}

.text-accent {
  color: var(--lime);
}

.fx-grid {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(148, 163, 184, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.05) 1px, transparent 1px),
    linear-gradient(180deg, rgba(34, 211, 238, 0.06), transparent 36%),
    linear-gradient(0deg, rgba(182, 243, 107, 0.045), transparent 30%);
  background-size: 42px 42px, 42px 42px, 100% 100%, 100% 100%;
}

.fx-scan {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.45;
  background: repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 3px);
  mix-blend-mode: overlay;
  animation: scan-drift 9s linear infinite;
}

@keyframes scan-drift {
  from {
    background-position: 0 0;
  }
  to {
    background-position: 0 36px;
  }
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}

.btn svg {
  width: 16px;
  height: 16px;
}

.btn-accent {
  background: linear-gradient(135deg, var(--lime), #8be9a0);
  color: #0a120c;
  box-shadow: 0 8px 24px rgba(182, 243, 107, 0.16);
}

.btn-accent:hover {
  box-shadow: 0 10px 30px rgba(182, 243, 107, 0.28);
  transform: translateY(-1px);
}

.btn.ghost {
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--line-strong);
  color: var(--text);
}

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

.btn.full {
  width: 100%;
}

.btn.small {
  height: 34px;
  padding: 0 12px;
  font-size: 13px;
}

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

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.icon-btn svg {
  width: 17px;
  height: 17px;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border-color: var(--line);
}

.input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(5, 7, 12, 0.72);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input::placeholder {
  color: var(--faint);
}

.input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.12);
}

.field-label {
  display: block;
  margin: 14px 0 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.auth-view {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(400px, 440px);
  background: var(--bg);
}

.auth-media {
  position: relative;
  overflow: hidden;
}

.auth-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(1.15) contrast(1.04) brightness(0.82);
}

.auth-media-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(5, 6, 10, 0.58), rgba(5, 6, 10, 0.16) 46%, rgba(5, 6, 10, 0.92));
}

.auth-media::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(148, 163, 184, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.07) 1px, transparent 1px);
  background-size: 34px 34px;
  opacity: 0.55;
}

.auth-media-caption {
  position: absolute;
  left: 42px;
  bottom: 38px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.auth-media-caption .eyebrow {
  width: fit-content;
  padding: 5px 10px;
  border: 1px solid rgba(34, 211, 238, 0.4);
  border-radius: 6px;
  background: rgba(5, 6, 10, 0.55);
  color: var(--cyan);
  font-family: var(--mono);
  font-size: 11px;
}

.auth-media-caption strong {
  font-size: 24px;
  font-weight: 800;
  text-shadow: 0 4px 26px rgba(0, 0, 0, 0.65);
}

.auth-shell {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 26px;
  padding: 40px;
  background: linear-gradient(180deg, #070a10, #05060a);
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--cyan), var(--lime));
  color: #071019;
  box-shadow: 0 0 26px rgba(34, 211, 238, 0.22);
}

.brand-mark svg {
  width: 22px;
  height: 22px;
}

.brand-mark.small {
  width: 38px;
  height: 38px;
  box-shadow: none;
}

.brand-mark.small svg {
  width: 18px;
  height: 18px;
}

.brand-copy {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-size: 19px;
  font-weight: 800;
}

.brand-sub {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 11px;
}

.auth-card {
  position: relative;
  width: 100%;
  padding: 28px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: rgba(13, 17, 25, 0.84);
  backdrop-filter: blur(16px);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
}

.auth-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  border-radius: var(--radius) var(--radius) 0 0;
  background: linear-gradient(90deg, var(--cyan), var(--lime), transparent 74%);
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  margin-bottom: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(5, 7, 12, 0.62);
}

.tab-btn {
  height: 36px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.tab-btn.active {
  background: var(--panel-3);
  color: var(--cyan);
  box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.3);
}

.auth-card .btn {
  margin-top: 22px;
}

.auth-note {
  margin: 14px 0 0;
  color: var(--faint);
  font-size: 13px;
  text-align: center;
}

.app-view {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
}

.rail {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  border-right: 1px solid var(--line);
  background: rgba(9, 12, 19, 0.92);
  backdrop-filter: blur(16px);
}

.rail-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 4px 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.rail-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.nav-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  text-align: left;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-btn svg {
  width: 18px;
  height: 18px;
}

.nav-btn kbd {
  margin-left: auto;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
}

.nav-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.nav-btn.active {
  background: linear-gradient(90deg, rgba(34, 211, 238, 0.13), rgba(34, 211, 238, 0.03));
  color: var(--cyan);
}

.nav-btn.active::before {
  content: "";
  position: absolute;
  left: -14px;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 3px;
  background: var(--cyan);
  box-shadow: 0 0 10px rgba(34, 211, 238, 0.65);
}

.nav-count {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 20px;
  margin-left: auto;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(34, 211, 238, 0.14);
  color: var(--cyan);
  font-family: var(--mono);
  font-size: 10px;
}

.rail-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--cyan), var(--lime));
  color: #071019;
  font-weight: 800;
}

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

.user-meta strong {
  display: block;
  overflow: hidden;
  max-width: 116px;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-meta span {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--faint);
  font-size: 11px;
}

.user-meta span::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px rgba(74, 222, 128, 0.7);
}

.main {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 64px;
  padding: 0 26px;
  border-bottom: 1px solid var(--line);
  background: rgba(5, 6, 10, 0.84);
  backdrop-filter: blur(14px);
}

.topbar-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.topbar-title h1 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.view-index {
  display: grid;
  place-items: center;
  width: 30px;
  height: 26px;
  border: 1px solid rgba(34, 211, 238, 0.35);
  border-radius: 6px;
  background: rgba(34, 211, 238, 0.08);
  color: var(--cyan);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
}

.env-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
}

.env-badge i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px rgba(74, 222, 128, 0.7);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.balance-card {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 42px;
  padding: 0 16px 0 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
}

.balance-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(34, 211, 238, 0.12);
  color: var(--cyan);
}

.balance-icon svg {
  width: 15px;
  height: 15px;
}

.balance-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.balance-copy span {
  color: var(--faint);
  font-size: 11px;
}

.balance-copy strong {
  color: var(--lime);
  font-size: 16px;
}

.content {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 28px 28px 64px;
}

.view {
  animation: view-in 0.22s ease;
}

@keyframes view-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.section-head h2 {
  margin: 0;
  font-size: 24px;
}

.section-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.sys-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.sys-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
}

.sys-item i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.sys-item i.ok {
  background: var(--success);
  box-shadow: 0 0 8px rgba(74, 222, 128, 0.7);
}

.sys-item b {
  color: var(--text);
}

.panel {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(19, 25, 36, 0.9), rgba(13, 17, 25, 0.94));
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
}

.panel-head,
.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.panel-title {
  font-size: 14px;
  font-weight: 700;
}

.hud-tag {
  padding: 3px 8px;
  border: 1px solid rgba(34, 211, 238, 0.3);
  border-radius: 5px;
  background: rgba(34, 211, 238, 0.08);
  color: var(--cyan);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.studio-grid {
  display: grid;
  grid-template-columns: minmax(0, 430px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.form-body {
  padding: 4px 18px 18px;
}

.textarea-wrap {
  position: relative;
}

.panel textarea {
  width: 100%;
  min-height: 150px;
  padding: 14px 14px 30px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(5, 7, 12, 0.72);
  color: var(--text);
  line-height: 1.65;
  outline: none;
  resize: vertical;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.panel textarea:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.11);
}

.panel textarea::placeholder {
  color: var(--faint);
}

.char-count {
  position: absolute;
  right: 12px;
  bottom: 10px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 11px;
}

.field-block {
  margin-bottom: 4px;
}

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

.preset-chip {
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.preset-chip:hover {
  color: var(--text);
  border-color: var(--line-strong);
}

.preset-chip.active {
  background: rgba(244, 114, 182, 0.1);
  border-color: rgba(244, 114, 182, 0.45);
  color: var(--magenta);
  box-shadow: 0 0 18px rgba(244, 114, 182, 0.12);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 16px 0;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(5, 7, 12, 0.6);
}

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

.seg-btn {
  height: 36px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.seg-btn:hover {
  color: var(--text);
}

.seg-btn.active {
  background: linear-gradient(180deg, rgba(34, 211, 238, 0.16), rgba(34, 211, 238, 0.06));
  color: var(--cyan);
  box-shadow: inset 0 0 0 1px rgba(34, 211, 238, 0.28);
}

.cost-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0 16px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.cost-label {
  color: var(--muted);
  font-size: 14px;
}

.cost-balance {
  margin-left: auto;
  color: var(--faint);
  font-size: 12px;
}

.cost-balance b {
  color: var(--text);
}

.cost-value {
  color: var(--amber);
  font-size: 20px;
}

.cost-value small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.generate-btn {
  height: 46px;
}

.preview-panel {
  overflow: hidden;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.status-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.status-pill.queued {
  background: rgba(245, 179, 76, 0.12);
  color: var(--amber);
}

.status-pill.processing {
  background: rgba(34, 211, 238, 0.12);
  color: var(--cyan);
}

.status-pill.processing::before {
  animation: pulse 1s ease-in-out infinite;
}

.status-pill.completed {
  background: rgba(74, 222, 128, 0.12);
  color: var(--success);
}

.status-pill.failed {
  background: rgba(251, 113, 133, 0.12);
  color: var(--danger);
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}

.stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: linear-gradient(135deg, #070a12, #0b101b 55%, #0a0f18);
}

.stage[data-ratio="9:16"] {
  width: min(100%, 420px);
  margin: 0 auto;
  aspect-ratio: 9 / 16;
}

.stage[data-ratio="1:1"] {
  width: min(100%, 520px);
  margin: 0 auto;
  aspect-ratio: 1 / 1;
}

.stage::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(34, 211, 238, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(34, 211, 238, 0.035) 1px, transparent 1px);
  background-size: 28px 28px;
  opacity: 0.8;
  pointer-events: none;
}

.stage > video,
.stage > img {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.stage-empty {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 14px;
  color: var(--faint);
}

.stage-icon {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border: 1px solid rgba(34, 211, 238, 0.28);
  border-radius: var(--radius);
  background: rgba(34, 211, 238, 0.05);
}

.stage-icon svg {
  width: 26px;
  height: 26px;
  color: var(--cyan);
}

.stage-empty-copy {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.stage-empty-title {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.stage-empty-sub {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 11px;
}

.stage-corner {
  position: absolute;
  z-index: 4;
  width: 22px;
  height: 22px;
  border: 0 solid rgba(34, 211, 238, 0.7);
  pointer-events: none;
}

.stage-corner.tl {
  top: 12px;
  left: 12px;
  border-top-width: 2px;
  border-left-width: 2px;
}

.stage-corner.tr {
  top: 12px;
  right: 12px;
  border-top-width: 2px;
  border-right-width: 2px;
}

.stage-corner.bl {
  bottom: 12px;
  left: 12px;
  border-bottom-width: 2px;
  border-left-width: 2px;
}

.stage-corner.br {
  right: 12px;
  bottom: 12px;
  border-right-width: 2px;
  border-bottom-width: 2px;
}

.stage-progress {
  position: absolute;
  right: 14px;
  bottom: 14px;
  left: 14px;
  z-index: 5;
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.stage-progress span {
  display: block;
  width: 42%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--cyan), var(--lime));
  box-shadow: 0 0 14px rgba(34, 211, 238, 0.7);
  animation: stage-slide 1.1s ease-in-out infinite;
}

@keyframes stage-slide {
  0% {
    transform: translateX(-120%);
  }
  100% {
    transform: translateX(400%);
  }
}

.stage-hud {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(5, 7, 12, 0.55);
  font-family: var(--mono);
  font-size: 11px;
  color: rgba(233, 238, 247, 0.75);
}

.rec-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 10px rgba(251, 113, 133, 0.8);
  animation: pulse 1.4s ease-in-out infinite;
}

.stage-res {
  color: var(--faint);
}

.stage-footer {
  padding: 14px 18px;
  border-top: 1px solid var(--line);
}

.stage-footer p {
  display: -webkit-box;
  min-height: 21px;
  margin: 0 0 10px;
  overflow: hidden;
  font-size: 14px;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

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

.stage-chips span {
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
}

.stage-log {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  min-height: 18px;
}

.log-line {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 11px;
}

.log-line::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--success);
  opacity: 0.75;
}

.log-line.live {
  color: var(--cyan);
}

.log-line.live::before {
  background: var(--lime);
  box-shadow: 0 0 8px rgba(182, 243, 107, 0.8);
  animation: pulse 1s ease-in-out infinite;
}

.recent-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 28px 0 14px;
}

.recent-head h3 {
  margin: 0;
  font-size: 16px;
}

.video-grid,
.recent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
}

.video-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(19, 25, 36, 0.86), rgba(13, 17, 25, 0.94));
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.video-card:hover {
  transform: translateY(-3px);
  border-color: rgba(34, 211, 238, 0.42);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.36);
}

.video-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #070a12;
}

.video-thumb > video,
.video-thumb > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.thumb-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  color: var(--faint);
  font-size: 13px;
}

.thumb-placeholder svg {
  width: 22px;
  height: 22px;
  color: var(--cyan);
}

.thumb-hud {
  position: absolute;
  right: 10px;
  bottom: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: rgba(5, 7, 12, 0.62);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
}

.thumb-hud i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--cyan);
}

.play-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  background: rgba(4, 7, 10, 0.42);
  opacity: 0;
  transition: opacity 0.18s ease;
}

.video-card:hover .play-overlay {
  opacity: 1;
}

.play-overlay span {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(182, 243, 107, 0.94);
  color: #0a120c;
  box-shadow: 0 0 30px rgba(182, 243, 107, 0.4);
}

.play-overlay svg {
  width: 20px;
  height: 20px;
  margin-left: 3px;
}

.status-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 3;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(5, 7, 12, 0.78);
  backdrop-filter: blur(6px);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

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

.status-badge.processing {
  color: var(--cyan);
}

.status-badge.queued {
  color: var(--amber);
}

.status-badge.failed {
  color: var(--danger);
}

.video-body {
  padding: 14px;
}

.video-prompt {
  display: -webkit-box;
  min-height: 40px;
  margin: 0 0 12px;
  overflow: hidden;
  font-size: 14px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.video-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 11px;
}

.video-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 34px;
  align-items: center;
}

.pending-note {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--faint);
  font-size: 13px;
}

.pending-note::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 8px rgba(245, 179, 76, 0.7);
  animation: pulse 1.2s ease-in-out infinite;
}

.error-text {
  color: var(--danger);
  font-size: 13px;
}

.empty-state {
  display: flex;
  grid-column: 1 / -1;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 60px 20px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--faint);
}

.empty-state svg {
  width: 34px;
  height: 34px;
  color: var(--cyan);
}

.wallet-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

.wallet-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.025);
}

.wallet-item span {
  color: var(--faint);
  font-size: 12px;
}

.wallet-item strong {
  font-size: 20px;
  color: var(--text);
}

.wallet-item:first-child strong {
  color: var(--lime);
}

.plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
  gap: 16px;
}

.plan-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(19, 25, 36, 0.86), rgba(13, 17, 25, 0.94));
  color: var(--text);
  text-align: left;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.plan-card:hover {
  transform: translateY(-2px);
  border-color: rgba(182, 243, 107, 0.55);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.32);
}

.plan-card.recommended {
  border-color: rgba(182, 243, 107, 0.42);
  background: linear-gradient(180deg, rgba(182, 243, 107, 0.09), rgba(13, 17, 25, 0.94) 68%);
}

.plan-tag {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(182, 243, 107, 0.14);
  color: var(--lime);
  font-size: 11px;
  font-weight: 700;
}

.plan-eyebrow {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 11px;
}

.plan-price {
  margin-top: 6px;
  font-size: 30px;
  font-weight: 800;
  color: var(--text);
}

.plan-note {
  color: var(--muted);
  font-size: 13px;
}

.plan-action {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 10px;
  color: var(--lime);
  font-size: 14px;
  font-weight: 700;
}

.plan-action svg {
  width: 15px;
  height: 15px;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(19, 25, 36, 0.86), rgba(13, 17, 25, 0.94));
}

table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
}

th,
td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

th {
  background: rgba(255, 255, 255, 0.03);
  color: var(--faint);
  font-size: 12px;
  font-weight: 600;
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

td {
  font-size: 14px;
}

.type-chip {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.type-recharge {
  background: rgba(182, 243, 107, 0.14);
  color: var(--lime);
}

.type-spend {
  background: rgba(251, 113, 133, 0.12);
  color: #ffa3b1;
}

.type-refund {
  background: rgba(74, 222, 128, 0.12);
  color: var(--success);
}

.type-bonus {
  background: rgba(34, 211, 238, 0.12);
  color: var(--cyan);
}

.type-card {
  background: rgba(244, 114, 182, 0.12);
  color: var(--magenta);
}

.plus {
  color: var(--success);
  font-weight: 700;
}

.minus {
  color: #ffa3b1;
  font-weight: 700;
}

.empty-cell {
  padding: 32px;
  color: var(--faint);
  text-align: center;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(5, 7, 10, 0.74);
  backdrop-filter: blur(8px);
}

.modal-card {
  position: relative;
  width: min(480px, 100%);
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(19, 25, 36, 0.96), rgba(13, 17, 25, 0.98));
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.55);
  animation: modal-in 0.2s ease;
}

.modal-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--cyan), var(--lime), transparent 74%);
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: scale(0.97) translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}

.modal-head h3 {
  margin: 0;
  font-size: 16px;
}

.modal-sub {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 11px;
}

.modal-body {
  padding: 20px;
}

.preview-img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: var(--radius);
  background: #070a12;
}

.preview-prompt {
  margin: 14px 0;
  color: var(--muted);
  font-size: 14px;
}

.order-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

.order-line span {
  color: var(--muted);
}

.mock-badge {
  display: inline-flex;
  margin: 14px 0 16px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(245, 179, 76, 0.13);
  color: var(--amber);
  font-size: 12px;
  font-weight: 600;
}

.toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  z-index: 80;
  max-width: calc(100vw - 32px);
  padding: 11px 18px;
  border: 1px solid rgba(34, 211, 238, 0.35);
  border-radius: var(--radius);
  background: var(--panel-3);
  color: var(--text);
  font-size: 14px;
  box-shadow: 0 12px 44px rgba(0, 0, 0, 0.45);
  transform: translateX(-50%);
}

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

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

  .auth-media {
    display: none;
  }

  .auth-shell {
    min-height: 100vh;
    align-items: center;
    justify-content: center;
    padding: 32px 20px;
  }

  .auth-card {
    max-width: 440px;
  }

  .app-view {
    grid-template-columns: 1fr;
  }

  .rail {
    position: static;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    height: auto;
    padding: 12px 14px;
    overflow-x: auto;
  }

  .rail-brand {
    flex: 0 0 auto;
    padding: 0;
    margin: 0;
    border: none;
  }

  .rail-brand .brand-sub {
    display: none;
  }

  .rail-nav {
    flex-direction: row;
    overflow-x: auto;
    flex: 1;
  }

  .nav-btn {
    flex: 0 0 auto;
    width: auto;
    height: 40px;
    padding: 0 12px;
  }

  .nav-btn.active::before {
    display: none;
  }

  .nav-btn kbd {
    display: none;
  }

  .rail-foot {
    margin-left: auto;
    padding: 0;
    border: none;
  }

  .user-meta {
    display: none;
  }

  .topbar {
    padding: 0 16px;
  }

  .content {
    padding: 20px 16px 48px;
  }
}

@media (max-width: 640px) {
  .env-badge {
    display: none;
  }

  .balance-copy span {
    display: none;
  }

  .balance-card {
    padding-right: 12px;
  }

  .topbar-actions .btn {
    padding: 0 12px;
  }

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

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

  .sys-strip {
    justify-content: flex-start;
  }

  .wallet-strip {
    grid-template-columns: 1fr;
  }

  .video-grid,
  .recent-grid {
    grid-template-columns: 1fr;
  }

  .auth-shell {
    padding: 24px 16px;
  }

  .auth-card {
    padding: 22px;
  }

  .stage[data-ratio="9:16"] {
    width: min(100%, 320px);
  }
}

.username-field {
  margin-top: 0;
}

.auth-card .username-field .field-label {
  margin-top: 0;
}

.preview-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 1px dashed rgba(34, 211, 238, 0.35);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(34, 211, 238, 0.08), rgba(182, 243, 107, 0.05)),
    #070a12;
  color: var(--faint);
}

.preview-placeholder svg {
  width: 38px;
  height: 38px;
  color: var(--cyan);
}

.preview-placeholder span {
  font-family: var(--mono);
  font-size: 12px;
}

.app-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(180deg, rgba(5, 6, 10, 0.78), rgba(7, 10, 16, 0.88)),
    url("/media/auth-bg.jpg") center / cover no-repeat;
  filter: blur(12px) brightness(0.6) saturate(0.85);
  transform: scale(1.06);
}

.duration-value {
  color: var(--cyan);
  font-family: var(--mono);
  font-weight: 600;
}

.duration-slider {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 4px 6px;
}

.duration-slider input[type="range"] {
  width: 100%;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--cyan), var(--lime));
  outline: none;
  cursor: pointer;
}

.duration-slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--cyan);
  background: #eaf2fb;
  box-shadow: 0 0 12px rgba(34, 211, 238, 0.55);
  cursor: pointer;
}

.duration-slider input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--cyan);
  background: #eaf2fb;
  box-shadow: 0 0 12px rgba(34, 211, 238, 0.55);
  cursor: pointer;
}

.slider-scale {
  display: flex;
  justify-content: space-between;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 10px;
}

.card-zone {
  display: grid;
  grid-template-columns: minmax(0, 420px);
  gap: 16px;
  margin-top: 18px;
}

.card-zone.two {
  grid-template-columns: minmax(0, 420px) minmax(0, 1fr);
  align-items: start;
}

.card-output {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}

.card-output-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.card-code-list {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid rgba(244, 114, 182, 0.25);
  border-radius: var(--radius);
  background: rgba(5, 7, 12, 0.7);
  color: var(--lime);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.7;
  outline: none;
  resize: vertical;
}

.api-docs-panel {
  margin-top: 18px;
}

.admin-key-row {
  max-width: 420px;
  margin-bottom: 16px;
}

.balance-control {
  display: flex;
  align-items: center;
  gap: 6px;
}

.balance-control .input {
  width: 86px;
  height: 32px;
  padding: 0 8px;
}

.balance-control .btn {
  height: 32px;
  padding: 0 10px;
  font-size: 12px;
}

.api-docs-panel .form-body {
  padding: 4px 18px 18px;
}

.api-docs-panel h3 {
  margin: 18px 0 8px;
  font-size: 15px;
}

.api-docs-panel pre {
  overflow-x: auto;
  margin: 0 0 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #0a0f18;
}

.api-docs-panel code {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--cyan);
}

.doc-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  width: max-content;
  max-width: 100%;
  margin: 6px 0 18px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(5, 7, 12, 0.6);
}

.doc-tab {
  height: 34px;
  padding: 0 14px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.doc-tab:hover {
  color: var(--text);
}

.doc-tab.active {
  background: var(--panel-3);
  color: var(--cyan);
  box-shadow: inset 0 0 0 1px rgba(34, 211, 238, 0.3);
}

.doc-section {
  display: none;
}

.doc-section.active {
  display: block;
  animation: view-in 0.2s ease;
}

.code-block {
  position: relative;
  margin: 12px 0 16px;
}

.code-block pre {
  overflow-x: auto;
  margin: 0;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #0a0f18;
}

.code-block code {
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.7;
  color: var(--cyan);
  white-space: pre;
}

.copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 11px;
}

.copy-btn:hover {
  color: var(--cyan);
  border-color: rgba(34, 211, 238, 0.4);
}

.doc-note {
  padding: 10px 14px;
  border: 1px solid rgba(34, 211, 238, 0.25);
  border-radius: var(--radius);
  background: rgba(34, 211, 238, 0.06);
  color: var(--muted);
  font-size: 13px;
}

.card-panel .form-body {
  padding: 4px 18px 18px;
}

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

.card-status {
  min-height: 18px;
  margin: 8px 0 0;
  color: var(--success);
  font-family: var(--mono);
  font-size: 12px;
}

.ref-count {
  color: var(--cyan);
  font-family: var(--mono);
  font-weight: 600;
}

.ref-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 8px;
}

.ref-item {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border: 1px solid rgba(34, 211, 238, 0.35);
  border-radius: var(--radius);
  background: #070a12;
}

.ref-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ref-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 50%;
  background: rgba(5, 7, 12, 0.78);
  color: var(--text);
  font-size: 14px;
  line-height: 1;
}

.ref-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}
