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

/* =========================================================
   HARDENING / BLINDAGEM GLOBAL — NÃO REMOVA ESTE BLOCO
   Evita elementos explodindo de tamanho quando styles.css
   carrega parcialmente ou há MIME type / cache conflitos.
   ========================================================= */
*, *::before, *::after { box-sizing: border-box !important; }
img, svg, video, iframe, embed, object { max-width: 100% !important; height: auto !important; display: block; }
svg { width: auto; max-height: 100%; }

/* Logo — tamanho fixo blindado */
.logo-icon {
  width: 48px !important;
  height: 48px !important;
  min-width: 48px !important;
  min-height: 48px !important;
  max-width: 48px !important;
  max-height: 48px !important;
  padding: 8px !important;
  border-radius: 14px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex: 0 0 48px !important;
  overflow: hidden !important;
  background: rgba(255,255,255,.04) !important;
  border: 1px solid rgba(255,255,255,.08) !important;
}
.logo-icon > svg,
.logo-icon > img {
  width: 100% !important;
  height: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  max-height: 100% !important;
  display: block !important;
  margin: 0 !important;
  padding: 0 !important;
  flex: none !important;
}

/* Features grid */
.feature-icon {
  width: 44px !important;
  height: 44px !important;
  min-width: 44px !important;
  min-height: 44px !important;
  max-width: 44px !important;
  max-height: 44px !important;
  padding: 10px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  overflow: hidden !important;
  border-radius: 12px !important;
}
.feature-icon > svg,
.feature-icon > img { width: 100% !important; height: 100% !important; display:block !important; }

/* Result card */
.result-author-avatar {
  width: 56px !important;
  height: 56px !important;
  min-width: 56px !important;
  min-height: 56px !important;
  max-width: 56px !important;
  max-height: 56px !important;
  border-radius: 50% !important;
  overflow: hidden !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: rgba(255,255,255,.06) !important;
  position: relative !important;
  flex: 0 0 56px !important;
}
.result-author-avatar img,
.result-author-avatar .avatar-initial {
  width: 100% !important;
  height: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  max-width: 100% !important;
  max-height: 100% !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  position: absolute !important;
  inset: 0 !important;
}
.result-media {
  width: 100% !important;
  max-width: 100% !important;
  max-height: 72vh !important;
  aspect-ratio: 1 / 1;
  overflow: hidden !important;
  border-radius: 16px !important;
  background: #000 !important;
  display: block !important;
}
.result-media img,
.result-media video {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  object-fit: contain !important;
  background: #000 !important;
  display: block !important;
}

/* Botões */
.download-btn,
.action-btn,
.clear-btn {
  max-width: 100% !important;
  overflow: hidden !important;
}
.btn-icon,
.action-btn svg,
.download-btn svg,
.clear-btn svg {
  max-width: 24px !important;
  max-height: 24px !important;
  width: 20px !important;
  height: 20px !important;
  flex: 0 0 20px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}

/* Inputs */
.input-wrapper { max-width: 100% !important; min-height: 58px !important; }
#urlInput { max-width: 100% !important; width: 100% !important; min-height: 58px !important; padding: 16px 12px !important; }

/* Mobile */
@media (max-width: 640px) {
  .logo-icon {
    width: 42px !important;
    height: 42px !important;
    min-width: 42px !important;
    min-height: 42px !important;
    max-width: 42px !important;
    max-height: 42px !important;
    flex: 0 0 42px !important;
  }
  .result-author-avatar {
    width: 48px !important;
    height: 48px !important;
    min-width: 48px !important;
    min-height: 48px !important;
    max-width: 48px !important;
    max-height: 48px !important;
    flex: 0 0 48px !important;
  }
  .feature-icon {
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    min-height: 40px !important;
    max-width: 40px !important;
    max-height: 40px !important;
  }
  .btn-icon,
  .action-btn svg,
  .download-btn svg {
    width: 18px !important;
    height: 18px !important;
    max-width: 18px !important;
    max-height: 18px !important;
    flex: 0 0 18px !important;
  }
}

/* =========================================================
   FIM DO BLOCO DE HARDENING
   ========================================================= */

:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #13131a;
  --bg-card: rgba(25, 25, 35, 0.55);
  --bg-card-hover: rgba(30, 30, 45, 0.7);
  --border-glass: rgba(255, 255, 255, 0.08);
  --border-glass-strong: rgba(255, 255, 255, 0.14);
  --text-primary: #f5f5f7;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --accent-1: #f09433;
  --accent-2: #e6683c;
  --accent-3: #dc2743;
  --accent-4: #cc2366;
  --accent-5: #bc1888;
  --success: #10b981;
  --error: #ef4444;
  --warning: #f59e0b;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --shadow-soft: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 40px rgba(220, 39, 67, 0.15);
}

html, body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.22);
}

.bg-gradient {
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: 
    radial-gradient(ellipse 60% 40% at 20% 20%, rgba(220, 39, 67, 0.12) 0%, transparent 60%),
    radial-gradient(ellipse 50% 35% at 80% 30%, rgba(204, 35, 102, 0.10) 0%, transparent 60%),
    radial-gradient(ellipse 40% 50% at 50% 80%, rgba(240, 148, 51, 0.08) 0%, transparent 60%);
  z-index: 0;
  pointer-events: none;
  animation: bgFloat 30s ease-in-out infinite;
}

@keyframes bgFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(-2%, 1%) scale(1.02); }
  66% { transform: translate(1%, -1%) scale(0.98); }
}

.bg-grid {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 50px 50px;
  z-index: 0;
  pointer-events: none;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 30%, black 30%, transparent 80%);
}

.app-container {
  position: relative;
  z-index: 1;
  max-width: 960px;
  margin: 0 auto;
  padding: 28px 20px 40px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 52px;
}

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

.logo-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-icon svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 4px 12px rgba(220, 39, 67, 0.3));
}

.logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.logo-title {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #f09433, #dc2743, #bc1888);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.logo-sub {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 3px;
}

.status-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 10px var(--success);
  animation: pulse 2s ease-in-out infinite;
}

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

.status-text {
  font-size: 12px;
  font-weight: 600;
  color: #6ee7b7;
  letter-spacing: 0.02em;
}

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.hero-section {
  text-align: center;
  margin-bottom: 40px;
}

.hero-title {
  font-size: clamp(28px, 5vw, 46px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin-bottom: 18px;
  color: var(--text-primary);
}

.gradient-text {
  background: linear-gradient(135deg, #f09433 0%, #dc2743 50%, #bc1888 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: clamp(14px, 2vw, 17px);
  color: var(--text-secondary);
  max-width: 580px;
  margin: 0 auto;
  line-height: 1.6;
}

.downloader-card {
  margin-bottom: 32px;
}

.glass-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-xl);
  padding: 32px;
  backdrop-filter: blur(24px) saturate(150%);
  -webkit-backdrop-filter: blur(24px) saturate(150%);
  box-shadow: var(--shadow-soft), var(--shadow-glow);
}

.glass-card-mini {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 24px;
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.glass-card-mini:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-glass-strong);
  transform: translateY(-3px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 24px;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  background: rgba(10, 10, 15, 0.6);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  transition: all 0.25s ease;
}

.input-wrapper:focus-within {
  border-color: rgba(220, 39, 67, 0.4);
  box-shadow: 0 0 0 4px rgba(220, 39, 67, 0.1), 0 0 20px rgba(220, 39, 67, 0.12);
  background: rgba(10, 10, 15, 0.8);
}

.input-icon {
  width: 20px;
  height: 20px;
  margin-left: 20px;
  color: var(--text-muted);
  flex-shrink: 0;
}

#urlInput {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  padding: 18px 14px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
  font-family: inherit;
  min-width: 0;
}

#urlInput::placeholder {
  color: var(--text-muted);
  font-weight: 400;
}

.clear-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin-right: 12px;
  background: rgba(255, 255, 255, 0.06);
  border: none;
  border-radius: 50%;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.clear-btn.visible {
  display: flex;
}

.clear-btn:hover {
  background: rgba(239, 68, 68, 0.15);
  color: var(--error);
}

.clear-btn svg {
  width: 14px;
  height: 14px;
}

.download-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 18px 28px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
  background-size: 200% 200%;
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 20px rgba(220, 39, 67, 0.35);
  overflow: hidden;
  letter-spacing: 0.01em;
}

.download-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 8px 32px rgba(220, 39, 67, 0.45);
  background-position: 100% 100%;
}

.download-btn:active:not(:disabled) {
  transform: translateY(0);
}

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

.download-btn.loading .btn-text,
.download-btn.loading .btn-icon {
  opacity: 0;
}

.btn-icon svg {
  width: 18px;
  height: 18px;
  stroke-width: 2.5;
}

.btn-loader {
  position: absolute;
  width: 22px;
  height: 22px;
  border: 2.5px solid rgba(255, 255, 255, 0.25);
  border-top-color: #fff;
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.2s;
  animation: spin 0.8s linear infinite;
}

.download-btn.loading .btn-loader {
  opacity: 1;
}

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

.examples {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.examples-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.examples-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  padding: 5px 12px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-glass);
  border-radius: 999px;
  letter-spacing: 0.02em;
}

.features-section {
  margin-top: 48px;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
}

.feature-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
}

.feature-icon svg {
  width: 22px;
  height: 22px;
}

.icon-1 {
  background: linear-gradient(135deg, rgba(240, 148, 51, 0.18), rgba(230, 104, 60, 0.12));
  color: #f59e0b;
}

.icon-2 {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.18), rgba(5, 150, 105, 0.12));
  color: #10b981;
}

.icon-3 {
  background: linear-gradient(135deg, rgba(204, 35, 102, 0.18), rgba(188, 24, 136, 0.12));
  color: #ec4899;
}

.feature-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}

.feature-desc {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.result-card {
  margin-bottom: 32px;
  animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.result-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-glass);
}

.result-author-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f09433, #dc2743, #bc1888);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  flex-shrink: 0;
  overflow: hidden;
}

.result-author-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.result-author-info {
  flex: 1;
  min-width: 0;
}

.result-author-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.result-author-username {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.result-type-badge {
  padding: 6px 14px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-radius: 999px;
  flex-shrink: 0;
}

.result-type-badge.video {
  background: rgba(220, 39, 67, 0.12);
  color: #fb7185;
  border: 1px solid rgba(220, 39, 67, 0.25);
}

.result-type-badge.image {
  background: rgba(59, 130, 246, 0.12);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.25);
}

.result-media {
  position: relative;
  width: 100%;
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 24px;
  background: #000;
  aspect-ratio: 1 / 1;
  max-height: 480px;
}

.result-media.video-preview {
  aspect-ratio: 9 / 16;
  max-width: 320px;
  margin-left: auto;
  margin-right: auto;
}

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

.result-caption {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 24px;
  padding: 16px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: var(--radius-md);
  max-height: 120px;
  overflow-y: auto;
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.action-btn {
  flex: 1;
  min-width: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 22px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.25s ease;
  border: 1px solid transparent;
  letter-spacing: 0.01em;
}

.action-btn.primary {
  color: #fff;
  background: linear-gradient(135deg, #10b981, #059669);
  box-shadow: 0 4px 18px rgba(16, 185, 129, 0.3);
}

.action-btn.primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(16, 185, 129, 0.4);
}

.action-btn.secondary {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border-glass-strong);
}

.action-btn.secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.08);
  transform: translateY(-1px);
}

.action-btn svg {
  width: 16px;
  height: 16px;
  stroke-width: 2.5;
}

.action-btn:disabled {
  cursor: not-allowed;
  opacity: 0.6;
  transform: none !important;
}

.btn-downloading {
  position: relative;
}

.btn-downloading span:not(.btn-loader) {
  opacity: 0;
}

.error-card {
  margin-bottom: 32px;
  animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.error-content {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.error-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--error);
  flex-shrink: 0;
}

.error-icon svg {
  width: 22px;
  height: 22px;
  stroke-width: 2.5;
}

.error-info {
  flex: 1;
}

.error-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.error-message {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: rgba(20, 20, 28, 0.95);
  border: 1px solid var(--border-glass-strong);
  border-radius: var(--radius-md);
  backdrop-filter: blur(20px);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  min-width: 280px;
  max-width: 400px;
  animation: toastIn 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: auto;
}

.toast.leave {
  animation: toastOut 0.3s ease forwards;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(40px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes toastOut {
  to {
    opacity: 0;
    transform: translateX(40px);
  }
}

.toast-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.toast-icon svg {
  width: 14px;
  height: 14px;
  stroke-width: 3;
  color: #fff;
}

.toast.success .toast-icon {
  background: var(--success);
}

.toast.error .toast-icon {
  background: var(--error);
}

.toast.info .toast-icon {
  background: #3b82f6;
}

.toast-body {
  flex: 1;
}

.toast-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.toast-msg {
  font-size: 12px;
  color: var(--text-secondary);
}

.footer {
  margin-top: 56px;
  text-align: center;
}

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

@media (min-width: 640px) {
  .input-group {
    flex-direction: row;
    align-items: stretch;
  }
  .input-wrapper {
    flex: 1;
  }
  .download-btn {
    flex-shrink: 0;
    padding: 0 32px;
  }
}

@media (max-width: 640px) {
  .app-container {
    padding: 20px 16px 32px;
  }
  .header {
    margin-bottom: 36px;
  }
  .logo-icon {
    width: 42px;
    height: 42px;
  }
  .logo-title {
    font-size: 18px;
  }
  .glass-card {
    padding: 22px;
    border-radius: var(--radius-lg);
  }
  .hero-section {
    margin-bottom: 30px;
  }
  .features-section {
    margin-top: 36px;
  }
  .toast-container {
    top: 16px;
    left: 16px;
    right: 16px;
  }
  .toast {
    min-width: 0;
    max-width: none;
  }
}
