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

:root {
  --bg: #0a0a0f;
  --surface: #13131a;
  --surface2: #1e1e2a;
  --surface3: #252535;
  --border: #2a2a3a;
  --accent: #7c6af5;
  --accent2: #9d8df7;
  --accent-glow: rgba(124, 106, 245, 0.3);
  --text: #f0f0f5;
  --text-muted: #8888aa;
  --text-dim: #555570;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 8px 32px rgba(0,0,0,0.4);
}

html { scroll-behavior: smooth; }

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

.page {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 16px 60px;
}

/* ── HERO ── */
.hero {
  text-align: center;
  padding: 60px 0 40px;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.logo-icon { font-size: 36px; }

.logo-text {
  font-size: 32px;
  font-weight: 800;
  background: linear-gradient(135deg, #7c6af5 0%, #c084fc 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
}

.tagline {
  color: var(--text-muted);
  font-size: 15px;
  margin-bottom: 20px;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}

/* Platform badges */
.platforms {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-bottom: 32px;
}

.badge {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid;
}
.badge.tiktok    { color: #69c9d0; border-color: #69c9d030; background: #69c9d010; }
.badge.instagram { color: #f77737; border-color: #f7773730; background: #f7773710; }
.badge.youtube   { color: #ff0000; border-color: #ff000030; background: #ff000010; }
.badge.facebook  { color: #4a90d9; border-color: #4a90d930; background: #4a90d910; }
.badge.threads   { color: #aaa; border-color: #aaa3; background: #aaa1; }

/* ── SEARCH FORM ── */
.search-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: stretch;
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.url-input {
  width: 100%;
  padding: 16px 52px 16px 20px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.url-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.url-input::placeholder { color: var(--text-dim); }

.paste-btn {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  transition: color 0.2s, background 0.2s;
}
.paste-btn:hover { color: var(--accent2); background: var(--surface2); }

.search-btn {
  padding: 15px 32px;
  background: linear-gradient(135deg, #7c6af5, #a78bfa);
  border: none;
  border-radius: var(--radius);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: opacity 0.2s, transform 0.1s;
  min-height: 52px;
}
.search-btn:hover { opacity: 0.9; }
.search-btn:active { transform: scale(0.98); }
.search-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.spin {
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (min-width: 540px) {
  .search-form { flex-direction: row; }
  .search-btn { flex-shrink: 0; }
}

/* ── ERROR ── */
.error-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #2a1515;
  border: 1px solid #5a2020;
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  color: #ff8080;
  margin-top: 20px;
  font-size: 14px;
}

.error-close {
  margin-left: auto;
  background: none;
  border: none;
  color: #ff8080;
  cursor: pointer;
  font-size: 14px;
  padding: 2px 6px;
  border-radius: 4px;
  opacity: 0.7;
  flex-shrink: 0;
}
.error-close:hover { opacity: 1; background: #3a1515; }

/* ── RESULT CARD ── */
.result-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-top: 28px;
  box-shadow: var(--shadow);
  animation: fadeUp 0.3s ease;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.card-inner {
  display: flex;
  flex-direction: column;
  gap: 0;
}

@media (min-width: 540px) {
  .card-inner { flex-direction: row; }
}

/* Thumbnail */
.thumb-wrap {
  position: relative;
  flex-shrink: 0;
  width: 100%;
  aspect-ratio: 16/9;
  overflow: hidden;
  background: var(--surface2);
}

@media (min-width: 540px) {
  .thumb-wrap {
    width: 240px;
    aspect-ratio: auto;
    height: auto;
    min-height: 160px;
  }
}

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

.platform-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(4px);
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
}

.duration-badge {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: rgba(0,0,0,0.8);
  color: #fff;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
}

/* Card info */
.card-info {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
  min-width: 0;
}

.video-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.video-uploader {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: -8px;
}

.format-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.format-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.format-select {
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  padding: 10px 14px;
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s;
}
.format-select:focus { border-color: var(--accent); }

.download-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 20px;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  border: none;
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
  min-height: 48px;
}
.download-btn:hover { opacity: 0.9; }
.download-btn:active { transform: scale(0.98); }
.download-btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* Progress */
.progress-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.progress-bar {
  height: 6px;
  background: var(--surface3);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 30%;
  background: linear-gradient(90deg, var(--accent), #c084fc);
  border-radius: 3px;
  animation: indeterminate 1.4s ease-in-out infinite;
}

@keyframes indeterminate {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(400%); }
}

.progress-text {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}

/* ── HOW IT WORKS ── */
.how-section {
  margin-top: 60px;
  text-align: center;
}

.how-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 28px;
  color: var(--text-muted);
}

.steps {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

@media (min-width: 540px) {
  .steps {
    flex-direction: row;
    justify-content: center;
  }
}

.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  max-width: 180px;
}

.step p {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
}

.step-num {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--surface2);
  border: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  color: var(--accent2);
}

.step-arrow {
  color: var(--text-dim);
  font-size: 20px;
}

/* ── FOOTER ── */
.footer {
  margin-top: 60px;
  text-align: center;
  color: var(--text-dim);
  font-size: 12px;
}
