:root {
    --primary-color: #2c3e50;
    --accent-color: #3498db;
    --bg-color: #f8f9fa;
    --overlay-bg: rgba(255, 255, 255, 0.95);
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    --rozmiar-pinu: 60px;
}

body,
html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-color);
}

#app {
    display: flex;
    flex-direction: column;
    width: 100vw;
    height: 100vh;
}

#header {
    padding: 10px 25px;
    background: var(--overlay-bg);
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
}

.header-logo img {
    height: 50px;
    width: auto;
    display: block;
}

.header-title {
    text-align: center;
}

.header-actions {
    text-align: right;
    min-width: 50px;
    /* Aby zachować symetrię */
}

.header-action-btn {
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.1);
    padding: 12px 24px;
    border-radius: 12px;
    font-family: inherit;
    font-weight: 600;
    font-size: 15px;
    color: var(--primary-color);
    cursor: pointer;
    transition: 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.header-action-btn i {
    font-size: 18px;
    color: var(--accent-color);
}

.header-action-btn:hover {
    background: white;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
    color: var(--accent-color);
    border-color: var(--accent-color);
}

@media (max-width: 600px) {
    .header-action-btn span {
        display: none;
    }
    .header-action-btn {
        padding: 10px;
    }
}

.viewport-reset-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 60;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--primary-color);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    gap: 6px;
}

.viewport-reset-btn:hover {
    background: #ffffff;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
    transform: translateY(-1px);
    color: var(--accent-color);
}

.viewport-reset-btn svg {
    width: 16px;
    height: 16px;
}

#main-content {
    display: flex;
    flex-direction: row;
    height: calc(100vh - 70px);
    /* 70px to wysokość headera */
    width: 100%;
    overflow: hidden;
    background: #ffffff;
}

.sidebar-col {
    width: 350px;
    flex-shrink: 0;
    padding: 20px;
    display: flex;
    flex-direction: column;
    background: #f8fafc;
    /* Bardzo jasny szary */
    z-index: 10;
    overflow-y: auto;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.05);
}

/* Licznik obiektów na mapie */
#status-overlay {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.9);
    padding: 10px 24px;
    border-radius: 14px;
    font-size: 13px;
    font-weight: 500;
    color: #475569;
    z-index: 50;
    pointer-events: none;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

#zoom-overlay {
    position: absolute;
    bottom: 15px;
    left: 15px;
    background: rgba(255, 255, 255, 0.2);
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 400;
    color: #7f8c8d;
    z-index: 50;
    pointer-events: none;
}

#sidebar-left {
    border-right: 1px solid #e2e8f0;
}

#sidebar-right {
    border-left: 1px solid #e2e8f0;
}

#viewport {
    flex: 1;
    position: relative;
    cursor: grab;
    overflow: hidden;
    border-radius: 20px;
    margin: 15px;
    box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.05), 0 8px 30px rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: #d1d8e0;
    /* Akceleracja sprzętowa */
    transform: translateZ(0);
    will-change: transform;
    touch-action: none;
}

/* RESPONSIVE DESIGN */
@media (max-width: 1100px) {
    .sidebar-col {
        width: 300px;
    }
}

@media (max-width: 1024px) {
    #main-content {
        flex-direction: column;
        height: auto;
        overflow-y: auto;
    }

    .sidebar-col {
        width: 100%;
        box-sizing: border-box;
        border: none !important;
        box-shadow: none;
        height: auto;
        min-height: 200px;
    }

    #viewport {
        height: 60vh;
        margin: 10px;
        min-height: 400px;
        flex: none;
        width: calc(100% - 20px);
    }

    #header {
        grid-template-columns: auto 1fr;
        padding: 10px 15px;
    }

    .header-logo img {
        height: 40px;
    }

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

    .header-actions {
        display: none;
        /* Ukrywamy pustą sekcję na mobile */
    }

    #sidebar-left {
        order: 2;
    }

    #viewport {
        order: 1;
    }

    #sidebar-right {
        order: 3;
    }
}

@media (max-width: 480px) {
    .header-title h1 {
        font-size: 16px;
    }

    .header-title div {
        font-size: 9px !important;
    }

    #viewport {
        height: 50vh;
        min-height: 300px;
    }
}

.search-container {
    position: relative;
    width: 100%;
    max-width: 400px;
}

#search-input {
    width: 100%;
    padding: 12px 20px;
    border-radius: 12px;
    border: 2px solid #eee;
    font-family: inherit;
    font-size: 16px;
    outline: none;
    transition: all 0.3s;
    box-sizing: border-box;
    background: white;
}

#search-input:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 10px rgba(52, 152, 219, 0.2);
}

#search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border-radius: 12px;
    margin-top: 8px;
    box-shadow: var(--shadow);
    max-height: 400px;
    overflow-y: auto;
    display: none;
    z-index: 2000;
}

.search-item {
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 12px;
}

.search-thumb {
    width: 44px;
    height: 44px;
    object-fit: cover;
    border-radius: 6px;
    background: #f8fafc;
    flex-shrink: 0;
    border: 1px solid #e2e8f0;
}

.search-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}


.search-item:last-child {
    border-bottom: none;
}

.search-item:hover {
    background: #f8f9fa;
}

.search-item b {
    color: var(--primary-color);
    font-size: 14px;
}

.search-item span {
    font-size: 12px;
    color: #7f8c8d;
}

.search-item .grave-tag {
    align-self: flex-start;
    background: #e1f0fa;
    color: #3498db;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    margin-top: 4px;
}

#details-container {
    margin-top: 25px;
    display: none;
    overflow-y: auto;
    padding-right: 5px;
}

#details-container.active {
    display: block;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.details-header {
    font-size: 20px;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 3px solid var(--accent-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.close-details {
    cursor: pointer;
    font-size: 20px;
    color: #bdc3c7;
    transition: color 0.2s;
}

.close-details:hover {
    color: #e74c3c;
}

h1 {
    margin: 0;
    font-size: 18px;
    color: var(--primary-color);
    font-weight: 600;
    white-space: nowrap;
}

/* Viewport mapy (środkowy panel) */
#viewport:active {
    cursor: grabbing;
}

#map-container {
    position: absolute;
    transform-origin: 0 0;
    z-index: 10;
    /* Szerokość i wysokość ustawiane dynamicznie w script.js na podstawie obrazu */
    /* Uruchomienie akceleracji GPU bez rasteryzacji tekstu */
    backface-visibility: hidden;
    transform-style: preserve-3d;
}

/* Płynne przejście używane tylko przy wyszukiwaniu/resetowaniu */
.smooth-transition {
    transition: transform var(--anim-duration, 2.6s) cubic-bezier(0.25, 1, 0.5, 1) !important;
}

/* Wyłączamy przejścia detali podczas dużych animacji dla płynności */
.intro-flying .lod-detail-2,
.intro-flying .lod-detail-3 {
    transition: none !important;
}

.bg-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    image-rendering: -webkit-optimize-contrast;
    display: block;
    pointer-events: none;
    transition: opacity 0.6s ease-in-out;
}

#bg-graves {
    z-index: 1;
    opacity: 1;
}

/* Utrzymujemy stałą widoczność warstwy bg-graves bez względu na zoom */
/* Zamiast przełączać obrazy, będziemy zanikać warstwę z dodanymi symbolami */

#sector-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
    pointer-events: none;
    transition: opacity 0.6s ease-in-out;
    opacity: 1;
    /* Domyślnie na oddaleniu widoczne */
}

.zoom-level-mid #sector-overlay {
    opacity: 0;
}

.sector-symbol {
    position: absolute;
    font-size: 300px;
    font-weight: bold;
    color: rgba(0, 0, 0, 0.5);
    /* Półprzezroczysty, by nie zasłaniał zbytnio */
    transform: translate(-50%, -50%);
    pointer-events: none;
    user-select: none;
    font-family: 'Outfit', sans-serif;
}

.military-title {
    position: absolute;
    font-size: 150px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    /* Trzeci stopień przezroczystości dla napisu */
    transform: translate(-50%, -50%);
    pointer-events: none;
    user-select: none;
    letter-spacing: 10px;
    font-family: 'Outfit', sans-serif;
    text-align: center;
}

.missionary-cross {
    position: absolute;
    width: 60px;
    height: 60px;
    background-image: url('../dane/zabawa/symbols/krzyz_misyjny.svg');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    transform: translate(-50%, -50%) rotate(-17.2deg);
    z-index: 4;
    pointer-events: none;
}

.karolina-grave {
    position: absolute;
    width: 160px;
    height: 240px;
    background-image: url('../dane/zabawa/symbols/pierwszy_grob_karoliny.svg');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    transform: translate(-50%, -50%) rotate(-12.5deg);
    z-index: 4;
    pointer-events: none;
}

.well-icon {
    position: absolute;
    width: 100px;
    height: 100px;
    background-image: url('../dane/zabawa/symbols/studnia.svg');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    transform: translate(-50%, -50%);
    z-index: 4;
    pointer-events: none;
}

#grave-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none;
}

.grave-box {
    position: absolute;
    border: 1px solid rgba(52, 152, 219, 0.4);
    background: rgba(52, 152, 219, 0.1);
    border-radius: 2px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    box-sizing: border-box;
    overflow: visible;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
}

.symbol-box {
    position: absolute;
    pointer-events: auto;
    z-index: 5;
}


.grave-box:hover {
    background: rgba(52, 152, 219, 0.5);
    border-color: rgba(52, 152, 219, 1);
    transform: translate(-50%, -50%) scale(1.05) rotate(var(--rotation)) !important;
    z-index: 1000 !important;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* LOD Control - .lod-detail-1 is always visible (default) */


.lod-detail-2 {
    visibility: hidden; /* Domyślnie ukryte - visibility zamiast display dla wydajności */
    pointer-events: none;
    transition: none !important;
}

.lod-detail-3 {
    visibility: hidden;
    pointer-events: none;
    transition: none !important;
}

/* Skokowe pojawianie się przy odpowiednim zoomie */
.zoom-level-mid .lod-detail-2 {
    visibility: visible;
    pointer-events: auto;
}

.zoom-level-high .lod-detail-3 {
    visibility: visible;
    pointer-events: auto;
}

/* Podświetlenie wybranego grobu (klikniętego) */
.grave-box.selected {
    border-width: 2px !important;
    z-index: 2000 !important;
    animation: pulse-border 1.5s infinite alternate ease-in-out;
}

@keyframes pulse-border {
    from {
        box-shadow: 0 0 5px rgba(0,0,0,0.2);
        filter: brightness(1);
    }
    to {
        box-shadow: 0 0 20px rgba(0,0,0,0.4);
        filter: brightness(1.1);
    }
}

.grave-id {
    position: absolute;
    top: 50%;
    left: 50%;
    width: max-content;
    height: max-content;
    color: #000;
    font-weight: 700;
    text-align: center;
    line-height: 1;
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    flex-shrink: 0;
    white-space: nowrap;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    /* Poprawa ostrości w przeglądarkach */
    text-rendering: geometricPrecision;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.grave-info {
    position: absolute;
    bottom: -20px;
    width: 150%;
    text-align: center;
    font-size: 8px;
    color: #34495e;
    display: none;
}

.zoom-level-high .grave-info {
    display: block;
}

#ui-overlay {
    position: absolute;
    bottom: 25px;
    left: 25px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ui-card {
    background: var(--overlay-bg);
    padding: 12px 18px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    font-size: 14px;
}

.zoom-controls {
    display: flex;
    gap: 5px;
}

.zoom-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: none;
    background: white;
    color: var(--primary-color);
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.zoom-btn:hover {
    background: #f0f0f0;
}

#status-bar {
    position: fixed;
    bottom: 20px;
    left: calc(var(--sidebar-brand-w, 0px) + 20px);
    max-width: calc(100vw - var(--sidebar-brand-w, 0px) - 360px);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    padding: 10px 24px;
    border-radius: 14px;
    font-size: 13px;
    font-weight: 500;
    color: #475569;
    z-index: 1000;
    pointer-events: none;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: left 0.3s ease, max-width 0.3s ease;
}

#status-bar:empty {
    display: none;
}


/* Tooltip style */
#tooltip {
    position: fixed;
    background: white;
    padding: 10px 15px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    pointer-events: none;
    z-index: 2000;
    display: none;
    font-size: 13px;
    /* blur usunięty */
}

#tooltip b {
    color: var(--accent-color);
}

/* Modal - Window dla informacji o zmarłych */
#info-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#info-modal.active {
    display: flex;
    opacity: 1;
}

.modal-content {
    background: white;
    width: 90%;
    max-width: 500px;
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    transform: translateY(30px);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

#info-modal.active .modal-content {
    transform: translateY(0);
}

.modal-header {
    padding: 25px;
    background: var(--primary-color);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.close-modal {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: background 0.2s;
}

.close-modal:hover {
    background: rgba(255, 255, 255, 0.3);
}

.modal-body {
    padding: 25px;
    overflow-y: auto;
    flex-grow: 1;
}

.person-card {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 20px;
    padding-right: 70px;
    margin-bottom: 20px;
    border-left: 5px solid var(--accent-color);
    transition: transform 0.2s;
    position: relative;
}

.person-card:last-child {
    margin-bottom: 0;
}

.person-card:hover {
    transform: translateX(5px);
}

.person-name {
    font-size: 18px;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 10px;
    display: block;
}

.person-biography {
    margin-top: 10px;
    padding: 10px 12px;
    background: #f8fafc;
    border-left: 3px solid #0284c7;
    border-radius: 6px;
    font-size: 13.5px;
    color: #334155;
    line-height: 1.6;
    white-space: pre-wrap;
    font-family: 'Outfit', sans-serif;
    font-style: normal;
    text-align: left;
}

.add-bio-link {
    display: inline-block;
    margin-top: 12px;
    font-size: 11px;
    color: #3498db;
    text-decoration: none;
    font-weight: 500;
    padding: 2px 0;
    border-bottom: 1px solid transparent;
    transition: all 0.2s;
}

.add-bio-link:hover {
    color: #2980b9;
    border-bottom-color: #2980b9;
}

.person-actions-container {
    margin-top: 10px;
    margin-right: -50px; /* offset the padding-right: 70px on .person-card */
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.person-action-btn {
    display: block;
    width: 100%;
    padding: 6px 12px;
    font-size: 11.5px;
    font-weight: 500;
    text-align: center;
    border-radius: 6px;
    cursor: pointer;
    box-sizing: border-box;
    transition: all 0.2s ease;
    user-select: none;
    -webkit-user-select: none;
    border: 1px solid transparent;
}

/* Primary Button: "Dodaj życiorys / wspomnienie" */
.person-action-btn.primary {
    background: #e0f2fe; /* light sky blue */
    color: #0369a1; /* dark blue text */
    border-color: #bae6fd;
}

.person-action-btn.primary:hover {
    background: #bae6fd;
    border-color: #7dd3fc;
    color: #0284c7;
}

.person-action-btn.primary:active {
    transform: scale(0.97);
    background: #7dd3fc;
}

/* Secondary Button: "Zgłoś błąd / uzupełnij dane o tej osobie" */
.person-action-btn.secondary {
    background: #f1f5f9; /* light slate gray */
    color: #475569;
    border-color: #e2e8f0;
}

.person-action-btn.secondary:hover {
    background: #e2e8f0;
    border-color: #cbd5e0;
    color: #1e293b;
}

.person-action-btn.secondary:active {
    transform: scale(0.97);
    background: #cbd5e0;
}

.person-details {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 15px;
    font-size: 14px;
    color: #636e72;
}

.detail-item b {
    color: #2d3436;
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.grave-photo-gallery {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 25px;
}

.grave-photo-container {
    border-radius: 8px;
    overflow: hidden;
    background: #f1f5f9;
    line-height: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.grave-photo-container:first-child:nth-last-child(1) {
    grid-column: span 2;
    /* Jeśli jest tylko 1 zdjęcie, niech zajmuje całą szerokość */
}


.grave-photo-container img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    max-height: 300px;
    cursor: zoom-in;
    transition: opacity 0.2s;
}

.grave-photo-container img:hover {
    opacity: 0.9;
}

/* Lightbox Stylizacja */
#lightbox {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    cursor: zoom-out;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#lightbox.active {
    display: flex;
    opacity: 1;
}

#lightbox-img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
    border-radius: 4px;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

#lightbox.active #lightbox-img {
    transform: scale(1);
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
}




/* Pineska wyszukiwania */
#map-pin {
    position: absolute;
    left: 0;
    top: 0;
    width: var(--rozmiar-pinu);
    height: var(--rozmiar-pinu);
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23e74c3c" stroke="white" stroke-width="0.7" stroke-linejoin="round" fill-rule="evenodd"><path d="M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm-1 3h2v3h3v2h-3v3h-2v-3h-3v-2h3V5z"/></svg>');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: bottom center;
    z-index: 1000;
    cursor: pointer;
    display: none;
    filter: drop-shadow(0 0 1.5px white) drop-shadow(2px 4px 6px rgba(0, 0, 0, 0.5));
    animation: bounce 0.5s infinite alternate cubic-bezier(0.45, 0.05, 0.55, 0.95);
    transform-origin: bottom center;
    transform: translate(calc(-50% + var(--pin-x, 0px)), calc(-100% + var(--pin-y, 0px)));
    pointer-events: none;
}

@keyframes bounce {
    from {
        transform: translate(calc(-50% + var(--pin-x, 0px)), calc(-100% + var(--pin-y, 0px)));
    }

    to {
        transform: translate(calc(-50% + var(--pin-x, 0px)), calc(-100% - 12px + var(--pin-y, 0px)));
    }
}

/* Przycisk zgłaszania błędu */
.report-btn {
    margin-top: 30px;
    padding: 12px;
    background: #f8f9fa;
    border: 1px dashed #cbd5e0;
    border-radius: 10px;
    color: #718096;
    font-size: 13px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.report-btn:hover {
    background: #edf2f7;
    border-color: #a0aec0;
    color: #4a5568;
}

/* Modal zgłoszenia */
.report-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);

    display: none;
    align-items: center;
    justify-content: center;
    z-index: 3000;
}

.report-card {
    background: white;
    width: 90%;
    max-width: 500px;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.report-card h2 {
    margin: 0 0 10px;
    color: var(--primary-color);
    font-size: 20px;
}

.report-card p {
    color: #718096;
    font-size: 14px;
    margin-bottom: 20px;
}

.report-field {
    margin-bottom: 20px;
}

.report-field label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 13px;
    color: #4a5568;
}

.report-field textarea,
.report-field input {
    width: 100%;
    padding: 12px;
    border: 2px solid #edf2f7;
    border-radius: 10px;
    font-family: inherit;
    font-size: 14px;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.report-field textarea:focus {
    outline: none;
    border-color: var(--accent-color);
}

.report-actions {
    display: flex;
    gap: 10px;
    margin-top: 25px;
}

.btn-send {
    flex: 2;
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 12px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
}

.btn-cancel {
    flex: 1;
    background: #edf2f7;
    color: #4a5568;
    border: none;
    padding: 12px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
}

/* Sekcja Rocznic */
#anniversary-section {
    margin-bottom: 25px;
    padding: 15px;
    background: #fff9f0;
    border: 1px solid #ffeeba;
    border-radius: 12px;
    display: none;
}

.anniversary-title {
    font-size: 13px;
    font-weight: 700;
    color: #856404;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

#anniversary-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.anniversary-item {
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(133, 100, 4, 0.1);
    cursor: pointer;
    transition: transform 0.2s;
}

.anniversary-item:last-child {
    border-bottom: none;
}

.anniversary-item:hover {
    transform: translateX(5px);
}

.anniversary-item b {
    font-size: 14px;
    color: #2d3436;
    display: block;
}

.anniversary-date {
    font-size: 11px;
    color: #856404;
    display: block;
}

.anniversary-tag {
    float: right;
    background: #856404;
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}

/* Grupowanie rocznic */
.anniversary-group {
    margin-bottom: 12px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid rgba(133, 100, 4, 0.05);
}

.anniversary-group-header {
    padding: 10px 15px;
    background: #fff4e5;
    color: #856404;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.anniversary-group-header::-webkit-details-marker {
    display: none;
}

.anniversary-group-header::after {
    content: '▼';
    font-size: 10px;
    transition: transform 0.2s;
}

.anniversary-group[open] .anniversary-group-header::after {
    transform: rotate(180deg);
}

.anniversary-group .anniversary-item {
    margin: 0 10px;
    padding: 10px 5px;
}

.anniversary-day-label {
    font-size: 12px;
    font-weight: 700;
    color: #856404;
    margin: 15px 0 5px;
    padding-bottom: 3px;
    border-bottom: 1px dashed rgba(133, 100, 4, 0.2);
}
/* ==========================================
   WIRTUALNY ZNICZ (v3.0.0)
   ========================================== */

@keyframes flicker {
    0% { transform: scale(1); opacity: 0.8; }
    20% { transform: scale(1.1) rotate(-1deg); opacity: 0.9; }
    40% { transform: scale(0.9) rotate(1deg); opacity: 0.7; }
    60% { transform: scale(1.05); opacity: 1; }
    80% { transform: scale(0.95) rotate(-0.5deg); opacity: 0.8; }
    100% { transform: scale(1); opacity: 0.9; }
}

@keyframes glow-pulse {
    0% { transform: translate(-50%, -50%) scale(1); opacity: 0.5; }
    50% { transform: translate(-50%, -50%) scale(1.3); opacity: 0.8; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 0.5; }
}

.candle-tile {
    background: #fff;
    border: 2px solid #f1f5f9;
    border-radius: 15px;
    padding: 15px;
    margin: 15px 0;
    display: flex;
    align-items: center;
    gap: 15px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
}

.candle-tile:hover {
    border-color: #ffd700;
    background: #fffdf0;
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(255, 215, 0, 0.1);
}

.candle-icon-container {
    width: 60px;
    height: 60px;
    background: #f8fafc url('../znicz_biały.png?v=2') no-repeat center;
    background-size: contain;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.candle-icon-container .icon,
.candle-icon-container .flame {
    display: none;
}

.candle-tile-text b {
    display: block;
    color: var(--primary-color);
    font-size: 15px;
}

.candle-tile-text span {
    font-size: 12px;
    color: #64748b;
}

/* Sidebar Recent Candles */
#candles-section {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #f1f5f9;
}

.section-title {
    font-size: 16px;
    font-weight: 600;
    color: #475569;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.candle-list-item {
    background: white;
    padding: 12px;
    border-radius: 10px;
    margin-bottom: 10px;
    border-left: 4px solid #ffd700;
    box-shadow: 0 2px 4px rgba(0,0,0,0.03);
    font-size: 13px;
    animation: fadeIn 0.5s ease forwards;
    cursor: pointer;
    transition: all 0.2s ease;
}

.candle-list-item:hover {
    background: #f8fafc;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.candle-list-item.type-blue { border-left-color: #3498db; }
.candle-list-item.type-white { border-left-color: #e2e8f0; }

.candle-list-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
}

.candle-list-name {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 14px;
}

.candle-list-date {
    font-size: 11px;
    color: #94a3b8;
}

.candle-list-msg {
    font-style: italic;
    color: #64748b;
    font-size: 14px;
    margin-top: 4px;
}

.candle-list-grave {
    font-size: 10px;
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
    color: #475569;
    margin-top: 8px;
    display: inline-block;
}

/* Modal Znicza */
#candle-modal {
    display: none;
    position: fixed;
    z-index: 10001;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6);

    align-items: center;
    justify-content: center;
}

.candle-modal-card {
    background: white;
    width: 90%;
    max-width: 450px;
    border-radius: 24px;
    padding: 30px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    animation: slideDown 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.candle-modal-card h2 {
    margin: 0 0 10px 0;
    font-size: 22px;
    color: var(--primary-color);
}

.candle-type-selector {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin: 20px 0;
}

.candle-type-option {
    border: 2px solid #f1f5f9;
    border-radius: 15px;
    padding: 15px 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.candle-type-option.active {
    border-color: var(--accent-color);
    background: #f0f7ff;
}

.candle-type-option .icon {
    width: 40px;
    height: 40px;
    display: block;
    margin: 0 auto 8px;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    transition: all 0.3s ease;
}

/* Dedykowane grafiki dla zniczy */
.candle-type-option[data-type="gold"] .icon {
    background-image: url('../znicz_złoty.png?v=2');
}

.candle-type-option[data-type="blue"] .icon {
    background-image: url('../znicz_niebieski.png?v=2');
}

.candle-type-option[data-type="white"] .icon {
    background-image: url('../znicz_biały.png?v=2');
}

.candle-type-option span {
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
}

.modal-input-group {
    margin-bottom: 20px;
}

.modal-input-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    margin-bottom: 8px;
}

.modal-input-group input, 
.modal-input-group textarea {
    width: 100%;
    padding: 12px 16px;
    border-radius: 12px;
    border: 2px solid #f1f5f9;
    font-family: inherit;
    font-size: 14px;
    box-sizing: border-box;
    transition: all 0.2s;
}

.modal-input-group input:focus, 
.modal-input-group textarea:focus {
    border-color: var(--accent-color);
    outline: none;
    background: white;
}

.candle-modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 30px;
}

.btn-candle-submit {
    flex: 2;
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 14px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-candle-submit:hover {
    filter: brightness(1.1);
    transform: translateY(-2px);
}

.btn-candle-cancel {
    flex: 1;
    background: #f1f5f9;
    color: #64748b;
    border: none;
    padding: 14px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
}

.candle-glow-effect {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    background: radial-gradient(circle, rgba(255,190,0,0.85) 0%, rgba(255,190,0,0) 80%);
    pointer-events: none;
    z-index: 10;
    border-radius: 50%;
    /* Używamy zmiennej CSS do skalowania, aby animacja jej nie nadpisywała */
    --base-scale: 1;
    transform: translate(-50%, -50%) scale(var(--base-scale));
    animation: glow-pulse 2.5s infinite ease-in-out;
    display: flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0 0 5px orange);
}

@keyframes glow-pulse {
    0%, 100% { opacity: 0.7; transform: translate(-50%, -50%) scale(var(--base-scale)); }
    50% { opacity: 1; transform: translate(-50%, -50%) scale(calc(var(--base-scale) * 1.1)); }
}

/* Person Selection in Modal */
.person-select-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 150px;
    overflow-y: auto;
    padding-right: 5px;
}

.person-select-option {
    padding: 10px 15px;
    border: 2px solid #f1f5f9;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    background: #f8fafc;
    color: #475569;
    display: flex;
    align-items: center;
    gap: 10px;
}

.checkbox-icon {
    width: 20px;
    height: 20px;
    border: 2px solid #cbd5e1;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    background: white;
    flex-shrink: 0;
}

.person-select-option.active .checkbox-icon {
    background: var(--accent-color);
    border-color: var(--accent-color);
}

.person-select-option.active .checkbox-icon::after {
    content: '✓';
    color: white;
    font-size: 14px;
    font-weight: 900;
}

.person-select-option:hover {
    border-color: #cbd5e1;
}

.person-select-option.active {
    border-color: var(--accent-color);
    background: #f0f7ff;
    color: var(--primary-color);
    font-weight: 600;
}

.candle-list-target {
    font-size: 11px;
    color: #94a3b8;
    margin-bottom: 2px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.person-candle-icon {
    position: absolute;
    right: 20px;
    top: 32px;
    width: 45px;
    height: 45px;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    filter: drop-shadow(0 2px 5px rgba(0,0,0,0.1));
}

.person-candle-icon.type-gold { background-image: url('../znicz_złoty.png?v=2'); }
.person-candle-icon.type-blue { background-image: url('../znicz_niebieski.png?v=2'); }
.person-candle-icon.type-white { background-image: url('../znicz_biały.png?v=2'); }

@keyframes person-flicker {
    0%, 100% { transform: scale(1) rotate(0deg); filter: drop-shadow(0 0 2px orange); }
    50% { transform: scale(1.1) rotate(2deg); filter: drop-shadow(0 0 5px gold); }
}

/* Modal Pełnej Listy (v3.0.0) */
.section-title#recent-candles-title {
    cursor: pointer;
    transition: all 0.2s;
    border-radius: 10px;
    padding: 8px 12px;
    margin: 5px 0 15px 0;
    width: 100%;
    box-sizing: border-box;
}

.section-title#recent-candles-title:hover {
    background: #fff9e6;
    color: #856404;
}

.full-list-modal {
    display: none;
    position: fixed;
    z-index: 10002;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6);

    align-items: center;
    justify-content: center;
}

.full-list-modal.active {
    display: flex;
}

.full-list-card {
    background: white;
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    border-radius: 20px;
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.full-list-header {
    padding: 20px 25px;
    background: white;
    border-bottom: 2px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.full-list-header h2 {
    margin: 0;
    font-size: 20px;
    color: var(--primary-color);
}

.close-list {
    font-size: 28px;
    font-weight: bold;
    color: #94a3b8;
    cursor: pointer;
    line-height: 1;
}

.close-list:hover { color: #64748b; }

.full-list-scroll {
    padding: 20px 25px;
    overflow-y: auto;
    flex: 1;
}

.full-list-scroll .candle-list-item {
    background: #f8fafc;
    border: 1px solid #f1f5f9;
    margin-bottom: 12px;
}

/* Lightbox Navigation (v3.0.0) */
.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: white;
    font-size: 40px;
    background: rgba(0, 0, 0, 0.3);
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    cursor: pointer;
    user-select: none;
    transition: all 0.3s ease;
    z-index: 2010;
}

.lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-50%) scale(1.1);
}

#lightbox-prev {
    left: 20px;
}

#lightbox-next {
    right: 20px;
}

@media (max-width: 768px) {
    .lightbox-nav {
        width: 45px;
        height: 45px;
        font-size: 24px;
        background: rgba(0, 0, 0, 0.5);
    }
    #lightbox-prev { left: 10px; }
    #lightbox-next { right: 10px; }
}

/* Rocznice Śmierci - Kalendarz całoroczny */
.calendar-day-cell.day-empty {
    color: #475569;
}
.calendar-day-cell.day-empty:hover {
    background: #f1f5f9;
    color: #1e293b;
}
.calendar-day-cell.day-has-anniv {
    background: #fef3c7;
    color: #b45309;
    font-weight: 700 !important;
}
.calendar-day-cell.day-has-anniv:hover {
    background: #fde68a;
    color: #78350f;
    transform: scale(1.1);
}
.calendar-day-cell.selected {
    background: #fde68a !important;
    color: #78350f !important;
    box-shadow: 0 0 0 2px #b45309 inset !important;
    transform: scale(1.1);
}
#btn-open-calendar {
    transition: transform 0.2s, opacity 0.2s;
    opacity: 0.8;
}
#btn-open-calendar:hover {
    transform: scale(1.25);
    opacity: 1;
}

/* --- LEAFLET GPS MAP INTEGRATION --- */
#leaflet-map {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    border-radius: 20px;
    overflow: hidden;
    pointer-events: none;
}
#viewport.gps-active #status-overlay {
    display: none !important;
}
#viewport.gps-active #bg-graves {
    opacity: 0.5;
}
#viewport.gps-active.zoom-level-mid #bg-graves {
    opacity: 1.0;
}


.viewport-map-mode-btn {
    background: rgba(255, 255, 255, 0.75);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--primary-color);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
}
.viewport-map-mode-btn:hover {
    background: #ffffff;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
    transform: translateY(-1px);
    color: var(--accent-color);
}
.viewport-map-mode-btn.active {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

.viewport-locate-btn {
    position: absolute;
    bottom: 80px;
    right: 20px;
    z-index: 60;
    width: 44px;
    height: 44px;
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    color: var(--primary-color);
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
}
.viewport-locate-btn:hover {
    background: #f8fafc;
    color: var(--accent-color);
    transform: scale(1.05);
}
.viewport-locate-btn.active {
    color: #3b82f6;
}

/* Przycisk przełączania warstw mapy (OSM/Satelita) */
.viewport-layer-btn {
    background: rgba(255, 255, 255, 0.75);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    font-size: 12px;
    padding: 6px 10px;
    cursor: pointer;
    display: none;
    align-items: center;
    gap: 5px;
    transition: all 0.2s;
    font-family: inherit;
    backdrop-filter: blur(6px);
    color: #333;
}
.viewport-layer-btn:hover {
    background: rgba(255, 255, 255, 0.95);
    transform: scale(1.03);
}
.viewport-layer-btn.active {
    background: rgba(0, 0, 0, 0.75);
    color: white;
}

@media (max-width: 600px) {
    .viewport-map-mode-btn span {
        display: none;
    }
    .viewport-map-mode-btn {
        padding: 8px;
    }
}

/* Nakładka z innymi cmentarzami na mapie */
#other-cemeteries-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 15;
    display: none;
}
#viewport.gps-active #other-cemeteries-overlay {
    display: block; /* Pokazujemy tylko gdy mapa podkładowa jest aktywna */
}

/* Pin cmentarza na mapie */
.cemetery-marker-pin {
    position: absolute;
    width: 48px;
    height: 48px;
    background: #ffffff;
    border: 3px solid var(--accent-color);
    border-radius: 50%;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.25);
    transform-origin: center center;
    transform: translate(-50%, -50%);
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), background 0.2s, color 0.2s;
    pointer-events: auto;
    z-index: 1000;
}
.cemetery-marker-pin:hover {
    transform: translate(-50%, -50%) scale(1.15);
    background: var(--accent-color);
    color: #ffffff;
}
.cemetery-marker-pin i {
    font-size: 20px;
}

/* Tooltip dla pinu cmentarza */
.cemetery-marker-pin .cemetery-tooltip {
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%) rotate(0deg);
    background: rgba(15, 23, 42, 0.95);
    color: #ffffff;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease-in-out;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    font-weight: 600;
    text-align: center;
    font-family: 'Outfit', sans-serif;
}
.cemetery-marker-pin:hover .cemetery-tooltip {
    opacity: 1;
}
.cemetery-marker-pin .cemetery-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: rgba(15, 23, 42, 0.95);
}

/* ==========================================================================
   Moduł Mowy na Tekst (Speech-to-Text) i Asystent Głosowy
   ========================================================================== */

/* Przyciski mikrofonu wewnątrz pól input/textarea */
.speech-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.speech-input-wrapper input,
.speech-input-wrapper textarea {
    padding-right: 38px !important; /* Rezerwacja miejsca na przycisk mikrofonu */
    flex: 1;
    width: 100%;
}

.speech-mic-btn {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    cursor: pointer;
    color: #94a3b8;
    padding: 6px;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, transform 0.2s;
    z-index: 10;
    outline: none;
    border-radius: 50%;
}

.speech-mic-btn:hover {
    color: var(--accent-color, #3498db);
    transform: scale(1.15);
    background: rgba(0, 0, 0, 0.05);
}

.speech-mic-btn.listening {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
    animation: pulse-mic 1.5s infinite;
}

@keyframes pulse-mic {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
    }
    70% {
        transform: scale(1.15);
        box-shadow: 0 0 0 6px rgba(239, 68, 68, 0);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

/* Przycisk Asystenta Głosowego w nagłówku modala */
.btn-voice-assistant {
    background: rgba(255, 255, 255, 0.1) !important;
    border: 1px dashed rgba(255, 255, 255, 0.4) !important;
    color: white !important;
    cursor: pointer;
    font-size: 0.85rem !important;
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px !important;
    border-radius: 20px !important;
    transition: all 0.2s !important;
    font-weight: 500 !important;
}

.btn-voice-assistant:hover {
    background: rgba(255, 255, 255, 0.2) !important;
    border-color: white !important;
    transform: translateY(-1px);
}

.btn-voice-assistant.active {
    background: #ef4444 !important;
    border-color: #ef4444 !important;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
    animation: pulse-assistant 2s infinite;
}

@keyframes pulse-assistant {
    0% { opacity: 1; }
    50% { opacity: 0.85; }
    100% { opacity: 1; }
}

/* Panel Asystenta Głosowego */
.voice-assistant-panel {
    position: fixed;
    top: 10vh;
    right: 20px;
    width: 330px;
    height: 80vh;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12);
    z-index: 2100;
    display: flex;
    flex-direction: column;
    padding: 20px;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s;
    transform: translateX(380px);
    opacity: 0;
    pointer-events: none;
    font-family: 'Outfit', sans-serif;
}

.voice-assistant-panel.active {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
}

.voice-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 12px;
    margin-bottom: 15px;
}

.voice-panel-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.voice-panel-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: #64748b;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.voice-panel-close:hover {
    color: #0f172a;
}

.voice-panel-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    gap: 15px;
}

/* Wizualizator audio (waveform) */
.voice-visualizer-container {
    background: #0f172a;
    border-radius: 12px;
    padding: 20px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 110px;
    position: relative;
    overflow: hidden;
}

.voice-status-text {
    font-size: 0.8rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
    z-index: 2;
}

.voice-live-text {
    font-size: 1rem;
    color: white;
    text-align: center;
    font-weight: 500;
    min-height: 24px;
    z-index: 2;
    padding: 0 10px;
    word-break: break-word;
}

/* Symulowane fale dźwiękowe */
.voice-waves {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    height: 40px;
    width: 100%;
    margin-top: 10px;
}

.voice-wave-bar {
    width: 3px;
    height: 5px;
    background: #3498db;
    border-radius: 3px;
    transition: height 0.1s ease;
}

.voice-waves.listening .voice-wave-bar {
    background: #ef4444;
    animation: wave-bounce 1.2s infinite ease-in-out;
}

.voice-waves.listening .voice-wave-bar:nth-child(2n) {
    animation-delay: 0.15s;
}
.voice-waves.listening .voice-wave-bar:nth-child(3n) {
    animation-delay: 0.3s;
}
.voice-waves.listening .voice-wave-bar:nth-child(4n) {
    animation-delay: 0.45s;
}

@keyframes wave-bounce {
    0%, 100% { height: 5px; }
    50% { height: 35px; }
}

/* Lista kroków / pól formularza */
.voice-steps-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

.voice-step-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    font-size: 0.9rem;
    color: #475569;
    transition: all 0.2s;
}

.voice-step-item.active {
    background: rgba(52, 152, 219, 0.08);
    border-color: rgba(52, 152, 219, 0.4);
    color: #2c3e50;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.05);
}

.voice-step-item.completed {
    background: rgba(39, 174, 96, 0.05);
    border-color: rgba(39, 174, 96, 0.2);
    color: #27ae60;
}

.voice-step-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: bold;
    color: #64748b;
    transition: all 0.2s;
}

.voice-step-item.active .voice-step-icon {
    background: var(--accent-color, #3498db);
    color: white;
}

.voice-step-item.completed .voice-step-icon {
    background: #27ae60;
    color: white;
}

.voice-step-label {
    flex: 1;
}

.voice-step-value {
    font-size: 0.8rem;
    color: #64748b;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: right;
}

.voice-step-item.completed .voice-step-value {
    color: #27ae60;
    font-weight: 500;
}

/* Stopka panelu sterowania */
.voice-panel-footer {
    border-top: 1px solid #e2e8f0;
    padding-top: 15px;
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.voice-controls-row {
    display: flex;
    gap: 8px;
}

.voice-btn {
    flex: 1;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s;
    border: 1px solid #cbd5e1;
    background: white;
    color: #475569;
}

.voice-btn:hover:not(:disabled) {
    background: #f1f5f9;
    color: #0f172a;
}

.voice-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.voice-btn-primary {
    background: var(--accent-color, #3498db);
    border-color: var(--accent-color, #3498db);
    color: white;
}

.voice-btn-primary:hover:not(:disabled) {
    background: #2980b9;
    border-color: #2980b9;
    color: white;
}

.voice-btn-danger {
    background: #ef4444;
    border-color: #ef4444;
    color: white;
}

.voice-btn-danger:hover:not(:disabled) {
    background: #dc2626;
    border-color: #dc2626;
    color: white;
}

.voice-instructions-tip {
    font-size: 0.75rem;
    color: #64748b;
    background: #f8fafc;
    padding: 8px 12px;
    border-radius: 8px;
    border-left: 3px solid var(--accent-color, #3498db);
    line-height: 1.4;
}

/* Welcome Modal Style */
.welcome-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.45); /* Lighter, more subtle overlay */
    backdrop-filter: blur(4px); /* Softer blur */
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 11000;
    animation: fadeIn 0.3s ease-out;
}

.welcome-card {
    background: #ffffff;
    width: 90%;
    max-width: 500px; /* Slimmer, more compact card */
    border-radius: 18px;
    padding: 28px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    gap: 20px;
    transform: scale(0.95);
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slideUp {
    to {
        transform: scale(1);
    }
}

.welcome-header {
    text-align: center;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 12px;
}

.welcome-header h2 {
    color: #1e293b;
    font-size: 21px; /* Slightly smaller header */
    font-weight: 600;
    margin: 0;
    font-family: 'Playfair Display', serif;
}

.welcome-intro {
    color: #64748b;
    font-size: 13.5px;
    text-align: center;
    margin-bottom: 10px;
    line-height: 1.5;
}

.welcome-features {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.welcome-feature-item {
    display: flex;
    gap: 15px;
    padding: 12px 10px;
    border-radius: 10px;
    background: transparent;
    border: none;
    border-bottom: 1px solid #f1f5f9;
    transition: all 0.2s ease;
}

.welcome-feature-item:last-child {
    border-bottom: none;
}

.welcome-feature-item:hover {
    background: #f8fafc; /* Gentle background change, no heavy shadows */
}

.welcome-feature-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    color: #2c3e50;
    font-size: 16px;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    flex-shrink: 0;
}

.welcome-feature-text h3 {
    margin: 0 0 3px 0;
    color: #1e293b;
    font-size: 14.5px;
    font-weight: 600;
}

.welcome-feature-text p {
    margin: 0;
    color: #64748b;
    font-size: 12.5px;
    line-height: 1.4;
}

.welcome-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-top: 5px;
}

.welcome-dont-show {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 12px;
    color: #64748b;
    user-select: none;
}

.welcome-dont-show input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: #2c3e50;
    cursor: pointer;
}

.btn-welcome-close {
    background: #2c3e50;
    color: #ffffff;
    border: none;
    padding: 11px 22px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    width: 100%;
    text-align: center;
    transition: all 0.2s ease;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.btn-welcome-close:hover {
    background: #1e293b;
    transform: translateY(-1px);
    box-shadow: 0 8px 12px -3px rgba(0, 0, 0, 0.08);
}

/* ==========================================================================
   KAFELKI NAD ROCZNICAMI I KLEPSYDRY ZMARŁYCH (v3.0.0)
   ========================================================================== */
.sidebar-top-tiles {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 20px;
}

.sidebar-tile {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 10px 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.sidebar-tile:hover {
    border-color: #cbd5e1;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.06);
}

.sidebar-tile.active {
    background: #1e293b;
    color: #ffffff;
    border-color: #1e293b;
}

.sidebar-tile .tile-icon {
    font-size: 14px;
    margin-bottom: 4px;
    color: #64748b;
}

.sidebar-tile.active .tile-icon {
    color: #f1c40f;
}

.sidebar-tile .tile-info {
    text-align: center;
    line-height: 1.1;
}

.sidebar-tile .tile-count {
    font-size: 14px;
    font-weight: 700;
    display: block;
}

.sidebar-tile .tile-label {
    font-size: 10px;
    color: #64748b;
    font-weight: 500;
}

.sidebar-tile.active .tile-label {
    color: rgba(255, 255, 255, 0.7);
}

/* SEKCJA KLEPSYDR */
.obituaries-title-bar {
    font-size: 15px;
    border-bottom: 2px solid #cbd5e1;
    padding-bottom: 10px;
    margin-bottom: 15px;
    color: #1e293b;
    font-weight: 700;
    display: flex;
    align-items: center;
    width: 100%;
}

.obituaries-badge {
    margin-left: auto;
    font-size: 11px;
    background: #1e293b;
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
}

.obituary-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-left: 4px solid #1e293b;
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 12px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.03);
    transition: all 0.2s ease;
    position: relative;
}

.obituary-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.08);
    border-color: #cbd5e1;
    border-left-color: #000000;
}

.obituary-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.obituary-card-photo {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #64748b;
    flex-shrink: 0;
}

.obituary-card-name {
    font-size: 17px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.25;
}

.obituary-card-dates {
    font-size: 13px;
    color: #64748b;
    margin-top: 3px;
}

.obituary-card-funeral {
    background: #f8fafc;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 14px;
    line-height: 1.5;
    color: #1e293b;
    margin-top: 10px;
    border: 1px solid #e2e8f0;
}

.obituary-card-funeral strong {
    color: #0f172a;
    display: block;
    font-size: 14px;
    margin-bottom: 4px;
}

.obituary-card-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px dashed #e2e8f0;
}

.btn-obituary-action {
    flex: 1;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #334155;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-decoration: none;
    transition: all 0.15s ease;
}

.btn-obituary-action:hover {
    background: #f1f5f9;
    color: #0f172a;
    border-color: #94a3b8;
}

.btn-obituary-action.pdf-btn {
    background: #1e293b;
    color: #ffffff;
    border-color: #1e293b;
}

.btn-obituary-action.pdf-btn:hover {
    background: #0f172a;
}



