
:root {
  --bg: #f7f8fc;
  --surface: #ffffff;
  --text: #171a2b;
  --muted: #858ba1;
  --border: #e9ebf3;
  --primary: #6558e8;
  --primary-hover: #5144d0;
  --primary-soft: #f0eeff;
  --green: #16a477;
  --danger: #dc4545;
  --radius: 20px;
  --shadow: 0 12px 40px rgba(28, 34, 75, 0.055);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
  font-family: "DM Sans", sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
  transition: background .2s, border-color .2s, transform .2s, box-shadow .2s;
}

button:active {
  transform: translateY(1px);
}

button:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(101, 88, 232, .2);
  outline-offset: 2px;
}

.hidden {
  display: none !important;
}

.ambient {
  position: absolute;
  z-index: -1;
  pointer-events: none;
  border-radius: 50%;
  filter: blur(80px);
  opacity: .4;
}

.ambient-one {
  width: 260px;
  height: 260px;
  top: 90px;
  left: -130px;
  background: #dcd7ff;
}

.ambient-two {
  width: 280px;
  height: 280px;
  top: 350px;
  right: -150px;
  background: #d9efff;
}

.app-shell {
  width: min(100% - 40px, 820px);
  margin: 0 auto;
}

/* Header */

.topbar {
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(225, 228, 239, .8);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(140deg, #7868fa, #5445d5);
  box-shadow: 0 7px 18px rgba(101, 88, 232, .25);
}

.brand-icon svg {
  width: 24px;
  height: 24px;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.brand-name {
  font-family: "Space Grotesk", sans-serif;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -.7px;
}

.brand-by {
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 2px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 13px;
  border: 1px solid var(--border);
  border-radius: 100px;
  background: rgba(255, 255, 255, .8);
  color: #555c72;
  font-size: 11px;
  font-weight: 700;
}

.status-dot,
.footer-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #20b486;
}

/* Hero */

.hero {
  padding: 64px 0 38px;
  text-align: center;
}

.eyebrow {
  color: var(--primary);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 2px;
}

.hero .eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 13px;
  border: 1px solid #e6e1ff;
  border-radius: 100px;
  background: #f1efff;
}

.eyebrow-icon {
  font-size: 14px;
}

.hero h1 {
  margin: 20px 0 12px;
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(44px, 8vw, 70px);
  font-weight: 700;
  letter-spacing: -4px;
  line-height: 1.05;
}

.heading-accent {
  color: var(--primary);
}

.hero-description {
  max-width: 460px;
  margin: 0 auto;
  color: #777e94;
  font-size: 15px;
  line-height: 1.8;
}

.platform-list {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 17px;
  margin-top: 26px;
}

.platform-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #555b70;
  font-size: 12px;
  font-weight: 700;
}

.platform-symbol {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--border);
  font-size: 13px;
}

.youtube {
  color: #f04444;
}

.tiktok {
  color: #191b26;
}

.instagram {
  color: #d84c8b;
}

.platform-divider {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #c8cbda;
}

/* Cards */

.card {
  padding: 27px;
  border: 1px solid rgba(228, 231, 241, .9);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

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

.section-heading {
  position: relative;
  display: flex;
  align-items: center;
  gap: 13px;
  margin-bottom: 27px;
}

.section-icon {
  display: grid;
  place-items: center;
  width: 45px;
  height: 45px;
  flex: 0 0 auto;
  border-radius: 14px;
  background: #f2f0ff;
  color: var(--primary);
}

.section-icon svg {
  width: 23px;
  height: 23px;
}

.section-heading h2,
.job-title h2 {
  margin: 0 0 5px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -.4px;
}

.section-heading p,
.job-title p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.step-number {
  margin-left: auto;
  color: #b3b7c8;
  font-family: "Space Grotesk", sans-serif;
  font-size: 12px;
  font-weight: 700;
}

/* Inputs */

label {
  display: block;
  margin-bottom: 10px;
  color: #6e7489;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.2px;
}

.label-muted {
  color: #a1a5b5;
  font-weight: 600;
}

.url-input-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 7px 7px 7px 17px;
  border: 1.5px solid #e4e6f0;
  border-radius: 15px;
  background: #fbfbfe;
  transition: border-color .2s, box-shadow .2s, background .2s;
}

.url-input-wrap:focus-within {
  border-color: #958bfa;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(101, 88, 232, .08);
}

.link-icon {
  width: 21px;
  height: 21px;
  flex: 0 0 auto;
  color: #a0a5b7;
}

input {
  width: 100%;
  min-width: 0;
  padding: 13px 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
  font-size: 13px;
}

input::placeholder {
  color: #a8adbd;
}

.url-input-wrap input:focus-visible {
  outline: none;
}

.row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.row input {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: #fbfbfe;
}

#inspect,
#saveKey {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 48px;
  padding: 0 19px;
  border: 0;
  border-radius: 11px;
  background: var(--primary);
  color: white;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  box-shadow: 0 5px 12px rgba(101, 88, 232, .18);
}

#inspect:hover,
#saveKey:hover {
  background: var(--primary-hover);
  box-shadow: 0 8px 18px rgba(101, 88, 232, .24);
}

#inspect svg {
  width: 17px;
  height: 17px;
}

.meta {
  flex-wrap: wrap;
  min-height: 22px;
  margin-top: 14px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border: 1px solid #e3defe;
  border-radius: 7px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 10px;
  font-weight: 800;
}

.busy-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #777e94;
  font-size: 12px;
}

.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid #e5e1ff;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

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

.security-note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
  color: #959bad;
  font-size: 11px;
  line-height: 1.6;
}

.security-note svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  color: #8b92a9;
}

/* Error / messages */

.msg {
  margin-top: 14px;
  padding: 13px 15px;
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.err {
  border: 1px solid #ffdada;
  background: #fff4f4;
  color: #c53939;
}

/* Result */

.result-section {
  margin-top: 38px;
}

.result-heading {
  display: flex;
  align-items: center;
  margin-bottom: 17px;
}

.result-heading h2 {
  margin: 7px 0 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: 23px;
  letter-spacing: -.7px;
}

.result-heading .step-number {
  align-self: flex-end;
}

.head {
  display: flex;
  align-items: flex-start;
  gap: 21px;
  margin-bottom: 17px;
}

.thumbnail-wrap {
  width: 190px;
  min-width: 190px;
  overflow: hidden;
  border-radius: 13px;
  background: #f0f1f7;
}

#thumb:not(.hidden) {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.media-details {
  flex: 1;
  min-width: 0;
}

.media-details h2 {
  margin: 2px 0 11px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 18px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.sub {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.primary-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 53px;
  margin-top: 17px;
  padding: 0 19px;
  border: 0;
  border-radius: 12px;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
}

.primary-action:hover {
  background: var(--primary-hover);
}

/* Download job */

.job-card {
  margin-top: 24px;
}

.job-top {
  display: flex;
  align-items: center;
  gap: 13px;
}

.job-title {
  flex: 1;
  min-width: 0;
}

.live-indicator {
  padding: 6px 9px;
  border-radius: 7px;
  background: #e8faf3;
  color: #12956d;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 1px;
}

#bar {
  display: block;
  width: 100%;
  height: 8px;
  margin: 24px 0 18px;
  overflow: hidden;
  appearance: none;
  border: 0;
  border-radius: 100px;
  background: #eeeef6;
}

#bar::-webkit-progress-bar {
  border-radius: 100px;
  background: #eeeef6;
}

#bar::-webkit-progress-value {
  border-radius: 100px;
  background: linear-gradient(90deg, #8173fa, #5747d7);
  transition: width .3s;
}

#bar::-moz-progress-bar {
  border-radius: 100px;
  background: var(--primary);
}

.job-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.job-hint {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.danger {
  padding: 10px 15px;
  border: 1px solid #ffdada;
  border-radius: 9px;
  background: #fff5f5;
  color: var(--danger);
  font-size: 11px;
  font-weight: 800;
}

.danger:hover {
  background: #ffe6e6;
}

/* Footer */

.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 25px 0 32px;
  margin-top: 24px;
  border-top: 1px solid #e7e9f1;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #9298aa;
  font-size: 11px;
}

.footer-brand strong {
  color: #545b72;
}

.footer-version {
  color: #a4a9b8;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 1px;
}

/* Authentication */

.login-card {
  margin-bottom: 24px;
}

.login-card .row {
  align-items: stretch;
}

.login-card .row input {
  flex: 1;
}

/* Responsive */

@media (max-width: 600px) {
  .app-shell {
    width: calc(100% - 28px);
  }

  .topbar {
    min-height: 75px;
  }

  .brand-icon {
    width: 39px;
    height: 39px;
    border-radius: 12px;
  }

  .brand-name {
    font-size: 17px;
  }

  .status-pill {
    padding: 8px 10px;
    font-size: 10px;
  }

  .hero {
    padding: 47px 0 29px;
  }

  .hero h1 {
    letter-spacing: -2.8px;
  }

  .hero-description {
    max-width: 340px;
    font-size: 13px;
  }

  .platform-list {
    gap: 10px;
    margin-top: 22px;
  }

  .platform-item {
    gap: 5px;
    font-size: 10px;
  }

  .platform-symbol {
    width: 22px;
    height: 22px;
  }

  .card {
    padding: 20px 17px;
    border-radius: 17px;
  }

  .section-heading {
    gap: 10px;
    margin-bottom: 22px;
  }

  .section-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
  }

  .section-heading h2,
  .job-title h2 {
    font-size: 15px;
  }

  .section-heading p,
  .job-title p {
    font-size: 11px;
  }

  .url-input-wrap {
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px;
  }

  .link-icon {
    margin-left: 3px;
  }

  .url-input-wrap input {
    flex: 1;
    width: calc(100% - 38px);
    padding: 10px 0;
    font-size: 12px;
  }

  #inspect {
    width: 100%;
    min-height: 46px;
  }

  .head {
    flex-direction: column;
    gap: 15px;
  }

  .thumbnail-wrap {
    width: 100%;
    min-width: 0;
  }

  #thumb:not(.hidden) {
    max-height: 230px;
  }

  .media-details h2 {
    font-size: 16px;
  }

  .footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
    padding-bottom: 24px;
  }

  .job-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .job-footer .danger {
    align-self: flex-end;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}

#inspect {
  color: #ffffff !important;
  background: #6558e8 !important;
  opacity: 1 !important;
  visibility: visible !important;
  font-size: 13px;
  font-weight: 800;
}

#inspect span {
  color: #ffffff !important;
  display: inline-block;
  visibility: visible !important;
}

#inspect svg {
  width: 17px;
  height: 17px;
  color: #ffffff !important;
  stroke: #ffffff;
  flex-shrink: 0;
}

/* ==========================================
   FIX MEDIA RESULT, DOWNLOAD BUTTON & DROPDOWN
   ========================================== */

/* Cegah seluruh konten melebar keluar container */
.app-shell,
#result,
#items,
#warnings,
#job {
  min-width: 0;
  max-width: 100%;
}

#result,
#items,
#warnings {
  overflow-wrap: anywhere;
}

/* Semua card hasil inspeksi */
#result .card,
#items .card,
#items > div,
#warnings > div {
  min-width: 0;
  max-width: 100%;
}

/* Thumbnail: jangan sampai melewati card */
#result .head {
  width: 100%;
  min-width: 0;
  overflow: hidden;
}

#result .head img,
#items img,
#items video,
#items iframe {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
}

#result .head img {
  display: block;
  width: 100%;
  max-height: 320px;
  object-fit: contain;
  background: #f3f4f9;
}

/* Thumbnail wrapper */
.thumbnail-wrap {
  width: 190px;
  min-width: 0;
  max-width: 40%;
  flex: 0 0 190px;
  overflow: hidden;
}

#result .head .media-details {
  flex: 1 1 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

/* Area daftar format media */
#items {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  margin-top: 16px;
}

#items > * {
  min-width: 0;
  max-width: 100%;
}

/* Dropdown dan select di hasil inspeksi */
#items select,
#result select,
#items input,
#result input {
  box-sizing: border-box;
  max-width: 100%;
  min-width: 0;
}

#items select,
#result select {
  width: 100%;
  min-height: 44px;
  padding: 10px 38px 10px 13px;
  border: 1px solid #e2e5f0;
  border-radius: 11px;
  background-color: #fff;
  color: #252941;
  font-family: "DM Sans", sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

#items select:focus,
#result select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(101, 88, 232, .10);
}

/* Semua tombol di area pilihan download */
#items button,
#result button {
  max-width: 100%;
  min-height: 42px;
  padding: 10px 15px;
  border: 1px solid #e4e6f0;
  border-radius: 10px;
  background: #fff;
  color: #4d536b;
  font-family: "DM Sans", sans-serif;
  font-size: 12px;
  font-weight: 700;
  overflow-wrap: anywhere;
  transition: .2s ease;
}

#items button:hover,
#result button:hover {
  border-color: #c9c1ff;
  background: #f5f3ff;
  color: var(--primary);
}

/* Tombol download utama */
#items button.download-btn,
#items button.primary-action,
#items .download-btn,
#items .primary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
}

#items button.download-btn:hover,
#items button.primary-action:hover,
#items .download-btn:hover,
#items .primary-action:hover {
  background: var(--primary-hover);
  color: #fff;
}

/* Tombol Download All */
#all:not(.hidden) {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 52px;
  margin-top: 18px;
  padding: 0 18px;
  border: 0;
  border-radius: 12px;
  background: var(--primary);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
}

#all:hover {
  background: var(--primary-hover);
  color: #fff;
}

/* Pesan peringatan */
#warnings {
  display: grid;
  gap: 10px;
}

#warnings:empty {
  display: none;
}

#warnings > * {
  padding: 13px 15px;
  border: 1px solid #f3e2b9;
  border-radius: 11px;
  background: #fffaf0;
  color: #8b6520;
  font-size: 12px;
  line-height: 1.7;
}

/* Job progress dan cancel */
#job {
  overflow: hidden;
}

#jobText {
  min-width: 0;
  overflow-wrap: anywhere;
  line-height: 1.7;
}

/* Tampilan mobile */
@media (max-width: 600px) {
  #result .head {
    flex-direction: column;
  }

  .thumbnail-wrap {
    width: 100%;
    max-width: 100%;
    flex: 0 0 auto;
  }

  #result .head img {
    max-height: 240px;
  }

  #items {
    gap: 12px;
  }

  #items button,
  #items select,
  #result select {
    width: 100%;
  }

  #items button {
    white-space: normal;
  }
}


.live-indicator.job-done {
  background: #dcfce7;
  color: #166534;
}

.live-indicator.job-error {
  background: #fee2e2;
  color: #991b1b;
}

.platform-soon {
  opacity: 0.6;
}
.badge-soon {
  font-size: 10px;
  margin-left: 4px;
  padding: 1px 5px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}
