/* The public map page (src/web/views/publicMapView.js, public/map/bonemap.js).
   Colours and type come from the site's own tokens (publicShell). */
.bm-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 0.6rem 1rem;
    padding: 0.7rem 1rem;
    background: var(--panel);
    border-bottom: 1px solid var(--green-dim);
    position: relative;
    /* Above Leaflet's panes (400 and up) and controls (1000): the grid menu
       drops down from the toolbar over the map and must stay clickable. */
    z-index: 1100;
}
.bm-field {
    display: grid;
    gap: 0.2rem;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--steel);
}
.bm-field select,
.bm-field input {
    font: 0.95rem var(--font-body);
    text-transform: none;
    letter-spacing: 0;
    color: var(--paper);
    background: var(--panel-2);
    border: 1px solid var(--green-dim);
    border-radius: 6px;
    padding: 0.45rem 0.6rem;
    min-width: 10rem;
}
.bm-search input {
    min-width: 14rem;
}
.bm-goto input {
    min-width: 9rem;
}
/* The hidden attribute must win over .bm-field's display: grid. */
.bm-toolbar [hidden] {
    display: none;
}
.bm-group {
    display: flex;
    gap: 0.35rem;
}
.bm-toolbar button {
    font: 600 0.85rem var(--font-body);
    color: var(--paper-dim);
    background: var(--panel-2);
    border: 1px solid var(--green-dim);
    border-radius: 6px;
    padding: 0.5rem 0.8rem;
    cursor: pointer;
}
.bm-toolbar button:hover {
    border-color: var(--green);
    color: var(--paper);
}
.bm-toolbar button[aria-pressed='true'] {
    background: var(--green-dim);
    border-color: var(--green);
    color: var(--paper);
}
#bonemap {
    width: 100%;
    height: 100%;
    min-height: 20rem;
    background: var(--ink);
}
#bonemap:focus-visible {
    outline: 2px solid var(--green-bright);
    outline-offset: -2px;
}
.bm-readout {
    display: block;
    padding: 0.55rem 1rem;
    font: 0.85rem var(--font-mono);
    font-variant-numeric: tabular-nums;
    color: var(--paper-dim);
    background: var(--panel);
    border-top: 1px solid var(--green-dim);
    min-height: 2.4rem;
}
.bm-readout b {
    color: var(--green-bright);
    font-weight: 600;
}

/* Leaflet sits on the site's ink, not its default grey. */
.bonemap-page .leaflet-container {
    background: var(--ink);
    font-family: var(--font-body);
}
.bonemap-page .leaflet-bar a {
    background: var(--panel-2);
    color: var(--paper);
    border-color: var(--green-dim);
}
.bonemap-page .leaflet-bar a:hover {
    background: var(--green-dim);
}
.bm-place {
    font: 600 12px var(--font-body);
    color: #fff;
    text-shadow:
        0 0 3px #000,
        0 0 2px #000;
    white-space: nowrap;
    pointer-events: none;
}
.bm-place.bm-city {
    font-size: 15px;
    font-family: var(--font-display);
    letter-spacing: 0.02em;
}
.bm-place.bm-minor {
    font-weight: 400;
    font-style: italic;
    opacity: 0.9;
}
.bm-gridlabel {
    display: inline-block;
    font: 600 11px var(--font-mono);
    font-variant-numeric: tabular-nums;
    color: #fff;
    /* A dark backing reads on the satellite and the pale topographic style alike. */
    background: rgba(8, 12, 8, 0.72);
    border-radius: 3px;
    padding: 1px 4px;
    white-space: nowrap;
    pointer-events: none;
}
.bm-ruler-label {
    font: 600 12px var(--font-mono);
    background: var(--panel);
    color: var(--green-bright);
    border: 1px solid var(--green);
    border-radius: 4px;
    padding: 2px 6px;
    white-space: nowrap;
}

@media (max-width: 640px) {
    .bm-toolbar {
        padding: 0.5rem 0.6rem;
        gap: 0.4rem;
    }
    .bm-field span {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
    }
    .bm-field select,
    .bm-search input {
        min-width: 0;
        width: 100%;
    }
    .bm-search,
    .bm-goto {
        flex: 1 1 100%;
    }
    .bm-goto input {
        min-width: 0;
        width: 100%;
    }
    .bm-toolbar button {
        padding: 0.45rem 0.6rem;
    }
    .bm-readout {
        font-size: 0.78rem;
    }
}

/* Layers (public/map/layers.js): the map stage holds the map and two
   side panels that sit over it. */
.bm-stage {
    position: relative;
    min-height: 0;
}
.bm-panel {
    position: absolute;
    top: 0.6rem;
    bottom: 0.6rem;
    width: min(22rem, calc(100% - 1.2rem));
    overflow-y: auto;
    overscroll-behavior: contain;
    z-index: 800;
    padding: 0.8rem 0.9rem 1rem;
    background: color-mix(in srgb, var(--panel) 96%, transparent);
    border: 1px solid var(--green-dim);
    border-radius: 10px;
    box-shadow: var(--shadow-md);
    color: var(--paper-dim);
    font-size: 0.88rem;
}
.bm-panel[hidden] {
    display: none;
}
/* Clear of the zoom buttons in the top-left corner. */
.bm-panel-left {
    left: 3.4rem;
}
.bm-panel-right {
    right: 0.6rem;
}
.bm-panel-head {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.4rem;
}
.bm-panel-head h2 {
    flex: 1;
    margin: 0;
    font-size: 1.25rem;
    color: var(--paper);
}
.bm-close {
    font: 600 1.3rem/1 var(--font-body);
    color: var(--paper-dim);
    background: none;
    border: 0;
    cursor: pointer;
    padding: 0.2rem 0.4rem;
}
.bm-close:hover {
    color: var(--paper);
}
.bm-panel-actions {
    display: flex;
    gap: 0.4rem;
    margin-bottom: 0.4rem;
}
.bm-panel button:not(.bm-close) {
    font: 600 0.8rem var(--font-body);
    color: var(--paper-dim);
    background: var(--panel-2);
    border: 1px solid var(--green-dim);
    border-radius: 6px;
    padding: 0.4rem 0.7rem;
    cursor: pointer;
}
.bm-panel-note {
    font-size: 0.78rem;
    color: var(--steel);
    margin: 0.3rem 0 0.6rem;
}
.bm-panel fieldset {
    border: 0;
    margin: 0 0 0.7rem;
    padding: 0;
}
.bm-panel legend {
    font: 0.7rem var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--steel);
    margin-bottom: 0.25rem;
}
.bm-filter {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.22rem 0;
    cursor: pointer;
}
.bm-filter input {
    margin: 0;
    accent-color: var(--green);
}
.bm-filter svg {
    flex: none;
}
.bm-filter-name {
    flex: 1;
    min-width: 0;
}
.bm-filter-count {
    font: 0.75rem var(--font-mono);
    font-variant-numeric: tabular-nums;
    color: var(--steel);
}
.bm-swatch {
    flex: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    opacity: 0.8;
}
.bm-blip {
    background: none;
    border: 0;
}
.bm-blip svg {
    display: block;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.6));
}
.bm-cluster {
    background: none;
    border: 0;
}
.bm-cluster span {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid #0b0f0b;
    color: #fff;
    font: 700 12px var(--font-mono);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}
.bm-place small {
    display: block;
    font-size: 0.78em;
    font-weight: 400;
    opacity: 0.85;
}
.bm-detail-icon {
    flex: none;
    display: flex;
}
.bm-detail-key code {
    font-size: 0.78rem;
    color: var(--steel);
}
.bm-facts {
    margin: 0.4rem 0;
    padding-left: 1.1rem;
}
.bm-panel h3 {
    margin: 0.9rem 0 0.3rem;
    font-size: 0.95rem;
    color: var(--paper);
}
.bm-panel ul {
    margin: 0.2rem 0;
    padding-left: 1.1rem;
}
.bm-panel details {
    margin: 0.25rem 0;
}
.bm-panel summary {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.3rem 0.5rem;
    background: var(--panel-2);
    border-radius: 6px;
}
.bm-chip {
    display: inline-block;
    margin-left: 0.3rem;
    padding: 0.05rem 0.5rem;
    border-radius: 999px;
    background: var(--green-dim);
    color: var(--paper);
    font-size: 0.78rem;
}
.bm-tag {
    font: 0.68rem var(--font-mono);
    color: var(--amber);
}
.bm-spot b {
    color: var(--green-bright);
    font-family: var(--font-mono);
}
@media (max-width: 640px) {
    .bm-panel {
        top: auto;
        left: 0.4rem;
        right: 0.4rem;
        bottom: 0.4rem;
        width: auto;
        max-height: 65%;
    }
}
/* The map fills its stage; the panels float over it. */
.bm-stage #bonemap {
    position: absolute;
    inset: 0;
    height: auto;
    min-height: 0;
}
.bm-panel-sub {
    font: 600 0.75rem var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--green-bright);
    margin: 1rem 0 0.4rem;
    padding-top: 0.6rem;
    border-top: 1px solid var(--green-dim);
}
.bm-tier-key {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem 0.8rem;
    margin: 0.3rem 0;
    font-size: 0.8rem;
}
.bm-tier {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

/* the spot a bot link points at (#...&pin=1); the tip sits on the point */
.bm-pin {
    position: absolute;
    left: -11px;
    top: -30px;
    width: 22px;
    height: 22px;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    background: #e5484d;
    border: 2px solid #fff;
    box-shadow: 0 2px 6px rgb(0 0 0 / 0.6);
}
.bm-pin::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 5px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #fff;
}

/* ---- event wheel (eventWheel.js): staff of a server on this map */
.bm-wheel {
    position: absolute;
    z-index: 1000;
    width: 0;
    height: 0;
}
.bm-wheel-hub {
    position: absolute;
    transform: translate(-50%, -50%);
    width: 84px;
    height: 84px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.1rem;
    text-align: center;
    font: 0.72rem/1.25 var(--font-mono);
    color: var(--paper-dim);
    background: var(--panel);
    border: 1px solid var(--green-dim);
    box-shadow: 0 4px 14px rgb(0 0 0 / 0.55);
    pointer-events: none;
}
.bm-wheel-hub b {
    color: var(--paper);
}
.bm-wheel-slice {
    position: absolute;
    left: 0;
    top: 0;
    min-width: 56px;
    min-height: 44px;
    padding: 0.3rem 0.55rem;
    border-radius: 999px;
    font: 600 0.8rem var(--font-body);
    color: var(--paper);
    background: var(--panel-2);
    border: 1px solid var(--green);
    box-shadow: 0 3px 10px rgb(0 0 0 / 0.5);
    cursor: pointer;
}
.bm-wheel-slice:hover,
.bm-wheel-slice:focus-visible {
    background: var(--green-dim);
}
.bm-wheel-copy {
    border-color: var(--steel);
    color: var(--paper-dim);
}
@media (prefers-reduced-motion: no-preference) {
    .bm-wheel-slice {
        animation: bm-wheel-in 0.14s ease-out both;
    }
}
@keyframes bm-wheel-in {
    from {
        opacity: 0;
    }
}

.bm-ev {
    position: absolute;
    z-index: 1000;
    right: 0.75rem;
    top: 0.75rem;
    width: min(20rem, calc(100% - 1.5rem));
    max-height: calc(100% - 1.5rem);
    overflow: auto;
    padding: 0.9rem 1rem;
    color: var(--paper-dim);
    background: var(--panel);
    border: 1px solid var(--green-dim);
    border-radius: 4px;
    box-shadow: 0 10px 28px -8px rgb(0 0 0 / 0.7);
    font: 0.9rem var(--font-body);
}
.bm-ev h2 {
    margin: 0 0 0.25rem;
    font: 700 1.05rem var(--font-display);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--paper);
}
.bm-ev-at,
.bm-ev-server,
.bm-ev-note {
    margin: 0 0 0.6rem;
    font-size: 0.82rem;
}
.bm-ev-at {
    font-family: var(--font-mono);
}
.bm-ev-note {
    color: var(--steel);
}
.bm-ev-form {
    display: grid;
    gap: 0.55rem;
}
.bm-ev-field {
    display: grid;
    gap: 0.2rem;
}
.bm-ev-field select,
.bm-ev-field input {
    font: 0.9rem var(--font-body);
    color: var(--paper);
    background: var(--panel-2);
    border: 1px solid var(--green-dim);
    border-radius: 3px;
    padding: 0.35rem 0.45rem;
}
.bm-ev-groups {
    border: 1px solid var(--green-dim);
    border-radius: 3px;
    padding: 0.4rem 0.6rem;
    max-height: 9rem;
    overflow: auto;
    display: grid;
    gap: 0.2rem;
}
.bm-ev-check {
    display: flex;
    gap: 0.45rem;
    align-items: center;
}
.bm-ev-result:empty {
    display: none;
}
.bm-ev-result {
    margin: 0;
    padding: 0.45rem 0.6rem;
    border-left: 3px solid var(--steel);
    background: var(--panel-2);
}
.bm-ev-result.is-ok {
    border-color: var(--green);
}
.bm-ev-result.is-fail {
    border-color: var(--rust);
}
.bm-ev-result.is-warn {
    border-color: var(--amber);
}
.bm-ev-actions {
    display: flex;
    gap: 0.5rem;
}
.bm-ev-actions button {
    flex: 1;
    min-height: 40px;
    font: 600 0.9rem var(--font-body);
    border-radius: 3px;
    cursor: pointer;
    color: var(--paper);
    background: var(--panel-2);
    border: 1px solid var(--green-dim);
}
.bm-ev-actions .bm-ev-go,
.bm-ev-actions .bm-ev-anyway {
    background: var(--green-dim);
    border-color: var(--green);
}
/* Restarting kicks everyone online (eventWheel.js offerRestart): marked as disruptive */
.bm-ev-actions .bm-ev-restart {
    border-color: var(--rust);
}
.bm-ev-actions button:disabled {
    opacity: 0.6;
    cursor: default;
}

/* Each layer category's own All and None (layers.js) */
.bm-panel legend {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    width: 100%;
}
.bm-cat-actions {
    display: inline-flex;
    gap: 0.25rem;
    text-transform: none;
    letter-spacing: 0;
}
.bm-panel .bm-cat-actions button:not(.bm-close) {
    font: 600 0.7rem var(--font-body);
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
}
.bm-panel .bm-cat-actions button[aria-pressed='true'] {
    background: var(--green-dim);
    border-color: var(--green);
    color: var(--paper);
}
.bm-panel button:focus-visible,
.bm-grid-menu button:focus-visible {
    outline: 2px solid var(--green-bright);
    outline-offset: 1px;
}

/* The grid menu (bonemap.js): Off, Auto, 1 km, 100 m */
.bm-grid-wrap {
    position: relative;
    display: inline-flex;
}
.bm-grid-menu {
    position: absolute;
    top: calc(100% + 0.3rem);
    right: 0;
    z-index: 1001;
    display: grid;
    gap: 0.2rem;
    min-width: 13rem;
    padding: 0.4rem;
    background: var(--panel);
    border: 1px solid var(--green-dim);
    border-radius: 8px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
}
.bm-grid-menu[hidden] {
    display: none;
}
.bm-grid-menu button {
    display: grid;
    grid-template-columns: 1rem 1fr;
    gap: 0.4rem;
    text-align: left;
    font: 0.85rem var(--font-body);
    color: var(--paper-dim);
    background: transparent;
    border: 0;
    border-radius: 5px;
    padding: 0.4rem 0.5rem;
    cursor: pointer;
}
.bm-grid-menu button:hover {
    background: var(--panel-2);
    color: var(--paper);
}
.bm-grid-menu button[aria-checked='true'] {
    color: var(--paper);
}
.bm-grid-menu button[aria-checked='true']::before {
    content: '\2713';
    color: var(--green-bright);
}
.bm-grid-menu button[aria-checked='false']::before {
    content: '';
}
.bm-grid-menu small {
    grid-column: 2;
    color: var(--steel);
    font-size: 0.72rem;
}

/* Grid numbers count squares (bonemap.js): centred in their square along the
   top edge (columns) and the left edge (rows), as the in-game map shows them. */
.bm-gridlabel-anchor {
    width: 0;
    height: 0;
}
.bm-gridlabel.bm-gridlabel-col {
    transform: translateX(-50%);
}
.bm-gridlabel.bm-gridlabel-row {
    transform: translateY(-50%);
}
