:root {
    --sidebar-width: 260px;
    --gold-color: #feca57;
    --blue-glow: #48dbfb;
    --red-glow: #ff6b6b;
}

body, html {
    margin: 0;
    background-color: #1a1a2e;
    font-family: 'Poppins', sans-serif;
    overflow-x: hidden;
    color: #E5E5E5;
}

body.modal-open, body.mobile-nav-open {
    overflow: hidden;
}

main {
    padding-left: var(--sidebar-width);
    background-image: url('https://cyferlandia.pl/cyferlandia_background.jpg');
    background-attachment: fixed;
    background-position: center;
    background-size: cover;
    position: relative;
    min-height: 100vh;
}

.main-overlay {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(26, 26, 46, 0.85);
    backdrop-filter: blur(5px);
    z-index: 1;
}

.page-content {
    position: relative;
    z-index: 2;
    padding: 4rem 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

/* --- Przycisk menu mobilnego --- */
.mobile-menu-trigger {
    display: none;
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1001;
    padding: 10px 25px;
    background: rgba(26, 26, 46, 0.8);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(254, 202, 87, 0.6);
    border-radius: 50px;
    color: white;
    font-family: 'Poppins', sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    letter-spacing: 3px;
    cursor: pointer;
    animation: gold-glow 4s ease-in-out infinite;
    transition: background-color 0.3s;
}
.mobile-menu-trigger:hover {
    background: rgba(40, 40, 60, 0.9);
}

/* --- Boczny panel nawigacji --- */
.side-panel {
    position: fixed; top: 0; left: 0;
    width: var(--sidebar-width); height: 100vh;
    display: flex; flex-direction: column; align-items: center;
    padding: 2rem 0; background: #19192e;
    z-index: 1002;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 5px 0 25px rgba(0,0,0,0.3);
    transition: transform 0.4s ease-in-out;
}
.panel-logo {
    font-family: 'Bangers', cursive; font-size: 2.5rem; color: white;
    text-decoration: none; letter-spacing: 2px; margin-bottom: 3rem;
    text-shadow: 0 0 10px var(--gold-color);
}
.panel-nav { width: 100%; }
.panel-nav a {
    display: flex; align-items: center; gap: 1rem; color: #e0e0e0;
    text-decoration: none; font-family: 'Dancing Script', cursive;
    font-weight: 700; padding: 1.2rem 2.5rem;
    transition: all 0.3s ease; font-size: 1.8rem;
    text-shadow: 0 0 8px rgba(254, 202, 87, 0.5);
}
.panel-nav a:hover, .panel-nav a.active {
    color: white; background-color: rgba(254, 202, 87, 0.1);
    text-shadow: 0 0 15px var(--gold-color);
}
.panel-nav i { width: 20px; text-align: center; color: var(--gold-color); }

/* --- Nagłówek i sekcje --- */
.page-header { text-align: center; margin-bottom: 4rem; }
.page-title {
    font-family: 'Bangers', cursive; font-size: clamp(3rem, 8vw, 5rem);
    letter-spacing: 3px; background-size: 400% 400%;
    background: linear-gradient(270deg, #ff6b6b, var(--gold-color), var(--blue-glow), #5f27cd, #ff6b6b);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    animation: rainbow-flow 8s ease-in-out infinite;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.5); margin: 0;
}
.section-title {
    font-family: 'Bangers', cursive; font-size: 3rem;
    text-align: center; margin: 3rem 0; letter-spacing: 2px;
}
.heroes .section-title { color: var(--blue-glow); text-shadow: 0 0 15px var(--blue-glow); }
.villains .section-title { color: var(--red-glow); text-shadow: 0 0 15px var(--red-glow); }

/* --- Karty postaci --- */
.characters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
}
.character-card {
    background: rgba(25, 25, 46, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 15px; padding: 1.5rem; text-align: center;
    backdrop-filter: blur(10px); box-shadow: 0 8px 32px rgba(0,0,0,0.37);
    transition: all 0.3s ease;
}
.character-card:hover { transform: translateY(-10px); }
.heroes .character-card:hover { box-shadow: 0 0 25px var(--blue-glow); }
.villains .character-card:hover { box-shadow: 0 0 25px var(--red-glow); }

.character-image-wrapper {
    height: 250px; margin-bottom: 1rem;
    display: flex; justify-content: center; align-items: center;
}
.character-image-wrapper video, .character-image-wrapper img {
    max-height: 100%; max-width: 100%;
    object-fit: contain;
    filter: drop-shadow(0 5px 15px rgba(0,0,0,0.5));
}
.character-name {
    font-family: 'Bangers', cursive; font-size: 2.2rem;
    color: #fff; letter-spacing: 1px; margin: 0;
}
.character-tagline {
    font-family: 'Dancing Script', cursive; font-size: 1.3rem;
    color: var(--gold-color); margin-top: 0.25rem; min-height: 40px;
}
.details-button {
    margin-top: 1rem; padding: 0.75rem 1.5rem; background: var(--gold-color);
    color: #1a1a2e; font-family: 'Bangers', cursive; letter-spacing: 1px;
    font-size: 1.2rem; border: none; border-radius: 20px; cursor: pointer;
    transition: all 0.3s ease;
}
.details-button:hover, .details-button:focus { background: #fff; transform: scale(1.05); outline: none; }

/* --- Okno Modalne --- */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.8); backdrop-filter: blur(8px);
    z-index: 2000; display: flex; justify-content: center; align-items: center;
    opacity: 0; transition: opacity 0.3s ease; pointer-events: none;
}
.modal-overlay.visible { opacity: 1; pointer-events: all; }
.modal-content {
    background: #1a1a2e; border: 2px solid var(--gold-color);
    border-radius: 20px; padding: 2rem; width: 90%; max-width: 900px;
    max-height: 90vh; overflow-y: auto; position: relative;
    box-shadow: 0 0 40px var(--gold-color);
    transform: scale(0.9); transition: transform 0.3s ease;
}
.modal-overlay.visible .modal-content { transform: scale(1); }

/* ### ZMIANY W PRZYCISKU ZAMYKANIA ### */
.modal-close-btn {
    position: sticky;
    top: -10px;
    /* Przesunięcie na prawo */
    margin-left: auto; 
    right: -10px;
    
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid var(--gold-color);
    color: white;
    font-size: 2.5rem;
    font-weight: bold;
    cursor: pointer;
    z-index: 10;
    transition: background-color 0.3s ease, color 0.3s ease;
    
    display: flex;
    justify-content: center;
    align-items: center;
    padding-bottom: 5px;

    /* Nowa, podwójna animacja */
    animation: 
        pulsing-gold-glow 2.5s ease-in-out infinite,
        gentle-scale 4s ease-in-out infinite;
}
.modal-close-btn:hover {
    background: white;
    color: black;
    animation-play-state: paused; /* Zatrzymujemy animacje po najechaniu */
}

.modal-body { display: flex; gap: 2rem; margin-top: -50px; }
.modal-image-container { flex-shrink: 0; width: 300px; }
.modal-image-container video, .modal-image-container img { width: 100%; }
.modal-title { font-family: 'Bangers', cursive; font-size: 3rem; color: var(--gold-color); }
.modal-text p { font-size: 1.1rem; line-height: 1.7; color: #e0e0e0; }
.modal-text strong { color: var(--blue-glow); }

/* --- Animacje --- */
@keyframes gold-glow { 0%,100%{box-shadow:0 0 4px rgba(254,202,87,0.5),0 0 8px rgba(254,202,87,0.4)}50%{box-shadow:0 0 8px rgba(254,202,87,0.8),0 0 16px rgba(254,202,87,0.8)} }
@keyframes rainbow-flow { 0%{background-position:0% 50%}50%{background-position:100% 50%}100%{background-position:0% 50%} }

@keyframes pulsing-gold-glow {
    0%, 100% { box-shadow: 0 0 8px var(--gold-color), 0 0 12px var(--gold-color); }
    50% { box-shadow: 0 0 16px var(--gold-color), 0 0 24px var(--gold-color); }
}

/* ### ZMIANA: Nowa animacja powiększania ### */
@keyframes gentle-scale {
    0%, 100% { transform: scale(1.0); }
    50% { transform: scale(1.1); }
}


/* --- Media Queries --- */
@media (max-width: 1024px) { 
    main { padding-left: 0; }
    .mobile-menu-trigger { display: block; }
    
    .side-panel {
        transform: translateY(-100%); top: 0; bottom: auto; width: 100vw; height: auto;
        border-right: none; border-bottom: 2px solid rgba(255, 255, 255, 0.1);
        box-shadow: 0 5px 25px rgba(0,0,0,0.3);
        padding-top: 1.5rem; padding-bottom: 2rem;
    }
    .side-panel.is-open { transform: translateY(0); }
}
@media (max-width: 768px) {
    .page-content { padding: 2rem 1rem; }
    .modal-body { flex-direction: column; }
    .modal-image-container { width: 200px; margin: 0 auto; }
}