/* ======================================================
   KOLOROWE RYTMY — MAPA I ENCYKLOPEDIA POSTACI (SWIAT/MAPA.CSS)
   ====================================================== */

:root {
    --kr-orange: #ff8c42;
    --kr-pink: #ff5ca8;
    --kr-blue: #4facfe;
    --kr-green: #38ef7d;
    --kr-dark: #06305f;
    --kr-card-bg: rgba(255, 255, 255, 0.85);
    --kr-border: rgba(255, 255, 255, 0.9);
    --kr-shadow: 0 16px 40px rgba(39, 74, 129, 0.12);
}

.kr-swiat-wrapper {
    font-family: 'Nunito', sans-serif;
    color: #4f637c;
    max-width: 1300px;
    margin: 0 auto;
    padding: 20px 15px 60px;
}

/* --- HERO SECTION --- */
.kr-swiat-hero {
    position: relative;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.88), rgba(255, 245, 238, 0.75));
    border: 1px solid var(--kr-border);
    box-shadow: var(--kr-shadow);
    backdrop-filter: blur(16px);
    border-radius: 32px;
    padding: 28px 32px;
    margin-bottom: 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.kr-swiat-hero-title h1 {
    margin: 0 0 6px;
    font-size: clamp(28px, 4vw, 42px);
    color: var(--kr-dark);
    font-weight: 900;
    line-height: 1.1;
}

.kr-title-gradient {
    background: linear-gradient(90deg, #ff8b45, #ff5ca8, #00c6ff, #38ef7d);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.kr-swiat-hero-title p {
    margin: 0;
    font-size: 17px;
    font-weight: 800;
    color: #5d7089;
}

/* --- CONTROLS / TABS BAR --- */
.kr-swiat-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.kr-swiat-tabs {
    display: flex;
    background: rgba(255, 255, 255, 0.9);
    padding: 6px;
    border-radius: 999px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.8);
}

.kr-tab-btn {
    border: none;
    background: transparent;
    padding: 10px 22px;
    border-radius: 999px;
    font-size: 16px;
    font-weight: 900;
    color: #5d7089;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.kr-tab-btn.active, .kr-tab-btn:hover {
    background: linear-gradient(135deg, var(--kr-orange), #ff6f4b);
    color: #fff;
    box-shadow: 0 8px 20px rgba(255, 140, 66, 0.35);
}

.kr-swiat-search {
    position: relative;
    min-width: 280px;
}

.kr-swiat-select {
    padding: 12px 40px 12px 20px;
    border-radius: 999px;
    border: 2px solid rgba(255, 140, 66, 0.3);
    background-color: rgba(255, 255, 255, 0.9);
    background-image: url("data:image/svg+xml;utf8,<svg fill='%235d7089' height='24' viewBox='0 0 24 24' width='24' xmlns='http://www.w3.org/2000/svg'><path d='M7 10l5 5 5-5z'/><path d='M0 0h24v24H0z' fill='none'/></svg>");
    background-repeat: no-repeat;
    background-position: right 10px center;
    font-family: inherit;
    font-size: 15px;
    font-weight: 800;
    color: var(--kr-dark);
    outline: none;
    transition: all 0.25s ease;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.04);
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}

.kr-swiat-select:focus {
    border-color: var(--kr-orange);
    box-shadow: 0 8px 24px rgba(255, 140, 66, 0.2);
}

.kr-swiat-search input {
    width: 100%;
    padding: 12px 20px 12px 42px;
    border-radius: 999px;
    border: 2px solid rgba(255, 140, 66, 0.3);
    background: rgba(255, 255, 255, 0.9);
    font-family: inherit;
    font-size: 15px;
    font-weight: 800;
    color: var(--kr-dark);
    outline: none;
    transition: all 0.25s ease;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.04);
}

.kr-swiat-search input:focus {
    border-color: var(--kr-orange);
    box-shadow: 0 8px 24px rgba(255, 140, 66, 0.2);
}

.kr-swiat-search-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    opacity: 0.6;
}

/* --- FILTER CHIPS --- */
.kr-swiat-filters {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 12px;
    margin-bottom: 20px;
    scrollbar-width: thin;
}

.kr-filter-chip {
    white-space: nowrap;
    border: none;
    background: rgba(255, 255, 255, 0.85);
    padding: 10px 20px;
    border-radius: 999px;
    font-size: 15px;
    font-weight: 800;
    color: #4f637c;
    cursor: pointer;
    transition: all 0.25s ease;
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}

.kr-filter-chip:hover, .kr-filter-chip.active {
    background: var(--kr-dark);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(6, 48, 95, 0.25);
}

/* --- MAP VIEW CONTAINER (STATIC, NON-DRAGGABLE) --- */
.kr-map-section {
    position: relative;
    width: 100%;
    height: 760px;
    border-radius: 32px;
    overflow: hidden;
    background: #eef7ff;
    box-shadow: 0 20px 50px rgba(39, 74, 129, 0.15);
    border: 3px solid rgba(255, 255, 255, 0.9);
}

.kr-map-viewport {
    width: 100%;
    height: 100%;
    cursor: default;
    position: relative;
    user-select: none;
    overflow: hidden;
}

.kr-map-content {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform-origin: center center;
    /* Very smooth, gentle, slow transition for hover zoom focus */
    transition: transform 0.8s cubic-bezier(0.25, 1, 0.5, 1);
}

.kr-map-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none;
}

.kr-map-label-hotspot {
    position: absolute;
    transform: translate(-50%, -50%);
    cursor: zoom-in;
    z-index: 15;
    transition: all 0.25s ease;
}

.kr-map-label-hotspot:hover {
    transform: translate(-50%, -50%) scale(1.08);
    z-index: 25;
}

.kr-label-text {
    position: relative;
    overflow: hidden;
    font-family: 'Nunito', 'Comic Sans MS', 'Chalkboard SE', sans-serif;
    font-weight: 900;
    font-size: 18px;
    color: #ffffff;
    background: #1964bc;
    border: none;
    padding: 8px 18px;
    border-radius: 999px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25);
    white-space: nowrap;
    display: inline-block;
    transition: all 0.25s ease;
}

/* Efekt fajerwerku aktywowany klasą po kliknięciu */
@keyframes kr-firework-burst {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.8), 0 0 0 0 rgba(25, 100, 188, 0.8); background: #1964bc; color: #fff; }
    30% { transform: scale(1.2); box-shadow: 0 0 20px 10px rgba(255, 255, 255, 0.9), 0 0 40px 20px rgba(25, 100, 188, 0.6); background: #ffea00; color: #d32f2f; }
    100% { transform: scale(1); box-shadow: 0 0 50px 30px rgba(255, 255, 255, 0), 0 0 60px 40px rgba(25, 100, 188, 0); background: #1964bc; color: #fff; }
}

.kr-sparkle .kr-label-text {
    animation: kr-firework-burst 0.6s ease-out forwards;
}

.kr-map-label-hotspot:hover .kr-label-text {
    background: #114b91;
    color: #ffffff;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

/* --- CHARACTERS GRID (ENCYCLOPEDIA VIEW) --- */
.kr-grid-section {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 22px;
    margin-top: 25px;
}

.kr-char-card {
    background: var(--kr-card-bg);
    border: 1px solid var(--kr-border);
    border-radius: 24px;
    box-shadow: var(--kr-shadow);
    backdrop-filter: blur(16px);
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.kr-char-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 24px 50px rgba(39, 74, 129, 0.2);
    border-color: var(--kr-orange);
}

.kr-char-img-wrapper {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.9), rgba(255, 240, 230, 0.5));
    border: 4px solid #fff;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
    overflow: hidden;
}

.kr-char-img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.1));
    transition: transform 0.3s ease;
}

.kr-char-card:hover .kr-char-img {
    transform: scale(1.1);
}

.kr-char-name {
    margin: 0 0 6px;
    font-size: 20px;
    font-weight: 900;
    color: var(--kr-dark);
}

.kr-char-location {
    font-size: 13px;
    font-weight: 800;
    color: var(--kr-orange);
    background: rgba(255, 140, 66, 0.1);
    padding: 4px 12px;
    border-radius: 999px;
    display: inline-block;
}

/* --- MODAL DIALOG --- */
.kr-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(6, 48, 95, 0.6);
    backdrop-filter: blur(8px);
    z-index: 110000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.kr-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.kr-modal-card {
    background: linear-gradient(145deg, #ffffff, #fafdff);
    border-radius: 36px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.3);
    max-width: 650px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 35px;
    position: relative;
    transform: scale(0.9) translateY(20px);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.kr-modal-overlay.active .kr-modal-card {
    animation: kr-modal-bounce 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes kr-modal-bounce {
    0% { transform: scale(0.3) translateY(60px); opacity: 0; }
    50% { transform: scale(1.05) translateY(-10px); opacity: 1; }
    75% { transform: scale(0.96) translateY(5px); }
    100% { transform: scale(1) translateY(0); opacity: 1; }
}

.kr-modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    border: none;
    background: rgba(0, 0, 0, 0.06);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 20px;
    font-weight: 900;
    color: var(--kr-dark);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.kr-modal-close:hover {
    background: var(--kr-orange);
    color: #fff;
}

.kr-modal-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.kr-modal-img {
    max-width: 220px;
    max-height: 220px;
    object-fit: contain;
    filter: drop-shadow(0 15px 25px rgba(0, 0, 0, 0.15));
    margin-bottom: 20px;
}

.kr-modal-title {
    font-size: 32px;
    font-weight: 900;
    color: var(--kr-dark);
    margin: 0 0 8px;
}

.kr-modal-tag {
    font-size: 15px;
    font-weight: 800;
    color: #fff;
    background: linear-gradient(135deg, var(--kr-orange), var(--kr-pink));
    padding: 6px 18px;
    border-radius: 999px;
    margin-bottom: 20px;
    display: inline-block;
    box-shadow: 0 6px 16px rgba(255, 140, 66, 0.3);
}

.kr-modal-desc {
    font-size: 17px;
    line-height: 1.6;
    color: #4f637c;
    font-weight: 700;
    margin-bottom: 24px;
}

.kr-modal-details {
    width: 100%;
    background: rgba(238, 247, 255, 0.6);
    border-radius: 20px;
    padding: 20px;
    text-align: left;
    margin-bottom: 25px;
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.kr-modal-detail-item {
    margin-bottom: 10px;
    font-size: 15px;
    line-height: 1.5;
}

.kr-modal-detail-item:last-child {
    margin-bottom: 0;
}

.kr-modal-detail-label {
    font-weight: 900;
    color: var(--kr-dark);
}

.kr-modal-action-btn {
    border: none;
    background: linear-gradient(135deg, var(--kr-dark), #0b53a5);
    color: #fff;
    padding: 14px 32px;
    border-radius: 999px;
    font-size: 16px;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(6, 48, 95, 0.25);
    transition: all 0.25s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.kr-modal-action-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 32px rgba(6, 48, 95, 0.35);
    background: linear-gradient(135deg, var(--kr-orange), #ff6f4b);
}

/* RESPONSIVE BREAKPOINTS */
@media (max-width: 900px) {
    /* ENABLE NATIVE PANNING ON MOBILE / TABLET */
    .kr-map-viewport {
        overflow: auto;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-x pan-y;
    }
    .kr-map-content {
        width: 1400px;
        height: auto;
        aspect-ratio: 16 / 9;
        position: relative !important;
        transform: none !important;
        transition: none !important;
    }
}

.kr-mobile-map-hint {
    display: none;
}

@media (max-width: 900px) {
    .kr-mobile-map-hint {
        display: block;
        position: absolute;
        bottom: 15px;
        right: 15px;
        pointer-events: none;
        z-index: 100;
        animation: pulseHint 1.8s infinite alternate ease-in-out;
    }
    .kr-map-hint-img {
        width: 80px;
        height: auto;
        filter: drop-shadow(0 4px 10px rgba(0,0,0,0.25));
    }
}

@keyframes pulseHint {
    0% { transform: scale(0.85); opacity: 0.3; }
    100% { transform: scale(1.05); opacity: 1; }
}

@media (max-width: 768px) {
    .kr-swiat-hero {
        padding: 24px 20px;
    }
    .kr-map-section {
        height: 65vh;
        min-height: 550px;
    }
    .kr-grid-section {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 14px;
    }
    .kr-char-img-wrapper {
        width: 100px;
        height: 100px;
    }
    .kr-char-name {
        font-size: 17px;
    }
}
