:root,
[data-theme="dark"] {
  --bg: #08090e;
  --surface: #11131b;
  --surface-2: #1a1d28;
  --border: rgba(255, 255, 255, 0.08);
  --text: #f4f5f7;
  --muted: #9aa3b2;
  --accent: #ff3b5c;
  --accent-2: #ff6b4a;
  --yt: #ff0000;
  --success: #3dd68c;
  --success-text: #062814;
  --error: #ff8da3;
  --header-bg: rgba(8, 9, 14, 0.88);
  --footer-bg: rgba(17, 19, 27, 0.92);
  --glow-opacity: 0.3;
  --header-h: 64px;
  --radius: 16px;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  --pill-active-text: #ffb3c0;
  --step-bg: rgba(255, 255, 255, 0.06);
  --hover-bg: rgba(255, 255, 255, 0.05);
}

[data-theme="light"] {
  --bg: #f0f2f6;
  --surface: #ffffff;
  --surface-2: #eef1f6;
  --border: rgba(15, 23, 42, 0.1);
  --text: #0f1419;
  --muted: #5c6573;
  --header-bg: rgba(255, 255, 255, 0.92);
  --footer-bg: #ffffff;
  --glow-opacity: 0.12;
  --shadow: 0 16px 48px rgba(15, 23, 42, 0.08);
  --pill-active-text: #c41e3a;
  --step-bg: rgba(15, 23, 42, 0.06);
  --hover-bg: rgba(15, 23, 42, 0.04);
  --error: #dc2626;
}

[data-theme="light"] .bg-glow--right {
  background: #a5b4fc;
}

[data-theme="light"] .platform-badge--yt {
  color: #b91c1c;
}

[data-theme="light"] .platform-badge--ig {
  color: #be185d;
}

[data-theme="light"] .platform-badge--fb {
  color: #1d4ed8;
}

[data-theme="light"] .platform-badge--tb {
  color: #1d4ed8;
}

[data-theme="light"] html[data-platform="instagram"] .hero-eyebrow,
[data-theme="light"] html[data-platform="instagram"] .tab.active,
[data-theme="light"] html[data-platform="instagram"] .quality-pill {
  color: #be185d;
}

[data-theme="light"] html[data-platform="facebook"] .hero-eyebrow,
[data-theme="light"] html[data-platform="facebook"] .tab.active,
[data-theme="light"] html[data-platform="facebook"] .quality-pill {
  color: #1d4ed8;
}

[data-theme="light"] html[data-platform="terabox"] .hero-eyebrow,
[data-theme="light"] html[data-platform="terabox"] .tab.active,
[data-theme="light"] html[data-platform="terabox"] .quality-pill {
  color: #1d4ed8;
}

[data-theme="light"] .hero-eyebrow {
  color: #c41e3a;
}

[data-theme="light"] .tab.active {
  color: var(--pill-active-text);
}

[data-theme="light"] .quality-pill {
  color: var(--pill-active-text);
}

[data-theme="light"] .spinner {
  border-color: rgba(15, 23, 42, 0.1);
}

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

html {
  height: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: "DM Sans", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  overflow-x: hidden;
}

html[data-platform="home"] {
  --accent: #ff3b5c;
  --accent-2: #ff6b4a;
}

html[data-platform="instagram"] {
  --accent: #e1306c;
  --accent-2: #f77737;
}

html[data-platform="instagram"] .bg-glow--left {
  background: #e1306c;
}

html[data-platform="facebook"] {
  --accent: #1877f2;
  --accent-2: #0d65d9;
}

html[data-platform="facebook"] .bg-glow--left {
  background: #1877f2;
}

html[data-platform="terabox"] {
  --accent: #4c8bf5;
  --accent-2: #2f6fe0;
}

html[data-platform="terabox"] .bg-glow--left {
  background: #4c8bf5;
}

.bg-glow {
  position: fixed;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  filter: blur(120px);
  opacity: var(--glow-opacity);
  pointer-events: none;
  z-index: 0;
}

.bg-glow--left {
  top: -120px;
  left: -160px;
  background: var(--accent);
}

.bg-glow--right {
  bottom: -180px;
  right: -120px;
  background: #5b4dff;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  background: var(--header-bg);
  backdrop-filter: blur(16px);
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 12px 16px 14px;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 12px 12px;
  align-items: center;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  grid-column: 1;
  grid-row: 1;
}

.header-actions {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  align-items: center;
  gap: 8px;
}

.theme-toggle {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.15s, border-color 0.15s;
}

.theme-toggle:hover {
  background: var(--surface-2);
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
}

.platform-tabs {
  grid-column: 1 / -1;
  grid-row: 2;
  width: 100%;
}

.brand-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: grid;
  place-items: center;
  color: white;
}

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

.brand-text {
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}

.header-nav {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  flex-wrap: nowrap;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 2px;
}

.header-nav::-webkit-scrollbar {
  display: none;
}

.nav-cat {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex: 0 0 auto;
  min-height: 44px;
  min-width: 44px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.nav-cat:hover:not(:disabled) {
  color: var(--text);
  background: var(--hover-bg);
}

.nav-cat.active {
  color: var(--text);
  background: color-mix(in srgb, var(--accent) 14%, var(--surface));
  border-color: color-mix(in srgb, var(--accent) 35%, transparent);
}

.nav-cat--soon {
  opacity: 0.5;
  cursor: not-allowed;
}

.soon-tag {
  font-size: 0.6rem;
  padding: 2px 5px;
  border-radius: 4px;
  background: var(--step-bg);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.cat-icon {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  flex-shrink: 0;
}

.cat-icon--all {
  background: linear-gradient(135deg, var(--accent), #5b4dff);
}

.cat-icon--yt {
  background: var(--yt);
}

.cat-icon--ig {
  background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
}

.cat-icon--tt {
  background: #010101;
  box-shadow: inset 0 0 0 1px var(--border);
}

.cat-icon--fb {
  background: #1877f2;
}

.cat-icon--tb {
  background: linear-gradient(135deg, #4c8bf5, #2f6fe0);
}

@media (min-width: 768px) {
  .header-inner {
    padding: 0 20px;
    height: var(--header-h);
    display: flex;
    flex-wrap: nowrap;
    gap: 16px;
  }

  .brand,
  .header-actions,
  .platform-tabs {
    grid-column: unset;
    grid-row: unset;
  }

  .platform-tabs {
    flex: 1;
    justify-content: flex-end;
    width: auto;
  }

  .header-nav {
    display: flex;
    gap: 6px;
  }

  .nav-cat {
    flex: 0 1 auto;
    min-height: 0;
    padding: 8px 14px;
    border-radius: 999px;
    border-color: transparent;
    background: transparent;
    font-size: 0.85rem;
    font-weight: 500;
  }

  .nav-cat.active {
    border-color: color-mix(in srgb, var(--accent) 35%, transparent);
  }
}

/* Main — grows so footer sits at bottom */
.page {
  position: relative;
  z-index: 1;
  flex: 1 0 auto;
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  padding: 24px 16px 48px;
  padding-bottom: max(48px, env(safe-area-inset-bottom));
}

@media (min-width: 768px) {
  .page {
    padding: 32px 20px 56px;
  }
}

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

.hero-eyebrow {
  margin: 0 0 10px;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--error);
}

html[data-platform="instagram"] .hero-eyebrow {
  color: #f7a0c4;
}

html[data-platform="facebook"] .hero-eyebrow {
  color: #93c5fd;
}

html[data-platform="terabox"] .hero-eyebrow {
  color: #93c5fd;
}

.hero h1 {
  margin: 0 0 12px;
  font-size: clamp(1.6rem, 5vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.hero-sub {
  margin: 0 auto;
  max-width: 540px;
  color: var(--muted);
  font-size: 0.95rem;
}

.search-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

@media (min-width: 640px) {
  .search-card {
    padding: 20px;
  }
}

.search-row {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: stretch;
}

@media (min-width: 640px) {
  .search-row {
    flex-direction: row;
    align-items: flex-start;
    gap: 12px;
  }
}

.search-field {
  flex: 1;
  min-width: 0;
}

.input-wrap {
  position: relative;
  width: 100%;
}

.input-icon {
  position: absolute;
  left: 14px;
  top: 0;
  bottom: 0;
  margin: auto 0;
  width: 20px;
  height: 20px;
  color: var(--muted);
  pointer-events: none;
  flex-shrink: 0;
}

#url-input {
  display: block;
  width: 100%;
  height: 48px;
  padding: 0 132px 0 44px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
  line-height: 48px;
  outline: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input-actions {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  gap: 4px;
}

.input-action-btn {
  height: 34px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s, border-color 0.12s;
}

.input-action-btn:hover {
  background: var(--surface-2);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
}

.input-action-btn--clear {
  color: var(--muted);
}

@media (max-width: 420px) {
  #url-input {
    padding-right: 76px;
  }

  .input-action-btn {
    padding: 0 8px;
    font-size: 0.72rem;
  }

  #clear-btn {
    display: none;
  }
}

#url-input:focus {
  border-color: color-mix(in srgb, var(--accent) 50%, transparent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent);
}

.submit-btn {
  width: 100%;
  min-height: 52px;
  height: auto;
  padding: 14px 28px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
  white-space: nowrap;
  transition: transform 0.12s, opacity 0.12s;
  -webkit-tap-highlight-color: transparent;
}

@media (min-width: 640px) {
  .submit-btn {
    width: auto;
    min-width: 140px;
  }
}

.submit-btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.submit-btn:disabled {
  opacity: 0.65;
  cursor: wait;
}

.form-error {
  margin: 12px 0 0;
  color: var(--error);
  font-size: 0.92rem;
}

.form-error--with-action {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
}

.form-error__text {
  flex: 1 1 200px;
  line-height: 1.4;
}

.link-hint {
  margin: 8px 0 0;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  line-height: 1.35;
  color: var(--success);
  background: color-mix(in srgb, var(--success) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--success) 25%, transparent);
  word-break: break-word;
}

.link-hint--with-action {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
}

.link-hint__text {
  flex: 1 1 180px;
  line-height: 1.4;
}

.link-hint--warn {
  color: var(--error);
  background: color-mix(in srgb, var(--error) 10%, transparent);
  border-color: color-mix(in srgb, var(--error) 25%, transparent);
}

.visit-tool-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 8px 14px;
  border-radius: 8px;
  border: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  transition: transform 0.12s, filter 0.12s;
  -webkit-tap-highlight-color: transparent;
}

.visit-tool-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.06);
}

.link-hint--warn .visit-tool-btn,
.form-error--with-action .visit-tool-btn {
  box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 35%, transparent);
}

.how-to {
  list-style: none;
  margin: 16px 0 0;
  padding: 14px 0 0;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.how-step {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.35;
}

.how-num {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
  background: var(--step-bg);
  border: 1px solid var(--border);
}

@media (min-width: 640px) {
  .how-to {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px 20px;
  }

  .how-step {
    flex: 0 1 auto;
  }
}

/* Hide steps while fetching or showing results — saves mobile space */
.search-card:has(~ #loading:not(.hidden)) .how-to,
.search-card:has(~ #results:not(.hidden)) .how-to {
  display: none;
}

@media (min-width: 520px) {
  .how-to {
    margin-top: 16px;
    padding-top: 16px;
  }
}

.results {
  margin-top: 20px;
}

.results-layout {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

@media (min-width: 900px) {
  .results-layout {
    display: grid;
    grid-template-columns: minmax(220px, 260px) minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    gap: 16px 20px;
    align-items: start;
  }

  .video-card--compact {
    grid-column: 1;
    grid-row: 1 / span 2;
  }

  .stream-player-wrap--terabox {
    grid-column: 1 / -1;
  }

  .formats-panel {
    grid-column: 2;
    grid-row: 1 / span 2;
  }
}

.video-card {
  display: flex;
  gap: 14px;
  padding: 14px;
  margin-bottom: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.video-card--compact {
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  margin-bottom: 0;
}

.video-card--compact .video-thumb {
  width: 100%;
  max-height: none;
  aspect-ratio: 16 / 9;
}

.video-card--compact .video-meta h2 {
  font-size: 0.92rem;
  -webkit-line-clamp: 2;
}

.video-card--compact .video-info {
  font-size: 0.78rem;
}

@media (max-width: 899px) {
  .video-card--compact {
    flex-direction: row;
    align-items: center;
  }

  .video-card--compact .video-thumb {
    width: 96px;
    aspect-ratio: 16 / 9;
    height: auto;
  }

  .video-card--compact .video-meta h2 {
    -webkit-line-clamp: 2;
    font-size: 0.88rem;
  }
}

.hidden {
  display: none !important;
}

.loading {
  text-align: center;
  padding: 48px 0;
  color: var(--muted);
}

.spinner {
  width: 40px;
  height: 40px;
  margin: 0 auto 16px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.video-thumb {
  width: 120px;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 10px;
  flex-shrink: 0;
  background: var(--surface-2);
}

.video-meta {
  min-width: 0;
  flex: 1;
}

.platform-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.platform-badge--yt {
  background: rgba(255, 0, 0, 0.15);
  color: #ff8a8a;
}

.platform-badge--ig {
  background: rgba(225, 48, 108, 0.15);
  color: #f7a0c4;
}

.platform-badge--fb {
  background: rgba(24, 119, 242, 0.15);
  color: #93c5fd;
}

.platform-badge--tb {
  background: rgba(76, 139, 245, 0.15);
  color: #93c5fd;
}

.video-meta h2 {
  margin: 0 0 8px;
  font-size: 1rem;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.video-info {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

@media (max-width: 560px) {
  .video-card:not(.video-card--compact) {
    flex-direction: column;
  }

  .video-card:not(.video-card--compact) .video-thumb {
    width: 100%;
    max-height: 280px;
  }
}

/* Formats panel */
.formats-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  min-width: 0;
}

@media (min-width: 640px) {
  .formats-panel {
    padding: 14px 16px 16px;
  }
}

.formats-panel__head {
  margin-bottom: 12px;
}

.formats-panel__hint {
  margin: 0 0 10px;
  font-size: 0.82rem;
  color: var(--muted);
  text-align: center;
}

@media (min-width: 900px) {
  .formats-panel__hint {
    text-align: left;
  }
}

.formats-panel .filter-tabs {
  margin-bottom: 0;
}

/* Filter tabs — mobile-friendly horizontal scroll */
.filter-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  overflow-x: auto;
  overflow-y: hidden;
  flex-wrap: nowrap;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 2px 0 6px;
  margin-left: -4px;
  margin-right: -4px;
  padding-left: 4px;
  padding-right: 4px;
}

.filter-tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  flex: 1 0 auto;
  min-width: 0;
  min-height: 42px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  scroll-snap-align: start;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

@media (min-width: 480px) {
  .filter-tabs {
    flex-wrap: nowrap;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    overflow: visible;
    gap: 6px;
  }

  .tab {
    min-height: 40px;
    padding: 8px 10px;
  }
}

.tab.active {
  background: color-mix(in srgb, var(--accent) 15%, var(--surface));
  border-color: color-mix(in srgb, var(--accent) 35%, transparent);
  color: var(--pill-active-text);
}

html[data-platform="instagram"] .tab.active {
  background: rgba(225, 48, 108, 0.15);
  border-color: rgba(225, 48, 108, 0.35);
  color: #f7a0c4;
}

html[data-platform="facebook"] .tab.active {
  background: rgba(24, 119, 242, 0.15);
  border-color: rgba(24, 119, 242, 0.35);
  color: #93c5fd;
}

.resource-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

@media (min-width: 520px) {
  .resource-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
  }
}

@media (min-width: 900px) {
  .resource-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 1100px) {
  .page {
    max-width: 980px;
  }

  .resource-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.format-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 10px 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  min-height: 0;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.format-card--best {
  border-color: color-mix(in srgb, var(--success) 45%, var(--border));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--success) 20%, transparent);
}

.format-card__body {
  flex: 1;
  min-width: 0;
  text-align: center;
}

.format-card__badge {
  display: inline-block;
  margin-bottom: 4px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--success-text);
  background: var(--success);
}

.format-card__quality {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.format-card__meta {
  margin: 4px 0 0;
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.download-btn--compact {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  font-size: 0.82rem;
  border-radius: 9px;
  box-shadow: none;
}

.download-btn--compact .download-btn-icon {
  width: 16px;
  height: 16px;
}

/* Legacy list rows (Terabox) */
.resource-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.resource-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  transition: border-color 0.15s, background 0.15s;
}

.resource-row:focus-within {
  border-color: color-mix(in srgb, var(--success) 40%, var(--border));
}

.resource-main {
  min-width: 0;
}

.resource-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.resource-quality {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.recommended-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--success-text);
  background: var(--success);
}

.quality-pill--video {
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  color: var(--pill-active-text);
}

.quality-pill--audio {
  background: rgba(91, 77, 255, 0.18);
  color: #b8b0ff;
}

.quality-pill--image {
  background: rgba(61, 220, 151, 0.18);
  color: #8ef0c8;
}

@media (max-width: 520px) {
  .resource-row {
    grid-template-columns: 1fr;
    gap: 14px;
  }
}

.resource-row[data-type="audio"] .quality-pill {
  background: rgba(91, 77, 255, 0.18);
  color: #b8b0ff;
}

.resource-row[data-type="image"] .quality-pill {
  background: rgba(61, 220, 151, 0.18);
  color: #8ef0c8;
}

.quality-pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  color: var(--pill-active-text);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-right: 8px;
}

html[data-platform="instagram"] .quality-pill {
  background: rgba(225, 48, 108, 0.15);
  color: #f7a0c4;
}

.resource-label {
  font-weight: 500;
}

.resource-sub {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.85rem;
}

.download-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 12px 20px;
  border-radius: 12px;
  border: none;
  background: var(--success);
  color: var(--success-text);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  transition: filter 0.12s, transform 0.12s;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--success) 35%, transparent);
}

.download-btn-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

@media (max-width: 520px) {
  .download-btn {
    width: 100%;
  }
}

.download-btn:focus-visible {
  outline: 2px solid var(--success);
  outline-offset: 2px;
}

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

.download-btn:hover {
  filter: brightness(1.08);
}

.pwd-field-wrap {
  margin-top: 10px;
}

.pwd-label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.82rem;
  color: var(--muted);
}

.pwd-field-wrap input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
}

.terabox-player-wrap,
.stream-player-wrap {
  margin-bottom: 16px;
}

.terabox-player-shell,
.stream-player-shell {
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #000;
}

.terabox-player,
.stream-player {
  display: block;
  width: 100%;
  max-height: 420px;
  background: #000;
}

.terabox-player-note,
.stream-player-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.resource-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.play-btn {
  padding: 10px 18px;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--border));
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}

.play-btn:hover {
  background: color-mix(in srgb, var(--accent) 20%, var(--surface));
}

.resource-row--terabox {
  align-items: center;
}

@media (max-width: 480px) {
  .resource-actions {
    width: 100%;
  }

  .play-btn,
  .resource-row--terabox .download-btn {
    flex: 1;
    text-align: center;
    justify-content: center;
  }
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 24px 16px;
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: 12px;
  font-size: 0.9rem;
}

/* Footer — always at bottom */
.site-footer {
  position: relative;
  z-index: 1;
  flex-shrink: 0;
  margin-top: auto;
  width: 100%;
  border-top: 1px solid var(--border);
  background: var(--footer-bg);
}

.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 16px 24px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 28px;
}

@media (min-width: 768px) {
  .footer-inner {
    grid-template-columns: 1.2fr 2fr;
    padding: 40px 20px 28px;
    gap: 40px;
  }
}

.footer-tagline {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  max-width: 320px;
}

.footer-cols {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

@media (min-width: 480px) {
  .footer-cols {
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
  }
}

.footer-col h3 {
  margin: 0 0 12px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text);
}

.footer-col ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.footer-col li {
  margin-bottom: 8px;
}

.footer-link {
  display: inline-block;
  padding: 8px 0;
  min-height: 36px;
  color: var(--muted);
  font: inherit;
  font-size: 0.9rem;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.footer-link:hover {
  color: var(--text);
}

.footer-muted {
  color: var(--muted);
  font-size: 0.88rem;
}

.footer-bottom {
  border-top: 1px solid var(--border);
  padding: 16px;
  text-align: center;
}

.footer-bottom p {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.5;
}

.cookie-notice {
  position: fixed;
  bottom: 16px;
  left: 16px;
  right: 16px;
  max-width: 520px;
  margin: 0 auto;
  z-index: 200;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.cookie-notice p {
  margin: 0;
  flex: 1 1 200px;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.4;
}

.cookie-accept {
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  background: var(--success);
  color: var(--success-text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
}

@media (min-width: 640px) {
  .cookie-notice {
    left: auto;
    right: 20px;
    margin: 0;
  }
}
