/* EKADOESA WebGL template — layar splash/loading gaya Figma "Does Multiplayer — Masuk" (30 Nov 2026) */
@font-face {
  font-family: "Lilita One";
  src: url("fonts/LilitaOne-Regular.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Nunito";
  src: url("fonts/Nunito-ExtraBold.woff2") format("woff2");
  font-weight: 800; font-style: normal; font-display: swap;
}

:root {
  --app-height: 100vh;
  /* Lebar "frame Figma" 1589 x 975: muat utuh di layar (contain) */
  --fw: min(100vw, calc(var(--app-height) * 1.6297));
}
html, body { padding: 0; margin: 0; background: #1a7cf4; overflow: hidden; width: 100%; height: 100%; }
body { overscroll-behavior: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
#unity-container { position: absolute; width: 100%; height: 100%; top: 0; left: 0; }
#unity-container.unity-desktop { width: 100%; height: 100%; left: 0; top: 0; transform: none; }
#unity-container.unity-mobile { position: fixed; inset: 0; width: 100vw; height: var(--app-height); }
#unity-canvas { background: #1a7cf4; width: 100% !important; height: 100% !important; display: block; touch-action: none; }
.unity-mobile #unity-canvas { width: 100%; height: 100%; }

/* ---------- Splash / loading ---------- */
#unity-loading-bar {
  position: absolute;
  inset: 0;
  background: #1a7cf4 url("bg-splash.jpg") no-repeat center center;
  background-size: cover;
  display: flex;
  overflow: hidden;
  z-index: 100;
  opacity: 1;
  transition: opacity 0.5s ease;
}
#unity-loading-bar.is-done { opacity: 0; pointer-events: none; }
#unity-logo { display: none !important; }

#splash-frame {
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--fw);
  height: calc(var(--fw) * 0.6136);
  transform: translate(-50%, -50%);
  pointer-events: none;
}
#splash-logo {
  position: absolute;
  left: 50%;
  top: 16.06%;
  width: 19.69%;
  height: auto;
  transform: translateX(-50%);
  filter: drop-shadow(0 calc(var(--fw) * 0.003) calc(var(--fw) * 0.008) rgba(20, 80, 190, 0.35));
}
#splash-title,
#splash-subtitle {
  position: absolute;
  left: 0;
  right: 0;
  margin: 0;
  text-align: center;
  color: #fff;
  font-family: "Lilita One", "Arial Black", Impact, sans-serif;
  font-weight: 400;
  line-height: 1.143;
  white-space: nowrap;
  text-shadow: 0 calc(var(--fw) * 0.004) calc(var(--fw) * 0.012) rgba(20, 80, 190, 0.35);
}
#splash-title { top: 38.06%; font-size: calc(var(--fw) * 0.1247); }
#splash-subtitle { top: 57.79%; font-size: calc(var(--fw) * 0.03755); }

#splash-progress {
  position: absolute;
  left: 50%;
  bottom: max(7%, calc(env(safe-area-inset-bottom) + 24px));
  transform: translateX(-50%);
  width: min(560px, 72vw);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
#unity-progress-bar-empty {
  width: 100%;
  height: 22px;
  padding: 3px;
  box-sizing: border-box;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
  border: 2px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 6px 18px rgba(20, 70, 160, 0.28);
  overflow: hidden;
}
#unity-progress-bar-full {
  width: 0%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(180deg, #4FC7FF 0%, #2961FF 100%);
  transition: width 0.15s ease-out;
}
#unity-loading-text {
  color: #fff;
  font: 800 18px/1.2 "Nunito", "Segoe UI", Arial, sans-serif;
  letter-spacing: 0.3px;
  text-shadow: 0 2px 6px rgba(15, 55, 130, 0.6);
}

/* Portrait (HP berdiri): judul diperbesar, frame boleh lebih lebar dari layar (tetap di tengah) */
@media (orientation: portrait) {
  :root { --fw: min(165vw, calc(var(--app-height) * 1.6297)); }
  #splash-frame { top: 46%; }
  #splash-progress { width: 80vw; bottom: max(9%, calc(env(safe-area-inset-bottom) + 28px)); }
  #unity-loading-text { font-size: 16px; }
}

/* ---------- Pesan crash memori (HP) ---------- */
#crash-notice {
  display: none;
  position: absolute; inset: 0; z-index: 200;
  align-items: center; justify-content: center;
  padding: 24px; box-sizing: border-box;
  background: linear-gradient(rgba(10, 41, 89, 0.45), rgba(10, 41, 89, 0.45)), #1a7cf4 url("bg-splash.jpg") no-repeat center / cover;
  font: 800 15px/1.45 "Nunito", "Segoe UI", Arial, sans-serif;
}
#crash-notice .crash-card {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  width: 100%; max-width: 480px; box-sizing: border-box;
  padding: 26px 26px 24px;
  border-radius: 28px;
  border: 3px solid #E4F5FF;
  background: linear-gradient(180deg, #CCE6FF 0%, #E8FCF9 100%);
  box-shadow: 0 12px 36px rgba(10, 41, 89, 0.35);
  color: #3B659D; text-align: center;
}
#crash-notice p { margin: 0; }
#crash-notice .crash-title { color: #267AFF; font: 400 28px/1.15 "Lilita One", "Arial Black", sans-serif; }
#crash-notice ul { text-align: left; margin: 4px 0 8px; padding-left: 20px; }
#crash-notice button {
  background: linear-gradient(90deg, #27C9F1 0%, #3D71FF 100%);
  color: #fff; border: 0; border-radius: 999px;
  padding: 13px 34px; font: 800 17px/1 "Nunito", "Segoe UI", Arial, sans-serif;
  box-shadow: 0 6px 16px rgba(40, 110, 230, 0.35);
  cursor: pointer;
}

#unity-footer { position: fixed; bottom: 12px; right: 16px; z-index: 50; }
.unity-mobile #unity-footer { display: none; }
#unity-logo-title-footer { display: none; }
#unity-build-title { display: none; }
#unity-fullscreen-button { cursor: pointer; width: 36px; height: 36px; background: url('fullscreen-button.png') no-repeat center; opacity: 0.6; }
#unity-fullscreen-button:hover { opacity: 1; }
#unity-warning { position: absolute; left: 50%; top: 5%; transform: translate(-50%); background: #267AFF; color: #fff; padding: 10px 20px; border-radius: 14px; font: 800 14px/1.3 "Nunito", Arial, sans-serif; display: none; z-index: 1000; }
