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

:root {
  --bg: #000000;
  --surface: rgba(18, 18, 18, 0.65);
  --surface2: rgba(26, 26, 26, 0.7);
  --border: rgba(45, 45, 45, 0.6);
  --accent: #ffffff;
  --accent2: #a3a3a3;
  --accent-glow: rgba(255, 255, 255, 0.05);
  --green: #10b981;
  --text: #ffffff;
  --muted: #888888;
  --radius: 20px;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  background-color: #000000;
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: hidden;
}


.decorations {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
}

.decor-block-left {
  position: absolute;
  top: 10%;
  left: -12vw;
  height: 80vh;
  mix-blend-mode: screen;
  opacity: 0.85;
  z-index: 0;
  animation: float-left 8s ease-in-out infinite alternate;
}

.decor-block-right {
  position: absolute;
  top: 10%;
  right: -12vw;
  height: 80vh;
  mix-blend-mode: screen;
  opacity: 0.85;
  transform: scaleX(-1);
  z-index: 0;
  animation: float-right 9s ease-in-out infinite alternate;
}

@keyframes float-left {
  0% {
    transform: translateY(0) rotate(0deg);
  }

  100% {
    transform: translateY(-20px) rotate(2deg);
  }
}

@keyframes float-right {
  0% {
    transform: scaleX(-1) translateY(0) rotate(0deg);
  }

  100% {
    transform: scaleX(-1) translateY(-20px) rotate(-2deg);
  }
}

.decor {
  position: absolute;
  z-index: 5;
  filter: drop-shadow(0 20px 40px rgba(0, 0, 0, 0.7));
  will-change: transform, opacity;
  animation-duration: 1.2s;
  animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1.275);
  animation-fill-mode: forwards;
  opacity: 0;
}

.decor-1 {
  bottom: -10px;
  left: 2%;
  max-width: 180px;
  animation-name: popDecor1;
  animation-delay: 0.1s;
}

@keyframes popDecor1 {
  0% { transform: translate(-300px, 300px) rotate(-30deg) scale(0.6); opacity: 0; }
  100% { transform: translate(0, 0) rotate(8deg) scale(1); opacity: 1; }
}

.decor-2 {
  top: 3%;
  right: 1%;
  max-width: 220px;
  animation-name: popDecor2;
  animation-delay: 0.3s;
}

@keyframes popDecor2 {
  0% { transform: translate(300px, -300px) rotate(45deg) scale(0.6); opacity: 0; }
  100% { transform: translate(0, 0) rotate(-6deg) scale(1.05); opacity: 1; }
}

.decor-3 {
  top: 40%;
  left: -25px;
  max-width: 160px;
  animation-name: popDecor3;
  animation-delay: 0.5s;
}

@keyframes popDecor3 {
  0% { transform: translate(-300px, 0) rotate(-45deg) scale(0.5); opacity: 0; }
  100% { transform: translate(0, 0) rotate(14deg) scale(1.1); opacity: 1; }
}

.decor-4 {
  bottom: 50px;
  right: 4%;
  max-width: 240px;
  animation-name: popDecor4;
  animation-delay: 0.7s;
}

@keyframes popDecor4 {
  0% { transform: translate(300px, 300px) rotate(25deg) scale(0.6); opacity: 0; }
  100% { transform: translate(0, 0) rotate(-3deg) scale(0.95); opacity: 1; }
}

.decor-5 {
  top: 8%;
  left: 8%;
  max-width: 150px;
  animation-name: popDecor5;
  animation-delay: 0.9s;
}

@keyframes popDecor5 {
  0% { transform: translate(-200px, -300px) rotate(-25deg) scale(0.5); opacity: 0; }
  100% { transform: translate(0, 0) rotate(-18deg) scale(1); opacity: 1; }
}

@media (max-width: 1100px) {
  .decorations {
    opacity: 0.2;
  }

  /* Keep them but faded on mobile */
}

/* Layout */
.hero,
.container {
  position: relative;
  z-index: 10;
}

.hero {
  width: 100%;
  padding: 120px 20px 60px;
  text-align: center;
}

.hero h1 {
  font-size: clamp(2.5rem, 6vw, 4.8rem);
  font-weight: 800;
  letter-spacing: -0.05em;
  color: #ffffff;
  line-height: 1.1;
  margin-bottom: 24px;
}

.hero p {
  color: var(--muted);
  font-size: 1.1rem;
  max-width: 540px;
  margin: 0 auto 50px;
  line-height: 1.6;
}

.input-wrap {
  display: flex;
  align-items: center;
  max-width: 560px;
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 100px;
  padding: 6px 6px 6px 24px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.input-wrap:focus-within {
  background: rgba(255, 255, 255, 0.5);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.3), 0 15px 45px rgba(0, 0, 0, 0.6);
  transform: translateY(-2px);
}

.input-wrap input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: 1.05rem;
  color: #000;
  font-weight: 500;
  min-width: 0;
}

.input-wrap input::placeholder {
  color: rgba(0, 0, 0, 0.6);
}

.btn-primary {
  background: #000000;
  color: #ffffff;
  border: none;
  border-radius: 100px;
  padding: 14px 32px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.btn-primary:hover {
  background: #1a1a1a;
  transform: scale(1.02);
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.download-btn:active {
  transform: scale(0.98);
}

.credit {
  margin-top: auto;
  margin-bottom: 24px;
  font-size: 0.9rem;
  color: var(--muted);
  text-align: center;
}

.credit span {
  font-weight: 700;
  color: var(--text);
}

.marquee-wrapper {
  width: 100vw;
  overflow: hidden;
  background: #000000;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 16px 0;
  /* margin-top: auto; removed */
}

.marquee-track {
  display: flex;
  gap: 40px;
  width: max-content;
  animation: scroll-marquee 25s linear infinite;
  padding: 0 20px;
}

.marquee-item {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-weight: 600;
  font-size: 1.1rem;
}

.marquee-item svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
  opacity: 0.85;
}

@keyframes scroll-marquee {
  0% {
    transform: translateX(0);
  }

  100% {
    transform: translateX(calc(-50% - 20px));
  }
}

.container {
  width: 100%;
  max-width: 1040px;
  padding: 0 20px 80px;
}

#state-loading {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 60px 20px;
  color: var(--muted);
  font-size: 1rem;
  font-weight: 500;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s cubic-bezier(0.5, 0, 0.5, 1) infinite;
  box-shadow: 0 0 20px var(--accent-glow);
}

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

#state-error {
  display: none;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  backdrop-filter: blur(10px);
  border-radius: 12px;
  padding: 12px 16px;
  color: #fca5a5;
  font-size: 0.9rem;
  font-weight: 500;
  margin: 36px auto 0;
  max-width: 380px;
  text-align: center;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

#state-result {
  display: none;
  margin-top: 40px;
}

.video-card {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 32px;
  background: var(--surface);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 30px;
  align-items: start;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}

@media (max-width: 768px) {
  .video-card {
    grid-template-columns: 1fr;
    padding: 20px;
  }
}

.thumb-wrap {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  background: #000;
  aspect-ratio: 16/9;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
}

.thumb-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: brightness(0.9);
  transition: filter 0.3s;
}

.thumb-wrap:hover img {
  filter: brightness(1);
}

.source-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 100px;
  letter-spacing: 0.05em;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.video-meta {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.video-title {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.4;
  color: var(--text);
}

.video-author {
  font-size: 0.9rem;
  color: var(--accent2);
  font-weight: 500;
}

.format-section {
  margin-top: 24px;
}

.format-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
}

.format-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 320px;
  overflow-y: auto;
  padding-right: 8px;
}

.format-grid::-webkit-scrollbar {
  width: 6px;
}

.format-grid::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 6px;
}

.format-grid::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

.format-option {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border: 1px solid var(--border);
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--surface2);
}

.format-option:hover {
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.05);
  transform: translateX(2px);
}

.format-option.selected {
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.format-option input[type="radio"] {
  accent-color: var(--accent);
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  cursor: pointer;
}

.format-res {
  font-weight: 800;
  font-size: 1rem;
  min-width: 65px;
  color: var(--text);
}

.format-meta {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.fmt-tag {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 100px;
  border: 1px solid;
  letter-spacing: 0.02em;
}

.tag-ext {
  color: #93c5fd;
  border-color: rgba(147, 197, 253, 0.3);
  background: rgba(147, 197, 253, 0.1);
}

.tag-size {
  color: var(--green);
  border-color: rgba(16, 185, 129, 0.3);
  background: rgba(16, 185, 129, 0.1);
}

.tag-audio {
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.3);
  background: rgba(251, 191, 36, 0.1);
}

.download-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  margin-top: 24px;
  padding: 16px;
  background: #ffffff;
  border: none;
  border-radius: 16px;
  color: #000000;
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  letter-spacing: 0.02em;
}

.download-btn:hover {
  background: #e5e5e5;
  transform: translateY(-2px);
}

.download-btn:active {
  transform: scale(0.98);
}