/* SpringsCraft colours: the purple of the logo and banner, gold like the stars */
:root {
    --purple: #5c286b;
    --purple-mid: #3b1848;
    --purple-dark: #16071c;
    --card: rgba(30, 10, 40, 0.55);
    --card-border: rgba(255, 255, 255, 0.14);
    --text: #ffffff;
    --muted: #e3d3ea;
    --gold: #f6c453;
    --gold-dark: #e89a2c;
    --ok: #7ee2a8;
    --error: #ff9a9a;
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

/* the park photo fills the whole page, with a light purple haze like the banner */
html {
    min-height: 100%;
    background: var(--purple-dark);
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    color: var(--text);
    font-family: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/*
 * The park photo in its own fixed layer behind the page (not background-attachment: fixed: together with the blurred
 * cards Chrome then repaints the whole page on every hover and an extra layer flashes)
 */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    /* photo and purple appear together once the photo is in (no gradient on its own first) */
    opacity: 0;
    transition: opacity 0.5s ease;
    background:
        linear-gradient(180deg, rgba(92, 40, 107, 0.45) 0%, rgba(59, 24, 72, 0.35) 50%, rgba(22, 7, 28, 0.7) 100%),
        url("header.webp") center / cover no-repeat;
}

body.ready::before {
    opacity: 1;
}

/* ------------------------------------------------------------ screen 1: connect */

.welcome {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 48px 16px 24px;
}

.logo {
    width: 340px;
    max-width: 80vw;
    height: auto;
    filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.5));
}

.badge {
    display: inline-block;
    margin-top: 18px;
    padding: 5px 16px;
    border-radius: 999px;
    font-weight: 800;
    font-size: 14px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--purple-dark);
    background: linear-gradient(90deg, var(--gold), var(--gold-dark));
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.tagline {
    margin: 14px 0 28px;
    font-size: 34px;
    font-weight: 800;
    line-height: 1.2;
    text-shadow: 0 3px 12px rgba(0, 0, 0, 0.6);
}

button {
    border: 0;
    border-radius: 999px;
    padding: 16px 40px;
    font: inherit;
    font-weight: 800;
    font-size: 19px;
    color: var(--purple-dark);
    background: linear-gradient(90deg, var(--gold), var(--gold-dark));
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35), 0 0 0 4px rgba(246, 196, 83, 0.38);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

button:hover {
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.4), 0 0 0 6px rgba(246, 196, 83, 0.3);
}

button:disabled {
    opacity: 0.6;
    cursor: default;
    transform: none;
}

/* admin (/admin): the password above the connect button, in the glass style of the cards */
.admin-password {
    display: block;
    width: min(280px, 80vw);
    margin: 0 auto 26px;
    padding: 13px 18px;
    border-radius: 999px;
    border: 1px solid var(--card-border);
    background: var(--card);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    font: inherit;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    color: var(--text);
    outline: none;
}

.admin-password:focus {
    border-color: var(--gold);
}

.admin-password::placeholder {
    color: var(--muted);
}

.admin-password[hidden] {
    display: none;
}

.status {
    min-height: 1.4em;
    margin: 16px 0 0;
    color: var(--muted);
    font-weight: 600;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
}

/* a new message comes in like the contents of the cards */
.welcome > .status.show {
    animation: content-in 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.status.ok {
    color: var(--ok);
}

.status.ok::before {
    content: "";
    display: inline-block;
    width: 9px;
    height: 9px;
    margin-right: 8px;
    border-radius: 50%;
    background: var(--ok);
    animation: pulse 2s infinite;
}

.status.error {
    color: var(--error);
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(126, 226, 168, 0.7); }
    70% { box-shadow: 0 0 0 8px rgba(126, 226, 168, 0); }
    100% { box-shadow: 0 0 0 0 rgba(126, 226, 168, 0); }
}

/* ------------------------------------------------------------ screen 2: what plays, volume */

.player {
    flex: 1;
}

/* the bar at the top, a card like the others: the tabs in the middle, who you are on the right */
.topbar {
    /* not sticky: a sticky bar with a blur showed a shifted ghost strip in Chrome when something else repainted */
    transform: translateZ(0);
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 20px;
    width: calc(100% - 32px);
    max-width: 728px;
    margin: 16px auto 18px;
    padding: 12px 18px;
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: 22px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
}

.tabs {
    grid-column: 1;
    position: relative;
    display: flex;
    justify-content: flex-start;
    gap: 6px;
}

.tabs .tab {
    position: relative;
    z-index: 1;
    padding: 9px 20px;
    font-size: 16px;
    font-weight: 800;
    color: var(--muted);
    background: transparent;
    box-shadow: none;
    border-radius: 999px;
    transition: color 0.3s ease;
}

.tabs .tab:hover {
    transform: none;
    color: var(--text);
    box-shadow: none;
}

.tabs .tab.active {
    color: var(--purple-dark);
}

/* the gold pill behind the active tab: slides to the tab you click, or drag it with the mouse or a finger */
.pill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--gold), var(--gold-dark));
    box-shadow: 0 4px 14px rgba(232, 154, 44, 0.3);
    cursor: grab;
    touch-action: none;
    transition:
        transform 0.45s cubic-bezier(0.3, 1.25, 0.5, 1),
        width 0.45s cubic-bezier(0.3, 1.25, 0.5, 1);
}

/* on the move: a little stretch */
.pill.moving {
    animation: stretch 0.45s ease;
}

/* held: follows the pointer right away, a bit bigger */
.pill.dragging {
    cursor: grabbing;
    transition: none;
    scale: 1.06;
    box-shadow: 0 8px 22px rgba(232, 154, 44, 0.45);
}

@keyframes stretch {
    0% { scale: 1 1; }
    40% { scale: 1.06 0.95; }
    100% { scale: 1 1; }
}

/*
 * The new page comes in softly: only what is inside the cards moves and fades. The cards themselves stay still:
 * moving, fading or blurring a card (or the page around it) drops its blurred background (backdrop-filter) in Chrome
 * while it runs.
 */
.tab-page.enter .card > * {
    animation: content-in 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.tab-page.enter .card > *:nth-child(2) {
    animation-delay: 0.04s;
}

.tab-page.enter .card > *:nth-child(n + 3) {
    animation-delay: 0.08s;
}

@keyframes content-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    .pill, .pill.moving, .tab-page.enter .card > * {
        transition: none;
        animation: none;
    }
}

.me {
    display: flex;
    align-items: center;
    gap: 10px;
    grid-column: 2;
    justify-self: end;
}

.head {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    image-rendering: pixelated;
    background: linear-gradient(135deg, var(--purple), var(--purple-mid));
    box-shadow: 0 0 0 2px var(--ok), 0 4px 10px rgba(0, 0, 0, 0.4);
}

.me > div:not(.head-wrap) {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    text-align: right;
    line-height: 1.2;
}

.me-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--ok);
}

.me strong {
    font-size: 16px;
}

.card.soon p {
    margin: 0;
    color: var(--muted);
}

main {
    max-width: 760px;
    margin: 0 auto;
    padding: 0 16px 24px;
}

.card {
    /* an own layer: no repaint flicker of the blur */
    transform: translateZ(0);
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: 22px;
    padding: 22px;
    margin-bottom: 18px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
}

h2 {
    margin: 0 0 14px;
    font-size: 15px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--gold);
}

#playing {
    list-style: none;
    margin: 0;
    padding: 0;
}

#playing li {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px;
    margin: 0 -10px;
    border-radius: 16px;
}

#playing li + li {
    margin-top: 4px;
}

#playing img {
    position: relative;
    z-index: 1;
    display: block;
    width: 56px;
    height: 56px;
    border-radius: 14px;
    object-fit: cover;
    /* a thin white edge, white rings flow out of it (like the green ones of the head) */
    box-shadow: 0 0 0 2px #fff, 0 4px 12px rgba(0, 0, 0, 0.3);
}

.cover-wrap {
    position: relative;
    flex: none;
    width: 56px;
    height: 56px;
}

#playing .cover-rings {
    filter: none;
}

#playing .cover-rings rect {
    stroke: #fff;
    stroke-width: 2px;
    animation-name: flow-cover;
    animation-delay: var(--phase, 0s);
}

#playing .cover-rings rect:nth-child(2) { animation-delay: calc(var(--phase, 0s) - 1.8s); }
#playing .cover-rings rect:nth-child(3) { animation-delay: calc(var(--phase, 0s) - 3.6s); }
#playing .cover-rings rect:nth-child(4) { animation-delay: calc(var(--phase, 0s) - 5.4s); }
#playing .cover-rings rect:nth-child(5) { animation-delay: calc(var(--phase, 0s) - 7.2s); }

/* 4px behind the edge of the cover to 8px outside it (33.33% = at the edge); the corners stay as round as the cover (14px) */
@keyframes flow-cover {
    0% { x: 34px; y: 34px; width: calc(100% - 68px); height: calc(100% - 68px); ry: 10px; opacity: 0.9; }
    33.33% { x: 30px; y: 30px; width: calc(100% - 60px); height: calc(100% - 60px); ry: 14px; opacity: 0.9; }
    100% { x: 22px; y: 22px; width: calc(100% - 44px); height: calc(100% - 44px); ry: 22px; opacity: 0; }
}

/* no cover of its own: the SC monogram on purple */
#playing img.fallback {
    object-fit: contain;
    padding: 8px;
    background: linear-gradient(135deg, var(--purple), var(--purple-mid));
}

#playing strong {
    display: block;
    font-size: 17px;
}

#playing span {
    color: var(--muted);
    font-size: 14px;
}

.slider {
    display: grid;
    grid-template-columns: 112px 1fr 48px;
    align-items: center;
    gap: 14px;
    margin: 10px 0;
    font-weight: 600;
}

.slider input {
    width: 100%;
    accent-color: var(--gold);
}

.slider output {
    text-align: right;
    color: var(--muted);
}

.muted {
    color: var(--muted);
}

footer {
    text-align: center;
    font-size: 13px;
    padding: 8px 16px 24px;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
}

footer p {
    margin: 4px 0;
}

footer strong {
    font-size: 15px;
    letter-spacing: 0.04em;
}

@media (max-width: 520px) {
    .tagline {
        font-size: 26px;
    }

    /* phone: one row, the tabs at the top left and only the head on the right (no "connected as" and name) */
    .topbar {
        gap: 10px;
        margin-top: 8px;
        padding: 12px;
    }

    .me > div:not(.head-wrap) {
        display: none;
    }

    .tabs {
        gap: 4px;
    }

    .tabs .tab {
        /* as wide as its text (a long name like "Ride photo" stays on one line) */
        flex: auto;
        white-space: nowrap;
        padding: 8px 10px;
        font-size: 15px;
    }

    .slider {
        grid-template-columns: 104px 1fr 44px;
    }
}

/* ------------------------------------------------------------ welcome screen animations */

/* coming in: logo, badge, tagline and button one after the other */
.welcome > * {
    animation: rise-in 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.welcome > :nth-child(2) { animation-delay: 0.12s; }
.welcome > :nth-child(3) { animation-delay: 0.22s; }
.welcome > :nth-child(4) { animation-delay: 0.32s; }
.welcome > :nth-child(5) { animation-delay: 0.42s; }

@keyframes rise-in {
    from { opacity: 0; transform: translateY(18px) scale(0.97); }
    to { opacity: 1; transform: none; }
}

/* the badge: now and then a slow gleam of light slides over it */
.badge, #connect {
    position: relative;
    overflow: hidden;
}

.badge::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, 0.65) 50%, transparent 65%);
    transform: translateX(-120%);
    animation: gleam 9s ease-in-out 1.5s infinite;
    pointer-events: none;
}

@keyframes gleam {
    0%, 72% { transform: translateX(-120%); }
    100% { transform: translateX(120%); }
}

/*
 * The button breathes in layers, like a doppler effect: three soft glows (no hard edge) flow out of it one after
 * the other, swell and fade; they blend into each other and never shrink back, so it reads as one breathing glow.
 */
.connect-wrap {
    position: relative;
    display: inline-block;
}

.connect-wrap #connect {
    position: relative;
    z-index: 1;
    /* the gold edge is the start of every ring, so a ring peels off it without anything shrinking back */
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35), 0 0 4px 3px rgba(246, 196, 83, 0.35);
}

/* hover: the button and its rings grow together (scale/translate, so the rise-in animation's transform doesn't block it) */
.connect-wrap {
    transition: scale 0.15s ease, translate 0.15s ease;
}

.connect-wrap:has(#connect:hover:not(:disabled)) {
    translate: 0 -2px;
    scale: 1.03;
}

.connect-wrap:has(#connect:active:not(:disabled)) {
    scale: 0.96;
}

.connect-wrap #connect:hover,
.connect-wrap #connect:active {
    transform: none;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.4), 0 0 4px 3px rgba(246, 196, 83, 0.35);
}

/* the rings are SVG: it draws between the pixels, so a slow ring glides instead of stepping a pixel at a time.
   The SVG is 30px bigger than the button on every side, so the blur never cuts a ring off at the edge */
.rings {
    position: absolute;
    inset: -30px;
    width: calc(100% + 60px);
    height: calc(100% + 60px);
    pointer-events: none;
    /* one soft blur over all rings together: cheaper than a blur per ring, so the animation keeps its frames */
    filter: blur(1.5px);
}

.rings rect {
    fill: none;
    stroke: rgb(246, 196, 83);
    stroke-width: 6px;
    opacity: 0;
    animation: flow 9s linear infinite;
}

.rings rect:nth-child(2) { animation-delay: -1.8s; }
.rings rect:nth-child(3) { animation-delay: -3.6s; }
.rings rect:nth-child(4) { animation-delay: -5.4s; }
.rings rect:nth-child(5) { animation-delay: -7.2s; }

/* only outwards and the same on every side: it starts 10px behind the edge of the button (so it never pops up),
   comes out from under it and ends 16px outside, at an even speed (the SVG starts 30px outside the button).
   Size and fade in one animation, so they can never be out of step when a ring starts over.
   38.46% = 10 of the 26px: the moment it reaches the edge of the button, from there it fades */
@keyframes flow {
    0% { x: 40px; y: 40px; width: calc(100% - 80px); height: calc(100% - 80px); ry: calc(50% - 40px); opacity: 0.575; }
    38.46% { x: 30px; y: 30px; width: calc(100% - 60px); height: calc(100% - 60px); ry: calc(50% - 30px); opacity: 0.575; }
    100% { x: 14px; y: 14px; width: calc(100% - 28px); height: calc(100% - 28px); ry: calc(50% - 14px); opacity: 0; }
}

/* the head: green rings flow out of it, like the gold ones of the connect button */
.head-wrap {
    position: relative;
    flex: none;
    width: 38px;
    height: 38px;
}

.head-wrap .head {
    position: relative;
    z-index: 1;
    display: block;
}

/* the head is small: three thin sharp rings with room between them, else they melt into a haze */
.head-rings {
    filter: none;
}

.head-rings rect {
    stroke: var(--ok);
    stroke-width: 2px;
    animation-name: flow-head;
}

.head-rings rect:nth-child(2) { animation-delay: -2.25s; }
.head-rings rect:nth-child(3) { animation-delay: -4.5s; }
.head-rings rect:nth-child(4) { animation-delay: -6.75s; }

/* 4px behind the edge of the head to 7px outside it (36.36% = at the edge); the corners stay as round as the head (10px) */
@keyframes flow-head {
    0% { x: 34px; y: 34px; width: calc(100% - 68px); height: calc(100% - 68px); ry: 6px; opacity: 0.9; }
    36.36% { x: 30px; y: 30px; width: calc(100% - 60px); height: calc(100% - 60px); ry: 10px; opacity: 0.9; }
    100% { x: 23px; y: 23px; width: calc(100% - 46px); height: calc(100% - 46px); ry: 17px; opacity: 0; }
}

#connect:active {
    transform: scale(0.96);
}

/* connecting: three dots walk in the button */
#connect.connecting,
#connect.connecting:disabled {
    opacity: 1;
    color: transparent;
}

#connect.connecting::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 8px;
    height: 8px;
    margin: -4px 0 0 -4px;
    border-radius: 50%;
    background: var(--purple-dark);
    animation: dots 1s infinite linear;
}

@keyframes dots {
    0% { box-shadow: -16px 0 0 0 var(--purple-dark), 16px 0 0 0 var(--purple-dark); opacity: 1; }
    33% { box-shadow: -16px 0 0 0 rgba(22, 7, 28, 0.35), 16px 0 0 0 var(--purple-dark); opacity: 0.35; }
    66% { box-shadow: -16px 0 0 0 var(--purple-dark), 16px 0 0 0 rgba(22, 7, 28, 0.35); opacity: 1; }
    100% { box-shadow: -16px 0 0 0 var(--purple-dark), 16px 0 0 0 var(--purple-dark); opacity: 1; }
}

/* connected: the welcome screen zooms away, then the bar and the cards pop open */
.welcome.leaving > * {
    animation: zoom-away 0.4s cubic-bezier(0.5, 0, 0.75, 0) both;
}

@keyframes zoom-away {
    to { opacity: 0; transform: scale(1.06); }
}


/* language: a round flag with a white edge on the right of the footer, in the middle of its text (the footer has 8px
   more padding below than above); the languages pop up above it */
footer {
    position: relative;
}

.lang {
    position: absolute;
    right: 16px;
    /* half of the flag (44px) up, without translate: a moved parent switched off the blur of the language list */
    top: calc(50% - 8px - 22px);
    z-index: 10;
    text-shadow: none;
}

.lang-current {
    display: block;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 3px solid #fff;
    border-radius: 50%;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45);
    transition: transform 0.15s ease;
}

.lang-current:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45);
}

.lang-current svg,
.lang-option .flag svg {
    display: block;
    width: 100%;
    height: 100%;
}

.lang-menu {
    position: absolute;
    right: 0;
    bottom: calc(100% + 10px);
    /* an own layer like the cards: no repaint flicker of the blur */
    transform: translateZ(0);
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: 22px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
    pointer-events: none;
    visibility: hidden;
    touch-action: none;
}

/* opening: it grows open like the cards (the script morphs its height), then the languages come in one after the other;
   closing: the languages go and it shrinks back to nothing. No fading of the list itself: that would drop its blur */
.lang-list {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding: 8px;
}

.lang.open .lang-menu {
    pointer-events: auto;
    visibility: visible;
}

.lang.closing .lang-menu {
    pointer-events: none;
}

.lang.open.closing .lang-option {
    animation: content-out 0.2s ease both;
}

@keyframes content-out {
    to { opacity: 0; transform: translateY(8px); }
}

/* the chosen language can be dragged (the pill goes along) */
.lang-option.selected {
    cursor: grab;
}

.lang-pill.dragging {
    transition: none;
    scale: 1.06;
    box-shadow: 0 8px 22px rgba(232, 154, 44, 0.45);
}

.lang.open .lang-option {
    animation: content-in 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.lang.open .lang-option:nth-of-type(2) { animation-delay: 0.04s; }
.lang.open .lang-option:nth-of-type(3) { animation-delay: 0.08s; }
.lang.open .lang-option:nth-of-type(4) { animation-delay: 0.12s; }

/* the gold pill behind the chosen language: slides like the pill of the tabs */
.lang-pill {
    position: absolute;
    top: 0;
    left: 0;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--gold), var(--gold-dark));
    box-shadow: 0 4px 14px rgba(232, 154, 44, 0.3);
    transition:
        transform 0.45s cubic-bezier(0.3, 1.25, 0.5, 1),
        width 0.45s cubic-bezier(0.3, 1.25, 0.5, 1),
        height 0.45s cubic-bezier(0.3, 1.25, 0.5, 1);
}

/* on the move: a little stretch (up and down here, the list is vertical) */
.lang-pill.moving {
    animation: stretch-y 0.45s ease;
}

@keyframes stretch-y {
    0% { scale: 1 1; }
    40% { scale: 0.96 1.08; }
    100% { scale: 1 1; }
}

.lang-option {
    position: relative;
    z-index: 1;
    transition: color 0.2s ease;
    display: flex;
    white-space: nowrap;
    align-items: center;
    gap: 10px;
    padding: 6px 14px 6px 6px;
    border-radius: 999px;
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    background: transparent;
    box-shadow: none;
    text-align: left;
}

.lang-option:hover {
    transform: none;
    background: rgba(255, 255, 255, 0.1);
    box-shadow: none;
}

.lang-option.selected,
.lang-option.selected:hover {
    color: var(--purple-dark);
    background: transparent;
}

.lang-option .flag {
    flex: none;
    width: 28px;
    height: 28px;
    border: 2px solid #fff;
    border-radius: 50%;
    overflow: hidden;
}

@media (max-width: 520px) {
    /* the footer text stays clear of the flag */
    footer {
        padding-left: 68px;
        padding-right: 68px;
    }
}

/* ------------------------------------------------------------ the 3D map (Map tab) */

.map-view {
    position: relative;
    height: min(68vh, 620px);
    margin: 0 -8px -8px;
    border-radius: 16px;
    overflow: hidden;
    background: rgba(10, 4, 16, 0.35);
    touch-action: none;
}

.map-view canvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: grab;
}

.map-view canvas:active {
    cursor: grabbing;
}

/* the minimap of low quality: a Leaflet map like Craftventure's, in the same place as the 3D view (its own layer, so
   Leaflet's panes stay under the buttons and pins) */
.map-view .map-mini {
    position: absolute;
    inset: 0;
    z-index: 0;
    background: #6d9930;
}

.map-view .map-mini[hidden] {
    display: none;
}

/* sharp pixels when zoomed in, like Craftventure */
.map-mini .pixelated {
    image-rendering: pixelated;
}

/* night on the minimap: a dark blue layer over the map and the grass (not over you and the + / -), fading in and out
   like the night of the 3D view */
.map-mini::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 350;
    background: rgba(8, 12, 36, 0.62);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.6s ease;
}

.map-mini.night::after {
    opacity: 1;
}

.map-view canvas[hidden] {
    display: none;
}

.map-status {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    margin: 0;
    padding: 24px;
    text-align: center;
    color: var(--muted);
    font-weight: 600;
    pointer-events: none;
}

/* how to move, bottom left (fades out after a few seconds) */
.map-hint {
    position: absolute;
    left: 10px;
    bottom: 10px;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 12px;
    color: var(--muted);
    background: var(--card);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    pointer-events: none;
    transition: opacity 0.6s ease;
}

.map-hint.faded {
    opacity: 0;
}

/* the buttons: one glass bar in the top right corner, side by side (like the cards), small white icons, what is on lights up gold */
.map-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    padding: 4px;
    border-radius: 16px;
    background: var(--card);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.map-button {
    position: relative;
    width: 34px;
    height: 34px;
    padding: 0;
    display: grid;
    place-items: center;
    border-radius: 11px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.02em;
    color: var(--text);
    background: transparent;
    box-shadow: none;
    transition: background 0.15s ease, color 0.15s ease;
}

/* a thin line between two buttons */
.map-button + .map-button::before {
    content: "";
    position: absolute;
    left: -1px;
    top: 8px;
    bottom: 8px;
    width: 1px;
    background: var(--card-border);
}

.map-button:hover {
    transform: none;
    background: rgba(255, 255, 255, 0.1);
    box-shadow: none;
}

.map-button svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.map-button.on {
    color: var(--gold);
}

/* the quality menu of the gear button: glass like the bar, under it on the right */
.map-quality {
    position: absolute;
    top: 58px;
    right: 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 200px;
    padding: 8px;
    border-radius: 16px;
    background: var(--card);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.map-quality[hidden] {
    display: none;
}

.map-quality-title {
    padding: 2px 10px 6px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

.map-quality-option {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
    padding: 7px 10px;
    border-radius: 11px;
    text-align: left;
    font-size: 13px;
    color: var(--text);
    background: transparent;
    box-shadow: none;
}

.map-quality-option:hover {
    transform: none;
    background: rgba(255, 255, 255, 0.1);
    box-shadow: none;
}

.map-quality-option small {
    font-size: 11px;
    font-weight: 600;
    color: var(--muted);
}

.map-quality-option.on b {
    color: var(--gold);
}

/* the custom settings, under the four choices */
.map-custom {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 4px;
    padding-top: 6px;
    border-top: 1px solid var(--card-border);
}

.map-custom[hidden] {
    display: none;
}

.map-setting {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 7px 10px;
    border-radius: 11px;
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    background: transparent;
    box-shadow: none;
}

.map-switch:hover {
    transform: none;
    background: rgba(255, 255, 255, 0.1);
    box-shadow: none;
}

/* a small switch: gold when on */
.map-switch i {
    position: relative;
    flex: none;
    width: 30px;
    height: 17px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
    transition: background 0.2s ease;
}

.map-switch i::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.2s ease;
}

.map-switch.on i {
    background: var(--gold);
}

.map-switch.on i::after {
    transform: translateX(13px);
}

.map-slider {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
}

.map-slider > span {
    display: flex;
    justify-content: space-between;
}

.map-slider output {
    color: var(--gold);
}

.map-slider input {
    width: 100%;
    accent-color: var(--gold);
}

/* the pins of the attractions (green open, red closed) and your own markers (gold): a dot and the name */
.map-markers {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.map-pin {
    position: absolute;
    left: 0;
    top: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    margin: -14px 0 0 -9px;
    padding: 4px 10px 4px 6px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
    color: var(--text);
    background: rgba(22, 7, 28, 0.72);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35);
    pointer-events: auto;
    will-change: transform;
    /* follows its place in the map every frame: no smoothing of the buttons */
    transition: none;
}

.map-pin:hover {
    background: rgba(59, 24, 72, 0.9);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35);
}

.map-pin-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid #fff;
    background: var(--gold);
}

.map-pin.open .map-pin-dot {
    background: var(--ok);
}

.map-pin.closed .map-pin-dot {
    background: #ff6b6b;
}

@media (max-width: 520px) {
    .map-hint {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .welcome > *, .rings rect, #playing .cover-rings rect, .welcome.leaving > *, .badge::after, .welcome > .status.show {
        animation: none;
    }

    .lang-menu, .connect-wrap, .lang-pill, .lang.open .lang-option {
        transition: none;
        animation: none;
    }
}
