body {
    /*background: #ebe7d8;*/
    margin: 0;
    text-align: center;
    font-family: "carolingia", "Times New Roman", Times, serif;
    font-size: 20px;
    overflow: hidden;
}

:root {
    --jagged-edges: polygon(3% 0, 7% 1%, 11% 0%, 16% 2%, 20% 0, 23% 2%, 28% 2%, 32% 1%, 35% 1%, 39% 3%, 41% 1%, 45% 0%, 47% 2%, 50% 2%, 53% 0, 58% 2%, 60% 2%, 63% 1%, 65% 0%, 67% 2%, 69% 2%, 73% 1%, 76% 1%, 79% 0, 82% 1%, 85% 0, 87% 1%, 89% 0, 92% 1%, 96% 0, 98% 3%, 99% 3%, 99% 6%, 100% 11%, 98% 15%, 100% 21%, 99% 28%, 100% 32%, 99% 35%, 99% 40%, 100% 43%, 99% 48%, 100% 53%, 100% 57%, 99% 60%, 100% 64%, 100% 68%, 99% 72%, 100% 75%, 100% 79%, 99% 83%, 100% 86%, 100% 90%, 99% 94%, 99% 98%, 95% 99%, 92% 99%, 89% 100%, 86% 99%, 83% 100%, 77% 99%, 72% 100%, 66% 98%, 62% 100%, 59% 99%, 54% 99%, 49% 100%, 46% 98%, 43% 100%, 40% 98%, 38% 100%, 35% 99%, 31% 100%, 28% 99%, 25% 99%, 22% 100%, 19% 99%, 16% 100%, 13% 99%, 10% 99%, 7% 100%, 4% 99%, 2% 97%, 1% 97%, 0% 94%, 1% 89%, 0% 84%, 1% 81%, 0 76%, 0 71%, 1% 66%, 0% 64%, 0% 61%, 0% 59%, 1% 54%, 0% 49%, 1% 45%, 0% 40%, 1% 37%, 0% 34%, 1% 29%, 0% 23%, 2% 20%, 1% 17%, 1% 13%, 0 10%, 1% 6%, 1% 3%);
}

/* Hide on mobile */
@media (max-width: 760px), (pointer: coarse) {
    #info {
        position: absolute;
        padding: 0;
        margin: 0;
        top: 0px;
        width: 20px;

        background: url("images/altimeline.png") no-repeat center center;
        background-size: contain;

        color: transparent;
        text-indent: -9999px;
        overflow: hidden;
    }
    #mapButton {
        display: none;
    }
    #popup {
        aspect-ratio: 5 / 7;
    }
}
/*---------------*/

#info {
    position: absolute;
    font-family: "Times";
    top: 20px;
    left: 20px;
    padding: 15px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 100;
}
#info h2 {
    margin: 0 0 10px 0;
    font-size: 18px;
}
#error {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #ff6b6b;
    background: rgba(0, 0, 0, 0.9);
    padding: 30px;
    border-radius: 12px;
    text-align: center;
    display: none;
    z-index: 200;
}

/* Map */

#box {
    filter: drop-shadow(0px 10px 5px rgba(0, 0, 0, 0.25))
}

#testcolors {
    color: rgb(45, 144, 85);
}

canvas {
    display: block;
    margin: 1em auto;
    /*background: #fff; */
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.9);
}

#buffer {
    display: none;
}

#buffer {
    display: none;
}

#loading {
    display: none;
    place-items: center;
    margin: 1px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    background: rgba(0, 0, 0, 0.75);
    padding: 8px;
    border-radius: 100%;
    text-align: center;
    z-index: 200;
}

@font-face {
    font-family: "carolingia";
    src: url("carolingia.ttf") format("truetype");
}

@keyframes pulsate {
    0% {
        text-shadow: -1px -1px 2px rgba(0, 0, 0, 0.5), 1px -1px 2px rgba(0, 0, 0, 0.5), -1px 1px 2px rgba(0, 0, 0, 0.5), 1px 1px 2px rgba(0, 0, 0, 0.5);
    }

    50% {
        text-shadow: -1px -1px 2px rgba(0, 0, 0, 1), 1px -1px 2px rgba(0, 0, 0, 1), -1px 1px 2px rgba(0, 0, 0, 1), 1px 1px 2px rgba(0, 0, 0, 1);
    }

    100% {
        text-shadow: -1px -1px 2px rgba(0, 0, 0, 0.5), 1px -1px 2px rgba(0, 0, 0, 0.5), -1px 1px 2px rgba(0, 0, 0, 0.5), 1px 1px 2px rgba(0, 0, 0, 0.5);
    }
}

input[type="range"] {
    z-index: 2;
    width: 90%;
    margin: 10px;
    position: relative;
}



/* Timeline */

.range {
    position: relative;
    padding: 5px;
    width: 90%;
    margin: 0 auto;
}

#timeline,
#timelineValue {
    position: relative;
    z-index: 2;
    font-size: 25px;
}

/* Extra CSS for Timeline */
input[type=range] {
    height: 34px;
    -webkit-appearance: none;
    appearance: none;
    margin: 0px 0;
    width: 100%;
    background: rgba(0, 0, 0, 0);
    /* Transparent background */
}

input[type=range]:focus {
    outline: none;
}

input[type=range]::-webkit-slider-runnable-track {
    width: 100%;
    height: 11px;
    cursor: pointer;
    box-shadow: 1px 1px 1px #000000;
    background: rgba(116, 169, 216, 0.5);
    /* Adjusted color with transparency */
    border-radius: 1px;
    border: 0px solid #010101;
}

input[type=range]::-webkit-slider-thumb {
    box-shadow: 1px 1px 1px #000031;
    border: 1px solid #00001E;
    height: 26px;
    width: 26px;
    border-radius: 15px;
    background: #FFFFFF;
    cursor: pointer;
    -webkit-appearance: none;
    margin-top: -8px;
}

input[type=range]:focus::-webkit-slider-runnable-track {
    background: #74A9D8;
}

input[type=range]::-moz-range-track {
    width: 100%;
    height: 11px;
    cursor: pointer;
    box-shadow: 1px 1px 1px #000000;
    background: #74A9D8;
    border-radius: 1px;
    border: 0px solid #010101;
}

input[type=range]::-moz-range-thumb {
    box-shadow: 1px 1px 1px #000031;
    border: 1px solid #00001E;
    height: 26px;
    width: 26px;
    border-radius: 15px;
    background: #FFFFFF;
    cursor: pointer;
}

input[type=range]::-ms-track {
    width: 100%;
    height: 11px;
    cursor: pointer;
    background: transparent;
    border-color: transparent;
    color: transparent;
}

input[type=range]::-ms-fill-lower {
    background: #74A9D8;
    border: 0px solid #010101;
    border-radius: 2px;
    box-shadow: 1px 1px 1px #000000;
}

input[type=range]::-ms-fill-upper {
    background: #74A9D8;
    border: 0px solid #010101;
    border-radius: 2px;
    box-shadow: 1px 1px 1px #000000;
}

input[type=range]::-ms-thumb {
    margin-top: 1px;
    box-shadow: 1px 1px 1px #000031;
    border: 1px solid #00001E;
    height: 26px;
    width: 26px;
    border-radius: 15px;
    background: #FFFFFF;
    cursor: pointer;
}

input[type=range]:focus::-ms-fill-lower {
    background: #74A9D8;
}

input[type=range]:focus::-ms-fill-upper {
    background: #74A9D8;
}

/* Seed Input & RNG Button */
#seed {
    position: relative;
    z-index: 99;
    display: flex;
    align-items: center;
    justify-content: center;
}

#seedInput {
    background-color: #f8f1e5;
    border: 2px solid #c0b283;
    border-radius: 8px;
    padding: 5px 10px;
    font-family: 'Times New Roman', Times, serif;
    font-size: 16px;
    color: #635a4d;
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.3);

    width: auto;
    height: 18px;
}

#seedInput:hover {
    border-color: #8c7c5f;
}

#randomSeed {
    width: 40px;
    padding: 10px;
    margin: 5px;
    cursor: pointer;
    transition: transform 0.1s ease-in-out;
}

#randomSeed:hover {
    transform: scale(1.2);
}

/* World News */
#container {
    overflow: hidden;
}

.news {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    cursor: pointer;
    z-index: 998;
    width: 20%;
    background: transparent;
    transition: transform 0.1s ease-in-out;
}

.news:hover {
    transform: translate(-50%, -50%) scale(2.0) rotate(2deg);
    z-index: 999;
}

.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 999;
    pointer-events: none;
}

.overlay img {
    width: 8%;
    left: 10%;
    top: 10px;
    z-index: 999;
}

.overlay p {
    margin-top: 20px;
    top: 50%;
    z-index: 999;
}

/* Buttons */
.button {
    position: fixed;
    border: none;
    cursor: pointer;
    transition: transform 0.1s ease;
    z-index: 1000;
}

.button:hover {
    transform: scale(1.2);
}

#settings {
    background: url('images/cog.png') no-repeat center center;
    background-size: contain;
    width: 40px;
    height: 40px;
    position: sticky;
}

#downloadButton {
    background: url('images/download.png') no-repeat center center;
    background-size: contain;
    width: 30px;
    height: 30px;
    bottom: 20px;
    right: 20px;
}

#mapButton {
    background: url('images/mapIcon.png') no-repeat center center;
    background-size: contain;
    width: 30px;
    height: 30px;
    top: 20px;
    right: 20px;
}
#globeButton {
    background: url('images/globe.png') no-repeat center center;
    background-size: contain;
    width: 40px;
    height: 40px;
    top: 20px;
    right: 20px;
}

/* Settings */

.hidden {
    display: none;
}

#popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);

    background-color: #f0e6d6;
    border-radius: 5px;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);

    width: 70vw;              /* percentage-based */
    max-width: 700px;         /* keeps desktop size */
    aspect-ratio: 7 / 5;      /* 700 : 500 ratio */

    font-family: 'Lato', sans-serif;
    z-index: 9999;
    animation: slideIn 0.6s ease;
}

@keyframes slideIn {
    0% {
        transform: translate(-50%, -20%);
        opacity: 0;
    }

    100% {
        transform: translate(-50%, -50%);
        opacity: 1;
    }
}

.settings-window {
    display: flex;
    flex-direction: column;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #8b4513;
    padding: 10px 20px;
    border-bottom: 1px solid #444;
    clip-path: var(--jagged-edges);
}

.header h1 {
    color: #fff;
    font-size: 2em;
    font-family: 'carolingia';
}

.close-button {
    cursor: pointer;
    color: #FFF;
    font-size: 1.5em;
    border: none;
    background: none;
}

.settings-body {
    display: flex;
    /* Make it a flex container */
    flex-grow: 1;
    /* Allow it to fill remaining space */
}

.sidebar {
    background-color: #f4dbb3;
    width: 150px;
    padding: 5px 15px;
    height: 403px;
    max-height: 403px;
    overflow-y: auto;
    clip-path: var(--jagged-edges);
}

/* Hide the default scrollbar */
.sidebar::-webkit-scrollbar {
    width: 10px;
}

/* Track */
.sidebar::-webkit-scrollbar-track {
    background: #222222;
    box-shadow: inset 0 0 4px rgba(0, 0, 0, 0.5);
}

/* Handle */
.sidebar::-webkit-scrollbar-thumb {
    background: #2e2e2e;
    border: 1px solid rgba(0, 0, 0, 0.37);
    border-radius: 5px;
}

/* Handle */
.sidebar::-webkit-scrollbar-thumb:hover {
    background: #8b8b8b;
    border: 1px solid rgba(0, 0, 0, 0.37);
}

.sidebar ul {
    list-style: none;
    padding: 0;
}

.sidebar ul li a {
    text-decoration: none;
    color: black;
    display: block;
    padding: 6px 7px;
    border-radius: 5px;
    margin-bottom: 5px;
    user-select: none;
}

.sidebar ul li a.active {
    background-color: #8b4513;
    color: #fff;
}

.content {
    height: 100%;
    padding: 12px 15px;
    /* Adjust padding */
    overflow-y: auto;
    max-height: 395px;
    flex-grow: 1;
    color: black;
}

/* Hide the default scrollbar */
.content::-webkit-scrollbar {
    width: 10px;
}

/* Track */
.content::-webkit-scrollbar-track {
    background: #222222;
    box-shadow: inset 0 0 4px rgba(0, 0, 0, 0.5);
}

/* Handle */
.content::-webkit-scrollbar-thumb {
    background: #2e2e2e;
    border: 1px solid rgba(0, 0, 0, 0.37);
    border-radius: 5px;
}

/* Handle */
.content::-webkit-scrollbar-thumb:hover {
    background: #8b8b8b;
    border: 1px solid rgba(0, 0, 0, 0.37);
}

.content-section {
    display: block;
}

.content-section.hidden {
    display: none;
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.200);
    /* Semi-transparent black */
    z-index: 999;
    /* Ensure it's above other content */
}

/* Folders */
.toggle-switch {
    align-items: left;
    justify-content: left;
}