html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: #02030a;
  overflow: hidden;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
}

#c {
  width: 100vw;
  height: 100vh;
  display: block;
}

/* -------------------------
   HUD
-------------------------- */
#hud {
  position: fixed;
  top: 16px;
  left: 16px;
  width: 260px;
  padding: 14px 14px 12px;
  border-radius: 12px;
  background: rgba(10, 12, 24, 0.55);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(140, 165, 255, 0.18);
  color: rgba(210, 220, 255, 0.92);
  box-shadow: 0 18px 50px rgba(0,0,0,0.45);
  letter-spacing: 0.3px;
}

#hud .title {
  font-weight: 800;
  letter-spacing: 3px;
  font-size: 13px;
  opacity: 0.95;
  margin-bottom: 10px;
}

#hud .row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 3px 0;
  font-size: 12px;
}

#hud .label {
  opacity: 0.78;
}

.hud-divider {
  margin: 8px 0 6px;
  height: 1px;
  background: rgba(140, 165, 255, 0.16);
}

.wormhole-row .label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #d9c4ff;
  opacity: 0.95;
}

.wormhole-arrow {
  display: inline-block;
  font-size: 11px;
  color: #d9c4ff;
  text-shadow: 0 0 8px rgba(217, 196, 255, 0.9);
  transition: transform 120ms linear;
}

#wormholeDist {
  color: #e9dcff;
}

.controls-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid rgba(140, 165, 255, 0.3);
  background: rgba(140, 165, 255, 0.08);
  color: rgba(210, 220, 255, 0.85);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  line-height: 1;
}

.controls-btn:hover {
  background: rgba(140, 165, 255, 0.18);
}

.hud-hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
  transition: opacity 600ms ease, transform 600ms ease;
}

.hud-shown {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

/* -------------------------
   Player flag (ring overview "you are here" marker)
   Positioned via JS (left/top in px, projected from world space).
   Opacity is driven by JS to match the overview transition.
-------------------------- */
.player-flag {
  position: fixed;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
  z-index: 40;
  transition: opacity 120ms linear;
}

.player-flag-dot {
  position: absolute;
  left: -6px;
  top: -6px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #eaf2ff;
  box-shadow:
    0 0 10px 3px rgba(150, 190, 255, 0.85),
    0 0 26px 8px rgba(120, 160, 255, 0.45);
}

.player-flag-heading {
  position: absolute;
  left: -1px;
  top: -34px;
  width: 2px;
  height: 26px;
  background: linear-gradient(to top, rgba(234, 242, 255, 0.9), rgba(234, 242, 255, 0));
}

.player-flag-label {
  position: absolute;
  left: 0;
  top: 12px;
  transform: translateX(-50%);
  font-size: 10px;
  letter-spacing: 1.5px;
  color: rgba(230, 238, 255, 0.9);
  text-shadow: 0 0 6px rgba(0, 0, 0, 0.9), 0 1px 2px rgba(0, 0, 0, 0.9);
  white-space: nowrap;
}

/* -------------------------
   Boundary warning — flares in when pressing against the belt's
   containment field. Opacity driven by JS to match field intensity.
-------------------------- */
.boundary-warning {
  position: fixed;
  left: 50%;
  bottom: 12%;
  transform: translateX(-50%);
  text-align: center;
  opacity: 0;
  pointer-events: none;
  z-index: 45;
  transition: opacity 200ms ease;
}

.boundary-warning-title {
  font-weight: 800;
  letter-spacing: 4px;
  font-size: 13px;
  color: #bfe6ff;
  text-shadow: 0 0 14px rgba(120, 190, 255, 0.9), 0 0 30px rgba(120, 190, 255, 0.5);
}

.boundary-warning-text {
  margin-top: 6px;
  font-size: 12px;
  letter-spacing: 0.5px;
  color: rgba(220, 235, 255, 0.85);
  text-shadow: 0 0 8px rgba(0, 0, 0, 0.9), 0 1px 2px rgba(0, 0, 0, 0.9);
}

/* -------------------------
   Shared utility
-------------------------- */
.hidden {
  opacity: 0 !important;
  pointer-events: none !important;
}

/* -------------------------
   Controls help panel
-------------------------- */
.controls-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(340px, 86vw);
  padding: 20px 22px;
  border-radius: 14px;
  background: rgba(8, 10, 20, 0.88);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(140, 165, 255, 0.22);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
  color: rgba(215, 225, 255, 0.92);
  z-index: 60;
  transition: opacity 180ms ease;
}

.controls-panel-title {
  font-weight: 800;
  letter-spacing: 3px;
  font-size: 13px;
  margin-bottom: 14px;
  opacity: 0.9;
}

.controls-row {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  padding: 5px 0;
  opacity: 0.85;
  border-bottom: 1px solid rgba(140, 165, 255, 0.08);
}

.controls-row span:last-child {
  color: #bfe6ff;
  letter-spacing: 0.5px;
}

.controls-close-btn {
  margin-top: 16px;
  width: 100%;
  padding: 8px 0;
  border-radius: 8px;
  border: 1px solid rgba(140, 165, 255, 0.3);
  background: rgba(140, 165, 255, 0.1);
  color: rgba(220, 230, 255, 0.92);
  font-size: 12px;
  letter-spacing: 1px;
  cursor: pointer;
}

.controls-close-btn:hover {
  background: rgba(140, 165, 255, 0.2);
}

/* -------------------------
   Win screen
-------------------------- */
.win-screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: radial-gradient(circle at 50% 45%, rgba(60, 30, 110, 0.55), rgba(2, 3, 10, 0.94));
  z-index: 70;
  transition: opacity 500ms ease;
}

.win-title {
  font-weight: 900;
  letter-spacing: 8px;
  font-size: 28px;
  color: #ecdcff;
  text-shadow: 0 0 24px rgba(217, 196, 255, 0.9), 0 0 60px rgba(180, 140, 255, 0.5);
}

.win-sub {
  margin-top: 12px;
  font-size: 14px;
  color: rgba(225, 220, 245, 0.85);
  max-width: 420px;
  padding: 0 20px;
}

.win-stats {
  margin-top: 22px;
  font-size: 12.5px;
  letter-spacing: 0.5px;
  color: rgba(210, 220, 255, 0.75);
  line-height: 1.8;
}

.win-continue-btn {
  margin-top: 26px;
  padding: 10px 26px;
  border-radius: 10px;
  border: 1px solid rgba(217, 196, 255, 0.4);
  background: rgba(217, 196, 255, 0.12);
  color: #ecdcff;
  font-size: 13px;
  letter-spacing: 1.5px;
  cursor: pointer;
}

.win-continue-btn:hover {
  background: rgba(217, 196, 255, 0.22);
}
