:root {
  --bg: #0a0a10;
  --surface: #14141d;
  --surface-2: #1c1c28;
  --border: #2a2a3a;
  --text: #f2f2f7;
  --muted: #9a9ab0;
  --accent: #7c5cff;
  --accent-2: #00d4ff;
  --radius: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  min-height: 100vh;
  line-height: 1.5;
}

.bg-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(600px 400px at 20% 0%, rgba(124, 92, 255, 0.12), transparent 60%),
    radial-gradient(500px 400px at 85% 20%, rgba(0, 212, 255, 0.08), transparent 60%);
}

.container {
  max-width: 680px;
  margin: 0 auto;
  padding: 32px 20px 64px;
  position: relative;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 56px;
}

.logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 14px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.brand-name {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 17px;
  letter-spacing: 0.2px;
}

.hero { margin-bottom: 32px; }

.hero h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(34px, 6vw, 52px);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.5px;
  margin-bottom: 14px;
}

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

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}

label {
  display: block;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 10px;
}

label .optional {
  font-weight: 400;
  color: var(--muted);
  font-size: 12px;
}

#notes {
  margin-bottom: 18px;
}

textarea {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  padding: 14px 16px;
  resize: vertical;
  min-height: 84px;
  outline: none;
  transition: border-color 0.15s;
}

textarea:focus { border-color: var(--accent); }

textarea::placeholder { color: #5d5d75; }

.examples {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 18px;
  font-size: 13px;
  color: var(--muted);
}

.chip {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.chip:hover { border-color: var(--accent); background: #23232f; }

.mode-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0 4px;
  flex-wrap: wrap;
}

.mode-picker {
  display: flex;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.mode-option {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 6px;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.mode-name { font-size: 14px; font-weight: 600; color: var(--text); }
.mode-desc { font-size: 11px; color: var(--muted); }

.mode-option.selected {
  border-color: var(--accent);
  background: rgba(124, 92, 255, 0.12);
  box-shadow: 0 0 0 1px var(--accent) inset;
}

.mode-badge {
  display: inline-block;
  font-size: 11px;
  color: var(--accent-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 8px;
  white-space: nowrap;
}

.lang-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0 4px;
}

.lang-label { font-size: 13px; color: var(--muted); }

.lang-toggle {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}

.lang-option {
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 16px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.lang-option.selected {
  background: var(--accent);
  color: #fff;
}

.primary {
  width: 100%;
  border: none;
  border-radius: 12px;
  padding: 15px;
  font-size: 16px;
  font-weight: 600;
  font-family: 'Space Grotesk', sans-serif;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(135deg, var(--accent), #5a3ee0);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: transform 0.1s, opacity 0.15s;
}

.primary:hover:not(:disabled) { transform: translateY(-1px); }
.primary:disabled { opacity: 0.7; cursor: default; }

.btn-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.result { min-height: 220px; display: grid; place-items: center; text-align: center; }

.result[hidden] { display: none; }

.empty-icon { font-size: 40px; margin-bottom: 12px; }

.result-empty p, .result-soon p { color: var(--muted); }
.result-soon p strong { color: var(--text); }
.muted { font-size: 14px; margin-top: 6px; }

.spinner {
  width: 44px;
  height: 44px;
  margin: 0 auto 16px;
  border: 3px solid var(--border);
  border-top-color: var(--accent-2);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

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

.result-loading p { color: var(--muted); }

video {
  width: 100%;
  border-radius: 12px;
  background: #000;
  max-height: 380px;
}

.video-topic {
  margin-top: 12px;
  color: var(--muted);
  font-size: 14px;
}

.download-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding: 12px 22px;
  border-radius: 12px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  text-decoration: none;
  background: linear-gradient(135deg, var(--accent-2), #0090c8);
  transition: transform 0.1s, opacity 0.15s;
}

.download-btn:hover { transform: translateY(-1px); }

footer {
  text-align: center;
  color: #5d5d75;
  font-size: 13px;
  margin-top: 40px;
}

/* ---- My videos history ---- */
.history[hidden] { display: none; }

.history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.history-head h2 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.2px;
}

.refresh-btn {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 10px;
  width: 34px;
  height: 34px;
  font-size: 16px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  line-height: 1;
}

.refresh-btn:hover { color: var(--text); border-color: var(--accent); }
.refresh-btn.spinning { animation: spin 0.9s linear infinite; }

.history-list { display: flex; flex-direction: column; }

.history-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  padding: 14px 4px;
  color: var(--text);
  font-family: 'Inter', sans-serif;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
}

.history-item:last-child { border-bottom: none; }
.history-item:hover { background: rgba(124, 92, 255, 0.06); }

.history-play {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 13px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

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

.history-title {
  display: block;
  max-width: 100%;
  font-weight: 600;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-sub {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 3px;
  font-size: 12.5px;
  color: var(--muted);
}

.lang-badge {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 9px;
  font-size: 11.5px;
  color: var(--muted);
}

.status-chip {
  border-radius: 999px;
  padding: 1px 9px;
  font-size: 11.5px;
  font-weight: 600;
}

.status-ready { background: rgba(0, 212, 150, 0.14); color: #3ddc97; }
.status-working { background: rgba(124, 92, 255, 0.16); color: #b3a1ff; }
.status-failed { background: rgba(255, 92, 92, 0.14); color: #ff8a8a; }

.history-empty {
  color: var(--muted);
  font-size: 14px;
  text-align: center;
  padding: 18px 0 8px;
}
