/* Colours follow the theme picked in the game (see setGameTheme in index.html). Wood is the default. */
:root {
  --bg-top: #fce9c1; --bg-mid: #f1daa9; --bg-bottom: #e6cb92;
  --text: #542c13; --text-soft: #7a4a28; --shadow-rgb: 84,44,19; --title-shadow: rgba(255,255,255,.6);
  --bar: linear-gradient(90deg, #5a2f16, #8f5530 60%, #c07a3f);
  --button: linear-gradient(90deg, #5a2f16, #8b522e, #5a2f16);
  --apex-logo: url('apex-logo.png');
}
:root[data-theme="light"] {
  --bg-top: #eff3fe; --bg-mid: #dfe7ff; --bg-bottom: #cedbfe;
  --text: #141f38; --text-soft: #424f6a; --shadow-rgb: 20,31,56;
  --bar: linear-gradient(90deg, #141f38, #2f4c9a 60%, #4f7ff0);
  --button: linear-gradient(90deg, #141f38, #34467a, #141f38);
  --apex-logo: url('apex-logo-light.png');
}
:root[data-theme="dark"] {
  --bg-top: #1e2e54; --bg-mid: #151f38; --bg-bottom: #0b101c;
  --text: #eeeeee; --text-soft: #b9c8f5; --shadow-rgb: 0,0,0; --title-shadow: rgba(0,0,0,.45);
  --bar: linear-gradient(90deg, #ff3b4e, #8b5cf6 50%, #1e9bff);
  --button: linear-gradient(90deg, #2a3c6c, #43599a, #2a3c6c);
  --apex-logo: url('apex-logo-dark.png');
}

* { box-sizing: border-box; margin: 0; padding: 0 }
html, body { width: 100%; height: 100%; overflow: hidden; background: var(--bg-bottom); font-family: "Segoe UI", Arial, sans-serif; color: var(--text) }

#unity-container { position: fixed; inset: 0; display: flex; flex-direction: column }
#game-area { position: relative; flex: 1; min-height: 0 }
#unity-canvas { display: block; width: 100%; height: 100%; background: var(--bg-mid); outline: none }

/* ---------- Loading screen ---------- */
#unity-loading-bar {
  position: absolute; inset: 0; z-index: 2;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: linear-gradient(180deg, var(--bg-top) 0%, var(--bg-mid) 50%, var(--bg-bottom) 100%);
  transition: opacity .45s ease;
}
#unity-loading-bar.done { opacity: 0; pointer-events: none }

#game-logo {
  width: clamp(110px, 24vmin, 190px); height: clamp(110px, 24vmin, 190px);
  background: #fff url('game-logo.png') no-repeat center / 82%;
  border-radius: 24%;
  box-shadow: 0 16px 34px rgba(var(--shadow-rgb),.25), 0 0 0 6px rgba(255,255,255,.35);
  animation: float 2.6s ease-in-out infinite;
}
#game-title {
  margin-top: 26px; font-size: clamp(28px, 6vmin, 46px); font-weight: 800; letter-spacing: 2px;
  text-shadow: 0 2px 0 var(--title-shadow);
}
#progress-track {
  width: min(380px, 74%); height: 20px; margin-top: 26px; padding: 3px;
  background: rgba(128,128,128,.22); border: 1px solid rgba(128,128,128,.35); border-radius: 20px;
  box-shadow: inset 0 2px 5px rgba(var(--shadow-rgb),.3);
}
#unity-progress-bar-full {
  position: relative; width: 0; min-width: 12px; height: 100%; overflow: hidden; border-radius: 12px;
  background: var(--bar);
  box-shadow: 0 2px 8px rgba(var(--shadow-rgb),.4);
  transition: width .25s ease;
}
#unity-progress-bar-full::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: -52px; right: 0;
  background: repeating-linear-gradient(-45deg, rgba(255,255,255,.28) 0 9px, transparent 9px 18.4px);
  animation: stripes .9s linear infinite;
}
#progress-text { margin-top: 12px; font-size: 14px; letter-spacing: 3px; font-weight: 600; color: var(--text-soft) }

@keyframes float { 0%, 100% { transform: translateY(0) } 50% { transform: translateY(-10px) } }
@keyframes stripes { to { transform: translateX(26px) } }
@media (prefers-reduced-motion: reduce) { #game-logo, #unity-progress-bar-full::after { animation: none } }

/* ---------- Footer ---------- */
#unity-footer {
  display: flex; align-items: center; gap: 16px; height: 58px; padding: 0 18px;
  background: var(--bg-bottom);
}
#apex-logo { width: 190px; height: 38px; background: var(--apex-logo) no-repeat left center / contain }
#unity-build-title { margin-left: auto; font-size: 18px; font-weight: 800; color: var(--text) }
#unity-fullscreen-button {
  width: 38px; height: 38px; cursor: pointer; border: 0; border-radius: 10px;
  background: url('fullscreen-button.png') no-repeat center, var(--button);
  box-shadow: 0 3px 8px rgba(var(--shadow-rgb),.35);
}
#unity-fullscreen-button:hover { filter: brightness(1.15) }
.unity-mobile #unity-footer { display: none }

#unity-warning {
  position: absolute; left: 50%; top: 5%; z-index: 3; transform: translateX(-50%);
  display: none; padding: 10px; background: #fff; color: #111;
}
