:root {
    color-scheme: dark;
    --ink: #ecede5;
    --muted: #89968b;
    --surface: #141c18;
    --line: #2a352d;
    --gold: #dbb66d;
    --panel: 310px;
    font-family:
        system-ui,
        -apple-system,
        "Segoe UI",
        sans-serif;
    font-size: 14px;
}
* {
    box-sizing: border-box;
}
body {
    margin: 0;
    overflow: hidden;
    background: #101715;
    color: var(--ink);
}
button,
input,
select {
    font: inherit;
}
button,
a,
input,
select,
summary {
    outline-offset: 4px;
}
button {
    cursor: pointer;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible {
    outline: 2px solid var(--gold);
}
button {
    color: inherit;
}
#map {
    position: absolute;
    inset: 0;
    background: #111a16;
}
#explorer {
    position: absolute;
    z-index: 800;
    inset: 16px auto 16px 16px;
    width: var(--panel);
    display: flex;
    flex-direction: column;
    background: rgba(18, 26, 21, 0.97);
    border: 1px solid #394436;
    border-radius: 12px;
    box-shadow: 0 12px 45px #0008;
    transition:
        transform 0.2s,
        opacity 0.2s;
}
.brand {
    padding: 24px 24px 20px;
    border-bottom: 1px solid var(--line);
}
.brand img {
    width: 230px;
    height: 63px;
    object-fit: contain;
    display: block;
    margin: 0 auto 15px;
}
.brand > div {
    font-size: 10px;
    letter-spacing: 3px;
    color: var(--gold);
    display: flex;
    justify-content: space-between;
}
.brand span {
    color: #8e9d8e;
    letter-spacing: 2px;
    font-size: 9px;
}
.explore-body {
    padding: 23px 20px;
    overflow: auto;
    scrollbar-width: thin;
    scrollbar-color: #465447 transparent;
    flex: 1;
}
.section-heading {
    font-size: 9px;
    letter-spacing: 1.55px;
    color: var(--muted);
    margin-bottom: 12px;
}
.map-field-label {
    margin-top: 0;
}
#map-select {
    border-color: #65704d;
    color: #edcf92;
    font-weight: 600;
}
#map-select[aria-busy="true"] {
    opacity: 0.65;
}
.map-description {
    margin: 9px 0 0;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.5;
}
#map-field ~ .section-heading {
    margin-top: 22px;
}
body.player-atlas #map-field ~ .section-heading {
    margin-top: 0;
}
.search-box {
    display: flex;
    gap: 9px;
    align-items: center;
    border: 1px solid #465344;
    border-radius: 6px;
    background: #0d1511;
    padding: 8px 10px;
}
.search-box:focus-within {
    border-color: var(--gold);
}
.search-box > span {
    font-size: 23px;
    color: var(--gold);
    line-height: 1;
}
.search-box input {
    min-width: 0;
    width: 100%;
    border: 0;
    background: none;
    color: var(--ink);
    outline: none;
    font-size: 12px;
}
.search-box kbd {
    color: #6d7b71;
    border: 1px solid #344037;
    padding: 0 5px;
    border-radius: 3px;
}
.field-label {
    display: block;
    color: var(--muted);
    font-size: 9px;
    letter-spacing: 1.8px;
    margin: 22px 0 8px;
}
#direction-field {
    border: 0;
    margin: 0;
    padding: 0;
    min-width: 0;
}
#direction-field[hidden] {
    display: none;
}
#direction-field legend {
    padding: 0;
}
#direction-options {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
}
.direction-option {
    position: relative;
    cursor: pointer;
    text-align: center;
}
.direction-option input {
    appearance: none;
    position: absolute;
    inset: 0;
    margin: 0;
    border-radius: 5px;
    cursor: pointer;
}
.direction-option span {
    display: block;
    padding: 10px 1px;
    border: 1px solid #364538;
    border-radius: 5px;
    font-size: 11px;
    background: #1d2921;
    pointer-events: none;
}
.direction-option:hover span {
    border-color: #7b8464;
}
.direction-option input:checked + span {
    border-color: var(--gold);
    background: #3a3523;
    color: #f0d397;
}
.direction-option input:focus-visible + span {
    outline: 2px solid var(--gold);
    outline-offset: 3px;
}
select {
    width: 100%;
    background: #1d2921;
    border: 1px solid #364538;
    border-radius: 5px;
    padding: 10px 12px;
    color: var(--ink);
    font-size: 12px;
}
.section-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 25px 0 10px;
}
.section-row h2 {
    font-family: Georgia, serif;
    font-size: 19px;
    font-weight: 400;
    margin: 0;
}
.text-button {
    font-size: 11px;
    color: var(--gold);
    background: none;
    border: 0;
    padding: 4px;
}
.layer {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 39px;
    cursor: pointer;
    border-bottom: 1px solid #24302755;
    font-size: 12px;
}
.layer:hover {
    background: #ffffff04;
}
.layer-swatch {
    height: 7px;
    width: 7px;
    border-radius: 50%;
    background: var(--color);
    flex: none;
}
.layer-swatch--dungeon {
    height: 12px;
    width: 11px;
    box-sizing: border-box;
    border: 2px solid var(--color);
    border-bottom-width: 1px;
    border-radius: 6px 6px 1px 1px;
    background: none;
}
.layer-swatch--area {
    height: 10px;
    width: 11px;
    box-sizing: border-box;
    border: 1px dashed var(--color);
    border-radius: 2px;
    background: color-mix(in srgb, var(--color) 22%, transparent);
}
.player-atlas .layer {
    min-height: 44px;
    font-size: 14px;
}
.layer input:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 3px;
}
.layer-name {
    flex: 1;
}
.layer-count {
    font-size: 10px;
    color: #839383;
    font-variant-numeric: tabular-nums;
}
.layer input {
    appearance: none;
    flex: none;
    width: 29px;
    height: 16px;
    border-radius: 12px;
    background: #344036;
    position: relative;
    cursor: pointer;
}
.layer input:before {
    content: "";
    position: absolute;
    width: 10px;
    height: 10px;
    top: 3px;
    left: 3px;
    border-radius: 50%;
    background: #8b968a;
    transition: transform 0.15s;
}
.layer input:checked {
    background: #796540;
}
.layer input:checked:before {
    transform: translateX(13px);
    background: #f2d39a;
}
.muted {
    font-size: 11px;
    color: var(--muted);
    line-height: 1.6;
}
.waypoint {
    display: flex;
    align-items: center;
    gap: 4px;
    border-bottom: 1px solid var(--line);
}
.waypoint > button:first-child {
    flex: 1;
    text-align: left;
    padding: 9px 0;
    font-size: 12px;
    background: none;
    border: 0;
}
.waypoint small {
    display: block;
    color: var(--muted);
    font-size: 10px;
    margin-top: 4px;
}
.waypoint .remove {
    background: none;
    border: 0;
    color: var(--muted);
    font-size: 18px;
}
.waypoint-actions {
    display: flex;
    gap: 12px;
    margin: 8px 0;
}
.coordinates {
    margin-top: 22px;
    border-top: 1px solid var(--line);
    padding-top: 17px;
    font-size: 11px;
    color: var(--muted);
}
.coordinates summary {
    cursor: pointer;
}
.coordinates form {
    display: flex;
    align-items: end;
    gap: 8px;
    margin-top: 10px;
}
.coordinates label {
    min-width: 0;
    flex: 1;
}
.coordinates input {
    width: 100%;
    background: #0e1711;
    color: var(--ink);
    border: 1px solid var(--line);
    padding: 7px;
    border-radius: 4px;
    margin-top: 5px;
}
.coordinates button {
    background: var(--gold);
    color: #1c2119;
    border: 0;
    border-radius: 4px;
    padding: 8px 12px;
}
.panel-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    border-top: 1px solid var(--line);
    padding: 13px 20px;
    color: var(--muted);
    font-size: 10px;
    line-height: 1.4;
}
.status-dot {
    background: #82ad76;
    border-radius: 50%;
    height: 5px;
    width: 5px;
    flex: none;
}
.map-title {
    position: absolute;
    z-index: 700;
    top: 30px;
    left: calc(var(--panel) + 45px);
    pointer-events: none;
    text-shadow: 0 2px 8px #000;
}
.map-title > span {
    color: #f2dfab;
    letter-spacing: 3px;
    font-size: 9px;
}
.map-title h1 {
    font-family: Georgia, serif;
    font-size: 29px;
    font-weight: 400;
    margin: 7px 0;
    color: #f4f0de;
    max-width: calc(100vw - var(--panel) - 140px);
    text-wrap: balance;
}
#map-transition {
    position: absolute;
    z-index: 900;
    top: 115px;
    left: calc(var(--panel) + 45px);
    padding: 9px 13px;
    color: #edcf92;
    background: #142019f2;
    border: 1px solid #4a5843;
    border-radius: 5px;
    font-size: 12px;
    pointer-events: none;
}
.map-tools {
    position: absolute;
    z-index: 750;
    right: 22px;
    top: 25px;
    display: flex;
    flex-direction: column;
    gap: 7px;
}
.map-button {
    width: 38px;
    height: 38px;
    font-size: 24px;
    background: #142019ee;
    border: 1px solid #4a5843;
    border-radius: 6px;
    box-shadow: 0 3px 8px #0004;
    display: grid;
    place-items: center;
}
.map-button:hover {
    background: #28362a;
    border-color: var(--gold);
}
.compass {
    position: absolute;
    right: 25px;
    bottom: 80px;
    z-index: 700;
    text-align: center;
    pointer-events: none;
    color: #d9c58f;
    text-shadow: 0 2px 5px #000;
    width: 54px;
    height: 54px;
    transform: rotate(var(--north-angle, -63deg));
}
.compass span {
    display: block;
    font-size: 10px;
    transform: rotate(calc(-1 * var(--north-angle, -63deg)));
}
.compass div {
    font-size: 42px;
    line-height: 1;
}
.map-bottom {
    position: absolute;
    z-index: 700;
    bottom: 0;
    left: calc(var(--panel) + 32px);
    right: 0;
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 12px 18px;
    background: #111a16df;
    border-top: 1px solid #3b473833;
    font-size: 10px;
    color: #9ba993;
}
.map-bottom #coordinates {
    color: #e1d4ad;
    font-variant-numeric: tabular-nums;
    font-size: 11px;
}
.map-credit {
    margin-left: auto;
    font-size: 9px;
}
.map-credit a {
    color: inherit;
}
.leaflet-control-attribution {
    display: none;
}
#hover-label {
    position: absolute;
    pointer-events: none;
    z-index: 900;
    background: #142019f5;
    color: #ecebdc;
    border: 1px solid #57664c;
    border-radius: 5px;
    padding: 7px 10px;
    font-size: 11px;
    max-width: 280px;
    box-shadow: 0 4px 15px #0006;
}
#toast {
    position: absolute;
    z-index: 1000;
    bottom: 65px;
    left: calc(50% + 90px);
    transform: translate(-50%, 12px);
    padding: 12px 20px;
    background: #18271e;
    border: 1px solid #62704e;
    border-radius: 7px;
    font-size: 12px;
    opacity: 0;
    pointer-events: none;
    transition:
        opacity 0.18s,
        transform 0.18s;
    max-width: 80vw;
}
#toast.show {
    opacity: 1;
    transform: translate(-50%, 0);
}
#loading {
    position: absolute;
    z-index: 1100;
    inset: 0;
    background: #101715;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 14px;
    font-family: Georgia, serif;
    font-size: 20px;
    transition: opacity 0.25s;
}
#loading.done {
    opacity: 0;
    pointer-events: none;
}
.loading-ring {
    width: 24px;
    height: 24px;
    border: 1px solid #384933;
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}
.mobile {
    display: none;
}
.focus #explorer {
    transform: translateX(-350px);
    opacity: 0;
    pointer-events: none;
}
.focus .map-title {
    left: 30px;
}
.focus #map-transition {
    left: 30px;
}
.focus .map-bottom {
    left: 0;
}
.focus #toast {
    left: 50%;
}
.focus #open-panel {
    display: flex;
    position: absolute;
    top: 105px;
    left: 25px;
    z-index: 750;
    width: auto;
    gap: 8px;
    padding: 0 12px;
    font-size: 14px;
}
.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
    background: #17221b;
    color: var(--ink);
    box-shadow: 0 4px 24px #0006;
}
.leaflet-popup-content {
    margin: 18px;
    min-width: 180px;
    max-width: 290px;
}
.popup-title {
    font-family: Georgia, serif;
    color: #edcf92;
    font-size: 20px;
    margin-bottom: 10px;
}
.popup-body {
    white-space: pre-line;
    font-size: 12px;
    color: #acb9aa;
    line-height: 1.65;
    max-height: 240px;
    overflow: auto;
}
.popup-actions {
    display: flex;
    gap: 14px;
    margin-top: 13px;
}
.popup-actions button {
    background: none;
    border: 0;
    color: var(--gold);
    font-size: 11px;
    padding: 3px 0;
}
.popup-coords {
    font-size: 10px;
    color: #788e7c;
    margin-top: 10px;
    font-variant-numeric: tabular-nums;
}
#search-results {
    margin-top: 6px;
    border: 1px solid var(--line);
    border-radius: 5px;
    background: #0e1711;
    max-height: 250px;
    overflow: auto;
}
#search-results button {
    display: block;
    text-align: left;
    width: 100%;
    border: 0;
    border-bottom: 1px solid var(--line);
    background: none;
    padding: 10px;
    color: var(--ink);
    font-size: 12px;
}
#search-results button:hover,
#search-results button:focus {
    background: #273626;
}
#search-results small {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 10px;
}
.empty-result {
    padding: 13px;
    font-size: 12px;
    color: var(--muted);
}
.map-overlay {
    pointer-events: none;
    transform-origin: 0 0;
    will-change: transform;
}
@media (max-width: 760px) {
    :root {
        --panel: 285px;
    }
    #explorer {
        inset: 0 auto 0 0;
        width: min(320px, 88vw);
        border-radius: 0;
        transform: translateX(-105%);
        transition: transform 0.2s;
    }
    body.panel-open #explorer {
        transform: translateX(0);
    }
    .brand {
        position: relative;
        padding: 20px;
    }
    .brand img {
        width: 215px;
    }
    .mobile {
        display: flex;
    }
    #close-panel {
        position: absolute;
        top: 5px;
        right: 7px;
        background: none;
        border: 0;
        font-size: 24px;
        color: var(--muted);
    }
    #open-panel {
        position: absolute;
        z-index: 750;
        left: 16px;
        top: 18px;
        display: flex;
        width: auto;
        padding: 0 12px;
        gap: 8px;
        font-size: 16px;
    }
    .map-title {
        left: 17px;
        top: 79px;
    }
    .map-title h1 {
        font-size: 23px;
        max-width: calc(100vw - 100px);
    }
    #map-transition,
    .focus #map-transition {
        left: 17px;
        top: 163px;
    }
    .map-title > span {
        font-size: 8px;
    }
    .map-tools {
        right: 16px;
        top: 18px;
    }
    .map-bottom {
        left: 0;
        gap: 12px;
        padding: 11px 13px;
        flex-wrap: wrap;
    }
    .map-credit {
        display: none;
    }
    #visible-status {
        margin-left: auto;
        font-size: 9px;
    }
    .compass {
        right: 17px;
        bottom: 62px;
    }
    #toast {
        left: 50%;
        bottom: 58px;
        min-width: 190px;
        text-align: center;
    }
    .focus .map-title {
        left: 17px;
    }
    .focus #open-panel {
        top: 18px;
        left: 16px;
    }
    .focus #explorer {
        opacity: 1;
        pointer-events: auto;
    }
    .focus.panel-open #explorer {
        transform: translateX(0);
    }
}
@media (prefers-reduced-motion: reduce) {
    *,
    *:before,
    *:after {
        animation: none !important;
        transition: none !important;
        scroll-behavior: auto !important;
    }
}

html {
    width: 100%;
    height: 100%;
    overflow: hidden;
}
.focus #explorer {
    visibility: hidden;
}
@media (max-width: 760px) {
    #explorer {
        visibility: hidden;
    }
    .panel-open #explorer,
    .focus.panel-open #explorer {
        visibility: visible;
    }
}

.cluster-list {
    max-height: 280px;
    overflow: auto;
}
.cluster-list button {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: 0;
    border-bottom: 1px solid var(--line);
    padding: 9px 0;
    color: var(--ink);
    font-size: 12px;
}

body {
    width: 100%;
    height: 100%;
    position: relative;
    isolation: isolate;
}

html,
body {
    overflow: clip;
}
