/* Hogwarts Broom Flight Simulator — full-screen canvas UI */

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

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #1a2a48;
  color: #e8e4d8;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

#canvas-container {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
}

#canvas-container canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
  outline: none;
}

/* ——— HUD ——— */
#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
  font-variant-numeric: tabular-nums;
}

#hud-top-right {
  position: absolute;
  top: 1rem;
  right: 1rem;
  text-align: right;
  background: rgba(4, 8, 18, 0.55);
  border: 1px solid rgba(212, 175, 55, 0.25);
  border-radius: 8px;
  padding: 0.65rem 0.9rem;
  backdrop-filter: blur(6px);
  min-width: 11rem;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.45);
}

#hud-top-right .row {
  display: flex;
  justify-content: space-between;
  gap: 1.25rem;
  font-size: 0.78rem;
  line-height: 1.55;
  letter-spacing: 0.02em;
}

#hud-top-right .label {
  color: rgba(212, 175, 55, 0.75);
  text-transform: uppercase;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
}

#hud-top-right .value {
  color: #f5f0e6;
  font-weight: 600;
}

#hud-top-right .route-value {
  color: #ffd86b;
  max-width: 12rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#hud-hint {
  position: absolute;
  bottom: 1.25rem;
  left: 1.25rem;
  font-size: 0.78rem;
  color: rgba(232, 228, 216, 0.88);
  background: rgba(4, 8, 18, 0.5);
  border: 1px solid rgba(212, 175, 55, 0.2);
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  backdrop-filter: blur(6px);
  opacity: 1;
  transition: opacity 1.2s ease;
  max-width: min(28rem, calc(100vw - 2.5rem));
  line-height: 1.4;
}

#hud-hint.faded {
  opacity: 0;
  pointer-events: none;
}

#hud-paused {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.1rem;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: rgba(255, 216, 107, 0.95);
  background: rgba(4, 8, 18, 0.65);
  border: 1px solid rgba(212, 175, 55, 0.4);
  padding: 0.75rem 1.5rem;
  border-radius: 6px;
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}

#hud-paused.visible {
  opacity: 1;
}

/* Accessibility: reduced motion softens UI transitions */
@media (prefers-reduced-motion: reduce) {
  #hud-hint {
    transition: opacity 0.4s ease;
  }

  #hud-paused {
    transition: none;
  }
}

/* Loading overlay */
#loading {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, #0a1020 0%, #02040a 70%);
  transition: opacity 0.8s ease, visibility 0.8s ease;
}

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

#loading h1 {
  font-size: clamp(1.25rem, 3vw, 1.85rem);
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #d4af37;
  margin-bottom: 1.5rem;
  text-align: center;
  padding: 0 1rem;
}

#loading .bar {
  width: min(220px, 50vw);
  height: 3px;
  background: rgba(212, 175, 55, 0.15);
  border-radius: 2px;
  overflow: hidden;
}

#loading .bar-fill {
  height: 100%;
  width: 30%;
  background: linear-gradient(90deg, #8b6914, #d4af37, #ffd86b);
  border-radius: 2px;
  animation: load-slide 1.1s ease-in-out infinite;
}

@keyframes load-slide {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(400%);
  }
}

@media (prefers-reduced-motion: reduce) {
  #loading .bar-fill {
    animation: none;
    width: 100%;
    transform: none;
  }
}
