@font-face { font-family: 'Inter'; font-style: normal; font-weight: 100 900; font-display: swap; src: url('/fonts/Inter-VF.woff2?v=2') format('woff2-variations'); }
:root {
  --bg: #09090b;
  --surface: #111114;
  --surface2: #18181b;
  --surface3: #1e1e22;
  --surface-hover: #242428;
  --surface-bright: #2a2a2e;
  --border: #27272a;
  --border-light: #3f3f46;
  --accent: #7c3aed;
  --accent-light: #a78bfa;
  --accent-dim: rgba(124, 58, 237, 0.15);
  --accent-rgb: 124, 58, 237;
  --accent-dark: #6d28d9;
  --accent2: #06b6d4;
  --text: #fafafa;
  --text-dim: #a1a1aa;
  --text-muted: #8a8a92;
  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;
  --card: #18181b;
  --hover: #242428;
  --radius: 12px;
  --radius-lg: 16px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}
::selection { background: var(--accent); color: white; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ===== LANDING PAGE ===== */
#landingView { display: block; }
#appView { display: none; }

.landing-nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  padding: 16px 40px;
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(9,9,11,0.8);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(39,39,42,0.5);
}
.landing-nav .logo-area {
  display: flex; align-items: center; gap: 12px;
}
.landing-nav .logo-area img {
  height: 36px; width: auto;
}
.landing-nav .nav-btn {
  padding: 10px 28px;
  background: var(--accent);
  border: none; border-radius: 8px;
  color: white; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: all .2s;
  font-family: inherit;
  text-decoration: none;
}
.landing-nav .nav-btn:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
}
.nav-auth {
  display: flex; align-items: center; gap: 12px;
}
.nav-link-sign-in {
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 28px;
  border-radius: 8px;
  transition: all .2s;
  cursor: pointer;
  background: transparent;
  border: 1px solid var(--border-light);
  font-family: inherit;
}
.nav-link-sign-in:hover {
  border-color: var(--accent-light);
  background: var(--accent-dim);
  transform: translateY(-1px);
}

.hero {
  min-height: 100vh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center;
  padding: 120px 24px 80px;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute; top: -40%; left: -20%; right: -20%; bottom: -40%;
  background:
    radial-gradient(ellipse 600px 400px at 30% 20%, rgba(124,58,237,0.12), transparent),
    radial-gradient(ellipse 500px 350px at 70% 60%, rgba(6,182,212,0.08), transparent),
    radial-gradient(ellipse 800px 600px at 50% 50%, rgba(124,58,237,0.04), transparent);
  pointer-events: none;
  animation: heroPulse 8s ease-in-out infinite alternate;
}
@keyframes heroPulse {
  0% { opacity: 0.7; }
  100% { opacity: 1; }
}
.hero-badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 16px 6px 8px;
  background: var(--accent-dim);
  border: 1px solid rgba(124,58,237,0.3);
  border-radius: 100px;
  font-size: 13px; font-weight: 500; color: var(--accent-light);
  margin-bottom: 32px;
  position: relative;
}
.hero-badge .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--success);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
.hero h1 {
  font-size: clamp(40px, 7vw, 80px);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin-bottom: 24px;
  position: relative;
}
.hero h1 .gradient-text {
  background: linear-gradient(135deg, #7c3aed, #06b6d4, #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero p.subtitle {
  font-size: clamp(16px, 2vw, 20px);
  color: var(--text-dim);
  max-width: 600px;
  line-height: 1.6;
  margin-bottom: 48px;
  position: relative;
}
.hero-cta {
  display: flex; gap: 16px; align-items: center;
  position: relative;
}
.btn-primary {
  padding: 14px 36px;
  background: linear-gradient(135deg, #7c3aed, var(--accent-dark));
  border: none; border-radius: 10px;
  color: white; font-size: 16px; font-weight: 600;
  cursor: pointer; transition: all .2s;
  font-family: inherit;
  box-shadow: 0 4px 24px rgba(124,58,237,0.35);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(124,58,237,0.5);
}
.btn-secondary {
  padding: 14px 36px;
  background: transparent;
  border: 1px solid var(--border-light);
  border-radius: 10px;
  color: var(--text); font-size: 16px; font-weight: 500;
  cursor: pointer; transition: all .2s;
  font-family: inherit;
}
.btn-secondary:hover {
  border-color: var(--accent-light);
  background: var(--accent-dim);
}

/* Features section */
.features {
  padding: 80px 40px;
  max-width: 1200px; margin: 0 auto;
}
.features-title {
  text-align: center;
  font-size: 14px; font-weight: 600;
  color: var(--accent-light);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 16px;
}
.features-heading {
  text-align: center;
  font-size: clamp(28px, 4vw, 44px);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 56px;
}
.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
@media (max-width: 768px) {
  .features-grid { grid-template-columns: 1fr; }
}
.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  transition: all .3s;
}
.feature-card:hover {
  border-color: var(--accent);
  transform: translateY(-4px);
  box-shadow: 0 8px 32px rgba(124,58,237,0.1);
}
.feature-icon {
  width: 48px; height: 48px;
  background: var(--accent-dim);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
  margin-bottom: 20px;
}
.feature-card h3 {
  font-size: 18px; font-weight: 600;
  margin-bottom: 8px;
}
.feature-card p {
  font-size: 14px; color: var(--text-dim);
  line-height: 1.6;
}

/* Models section */
.models-section {
  padding: 80px 40px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.models-inner {
  max-width: 1200px; margin: 0 auto;
}
.models-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px; margin-top: 48px;
}
@media (max-width: 768px) {
  .models-grid { grid-template-columns: 1fr; }
}
.model-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  position: relative; overflow: hidden;
}
.model-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
}
.model-card h3 { font-size: 22px; font-weight: 700; margin-bottom: 8px; }
.model-card .model-sub { font-size: 13px; color: var(--text-muted); margin-bottom: 20px; }
.model-specs {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
.spec-item { font-size: 13px; }
.spec-item .spec-label { color: var(--text-muted); display: block; }
.spec-item .spec-value { color: var(--text); font-weight: 500; }

/* Login Modal */
.modal-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 100%; max-width: 420px;
  position: relative;
}
.login-card .close-btn {
  position: absolute; top: 16px; right: 16px;
  background: none; border: none; color: var(--text-muted);
  font-size: 24px; cursor: pointer; line-height: 1;
}
.login-card .close-btn:hover { color: var(--text); }
.login-logo {
  text-align: center; margin-bottom: 24px;
}
.login-logo img { height: 40px; }
.login-card h2 {
  text-align: center;
  font-size: 22px; font-weight: 700;
  margin-bottom: 4px;
}
.login-subtitle {
  text-align: center;
  font-size: 14px; color: var(--text-dim);
  margin-bottom: 28px;
}
.login-card .form-group { margin-bottom: 16px; }
.login-card .form-group label {
  display: block; font-size: 13px; font-weight: 500;
  color: var(--text-dim); margin-bottom: 6px;
}
.login-card input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 12px 14px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color .2s;
}
.login-card input:focus {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  border-color: var(--accent);
}
.login-error {
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px; color: var(--error);
  margin-bottom: 16px;
  display: none;
}
.login-btn {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, #7c3aed, var(--accent-dark));
  border: none; border-radius: 8px;
  color: white; font-size: 15px; font-weight: 600;
  cursor: pointer; transition: all .2s;
  font-family: inherit;
  margin-top: 8px;
}
.login-btn:hover { background: #5b21b6; }
.login-btn:disabled { opacity: 0.5; cursor: wait; }
.auth-toggle {
  text-align: center;
  margin-top: 20px;
  font-size: 13px;
  color: var(--text-muted);
}
.auth-toggle a {
  color: var(--accent-light);
  text-decoration: none;
  font-weight: 500;
}
.auth-toggle a:hover { text-decoration: underline; }

/* Footer */
.landing-footer {
  padding: 40px;
  text-align: center;
  border-top: 1px solid var(--border);
  color: var(--text-muted); font-size: 13px;
}
.landing-footer a {
  color: var(--accent-light);
  text-decoration: none;
}

/* ===== APP VIEW ===== */
.app-header {
  border-bottom: 1px solid var(--border);
  padding: 12px 32px;
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface);
}
.app-header .logo-area {
  display: flex; align-items: center; gap: 12px;
}
.app-header .logo-area img { height: 30px; }
.app-header .right-side {
  display: flex; align-items: center; gap: 12px;
}
.app-header .status-indicator {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text-dim);
}
.app-header .status-indicator .dot {
  width: 7px; height: 7px; border-radius: 50%;
}
.app-header .status-indicator .dot.online { background: var(--success); }
.app-header .status-indicator .dot.offline { background: var(--error); }

.app-main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 32px;
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 24px;
  min-height: calc(100vh - 57px);
}
@media (max-width: 960px) {
  .app-main { grid-template-columns: 1fr; }
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.panel-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.form-group { margin-bottom: 14px; }
.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-dim);
  margin-bottom: 5px;
}
textarea, input[type="number"], input[type="range"], input[type="text"], select {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 10px 12px;
  font-size: 13px;
  font-family: inherit;
  transition: border-color .2s;
}
input[type="file"] {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 10px 12px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
}
input[type="file"]::file-selector-button {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  margin-right: 10px;
  font-family: inherit;
}
input[type="file"]::file-selector-button:hover {
  background: var(--accent-dark);
}
textarea:focus, input:focus, select:focus {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  border-color: var(--accent);
}
textarea { resize: vertical; min-height: 80px; }

.half-row { display: flex; gap: 12px; }
.half-row > div { flex: 1; }

.btn-generate {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: white;
  border: none;
  border-radius: 8px;
  padding: 10px 24px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all .2s;
  box-shadow: 0 2px 12px rgba(var(--accent-rgb), .3);
}
.btn-generate:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(var(--accent-rgb), .45);
}
.btn-generate:disabled {
  opacity: .5;
  cursor: not-allowed;
  transform: none;
}

.status-message {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin-top: 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-dim);
}

.btn {
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  transition: all .2s;
}
.btn:hover {
  border-color: var(--accent);
  background: var(--surface3);
}

.tab-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  transition: all .15s;
  min-height: 44px;
}
.tab-btn:hover { border-color: var(--accent); }
.tab-btn.active { background: var(--accent); color: white; border-color: var(--accent); }

.row { display: flex; gap: 10px; }
.row .form-group { flex: 1; }

.aspect-ratio-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.aspect-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  padding: 10px 6px;
  font-size: 11px;
  cursor: pointer;
  text-align: center;
  transition: all .2s;
  min-height: 44px;
}
.aspect-btn:hover { border-color: var(--accent); color: var(--text); }
.aspect-btn.active {
  border-color: var(--accent);
  background: var(--accent-dim);
  color: var(--text);
}
.aspect-btn .ratio-label { font-weight: 600; display: block; font-size: 12px; }
.aspect-btn .ratio-size { font-size: 11px; color: var(--text-muted); margin-top: 1px; display: block; }

.advanced-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  padding: 7px 12px;
  font-size: 12px;
  cursor: pointer;
  width: 100%;
  text-align: left;
  margin-bottom: 14px;
  transition: all .2s;
  font-family: inherit;
}
.advanced-toggle:hover { border-color: var(--accent); color: var(--text); }
.advanced-content { display: none; }
.advanced-content.open { display: block; }

.settings-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin: 16px 0 8px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.settings-section-title:first-child { margin-top: 4px; border-top: none; padding-top: 0; }

.resolution-info {
  margin-top: 6px;
  padding: 6px 10px;
  background: var(--surface2);
  border-radius: 6px;
  border: 1px solid var(--border);
}
.resolution-info small {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
}
.quota-indicator {
  margin-top: 10px;
  padding: 8px 12px;
  background: var(--surface2);
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-dim);
}
.quota-bar {
  margin-top: 6px;
  height: 4px;
  background: var(--surface3);
  border-radius: 2px;
  overflow: hidden;
}
.quota-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.3s;
}

.generate-btn {
  width: 100%;
  padding: 13px;
  background: linear-gradient(135deg, #7c3aed, var(--accent-dark));
  border: none;
  border-radius: 8px;
  color: white;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  margin-top: 6px;
  font-family: inherit;
}
.generate-btn:hover { box-shadow: 0 4px 20px rgba(124,58,237,.4); }
.generate-btn:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; }

.right-col { display: flex; flex-direction: column; gap: 24px; }

.preview-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}
.placeholder-box {
  width: 100%;
  max-width: 100%;
  max-height: 60vh;
  aspect-ratio: 16/9;
  background: var(--surface2);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  color: var(--text-muted);
}
.placeholder-box svg {
  width: 48px; height: 48px;
  margin-bottom: 12px; opacity: 0.3;
}

.progress-bar {
  width: 100%; height: 3px;
  background: var(--surface2);
  border-radius: 2px;
  margin-top: 16px;
  overflow: hidden; display: none;
}
.progress-bar.active { display: block; }
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 2px;
  animation: progress-indeterminate 1.5s ease-in-out infinite;
  width: 30%;
}
@keyframes progress-indeterminate {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(400%); }
}
.status-msg {
  text-align: center; margin-top: 12px;
  font-size: 13px; color: var(--text-dim);
}
.status-msg.status-error {
  color: var(--error);
  font-weight: 500;
}
video {
  width: 100%;
  max-height: 70vh;
  object-fit: contain;
  border-radius: var(--radius);
  background: #000;
}
@media (max-width: 600px) {
  video { max-height: 50vh; }
  .placeholder-box { max-height: 40vh; }
}
.download-btn {
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 12px; padding: 8px 20px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text); font-size: 13px;
  text-decoration: none; cursor: pointer; transition: all .2s;
}
.download-btn:hover { border-color: var(--accent); }

.seed-row { display: flex; gap: 8px; align-items: flex-end; margin-bottom: 14px; }
.seed-row .form-group { flex: 1; margin-bottom: 0; }
.dice-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  width: 44px; height: 44px;
  cursor: pointer; font-size: 16px;
  transition: all .2s; flex-shrink: 0;
}
.dice-btn:hover { border-color: var(--accent); color: var(--text); }

.history-panel { grid-column: 1 / -1; }
.history-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px; margin-top: 10px;
}
.history-item {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden; cursor: pointer;
  transition: border-color .2s;
}
.history-item:hover { border-color: var(--accent); }
.history-item video {
  width: 100%; aspect-ratio: 16/9;
  object-fit: cover; border-radius: 0;
}
.history-item .meta {
  padding: 6px 8px; font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis;
}

.duration-range-row {
  display: flex; justify-content: space-between;
  font-size: 11px; color: var(--text-muted);
  margin-top: 3px;
}

/* ===== MOBILE RESPONSIVE FIXES ===== */
@media (max-width: 600px) {
  .landing-nav { padding: 12px 16px; }
  .app-main { padding: 16px; }
  .app-header { padding: 10px 16px; }
  .features { padding: 48px 16px; }
  .models-section { padding: 48px 16px; }
  .hero { padding: 100px 16px 60px; }
  .hero-cta { flex-direction: column; width: 100%; }
  .hero-cta .btn-primary,
  .hero-cta .btn-secondary { width: 100%; text-align: center; }
  .panel { padding: 16px; }
  .half-row { flex-direction: column; gap: 0; }
  .aspect-ratio-grid { grid-template-columns: repeat(3, 1fr); gap: 4px; }
  .aspect-btn { padding: 8px 4px; font-size: 10px; }
  .history-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .login-card { padding: 28px 20px; margin: 16px; }
}
@media (max-width: 480px) {
  .landing-nav { padding: 10px 12px; }
  .landing-nav .logo-area img { height: 28px; }
  .app-main { padding: 12px; }
  .features-grid { gap: 16px; }
  .feature-card { padding: 24px; }
  .model-card { padding: 24px; }
  .model-specs { grid-template-columns: 1fr; }
}

/* ===== LIGHT THEME ===== */
body.light {
  --bg: #f5f5f5;
  --surface: #ffffff;
  --surface2: #f0f0f2;
  --surface3: #e8e8eb;
  --surface-bright: #e0e0e4;
  --card: #ffffff;
  --hover: #e8e8eb;
  --surface-hover: #e8e8eb;
  --border: #d4d4d8;
  --border-light: #a1a1aa;
  --text: #18181b;
  --text-dim: #52525b;
  --text-muted: #636370;
  --accent: #7c3aed;
  --accent-light: #6d28d9;
  --accent-dim: rgba(124, 58, 237, 0.1);
  --success: #059669;
  --warning: #b45309;
  --error: #dc2626;
}
body.light ::selection { background: var(--accent); color: white; }
body.light ::-webkit-scrollbar-track { background: var(--bg); }
body.light ::-webkit-scrollbar-thumb { background: var(--border); }
