:root {
  --base-bg: rgba(242, 235, 247, 0.93);
  --bg-sp99: rgba(140, 120, 165, 0.93);
  --bg-alk: rgba(200, 190, 215, 0.93);
  --bg-rok: rgba(230, 225, 240, 0.93);
}

body {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  margin: 0;
  background-color: var(--base-bg);
  color: rgb(0, 0, 0);
  font-family: Consolas, monospace;
  transition: background-color 180ms ease;
  animation: bgLoop 12s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  body {
    animation: none;
  }
}

@keyframes bgLoop {
  0% {
    background-color: var(--bg-sp99);
  }
  33% {
    background-color: var(--bg-alk);
  }
  66% {
    background-color: var(--bg-rok);
  }
  100% {
    background-color: var(--bg-sp99);
  }
}

body.paused {
  animation-play-state: paused;
}

body.modal-open {
  overflow: hidden;
}

body.hover-sp99 {
  background-color: var(--bg-sp99);
}
body.hover-alk {
  background-color: var(--bg-alk);
}
body.hover-rok {
  background-color: var(--bg-rok);
}

#venn {
  position: relative;
  width: min(92vw, 92vh * (1400 / 1200));
  aspect-ratio: 1400 / 1200;
  background: url("sp99venn.png") no-repeat center center;
  background-size: contain;
}

#vennHotspots {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  outline: none;
}

/* Invisible clickable regions */
.hotspot {
  outline: none;
  fill: transparent;
  stroke: transparent;
  cursor: pointer;
  pointer-events: all;
}

/* Optional: debugging to see hotspot outlines while tuning. Uncomment while adjusting.*/

/*
.hotspot {
  fill: rgba(255, 0, 0, 0.08);
  stroke: rgba(255, 0, 0, 0.35);
  stroke-width: 6;
}
*/

.modal {
  position: fixed;
  inset: 0;
  display: none;
  justify-content: center;
  align-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.35);
  z-index: 999;
}

.modal.open {
  display: flex;
}

.modal-frame {
  position: relative;
  width: min(820px, 92vw);
  max-height: 86vh;
  background: url("sp99frame.png") no-repeat center center;
  background-size: cover;
  padding: 34px;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.35);
}

.modal-inner {
  background: white;
  border-radius: 8px;
  padding: 22px;
  max-height: calc(86vh - 68px);
  overflow: auto;
  text-align: left;
}

.modal-inner h2 {
  margin: 0 0 12px 0;
  font-size: 22px;
}

.modal-body {
  font-size: 16px;
  line-height: 1.45;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
  cursor: pointer;
  font-size: 18px;
  line-height: 40px;
}

.modal-close:focus-visible,
.emoji-anchor:focus-visible,
a:focus-visible {
  outline: 2px solid black;
  outline-offset: 2px;
}

.closing-line {
  margin-bottom: 0;
}

.modal-figure {
  margin: 0;
  display: flex;
  justify-content: center;
}

.modal-image {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
}

.emoji-anchor {
  position: relative;
  cursor: pointer;
  font-family:
    "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "EmojiOne Color",
    sans-serif;
  font-size: 1rem;
  line-height: 1;
}

.emoji-anchor::after {
  content: attr(data-hover);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  background: rgba(20, 20, 20, 0.95);
  color: #fff;
  font-size: 12px;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 150ms ease,
    transform 150ms ease;
  z-index: 9999;
}

.emoji-anchor:hover::after,
.emoji-anchor:focus::after {
  opacity: 1;
  transform: translateX(-50%) translateY(-12px);
}
