/* §174: page around the canvas. Same palette as ui/theme.css. */
html, body { margin: 0; padding: 0; width: 100%; height: 100%; overflow: hidden; background: #0b0f12; color: #e7ecef; }
body { font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; -webkit-font-smoothing: antialiased; }

/* §174.9: the stage is the whole browser window — canvas and HTML windows
   (#hex-ui, inset 0) always the same size. */
#unity-container { position: fixed; inset: 0; }
#hex-stage { position: absolute; inset: 0; line-height: 0; overflow: hidden; background: #231F20; }
#unity-canvas { display: block; width: 100%; height: 100%; background: #231F20; }
#hex-ui { line-height: 1.35; }

/* §174.3: full screen is the stage — canvas and HTML windows together. */
#hex-stage:fullscreen { width: 100vw; height: 100vh; background: #000; }
#hex-stage:-webkit-full-screen { width: 100vw; height: 100vh; background: #000; }

/* ---- §174.9: before Unity starts --------------------------------------- */
#unity-loading-bar {
  position: absolute; inset: 0; z-index: 5; display: none; line-height: 1.35;
  background: #16202a url("loader-bg.webp") center / cover no-repeat;
  transition: opacity 450ms ease;
}
#unity-loading-bar::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(to top, rgb(0 0 0 / 0.78), rgb(0 0 0 / 0.35) 28%, transparent 48%),
    radial-gradient(ellipse at 50% 40%, transparent 55%, rgb(0 0 0 / 0.35));
}
#unity-loading-bar.hex-loader--done { opacity: 0; pointer-events: none; }
/* Where Unity's title screen puts the same logo (LoadingScreen: 36, 20, 360 wide at 1080). */
#hex-loader-logo {
  position: absolute; z-index: 1; left: 3.3vh; top: 1.85vh; width: 33.3vh; height: auto;
  filter: drop-shadow(0 6px 18px rgb(0 0 0 / 0.5));
  animation: hex-loader-in 700ms cubic-bezier(0.2, 0.9, 0.3, 1) both;
}
#hex-loader-bottom {
  position: absolute; z-index: 1; left: 0; right: 0; bottom: 0;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 0 24px max(28px, 4.5vh);
}
#hex-loader-row { width: min(60%, 736px); display: flex; justify-content: space-between; gap: 16px; }
#hex-loader-status { color: rgb(236 232 221); font-size: 15px; letter-spacing: 0.04em; text-shadow: 0 1px 8px rgb(0 0 0 / 0.6); }
#hex-loader-status::after { content: ""; display: inline-block; width: 1.2em; text-align: left; animation: hex-dots 1.4s steps(4) infinite; }
#hex-loader-percent { color: rgb(240 180 92); font-weight: 700; font-variant-numeric: tabular-nums; }
#unity-progress-bar-empty {
  width: min(60%, 736px); height: 8px; border-radius: 999px; overflow: hidden;
  background: rgb(255 255 255 / 0.15); box-shadow: 0 2px 12px rgb(0 0 0 / 0.35);
}
#unity-progress-bar-full {
  width: 0%; height: 100%; border-radius: inherit;
  background: linear-gradient(90deg, rgb(242 191 89), rgb(247 210 140) 50%, rgb(242 191 89)) 0 0 / 200% 100%;
  transition: width 240ms ease-out; animation: hex-shine 1.6s linear infinite;
}
#hex-loader-hint { color: rgb(154 166 173); font-size: 12px; letter-spacing: 0.04em; }
@keyframes hex-loader-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@keyframes hex-dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }
@keyframes hex-shine { to { background-position: -200% 0; } }
@media (max-width: 640px) {
  #hex-loader-logo { left: 50%; top: 6vh; width: min(70vw, 300px); transform: translateX(-50%); animation: none; }
  #hex-loader-row, #unity-progress-bar-empty { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  #hex-loader-logo, #unity-progress-bar-full, #hex-loader-status::after { animation: none; }
}

#unity-warning {
  position: absolute; left: 50%; top: 5%; transform: translate(-50%);
  display: none; line-height: 1.35; z-index: 10;
}
.hex-banner {
  margin-bottom: 6px; padding: 10px 14px; border-radius: 10px;
  background: rgb(19 24 28 / 0.95); border: 1px solid rgb(255 255 255 / 0.12); color: #e7ecef;
}
.hex-banner--warning { border-color: rgb(240 180 92); }
.hex-banner--error { background: rgb(120 30 28); border-color: rgb(191 51 46); }

/* §174.9: what was the footer under the canvas is a small corner button now —
   top right, the one corner the HUD leaves free (weather top left, speed top
   centre, roster from 4.25rem down, character card along the bottom). In full
   screen it steps aside (Esc leaves). */
#unity-footer {
  position: absolute; right: 0.875rem; top: 0.875rem; z-index: 6;
  display: flex; align-items: center; gap: 8px; line-height: 1.2;
  color: rgb(154 166 173); font-size: 13px; opacity: 0.55; transition: opacity 150ms;
}
#unity-footer:hover, #unity-footer:focus-within { opacity: 1; }
#hex-stage:fullscreen #unity-footer, #hex-stage:-webkit-full-screen #unity-footer { display: none; }
/* §174.7: in the world the HUD row carries the fullscreen button (ui/screens/hud.js). */
.hx-hud-on #unity-footer { display: none; }
.unity-mobile #unity-footer { display: none; }
#unity-build-title:empty { display: none; }
#unity-fullscreen-button {
  display: grid; place-items: center; width: 34px; height: 34px; padding: 0;
  border: 1px solid rgb(255 255 255 / 0.12); border-radius: 8px;
  background: rgb(19 24 28 / 0.8); color: #e7ecef; cursor: pointer;
}
#unity-fullscreen-button:hover { background: rgb(46 56 65); }
#unity-fullscreen-button svg { width: 18px; height: 18px; }
