@font-face {
  font-family: "Fredoka";
  src: url("Fredoka-SemiBold.ttf") format("truetype");
  font-weight: 600;
  font-display: swap;
}

:root {
  --sky: #8EC9FF;
  --sky-light: #CFE7FF;
  --cream: #FFF6E9;
  --butter: #FFD670;
  --mint: #7FD8BE;
  --mint-dark: #4FB89A;
  --lilac: #9B8CFF;
  --ink: #4A3B66;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: linear-gradient(180deg, var(--sky) 0%, var(--sky-light) 100%);
  font-family: "Fredoka", system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

/* 9:16 at the full window height on desktop; on a portrait phone the width runs out first and it fills the screen. */
#stage {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  height: 100vh;
  height: 100dvh;
  width: min(100vw, calc(100vh * 9 / 16));
  width: min(100vw, calc(100dvh * 9 / 16));
  background: var(--sky);
  box-shadow: 0 0 60px rgba(74, 59, 102, 0.18);
}

#unity-canvas {
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
  background: var(--sky);
}

#loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: linear-gradient(180deg, var(--sky) 0%, var(--sky-light) 70%, var(--cream) 100%);
  transition: opacity 0.5s ease;
}

#loading.done {
  opacity: 0;
  pointer-events: none;
}

#loading-icon {
  width: 34%;
  max-width: 168px;
  border-radius: 24%;
  box-shadow: 0 8px 0 rgba(74, 59, 102, 0.18);
  animation: bob 1.1s ease-in-out infinite alternate;
}

#loading-title {
  font-size: clamp(34px, 9vh, 72px);
  color: var(--butter);
  text-shadow: 0 4px 0 var(--lilac), 0 0 2px var(--lilac);
  -webkit-text-stroke: 2px #F2B840;
}

#loading-track {
  width: 62%;
  height: 22px;
  border-radius: 11px;
  background: var(--cream);
  box-shadow: inset 0 -4px 0 rgba(74, 59, 102, 0.12), 0 4px 0 rgba(74, 59, 102, 0.15);
  overflow: hidden;
}

#loading-fill {
  width: 6%;
  height: 100%;
  border-radius: 11px;
  background: var(--mint);
  box-shadow: inset 0 -5px 0 var(--mint-dark), inset 0 4px 0 rgba(255, 255, 255, 0.45);
  transition: width 0.2s ease;
}

#loading-note {
  font-size: 18px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--lilac);
}

#error {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  padding: 12px 16px;
  border-radius: 16px;
  background: var(--cream);
  color: var(--ink);
  font-size: 15px;
  box-shadow: 0 4px 0 rgba(74, 59, 102, 0.18);
}

@keyframes bob {
  from { transform: translateY(0) rotate(-3deg); }
  to { transform: translateY(-10px) rotate(3deg); }
}
