main {
    width: min(calc(100% - 64px), 680px);
    margin: calc(5rem + 64px) auto 0;
    text-align: center;
}

.map {
    position: relative;
    /* Icon borders and shadows are sized from the map width, so they scale with the icons */
    container-type: inline-size;
}

.map-background {
    display: block;
    width: 100%;
    height: auto;
}

.map-icon {
    position: absolute;
    width: 8.4%;
    padding: 0;
    border: 0;
    border-radius: 20%;
    background: transparent;
    color: black;
    cursor: default;
    box-shadow: none;
    /* The whole icon pulses, label included, so label and gap grow with it */
    animation: pulse var(--cycle, 8s) ease-in-out var(--delay) infinite;
}

/* Invisible tap area of at least 24px, even when the icon itself is smaller */
.map-icon::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: max(100%, 24px);
    height: max(100%, 24px);
    translate: -50% -50%;
}

a.map-icon {
    cursor: pointer;
}

/* No grey/blue flash on tap: the label is the feedback */
.map-icon {
    -webkit-tap-highlight-color: transparent;
}

.map-icon:nth-child(2) {
    --cycle: 8.3s;
}

.map-icon:nth-child(3) {
    --cycle: 10.7s;
}

.map-icon:nth-child(4) {
    --cycle: 7.1s;
}

.map-icon:nth-child(5) {
    --cycle: 11.9s;
}

.map-icon:nth-child(6) {
    --cycle: 9.5s;
}

.map-icon:nth-child(7) {
    --cycle: 7.7s;
}

.map-icon:nth-child(8) {
    --cycle: 11.3s;
}

.map-icon:nth-child(9) {
    --cycle: 8.9s;
}

.map-icon:nth-child(10) {
    --cycle: 12.7s;
}

.map-icon:nth-child(11) {
    --cycle: 10.1s;
}

.map-icon:nth-child(-n+8) {
    border-radius: 50%;
}

.map-icon img {
    display: block;
    box-sizing: border-box;
    width: 100%;
    height: auto;
    border: max(1px, .26cqi) solid white;
    border-radius: inherit;
    background: white;
    /* 3D edge like the logo on the rules pages (grey band, black band, soft shadow), in the same proportions to the icon */
    box-shadow: 0 .33cqi 0 #ddd, 0 .66cqi 0 black, 0 1.05cqi 1.58cqi #0006;
}

/* Label sticker: same style as the /games name stickers. Padding, corners,
shadow and distance in em, so it keeps its proportions at every text size. */
.map-icon span {
    position: absolute;
    z-index: 2;
    left: 50%;
    transform: translateX(-50%) rotate(1.5deg);
    padding: .37em .57em;
    border-radius: .17em;
    border: 2px solid black;
    background: white;
    color: black;
    box-shadow: .23em .23em 0 black;
    /* Scales with the map like the icons, with a readable minimum */
    font-size: max(.5625rem, 1.6cqi);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .02em;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
}

/* Labels above the icon */
.map-spot-4 span, .map-spot-7 span, .map-spot-9 span, .map-spot-10 span {
    bottom: calc(100% + .8em);
}

/* Labels below the icon */
.map-spot-1 span, .map-spot-2 span, .map-spot-3 span,
.map-spot-5 span, .map-spot-6 span, .map-spot-8 span {
    top: calc(100% + .8em);
}

/* Mouse: the label shows on hover. Keyboard: on focus. The icon showing
its label sits above the others, so nothing covers the label. */
.map-icon:hover, .map-icon:focus-visible, .map-icon.is-active {
    z-index: 1;
}

.map-icon:focus-visible {
    outline: 2px solid white;
    outline-offset: 4px;
}

.map-icon:focus-visible span {
    opacity: 1;
}

@media (hover: hover) and (pointer: fine) {
    .map-icon:hover span {
        opacity: 1;
    }
}

/* Touch screens: map-labels.js marks the tapped icon, one at a time */
.map-icon.is-active span {
    opacity: 1;
}

@media (max-width: 600px) {
    main {
        margin-top: calc(5rem + 48px);
    }
}

@keyframes pulse {
    0%, 40%, 100% {
        transform: scale(1);
    }

    20% {
        transform: scale(1.16);
    }
}

@media (prefers-reduced-motion: reduce) {
    .map-icon {
        animation: none;
    }
}

/* Positions of the individual items. They live here instead of in the page
so the content security policy can block all inline styles. */

.map-icon.map-spot-1 {
    left: 84.03%;
    top: 33.44%;
    --delay: 0s;
}

.map-icon.map-spot-2 {
    left: 31.75%;
    top: 53.48%;
    --delay: 0.2s;
}

.map-icon.map-spot-3 {
    left: 10.87%;
    top: 57.14%;
    --delay: 0.4s;
}

.map-icon.map-spot-4 {
    left: 10.87%;
    top: 84.75%;
    --delay: 0.6s;
}

.map-icon.map-spot-5 {
    left: 43.48%;
    top: 79.37%;
    --delay: 0.8s;
}

.map-icon.map-spot-6 {
    left: 52.63%;
    top: 63.29%;
    --delay: 1s;
}

.map-icon.map-spot-7 {
    left: 67.57%;
    top: 55.56%;
    --delay: 1.2s;
}

.map-icon.map-spot-8 {
    left: 79.37%;
    top: 63.29%;
    --delay: 1.4s;
}

.map-icon.map-spot-9 {
    left: 76.92%;
    top: 26.25%;
    --delay: 1.6s;
}

.map-icon.map-spot-10 {
    left: 32.79%;
    top: 39.49%;
    --delay: 1.8s;
}
