:root {
  --bg0: #1b2a33;
  --bg1: #2c404d;
  --panel: rgba(26, 40, 49, 0.72);
  --line: rgba(255, 255, 255, 0.22);
  --text: #f3f8fc;
  --muted: #c0d1dc;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background:
    radial-gradient(900px 700px at 10% 0%, #456273 0%, transparent 65%),
    radial-gradient(900px 700px at 90% 100%, #3f5c6d 0%, transparent 65%),
    linear-gradient(145deg, var(--bg0), var(--bg1));
  color: var(--text);
  font-family: "Avenir Next", "Segoe UI", sans-serif;
}

canvas {
  display: block;
}

.hud {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 10;
  max-width: min(280px, 72vw);
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  backdrop-filter: blur(5px);
}

.hud h1 {
  margin: 0;
  font-size: 0.95rem;
  letter-spacing: 0.03em;
}

.hud p {
  margin: 3px 0;
  color: var(--muted);
  line-height: 1.25;
  font-size: 0.76rem;
}

.legend {
  margin-top: 5px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
  font-size: 0.74rem;
}

.legend span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.parent-child {
  background: #66c2ff;
}

.spouse {
  background: #ff8ad4;
}

.sibling {
  background: #ffd166;
}

.alliance {
  background: #8ce99a;
}

#reheatButton {
  margin-top: 6px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  background: rgba(255, 255, 255, 0.14);
  color: var(--text);
  border-radius: 7px;
  padding: 5px 7px;
  font-size: 0.72rem;
  font: inherit;
  cursor: pointer;
}

#reheatButton:hover {
  background: rgba(255, 255, 255, 0.24);
}

.hint {
  font-size: 0.7rem;
}

.tooltip {
  position: fixed;
  z-index: 20;
  pointer-events: none;
  opacity: 0;
  transform: translate(12px, 12px);
  transition: opacity 120ms ease;
  color: #f7fbff;
  font-size: 0.85rem;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(20, 30, 38, 0.9);
  max-width: 250px;
}

.tooltip.show {
  opacity: 1;
}

@media (max-width: 760px) {
  .hud {
    max-width: min(240px, 74vw);
    top: 8px;
    left: 8px;
    right: auto;
  }

  .legend {
    grid-template-columns: 1fr;
  }
}
