.page-maps .rk-main {
    background: #e8f1df;
}

.maps-page-head {
    min-height: 198px;
    padding: 32px 28px;
    color: #fffbe4;
    background-color: var(--rk-water);
    background-image: url("../images/water-tile.webp");
    background-repeat: repeat;
    background-size: 96px 96px;
    border-bottom: 8px solid var(--rk-sand);
}

.maps-page-head-inner {
    display: flex;
    width: min(100%, 1280px);
    min-height: 126px;
    align-items: center;
    justify-content: space-between;
    gap: 34px;
    margin: 0 auto;
}

.maps-page-title-block {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 18px;
    text-shadow: 2px 2px 0 var(--rk-deep-dark);
}

.maps-page-sprite,
.maps-detail-icon {
    display: block;
    flex: 0 0 auto;
    background-image: url("../images/environment-sprites.webp");
    background-repeat: no-repeat;
    background-size: 512px 512px;
    image-rendering: pixelated;
}

.maps-page-sprite {
    width: 96px;
    height: 96px;
    background-position: -128px -64px;
    filter: drop-shadow(3px 3px 0 rgba(4, 48, 47, 0.72));
}

.maps-page-title-block p,
.maps-detail-head p {
    margin: 0 0 2px;
    color: #fff1a2;
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
}

.maps-page-title-block h1 {
    margin: 0;
    font-size: 40px;
    line-height: 1.08;
}

.maps-page-title-block > div > span {
    display: block;
    max-width: 630px;
    margin-top: 8px;
    font-size: 14px;
    line-height: 1.4;
    font-weight: 700;
}

.maps-page-stats {
    display: grid;
    width: min(100%, 500px);
    min-width: 450px;
    margin: 0;
    overflow: hidden;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    color: var(--rk-ink);
    background: var(--rk-paper);
    border: var(--rk-line);
    border-radius: 6px;
    box-shadow: 5px 5px 0 rgba(4, 48, 47, 0.45);
    text-shadow: none;
}

.maps-page-stats div {
    display: flex;
    min-width: 0;
    min-height: 76px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 9px 8px;
    border-right: 2px solid rgba(24, 58, 54, 0.4);
    text-align: center;
}

.maps-page-stats div:last-child {
    border-right: 0;
}

.maps-page-stats dt {
    color: var(--rk-green-dark);
    font-size: 9px;
    font-weight: 900;
    text-transform: uppercase;
}

.maps-page-stats dd {
    margin: 4px 0 0;
    font-size: 21px;
    line-height: 1.1;
    font-weight: 900;
}

.maps-workspace {
    width: min(calc(100% - 40px), 1280px);
    min-height: 720px;
    margin: 0 auto;
    padding: 28px 0 72px;
}

.maps-directory {
    display: grid;
    overflow: hidden;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    background: #dce9d2;
    border: var(--rk-line);
    border-radius: 6px;
    box-shadow: 4px 4px 0 #7b9b72;
}

.maps-directory button {
    min-width: 0;
    min-height: 46px;
    padding: 8px 7px;
    color: var(--rk-ink);
    background: #f7f1d6;
    border: 0;
    border-right: 2px solid rgba(24, 58, 54, 0.42);
    cursor: pointer;
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
}

.maps-directory button:last-child {
    border-right: 0;
}

.maps-directory button:hover {
    background: #f3dda0;
}

.maps-directory button.is-active {
    color: #fff;
    background: var(--rk-deep);
}

.maps-filter-panel {
    display: grid;
    align-items: end;
    grid-template-columns: minmax(230px, 1.35fr) minmax(150px, 0.7fr) minmax(220px, 1.15fr) minmax(150px, 0.75fr) minmax(250px, 1.4fr);
    gap: 12px;
    margin-top: 15px;
    padding: 15px;
    background: var(--rk-paper-strong);
    border: var(--rk-line);
    border-radius: 6px;
    box-shadow: 4px 4px 0 #91a976;
}

.maps-control {
    min-width: 0;
}

.maps-control label,
.maps-control legend {
    display: block;
    margin: 0 0 6px;
    padding: 0;
    color: var(--rk-deep);
    font-size: 10px;
    line-height: 1;
    font-weight: 900;
    text-transform: uppercase;
}

.maps-control select,
.maps-search-control input {
    width: 100%;
    min-width: 0;
    height: 42px;
    padding: 0 10px;
    color: var(--rk-ink);
    background: #fff;
    border: 2px solid var(--rk-ink);
    border-radius: 4px;
    font-size: 12px;
    font-weight: 800;
}

.maps-control select {
    cursor: pointer;
}

.maps-search-control {
    position: relative;
}

.maps-search-control input {
    padding-right: 40px;
    padding-left: 42px;
}

.maps-search-control input::placeholder {
    color: #687d76;
    opacity: 1;
}

.maps-search-icon {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 26px;
    height: 26px;
    pointer-events: none;
    background-image: url("../images/ui-sprites.webp");
    background-repeat: no-repeat;
    background-position: -78px -52px;
    background-size: 208px 208px;
    image-rendering: pixelated;
}

.maps-search-clear {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 34px;
    height: 34px;
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 4px;
    cursor: pointer;
}

.maps-search-clear:hover {
    background: #e6efd9;
}

.maps-search-clear span::before,
.maps-search-clear span::after {
    content: "";
    position: absolute;
    top: 16px;
    left: 9px;
    width: 16px;
    height: 2px;
    background: var(--rk-ink);
}

.maps-search-clear span::before { transform: rotate(45deg); }
.maps-search-clear span::after { transform: rotate(-45deg); }

.maps-view-control,
.maps-feature-control {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.maps-segmented-control {
    display: grid;
    height: 42px;
    overflow: hidden;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    background: #fff;
    border: 2px solid var(--rk-ink);
    border-radius: 4px;
}

.maps-segmented-control input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.maps-segmented-control label {
    display: flex;
    min-width: 0;
    min-height: 38px;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0 7px;
    cursor: pointer;
    border-right: 1px solid #84948e;
    font-size: 10px;
    text-align: center;
}

.maps-segmented-control label:last-child { border-right: 0; }

.maps-segmented-control input:checked + label {
    color: #fffbe4;
    background: var(--rk-deep);
}

.maps-marker-toggles {
    display: flex;
    min-height: 42px;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
    padding: 5px 8px;
    background: #fff;
    border: 2px solid var(--rk-ink);
    border-radius: 4px;
}

.maps-marker-toggles label {
    display: inline-flex;
    min-height: 26px;
    align-items: center;
    gap: 4px;
    margin: 0;
    color: var(--rk-ink);
    cursor: pointer;
    font-size: 9px;
    text-transform: none;
}

.maps-marker-toggles input {
    accent-color: var(--rk-deep);
}

.maps-toggle-dot,
.maps-key-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border: 1px solid var(--rk-ink);
    border-radius: 50%;
}

.maps-toggle-dot.is-spot,
.maps-key-dot.is-spot { background: #ebd35c; }
.maps-toggle-dot.is-exit,
.maps-key-dot.is-exit { background: #c75b43; }
.maps-toggle-dot.is-npc,
.maps-key-dot.is-npc { background: #5a86af; }

.maps-results-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 14px 3px 10px;
}

.maps-results-status p {
    margin: 0;
    color: #596e64;
    font-size: 12px;
    font-weight: 800;
}

.maps-results-status strong {
    color: var(--rk-deep);
    font-size: 17px;
}

#maps-filter-summary { text-align: right; }

.maps-layout {
    display: grid;
    align-items: start;
    grid-template-columns: minmax(0, 1.58fr) minmax(320px, 0.82fr);
    gap: 20px;
}

.maps-atlas-panel,
.maps-detail-panel {
    overflow: hidden;
    background: #fff9dc;
    border: var(--rk-line);
    border-radius: 6px;
    box-shadow: 5px 5px 0 #77966f;
}

.maps-current-head {
    display: flex;
    min-height: 92px;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 13px 16px;
    color: #fff;
    background: var(--rk-deep);
    border-bottom: 3px solid var(--rk-ink);
}

.maps-current-head p {
    margin: 0 0 2px;
    color: #f5d675;
    font-size: 9px;
    font-weight: 900;
    text-transform: uppercase;
}

.maps-current-head h2 {
    margin: 0;
    font-size: 25px;
    line-height: 1.1;
}

.maps-current-head > div > span {
    display: block;
    max-width: 700px;
    margin-top: 5px;
    color: #e3efd7;
    font-size: 10px;
    line-height: 1.35;
    font-weight: 700;
}

.maps-access-chip {
    display: inline-flex;
    max-width: 240px;
    min-height: 27px;
    flex: 0 0 auto;
    align-items: center;
    padding: 4px 8px;
    color: var(--rk-ink);
    background: #fff0a8;
    border: 1px solid var(--rk-ink);
    border-radius: 4px;
    font-size: 9px;
    line-height: 1.25;
    font-weight: 900;
}

.maps-canvas-shell {
    padding: 14px;
    background: #29464a;
}

.maps-canvas {
    position: relative;
    overflow: hidden;
    width: 100%;
    aspect-ratio: var(--map-aspect);
    background: #93cbd4;
    border: 3px solid #0c2628;
    box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.4);
}

.maps-canvas > img {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    image-rendering: pixelated;
}

.maps-marker-layer {
    position: absolute;
    inset: 0;
}

.maps-marker-layer[hidden] { display: none; }

.maps-marker {
    position: absolute;
    z-index: 2;
    display: block;
    width: 17px;
    height: 17px;
    padding: 0;
    transform: translate(-50%, -50%);
    background: transparent;
    border: 0;
    cursor: pointer;
}

.maps-marker-glyph {
    display: block;
    width: 100%;
    height: 100%;
    border: 2px solid #173438;
    border-radius: 50%;
    box-shadow: 1px 1px 0 rgba(255, 255, 255, 0.65);
}

.maps-marker.is-spot { width: 13px; height: 13px; opacity: 0.82; }
.maps-marker.is-spot .maps-marker-glyph { background: #ebd35c; }
.maps-marker.is-exit { width: 22px; height: 22px; z-index: 5; }
.maps-marker.is-exit .maps-marker-glyph { background: #c75b43; border-radius: 4px; }
.maps-marker.is-npc { width: 20px; height: 20px; z-index: 4; }
.maps-marker.is-npc .maps-marker-glyph { background: #5a86af; }

.maps-marker.is-selected .maps-marker-glyph,
.maps-marker:hover .maps-marker-glyph,
.maps-marker:focus-visible .maps-marker-glyph {
    outline: 3px solid #fff;
    outline-offset: 2px;
    box-shadow: 0 0 0 5px #cf9a35;
}

.maps-marker-label {
    position: absolute;
    bottom: calc(100% + 7px);
    left: 50%;
    display: none;
    min-width: max-content;
    max-width: 210px;
    padding: 4px 6px;
    color: #fffbe4;
    background: rgba(8, 37, 38, 0.94);
    border: 1px solid #fff1a5;
    border-radius: 3px;
    transform: translateX(-50%);
    font-size: 9px;
    line-height: 1.2;
    font-weight: 900;
    pointer-events: none;
    white-space: normal;
}

.maps-marker:hover .maps-marker-label,
.maps-marker:focus-visible .maps-marker-label,
.maps-marker.is-selected .maps-marker-label { display: block; }

.maps-canvas-note {
    margin: 10px 2px 0;
    color: #e8f4dc;
    font-size: 9px;
    line-height: 1.4;
    font-weight: 700;
}

.maps-map-key {
    display: flex;
    flex-wrap: wrap;
    gap: 9px 16px;
    padding: 10px 14px 12px;
    color: #52685d;
    background: #fff9dc;
    border-top: 2px solid #a0b28c;
    font-size: 9px;
    font-weight: 800;
}

.maps-map-key span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.maps-detail-panel {
    position: sticky;
    top: 98px;
}

.maps-detail-head {
    display: flex;
    min-height: 76px;
    align-items: center;
    gap: 10px;
    padding: 10px 13px;
    color: #fff;
    background: var(--rk-deep);
    border-bottom: 3px solid var(--rk-ink);
}

.maps-detail-head h2 {
    margin: 2px 0 0;
    font-size: 20px;
    line-height: 1.1;
}

.maps-detail-icon {
    width: 52px;
    height: 52px;
    background-position: -192px -64px;
}

.maps-detail-section {
    padding: 12px 14px;
    border-bottom: 2px solid #a3b28a;
}

.maps-detail-section:last-child { border-bottom: 0; }

.maps-section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

.maps-section-title h3 {
    margin: 0;
    color: var(--rk-deep);
    font-size: 10px;
    text-transform: uppercase;
}

.maps-section-title span {
    display: inline-flex;
    min-width: 21px;
    min-height: 20px;
    align-items: center;
    justify-content: center;
    padding: 2px 5px;
    color: var(--rk-ink);
    background: var(--rk-gold);
    border: 1px solid var(--rk-ink);
    border-radius: 3px;
    font-size: 9px;
    font-weight: 900;
}

.maps-detail-list {
    display: grid;
    max-height: 245px;
    gap: 5px;
    overflow-y: auto;
    margin: 0;
    padding: 0;
    list-style: none;
}

.maps-detail-link {
    display: grid;
    width: 100%;
    min-width: 0;
    align-items: start;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 7px;
    padding: 7px 7px;
    color: var(--rk-ink);
    background: #fffdf0;
    border: 1px solid #9bad8b;
    border-radius: 3px;
    cursor: pointer;
    text-align: left;
}

.maps-detail-link:hover,
.maps-detail-link:focus-visible {
    background: #fff1b6;
    outline: 2px solid var(--rk-blue);
    outline-offset: 1px;
}

.maps-detail-link > span {
    display: block;
    min-width: 0;
}

.maps-detail-link strong,
.maps-detail-link small {
    display: block;
}

.maps-detail-link strong {
    overflow-wrap: anywhere;
    color: var(--rk-deep);
    font-size: 10px;
    line-height: 1.2;
}

.maps-detail-link small {
    margin-top: 3px;
    color: #5b7066;
    font-size: 8px;
    line-height: 1.35;
    font-weight: 700;
}

.maps-detail-link > b {
    align-self: start;
    color: #8e5d17;
    font-size: 8px;
    line-height: 1.2;
    text-transform: uppercase;
    white-space: nowrap;
}

.maps-spot-list { max-height: 390px; }

.maps-empty-item {
    padding: 12px 8px;
    color: #64766b;
    background: #fffdf0;
    border: 1px dashed #9bad8b;
    font-size: 10px;
    font-weight: 700;
}

.maps-noscript {
    margin-top: 15px;
    padding: 15px;
    color: #fff;
    background: var(--rk-red);
    border: var(--rk-line);
    font-weight: 900;
}

@media (max-width: 1180px) {
    .maps-page-head-inner { gap: 22px; }
    .maps-page-stats { min-width: 420px; }
    .maps-filter-panel { grid-template-columns: minmax(220px, 1.2fr) minmax(150px, 0.75fr) minmax(200px, 1fr); }
    .maps-feature-control { grid-column: 1 / -1; }
    .maps-layout { grid-template-columns: minmax(0, 1.4fr) minmax(300px, 0.8fr); }
}

@media (max-width: 940px) {
    .maps-page-head-inner { align-items: stretch; flex-direction: column; }
    .maps-page-stats { width: 100%; min-width: 0; }
    .maps-directory { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .maps-directory button:nth-child(4n) { border-right: 0; }
    .maps-directory button:nth-child(-n + 4) { border-bottom: 2px solid rgba(24, 58, 54, 0.42); }
    .maps-layout { grid-template-columns: 1fr; }
    .maps-detail-panel { position: static; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .maps-detail-head { grid-column: 1 / -1; }
    .maps-detail-section { min-width: 0; border-right: 2px solid #a3b28a; border-bottom: 0; }
    .maps-detail-section:last-child { border-right: 0; }
}

@media (max-width: 700px) {
    .maps-page-head { padding: 27px 18px; }
    .maps-page-title-block h1 { font-size: 31px; }
    .maps-page-sprite { width: 76px; height: 76px; background-position: -101px -51px; background-size: 405px 405px; }
    .maps-workspace { width: min(calc(100% - 24px), 1280px); padding-top: 20px; }
    .maps-directory { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .maps-directory button,
    .maps-directory button:nth-child(4n) { border-right: 2px solid rgba(24, 58, 54, 0.42); border-bottom: 2px solid rgba(24, 58, 54, 0.42); }
    .maps-directory button:nth-child(even) { border-right: 0; }
    .maps-directory button:last-child { border-bottom: 0; }
    .maps-filter-panel { grid-template-columns: 1fr 1fr; }
    .maps-search-field,
    .maps-feature-control { grid-column: 1 / -1; }
    .maps-current-head { align-items: flex-start; flex-direction: column; }
    .maps-access-chip { max-width: none; }
    .maps-detail-panel { display: block; }
    .maps-detail-section { border-right: 0; border-bottom: 2px solid #a3b28a; }
}

@media (max-width: 520px) {
    .maps-page-title-block { align-items: flex-start; gap: 10px; }
    .maps-page-sprite { width: 58px; height: 58px; background-position: -77px -39px; background-size: 310px 310px; }
    .maps-page-title-block p { font-size: 9px; }
    .maps-page-title-block h1 { font-size: 26px; }
    .maps-page-title-block > div > span { font-size: 11px; }
    .maps-page-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .maps-page-stats div { min-height: 62px; border-bottom: 2px solid rgba(24, 58, 54, 0.4); }
    .maps-page-stats div:nth-child(even) { border-right: 0; }
    .maps-page-stats div:nth-last-child(-n + 2) { border-bottom: 0; }
    .maps-filter-panel { grid-template-columns: 1fr; }
    .maps-search-field,
    .maps-feature-control { grid-column: auto; }
    .maps-results-status { align-items: flex-start; flex-direction: column; gap: 2px; }
    #maps-filter-summary { text-align: left; }
    .maps-canvas-shell { padding: 8px; }
    .maps-marker-label { max-width: 150px; font-size: 8px; }
}

@media (prefers-reduced-motion: reduce) {
    .maps-marker { scroll-behavior: auto; }
}
