/* ============================================================
   Cubit WebGL loading template
   Themed after the in-game login splash: Lobby_AccountLanding's
   "Logging In..." pill over the Lobby_Background screenshot.
   ============================================================ */
@font-face {
  font-family: "Dongle";
  /* Latin subset of Assets/Plugins/TextMesh Pro/Fonts/Dongle-Regular.ttf —
     the full face is 4.4 MB of Hangul, far too much for a loading screen. */
  src: url("dongle-latin.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Average colour of cubit-bg.jpg — shows while the JPEG is still decoding. */
  --bg-fallback: #A6AB68;
  --pill-fill:   rgba(50, 55, 93, .78);   /* #32375D @ 0.78 */
  --pill-stroke: #555885;
  --cream:       #FEF2EA;                 /* logo, label and spinner tint */
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-fallback);
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

#unity-container { position: absolute; inset: 0; }

#unity-canvas {
  width: 100%;
  height: 100%;
  display: block;
  background: transparent;
}
#unity-container.unity-mobile #unity-canvas,
#unity-container.unity-mobile { width: 100%; height: 100%; }

/* ---- Loading overlay -------------------------------------- */
#cubit-loader {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: url("cubit-bg.jpg") center / cover no-repeat, var(--bg-fallback);
  transition: opacity .6s ease;
}
#cubit-loader.hidden { opacity: 0; pointer-events: none; }

/* ---- Wordmark --------------------------------------------- */
/* Mirrors the splash prefab: wide wordmark high on the screen, carrying the
   soft shadow its Unity shadow component draws (size 12, y -4, white .13). */
#cubit-logo {
  width: clamp(190px, 33vw, 620px);
  height: auto;
  margin-top: 9vh;
  filter: drop-shadow(0 4px 0 rgba(255, 255, 255, .13))
          drop-shadow(0 6px 18px rgba(50, 55, 93, .35));
  user-select: none;
  -webkit-user-drag: none;
}

/* ---- Status pill ------------------------------------------ */
/* SystemButton geometry from the RefreshingLogin instance: 219.3 x 53.6 with a
   40px Dongle label and a 32px spinner, on an 800x600 reference canvas. Sizes
   below are expressed in em off the label so the whole pill scales as one. */
#cubit-pill {
  position: absolute;
  top: 81%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: .42em;
  padding: .1em .62em .22em;
  border: max(2px, .05em) solid var(--pill-stroke);
  border-radius: .4em;
  background: var(--pill-fill);
  font-family: "Dongle", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  font-size: clamp(26px, 5.9vh, 58px);
  line-height: 1;
  letter-spacing: -.05em;
  color: var(--cream);
  white-space: nowrap;
}

/* The source PNG is pure white with alpha, so it is masked rather than drawn —
   that tints it to the same cream as the label, like #unity-fullscreen-button. */
#cubit-spinner {
  width: .8em;
  height: .8em;
  flex: none;
  background: var(--cream);
  -webkit-mask: url("circle-loading.png") center / contain no-repeat;
          mask: url("circle-loading.png") center / contain no-repeat;
  /* RotateControllable speed z -200 deg/s → clockwise, 1.8s per turn. */
  animation: spin 1.8s linear infinite;
}

#cubit-status {
  /* Dongle sits low in its em box; nudge the baseline to the spinner's centre. */
  transform: translateY(-.06em);
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ---- Fullscreen button ------------------------------------ */
#unity-fullscreen-button {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 30;
  width: 54px;
  height: 54px;
  border-radius: 16px;
  background: var(--pill-fill);
  border: 2px solid var(--pill-stroke);
  box-shadow: 0 6px 16px rgba(50, 55, 93, .45);
  cursor: pointer;
  display: none;                     /* revealed after load */
  align-items: center;
  justify-content: center;
  transition: background .15s ease, transform .12s ease, box-shadow .15s ease;
}
#unity-fullscreen-button::before {
  content: "";
  width: 24px;
  height: 24px;
  background: var(--cream);
  /* four-corner "expand" glyph */
  -webkit-mask: var(--fs-glyph) center / contain no-repeat;
          mask: var(--fs-glyph) center / contain no-repeat;
}
:root {
  --fs-glyph: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M3 9V3h6v2H5v4H3zm12-6h6v6h-2V5h-4V3zM5 15v4h4v2H3v-6h2zm14 0h2v6h-6v-2h4v-4z'/></svg>");
}
#unity-fullscreen-button:hover {
  background: #32375D;
  transform: translateY(-2px);
  box-shadow: 0 9px 22px rgba(50, 55, 93, .55);
}
#unity-fullscreen-button:active { transform: translateY(0); }

/* ---- Warning banner --------------------------------------- */
#unity-warning {
  position: fixed;
  left: 50%;
  top: 16px;
  transform: translateX(-50%);
  z-index: 40;
  color: #32375D;
  font-size: 14px;
}

/* ---- Reduced motion --------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  #cubit-spinner { animation: none; }
}

/* ---- Small screens ---------------------------------------- */
@media (max-width: 520px) {
  #cubit-logo { width: clamp(170px, 56vw, 320px); margin-top: 12vh; }
  #cubit-pill { font-size: clamp(24px, 5.2vh, 40px); }
  #unity-fullscreen-button { width: 48px; height: 48px; }
}
