/* ============================================================
   Cubit WebGL loading template
   Theme sourced from 2D_AppIcon_Cubit.png
   ============================================================ */
:root {
  --bg-top:      #F7EAA8;
  --bg-bottom:   #F1DC88;
  --purple:      #A768E0;
  --purple-lite: #C79BF0;
  --purple-deep: #8E4FD1;
  --seam:        #7E5AB8;
  --shadow-col:  #C9B679;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-bottom);
  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;
  justify-content: center;
  gap: clamp(28px, 5vh, 56px);
  background:
    radial-gradient(120% 120% at 50% 12%, var(--bg-top) 0%, var(--bg-bottom) 78%);
  transition: opacity .6s ease;
}
#cubit-loader.hidden { opacity: 0; pointer-events: none; }

/* ---- Wordmark --------------------------------------------- */
#cubit-logo {
  width: clamp(180px, 34vw, 420px);
  height: auto;
  filter: drop-shadow(0 3px 0 rgba(126, 90, 184, .55))
          drop-shadow(0 6px 14px rgba(126, 90, 184, .30));
  user-select: none;
  -webkit-user-drag: none;
}

/* ---- Stage (cube + bubbles + shadow) ---------------------- */
#cubit-stage {
  position: relative;
  width: clamp(200px, 30vw, 300px);
  height: clamp(210px, 32vw, 320px);
  display: flex;
  align-items: center;
  justify-content: center;
}

#cubit-cube {
  width: 62%;
  height: auto;
  transform-origin: 50% 55%;
  animation: cube-float 3.4s ease-in-out infinite;
  will-change: transform;
  z-index: 2;
}

#cubit-shadow {
  position: absolute;
  bottom: 6%;
  left: 50%;
  width: 46%;
  height: 8%;
  transform: translateX(-50%);
  background: radial-gradient(50% 50% at 50% 50%, var(--shadow-col) 0%, rgba(201,182,121,0) 72%);
  opacity: .55;
  animation: shadow-pulse 3.4s ease-in-out infinite;
  z-index: 1;
}

/* floating purple bubbles */
.bubble {
  position: absolute;
  border-radius: 50%;
  border: 3px solid var(--purple);
  background: rgba(199,155,240,.35);
  animation: bubble-float 4.5s ease-in-out infinite;
  z-index: 2;
}
.bubble.b1 { width: 20px; height: 20px; top: 8%;  left: 12%; animation-delay: -.2s; }
.bubble.b2 { width: 12px; height: 12px; top: 20%; right: 10%; animation-delay: -1.4s; }
.bubble.b3 { width: 16px; height: 16px; bottom: 24%; left: 6%; animation-delay: -2.6s; }
.bubble.b4 { width: 10px; height: 10px; bottom: 30%; right: 14%; animation-delay: -3.3s; }

@keyframes cube-float {
  0%, 100% { transform: translateY(6px)  rotate(-1.6deg); }
  50%      { transform: translateY(-12px) rotate(1.6deg); }
}
@keyframes shadow-pulse {
  0%, 100% { opacity: .60; transform: translateX(-50%) scale(1.08); }
  50%      { opacity: .38; transform: translateX(-50%) scale(0.86); }
}
@keyframes bubble-float {
  0%, 100% { transform: translateY(0);    opacity: .85; }
  50%      { transform: translateY(-14px); opacity: 1; }
}

/* ---- Progress bar ----------------------------------------- */
#cubit-progress {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: clamp(220px, 42vw, 460px);
}
#cubit-progress-track {
  position: relative;
  width: 100%;
  height: 18px;
  border-radius: 999px;
  background: rgba(255,255,255,.55);
  box-shadow: inset 0 2px 4px rgba(126,90,184,.22),
              0 1px 0 rgba(255,255,255,.7);
  overflow: hidden;
}
#cubit-progress-fill {
  width: 0%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--purple-lite) 0%, var(--purple) 55%, var(--purple-deep) 100%);
  box-shadow: 0 0 12px rgba(167,104,224,.65);
  transition: width .28s ease-out;
}
/* moving sheen on the fill */
#cubit-progress-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,.45) 50%, transparent 100%);
  transform: translateX(-100%);
  animation: sheen 1.6s ease-in-out infinite;
}
@keyframes sheen {
  0%   { transform: translateX(-100%); }
  60%, 100% { transform: translateX(300%); }
}
#cubit-progress-pct {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .12em;
  color: var(--purple-deep);
  text-shadow: 0 1px 0 rgba(255,255,255,.6);
}

/* ---- Fullscreen button ------------------------------------ */
#unity-fullscreen-button {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 30;
  width: 54px;
  height: 54px;
  border-radius: 16px;
  background: var(--purple);
  border: 2px solid rgba(255,255,255,.55);
  box-shadow: 0 6px 16px rgba(126,90,184,.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: #fff;
  /* 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: var(--purple-lite);
  transform: translateY(-2px);
  box-shadow: 0 9px 22px rgba(126,90,184,.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: #3a2a5c;
  font-size: 14px;
}

/* ---- Reduced motion --------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  #cubit-cube, #cubit-shadow, .bubble, #cubit-progress-fill::after {
    animation: none;
  }
}

/* ---- Small screens ---------------------------------------- */
@media (max-width: 520px) {
  #cubit-loader { gap: 26px; }
  #unity-fullscreen-button { width: 48px; height: 48px; }
}
