/* ===== Page & background ===== */
:root {
  --game-bg: #121213;
  --vvh: 100dvh;
  --vvo: 0px;
  --logo-size: 120px;
  --logo-pad: 16px;
}

/* Prevent focus-zoom and text auto-resize on mobile */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
input, textarea, select, [contenteditable="true"] { font-size: 16px !important; }

html, body {
  height: 100dvh;
  margin: 0;
  overflow: hidden;
  background: var(--game-bg);
}

/* ===== Container (no transforms; just center) ===== */
#unity-container,
#unity-container.unity-desktop,
#unity-container.unity-mobile {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: var(--vvh);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  transform: translateY(var(--vvo));
  left: auto;
  top: auto;
  z-index: 10;
}

/* ===== Canvas (let flex centering work; always fit window, keep 9:16) ===== */
#unity-canvas {
  position: static;                /* <-- critical: kills template absolute/translate */
  display: block;
  width:  100vw;
  height: var(--vvh, 100vh);
  background: transparent;         /* let Unity's background show through */
  z-index: 10;
}

/* Remove old mobile rule that forced 100% x 100% */
.unity-mobile #unity-canvas {
  width: 100%;
  height: 100%;
}

/* ===== Loading overlay (simple centered column) ===== */
#unity-loading-bar {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;                        /* space between logo and bar */
  pointer-events: none;
}

/* Kill template sprite; use your <img> instead */
#unity-logo {
  width: auto;
  height: auto;
  background: none;
}
#unity-logo img {
  display: block;
  width: min(14vmin, 160px);
  height: auto;
}

/* Progress bar track + fill */
#unity-progress-bar-empty {
  display: block !important;        /* overrides any inline style="display:none" */
  width: min(60vmin, 420px);
  height: 10px;
  border-radius: 6px;
  overflow: hidden;
  background: #2b2b2b;
}
#unity-progress-bar-full {
  height: 100%;
  width: 0%;
  background: #ff7a00;
}

/* (Optional) fullscreen button */
#unity-fullscreen-button { position: fixed; right: 16px; bottom: 16px; }

a#brand-logo {
  position: fixed;
  left: calc(var(--logo-pad) + env(safe-area-inset-left));
  bottom: calc(var(--logo-pad) + env(safe-area-inset-bottom));
  z-index: 1100;
  opacity: 0;
  visibility: hidden;
  transition: opacity 180ms ease;
}
a#brand-logo img {
  width: var(--logo-size);
  height: auto;
  display: block;
  -webkit-user-drag: none;
}

body.game-ready #brand-logo { opacity: 1; visibility: visible; }
body.logo-hidden #brand-logo { display: none !important; }

#unity-canvas,
#unity-canvas:focus,
#unity-canvas:focus-visible {
  outline: none !important;
  box-shadow: none !important;
}

body { -webkit-tap-highlight-color: transparent; }

/* The snackbar - position it at the bottom and in the middle of the screen */
#snackbar {
  visibility: hidden;
  min-width: 250px;
  background-color: #333;
  color: #fff;
  text-align: center;
  border-radius: 2px;
  padding: 16px;
  position: fixed;
  z-index: 2000;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 30px);
  transform: translateX(-50%);
}

#snackbar.show {
  visibility: visible;
  -webkit-animation: fadein 0.5s, fadeout 0.5s 2.5s;
  animation: fadein 0.5s, fadeout 0.5s 2.5s;
}

/* Animations to fade the snackbar in and out */
@-webkit-keyframes fadein {
  from {bottom: 0; opacity: 0;}
  to {bottom: calc(env(safe-area-inset-bottom, 0px) + 30px); opacity: 1;}
}

@keyframes fadein {
  from {bottom: 0; opacity: 0;}
  to {bottom: calc(env(safe-area-inset-bottom, 0px) + 30px); opacity: 1;}
}

@-webkit-keyframes fadeout {
  from {bottom: calc(env(safe-area-inset-bottom, 0px) + 30px); opacity: 1;}
  to {bottom: 0; opacity: 0;}
}

@keyframes fadeout {
  from {bottom: calc(env(safe-area-inset-bottom, 0px) + 30px); opacity: 1;}
  to {bottom: 0; opacity: 0;}
}