:root {
  --preload-bg: #091a1d;
  --preload-panel: #102629;
  --preload-line: #31514e;
  --preload-ink: #ecfbf4;
  --preload-muted: #9cbbb2;
  --preload-accent: #74ddb9;
  --preload-accent-2: #aea8ff;
}

#zoffice-preloader {
  --download-progress: 0%;
  --download-angle: 0deg;
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  overflow: auto;
  color: var(--preload-ink);
  background:
    radial-gradient(circle at 16% 10%, rgb(81 211 171 / 14%), transparent 34%),
    radial-gradient(circle at 88% 86%, rgb(147 139 255 / 12%), transparent 38%),
    var(--preload-bg);
  font: 500 15px/1.5 ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  transition: opacity 220ms ease, visibility 220ms ease;
}

#zoffice-preloader[hidden] { display: none; }
#zoffice-preloader.is-complete { opacity: 0; visibility: hidden; }

.zoffice-preloader-card {
  position: relative;
  isolation: isolate;
  width: min(100%, 430px);
  overflow: hidden;
  padding: clamp(24px, 7vw, 38px);
  border: 1px solid var(--preload-line);
  border-radius: 26px;
  background: linear-gradient(150deg, #173230, var(--preload-panel) 64%, #102326);
  box-shadow: 0 26px 90px rgb(0 0 0 / 32%), inset 0 1px rgb(255 255 255 / 4%);
}

.zoffice-preloader-card::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(#ffffff06 1px, transparent 1px), linear-gradient(90deg, #ffffff06 1px, transparent 1px);
  background-size: 30px 30px;
  mask-image: linear-gradient(120deg, transparent 16%, #000 100%);
}

.zoffice-preloader-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #c8f6e2;
  font-size: 12px;
  font-weight: 760;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.zoffice-preloader-brand img { width: 30px; height: 30px; object-fit: contain; }

.zoffice-preloader-art {
  position: relative;
  display: grid;
  place-items: center;
  height: 205px;
}

.zoffice-preloader-ring {
  display: grid;
  place-items: center;
  width: 154px;
  aspect-ratio: 1;
  padding: 4px;
  border-radius: 50%;
  background: conic-gradient(var(--preload-accent) var(--download-progress), rgb(116 221 185 / 12%) 0);
  box-shadow: 0 0 50px rgb(83 226 177 / 12%);
}

.zoffice-preloader-core {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border: 1px solid rgb(145 226 198 / 18%);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 28%, #244a43, #102629 72%);
}

.zoffice-preloader-core svg {
  width: 70px;
  color: #a9f5d5;
  filter: drop-shadow(0 9px 16px rgb(0 0 0 / 35%));
  animation: preload-float 3s ease-in-out infinite;
}

.zoffice-preloader-pilot {
  position: absolute;
  width: 154px;
  aspect-ratio: 1;
  transform: rotate(var(--download-angle));
  transition: transform 140ms ease-out;
}

.zoffice-preloader-pilot::after {
  content: "";
  position: absolute;
  left: 50%;
  top: -4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #d8fff0;
  box-shadow: 0 0 18px var(--preload-accent);
}

.is-indeterminate .zoffice-preloader-ring { background: conic-gradient(var(--preload-accent) 0 18%, rgb(116 221 185 / 10%) 32%); }
.is-indeterminate .zoffice-preloader-pilot { animation: preload-orbit 1.55s linear infinite; }

.zoffice-preloader-copy { text-align: center; }
.zoffice-preloader-stage { color: var(--preload-accent); font-size: 11px; font-weight: 760; letter-spacing: .15em; text-transform: uppercase; }
.zoffice-preloader-copy h1 { margin: 10px 0 7px; font-size: clamp(24px, 7vw, 31px); line-height: 1.15; letter-spacing: -.04em; }
.zoffice-preloader-copy p { min-height: 1.5em; margin: 0; color: var(--preload-muted); }

#zoffice-preloader-retry {
  margin-top: 20px;
  padding: 10px 15px;
  border: 1px solid #52766c;
  border-radius: 11px;
  color: var(--preload-ink);
  background: #214039;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

#zoffice-preloader-retry:hover { background: #2b5147; }
#zoffice-preloader-retry:focus-visible { outline: 2px solid #b5fbd9; outline-offset: 4px; }
.is-error .zoffice-preloader-ring { background: conic-gradient(#ff9c91 0 100%); }
.is-error .zoffice-preloader-pilot { display: none; }

@keyframes preload-orbit { to { transform: rotate(360deg); } }
@keyframes preload-float { 50% { transform: translateY(-7px) rotate(-2deg); } }

@media (max-height: 560px) {
  .zoffice-preloader-art { height: 155px; }
  .zoffice-preloader-ring, .zoffice-preloader-pilot { width: 122px; }
}

@media (prefers-reduced-motion: reduce) {
  #zoffice-preloader, .zoffice-preloader-pilot, .zoffice-preloader-core svg { animation: none !important; transition-duration: .001ms !important; }
}
