.gh-castle-map-page {
    --map-bg: #f4f0e8;
    --map-card: #fffaf2;
    --map-ink: #17211c;
    --map-muted: #667069;
    --map-line: rgba(40, 52, 44, 0.14);
    --map-line-strong: rgba(40, 52, 44, 0.24);
    --map-forest: #2f5d4f;
    --map-gold: #b57a24;
    --map-rust: #6e3a26;
    background: var(--map-bg);
}

.gh-map-hero {
    padding-top: clamp(32px, 5vw, 74px);
    padding-bottom: clamp(20px, 4vw, 44px);
}

.gh-map-hero-inner {
    display: grid;
    gap: 10px;
}

.gh-map-kicker {
    color: var(--map-gold);
    font-size: 1.2rem;
    font-weight: 900;
    letter-spacing: 0;
    text-transform: uppercase;
}

.gh-map-title {
    max-width: 980px;
    color: var(--map-ink);
    font-size: clamp(4rem, 6vw, 8rem);
    line-height: 0.95;
    letter-spacing: 0;
}

.gh-map-excerpt {
    max-width: 760px;
    color: var(--map-muted);
    font-size: clamp(1.6rem, 1.2vw, 2rem);
    line-height: 1.55;
}

.gh-map-shell {
    padding-bottom: clamp(40px, 8vw, 92px);
}

.gh-map-shell-inner {
    display: grid;
    grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
    gap: 16px;
    height: min(760px, calc(100vh - 190px));
}

.gh-map-panel,
.gh-map-stage,
.gh-map-selected {
    border: 1px solid var(--map-line);
    border-radius: 8px;
    background: rgba(255, 250, 242, 0.84);
    box-shadow: 0 18px 54px rgba(23, 33, 28, 0.09);
}

.gh-map-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 14px;
    overflow: hidden;
}

.gh-map-search {
    display: grid;
    grid-template-columns: 22px 1fr;
    align-items: center;
    gap: 10px;
    min-height: 46px;
    padding: 0 12px;
    border: 1px solid var(--map-line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.78);
}

.gh-map-search svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    color: var(--map-muted);
}

.gh-map-search input {
    width: 100%;
    min-width: 0;
    border: 0;
    outline: 0;
    color: var(--map-ink);
    background: transparent;
    font: inherit;
    font-size: 1.4rem;
}

.gh-map-search:focus-within {
    outline: 2px solid var(--ghost-accent-color, #4e8fad);
    outline-offset: 1px;
}

.gh-map-stats {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 12px 0;
    color: var(--map-muted);
    font-size: 1.3rem;
}

.gh-map-stats strong {
    color: var(--map-ink);
}

.gh-map-regions-row {
    display: flex;
    align-items: center;
    gap: 4px;
    margin: 0 -14px 12px;
    padding: 0 6px;
}

.gh-map-regions-nav {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border: 1px solid var(--map-line);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.78);
    color: var(--map-ink);
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
}

.gh-map-regions-nav:disabled,
.gh-map-regions-nav.is-hidden {
    visibility: hidden;
}

.gh-map-regions {
    display: flex;
    flex: 1 1 auto;
    gap: 7px;
    padding: 0 8px 3px;
    overflow-x: auto;
    scroll-behavior: smooth;
    scrollbar-width: none;
}

.gh-map-regions::-webkit-scrollbar {
    display: none;
}

.gh-map-region {
    flex: 0 0 auto;
    min-height: 34px;
    padding: 0 10px;
    border: 1px solid var(--map-line);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.64);
    color: var(--map-muted);
    cursor: pointer;
    font-size: 1.25rem;
    font-weight: 850;
}

.gh-map-region.is-active {
    border-color: transparent;
    background: var(--map-ink);
    color: #fffaf2;
}

.gh-map-list {
    display: grid;
    flex: 1 1 auto;
    gap: 8px;
    min-height: 0;
    overflow-y: auto;
    padding-right: 4px;
}

.gh-map-list-item {
    display: grid;
    grid-template-columns: 54px 1fr;
    gap: 10px;
    width: 100%;
    min-height: 72px;
    padding: 7px;
    border: 1px solid var(--map-line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.68);
    color: var(--map-ink);
    text-align: left;
    cursor: pointer;
}

.gh-map-list-item.is-active {
    border-color: rgba(47, 93, 79, 0.42);
    box-shadow: inset 4px 0 0 var(--map-forest);
}

.gh-map-list-item img,
.gh-map-list-thumb {
    width: 54px;
    height: 58px;
    border-radius: 6px;
    object-fit: cover;
    background: linear-gradient(135deg, var(--map-forest), #4a7286);
}

.gh-map-list-copy {
    min-width: 0;
    display: grid;
    align-content: center;
    gap: 3px;
}

.gh-map-list-copy strong {
    overflow: hidden;
    color: var(--map-ink);
    font-size: 1.35rem;
    line-height: 1.18;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gh-map-list-copy span {
    color: var(--map-gold);
    font-size: 1.1rem;
    font-weight: 850;
}

.gh-map-list-copy small {
    display: -webkit-box;
    overflow: hidden;
    color: var(--map-muted);
    font-size: 1.15rem;
    line-height: 1.32;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.gh-map-pagination {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--map-line);
}

.gh-map-pagination button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid var(--map-line);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.68);
    color: var(--map-ink);
    cursor: pointer;
    font-size: 1.3rem;
}

.gh-map-pagination button:disabled {
    opacity: 0.4;
    cursor: default;
}

.gh-map-pagination-status {
    min-width: 50px;
    color: var(--map-muted);
    font-size: 1.2rem;
    font-weight: 850;
    text-align: center;
}

.gh-map-stage {
    position: relative;
    height: 100%;
    min-height: 560px;
    overflow: hidden;
}

.gh-map-progress {
    position: absolute;
    top: 14px;
    left: 50%;
    z-index: 3;
    display: none;
    align-items: center;
    gap: 14px;
    transform: translateX(-50%);
    padding: 10px 18px;
    border: 1px solid var(--map-line);
    border-radius: 14px;
    background: var(--map-card);
    box-shadow: 0 16px 38px rgba(23, 33, 28, 0.16);
    opacity: 0;
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.gh-map-progress.is-visible {
    display: flex;
    opacity: 1;
}

.gh-map-progress.is-leaving {
    opacity: 0;
    transform: translateX(-50%) translateY(-6px);
}

.gh-map-progress-ring {
    flex: 0 0 auto;
    width: 46px;
    height: 46px;
}

.gh-map-progress-track {
    fill: none;
    stroke: var(--map-line);
    stroke-width: 5;
}

.gh-map-progress-fill {
    fill: none;
    stroke: var(--map-forest);
    stroke-width: 5;
    stroke-linecap: round;
    stroke-dasharray: 113.1;
    stroke-dashoffset: 113.1;
    transform: rotate(-90deg);
    transform-origin: 23px 23px;
    transition: stroke-dashoffset 0.6s ease;
}

.gh-map-progress-pct {
    font-size: 12px;
    font-weight: 700;
    fill: var(--map-ink);
}

.gh-map-progress-copy {
    display: grid;
    gap: 2px;
    white-space: nowrap;
}

.gh-map-progress-copy strong {
    color: var(--map-ink);
    font-size: 1.3rem;
}

.gh-map-progress-copy span {
    color: var(--map-muted);
    font-size: 1.15rem;
}

@media (max-width: 680px) {
    .gh-map-progress {
        left: 14px;
        right: 14px;
        top: 10px;
        transform: none;
        white-space: normal;
    }

    .gh-map-progress.is-leaving {
        transform: translateY(-6px);
    }

    .gh-map-progress-copy {
        white-space: normal;
    }
}

.gh-map-canvas {
    position: absolute;
    inset: 0;
    z-index: 1;
    background: #d9e3df;
}

.gh-map-selected {
    position: absolute;
    z-index: 2;
    left: 18px;
    bottom: 18px;
    width: min(420px, calc(100% - 36px));
    overflow: hidden;
}

.gh-map-selected-card {
    display: grid;
    grid-template-columns: 116px 1fr;
    gap: 12px;
    padding: 10px;
}

.gh-map-selected-card img,
.gh-map-selected-thumb {
    width: 116px;
    height: 112px;
    border-radius: 6px;
    object-fit: cover;
    background: linear-gradient(135deg, var(--map-forest), #4a7286);
}

.gh-map-selected-copy {
    min-width: 0;
    display: grid;
    align-content: center;
    gap: 6px;
}

.gh-map-selected-copy span {
    color: var(--map-gold);
    font-size: 1.12rem;
    font-weight: 900;
    text-transform: uppercase;
}

.gh-map-selected-copy h2 {
    color: var(--map-ink);
    font-size: 2rem;
    line-height: 1.1;
}

.gh-map-selected-copy p {
    display: -webkit-box;
    overflow: hidden;
    color: var(--map-muted);
    font-size: 1.25rem;
    line-height: 1.38;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.gh-map-selected-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.gh-map-selected-actions a {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 0 10px;
    border: 1px solid var(--map-line);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.68);
    color: var(--map-ink);
    font-size: 1.18rem;
    font-weight: 850;
}

.gh-map-selected-actions a:first-child {
    background: var(--map-ink);
    color: #fffaf2;
}

.gh-map-pin {
    position: relative;
    display: block;
    width: 15px;
    height: 15px;
    border: 1px solid rgba(255, 250, 242, 0.85);
    border-radius: 999px 999px 999px 0;
    background: var(--map-rust);
    box-shadow: 0 3px 9px rgba(23, 33, 28, 0.4);
    transform: rotate(-45deg);
}

.gh-map-pin::after {
    content: "";
    position: absolute;
    inset: 5px;
    border-radius: 999px;
    background: #fffaf2;
}

.gh-map-cluster {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 2px solid #fffaf2;
    border-radius: 999px;
    background: var(--map-forest);
    color: #fffaf2;
    font-size: 1.2rem;
    font-weight: 900;
    box-shadow: 0 8px 18px rgba(23, 33, 28, 0.28);
}

.leaflet-container {
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
    border-radius: 8px;
    background: var(--map-card);
}

.leaflet-popup-content {
    margin: 10px 12px;
    color: var(--map-ink);
    font-size: 1.3rem;
}

@media (max-width: 1040px) {
    .gh-map-shell-inner {
        grid-template-columns: 1fr;
        height: auto;
    }

    .gh-map-panel {
        height: auto;
        min-height: 0;
    }

    .gh-map-list {
        flex: 0 1 auto;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        max-height: 260px;
    }
}

@media (max-width: 680px) {
    .gh-map-shell-inner {
        min-height: 0;
    }

    .gh-map-list {
        grid-template-columns: 1fr;
    }

    .gh-map-stage {
        min-height: 560px;
    }

    .gh-map-selected {
        left: 10px;
        right: 10px;
        bottom: 10px;
        width: auto;
    }

    .gh-map-selected-card {
        grid-template-columns: 88px 1fr;
    }

    .gh-map-selected-card img,
    .gh-map-selected-thumb {
        width: 88px;
        height: 96px;
    }
}
