:root {
  --ink: #080C14;
  --panel: #111726;
  --panel-2: #161F33;
  --panel-hover: #1C2740;
  --border: rgba(232, 236, 244, 0.09);
  --border-active: rgba(0, 242, 254, 0.4);
  --text: #F1F4F9;
  --muted: #8E9BAE;
  --cyan: #00F2FE;
  --cyan-glow: rgba(0, 242, 254, 0.25);
  --magenta: #FE2C55;
  --magenta-glow: rgba(254, 44, 85, 0.25);
  --green: #10B981;
  --red: #F87171;

  --display: 'Space Grotesk', -apple-system, sans-serif;
  --body: 'Inter', -apple-system, sans-serif;
  --mono: 'JetBrains Mono', monospace;
}

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

body {
  background: var(--ink);
  background-image:
    radial-gradient(circle at 12% 0%, rgba(0, 242, 254, 0.08), transparent 38%),
    radial-gradient(circle at 88% 100%, rgba(254, 44, 85, 0.07), transparent 42%),
    radial-gradient(circle at 50% 50%, rgba(18, 24, 38, 0.5), transparent 70%);
  color: var(--text);
  font-family: var(--body);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.mono { font-family: var(--mono); }

.deck-frame {
  max-width: 760px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

/* ---------- Topbar & Branding ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 48px;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 3px;
  background: var(--panel-2);
  padding: 5px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
}

.brand-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.brand-dot.cyan {
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan);
}
.brand-dot.magenta {
  background: var(--magenta);
  box-shadow: 0 0 8px var(--magenta);
}

.brand-name {
  font-family: var(--display);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, #FFFFFF 30%, #CFD8DC 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ---------- Hero Section ---------- */
.hero {
  text-align: center;
  margin-bottom: 36px;
}

.badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 14px;
  border-radius: 999px;
  background: rgba(0, 242, 254, 0.08);
  border: 1px solid rgba(0, 242, 254, 0.25);
  font-size: 12px;
  font-weight: 600;
  color: var(--cyan);
  margin-bottom: 20px;
  letter-spacing: 0.02em;
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cyan);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

.hero h1 {
  font-family: var(--display);
  font-size: clamp(28px, 5.5vw, 42px);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin-bottom: 14px;
}

.gradient-text {
  background: linear-gradient(135deg, #00F2FE 0%, #4FACFE 50%, #FE2C55 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero .sub {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
  max-width: 520px;
  margin: 0 auto 30px;
}

/* ---------- URL Input Slot ---------- */
.url-slot {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 6px 6px 6px 14px;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  transition: border-color 0.2s, box-shadow 0.2s;
  max-width: 680px;
  margin: 0 auto;
}

.url-slot:focus-within {
  border-color: var(--border-active);
  box-shadow: 0 0 0 3px rgba(0, 242, 254, 0.15), 0 8px 32px rgba(0, 0, 0, 0.4);
}

.input-wrap {
  display: flex;
  align-items: center;
  flex: 1;
  gap: 10px;
  min-width: 0;
}

.input-icon {
  color: var(--muted);
  flex-shrink: 0;
}

.url-slot input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: var(--body);
  font-size: 15px;
  min-width: 0;
}

.url-slot input::placeholder {
  color: #556277;
}

.paste-btn {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--muted);
  font-family: var(--display);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.paste-btn:hover {
  background: var(--panel-hover);
  color: var(--text);
  border-color: rgba(232, 236, 244, 0.2);
}

.url-slot button[type="submit"] {
  background: linear-gradient(135deg, #00F2FE 0%, #00C6FF 100%);
  color: #060912;
  font-family: var(--display);
  font-size: 15px;
  font-weight: 700;
  border: none;
  padding: 12px 24px;
  border-radius: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 16px rgba(0, 242, 254, 0.3);
  flex-shrink: 0;
}

.url-slot button[type="submit"]:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 22px rgba(0, 242, 254, 0.45);
}

.url-slot button[type="submit"]:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(6, 9, 18, 0.25);
  border-top-color: #060912;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

.error {
  color: var(--red);
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.25);
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 14px;
  max-width: 680px;
  margin: 16px auto 0;
  text-align: left;
}

/* ---------- Result Card ---------- */
.result-card {
  background: rgba(17, 23, 38, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 24px;
  margin-bottom: 48px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.result-top {
  display: flex;
  gap: 20px;
  margin-bottom: 24px;
}

.thumb-container {
  position: relative;
  width: 140px;
  height: 180px;
  flex-shrink: 0;
  border-radius: 12px;
  overflow: hidden;
  background: var(--panel-2);
  border: 1px solid var(--border);
}

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

.duration-badge {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(6, 9, 18, 0.85);
  backdrop-filter: blur(4px);
  padding: 3px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  color: #FFF;
}

.result-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.author-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.author-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.author-name {
  font-weight: 700;
  font-size: 16px;
  color: #FFF;
}

.author-handle {
  font-size: 13px;
  color: var(--muted);
}

.cache-badge {
  background: rgba(0, 242, 254, 0.12);
  color: var(--cyan);
  border: 1px solid rgba(0, 242, 254, 0.3);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.video-caption {
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
  margin-bottom: 16px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.stats-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: auto;
  flex-wrap: wrap;
}

.stat-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 13px;
}

/* ---------- Download Action Buttons ---------- */
.download-actions {
  border-top: 1px solid var(--border);
  padding-top: 20px;
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.action-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-radius: 14px;
  text-decoration: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  border: 1px solid transparent;
}

.action-btn.primary {
  background: linear-gradient(135deg, rgba(0, 242, 254, 0.15) 0%, rgba(79, 172, 254, 0.12) 100%);
  border-color: rgba(0, 242, 254, 0.35);
  color: #FFF;
}

.action-btn.primary:hover {
  background: linear-gradient(135deg, rgba(0, 242, 254, 0.25) 0%, rgba(79, 172, 254, 0.22) 100%);
  border-color: var(--cyan);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px var(--cyan-glow);
}

.action-btn.primary .action-icon {
  background: var(--cyan);
  color: #060912;
}

.action-btn.audio {
  background: linear-gradient(135deg, rgba(254, 44, 85, 0.12) 0%, rgba(245, 87, 108, 0.1) 100%);
  border-color: rgba(254, 44, 85, 0.3);
  color: #FFF;
}

.action-btn.audio:hover {
  background: linear-gradient(135deg, rgba(254, 44, 85, 0.22) 0%, rgba(245, 87, 108, 0.18) 100%);
  border-color: var(--magenta);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px var(--magenta-glow);
}

.action-btn.audio .action-icon {
  background: var(--magenta);
  color: #FFF;
}

.action-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.action-content {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.action-title {
  font-family: var(--display);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
}

.action-meta {
  font-size: 12px;
  color: var(--muted);
}

/* Secondary format pills */
.more-options summary {
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  padding: 8px 0;
  user-select: none;
}

.more-options summary:hover {
  color: var(--text);
}

.format-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.format-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
  transition: all 0.15s ease;
}

.format-pill:hover {
  background: var(--panel-hover);
  border-color: rgba(232, 236, 244, 0.2);
  color: #FFF;
}

.format-pill .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cyan);
}

.format-pill .size {
  color: var(--muted);
  font-size: 12px;
}

/* ---------- Feature Cards ---------- */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 48px;
}

.feature-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px;
  transition: all 0.2s ease;
}

.feature-card:hover {
  background: var(--panel-2);
  border-color: rgba(232, 236, 244, 0.18);
  transform: translateY(-2px);
}

.feature-icon {
  font-size: 24px;
  margin-bottom: 12px;
}

.feature-card h3 {
  font-family: var(--display);
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 6px;
  color: #FFF;
}

.feature-card p {
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}

/* ---------- Footnote ---------- */
.footnote {
  text-align: center;
  border-top: 1px solid var(--border);
  padding-top: 24px;
  color: #6C7A8E;
  font-size: 12px;
  line-height: 1.6;
}

.brand-footer {
  color: var(--muted);
  margin-bottom: 6px;
}

.footnote a {
  color: var(--cyan);
  text-decoration: none;
}

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

/* Responsive adjustments */
@media (max-width: 640px) {
  .deck-frame { padding: 16px 14px 40px; }
  .topbar { margin-bottom: 32px; justify-content: center; }
  .result-top { flex-direction: column; align-items: center; text-align: center; }
  .thumb-container { width: 160px; height: 210px; }
  .author-row { justify-content: center; }
  .stats-row { justify-content: center; }
  .url-slot { flex-direction: column; padding: 10px; border-radius: 16px; }
  .input-wrap { width: 100%; }
  .url-slot button[type="submit"] { width: 100%; }
}
