/* YouTube Downloader — professional single-flow UI */
.tool-widget:has(.ytdl-app) {
  padding: 0;
  overflow: hidden;
  background: transparent;
  border: none;
  box-shadow: none;
}

.ytdl-app {
  --a: #ff0033;
  --a2: #c40028;
  --a3: #ff7a8a;
  --ink: #f8fafc;
  --muted: #94a3b8;
  --line: rgba(148, 163, 184, .18);
  --card: rgba(15, 23, 42, .78);
  --surface: rgba(2, 8, 20, .55);
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.ytdl-app *,
.ytdl-app *::before,
.ytdl-app *::after {
  box-sizing: border-box;
}

.ytdl-app [hidden] { display: none !important; }

.ytdl-shell {
  border: 1px solid var(--line);
  border-radius: 22px;
  background:
    radial-gradient(ellipse 65% 50% at 8% -10%, rgba(255, 0, 51, .22), transparent 55%),
    radial-gradient(ellipse 45% 40% at 100% 0%, rgba(196, 0, 40, .12), transparent 50%),
    linear-gradient(165deg, #121a2b 0%, #0a101c 55%, #070d16 100%);
  padding: 1.35rem 1.35rem 1.5rem;
  box-shadow: 0 22px 56px rgba(0, 0, 0, .32);
}

.ytdl-hero {
  display: grid;
  gap: 1rem;
  margin-bottom: 1.15rem;
  padding-bottom: 1.15rem;
  border-bottom: 1px solid var(--line);
}

.ytdl-hero-brand {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.ytdl-hero-copy { min-width: 0; flex: 1; }

.ytdl-kicker {
  margin: 0 0 .35rem;
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--a3);
}

.ytdl-intro-title {
  margin: 0 0 .55rem;
  font-size: clamp(1.35rem, 2.4vw, 1.75rem);
  line-height: 1.15;
  letter-spacing: -.03em;
  font-weight: 800;
  color: var(--ink);
}

.ytdl-intro-text {
  margin: 0;
  color: var(--muted);
  font-size: .92rem;
  line-height: 1.55;
  max-width: 46rem;
}

.ytdl-trust {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}

.ytdl-trust-item {
  padding: .38rem .75rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 122, 138, .22);
  background: rgba(255, 0, 51, .08);
  font-size: .72rem;
  font-weight: 700;
  color: #fecdd3;
}

.ytdl-card {
  padding: 1.15rem 1.2rem;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--card);
  backdrop-filter: blur(8px);
}

.ytdl-card-main { margin-bottom: 1rem; }
.ytdl-card-result { margin-bottom: 0; }

.ytdl-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .65rem;
  margin-bottom: .9rem;
}

.ytdl-card-head h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
  color: var(--ink);
}

.ytdl-pill {
  font-size: .7rem;
  font-weight: 700;
  color: var(--a3);
  background: rgba(255, 0, 51, .1);
  border: 1px solid rgba(255, 0, 51, .28);
  border-radius: 999px;
  padding: .3rem .7rem;
  white-space: nowrap;
}

.ytdl-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* Row 1: input | Row 2: Paste | Row 3: Fetch + Clear */
.ytdl-url-stack {
  display: flex;
  flex-direction: column;
  gap: .6rem;
  width: 100%;
}

.ytdl-url-field {
  position: relative;
  min-width: 0;
  width: 100%;
}

.ytdl-url-icon {
  position: absolute;
  left: .85rem;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  pointer-events: none;
}

.ytdl-url-input {
  padding-left: 2.55rem !important;
  min-height: 50px;
}

.ytdl-action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .6rem;
  width: 100%;
}

.ytdl-action-btn,
.ytdl-paste-btn,
.ytdl-fetch-btn,
.ytdl-clear-btn {
  width: 100%;
  min-height: 48px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  font-weight: 700;
  border-radius: 12px;
  padding: .7rem 1rem;
}

.ytdl-fetch-btn {
  background: linear-gradient(145deg, var(--a2), var(--a));
  border-color: transparent;
  box-shadow: 0 8px 22px rgba(255, 0, 51, .28);
}

.ytdl-fetch-btn:disabled {
  opacity: .65;
  cursor: not-allowed;
  box-shadow: none;
}

.ytdl-paste-btn {
  border-style: dashed;
}

.ytdl-input {
  width: 100%;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  padding: .85rem 1rem;
  font-size: .95rem;
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}

.ytdl-input::placeholder { color: #64748b; }

.ytdl-input:focus {
  outline: none;
  border-color: rgba(255, 122, 138, .55);
  box-shadow: 0 0 0 3px rgba(255, 0, 51, .14);
}

.ytdl-mini {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(30, 41, 59, .75);
  color: #cbd5e1;
  font-size: .78rem;
  font-weight: 700;
  border-radius: 999px;
  padding: .4rem .8rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  transition: border-color .15s, color .15s, background .15s;
}

.ytdl-mini:hover {
  border-color: rgba(255, 0, 51, .45);
  color: #fff;
  background: rgba(255, 0, 51, .12);
}

.ytdl-progress {
  margin-top: 1rem;
  padding: .95rem 1rem;
  border-radius: 14px;
  border: 1px solid rgba(255, 0, 51, .28);
  background: linear-gradient(135deg, rgba(255, 0, 51, .12), rgba(15, 23, 42, .35));
}

.ytdl-progress-head {
  display: flex;
  justify-content: space-between;
  color: var(--ink);
  font-size: .86rem;
  margin-bottom: .5rem;
}

.ytdl-progress-track {
  height: 9px;
  border-radius: 999px;
  background: rgba(15, 23, 41, .85);
  overflow: hidden;
}

.ytdl-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--a2), var(--a), #ff8a98);
  transition: width .25s ease;
}

.ytdl-progress-step {
  margin: .55rem 0 0;
  font-size: .78rem;
  color: var(--muted);
}

.ytdl-status {
  margin: .85rem 0 0;
  padding: .7rem .9rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: .86rem;
  color: var(--muted);
  line-height: 1.45;
}

.ytdl-status.is-error {
  color: #fecaca;
  border-color: rgba(248, 113, 113, .35);
  background: rgba(127, 29, 29, .28);
}

.ytdl-status.is-ok {
  color: #bbf7d0;
  border-color: rgba(52, 211, 153, .3);
  background: rgba(6, 78, 59, .28);
}

.ytdl-result-grid {
  display: grid;
  grid-template-columns: minmax(180px, 260px) 1fr;
  gap: 1.15rem;
  margin-bottom: 1.15rem;
}

.ytdl-preview-wrap {
  border-radius: 16px;
  overflow: hidden;
  background: #020617;
  border: 1px solid var(--line);
  aspect-ratio: 16 / 10;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .03);
}

.ytdl-preview,
.ytdl-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ytdl-result-copy h3 {
  margin: 0 0 .5rem;
  color: var(--ink);
  font-size: 1.12rem;
  font-weight: 800;
  line-height: 1.35;
}

.ytdl-meta {
  margin: 0 0 .35rem;
  color: var(--muted);
  font-size: .88rem;
}

.ytdl-actions-inline {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-top: .7rem;
}

.ytdl-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .65rem;
  margin-bottom: .85rem;
  padding-top: .15rem;
  border-top: 1px solid var(--line);
  padding-top: 1rem;
}

.ytdl-filters {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
}

.ytdl-filter {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(30, 41, 59, .55);
  color: #cbd5e1;
  font-size: .76rem;
  font-weight: 700;
  border-radius: 999px;
  padding: .4rem .8rem;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}

.ytdl-filter:hover {
  border-color: rgba(255, 122, 138, .35);
  color: #fff;
}

.ytdl-filter.active {
  border-color: rgba(255, 0, 51, .5);
  background: rgba(255, 0, 51, .18);
  color: #fecdd3;
}

.ytdl-formats {
  display: grid;
  gap: .55rem;
}

.ytdl-format {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: .8rem;
  align-items: center;
  width: 100%;
  text-align: left;
  padding: .9rem 1rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(2, 6, 23, .42);
  color: var(--ink);
  transition: border-color .15s, background .15s, transform .15s;
}

.ytdl-format:hover {
  border-color: rgba(255, 122, 138, .35);
  background: rgba(255, 0, 51, .08);
}

.ytdl-format.is-active {
  border-color: rgba(255, 0, 51, .55);
  background: rgba(255, 0, 51, .14);
}

.ytdl-format.is-rec {
  border-color: rgba(52, 211, 153, .32);
}

.ytdl-format-badge {
  font-size: .66rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: .32rem .5rem;
  border-radius: 8px;
  background: rgba(255, 0, 51, .16);
  color: var(--a3);
}

.ytdl-format-badge.is-rec {
  background: rgba(52, 211, 153, .16);
  color: #6ee7b7;
}

.ytdl-format strong {
  display: block;
  font-size: .92rem;
}

.ytdl-format span {
  display: block;
  font-size: .75rem;
  color: var(--muted);
  margin-top: .18rem;
}

.ytdl-format-dl {
  appearance: none;
  border: 0;
  border-radius: 11px;
  background: linear-gradient(145deg, var(--a2), var(--a));
  color: #fff;
  font-size: .76rem;
  font-weight: 800;
  padding: .55rem .85rem;
  cursor: pointer;
  min-height: 40px;
  white-space: nowrap;
  box-shadow: 0 6px 16px rgba(255, 0, 51, .22);
}

.ytdl-format-dl:hover { filter: brightness(1.06); }

.ytdl-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem;
  margin-top: 1.1rem;
  align-items: stretch;
  width: 100%;
}

.ytdl-actions .btn {
  min-height: 46px;
  font-weight: 700;
  border-radius: 12px;
}

.ytdl-actions .btn-primary {
  background: linear-gradient(145deg, var(--a2), var(--a));
  border-color: transparent;
  box-shadow: 0 8px 22px rgba(255, 0, 51, .25);
}

.ytdl-empty {
  margin: 0;
  padding: 1rem;
  text-align: center;
  color: var(--muted);
  font-size: .88rem;
  border: 1px dashed var(--line);
  border-radius: 12px;
}

@media (max-width: 900px) {
  .ytdl-result-grid { grid-template-columns: 1fr; }

  .ytdl-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: .5rem;
  }

  .ytdl-actions .btn {
    width: 100%;
    min-width: 0;
    min-height: 48px;
    justify-content: center;
  }

  .ytdl-filter-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .ytdl-filters {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .4rem;
  }

  .ytdl-filter {
    min-height: 42px;
    justify-content: center;
    text-align: center;
  }

  .ytdl-format {
    grid-template-columns: auto minmax(0, 1fr);
    gap: .65rem;
  }

  .ytdl-format-dl {
    grid-column: 1 / -1;
    width: 100%;
    min-height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .ytdl-profile-toolbar {
    display: grid;
    grid-template-columns: 1fr;
    gap: .55rem;
  }

  .ytdl-profile-toolbar .btn {
    width: 100%;
    min-height: 48px;
    justify-content: center;
  }

  .ytdl-profile-actions {
    width: 100%;
  }

  .ytdl-profile-actions .ytdl-mini {
    flex: 1 1 calc(50% - .35rem);
    justify-content: center;
    min-height: 40px;
  }

  .ytdl-actions-inline {
    width: 100%;
  }

  .ytdl-actions-inline .ytdl-mini {
    flex: 1 1 calc(50% - .3rem);
    justify-content: center;
    min-height: 40px;
  }
}

@media (max-width: 640px) {
  .ytdl-shell { padding: 1rem; border-radius: 18px; }

  .ytdl-hero-brand { gap: .75rem; }

  .ytdl-filters {
    grid-template-columns: 1fr;
  }

  .ytdl-pill {
    white-space: normal;
    text-align: right;
  }

  .ytdl-card-head {
    flex-wrap: wrap;
  }

  .ytdl-trust {
    gap: .35rem;
  }

  .ytdl-trust-item {
    font-size: .68rem;
    padding: .32rem .6rem;
  }
}

/* Profile / album bulk download (tool-specific) */
.ytdl-profile-head { display:flex; justify-content:space-between; gap:1rem; flex-wrap:wrap; align-items:flex-start; margin-bottom:1rem; }
.ytdl-profile-actions, .ytdl-profile-toolbar { display:flex; flex-wrap:wrap; gap:.5rem; align-items:center; }
.ytdl-profile-toolbar { margin-bottom:1rem; padding:.75rem; border-radius:12px; border:1px solid var(--line, rgba(148,163,184,.18)); background:rgba(2,6,23,.35); }
.ytdl-check-all { display:inline-flex; gap:.4rem; align-items:center; color:#cbd5e1; font-size:.85rem; font-weight:700; }
.ytdl-profile-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(150px,1fr)); gap:.75rem; }
.ytdl-profile-card { position:relative; display:flex; flex-direction:column; gap:.45rem; padding:.55rem; border-radius:14px; border:1px solid var(--line, rgba(148,163,184,.18)); background:rgba(15,23,41,.75); cursor:pointer; }
.ytdl-profile-card.is-checked { border-color:color-mix(in srgb, var(--a, #ff0033) 55%, transparent); box-shadow:0 0 0 1px color-mix(in srgb, var(--a, #ff0033) 35%, transparent); }
.ytdl-profile-card input { position:absolute; top:.65rem; left:.65rem; z-index:2; width:1.05rem; height:1.05rem; }
.ytdl-profile-thumb { display:block; aspect-ratio:1/1; border-radius:10px; background:#020617 center/cover no-repeat; }
.ytdl-profile-meta strong { display:block; font-size:.78rem; color:#e2e8f0; line-height:1.3; max-height:2.5em; overflow:hidden; }
.ytdl-profile-meta em { display:block; font-style:normal; font-size:.7rem; color:#94a3b8; }
.ytdl-profile-one { appearance:none; border:0; border-radius:8px; background:linear-gradient(145deg, var(--a2, #c40028), var(--a, #ff0033)); color:#fff; font-size:.72rem; font-weight:800; padding:.4rem .55rem; cursor:pointer; min-height:40px; }
