/* Map site — dim rose + apricot (lab map-gradients-v4 / rose-apricot). */
/* Status bar + page title + link slot + a sliver of bottom pad.
   Keep the whole card on screen when the page is scrolled to the top. */
body.theme-map,
body.theme-map.font-sans {
    padding-bottom: 0.45rem;
}
body.theme-map .app-shell {
    padding-bottom: 0.35rem;
}
.wm-site-card {
    --wm-page-chrome: 13rem;
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: calc(100vh - var(--wm-page-chrome));
    max-height: calc(100vh - var(--wm-page-chrome));
    height: calc(100dvh - var(--wm-page-chrome));
    max-height: calc(100dvh - var(--wm-page-chrome));
    overflow: hidden;
    border-radius: 1rem;
    background:
        linear-gradient(180deg, rgba(160, 70, 74, 0.18), rgba(22, 14, 16, 0.74));
    border: 1px solid rgba(224, 176, 160, 0.26);
    box-shadow:
        0 18px 40px rgba(16, 8, 10, 0.46),
        inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
#map-stage.section {
    margin-bottom: 0;
}
.wm-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 0.7rem;
    padding: 0.52rem 0.9rem;
    position: relative;
    z-index: 30;
    overflow: hidden;
    border-radius: 1rem 1rem 0 0;
    border-bottom: 1px solid rgba(224, 176, 160, 0.16);
    background: linear-gradient(180deg, rgba(130, 56, 62, 0.92), rgba(40, 20, 22, 0.92));
}
.wm-head-text {
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: flex-start;
    gap: 0.08rem;
    min-width: 0;
    flex: 1 1 10rem;
}
.wm-world-wrap {
    position: relative;
    min-width: 0;
}
.wm-world-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    max-width: 100%;
    border: none;
    background: transparent;
    padding: 0.05rem 0.1rem;
    color: #f6eee8;
    cursor: pointer;
    user-select: none;
}
.wm-world-btn:hover .wm-title {
    color: #fff7f2;
}
.wm-world-btn[aria-expanded="true"] .wm-title {
    color: #fff7f2;
}
.wm-title {
    font-weight: 700;
    font-size: 1.02rem;
    line-height: 1.25;
    color: #f6eee8;
    letter-spacing: 0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.wm-world-menu {
    min-width: 13rem;
    max-width: min(20rem, 80vw);
    max-height: min(22rem, 60vh);
}
.wm-world-group {
    padding: 0.4rem 0.45rem 0.12rem;
    font-size: 0.65rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(232, 186, 176, 0.62);
    user-select: none;
}
.wm-world-opt {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}
.wm-live {
    flex: 0 0 auto;
    font-size: 0.62rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #86efac;
}
.wm-sub {
    color: #c8a8a2;
    font-size: 0.8rem;
    line-height: 1.25;
    white-space: nowrap;
}
.wm-tools {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.4rem;
    margin-left: auto;
    flex: 0 1 auto;
}
.wm-dim-wrap {
    position: relative;
}
.wm-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    padding: 0.52rem 0.9rem;
    flex: 0 0 auto;
    position: relative;
    z-index: 30;
    overflow: hidden;
    border-radius: 0 0 1rem 1rem;
    border-top: 1px solid rgba(224, 176, 160, 0.16);
    background: linear-gradient(180deg, rgba(40, 20, 22, 0.92), rgba(130, 56, 62, 0.92));
}
.wm-foot .wm-sub {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}
.wm-foot .wm-goto {
    margin-left: auto;
    flex: 0 0 auto;
}
.wm-goto {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}
.wm-goto-xz {
    width: 8.5rem;
    border: 1px solid rgba(224, 176, 160, 0.28);
    background: rgba(16, 10, 12, 0.72);
    color: #f0dcd4;
    border-radius: 999px;
    padding: 0.28rem 0.7rem;
    font-size: 0.8rem;
}
.wm-goto-xz:focus {
    outline: none;
    border-color: rgba(232, 190, 168, 0.5);
}
.wm-goto-btn,
.wm-dim-btn,
.wm-dim,
.wm-world-opt,
.wm-recenter {
    border: 1px solid rgba(224, 176, 160, 0.28);
    background: rgba(28, 16, 18, 0.7);
    color: #f0dcd4;
    border-radius: 999px;
    padding: 0.28rem 0.8rem;
    font-size: 0.8rem;
    cursor: pointer;
    user-select: none;
}
.wm-goto-btn:hover,
.wm-dim-btn:hover,
.wm-dim:hover,
.wm-world-opt:hover,
.wm-recenter:hover {
    background: rgba(140, 60, 66, 0.78);
    border-color: rgba(224, 176, 160, 0.42);
}
.wm-dim-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}
.wm-dim-caret {
    font-size: 0.65rem;
    opacity: 0.8;
}
.wm-dim-menu {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 200;
    min-width: 11rem;
    max-width: min(18rem, 70vw);
    max-height: min(18rem, 50vh);
    overflow-x: hidden;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.3rem 0.28rem 0.3rem 0.3rem;
    border-radius: 0.7rem;
    border: 1px solid rgba(224, 176, 160, 0.28);
    background: rgba(28, 16, 18, 0.96);
    box-shadow: 0 10px 22px rgba(8, 4, 6, 0.45);
    scrollbar-width: thin;
    scrollbar-color: rgba(224, 176, 160, 0.55) rgba(16, 8, 10, 0.45);
    scrollbar-gutter: stable;
}
.wm-dim-menu::-webkit-scrollbar {
    width: 8px;
}
.wm-dim-menu::-webkit-scrollbar-corner {
    background: transparent;
}
.wm-dim-menu::-webkit-scrollbar-track {
    margin: 0.35rem 0;
    background: rgba(16, 8, 10, 0.35);
    border-radius: 999px;
}
.wm-dim-menu::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(255, 176, 140, 0.72), rgba(154, 68, 76, 0.85));
    border: 2px solid rgba(28, 16, 18, 0.96);
    border-radius: 999px;
}
.wm-dim-menu::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, rgba(255, 210, 186, 0.88), rgba(160, 70, 74, 0.95));
}
.wm-dim-filter {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid rgba(224, 176, 160, 0.28);
    background: rgba(16, 10, 12, 0.88);
    color: #f0dcd4;
    border-radius: 0.45rem;
    padding: 0.28rem 0.45rem;
    font-size: 0.75rem;
}
.wm-dim-filter:focus {
    outline: none;
    border-color: rgba(232, 190, 168, 0.5);
}
.wm-dim-menu[hidden] {
    display: none;
}
.wm-dim,
.wm-world-opt {
    width: 100%;
    text-align: left;
    border-radius: 0.55rem;
}
.wm-dim-btn.is-on,
.wm-dim.is-on,
.wm-world-opt.is-on {
    background: linear-gradient(180deg, #9a444c, #6a2c34);
    border-color: rgba(232, 190, 168, 0.45);
    color: #fff7f2;
}
.wm-view {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    background-color: #120e10;
    background-image:
        repeating-linear-gradient(
            0deg,
            rgba(255, 220, 200, 0.045) 0 1px,
            transparent 1px 32px
        ),
        repeating-linear-gradient(
            90deg,
            rgba(255, 220, 200, 0.045) 0 1px,
            transparent 1px 32px
        ),
        radial-gradient(ellipse 70% 60% at 50% 42%, rgba(72, 36, 38, 0.22), transparent 64%),
        linear-gradient(180deg, #1c1416 0%, #120e10 100%);
    cursor: grab;
    touch-action: none;
    overscroll-behavior: none;
}
.wm-view.is-drag {
    cursor: grabbing;
}
.wm-ico-btn {
    position: absolute;
    z-index: 8;
    pointer-events: auto;
    width: 2rem;
    height: 2rem;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(224, 176, 160, 0.32);
    background: rgba(28, 16, 18, 0.82);
    color: #f0dcd4;
    border-radius: 0.5rem;
    cursor: pointer;
}
.wm-ico-btn:hover {
    background: rgba(140, 60, 66, 0.88);
    border-color: rgba(224, 176, 160, 0.5);
}
.wm-ico-btn.is-on {
    background: linear-gradient(180deg, #9a444c, #6a2c34);
    border-color: rgba(232, 190, 168, 0.45);
    color: #fff7f2;
}
.wm-ico-btn svg {
    width: 1.05rem;
    height: 1.05rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.wm-refresh {
    top: 10px;
    left: 10px;
    right: auto;
}
.wm-fs {
    top: 10px;
    right: 10px;
    left: auto;
}
.wm-fs .wm-ico-fs-exit {
    display: none;
}
.wm-fs.is-on .wm-ico-fs {
    display: none;
}
.wm-fs.is-on .wm-ico-fs-exit {
    display: block;
}
.wm-world {
    position: absolute;
    left: 0;
    top: 0;
    width: 0;
    height: 0;
    overflow: visible;
    pointer-events: none;
}
.wm-cell {
    position: absolute;
    width: 512px;
    height: 512px;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}
/* Tailwind preflight sets img { max-width: 100% }. The world layer is 0×0
   (children are absolutely placed), so that rule collapses every tile. */
.wm-cell:not(.is-ready) img {
    visibility: hidden;
}
.wm-world img {
    position: absolute;
    left: 0;
    top: 0;
    display: block;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    image-rendering: pixelated;
    -ms-interpolation-mode: nearest-neighbor;
    background-color: transparent;
    pointer-events: none;
    -webkit-user-drag: none;
}
.wm-loading {
    position: absolute;
    inset: 0;
    z-index: 2;
    box-sizing: border-box;
    pointer-events: none;
    display: none;
}
.wm-cell.is-planned .wm-loading {
    display: block;
    border: 3px solid rgba(200, 140, 120, 0.42);
    background: rgba(140, 52, 48, 0.14);
    box-shadow: none;
    animation: none;
    opacity: 0.7;
}
.wm-cell.is-working .wm-loading {
    display: block;
    border: 5px solid rgba(255, 186, 160, 0.92);
    background: rgba(210, 78, 64, 0.28);
    box-shadow:
        0 0 28px rgba(255, 140, 110, 0.5),
        inset 0 0 56px rgba(255, 176, 140, 0.28);
    animation: wm-load-pulse 0.85s ease-in-out infinite alternate;
}
@keyframes wm-load-pulse {
    from {
        opacity: 0.55;
        border-color: rgba(255, 168, 140, 0.7);
    }
    to {
        opacity: 1;
        border-color: rgba(255, 214, 190, 1);
    }
}
.wm-heads {
    position: absolute;
    left: 0;
    top: 0;
    width: 0;
    height: 0;
    overflow: visible;
    pointer-events: none;
    z-index: 6;
}
.wm-pin {
    position: absolute;
    width: 36px;
    margin: 0;
    transform: translate(-50%, -78%);
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: auto;
}
.wm-pin-face {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    border: 2px solid #f6eee8;
    box-shadow: 0 2px 8px rgba(8, 4, 4, 0.65);
    background: #4a2628;
    overflow: hidden;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}
.wm-pin-face img {
    display: block;
    width: 28px !important;
    height: 28px !important;
    max-width: none !important;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}
.wm-pin-letter {
    display: none;
    width: 28px;
    height: 28px;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: #fff7f2;
    background: #6a2c34;
}
.wm-pin.is-fallback .wm-pin-letter {
    display: flex;
}
.wm-pin.is-fallback img {
    display: none;
}
.wm-pin.is-offline {
    opacity: 0.42;
}
.wm-pin.is-offline .wm-pin-face {
    border-color: rgba(246, 238, 232, 0.42);
    box-shadow: 0 1px 5px rgba(8, 4, 4, 0.35);
}
.wm-pin-off {
    margin-top: 1px;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: lowercase;
    color: rgba(254, 226, 226, 0.95);
    text-shadow: 0 1px 2px rgba(8, 4, 4, 0.95);
    line-height: 1.1;
}
.wm-pin-name {
    margin-top: 2px;
    max-width: 76px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 10px;
    font-weight: 600;
    color: #fff7f2;
    text-shadow: 0 1px 2px rgba(8, 4, 4, 0.95);
    line-height: 1.15;
    text-align: center;
}
.wm-marks {
    position: absolute;
    left: 0;
    top: 0;
    width: 0;
    height: 0;
    overflow: visible;
    pointer-events: none;
    z-index: 6;
}
.wm-mark {
    position: absolute;
    width: 16px;
    height: 22px;
    margin: 0;
    transform: translate(-50%, -92%);
    pointer-events: none;
}
.wm-mark-dot {
    display: block;
    width: 12px;
    height: 12px;
    margin: 0 auto;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    background: #ef4444;
    border: 2px solid #fee2e2;
    box-shadow: 0 2px 8px rgba(8, 4, 4, 0.65);
}
.wm-coords {
    position: absolute;
    left: 14px;
    bottom: 12px;
    z-index: 7;
    color: #fff6f0;
    font-size: 0.82rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
    pointer-events: none;
    padding: 0.2rem 0.45rem;
    border-radius: 0.35rem;
    background: rgba(8, 4, 6, 0.52);
    text-shadow:
        0 1px 2px rgba(0, 0, 0, 0.95),
        0 0 10px rgba(0, 0, 0, 0.7);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}
.wm-coords.is-pin {
    color: #86efac;
    pointer-events: auto;
    cursor: pointer;
}
.wm-coords.is-pin:hover {
    color: #bbf7d0;
    text-decoration: underline;
}
.wm-hint {
    position: absolute;
    right: 14px;
    left: auto;
    bottom: 12px;
    z-index: 7;
    color: rgba(244, 220, 210, 0.72);
    font-size: 0.75rem;
    pointer-events: none;
    text-shadow: 0 1px 3px rgba(16, 8, 8, 0.85);
    transition: opacity 0.7s ease;
}
.wm-hint.is-gone {
    opacity: 0;
}
.wm-map-btn {
    border: 1px solid rgba(224, 176, 160, 0.35);
    background: rgba(120, 52, 52, 0.72);
    color: #f6eee8;
    border-radius: 8px;
    padding: 0.25rem 0.65rem;
    font-size: 0.8rem;
    text-decoration: none;
    cursor: pointer;
}
.wm-map-btn:hover {
    background: rgba(150, 64, 62, 0.82);
}
/* Map chrome is not copyable — selecting text was stealing pan gestures.
   Lock-card !weblink stays selectable. */
#map-stage,
#map-stage * {
    -webkit-user-select: none !important;
    user-select: none !important;
}
#map-stage input,
#map-stage textarea {
    -webkit-user-select: text !important;
    user-select: text !important;
}
#map-need-link,
#map-need-link * {
    -webkit-user-select: text !important;
    user-select: text !important;
}
body.r5-unlinked #map-stage {
    display: none !important;
}

.es-btn.mapish {
    background: rgba(150, 68, 64, 0.88);
    border-color: rgba(224, 176, 160, 0.42);
    color: #fff7f2;
}
.es-btn.mapish:hover {
    filter: brightness(1.08);
}
#map-stage.card,
#map-stage.wm-site-card {
    overflow: hidden !important;
    border-radius: 1rem;
}
@media (max-width: 900px) {
    body.theme-map,
    body.theme-map.font-sans {
        padding-bottom: max(0.45rem, env(safe-area-inset-bottom, 0px));
    }
    .wm-site-card {
        --wm-page-chrome: 10.75rem;
    }
    .wm-tools {
        flex-wrap: wrap;
    }
}
#map-stage:fullscreen,
#map-stage:-webkit-full-screen,
#map-stage.is-fs {
    width: 100vw;
    height: 100vh;
    max-height: none;
    min-height: 100vh;
    border-radius: 0;
    border: none;
}
#map-stage:fullscreen .wm-head,
#map-stage:-webkit-full-screen .wm-head,
#map-stage.is-fs .wm-head,
#map-stage:fullscreen .wm-foot,
#map-stage:-webkit-full-screen .wm-foot,
#map-stage.is-fs .wm-foot {
    border-radius: 0;
}
#map-stage.is-fs {
    position: fixed;
    inset: 0;
    z-index: 80;
}
#map-stage:fullscreen .wm-view,
#map-stage:-webkit-full-screen .wm-view,
#map-stage.is-fs .wm-view {
    flex: 1;
    min-height: 0;
}
.wm-fs.is-on {
    background: linear-gradient(180deg, #9a444c, #6a2c34);
    border-color: rgba(232, 190, 168, 0.45);
    color: #fff7f2;
}
