:root {
  --bg0: #f6f7fb;
  --bg1: #e9ecf5;
  --surface: rgba(255, 255, 255, 0.72);
  --surface-strong: rgba(255, 255, 255, 0.9);
  --stroke: rgba(17, 24, 39, 0.1);
  --stroke-strong: rgba(17, 24, 39, 0.14);
  --text: #0b1220;
  --muted: rgba(17, 24, 39, 0.7);
  --muted2: rgba(17, 24, 39, 0.52);
  --shadow: 0 18px 60px rgba(15, 23, 42, 0.14);
  --shadow2: 0 10px 26px rgba(15, 23, 42, 0.12);
  --radius-xl: 18px;
  --radius-lg: 14px;
  --radius-md: 12px;
  --radius-sm: 10px;
  --primary: #3b82f6;
  --accent: #a855f7;
  --primary-soft: rgba(59, 130, 246, 0.16);
  --accent-soft: rgba(168, 85, 247, 0.14);
}

/* Global safe box model + prevent page-level horizontal scroll */
*, *::before, *::after {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  overflow-x: hidden;
}

body {
  font-family: "Inter", sans-serif;
  background: radial-gradient(900px 560px at 15% -10%, var(--accent-soft), transparent 55%),
    radial-gradient(800px 520px at 90% 0%, var(--primary-soft), transparent 60%),
    linear-gradient(135deg, var(--bg0) 0%, var(--bg1) 100%);
  margin: 0;
  padding: 0;
  min-height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  color: var(--text);
}

/* SEO content blocks (lightweight, CWV-friendly) */
.seo-section {
  max-width: 980px;
  margin: 1.8rem auto 0;
  padding: 1.2rem 1.25rem;
  border-radius: 14px;
  border: 1px solid rgba(17, 24, 39, 0.08);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.08);
  text-align: left;
}
.seo-section h2 {
  margin: 0.2rem 0 0.7rem;
  font-size: 1.15rem;
  font-weight: 800;
  color: rgba(17, 24, 39, 0.92);
}
.seo-section h3 {
  margin: 0 0 0.4rem;
  font-size: 1rem;
  font-weight: 800;
  color: rgba(17, 24, 39, 0.9);
}
.seo-lead {
  margin: 0 0 1rem;
  color: rgba(17, 24, 39, 0.74);
  line-height: 1.55;
}
.seo-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
  margin: 0.6rem 0 1.2rem;
}
.seo-card {
  padding: 0.9rem 0.95rem;
  border-radius: 14px;
  border: 1px solid rgba(17, 24, 39, 0.08);
  background: rgba(255, 255, 255, 0.82);
}
.seo-card p {
  margin: 0 0 0.65rem;
  color: rgba(17, 24, 39, 0.72);
  line-height: 1.5;
}
.seo-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: center;
}
.seo-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 0.75rem;
  border-radius: 999px;
  border: 1px solid rgba(17, 24, 39, 0.12);
  background: rgba(255, 255, 255, 0.9);
  color: rgba(17, 24, 39, 0.88);
  text-decoration: none;
  font-weight: 750;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.07);
}
.seo-link:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.1);
}
.seo-faq details {
  border: 1px solid rgba(17, 24, 39, 0.08);
  background: rgba(255, 255, 255, 0.84);
  border-radius: 14px;
  padding: 0.7rem 0.85rem;
  margin: 0.55rem 0;
}
.seo-faq summary {
  cursor: pointer;
  font-weight: 800;
  color: rgba(17, 24, 39, 0.9);
}
.seo-faq p {
  margin: 0.6rem 0 0;
  color: rgba(17, 24, 39, 0.72);
  line-height: 1.55;
}

@media (max-width: 900px) {
  .seo-grid { grid-template-columns: 1fr; }
}
.main-container {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
}

.container {
  text-align: center;
  padding: 2rem;
  margin-top: 0rem;
  position: relative; /* Untuk overlay */
}

img,
video,
canvas,
svg {
  max-width: 100%;
}
h1 {
  color: var(--text);
  font-size: 1.9rem;
  font-weight: 700;
  margin-bottom: 2rem;
  letter-spacing: 0.3px;
  animation: fadeIn 1s ease-in;
  text-shadow: 0 10px 35px rgba(15, 23, 42, 0.12);
}
.hero-subtitle {
  margin: -0.85rem auto 0.85rem;
  max-width: 820px;
  color: rgba(17, 24, 39, 0.72);
  line-height: 1.55;
  font-weight: 550;
}
.platform-indicators {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.55rem;
  margin-bottom: 1.15rem;
}
.platform-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.38rem 0.6rem;
  border-radius: 999px;
  border: 1px solid rgba(17, 24, 39, 0.12);
  background: rgba(255, 255, 255, 0.75);
  color: rgba(17, 24, 39, 0.8);
  font-weight: 750;
  font-size: 0.88rem;
  transition: transform 0.2s ease-out, box-shadow 0.2s ease-out, background 0.2s ease-out;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.06);
  user-select: none;
}
.platform-pill i {
  font-size: 0.95rem;
  transition: transform 0.2s ease-out, opacity 0.2s ease-out;
}
.platform-pill:hover {
  transform: translateY(-1px) scale(1.03);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.1);
}
.platform-pill:hover i {
  transform: scale(1.07);
}
.platform-pill[data-platform="tiktok"] i {
  color: #ff0050;
  text-shadow: -1px 0 rgba(0, 242, 234, 0.35);
}
.platform-pill[data-platform="instagram"] i {
  background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
.platform-pill[data-platform="youtube"] i {
  color: #ff0000;
}

.universal-form {
  margin: 0.2rem auto 0;
  width: 100%;
  max-width: 720px;
  align-items: center;
  gap: 0.75rem;
}
.universal-form .universal-input-wrapper {
  transform: none;
  width: 100%;
  margin: 0 auto;
}
.universal-form .downloader-button {
  width: auto;
  min-width: 200px;
  max-width: 320px;
  margin: 0.25rem auto 0;
  justify-content: center;
  padding: 0.82rem 1.6rem;
}
.input-hint {
  max-width: 720px;
  width: 100%;
  text-align: left;
  margin-top: -0.15rem;
  color: rgba(17, 24, 39, 0.66);
  font-size: 0.88rem;
  min-height: 1.2em;
}
.input-hint .hint-platform {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  border: 1px solid rgba(17, 24, 39, 0.12);
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.06);
  transition: transform 0.2s ease-out, box-shadow 0.2s ease-out;
}
.input-hint .hint-platform i {
  font-size: 1rem;
}
.input-hint .hint-platform:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.1);
}
.input-hint .hint-platform[data-platform="tiktok"] i {
  color: #ff0050;
  text-shadow: -1px 0 rgba(0, 242, 234, 0.35);
}
.input-hint .hint-platform[data-platform="instagram"] i {
  background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
.input-hint .hint-platform[data-platform="youtube"] i {
  color: #ff0000;
}
.input-hint.is-error {
  color: rgba(220, 38, 38, 0.9);
}
.input-hint.is-ok {
  color: rgba(16, 185, 129, 0.9);
}

/* Modern FAQ accordion (premium, non-default look) */
.seo-faq details {
  position: relative;
  overflow: hidden;
  padding: 0;
  border-radius: 16px;
  border: 1px solid rgba(17, 24, 39, 0.08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(255, 255, 255, 0.72));
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.06);
  transition: transform 0.22s ease-out, box-shadow 0.22s ease-out, border-color 0.22s ease-out;
}
.seo-faq details::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: linear-gradient(180deg, var(--primary), var(--accent));
  opacity: 0;
  transition: opacity 0.22s ease-out;
}
.seo-faq details:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 34px rgba(15, 23, 42, 0.1);
  border-color: rgba(17, 24, 39, 0.12);
}
.seo-faq details[open]::before {
  opacity: 1;
}
.seo-faq details[open] {
  box-shadow: 0 18px 46px rgba(15, 23, 42, 0.12);
}
.seo-faq summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  font-weight: 850;
  color: rgba(17, 24, 39, 0.92);
}
.seo-faq summary::-webkit-details-marker {
  display: none;
}
.seo-faq summary::after {
  content: "\f078";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  color: rgba(17, 24, 39, 0.55);
  transition: transform 0.22s ease-out, color 0.22s ease-out, opacity 0.22s ease-out;
}
.seo-faq details[open] summary::after {
  transform: rotate(180deg);
  color: rgba(17, 24, 39, 0.78);
}
.seo-faq summary:focus-visible {
  outline: none;
}
.seo-faq details:focus-within {
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.14), 0 18px 46px rgba(15, 23, 42, 0.12);
}

/* Smooth expand using grid rows (no jumpy max-height) */
.seo-faq .faq-content {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transform: translateY(-2px);
  transition: grid-template-rows 0.25s ease-out, opacity 0.22s ease-out, transform 0.22s ease-out;
  padding: 0 1rem;
}
.seo-faq .faq-content > * {
  overflow: hidden;
}
.seo-faq details[open] .faq-content {
  grid-template-rows: 1fr;
  opacity: 1;
  transform: translateY(0);
  padding-bottom: 1rem;
}
.seo-faq .faq-content p {
  margin: 0.15rem 0 0;
  color: rgba(17, 24, 39, 0.72);
  line-height: 1.6;
}
.downloader-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.8rem;
}
.downloader-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.65));
  border-radius: 12px;
  border: 1px solid rgba(17, 24, 39, 0.08);
  box-shadow: var(--shadow2);
  padding: 0.4rem;
  width: 70px;
  text-align: center;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease,
    border-color 0.18s ease;
  pointer-events: auto;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
}
.downloader-card:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 16px 42px rgba(15, 23, 42, 0.16);
  border-color: rgba(17, 24, 39, 0.12);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.72));
}
.downloader-card i {
  font-size: 1.3rem;
  color: #2563eb;
  transition: transform 0.18s ease, color 0.18s ease;
}
.downloader-card:hover i {
  color: #1e40af;
  transform: rotate(10deg);
}
.downloader-card h3 {
  margin: 0;
  color: rgba(17, 24, 39, 0.9);
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1.3;
  transition: color 0.18s ease;
}
.downloader-card:hover h3 {
  color: #111827;
}
.downloader-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 0, 0.3),
    transparent
  );
  transition: left 0.4s ease;
}
.downloader-card:hover::before {
  left: 100%;
}
.downloader-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  max-width: 400px;
  margin: 0 auto;
}
.downloader-input {
  width: 100%;
  padding: 0.9rem 1rem;
  border: 1px solid var(--stroke);
  border-radius: 8px;
  font-size: 1rem;
  font-family: "Inter", sans-serif;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
  background: rgba(255, 255, 255, 0.75);
}
.downloader-input:focus {
  border-color: rgba(37, 99, 235, 0.35);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.14);
  background: rgba(255, 255, 255, 0.9);
}
.downloader-button {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #ffffff;
  padding: 0.8rem 1.5rem;
  border: none;
  border-radius: 25px;
  font-size: 1rem;
  font-weight: 650;
  font-family: "Inter", sans-serif;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
  position: relative;
  box-shadow: 0 14px 34px rgba(59, 130, 246, 0.14);
}
.downloader-button.tiktok {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  box-shadow: 0 14px 34px rgba(59, 130, 246, 0.14);
}
.downloader-button.youtube {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  box-shadow: 0 14px 34px rgba(59, 130, 246, 0.14);
}
.downloader-button:hover:not(:disabled) {
  transform: translateY(-1px) scale(1.02);
  filter: brightness(1.03);
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.18);
}
.downloader-button:disabled {
  background: #9ca3af;
  cursor: not-allowed;
}
.downloader-button i {
  font-size: 1rem;
}
.button-spinner {
  animation: spin 1s linear infinite;
}
.download-result {
  margin-top: 1.5rem;
  text-align: center;
}
.result-content {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.75));
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: var(--shadow);
  border: 1px solid rgba(17, 24, 39, 0.09);
  animation: slideIn 0.5s ease-out;
  display: inline-block; /* Lebar menyesuaikan konten */
  width: auto; /* Lebar otomatis berdasarkan konten */
  max-width: 90%; /* Batas maksimum lebar */
  margin: 0 auto;
}
.result-content.single-item {
  max-width: 300px; /* Lebar lebih kecil untuk satu item */
}
.result-content p {
  margin: 0.5rem 0;
  color: #1f2937;
}
.result-content a {
  color: #ffffff;
  text-decoration: none;
  font-weight: 500;
}
.result-content a:hover {
  text-decoration: none;
}
.error {
  color: #ef4444;
  font-weight: 500;
}
.loading {
  color: #2563eb;
  font-weight: 500;
}
.background-icons {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: -1;
  overflow: hidden;
}
.background-icons i {
  position: absolute;
  font-size: 1.5rem;
  color: rgba(59, 130, 246, 0.25);
  transition: all ease-in-out;
  opacity: 0.4;
}
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Media Query untuk Mobile (<= 600px) */
@media (max-width: 600px) {
  h1 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
  }
  .downloader-list {
    gap: 0.5rem;
  }
  .downloader-card {
    width: 60px;
    padding: 0.3rem;
    gap: 0.3rem;
  }
  .downloader-card i {
    font-size: 1.2rem;
  }
  .downloader-card h3 {
    font-size: 0.65rem;
  }
  .downloader-form {
    gap: 0.8rem;
  }
  .downloader-input {
    padding: 0.6rem;
    font-size: 0.9rem;
  }
  .downloader-button {
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
  }
  .downloader-button i {
    font-size: 0.9rem;
  }
  .download-result {
    margin-top: 1rem;
  }
  .result-content {
    padding: 1rem;
  }
  .result-content.single-item {
    max-width: 250px;
  }
  .result-content p {
    font-size: 0.9rem;
  }
}

/* Header Section */
.header-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
}

.instagram-icon {
  font-size: 2.5rem;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: bounce 1s ease-in-out infinite;
}

.tiktok-icon {
  font-size: 2.5rem;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: bounce 1s ease-in-out infinite;
}

.youtube-icon {
  font-size: 2.5rem;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: bounce 1s ease-in-out infinite;
}

/* Input Wrapper */
.input-wrapper {
  position: relative;
  width: 100%;
  max-width: 100%;
  transform: none;
}

.input-icon {
  position: absolute;
  top: 50%;
  left: 1rem;
  transform: translateY(-50%);
  color: #9ca3af;
  font-size: 1rem;
}

.downloader-input {
  padding-left: 3rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  border: none;
  background: #ffffff;
}

.downloader-input:focus {
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Button Styling */
.downloader-button {
  padding: 0.8rem 2rem;
  border-radius: 25px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.downloader-button:hover:not(:disabled) {
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

/* Result Content */
.result-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding-bottom: 0.5rem;
  margin-bottom: 0.5rem; /* Kurangi margin untuk memberi ruang pada judul */
  border-bottom: none;
}

.success-icon {
  font-size: 1.5rem;
  color: #22c55e;
}

.success-text {
  font-size: 1.1rem;
  font-weight: 600;
  color: #1f2937;
  background: linear-gradient(90deg, #22c55e, #16a34a);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.animate-success {
  animation: pop 0.5s ease-out;
}

.video-title {
  font-size: 1rem;
  font-weight: 500;
  color: #1f2937;
  margin: 0.5rem 0;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

/* Result header + metadata (enhanced, keeps layout) */
.md-result-header {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  align-items: center;
  margin-top: 0.3rem;
}
.md-result-title {
  margin: 0.1rem 0 0;
  font-size: 1.02rem;
  font-weight: 650;
  color: rgba(17, 24, 39, 0.92);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.md-result-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.35;
}
.md-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(17, 24, 39, 0.1);
  background: rgba(255, 255, 255, 0.7);
}
.md-chip i {
  opacity: 0.9;
}
.md-top-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
  margin-top: 0.7rem;
}
.md-mini-btn {
  border: 1px solid rgba(17, 24, 39, 0.12);
  background: rgba(255, 255, 255, 0.8);
  color: rgba(17, 24, 39, 0.88);
  border-radius: 999px;
  padding: 0.5rem 0.85rem;
  font-size: 0.92rem;
  font-weight: 650;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}
.md-mini-btn:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.12);
}

/* Download option rows inside each result item */
.md-option {
  margin-top: 0.75rem;
  border-radius: 14px;
  border: 1px solid rgba(17, 24, 39, 0.1);
  background: rgba(255, 255, 255, 0.65);
  padding: 0.75rem;
}
.md-option-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}
.md-option-title {
  font-weight: 700;
  color: rgba(17, 24, 39, 0.9);
  font-size: 0.92rem;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}
.md-status {
  font-size: 0.85rem;
  color: rgba(17, 24, 39, 0.7);
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(17, 24, 39, 0.1);
  background: rgba(255, 255, 255, 0.8);
}
.md-status.is-downloading {
  color: rgba(188, 24, 136, 0.95);
  border-color: rgba(188, 24, 136, 0.18);
  background: rgba(240, 148, 51, 0.14);
}
.md-status.is-done {
  color: rgba(16, 185, 129, 0.95);
  border-color: rgba(16, 185, 129, 0.18);
  background: rgba(16, 185, 129, 0.12);
}
.md-option-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.7rem;
  align-items: center;
}
.md-select {
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(17, 24, 39, 0.12);
  background: rgba(255, 255, 255, 0.9);
  padding: 0.6rem 0.7rem;
  font-weight: 600;
  color: rgba(17, 24, 39, 0.85);
  outline: none;
  transition: box-shadow 0.18s ease, border-color 0.18s ease;
}
.md-select:focus {
  border-color: rgba(37, 99, 235, 0.28);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}
.md-static {
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(17, 24, 39, 0.12);
  background: rgba(255, 255, 255, 0.9);
  padding: 0.6rem 0.7rem;
  font-weight: 700;
  color: rgba(17, 24, 39, 0.82);
  text-align: left;
}
.md-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 12px;
  padding: 0.65rem 0.85rem;
  font-weight: 750;
  cursor: pointer;
  color: #fff;
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.12);
}

/* Carousel summary (single detail block) */
.md-summary {
  margin-top: 0.8rem;
  border-radius: 14px;
  border: 1px solid rgba(17, 24, 39, 0.1);
  background: rgba(255, 255, 255, 0.75);
  padding: 0.85rem 1rem;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.08);
}
.md-summary-title {
  font-weight: 750;
  color: rgba(17, 24, 39, 0.92);
  font-size: 1.05rem;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.md-summary-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.45rem;
  margin-top: 0.65rem;
}
.md-summary-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
  margin-top: 0.75rem;
}
.md-summary-actions .md-btn { width: auto; }

/* Unified card layout for TikTok/Instagram (simple mode) */
.md-card {
  overflow: hidden;
  border-radius: var(--radius-xl);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.76));
  border: 1px solid rgba(17, 24, 39, 0.09);
  box-shadow: var(--shadow2);
}
.md-body {
  padding: 0.9rem 0.95rem 1rem;
  text-align: left;
}
.md-title {
  font-size: 0.98rem;
  font-weight: 750;
  color: rgba(17, 24, 39, 0.92);
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.5em;
}
.md-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.55rem;
  color: rgba(17, 24, 39, 0.68);
  font-size: 0.86rem;
}
.md-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.34rem 0.5rem;
  border-radius: 999px;
  border: 1px solid rgba(17, 24, 39, 0.1);
  background: rgba(255, 255, 255, 0.78);
}
.md-meta-item i {
  opacity: 0.9;
}
.md-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.75rem;
  align-items: stretch;
}
.md-actions-row .md-btn {
  flex: 1 1 150px;
}
.md-actions-row .md-btn--ghost {
  flex: 1 1 100%;
}
.md-btn {
  border: 1px solid rgba(17, 24, 39, 0.14);
  background: rgba(255, 255, 255, 0.9);
  color: rgba(17, 24, 39, 0.88);
  border-radius: 12px;
  padding: 0.62rem 0.8rem;
  font-weight: 750;
  font-size: 0.9rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease, background 0.18s ease;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.08);
}
.md-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.02);
  box-shadow: 0 16px 32px rgba(15, 23, 42, 0.12);
}
.md-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.md-btn--primary {
  border: none;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--accent));
}
.md-btn--secondary {
  border: 1px solid rgba(17, 24, 39, 0.14);
  background: rgba(59, 130, 246, 0.1);
  color: rgba(17, 24, 39, 0.9);
}
.md-btn--ghost {
  background: rgba(255, 255, 255, 0.8);
}

/* Carousel: keep only thumbnails + single primary button per item */
.media-grid.instagram .md-body,
.media-grid.tiktok.carousel .md-body {
  padding: 0.75rem 0.8rem 0.85rem;
}
.media-grid.instagram .md-actions-row,
.media-grid.tiktok.carousel .md-actions-row {
  gap: 0.45rem;
}
.media-grid.instagram .md-btn,
.media-grid.tiktok.carousel .md-btn {
  width: 100%;
}

@media (max-width: 600px) {
  .md-actions-row { gap: 0.45rem; }
  .md-btn { width: 100%; }
}
.md-action-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.md-action-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.03);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.16);
}
.md-action-btn.is-video {
  background: linear-gradient(135deg, var(--primary), var(--accent));
}
.md-action-btn.is-audio {
  background: linear-gradient(135deg, var(--accent), var(--primary));
}
.md-action-btn.is-image {
  background: linear-gradient(135deg, var(--primary), var(--accent));
}

/* Media Grid */
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  padding: 0.5rem 0;
  justify-content: stretch;
  overflow: visible;
  width: 100%;
}

.media-grid.single-item {
  justify-content: center;
}

/* Instagram carousel: horizontal scroll (per request) */
.media-grid.instagram {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  max-width: 100%;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  gap: 0.75rem;
  scroll-snap-type: x mandatory;
  padding-bottom: 0.75rem;
}
.media-grid.instagram .media-item {
  flex: 0 0 auto;
  width: 220px;
  scroll-snap-align: start;
}
.media-grid.instagram .md-result-meta {
  display: none;
}
.media-grid.instagram .md-top-actions {
  display: none;
}
.media-grid.instagram .md-option-row {
  grid-template-columns: 1fr;
}
.media-grid.instagram .md-action-btn {
  width: 100%;
  justify-content: center;
}
.media-grid.instagram .md-option {
  padding: 0.65rem;
}
.media-grid.instagram .md-status {
  display: none;
}

/* TikTok photo carousel: same behavior */
.media-grid.tiktok.carousel {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  max-width: 100%;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  gap: 0.75rem;
  scroll-snap-type: x mandatory;
  padding-bottom: 0.75rem;
}
.media-grid.tiktok.carousel .media-item {
  flex: 0 0 auto;
  width: 220px;
  scroll-snap-align: start;
}
.media-grid.tiktok.carousel .md-result-meta {
  display: none;
}
.media-grid.tiktok.carousel .md-top-actions {
  display: none;
}
.media-grid.tiktok.carousel .md-option-row {
  grid-template-columns: 1fr;
}
.media-grid.tiktok.carousel .md-action-btn {
  width: 100%;
}
.media-grid.tiktok.carousel .md-status {
  display: none;
}

.media-grid::-webkit-scrollbar {
  height: 8px;
}

.media-grid::-webkit-scrollbar-track {
  background: #e5e7eb;
  border-radius: 4px;
}

.media-grid::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 4px;
}

.media-grid::-webkit-scrollbar-thumb:hover {
  filter: brightness(0.98);
}

.media-item {
  width: 100%;
  text-align: center;
}

.media-wrapper {
  position: relative;
  width: 100%;
  height: 180px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.media-wrapper:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

.media-thumbnail {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* When wrapped by .md-card, keep the thumbnail flush with the card */
.md-card .media-wrapper {
  border-radius: 0;
  box-shadow: none;
  transition: none;
}
.md-card .media-wrapper:hover {
  transform: none;
  box-shadow: none;
}
.md-card .media-thumbnail {
  display: block;
}

.media-download-button {
  display: inline-block;
  margin-top: 0.75rem;
  padding: 0.5rem 1rem;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  text-decoration: none;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 650;
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.media-download-button.tiktok,
.media-download-button.youtube {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border: none;
}

.media-download-button:hover {
  transform: translateY(-1px) scale(1.02);
  filter: brightness(1.03);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

.media-download-button i {
  margin-right: 5px;
}

/* Error Message */
.error-message {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  background: #fef2f2;
  border: 1px solid #fee2e2;
  border-radius: 8px;
  padding: 1rem;
  animation: slideIn 0.5s ease-out;
}

.error-icon {
  font-size: 1.5rem;
  color: #ef4444;
}

/* Empty state (result section) */
.empty-state {
  border: 1px dashed rgba(17, 24, 39, 0.18);
  background: rgba(255, 255, 255, 0.65);
  border-radius: 12px;
  padding: 1rem 1.1rem;
  max-width: 520px;
  margin: 0 auto;
  color: var(--muted);
  animation: slideIn 0.4s ease-out;
}
.empty-state strong {
  display: block;
  color: rgba(17, 24, 39, 0.9);
  margin-bottom: 0.35rem;
}
.empty-state span {
  display: block;
  color: var(--muted);
  line-height: 1.5;
  font-size: 0.95rem;
}

/* Loading Overlay */
.loading-overlay {
  display: none; /* Awalnya disembunyikan */
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  animation: fadeInOverlay 0.3s ease-in;
}

.loading-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #f3f4f6;
  border-top: 4px solid #2563eb;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.loading-text {
  color: #ffffff;
  font-size: 1.2rem;
  font-weight: 500;
  letter-spacing: 0.5px;
  animation: pulse 1.5s ease-in-out infinite;
}

/* Animations */
@keyframes bounce {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-5px);
  }
}

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

@keyframes pop {
  0% {
    transform: scale(0.5);
    opacity: 0;
  }
  70% {
    transform: scale(1.2);
    opacity: 1;
  }
  100% {
    transform: scale(1);
  }
}

@keyframes fadeInOverlay {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 0.7;
  }
  50% {
    opacity: 1;
  }
}

/* Media Query untuk Mobile */
@media (max-width: 600px) {
  .instagram-icon {
    font-size: 2rem;
  }

  .tiktok-icon {
    font-size: 2rem;
  }

  .youtube-icon {
    font-size: 2rem;
  }

  .downloader-button {
    padding: 0.6rem 1.5rem;
  }

  .result-header {
    flex-direction: row;
    text-align: center;
  }

  .success-text {
    font-size: 1rem;
  }

  .video-title {
    font-size: 0.9rem;
  }

  /* Legacy result layout only (avoid shrinking MDUI cards) */
  .media-item:not([data-platform]) {
    width: 140px;
  }

  .media-item:not([data-platform]) .media-wrapper {
    height: 140px;
  }

  .media-download-button {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
  }

  .spinner {
    width: 32px;
    height: 32px;
    border-width: 3px;
  }

  .loading-text {
    font-size: 1rem;
  }
}

/* Footer styling */
.footer {
  text-align: center;
  padding: 1rem 0;
  width: 100%;
  flex-shrink: 0;
}

.footer p {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 400;
  color: #1f2937;
  font-family: "Inter", sans-serif;
  letter-spacing: 0.3px;
}

/* Mobile Responsiveness */
@media (max-width: 600px) {
  .footer {
    padding: 0.8rem 0;
  }
  .footer p {
    font-size: 0.8rem;
  }
  .md-option-row {
    grid-template-columns: 1fr;
  }
}

/* ==============================
   Responsive Layout Overrides
   (Desktop-first, fixes "too narrow" layout)
   ============================== */

/* Main container should feel wide on desktop */
.container {
  width: 100%;
  max-width: 1160px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

/* Forms should not be locked to mobile widths */
.downloader-form {
  width: 100%;
  max-width: 920px;
}

/* Universal homepage input stays visually centered */
.downloader-form.universal-form {
  max-width: 920px;
  margin-top: 0.55rem;
}

/* Remove the legacy horizontal offset that makes the left look "cut" */
.input-wrapper {
  transform: none;
}

/* Keep the detected-platform icon centered above the CTA */
.input-hint {
  display: flex;
  justify-content: center;
  text-align: center;
  margin-top: 0.25rem;
}
.input-hint.is-error {
  justify-content: flex-start;
  text-align: left;
}

/* Results should use the available desktop width */
.download-result {
  width: 100%;
}
.result-content {
  display: block;
  width: 100%;
  max-width: 1160px;
}
.result-content.single-item {
  max-width: 920px;
}

/* SEO section shouldn't look like a small card on desktop */
.seo-section {
  max-width: 1160px;
}

/* Grid sizing: bigger cards on desktop */
.media-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

/* Instagram single item should not force horizontal scroll */
.media-grid.instagram.single-item {
  display: grid;
  overflow: visible;
  scroll-snap-type: none;
}
.media-grid.instagram.single-item .media-item {
  width: auto;
  flex: initial;
}

@media (min-width: 768px) {
  .container { padding-left: 1.75rem; padding-right: 1.75rem; }
  .downloader-form { max-width: 980px; }
  .downloader-form.universal-form { max-width: 980px; }
}

@media (min-width: 1024px) {
  .container { max-width: 1200px; padding-left: 2rem; padding-right: 2rem; }
  .result-content { max-width: 1200px; }
  .seo-section { max-width: 1200px; }
  .media-grid { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }

  /* Optional: horizontal card layout for non-carousel simple cards */
  .media-grid.tiktok:not(.carousel) .md-card,
  .media-grid.instagram.single-item .md-card,
  .media-grid.youtube .md-card {
    display: grid;
    grid-template-columns: 260px 1fr;
    align-items: stretch;
  }
  .media-grid.tiktok:not(.carousel) .md-card .media-wrapper,
  .media-grid.instagram.single-item .md-card .media-wrapper,
  .media-grid.youtube .md-card .media-wrapper {
    height: 100%;
    min-height: 210px;
    border-radius: var(--radius-xl) 0 0 var(--radius-xl);
  }
  .media-grid.tiktok:not(.carousel) .md-card .md-body,
  .media-grid.instagram.single-item .md-card .md-body,
  .media-grid.youtube .md-card .md-body {
    padding: 1.05rem 1.15rem 1.1rem;
  }
}

@media (min-width: 1280px) {
  .container { max-width: 1240px; }
  .result-content { max-width: 1240px; }
  .seo-section { max-width: 1240px; }
  .media-grid { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
}

/* ==============================
   Mobile Layout Overrides (< 768px)
   Make mobile feel native (full-width, thumb-friendly)
   ============================== */

@media (max-width: 640px) {
  .container {
    max-width: 100%;
    padding: 1.25rem 1rem;
  }

  h1 {
    font-size: 1.8rem;
    margin-bottom: 1.25rem;
  }

  .hero-subtitle {
    margin: 0 auto 0.9rem;
    font-size: 0.98rem;
  }

  .platform-indicators {
    margin-bottom: 1.1rem;
  }

  .downloader-form,
  .downloader-form.universal-form,
  .universal-form {
    max-width: 100%;
    width: 100%;
    gap: 0.85rem;
  }

  .universal-form .universal-input-wrapper {
    width: 100%;
  }

  .downloader-input {
    font-size: 1rem;
    padding: 0.95rem 1rem;
    border-radius: 14px;
  }

  /* Keep room for the left icon */
  .downloader-input {
    padding-left: 3.1rem;
  }

  .input-icon {
    left: 1rem;
    font-size: 1rem;
  }

  /* Detected icon centered under input, above button */
  .input-hint {
    justify-content: center;
    text-align: center;
    margin-top: 0.15rem;
  }
  .input-hint.is-error {
    justify-content: flex-start;
    text-align: left;
  }

  /* Primary CTA: full-width + comfy height */
  .downloader-button,
  .universal-form .downloader-button {
    width: 100%;
    max-width: 520px;
    min-height: 48px;
    border-radius: 14px;
    justify-content: center;
  }

  .download-result {
    margin-top: 1.1rem;
  }

  .result-content,
  .result-content.single-item {
    max-width: 100%;
    width: 100%;
    padding: 1.1rem;
    border-radius: 16px;
  }

  /* Result cards: single column, full-width */
  .media-grid {
    grid-template-columns: 1fr;
    gap: 0.85rem;
    justify-items: center;
  }

  /* Fix: desktop single-item overrides make the card shrink + stick left */
  .media-grid.instagram.single-item {
    justify-items: center;
  }
  .media-grid.instagram.single-item .media-item {
    width: 100%;
    margin-left: auto;
    margin-right: auto;
  }

  /* Fix: thumbnail looks left-shifted (mobile) by forcing explicit centering */
  .media-item.md-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
  }

  .media-item.md-card .media-wrapper {
    align-self: stretch;
    display: block;
    margin-left: auto;
    margin-right: auto;
  }

  .media-item.md-card .media-thumbnail {
    display: block;
    margin-left: auto;
    margin-right: auto;
    max-width: 100%;
    object-position: center;
  }

  .media-wrapper {
    height: 210px;
    border-radius: 14px;
  }

  .md-body {
    padding: 0.95rem 1rem 1rem;
  }

  .md-title {
    font-size: 1rem;
  }

  /* YouTube mobile: avoid "shrunk" look and messy wrapping */
  .media-grid.youtube .media-item {
    width: 100%;
    text-align: left;
  }

  .media-grid.youtube .md-result-header {
    width: 100%;
    align-items: flex-start;
  }

  .media-grid.youtube .md-result-title {
    white-space: normal;
    line-height: 1.3;
  }

  .media-grid.youtube .md-top-actions {
    width: 100%;
  }

  .media-grid.youtube .md-mini-btn {
    width: 100%;
    justify-content: center;
    white-space: normal;
    text-align: center;
  }

  .media-grid.youtube .md-option-row {
    grid-template-columns: 1fr;
  }

  .media-grid.youtube .md-action-btn {
    width: 100%;
  }

  .md-meta-row {
    font-size: 0.9rem;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-items: center;
    justify-content: center;
  }

  .md-meta-item {
    justify-content: center;
  }

  .md-actions-row {
    gap: 0.55rem;
  }

  .md-btn {
    min-height: 44px;
  }

  .md-actions-row .md-btn {
    flex: 1 1 100%;
    width: 100%;
  }

  /* Carousel on mobile: bigger items (not tiny thumbnails) */
  .media-grid.instagram .media-item,
  .media-grid.tiktok.carousel .media-item {
    width: 78vw;
    max-width: 330px;
  }

  .seo-section {
    max-width: 100%;
    padding: 1rem;
    border-radius: 16px;
  }

  .seo-faq summary {
    padding: 0.85rem 0.95rem;
  }
}

@media (min-width: 640px) and (max-width: 768px) {
  .container {
    max-width: 100%;
    padding: 1.6rem 1.25rem;
  }

  .downloader-form,
  .downloader-form.universal-form,
  .universal-form {
    max-width: 100%;
  }

  .result-content {
    max-width: 100%;
  }

  .media-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  }
}
