:root {
  background: #fdfcf9;
  color: #1a1a1a;
}

html,
body {
  min-height: 100%;
  background: #fdfcf9;
}

.app-starting body {
  overflow: hidden;
}

.app-starting #root {
  visibility: hidden;
}

.app-startup {
  position: fixed;
  inset: 0;
  z-index: 2147483647;
  display: none;
  min-height: 100vh;
  min-height: 100svh;
  place-items: center;
  overflow: hidden;
  padding: max(24px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
  box-sizing: border-box;
  background: #fdfcf9;
  color: #1a1a1a;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  opacity: 1;
}

.app-startup.app-startup--active {
  display: grid;
}

.app-startup__content {
  display: flex;
  width: 100%;
  max-width: 420px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.app-startup__logo {
  display: block;
  /* Match the native PWA splash icon rather than restarting branding with a lockup. */
  width: min(28vw, 112px);
  height: auto;
  object-fit: contain;
  opacity: 1;
  transform: none;
}

.app-startup__logo-fallback {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.25rem, 12vw, 4rem);
  line-height: 1;
  letter-spacing: 0.02em;
}

/*
 * Infinity loader (adaptasi statis loading-ui "Infinity Loop"): jalur yang
 * sama, dash 80/20 yang bergeser sepanjang panjang jalur (256.59) secara
 * linear 2s. Jejak ink tipis + dash gold-dark; ukuran tetap (atribut
 * width/height di markup) sehingga tidak ada pergeseran tata letak. Hanya
 * elemen loader yang bergerak - logo tetap statis sejak frame pertama.
 */
.app-startup__loader {
  display: block;
  flex: none;
  width: 48px;
  height: 24px;
  margin-top: 20px;
  overflow: visible;
}

.app-startup__loader path {
  fill: none;
  stroke-width: 7;
  stroke-linecap: round;
}

.app-startup__loader-track {
  stroke: rgba(26, 26, 26, 0.1);
}

.app-startup__loader-dash {
  stroke: #b0873f;
  stroke-dasharray: 205.27 51.32;
  animation: app-startup-infinity 2s linear infinite;
}

@keyframes app-startup-infinity {
  to {
    stroke-dashoffset: 256.59;
  }
}

/* Gagal/lambat: umpan balik pemulihan menggantikan loader (bukan ditumpuk). */
.app-startup--recovery .app-startup__loader {
  display: none;
}

.app-startup__recovery {
  display: flex;
  max-width: 320px;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: 28px;
  color: #66615a;
  font-size: 0.875rem;
  line-height: 1.5;
}

.app-startup__recovery[hidden] {
  display: none;
}

.app-startup__recovery strong {
  color: #1a1a1a;
  font-size: 1rem;
}

.app-startup__recovery button {
  min-height: 44px;
  margin-top: 10px;
  padding: 0 22px;
  border: 0;
  border-radius: 12px;
  background: #1a1a1a;
  color: #fdfcf9;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.app-startup__recovery button:focus-visible {
  outline: 2px solid #c8a05f;
  outline-offset: 3px;
}

.app-startup--recovery .app-startup__logo {
  width: min(26vw, 104px);
}

.app-noscript {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  box-sizing: border-box;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 32px;
  background: #fdfcf9;
  color: #1a1a1a;
  font-family: ui-sans-serif, system-ui, sans-serif;
  text-align: center;
}

.app-noscript span {
  color: #66615a;
}

@media (max-height: 680px) {
  .app-startup__logo {
    width: min(26vw, 104px);
  }
}

@media (min-width: 768px) {
  .app-startup__logo {
    width: 112px;
  }

  .app-startup--recovery .app-startup__logo {
    width: 104px;
  }
}

/* Gerak dikurangi: tanda infinity statis utuh (tanpa loop). */
@media (prefers-reduced-motion: reduce) {
  .app-startup__loader-dash {
    animation: none;
    stroke-dasharray: none;
  }
}
