/*
 * The loading screen: plain CSS that paints with the HTML, before any script
 * runs. The colours are the default (Kafe) theme's, written out because the
 * theme's variables only exist once the app runs.
 */
html {
  background: #140d08;
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

.boot {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  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));
  background:
    radial-gradient(ellipse 60% 55% at 50% 0%, rgb(201 162 74 / 0.14), transparent 75%),
    radial-gradient(ellipse at 50% 55%, #2a1810, #140d08 75%);
  color: #f3e7d3;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  text-align: center;
  user-select: none;
  -webkit-user-select: none;
  transition: opacity 0.35s ease;
}

.boot--out {
  opacity: 0;
  pointer-events: none;
}

.boot__icon {
  width: 88px;
  height: 88px;
  border-radius: 22px;
  box-shadow: 0 10px 30px rgb(0 0 0 / 0.5);
  animation: boot-in 0.5s ease both;
}

.boot__name {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 34px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #c9a24a;
  animation: boot-in 0.5s ease 0.08s both;
}

/* An indeterminate bar: the size of what's left to load isn't known. */
.boot__bar {
  position: relative;
  width: min(220px, 60vw);
  height: 4px;
  overflow: hidden;
  border-radius: 2px;
  background: rgb(243 231 211 / 0.12);
}

.boot__bar span {
  position: absolute;
  inset: 0 auto 0 0;
  width: 40%;
  border-radius: 2px;
  background: #c9a24a;
  animation: boot-bar 1.2s ease-in-out infinite;
}

.boot__text {
  min-height: 1.4em;
  margin: 0;
  max-width: 36em;
  color: rgb(243 231 211 / 0.72);
  font-size: 14px;
  line-height: 1.4;
}

.boot__retry {
  min-height: 44px;
  padding: 0 22px;
  border: 0;
  border-radius: 12px;
  background: #c9a24a;
  color: #1c130c;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.boot__retry[hidden] {
  display: none;
}

.boot--failed .boot__bar {
  display: none;
}

@keyframes boot-bar {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(250%);
  }
}

@keyframes boot-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .boot__bar span {
    width: 100%;
    animation: none;
    opacity: 0.6;
  }

  .boot__icon,
  .boot__name {
    animation: none;
  }
}

/* Phones in landscape: one row is too tall, so the icon shrinks. */
@media (max-height: 420px) {
  .boot {
    gap: 10px;
  }

  .boot__icon {
    width: 64px;
    height: 64px;
    border-radius: 16px;
  }

  .boot__name {
    font-size: 28px;
  }
}
