/* ----------------- Fonts ----------------- */
@font-face {
    font-family: 'Manaspace';
    src: url('fonts/manaspace.ttf') format('truetype');
}

/* ----------------- Body & Background ----------------- */
body {
    margin: 0;
    padding: 20px;
    min-height: 100vh;
    font-family: 'Manaspace', Arial, sans-serif;
    color: #ffffff;
    text-align: center;
    background-color: #0c141f;
    overflow-x: hidden;
}

body::before, body::after {
    display: none; 
}

/* ----------------- Global pixel shadow ----------------- */
body,
body * {
    text-shadow: 1.5px 1.5px 0 rgba(0,0,0,0.55);
   color: #ffffff !important;

}

h1, h2, p {
    color: #ffffff !important;
}

/* =================== 9-SLICE SYSTEM ====================== */


.panel-9slice {
    position: relative;
    z-index: 10;
    padding: 16px;
}

.panel-9slice::before {
    content: "";
    position: absolute;
    inset: 0;

    border: 16px solid transparent;
    border-image-source: url("images/ui/9slice-panel.png");
    border-image-slice: 16 fill;
    border-image-repeat: repeat;

    background-color: rgba(40, 28, 55, 0.94);
    image-rendering: pixelated;

    box-shadow: 0 4px 12px rgba(0,0,0,0.3);

    z-index: 0;
    pointer-events: none;
}

.panel-9slice::after {
    content: "";
    position: absolute;
    inset: 0;

    background: radial-gradient(
        ellipse at center,
        rgba(0,0,0,0.0) 0%,
        rgba(0,0,0,0.08) 55%,
        rgba(0,0,0,0.18) 100%
    );

    z-index: 0;
    pointer-events: none;
}

.panel-9slice > * {
    position: relative;
    z-index: 1;
}

/* ----------------- Containers ----------------- */
.container {
    max-width: 820px;
    margin: 0 auto;
    padding: 32px;
    position: relative;
    z-index: 10;
}


/* ----------------- Headers & Text ----------------- */
h1 {
    color: #fff4dc;
    text-shadow: none;
}

h2,
p {
    color: #f4e9dc;
}

/* ----------------- Hub intro & navigation ----------------- */
.hub-intro {
    margin-top: 10px;
    font-size: 1.1em;
    color: #ffffff !important;
}

.hub-links {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 25px;
    flex-wrap: wrap;
}

/* ----------------- Buttons ----------------- */
.hub-button {
    display: inline-block;
    padding: 10px 18px;

    font-weight: bold;
    color: #3a1f14;
    cursor: pointer;
    user-select: none;

    background-color: #f2c27b;
    border-radius: 2px;

    box-shadow:
        0 4px 0 #366753,
        0 6px 10px rgba(0,0,0,0.35),
        inset 0 1px 0 rgba(255,255,255,0.4);

    transition:
        transform 0.08s ease,
        box-shadow 0.08s ease,
        filter 0.15s ease;
}

.hub-button:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
}

.hub-button:active {
    transform: translateY(3px);
    filter: brightness(0.95);

    box-shadow:
        0 1px 0 #366753,
        0 3px 6px rgba(0,0,0,0.3),
        inset 0 2px 4px rgba(0,0,0,0.25);
}

.hub-button:focus-visible {
    outline: 2px solid #ffb36a;
    outline-offset: 3px;
}

/* ----------------- Levels (data generated :3) ----------------- */
.level {
    margin-bottom: 16px;
}

/* ----------------- Player List Rows as Buttons ----------------- */
.level-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;

    cursor: pointer;
    user-select: none;
    font-weight: bold;
    color: #baffc1;
    text-shadow: 1px 1px 0 #000;


    background-color: #a7e0ad;
    border-radius: 2px;
    border: 2px solid #6c9270;


    background-repeat: repeat;
    background-size: 16px 16px;


    box-shadow:
        0 3px 0 #366753,
        0 4px 6px rgba(0,0,0,0.25),
        inset 0 1px 0 rgba(255,255,255,0.3);

    transition:
        transform 0.08s ease,
        box-shadow 0.08s ease,
        filter 0.15s ease;
}

.level-summary:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
}

.level-summary:active {
    transform: translateY(2px);
    filter: brightness(0.95);

    box-shadow:
        0 1px 0 #366753,
        0 2px 4px rgba(0,0,0,0.3),
        inset 0 1px 2px rgba(0,0,0,0.25);
}

.level-summary:focus-visible {
    outline: 2px solid #ffb36a;
    outline-offset: 2px;
}


.level + .level {
    margin-top: 6px;
}

.level-summary::after {
    content: "";
    position: absolute;
    left: 10px;
    right: 10px;
    bottom: -2px;
    height: 3px;

    background: linear-gradient(
        to right,
        rgba(0,0,0,0),
        #6e4a2f 20%,
        #e6caa8 50%,
        #6e4a2f 80%,
        rgba(0,0,0,0)
    );

    box-shadow: 0 1px 0 rgba(0,0,0,0.6);
    pointer-events: none;
}

.level-details {
    padding: 10px 12px;
    margin-top: 6px;

    background-color: rgba(20, 14, 30, 0.6);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
}

/* ----------------- Footer ----------------- */
.site-footer {
    margin-top: 40px;
    color: #e6caa8;
    position: relative;
    z-index: 10;
}
/* ----------------- ULB Background System ----------------- */
.background-stage {
    position: fixed;
    inset: 0;
    z-index: -10;
    pointer-events: none;
    overflow: hidden;
    background-color: #0c141f;
}

.sky-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url("images/banner.png") repeat;
    background-size: 128px 128px; 
    image-rendering: pixelated;
    z-index: 1;
}

.sunset-mask {
    position: absolute;
    bottom: 0px; 
    left: 0;
    width: 200%;
    height: 256px;
    background: url("images/decor/sunset.png") repeat-x bottom;
    background-size: auto 100%;
    image-rendering: pixelated;
    z-index: 2;
}

.sunset-decor.back {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 200%; 
    height: 256px;
    background: url("images/decor/mountains.png") repeat-x bottom;
    background-size: auto 100%;
    image-rendering: pixelated;
    z-index: 3;
    animation: parallax-back 80s linear infinite;
}

.sunset-decor.front {
    position: absolute;
    bottom: 0px;
    left: 0;
    width: 200%;
    height: 256px; 
    background: url("images/decor/tree.png") repeat-x bottom;
    background-size: auto 100%;
    image-rendering: pixelated;
    z-index: 4;
    animation: parallax-front 45s linear infinite;
}

/* ----------------- Recent Changes scrollable ----------------- */
#recent-changes-container {
    max-height: 400px;
    display: flex;
    flex-direction: column;
}

#recent-changes {
    flex: 1;
    overflow-y: auto;
    padding-right: 6px;
}


#recent-changes::-webkit-scrollbar {
    width: 8px;
}

#recent-changes::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.2);
}

#recent-changes::-webkit-scrollbar-thumb {
    background: #6e4a2f;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.2);
}

#player-history {
    height: auto;
    overflow-y: visible;
    padding: 6px 8px;
}
/* ----------------- Search & Filters --- -------------- */
#search {
    display: block;
    width: 90%;
    max-width: 400px;
    margin: 25px auto 12px auto !important;
    padding: 8px 10px;
    box-sizing: border-box;
    
    font-family: 'Manaspace', Manaspace;
    font-size: 1em;
    border: 2px solid #6c9270;
    border-radius: 2px;
    background-color: #a7e0ad;
    color: #3a1f14;
    outline: none;
}

.filters {
    display: flex;
    justify-content: center;
    gap: 10px; 
    flex-wrap: wrap;
    margin-bottom: 20px; 
}

.filters select,
.filters button {
    padding: 6px 10px;
    font-family: 'Manaspace', Manaspace;
    font-size: 0.95em;
    border: 2px solid #6c9270;
    border-radius: 2px;
    background-color: #a7e0ad;
    color: #ffffff !important;
    cursor: pointer;
    box-shadow: 0 3px 0 #366753, 0 4px 6px rgba(0,0,0,0.25), inset 0 1px 0 rgba(255,255,255,0.3);
    transition: transform 0.08s ease, box-shadow 0.08s ease, filter 0.15s ease;
}

.filters select:hover,
.filters button:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
}

.filters select:active,
.filters button:active {
    transform: translateY(2px);
    filter: brightness(0.95);
    box-shadow: 0 1px 0 #366753, 0 2px 4px rgba(0,0,0,0.3), inset 0 1px 2px rgba(0,0,0,0.25);
}

#player-search {
    display: block;
    width: 100%;
    max-width: 400px;
    margin: 25px auto 12px auto;
    padding: 8px 10px;
    font-family: 'Manaspace', Manaspace;
    font-size: 1em;
    border: 2px solid #6c9270;
    border-radius: 2px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.2);
    background-color: #a7e0ad;
    color: #3a1f14;
    outline: none;
    box-sizing: border-box;
}



@keyframes parallax-back {
    from { background-position-x: 0; }
    to   { background-position-x: -512px; }
}

@keyframes parallax-front {
    from { background-position-x: 0; }
    to   { background-position-x: -1024px; }
}

/* ----------------- Mobile ----------------- */
@media (max-width: 700px) {
    .hub-links {
        gap: 10px;
    }

    .sunset-decor {
        height: 260px;
    }
}

#player-total-klp {
  display: block;
  width: 100%;
  text-align: center;
  margin: 15px 0;
  font-size: 1.1em;
  font-weight: bold;
  color: #ffffff
}



#total-klp {
  display: block;
  width: 100%;
  text-align: center;
  margin: 15px 0;
  font-size: 1.1em;
  font-weight: bold;
  color: #ffffff
}


/* ----------------- Mobile Overflow stuff  ----------------- */
@media (max-width: 700px) {
    body {
        overflow-x: hidden; 
    }

    .sunset-decor,
    .sunset-mask {
        width: 100%;      
        max-width: 100%;
        left: 0;
    }

    .container {
        padding: 16px;
    }


    .player-container > div,
    .level-summary {
        min-width: 0;
    }
}

.update-announcement {
    position: relative;
    z-index: 1;
    color: #ffffff;
    font-size: 0.95em;
    text-align: left;
    padding: 12px;
    margin: 20px 0;
    height: auto; 
    overflow-y: visible; 
}

.update-announcement ul {
    padding-left: 20px;
    margin: 6px 0;
}

.update-announcement li {
    margin-bottom: 4px;
}

.update-announcement strong {
    color: #ffdd99;
}




@media (max-width: 700px) {
    .update-announcement {
        font-size: 0.9em;
        padding: 10px;
        max-height: 250px;   
        overflow-y: auto; 
        overflow-x: hidden; 
        box-sizing: border-box; 
    }

    .update-announcement ul {
        padding-left: 16px;      
    }
}


img.logo {
    display: block;
    margin: 20px auto;     
    width: 360px;          
    max-width: 80%;       
    height: auto;           
    image-rendering: pixelated;
    transition: transform 0.3s ease, width 0.3s ease;
    position: relative;
    z-index: 10;
}

img.logo:hover {
    transform: scale(1.03) rotate(-6.7deg);
}

@media (max-width: 500px) {
    img.logo {
        width: 240px;
    }
}

/* ----------------- Level Details Header ----------------- */

#title-row {
    display: flex;
    justify-content: space-between; 
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
    width: 100%;
    flex-wrap: wrap; 
}

#title-left {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

#badges-container-right {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    width: auto; 
    max-width: 100%; 
    overflow: visible;
    perspective: 1000px; 
}

@media (max-width: 600px) {
    #title-row {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    #badges-container-right {
        justify-content: center;
        margin-top: 10px;
    }

    .badge-hitbox {
        width: clamp(35px, 10vw, 50px);
        height: clamp(35px, 10vw, 50px);
    }
}

#badge-row {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: flex-start; 
    align-items: center;
    gap: 0;
    max-width: 100%;
    margin-top: 10px;
    perspective: 1000px;
}

.badge {
    cursor: pointer;
    width: clamp(40px, 8vw, 64px); 
    height: clamp(40px, 8vw, 64px);
    
    image-rendering: pixelated;
    flex-shrink: 0;
    position: relative;
    transition: transform 0.2s ease-out, filter 0.15s ease;
    filter: drop-shadow(2px 2px 0px rgba(0,0,0,0.6));
}   


/* ----------------- BADGES SIZE STUFF SHENANIGANS ----------------- */

.badge, #series-badge img {
    cursor: pointer;
    transition: transform 0.2s ease-out, margin 0.15s ease, filter 0.15s ease;
    image-rendering: pixelated;


    flex-shrink: 0; 
    
    filter: drop-shadow(2px 2px 0px rgba(0,0,0,0.6));
    position: relative;
    transform-style: preserve-3d;
    will-change: transform;
    
    margin-left: 0; 
    transition: transform 0.2s ease-out, filter 0.15s ease, z-index 0s;
}


.badge:hover, #series-badge img:hover {
    z-index: 1000 !important; 
    filter: brightness(1.1) drop-shadow(0 8px 15px rgba(0,0,0,0.8));
}

#series-badge img {
    z-index: 1001; 
    margin-left: 5px; 
}
 */

#series-badge img {
    width: 60px;
    height: 60px;
}

.badge.badge-special {

    width: clamp(55px, 10vw, 85px); 
    height: clamp(55px, 10vw, 85px);
    

    z-index: 5; 
    

    filter: drop-shadow(2px 2px 0px rgba(0,0,0,0.7)) brightness(1.05);
}

#series-badge img {
    width: 60px;
    height: 60px;
    z-index: 1001;
    margin-left: 10px; 
}
*/

/* ----------------- MODALS  ----------------- */

.badge-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    z-index: 999999999999999999999999999999999999;
}

.badge-modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    
    background: #1a1a1a;
    padding: 30px;
    border: 4px solid #f2c27b;
    border-radius: 8px;
    text-align: center;
    width: 90%;
    max-width: 320px;
    box-shadow: 0 0 40px rgba(0,0,0,1);
    box-sizing: border-box;
        z-index: 999999999999999999999999999999999999;
}

.hidden {
    display: none !important;
}


.badge-modal-content img {
    width: 100px; 
    height: 100px;
    margin-bottom: 15px;
    image-rendering: pixelated;
}
.badge-hitbox {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: clamp(40px, 8vw, 64px); 
    height: clamp(40px, 8vw, 64px);
    flex-shrink: 0;
    z-index: 1;
}

.badge-hitbox:has(.badge-special) {
    width: clamp(55px, 10vw, 85px);
    height: clamp(55px, 10vw, 85px);
    z-index: 5;
}


.badge {
    pointer-events: none; 
    width: 100%;
    height: 100%;
    transition: transform 0.2s ease-out;
}


.badge-hitbox:hover .badge {
    transform: scale(1.2) translateY(-10px);
    z-index: 100;
}

.badge-hitbox:hover {
    z-index: 1000 !important;
}

.summary-right {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.mini-badge-list {
  display: flex;
  align-items: center;
  flex-direction: row;
  max-width: 150px; 
  justify-content: flex-end;
  margin-right: 8px;
}

.mini-badge {
  width: 24px;
  height: 24px;
  image-rendering: pixelated;
  filter: drop-shadow(1px 1px 0px rgba(0,0,0,0.6));
  flex-shrink: 0;
  position: relative;
  transition: transform 0.1s ease;
}

.mini-badge:hover {
  transform: scale(1.5);
  z-index: 100 !important;
}


.level-summary:hover .mini-badge {
  z-index: 2;
}


.level-link-wrapper {
    text-decoration: none !important;
    color: inherit !important;
    display: block;
    margin-bottom: 10px; 
}

.main-stats-grid {
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 10px 0;
    flex-wrap: wrap;
    gap: 20px;
}

.secondary-stats-grid {
    display: flex;
    gap: 20px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.mini-panel {
    flex: 1;
    min-width: 250px;
}

.stat-block {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-label {
    font-size: 0.9em;
    color: #e6caa8;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-huge {
    font-size: 2.5em;
    line-height: 1.2;
    text-shadow: 2px 2px 0 #000;
}

.stat-large {
    font-size: 1.8em;
    display: block;
    color: #ffffff;
    margin: 10px 0;
}

.stat-delta {
    font-size: 1em;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(0,0,0,0.5);
}

.delta-positive { color: #baffc1; }
.delta-neutral { color: #aaaaaa; }

.curve-list {
    list-style: none;
    padding: 0;
    margin: 10px 0 0 0;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 8px;
    color: #f4e9dc;
}

.curve-list strong { color: #a7e0ad; float: right; }


.rpg-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    text-align: left;
    font-size: 0.95em;
}

.rpg-table th {
    color: #f2c27b;
    border-bottom: 2px solid #6c9270;
    padding: 8px;
}

.rpg-table td {
    padding: 8px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.simulated-row {
    background-color: rgba(242, 194, 123, 0.15);
    color: #f2c27b !important;
    font-weight: bold;
    border-left: 4px solid #f2c27b;
}

/* --- Recent Changes & Timeline Overhaul --- */
.update-summary {
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px dashed rgba(255, 255, 255, 0.2);
}
.update-summary p { margin: 0 0 5px 0; color: #f2c27b; font-weight: bold; }
.update-summary ul { margin: 0; padding-left: 20px; color: #e6caa8; font-size: 0.9em; }

.change-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px;
    margin-bottom: 6px;
    background: rgba(0, 0, 0, 0.3);
    border-left: 4px solid #6c9270;
    border-radius: 2px;
}
.change-item.is-new { border-left-color: #f2c27b; }
.change-item.is-buff { border-left-color: #baffc1; }
.change-item.is-nerf { border-left-color: #ff6a6a; }

.change-tag {
    font-size: 0.7em;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 4px;
    margin-right: 8px;
    text-transform: uppercase;
    color: #140e1e;
}
.tag-new { background: #f2c27b; }
.tag-buff { background: #baffc1; }
.tag-nerf { background: #ff6a6a; }

.change-details { flex-grow: 1; color: #fff; }
.change-numbers { font-family: Manaspace; font-size: 0.9em; text-align: right;}

.timeline-event {
    display: flex;
    flex-direction: column;
    padding: 10px;
    margin-bottom: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-left: 3px solid #a7e0ad;
    border-radius: 2px;
}
.timeline-date { font-size: 0.8em; color: #f2c27b; margin-bottom: 4px; font-weight: bold; }
.timeline-desc { font-size: 0.95em; color: #fff; }
.settings-menu {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    z-index: 10000;
}

.lang-switcher {
    display: flex;
    gap: 8px;
}

.lang-switcher button, 
#theme-toggle {
    width: 40px;
    height: 28px;
    cursor: pointer;
    border: 2px solid #000;
    background-color: transparent;
    background-size: cover;
    background-position: center;
    image-rendering: pixelated;
    transition: transform 0.1s;
    padding: 0;
    display: block; 
}

#flag-en { background-image: url('images/icon/flag_usa.png'); }
#flag-es { background-image: url('images/icon/flag_spain.png'); }

#theme-icon {
    display: block;
    width: 100%;
    height: 100%;
    background-image: url('images/icon/space_icon.png');
    background-size: cover;
    image-rendering: pixelated;
}

body.dark-mode #theme-icon {
    background-image: url('images/icon/mountain_icon.png');
}

.lang-switcher button:hover, 
#theme-toggle:hover {
    transform: scale(1.1);
}

.lang-switcher button.inactive {
    filter: grayscale(100%) opacity(0.5);
}
/* DARK MODE SYSTEM (SPACE THEME) */

#theme-toggle {
    width: 32px;
    height: 28px;
    background-color: rgba(0, 0, 0, 0.5);
    border: 2px solid #000;
    cursor: pointer;
    color: white;
    font-size: 14px;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.1s, background-color 0.2s;
}

#theme-toggle:hover {
    transform: scale(1.1);
    background-color: rgba(0, 0, 0, 0.8);
}

body.dark-mode .sky-layer {
    background: url("images/dark_banner.png") repeat;
    background-size: 128px 128px;
}

body.dark-mode .sunset-mask,
body.dark-mode .sunset-decor.front {
    display: none;
}

body.dark-mode .sunset-decor.back {
    background: url("images/decor/planets.png") repeat;
    background-size: 1536px 1536px;
    
    top: 0;
    height: 100vh;
    width: 200vw; 
    
    animation: parallax-planets 90s linear infinite;
    opacity: 0.9;
}

body.dark-mode .panel-9slice::before {
    border-image-source: url("images/ui/dark_9slice-panel.png");
    background-color: rgba(15, 15, 20, 0.95); 
}

body.dark-mode .level-summary,
body.dark-mode #search,
body.dark-mode #player-search,
body.dark-mode .filters select,
body.dark-mode .filters button {
    background-color: #2b3a30; 
    border-color: #4a634d;
    color: #ffffff !important;
    box-shadow: 0 3px 0 #1b261e, 0 4px 6px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.1);
}

@keyframes parallax-planets {
    from { background-position: 0 0; }
    to   { background-position: -3072px -1536px; }
}