html,
body {
    width: 100%;
    height: 100%;
    margin: 0;
}

body {
    overflow: hidden;
    color: #243027;
    background: #eef4ee;
    font-family: Arial, Helvetica, sans-serif;
}

.public-map-header {
    height: 58px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 8px 16px;
    background: #fff;
    box-sizing: border-box;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.public-map-header h1 {
    margin: 0;
    font-size: 22px;
    line-height: 1.1;
    font-weight: 700;
}

.public-map-header span {
    display: block;
    margin-top: 2px;
    color: #5d6b61;
    font-size: 13px;
}

.public-map-header a {
    flex: 0 0 auto;
    color: #2f6141;
    background: #fff;
    border: 1px solid #c9d3ca;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 14px;
    line-height: 1.2;
    text-decoration: none;
}

.public-map-shell {
    position: relative;
    width: 100%;
    height: calc(100vh - 58px);
    overflow: hidden;
}

.public-map-viewport {
    position: absolute;
    inset: 0;
    overflow: hidden;
    touch-action: none;
    cursor: grab;
}

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

.public-map-content {
    position: absolute;
    left: 0;
    top: 0;
    transform-origin: 0 0;
    will-change: transform;
}

.public-map-content img {
    display: block;
    user-select: none;
    -webkit-user-drag: none;
}

.public-map-overlay {
    position: absolute;
    left: 0;
    top: 0;
    overflow: visible;
}

.public-map-grave {
    fill: rgba(47, 97, 65, 0);
    stroke: rgba(47, 97, 65, 0);
    stroke-width: 2;
    vector-effect: non-scaling-stroke;
    cursor: pointer;
    transition: fill 120ms ease, stroke 120ms ease;
}

.public-map-grave:hover,
.public-map-grave.is-active {
    fill: rgba(47, 97, 65, 0.18);
    stroke: rgba(47, 97, 65, 0.8);
}

.public-map-grave.public-map-grave-dynamic {
    fill: var(--grave-color, #9aa39d);
    fill-opacity: 0.58;
    stroke: rgba(44, 57, 48, 0.72);
    stroke-width: 1.5;
}

.public-map-grave.public-map-grave-dynamic:hover,
.public-map-grave.public-map-grave-dynamic.is-active {
    fill: var(--grave-color, #9aa39d);
    fill-opacity: 0.78;
}

.public-map-grave-label {
    fill: #17251c;
    font: 600 12px Arial, sans-serif;
    letter-spacing: 0;
    text-anchor: middle;
    dominant-baseline: central;
    pointer-events: none;
}

.public-map-toolbar {
    position: absolute;
    right: 14px;
    top: 14px;
    z-index: 20;
    display: flex;
    gap: 6px;
    padding: 6px;
    background: rgba(31, 41, 35, 0.58);
    border-radius: 6px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.16);
}

.public-map-toolbar button {
    min-width: 34px;
    height: 34px;
    padding: 0 10px;
    border: 0;
    border-radius: 4px;
    color: #415447;
    background: #fff;
    font-size: 16px;
    font-weight: 700;
    line-height: 1;
}

.public-map-toolbar button[data-map-action="reset"] {
    font-size: 12px;
    font-weight: 600;
}

.public-map-hint {
    position: absolute;
    left: 14px;
    bottom: 14px;
    z-index: 10;
    max-width: min(520px, calc(100vw - 28px));
    padding: 8px 10px;
    color: #526458;
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 4px;
    font-size: 13px;
}

.public-map-preview {
    position: fixed;
    z-index: 60;
    display: none;
    min-width: 240px;
    max-width: 320px;
    padding: 12px;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.14);
    border-radius: 6px;
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.18);
}

.public-map-preview .grave-preview-loading {
    color: #66736a;
    font-size: 14px;
}

.public-map-preview img {
    max-width: 100%;
    height: auto;
}

.public-map-preview .grave-preview-photo,
.grave-detail-photo {
    position: relative;
}

.public-map-preview .grave-preview-photo::after,
.grave-detail-photo::after {
    content: "+";
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: #fff;
    background: rgba(18, 28, 22, 0.42);
    font-size: 34px;
    font-weight: 700;
    opacity: 0;
    transition: opacity 140ms ease;
    pointer-events: none;
}

.public-map-preview .grave-preview-photo:hover::after,
.grave-detail-photo:hover::after {
    opacity: 1;
}

.public-map-preview .btn {
    display: block;
    width: 100%;
    box-sizing: border-box;
    margin-top: 8px;
    padding: 6px 8px;
    border-radius: 4px;
    text-align: center;
    text-decoration: none;
}

.public-map-modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: none;
}

.public-map-modal.is-open {
    display: block;
}

.public-map-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
}

.public-map-modal-panel {
    position: absolute;
    left: 50%;
    top: 50%;
    width: min(760px, calc(100vw - 28px));
    max-height: calc(100vh - 28px);
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 22px 60px rgba(0, 0, 0, 0.35);
    overflow: hidden;
}

.public-map-modal-panel header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 16px;
    border-bottom: 1px solid #e3e8e4;
}

.public-map-modal-panel h2 {
    margin: 0;
    font-size: 18px;
}

.public-map-modal-panel header button {
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 4px;
    background: #edf2ee;
    font-size: 18px;
    line-height: 1;
}

.public-map-modal-body {
    padding: 0;
    overflow: auto;
}

.public-map-photo-viewer {
    display: grid;
    place-items: center;
    min-height: min(72vh, 720px);
    padding: 18px;
    background: #f7f9f6;
}

.public-map-photo-viewer img {
    display: block;
    max-width: 100%;
    max-height: 78vh;
    border-radius: 6px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.24);
}

.grave-detail {
    color: #243027;
}

.grave-detail-hero {
    display: grid;
    grid-template-columns: 190px minmax(0, 1fr);
    gap: 18px;
    padding: 18px;
    background: #f7faf7;
    border-bottom: 1px solid #e3e8e4;
}

.grave-detail-photo {
    display: block;
    width: 190px;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: #e6ece7;
    border: 1px solid #d8e1da;
    border-radius: 6px;
}

.grave-detail-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.grave-detail-photo-empty {
    display: grid;
    place-items: center;
    color: #68766d;
    font-size: 13px;
}

.grave-detail-meta {
    min-width: 0;
    align-self: center;
}

.grave-detail-kicker {
    margin-bottom: 5px;
    color: #5d6f62;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.grave-detail-meta h3 {
    margin: 0;
    font-size: 24px;
    line-height: 1.18;
}

.grave-detail-subtitle {
    margin-top: 8px;
    color: #607066;
    font-size: 14px;
}

.grave-detail-section {
    padding: 18px;
}

.grave-detail-section-title {
    margin-bottom: 10px;
    color: #45574b;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.grave-detail-list {
    display: grid;
    gap: 8px;
}

.grave-detail-person {
    display: grid;
    grid-template-columns: minmax(180px, 1.2fr) minmax(230px, 1fr);
    gap: 12px;
    align-items: center;
    padding: 12px 14px;
    background: #fff;
    border: 1px solid #e1e7e2;
    border-radius: 6px;
}

.grave-detail-person-location {
    grid-column: 1 / -1;
    width: max-content;
    max-width: 100%;
    padding: 3px 7px;
    color: #2f6141;
    background: #edf5ef;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
}

.grave-detail-person-name {
    min-width: 0;
    font-size: 16px;
    font-weight: 700;
}

.grave-detail-person-dates {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.grave-detail-person-dates span {
    display: block;
    margin-bottom: 2px;
    color: #6b776e;
    font-size: 12px;
}

.grave-detail-person-dates strong {
    display: block;
    font-size: 14px;
    font-weight: 600;
}

.grave-detail-empty {
    margin: 18px;
    padding: 14px;
    color: #69521a;
    background: #fff8df;
    border: 1px solid #ead99c;
    border-radius: 6px;
}

.public-map-empty {
    height: calc(100vh - 58px);
    display: grid;
    place-items: center;
    padding: 24px;
    box-sizing: border-box;
}

.public-map-empty div {
    max-width: 620px;
    padding: 18px 20px;
    background: #fff;
    border: 1px solid #d9e1da;
    border-radius: 6px;
    color: #4d5b52;
}

@media (max-width: 680px) {
    .public-map-header {
        height: 64px;
        padding: 8px 10px;
    }

    .public-map-header h1 {
        font-size: 18px;
    }

    .public-map-header a {
        padding: 7px 9px;
        font-size: 13px;
    }

    .public-map-shell,
    .public-map-empty {
        height: calc(100vh - 64px);
    }

    .public-map-toolbar {
        right: 10px;
        top: 10px;
    }

    .public-map-hint {
        display: none;
    }

    .grave-detail-hero {
        grid-template-columns: 1fr;
    }

    .grave-detail-photo {
        width: 100%;
    }

    .grave-detail-person {
        grid-template-columns: 1fr;
    }

    .grave-detail-person-dates {
        grid-template-columns: 1fr 1fr;
    }
}
