/* blokování interakce s pozadím */
body.pl-blocking { pointer-events: none; user-select: none; }
body.pl-blocking #preloader { pointer-events: all; }

.preloader {
  position: fixed; inset: 0; z-index: 9999;
  display: none; align-items: center; justify-content: center;
}

/* poloprůhledný backdrop */
.pl-backdrop {
  position: absolute; inset: 0;
  background: rgba(9, 10, 16, 0.72);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: pl-fade-in 0.2s ease;
}

/* karta uprostřed */
.pl-panel {
  position: relative; z-index: 1;
  background: var(--col-bg);
  border: 1px solid var(--border2);
  border-radius: 16px;
  padding: 32px 36px 28px;
  min-width: 280px;
  display: flex; flex-direction: column; align-items: center;
  box-shadow: 0 24px 64px rgba(0,0,0,.55);
  animation: pl-slide-in 0.25s cubic-bezier(.22,.68,0,1.2);
}

/* spinner */
.pl-spinner {
  position: relative; width: 64px; height: 64px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 20px;
}
.pl-ring {
  position: absolute; inset: 0;
  width: 64px; height: 64px;
  animation: pl-rotate 1.4s linear infinite;
}
.pl-ring-track {
  stroke: var(--border2);
}
.pl-ring-fill {
  stroke: var(--accent);
  stroke-dasharray: 100;
  stroke-dashoffset: 25;
  animation: pl-dash 1.4s ease-in-out infinite;
}
.pl-model-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent); opacity: .9;
  animation: pl-pulse 1.4s ease-in-out infinite;
}

.pl-label {
  font-size: 11px; font-weight: 600; letter-spacing: .1em;
  text-transform: uppercase; color: var(--text3); margin-bottom: 4px;
}
.pl-model-name {
  font-size: 15px; font-weight: 600; color: var(--text);
  font-family: var(--mono); margin-bottom: 22px;
}

/* kroky */
.pl-steps {
  display: flex; flex-direction: column; gap: 10px;
  width: 100%; margin-bottom: 20px;
}
.pl-step {
  display: flex; align-items: center; gap: 10px;
  font-size: 12px; color: var(--text3);
  transition: color .3s;
}
.pl-step-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
  background: var(--border2);
  transition: background .3s, box-shadow .3s;
}
.pl-step.pl-step-active {
  color: var(--text2);
}
.pl-step.pl-step-active .pl-step-dot {
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(99,102,241,.25);
  animation: pl-dot-pulse .8s ease-in-out infinite alternate;
}
.pl-step.pl-step-done {
  color: var(--green);
}
.pl-step.pl-step-done .pl-step-dot {
  background: var(--green);
  box-shadow: none;
  animation: none;
}
/* nahradí tečku checkmarkem u hotových kroků */
.pl-step.pl-step-done .pl-step-dot::after {
  content: '';
  display: block; width: 4px; height: 7px;
  border: 1.5px solid var(--col-bg);
  border-top: none; border-left: none;
  transform: translate(1px,-1px) rotate(42deg);
}

.pl-elapsed {
  font-size: 11px; color: var(--text3); font-family: var(--mono);
  margin-bottom: 20px;
}

.pl-cancel {
  font-size: 12px; padding: 7px 20px;
  border: 1px solid var(--border2); border-radius: 7px;
  background: transparent; color: var(--text3);
  cursor: pointer; font-family: var(--sans);
  transition: background .15s, color .15s;
}
.pl-cancel:hover { background: var(--card-bg); color: var(--text2); }

/* fade-out */
.preloader.pl-hiding .pl-backdrop {
  animation: pl-fade-out .3s ease forwards;
}
.preloader.pl-hiding .pl-panel {
  animation: pl-slide-out .3s cubic-bezier(.4,0,1,1) forwards;
}

/* keyframes */
@keyframes pl-fade-in  { from { opacity:0 } to { opacity:1 } }
@keyframes pl-fade-out { from { opacity:1 } to { opacity:0 } }
@keyframes pl-slide-in {
  from { opacity:0; transform: translateY(14px) scale(.96) }
  to   { opacity:1; transform: translateY(0)   scale(1)    }
}
@keyframes pl-slide-out {
  from { opacity:1; transform: translateY(0)   scale(1)   }
  to   { opacity:0; transform: translateY(10px) scale(.97) }
}
@keyframes pl-rotate { to { transform: rotate(360deg) } }
@keyframes pl-dash {
  0%   { stroke-dashoffset: 100; }
  50%  { stroke-dashoffset: 20;  }
  100% { stroke-dashoffset: 100; }
}
@keyframes pl-pulse {
  0%,100% { transform: scale(.85); opacity:.6 }
  50%      { transform: scale(1.1); opacity:1  }
}
@keyframes pl-dot-pulse {
  from { box-shadow: 0 0 0 2px rgba(99,102,241,.2) }
  to   { box-shadow: 0 0 0 5px rgba(99,102,241,.0) }
}