/*
 * Only what the browser needs before Compose takes over: a full-bleed canvas and a splash
 * screen that paints in the first frame, long before the WebAssembly has downloaded.
 */
:root {
  --bg: #fdf7ff;
  --fg: #1d1a22;
  --muted: #5f5868;
  --track: #e8def8;
  --kotlin-a: #7f52ff;
  --kotlin-b: #c711e1;
  --kotlin-c: #e44857;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141218;
    --fg: #e6e0e9;
    --muted: #b3aabd;
    --track: #2b2930;
  }
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: var(--bg);
}

/* Compose clears and fills this container; the splash is a sibling so it survives. */
#app {
  position: fixed;
  inset: 0;
}

canvas {
  display: block;
  outline: none;
}

#splash a {
  color: var(--kotlin-a);
}

#splash {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 16px;
  background: var(--bg);
  color: var(--fg);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  text-align: center;
  transition: opacity 320ms ease-out, visibility 320ms;
}

#splash.done {
  opacity: 0;
  visibility: hidden;
}

#splash .mark {
  width: 72px;
  height: 72px;
  border-radius: 22px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--kotlin-a), var(--kotlin-b) 55%, var(--kotlin-c));
  color: #fff;
  font-weight: 700;
  font-size: 28px;
  letter-spacing: 0.02em;
  box-shadow: 0 10px 30px rgb(127 82 255 / 0.35);
}

#splash h1 {
  margin: 4px 0 0;
  font-size: clamp(22px, 4vw, 30px);
  font-weight: 650;
  letter-spacing: -0.01em;
}

#splash p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
}

#splash .track {
  width: min(220px, 60vw);
  height: 4px;
  border-radius: 2px;
  background: var(--track);
  overflow: hidden;
}

#splash .track::after {
  content: "";
  display: block;
  width: 40%;
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--kotlin-a), var(--kotlin-b));
  animation: slide 1.1s ease-in-out infinite;
}

#splash .error {
  display: none;
  max-width: 420px;
}

#splash.failed .track {
  display: none;
}

#splash.failed .error {
  display: block;
}

@keyframes slide {
  from { transform: translateX(-100%); }
  to { transform: translateX(250%); }
}

@media (prefers-reduced-motion: reduce) {
  #splash .track::after { animation: none; width: 100%; opacity: 0.5; }
  #splash { transition: none; }
}

/* Readable by crawlers and by assistive technology that cannot see into the canvas. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
