/* ============================================================
   HK Downloader Pro — Obsidian Glassmorphism Design System
   Same class/id hooks as the original stylesheet; only the
   visual layer changed, so app.js needs zero logic changes.
   ============================================================ */

:root {
  /* Deep obsidian backdrop */
  --bg-1: #06070a;
  --bg-2: #0d1017;
  --bg-radial-orange: rgba(255, 138, 61, 0.14);
  --bg-radial-cyan: rgba(34, 211, 238, 0.10);

  /* Glass panels */
  --glass-bg: rgba(255, 255, 255, 0.035);
  --glass-bg-light: rgba(255, 255, 255, 0.055);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-border-strong: rgba(255, 255, 255, 0.14);
  --glass-blur: blur(20px);

  /* Accents */
  --accent-orange: #ff8a3d;
  --accent-orange-soft: rgba(255, 138, 61, 0.35);
  --accent-cyan: #22d3ee;
  --accent-cyan-soft: rgba(34, 211, 238, 0.35);
  --accent-green: #34d399;
  --accent-red: #fb7185;

  /* Text */
  --text-primary: #f1f3f7;
  --text-secondary: #8b93a7;
  --text-tertiary: #5b6274;

  /* Shadows */
  --shadow-card: 0 8px 30px rgba(0, 0, 0, 0.45), 0 1.5px 0 rgba(255, 255, 255, 0.04) inset;
  --shadow-lift: 0 14px 40px rgba(0, 0, 0, 0.55);

  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 8px;

  --font-display: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg-1);
  color: var(--text-primary);
  font-family: var(--font-display);
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ---------- App shell ---------- */
.mobile-frame {
  position: relative;
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(700px 400px at 15% -5%, var(--bg-radial-orange), transparent 60%),
    radial-gradient(600px 500px at 100% 20%, var(--bg-radial-cyan), transparent 55%),
    linear-gradient(180deg, var(--bg-1) 0%, var(--bg-2) 100%);
  overflow: hidden;
}

/* ---------- Header ---------- */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 18px 12px;
  position: sticky;
  top: 0;
  z-index: 20;
  background: linear-gradient(180deg, rgba(6,7,10,0.92) 60%, rgba(6,7,10,0));
  backdrop-filter: var(--glass-blur);
}

.header-brand-wrap { display: flex; align-items: center; gap: 10px; }
.header-logo-icon {
  width: 24px;
  height: 24px;
  color: var(--accent-orange);
  filter:
    drop-shadow(0 1.5px 1.5px rgba(0, 0, 0, 0.55))
    drop-shadow(0 -1px 0.5px rgba(255, 255, 255, 0.15));
}
.header-title {
  font-size: 17px;
  font-weight: 700;
  margin: 0;
  background: linear-gradient(135deg, #ffffff 0%, var(--accent-orange) 120%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: -0.01em;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.15s ease, background 0.2s ease;
}
.icon-btn:hover { border-color: var(--glass-border-strong); transform: translateY(-1px); }
.icon-btn:active { transform: translateY(0); }
.install-pwa-btn svg, .install-pwa-btn { color: var(--accent-orange); }

/* ---------- Content area ---------- */
.content-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 4px 18px 24px;
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.content-scroll::-webkit-scrollbar { display: none; }

.section-container { margin-top: 22px; }
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.section-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  margin: 0 0 12px;
}

.badge-count {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-cyan);
  background: rgba(34, 211, 238, 0.1);
  border: 1px solid rgba(34, 211, 238, 0.25);
  padding: 4px 10px;
  border-radius: 100px;
}

.btn-clear {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid var(--glass-border);
  border-radius: 100px;
  padding: 6px 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-clear:hover { color: var(--accent-red); border-color: rgba(251, 113, 133, 0.4); }

/* ---------- Glowing URL input ---------- */
.glowing-input-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border-radius: var(--radius-md);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  box-shadow:
    0 0 0 1px rgba(255, 138, 61, 0.08),
    0 0 24px rgba(255, 138, 61, 0.18),
    var(--shadow-card);
  transition: box-shadow 0.3s ease;
}
.glowing-input-box:focus-within {
  box-shadow:
    0 0 0 1.5px rgba(255, 138, 61, 0.5),
    0 0 32px rgba(255, 138, 61, 0.35),
    var(--shadow-card);
}

.input-inner { flex: 1; min-width: 0; }
#urlInput {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: 14px;
  padding: 10px 12px;
}
#urlInput::placeholder { color: var(--text-tertiary); }

.btn-start-download {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--accent-orange), #ff6a1f);
  color: #1a0b02;
  font-weight: 700;
  font-size: 13px;
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(255, 138, 61, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn-start-download:hover { transform: translateY(-1px); box-shadow: 0 8px 26px rgba(255, 138, 61, 0.45); }
.btn-start-download:active { transform: translateY(0); }

.spinner {
  width: 14px; height: 14px;
  border: 2px solid rgba(26,11,2,0.3);
  border-top-color: #1a0b02;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- APK banner ---------- */
.apk-download-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  padding: 14px;
  border-radius: var(--radius-md);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: var(--glass-blur);
  text-decoration: none;
  color: var(--text-primary);
  transition: border-color 0.2s ease, transform 0.15s ease;
}
.apk-download-banner:hover { border-color: var(--accent-cyan-soft); transform: translateY(-1px); }
.apk-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(34, 211, 238, 0.12);
  color: var(--accent-cyan);
  flex-shrink: 0;
}
.apk-text { flex: 1; min-width: 0; }
.apk-text strong { display: block; font-size: 13px; }
.apk-text small { color: var(--text-secondary); font-size: 11px; }
.apk-arrow { color: var(--accent-cyan); flex-shrink: 0; }

/* ---------- Empty states ---------- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 48px 20px;
  color: var(--text-tertiary);
  text-align: center;
}
.empty-icon {
  width: 52px; height: 52px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-tertiary);
}
.empty-state p { margin: 0; font-size: 13px; }

/* ---------- Downloads list (dl-card, generated by app.js) ---------- */
.downloads-list { display: flex; flex-direction: column; gap: 10px; }

.dl-card {
  display: flex;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius-md);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--shadow-card), inset 0 1px 0 rgba(255,255,255,0.05);
  transition: opacity 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
}
.dl-card:hover { box-shadow: var(--shadow-card), inset 0 1px 0 rgba(255,255,255,0.08); transform: translateY(-1px); }
.dl-card.fade-out { opacity: 0; transform: scale(0.97); }

.dl-thumb-box {
  flex-shrink: 0;
  width: 68px; height: 68px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.04);
  font-size: 22px;
  position: relative;
  border: 1.5px solid var(--accent-orange-soft);
  box-shadow: 0 0 16px rgba(255, 138, 61, 0.35);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
.dl-thumb-box img { width: 100%; height: 100%; object-fit: cover; }

/* Status-colored glow -- toggled by app.js adding a status class to .dl-card.
   Three states only: orange = in progress (downloading/waiting/verifying),
   red = failed, green = complete. */
.dl-card.completed .dl-thumb-box { border-color: rgba(52, 211, 153, 0.6); box-shadow: 0 0 16px rgba(52, 211, 153, 0.35); }
.dl-card.failed .dl-thumb-box { border-color: rgba(251, 113, 133, 0.6); box-shadow: 0 0 16px rgba(251, 113, 133, 0.35); }

.dl-info { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 6px; }
.dl-title-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.dl-title { font-size: 13px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dl-percent { font-size: 12px; font-weight: 700; color: var(--accent-orange); flex-shrink: 0; }
.dl-card.completed .dl-percent { color: var(--accent-green); }
.dl-card.failed .dl-percent { color: var(--accent-red); }

.dl-progress-wrap {
  display: grid;
  grid-template-rows: 1fr;
  transition: grid-template-rows 0.45s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.35s ease, margin 0.45s ease;
  opacity: 1;
}
.dl-progress-wrap > div { overflow: hidden; min-height: 0; }
.dl-card.completed .dl-progress-wrap {
  grid-template-rows: 0fr;
  opacity: 0;
}

.dl-progress-bg { height: 5px; border-radius: 100px; background: rgba(255,255,255,0.06); overflow: hidden; }
.dl-progress-bar {
  height: 100%; border-radius: 100px;
  background: var(--accent-orange);
  transition: width 0.3s ease;
}
.dl-card.completed .dl-progress-bar { background: var(--accent-green); }
.dl-card.failed .dl-progress-bar { background: var(--accent-red); }

/* One-time celebratory pulse the instant a download finishes -- plays once, doesn't loop */
@keyframes completePulse {
  0%   { box-shadow: 0 0 16px rgba(52, 211, 153, 0.35); }
  40%  { box-shadow: 0 0 28px rgba(52, 211, 153, 0.75); }
  100% { box-shadow: 0 0 16px rgba(52, 211, 153, 0.35); }
}
.dl-card.completed .dl-thumb-box { animation: completePulse 0.7s ease; }

/* New cards animate in rather than appearing abruptly */
@keyframes cardEnter {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.dl-card { animation: cardEnter 0.35s ease; }

.dl-meta-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.dl-meta { font-size: 11px; color: var(--text-secondary); font-family: var(--font-mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.dl-actions, .lib-actions { display: flex; gap: 6px; flex-shrink: 0; }
.btn-card-action {
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 1px solid var(--glass-border);
  background: rgba(255,255,255,0.03);
  color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-card-action:hover { color: var(--text-primary); border-color: var(--glass-border-strong); }
.btn-card-action.btn-cancel:hover, .btn-card-action.btn-del:hover { color: var(--accent-red); border-color: rgba(251,113,133,0.4); }
.btn-card-action.btn-play:hover { color: var(--accent-orange); }

/* ---------- Library grid ---------- */
.library-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.library-card {
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--shadow-card);
}
.lib-thumb {
  position: relative;
  width: 100%; aspect-ratio: 16/10;
  background: rgba(255,255,255,0.04);
  display: flex; align-items: center; justify-content: center;
  font-size: 26px;
  cursor: pointer;
}
.lib-thumb img { width: 100%; height: 100%; object-fit: cover; }
.lib-play-overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(180deg, rgba(0,0,0,0.05), rgba(0,0,0,0.45));
  color: #fff;
  opacity: 0; transition: opacity 0.2s ease;
}
.lib-thumb:hover .lib-play-overlay { opacity: 1; }
.lib-details { padding: 10px; }
.lib-title { font-size: 12px; font-weight: 600; margin-bottom: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-bottom-row { display: flex; align-items: center; justify-content: space-between; }
.lib-size { font-size: 10px; color: var(--text-tertiary); font-family: var(--font-mono); }

/* ---------- Bottom nav ---------- */
.bottom-nav {
  display: flex;
  border-top: 1px solid var(--glass-border);
  background: rgba(6,7,10,0.85);
  backdrop-filter: var(--glass-blur);
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
}
.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  color: var(--text-tertiary);
  font-size: 10px;
  font-weight: 600;
  padding: 6px;
  cursor: pointer;
  transition: color 0.2s ease;
}
.nav-icon { display: flex; }
.nav-item.active.orange-tab, .nav-item.orange-tab.active { color: var(--accent-orange); }
.nav-item.active.cyan-tab, .nav-item.cyan-tab.active { color: var(--accent-cyan); }
.nav-item.active { filter: drop-shadow(0 0 6px currentColor); }

/* ---------- Modal overlay & cards ---------- */
.modal-overlay {
  position: fixed; inset: 0;
  z-index: 100;
  background: rgba(3, 4, 6, 0.72);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.modal-card {
  width: 100%;
  max-width: 480px;
  background: var(--bg-2);
  border: 1px solid var(--glass-border-strong);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  box-shadow: var(--shadow-lift);
  max-height: 88vh;
  overflow-y: auto;
  animation: slideUp 0.25s ease;
}
@keyframes slideUp { from { transform: translateY(24px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* Format modal hero banner */
.modal-hero-banner {
  position: relative;
  width: 100%;
  height: 200px;
  background: linear-gradient(135deg, #14151b, #0a0b0e);
  overflow: hidden;
}
.hero-cover-img { width: 100%; height: 100%; object-fit: cover; }
.hero-cover-fallback {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 44px;
  color: var(--accent-orange);
}
.hero-overlay-gradient {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(6,7,10,0.05) 30%, rgba(6,7,10,0.95) 100%);
}
.hero-type-badge {
  position: absolute; top: 14px; left: 14px;
  background: var(--accent-orange);
  color: #1a0b02;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 4px 10px;
  border-radius: 100px;
}
.hero-close-btn {
  position: absolute; top: 10px; right: 10px;
  width: 30px; height: 30px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,0.45);
  color: #fff;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(6px);
}
.hero-video-title {
  position: absolute; left: 16px; right: 16px; bottom: 14px;
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.modal-body-container { padding: 16px; }
.modal-label { font-size: 12px; color: var(--text-secondary); margin-bottom: 10px; }

.format-list { display: flex; flex-direction: column; gap: 8px; }
.format-item-card {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px;
  border-radius: var(--radius-sm);
  background: var(--glass-bg-light);
  border: 1px solid var(--glass-border);
  transition: border-color 0.2s ease, transform 0.15s ease;
}
.format-item-card:hover { border-color: var(--accent-orange-soft); transform: translateY(-1px); }
.option-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.option-thumb { width: 44px; height: 44px; border-radius: var(--radius-sm); object-fit: cover; flex-shrink: 0; }
.option-thumb-fallback {
  width: 44px; height: 44px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.05);
  color: var(--accent-orange);
  flex-shrink: 0;
}
.option-details { min-width: 0; }
.option-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.option-size { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }
.btn-dl-item {
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent-orange), #ff6a1f);
  color: #1a0b02;
  font-weight: 700;
  font-size: 12px;
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  cursor: pointer;
}

.modal-top { display: flex; align-items: center; justify-content: space-between; padding: 16px 16px 0; }
.btn-close-modal { background: none; border: none; color: var(--text-secondary); font-size: 20px; cursor: pointer; }
.modal-desc { padding: 0 16px; color: var(--text-secondary); font-size: 13px; }
.confirm-actions, .delete-options-col { display: flex; flex-direction: column; gap: 10px; padding: 16px; }
.btn-confirm {
  padding: 12px; border-radius: var(--radius-sm); font-weight: 600; font-size: 13px;
  border: 1px solid var(--glass-border); cursor: pointer;
}
.btn-outline { background: transparent; color: var(--text-primary); }
.btn-danger { background: rgba(251,113,133,0.12); color: var(--accent-red); border-color: rgba(251,113,133,0.3); }

.btn-del-opt {
  display: flex; align-items: center; gap: 10px;
  padding: 12px; border-radius: var(--radius-sm); font-weight: 600; font-size: 13px;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg-light);
  color: var(--text-primary);
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.15s ease;
}
.btn-del-opt:hover { border-color: var(--glass-border-strong); transform: translateY(-1px); }
.btn-del-opt.danger { color: var(--accent-red); border-color: rgba(251,113,133,0.3); background: rgba(251,113,133,0.08); }

/* ---------- MX-style player overlay -- industry-grade redesign ---------- */
.player-modal-card {
  background: #000;
  border-radius: 0;
  max-height: 100vh;
  height: 100vh;
  animation: playerEnter 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes playerEnter {
  from { opacity: 0; transform: scale(1.03); }
  to   { opacity: 1; transform: scale(1); }
}
.mx-video-wrapper { position: relative; width: 100%; height: 100%; background: #000; }
.mx-video-element { width: 100%; height: 100%; object-fit: contain; transition: opacity 0.25s ease; }
.mx-video-wrapper.fit-cover .mx-video-element { object-fit: cover; }
.mx-touch-layer { position: absolute; inset: 0; display: flex; z-index: 2; }
.touch-zone { flex: 1; position: relative; overflow: hidden; }

/* Double-tap seek feedback: an expanding ripple + "-10s"/"+10s" flash,
   the pattern every mainstream mobile video player uses so a tap doesn't
   feel like it silently did something. */
.seek-ripple {
  position: absolute;
  top: 50%; left: 50%;
  width: 20px; height: 20px;
  margin: -10px 0 0 -10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  pointer-events: none;
  animation: seekRippleExpand 0.6s ease-out forwards;
}
@keyframes seekRippleExpand {
  from { transform: scale(0.5); opacity: 0.6; }
  to   { transform: scale(9); opacity: 0; }
}
.seek-flash {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  color: #fff;
  pointer-events: none;
  opacity: 0;
  animation: seekFlashPop 0.7s ease-out forwards;
}
.seek-flash svg { filter: drop-shadow(0 0 6px rgba(255,138,61,0.6)); }
.seek-flash span { font-size: 12px; font-weight: 700; letter-spacing: 0.02em; }
@keyframes seekFlashPop {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.7); }
  20%  { opacity: 1; transform: translate(-50%, -50%) scale(1.05); }
  35%  { transform: translate(-50%, -50%) scale(1); }
  75%  { opacity: 1; }
  100% { opacity: 0; }
}

.mx-controls-overlay {
  position: absolute; inset: 0;
  z-index: 3;
  display: flex; flex-direction: column; justify-content: space-between;
  background: linear-gradient(180deg, rgba(0,0,0,0.65) 0%, transparent 25%, transparent 68%, rgba(0,0,0,0.75) 100%);
  padding: 16px;
  opacity: 1;
  transition: opacity 0.35s ease;
}
.mx-controls-overlay.fade-out { opacity: 0; pointer-events: none; }
.mx-controls-overlay.locked .mx-top-bar,
.mx-controls-overlay.locked .mx-center-hub,
.mx-controls-overlay.locked .mx-bottom-dock > *:not(.mx-lock-hint) { display: none; }

.mx-top-bar { display: flex; align-items: flex-start; justify-content: space-between; }
.mx-brand-info { min-width: 0; }
.mx-badge {
  display: inline-block;
  font-size: 9px; font-weight: 800; letter-spacing: 0.07em;
  color: var(--accent-orange);
  background: rgba(255,138,61,0.14);
  border: 1px solid rgba(255,138,61,0.35);
  padding: 3px 9px; border-radius: 100px;
  margin-bottom: 6px;
  box-shadow: 0 0 12px rgba(255,138,61,0.15);
}
.mx-title {
  margin: 0; font-size: 13px; font-weight: 600; color: #fff;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 70vw;
}
.mx-top-actions { display: flex; gap: 8px; flex-shrink: 0; }

.mx-btn {
  width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(255,255,255,0.09);
  backdrop-filter: blur(14px);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}
.mx-btn:active { transform: scale(0.88); background: rgba(255,255,255,0.16); }
.mx-text-btn { width: auto; padding: 0 12px; border-radius: 100px; font-size: 11px; font-weight: 700; }

.mx-center-hub { display: flex; align-items: center; justify-content: center; gap: 32px; }
.mx-hub-btn {
  background: none; border: none; color: #fff;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: 9px; font-weight: 700;
  opacity: 0.9; cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease;
}
.mx-hub-btn:active { transform: scale(0.85); opacity: 1; }
.mx-hub-play {
  width: 68px; height: 68px; border-radius: 50%;
  background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.24);
  backdrop-filter: blur(14px);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  box-shadow: 0 0 0 1px rgba(255,138,61,0.1), 0 0 34px rgba(255,138,61,0.32), inset 0 1px 0 rgba(255,255,255,0.08);
  transition: transform 0.15s ease;
}
.mx-hub-play:active { transform: scale(0.9); }

.mx-bottom-dock { display: flex; flex-direction: column; gap: 10px; }
.mx-seekbar-wrap { position: relative; height: 14px; display: flex; align-items: center; }
.mx-seekbar-track {
  position: absolute; left: 0; right: 0; height: 4px; border-radius: 100px;
  background: rgba(255,255,255,0.18);
  overflow: hidden;
}
.mx-buffered-fill {
  position: absolute; left: 0; top: 0; height: 100%;
  background: rgba(255,255,255,0.28);
  width: 0%;
  transition: width 0.2s ease;
}
.mx-progress-fill {
  position: absolute; left: 0; top: 0; height: 100%;
  border-radius: 100px;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-orange));
  pointer-events: none;
  width: 0%;
}
.mx-seekbar {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 14px; background: transparent;
  position: relative; z-index: 2;
  margin: 0; cursor: pointer;
}
.mx-seekbar::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 13px; height: 13px; border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(255,138,61,0.35), 0 0 10px rgba(255,138,61,0.7);
  margin-top: 0.5px;
  transition: transform 0.15s ease;
}
.mx-seekbar:active::-webkit-slider-thumb { transform: scale(1.3); }

.mx-dock-row { display: flex; align-items: center; justify-content: space-between; }
.mx-left-dock, .mx-right-dock { display: flex; align-items: center; gap: 8px; }
.mx-time { font-size: 11px; font-family: var(--font-mono); color: rgba(255,255,255,0.9); letter-spacing: 0.02em; }

/* Buffering spinner -- shown while the video is loading/seeking, not just a
   static blank frame */
.mx-buffer-spinner {
  position: absolute; top: 50%; left: 50%;
  width: 40px; height: 40px;
  margin: -20px 0 0 -20px;
  border: 3px solid rgba(255,255,255,0.18);
  border-top-color: var(--accent-orange);
  border-radius: 50%;
  z-index: 4;
  animation: mxSpin 0.8s linear infinite;
  pointer-events: none;
}
.mx-buffer-spinner.hidden { display: none; }
@keyframes mxSpin { to { transform: rotate(360deg); } }

/* Responsive: larger screens/tablets get a centered app frame with a visible obsidian backdrop */
@media (min-width: 540px) {
  body {
    display: flex;
    justify-content: center;
    padding: 24px 0;
  }
  .mobile-frame {
    min-height: calc(100vh - 48px);
    border-radius: 28px;
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-lift);
  }
}

.quality-pills-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
.quality-pill {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--glass-bg);
  border: 0.5px solid var(--glass-border);
  border-radius: 6px;
  padding: 6px 10px;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.quality-pill:hover { border-color: var(--glass-border-strong); }
.quality-pill.active {
  color: var(--accent-orange);
  background: rgba(255, 138, 61, 0.13);
  border-color: var(--accent-orange);
  font-weight: 700;
}

/* ---------- Settings tab ---------- */
.settings-card {
  padding: 16px;
  border-radius: var(--radius-md);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--shadow-card);
}
.settings-card-title { font-size: 14px; font-weight: 700; margin: 0 0 8px; }
.settings-card-desc { font-size: 12px; line-height: 1.6; color: var(--text-secondary); margin: 0 0 16px; }
.settings-input {
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: 13px;
  padding: 10px 12px;
  margin-bottom: 12px;
}
.settings-input::placeholder { color: var(--text-tertiary); }
.settings-input:focus { outline: none; border-color: var(--accent-orange-soft); }
.settings-save-btn { width: 100%; justify-content: center; }
.settings-save-status { font-size: 12px; color: var(--accent-green); margin: 10px 0 0; }

/* ---------- Ambient animated glow background ---------- */
.ambient-bg {
  position: absolute;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}
.ambient-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 0%, transparent 15%, var(--bg-1) 62%);
}
.ambient-blob {
  position: absolute;
  width: 70vw;
  height: 70vw;
  max-width: 480px;
  max-height: 480px;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.32;
  animation-name: blobFloat;
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
  transition: background 1.2s ease, opacity 1.2s ease;
}
.ambient-blob.b1 { background: var(--accent-orange); top: -22%; left: -15%; animation-duration: 22s; }
.ambient-blob.b2 { background: var(--accent-cyan); top: -12%; right: -18%; animation-duration: 27s; animation-delay: -9s; }
.ambient-blob.b3 { background: #a855f7; top: -8%; left: 22%; animation-duration: 31s; animation-delay: -16s; opacity: 0.22; }

@keyframes blobFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25%      { transform: translate(7%, -6%) scale(1.15); }
  50%      { transform: translate(-5%, 7%) scale(0.92); }
  75%      { transform: translate(-7%, -7%) scale(1.06); }
}

/* State-reactive recoloring -- overall app activity, not per-item */
.ambient-bg.state-analyzing .ambient-blob { background: #8b5cf6 !important; animation-duration: 7s; opacity: 0.36; }
.ambient-bg.state-downloading .ambient-blob { background: var(--accent-orange) !important; animation-duration: 9s; opacity: 0.36; }
.ambient-bg.state-completed .ambient-blob { background: var(--accent-green) !important; animation-duration: 6s; opacity: 0.4; }
.ambient-bg.state-failed .ambient-blob { background: var(--accent-red) !important; animation-duration: 6s; opacity: 0.4; }

@media (prefers-reduced-motion: reduce) {
  .ambient-blob { animation: none; }
}

/* ---------- Toast banner (e.g. "Download complete") ---------- */
.toast-banner {
  position: absolute;
  left: 16px; right: 16px;
  top: 14px;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #1a3a2c, #0f2a20);
  border: 1px solid rgba(52, 211, 153, 0.35);
  box-shadow: 0 12px 32px rgba(0,0,0,0.5), 0 0 24px rgba(52, 211, 153, 0.2), inset 0 1px 0 rgba(255,255,255,0.06);
  transform: translateY(-120%);
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
}
.toast-banner.show { transform: translateY(0); opacity: 1; }
.toast-banner.toast-error {
  background: linear-gradient(135deg, #3a1a1e, #2a0f12);
  border-color: rgba(251, 113, 133, 0.35);
  box-shadow: 0 12px 32px rgba(0,0,0,0.5), 0 0 24px rgba(251, 113, 133, 0.2), inset 0 1px 0 rgba(255,255,255,0.06);
}
.toast-icon {
  width: 34px; height: 34px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(52, 211, 153, 0.15);
  color: var(--accent-green);
}
.toast-banner.toast-error .toast-icon { background: rgba(251, 113, 133, 0.15); color: var(--accent-red); }
.toast-title { font-size: 14px; font-weight: 800; color: #fff; }
.toast-subtitle { font-size: 12px; color: rgba(255,255,255,0.65); margin-top: 1px; }
