/* =========================================================
   Legends of Forgotten Realms — WebGL Template styles
   Canvas aspect ratio: 16:9 (1920×1080)
   ========================================================= */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0d0b0e; /* fallback if background image fails */
  font-family: Arial, sans-serif;
}

/* ── Background image ──────────────────────────────────── */
#background {
  position: fixed;
  inset: 0;
  /* Replace background.svg with background.jpg when you have the final asset */
  background-image: url("background.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  /* optional blur/darken to make the game stand out */
  filter: brightness(0.6) blur(2px);
  transform: scale(1.04); /* hide blur edges */
  z-index: 0;
}

/* ── Game wrapper — full viewport, centres the container ─ */
#game-wrapper {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  /* padding keeps the container away from screen edges */
  padding: 24px;
  z-index: 1;
}

/* ── Game container — fixed 16:9, max 1920×1080 ─────────
   The trick:
     width = min(viewport_w - 2*padding, (viewport_h - 2*padding) * 16/9, 1920px)
   height follows automatically from aspect-ratio.
   ───────────────────────────────────────────────────────── */
#game-container {
  position: relative;
  width: min(
    calc(100vw - 48px),
    calc((100vh - 48px) * (16 / 9)),
    1920px
  );
  aspect-ratio: 16 / 9;
  max-height: 1080px;
  /* subtle shadow to lift the game off the background */
  box-shadow: 0 8px 48px rgba(0, 0, 0, 0.7);
  border-radius: 16px;
  overflow: hidden;
}

/* ── Unity canvas — fills the container exactly ─────────── */
#unity-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* ── Loading overlay ─────────────────────────────────────── */
#loading-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0d0b0e;
  transition: opacity 0.5s ease;
  z-index: 10;
}

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

#loading-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  width: 420px;
  max-width: 80%;
}

/* ── Logo ────────────────────────────────────────────────── */
#loading-logo {
  width: 280px;
  max-width: 100%;
  height: auto;
  /* gentle glow */
  filter: drop-shadow(0 0 16px rgba(180, 120, 40, 0.6));
}

/* ── Progress bar ────────────────────────────────────────── */
#progress-bar-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 3px;
  overflow: hidden;
}

#progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #b87828, #f0c060, #b87828);
  background-size: 200% 100%;
  border-radius: 3px;
  transition: width 0.25s ease;
  animation: shimmer 2s linear infinite;
}

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Progress label ──────────────────────────────────────── */
#progress-label {
  color: rgba(255, 255, 255, 0.5);
  font-size: 13px;
  letter-spacing: 0.08em;
}
