.maps-list {
    display: grid;
    gap: 18px;
}

.map-card {
    overflow: hidden;
    border: 1px solid var(--rule);
    border-radius: 4px;
    background: rgba(255,255,255,0.44);
}

.map-card-title {
    padding: 11px 14px 9px;
    border-bottom: 1px solid var(--rule);
    color: var(--ink-soft);
    font-family: var(--ui);
    font-size: 0.68rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.map-box {
    width: 100%;
    height: 290px;
}

.footprints-atlas-list {
    grid-template-columns: minmax(0, 1fr);
}

.footprints-map-card {
    min-width: 0;
    border-color: #c7c5b6;
    background: #f3f0e6;
    box-shadow: 0 7px 24px rgba(42, 49, 43, 0.08);
}

.footprints-map-card .map-card-title {
    display: grid;
    grid-template-columns: 30px 1fr auto;
    grid-template-areas: 'number title actions';
    align-items: baseline;
    gap: 12px;
    padding: 18px 20px 15px;
    color: #374742;
    border-color: #d7d4c7;
    text-transform: none;
}

.footprints-map-card h3 {
    grid-area: title;
    margin: 0;
    font-family: Georgia, 'Noto Serif SC', 'Songti SC', serif;
    font-size: 1.25rem;
    font-weight: 500;
    letter-spacing: 0.03em;
}

.footprints-map-number {
    grid-area: number;
    color: #9a8055;
    font-size: 0.7rem;
    letter-spacing: 0.1em;
}

.footprints-map-title-actions {
    grid-area: actions;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 7px;
}

.footprints-map-open,
.footprints-map-view-toggle {
    align-self: center;
    min-height: 40px;
    padding: 0 12px;
    border: 1px solid #d2c9ae;
    border-radius: 4px;
    background: #eae4d1;
    color: #5f685b;
    font: 11px var(--ui);
    cursor: pointer;
}

.footprints-map-view-toggle {
    border-color: #9bafa6;
    background: #e2e9df;
    color: #3b5850;
}

.footprints-map-view-toggle[aria-pressed='true'] {
    border-color: #bba984;
    background: #ece3ce;
    color: #665736;
}

.footprints-map-view-select {
    max-width: 100%;
    min-width: 132px;
    padding-right: 28px;
    font: 11px var(--ui);
}

.footprints-map-view-select option {
    color: #374742;
    background: #f3f0e6;
}

.footprints-map-open:focus-visible,
.footprints-map-view-toggle:focus-visible {
    outline: 2px solid #536778;
    outline-offset: 3px;
}

.footprints-map-shell {
    position: relative;
    height: auto;
    min-height: 0;
    max-height: min(640px, 66dvh);
    overflow: hidden;
    background: #8098a5;
}

.footprints-map-shell::after {
    content: '';
    position: absolute;
    inset: 10px;
    border: 1px solid rgba(245, 245, 229, 0.34);
    box-shadow: 0 0 0 3px rgba(49, 61, 55, 0.025);
    pointer-events: none;
}

.footprints-map-north {
    position: absolute;
    right: 24px;
    top: 20px;
    color: rgba(33, 56, 56, 0.62);
    font: 12px Georgia, serif;
    letter-spacing: 0.12em;
    pointer-events: none;
}

.footprints-map-attribution {
    padding: 6px 20px 12px;
    color: var(--ink-soft);
    font-family: var(--ui);
    font-size: 9px;
    line-height: 1.5;
}

.footprints-map-attribution a {
    color: inherit;
}

.footprints-map-viewport {
    position: absolute;
    inset: 0;
    overflow: hidden;
    cursor: grab;
    outline: none;
    touch-action: pan-y;
    user-select: none;
}

.footprints-map-viewport:focus-visible {
    box-shadow: inset 0 0 0 2px rgba(83, 103, 120, 0.48);
}

.footprints-map-viewport.is-dragging {
    cursor: grabbing;
}

.is-map-preview .footprints-map-viewport {
    cursor: default;
}

.is-map-preview .footprints-map-stage {
    will-change: auto;
}

.footprints-preview-inset-title {
    position: absolute;
    transform: translateY(-100%);
    color: #3c5554;
    font: 600 var(--footprints-inset-title-size, 10px)/1 var(--ui);
    pointer-events: none;
}

.footprints-map-poster {
    position: absolute;
    inset: 0;
    z-index: 1;
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
}

.footprints-map-stage {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: auto;
    transform-origin: center center;
    will-change: transform;
}

.footprints-map-terrain,
.footprints-map-svg {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
}

.footprints-map-terrain {
    object-fit: fill;
    pointer-events: none;
}

.footprints-map-svg {
    overflow: visible;
}

.footprints-map-visited-image {
    display: block;
    pointer-events: none;
}

.footprints-map-insets {
    overflow: visible;
    pointer-events: none;
}

.footprints-map-inset {
    color: #3c5554;
    opacity: 1;
    pointer-events: none;
}

.footprints-map-inset.is-unavailable {
    display: none;
}

.footprints-map-inset-frame {
    fill: rgba(248, 249, 242, 0.96);
    stroke: rgba(57, 76, 74, 0.7);
    stroke-width: 1;
    vector-effect: non-scaling-stroke;
}

.footprints-map-inset-terrain,
.footprints-map-inset-colour {
    display: block;
    pointer-events: none;
}

.footprints-map-inset-title {
    fill: #3c5554;
    font-family: var(--ui);
    font-size: 70px;
    font-weight: 600;
    letter-spacing: 0.04em;
    paint-order: stroke;
    stroke: rgba(248, 249, 242, 0.94);
    stroke-width: 5px;
    stroke-linejoin: round;
}

.footprints-city {
    cursor: pointer;
    outline: none;
}

.footprints-city-hit {
    stroke-width: 2;
    pointer-events: all;
    transition: fill 150ms ease, stroke 150ms ease;
}

.footprints-city-dot {
    stroke: rgba(255, 255, 255, 0.92);
    stroke-width: 1.4;
}

.footprints-city-label-text {
    display: none;
    fill: #273138;
    font-family: var(--ui);
    font-size: var(--footprints-label-size, 15px);
    font-weight: 600;
    paint-order: stroke;
    stroke: rgba(255, 255, 255, 0.92);
    stroke-width: var(--footprints-label-outline, 4px);
    stroke-linejoin: round;
    pointer-events: none;
}

.footprints-city.is-active .footprints-city-hit {
    fill: transparent;
    stroke: rgba(39, 49, 56, 0.84);
}

.footprints-city.is-active .footprints-city-dot {
    stroke: #273138;
    stroke-width: 2.2;
}

.footprints-city.is-active .footprints-city-label-text {
    display: block;
}

.footprints-city:focus-visible .footprints-city-hit {
    stroke: #273138;
    stroke-width: 2.8;
}

.footprints-city.has-region-boundary .footprints-city-hit,
.footprints-city.has-region-boundary.is-active .footprints-city-hit,
.footprints-city.has-region-boundary:focus-visible .footprints-city-hit {
    fill: transparent;
    stroke: transparent;
}

.footprints-cultural-boundary {
    fill: none;
    stroke: rgba(57, 76, 74, 0.22);
    stroke-width: 0.5;
    stroke-linejoin: round;
    pointer-events: none;
}

.footprints-city.is-active .footprints-cultural-boundary,
.footprints-city:focus-visible .footprints-cultural-boundary {
    stroke: rgba(39, 49, 56, 0.55);
    stroke-width: 1;
}

.footprints-map-controls {
    position: absolute;
    right: 18px;
    bottom: 18px;
    z-index: 3;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px;
    border: 1px solid rgba(53, 62, 65, 0.18);
    border-radius: 6px;
    background: rgba(249, 248, 239, 0.94);
    box-shadow: 0 3px 12px rgba(40, 44, 42, 0.12);
    backdrop-filter: blur(5px);
}

.footprints-map-control {
    min-width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid rgba(53, 62, 65, 0.18);
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.56);
    color: #38434a;
    font: 500 1rem/1 var(--ui);
    cursor: pointer;
}

.footprints-map-shell.has-map-insets .footprints-map-controls {
    right: auto;
    left: min(18px, 3vw);
}

.footprints-map-control-maximum {
    font-size: 0.72rem;
}

.footprints-map-control-expand {
    padding: 0 12px;
    border-color: #c6bc9f;
    background: #e6e0cb;
    font-size: 0.72rem;
}

.footprints-map-zoom {
    min-width: 40px;
    color: #788073;
    font: 10px var(--ui);
    text-align: center;
}

.footprints-map-viewer {
    display: none;
    width: min(1720px, calc(100vw - 32px));
    height: calc(100dvh - 32px);
    max-width: none;
    max-height: none;
    margin: auto;
    padding: 0;
    overflow: hidden;
    border: 1px solid #c7c5b6;
    border-radius: 7px;
    background: #f3f0e6;
    color: #374742;
    box-shadow: 0 20px 90px rgba(0, 0, 0, 0.35);
}

.footprints-map-viewer[open] {
    display: flex;
    flex-direction: column;
}

.footprints-map-viewer::backdrop {
    background: rgba(12, 22, 26, 0.86);
    backdrop-filter: blur(8px);
}

.footprints-viewer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    padding: 9px 14px 9px 22px;
}

.footprints-viewer-header h2 {
    flex: 1;
    min-width: 0;
    margin: 0;
    font: 500 1.15rem Georgia, 'Noto Serif SC', 'Songti SC', serif;
}

.footprints-viewer-close {
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    border: 1px solid #d3d0c2;
    border-radius: 4px;
    background: transparent;
    color: #374742;
    font: 24px/1 var(--ui);
    cursor: pointer;
}

.footprints-map-viewer .footprints-map-shell {
    flex: 1;
    aspect-ratio: auto !important;
    height: auto;
    max-height: none;
}

.footprints-map-viewer .footprints-map-control-expand {
    display: none;
}

.footprints-map-hint {
    margin: 0;
    padding: 12px 16px;
    color: #737b6e;
    text-align: center;
    font: 11px/1.4 var(--ui);
}

@media (max-width: 600px) {
    .footprints-map-card .map-card-title {
        grid-template-columns: 22px minmax(0, 1fr);
        grid-template-areas: 'number title' 'actions actions';
        gap: 5px 10px;
        padding: 14px;
    }

    .footprints-map-title-actions {
        margin-top: 5px;
    }

    .footprints-map-controls {
        right: 10px;
        bottom: 10px;
        gap: 3px;
    }

    .footprints-map-control {
        min-width: 38px;
        height: 42px;
    }

    .footprints-map-zoom {
        display: none;
    }

    .footprints-map-shell.has-map-insets .footprints-map-control-expand {
        display: none;
    }

    .footprints-map-viewer {
        width: 100vw;
        height: 100dvh;
        border: 0;
        border-radius: 0;
    }

    .footprints-viewer-header {
        gap: 8px;
        padding-left: 14px;
        padding-top: max(9px, env(safe-area-inset-top));
    }

    .footprints-viewer-header h2 {
        font-size: 1rem;
    }

    .footprints-viewer-header .footprints-map-view-toggle {
        max-width: 42%;
        padding: 5px 9px;
        line-height: 1.35;
    }

    .footprints-viewer-header .footprints-map-view-select {
        flex: 0 1 46%;
        min-width: 0;
        max-width: 46%;
        padding-right: 20px;
    }

    .footprints-map-hint {
        padding-bottom: max(12px, env(safe-area-inset-bottom));
    }
}

.footprints-map-control:hover,
.footprints-map-control:focus-visible {
    border-color: rgba(53, 62, 65, 0.48);
    background: rgba(255, 255, 255, 0.9);
    outline: none;
}

.footprints-map-control:disabled {
    cursor: default;
    opacity: 0.38;
}

.footprints-map-status {
    position: absolute;
    inset: 0;
    z-index: 4;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 18px;
    background: rgba(238, 244, 240, 0.7);
    color: #3c5554;
    font: 0.76rem var(--ui);
    text-align: center;
    pointer-events: none;
}

.footprints-map-status.is-visible {
    display: flex;
}

.footprints-map-shell.is-map-loading .footprints-map-status {
    display: flex;
}

.footprints-map-shell.is-map-error .footprints-map-status {
    display: flex;
}

.footprints-map-status.is-loading::before {
    content: '';
    width: 30px;
    height: 30px;
    border: 2px solid rgba(89, 128, 119, 0.18);
    border-top-color: #598077;
    border-radius: 50%;
    animation: footprints-map-loading 0.85s linear infinite;
}

@keyframes footprints-map-loading {
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    .footprints-map-status.is-loading::before {
        animation: none;
    }
}

.footprints-map-retry {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 5;
    transform: translate(-50%, 22px);
    padding: 5px 11px;
    border: 1px solid rgba(53, 62, 65, 0.28);
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.92);
    color: #38434a;
    font: 0.72rem var(--ui);
    cursor: pointer;
}

.footprints-map-error {
    display: grid;
    height: 100%;
    place-items: center;
    color: #7d817e;
    font: 0.76rem var(--ui);
}

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: max(30px, env(safe-area-inset-top)) 78px max(30px, env(safe-area-inset-bottom));
    overflow: auto;
    background: rgba(3,4,9,0.92);
    backdrop-filter: blur(22px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 220ms ease, visibility 220ms ease;
}

.lightbox.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.lightbox-figure {
    max-width: min(1100px, 88vw);
    display: grid;
    justify-items: center;
    gap: 15px;
    margin: auto;
}

.lightbox img {
    max-width: 100%;
    max-height: calc(100dvh - 130px);
    border-radius: 3px;
    box-shadow: 0 25px 90px rgba(0,0,0,0.52);
}

.lightbox-caption {
    color: rgba(244,241,234,0.72);
    font-size: 0.88rem;
    text-align: center;
}

.lightbox-close,
.lightbox-nav {
    position: fixed;
    z-index: 2;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 50%;
    background: rgba(7,9,16,0.35);
    color: rgba(255,255,255,0.72);
    cursor: pointer;
    transition: color 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.lightbox-close:hover,
.lightbox-nav:hover {
    color: #fff;
    border-color: rgba(255,255,255,0.5);
}

.lightbox-close {
    top: max(20px, env(safe-area-inset-top));
    right: max(24px, env(safe-area-inset-right));
    width: 40px;
    height: 40px;
    font-size: 1.25rem;
}

.lightbox-nav {
    top: 50%;
    width: 46px;
    height: 46px;
    font-family: var(--ui);
    font-size: 1.2rem;
    transform: translateY(-50%);
}

.lightbox-nav:hover {
    transform: translateY(-50%) scale(1.04);
}

.lightbox-prev { left: 23px; }
.lightbox-next { right: 23px; }

.transition-veil {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    background:
        radial-gradient(circle at center, rgba(255,242,211,0.22), rgba(184,205,245,0.08) 18%, rgba(6,9,20,0.12) 43%, transparent 72%);
    color: rgba(255,248,231,0.82);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 360ms ease, visibility 360ms ease;
}

.transition-veil.is-active {
    opacity: 1;
    visibility: visible;
}

.transition-veil span {
    position: absolute;
    bottom: max(34px, env(safe-area-inset-bottom));
    font-family: var(--mono);
    font-size: 0.66rem;
    letter-spacing: 0.12em;
    text-shadow: 0 0 24px rgba(213,225,255,0.55);
}

@media (max-width: 768px) {
    .homepage-parity .project-grid {
        grid-template-columns: 1fr;
    }

    .footprints-atlas-list {
        grid-template-columns: 1fr;
    }

    .map-box:not(.footprints-map-shell) {
        height: min(66vw, 290px);
        min-height: 220px;
    }
}

@media (max-width: 1024px) and (min-aspect-ratio: 16/9) {
    .portal-panel {
        width: clamp(286px, 42vw, 340px);
    }
}

@media (max-aspect-ratio: 3/2),
       (max-width: 1024px) and (max-aspect-ratio: 16/9) {
    .portal-panel,
    .portal-panel.is-left {
        top: auto;
        left: max(10px, env(safe-area-inset-left));
        right: max(10px, env(safe-area-inset-right));
        bottom: max(10px, env(safe-area-inset-bottom));
        width: auto;
        max-height: 50dvh;
        transform: translateY(28px) scale(0.99);
        transform-origin: bottom center;
    }

    body.panel-open .portal-panel {
        transform: translateY(0) scale(1);
    }

    .portal-panel:has(#footprints:not([hidden]) .footprints-atlas-list:not([hidden])) {
        max-height: calc(100dvh - 100px);
    }

    .portal-panel-header {
        padding: 18px 62px 14px 20px;
    }

    .portal-panel-body {
        padding: 18px 20px 28px;
    }

    body.route-preview-active .portal-panel,
    body.route-preview-active .portal-panel.is-left {
        width: auto;
        max-height: 44dvh;
    }

    body.route-preview-active .portal-panel-body {
        padding: 14px;
    }
}

@media (max-height: 520px) and (min-aspect-ratio: 3/2) {
    .portal-panel {
        top: max(78px, calc(env(safe-area-inset-top) + 64px));
        left: auto;
        right: max(18px, env(safe-area-inset-right));
        bottom: max(18px, env(safe-area-inset-bottom));
        max-height: none;
        transform: translateX(34px) scale(0.985);
        transform-origin: right center;
    }

    .portal-panel {
        width: clamp(180px, 34vw, 280px);
    }

    .portal-panel.is-left {
        right: auto;
        left: max(18px, env(safe-area-inset-left));
        transform-origin: left center;
    }

    body.panel-open .portal-panel {
        transform: translateX(0) scale(1);
    }
}

@media (max-width: 1024px), (max-aspect-ratio: 3/2) {
    body.route-preview-active .portal-panel,
    body.route-preview-active .portal-panel.is-left {
        top: auto;
        left: max(10px, env(safe-area-inset-left));
        right: max(10px, env(safe-area-inset-right));
        bottom: max(10px, env(safe-area-inset-bottom));
        width: auto;
        max-height: min(44dvh, 188px);
        transform: translateY(28px) scale(0.99);
        transform-origin: bottom center;
    }

    body.route-preview-active.panel-open .portal-panel {
        transform: translateY(0) scale(1);
    }

    body.route-preview-active .portal-panel-body {
        padding: 14px;
    }

    body.route-preview-active .portal-panel-header,
    body.route-preview-active .home-route-summary {
        display: none;
    }

    body.route-preview-active .home-route-preview {
        padding: 14px;
    }

    body.route-preview-active .home-route-actions {
        grid-template-columns: minmax(0, 1fr) auto;
        margin-top: 10px;
    }
}

@media (max-width: 1024px) and (max-height: 520px) {
    body.route-preview-active .portal-panel,
    body.route-preview-active .portal-panel.is-left {
        max-height: 36dvh;
    }

    body.route-preview-active .portal-panel-header,
    body.route-preview-active .home-route-summary {
        display: none;
    }

    body.route-preview-active .home-route-preview {
        padding: 12px;
    }

    body.route-preview-active .home-route-actions {
        grid-template-columns: minmax(0, 1fr) auto;
        margin-top: 9px;
    }
}

@media (max-width: 760px) {
    .section-drawer-toggle {
        width: 44px;
        height: 68px;
    }

    body.section-drawer-open .section-drawer-toggle {
        transform: translate(min(86vw, calc(100vw - 24px)), -50%);
    }

    .section-drawer {
        width: min(86vw, calc(100vw - 24px));
    }

    .section-drawer-header {
        padding: 22px 66px 16px 20px;
    }

    .section-index-item,
    .section-index-home {
        min-height: 58px;
        padding-inline: 9px;
    }

    .section-index-visibility {
        min-width: 64px;
    }

    .life-mark {
        top: max(17px, env(safe-area-inset-top));
        left: max(17px, env(safe-area-inset-left));
    }

    .language-switch {
        top: max(15px, env(safe-area-inset-top));
        right: max(15px, env(safe-area-inset-right));
    }

    .control-legend {
        display: none;
    }

    .scene-status {
        right: auto;
        left: max(17px, env(safe-area-inset-left));
        bottom: max(15px, env(safe-area-inset-bottom));
    }

    .star-hit {
        width: 76px;
        height: 76px;
    }

    .star-hit-copy {
        max-width: 42vw;
    }

    .portal-close {
        top: 15px;
        right: 17px;
    }

    .gallery-grid,
    .friends-list {
        grid-template-columns: 1fr;
    }

    .home-route-actions {
        grid-template-columns: 1fr;
    }

    .about-card {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .about-portrait {
        width: 120px;
    }

    .about-links {
        justify-content: center;
    }

    .project-grid {
        grid-template-columns: 1fr;
    }

    .map-box:not(.footprints-map-shell) {
        height: 250px;
    }

    .lightbox {
        padding: 70px 16px 92px;
    }

    .lightbox img {
        max-height: calc(100dvh - 190px);
    }

    .lightbox-nav {
        top: auto;
        bottom: max(23px, env(safe-area-inset-bottom));
        transform: none;
    }

    .lightbox-nav:hover {
        transform: scale(1.04);
    }

    .lightbox-prev { left: calc(50% - 58px); }
    .lightbox-next { right: calc(50% - 58px); }
}

@media (hover: none), (pointer: coarse) {
    .portal-hit {
        width: 88px;
        height: 88px;
    }

    .gaze-instruction {
        display: none;
    }

    .gallery-caption {
        transform: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
}
