/* --- base & reset --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: #121212; /* slightly softer black */
    color: #e0e0e0; /* off-white for better readability */
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; /* modern font stack */
    line-height: 1.7; /* improved line spacing */
    font-size: 16px; /* base font size */
    overflow-x: hidden; /* prevent horizontal scroll */
}

/* --- layout --- */
#content {
    position: relative;
    z-index: 10;
    max-width: 900px; /* limit content width */
    margin: 60px auto; /* center horizontally, add top/bottom margin */
    padding: 40px 50px; /* generous padding */
    background-color: rgba(28, 28, 28, 0.5); /* dark, semi-transparent background */
    border-radius: 12px; /* rounded corners */
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4); /* subtle shadow for depth */
    text-align: center; /* center inline/inline-block children like buttons */
}

#content p, #content ul, #content ol, #content h2, #content hr {
    text-align: left; /* reset text-align for block elements */
}
#content h1, #content h2 {
    text-align: center; /* ensure headings remain centered */
}


/* --- typography --- */
h1, h2 {
    color: #ffffff; /* pure white for contrast */
    font-weight: 600;
    margin-bottom: 1em;
}

h1 {
    font-size: 2.8rem;
    margin-bottom: 0.3em;
    line-height: 1.2;
}

/* server tagline */
h1 + em {
    display: block; /* make it block-level */
    text-align: center;
    font-size: 1.2rem;
    color: #b0b0b0; /* slightly muted color */
    margin-bottom: 2.5em;
    font-style: normal;
}

h2 {
    font-size: 1.9rem;
    margin-top: 2.5em; /* more space before sections */
    padding-bottom: 0.4em;
    border-bottom: 2px solid #444; /* subtle separator */
}

p {
    margin-bottom: 1.3em;
    color: #dcdcdc;
}

strong {
    font-weight: 600;
    color: #f5f5f5;
}

code {
    background-color: #333;
    padding: 0.2em 0.5em;
    border-radius: 4px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.95em;
    color: #f0f0f0;
}

/* --- connection address block --- */
/* target the specific span using attribute selector to override inline styles */
#content > span[style*="background-color: rgb(64,64,64)"] {
    display: inline-block; /* change to inline-block for centering */
    text-align: center;
    background-color: #0056b3 !important; /* modern blue accent */
    color: white;
    padding: 25px 20px !important;
    margin: 40px auto !important;
    border-radius: 8px;
    font-size: 1.6rem !important;
    max-width: 700px;
    box-shadow: 0 4px 10px rgba(0, 86, 179, 0.3);
}

#content > span[style*="background-color: rgb(64,64,64)"] code {
    background-color: rgba(0, 0, 0, 0.3) !important; /* darker overlay */
    padding: 8px 18px;
    border-radius: 6px !important;
    font-size: 1.6rem !important;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    display: inline-block;
    margin-left: 10px;
}

/* --- links --- */
a {
    color: #7cb5f9; /* slightly softer blue */
    text-decoration: none;
    transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
    padding: 2px 0px;
}

a:hover, a:focus {
    color: #a8d1ff;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

/* style the discord/library links like buttons */
#content > a[href*="discord.gg"],
#content > a[href="libraryhome.html"] {
    display: inline-block; /* keep as inline-block for side-by-side centering */
    margin: 25px 10px; /* adjust margin for spacing */
    padding: 12px 28px; /* slightly more horizontal padding */
    border: 1px solid #666; /* darker, less prominent border */
    border-radius: 6px;
    background-color: transparent;
    font-weight: 500;
    text-align: center;
    color: #e0e0e0; /* match body text color */
}

#content > a[href*="discord.gg"]:hover,
#content > a[href="libraryhome.html"]:hover,
#content > a[href*="discord.gg"]:focus,
#content > a[href="libraryhome.html"]:focus {
    background-color: rgba(255, 255, 255, 0.08); /* subtle light overlay */
    border-color: #aaa; /* lighter border on hover */
    color: #fff; /* slightly brighter text on hover */
    text-decoration: none; /* remove underline for button-like links */
    outline: none;
}

/* report outdated data link */
a[href*="mailto:"] {
    font-size: 0.9em;
    color: #aaa;
    display: inline-block; /* allow margin */
    margin-top: 5px;
}
a[href*="mailto:"]:hover {
    color: #ccc;
}


/* --- lists --- */
ul, ol {
    padding-left: 30px; /* consistent indentation */
    margin-bottom: 1.5em;
}

li {
    margin-bottom: 0.7em;
}

/* nested lists */
ul ul, ul ol, ol ul, ol ol {
    margin-top: 0.6em;
    margin-bottom: 0.8em;
    padding-left: 25px; /* increase indent for nested */
}

/* style townsite leaders */
ul li > b {
   color: #f8f8f8;
   font-weight: 600;
}

/* style group names (top-level bold in list items) */
#content > ul > li > b {
    display: block; /* make group name its own line */
    font-size: 1.15em;
    margin-bottom: 0.5em;
    color: #ffffff;
}

/* style italicized names (leaders/members within groups) */
ul ul li i {
    color: #c8c8c8;
    font-style: normal; /* optional: remove italics if color is enough */
}

/* adjust ordered list marker style */
ol { list-style-type: decimal; }
ol ol { list-style-type: lower-alpha; }
ol ol ol { list-style-type: lower-roman; }


/* --- horizontal rules --- */
hr {
    border: none;
    height: 1px;
    background-color: #444; /* darker, subtle line */
    margin: 3em auto; /* more vertical spacing, centered */
    width: 80%;
}

/* --- background image cycle --- */
body > div:last-of-type {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh; /* cover viewport height */
    z-index: 0; /* behind content */
    overflow: hidden;
}

#cyclepicture {
    width: 100%;
    height: 100%;
    object-fit: cover; /* cover area without distortion */
    filter: brightness(0.35);
}

#cyclecaption {
    position: absolute;
    bottom: 15px;
    right: 20px;
    background-color: rgba(0, 0, 0, 0.75);
    color: #e0e0e0;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.9rem;
    z-index: 5; /* ensure caption is above image */
    max-width: 80%;
    text-align: right;
}

/* --- unused modal styles (quick modernization) --- */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    width: 100%;
    height: 100%;
    overflow-y: auto;
    padding: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modali {
    padding: 30px 40px;
    border: none;
    border-radius: 10px;
    background-color: #2a2a2a;
    color: #e0e0e0;
    width: auto;
    max-width: 700px;
    position: relative;
    margin: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.modali h3 {
    text-align: center;
    color: #ffffff;
    font-size: 1.5rem;
    margin-bottom: 1em;
}

/* --- other elements --- */
button { /* if buttons are used elsewhere */
    padding: 10px 20px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
}
button:hover {
    background-color: #0056b3;
}

textarea {
    width: 100%;
    height: 300px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 1rem;
    background-color: #252525;
    color: #e0e0e0;
    border: 1px solid #555;
    border-radius: 5px;
    padding: 10px;
    resize: vertical;
    text-align: left; /* ensure textarea text is left-aligned */
}

textarea:focus {
    outline: none;
    border-color: #7cb5f9; /* match link color */
    box-shadow: 0 0 0 3px rgba(124, 181, 249, 0.2);
}

fieldset {
    display: block;
    border: 1px solid #444;
    padding: 15px;
    margin-bottom: 1.5em;
    border-radius: 5px;
    text-align: left; /* ensure fieldset content is left-aligned */
}

legend {
    padding: 0 10px;
    color: #fff;
    font-weight: 500;
}

/* table styles */
table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5em;
    background-color: transparent;
    table-layout: auto;
    text-align: left; /* ensure table content is left-aligned */
}

th, td {
    border: 1px solid #444;
    padding: 10px 12px;
    text-align: left;
    width: auto !important;
    max-width: none !important;
    overflow-x: visible !important;
    word-wrap: break-word;
}

th {
    background-color: #333;
    color: #fff;
    font-weight: 600;
}

td {
     background-color: #2a2a2a;
}

tr:nth-child(even) td {
    background-color: #2f2f2f; /* subtle striping */
}

/* --- responsive adjustments --- */
@media (max-width: 768px) {
    #content {
        margin: 30px auto;
        padding: 30px 25px;
        border-radius: 8px;
    }

    h1 { font-size: 2.4rem; }
    h1 + em { font-size: 1.1rem; margin-bottom: 2em;}
    h2 { font-size: 1.7rem; }

    #content > span[style*="background-color: rgb(64,64,64)"],
    #content > span[style*="background-color: rgb(64,64,64)"] code {
        font-size: 1.3rem !important;
        padding: 20px 15px !important;
    }

    #content > a[href*="discord.gg"],
    #content > a[href="libraryhome.html"] {
        padding: 10px 20px;
        /* optionally stack buttons on smaller tablets if needed */
        /* display: block; */
        /* margin: 10px auto 15px auto; */
    }

    ul, ol { padding-left: 20px; }
    ul ul, ul ol, ol ul, ol ol { padding-left: 15px; }

    th, td { padding: 8px 10px; }
}

@media (max-width: 480px) {
    body { font-size: 15px; }
    #content {
        margin: 15px 0; /* remove side margin */
        padding: 20px 15px;
        border-radius: 0; /* full width on very small screens */
        width: 100%;
    }

    h1 { font-size: 2rem; }
    h2 { font-size: 1.5rem; }

    #content > span[style*="background-color: rgb(64,64,64)"]{
       max-width: 95%; /* prevent overflow */
    }

    #content > span[style*="background-color: rgb(64,64,64)"],
    #content > span[style*="background-color: rgb(64,64,64)"] code {
        font-size: 1.1rem !important;
        padding: 15px 10px !important;
        border-radius: 4px !important;
    }
    #content > span[style*="background-color: rgb(64,64,64)"] code {
         padding: 6px 12px;
         margin-left: 5px;
    }

    #content > a[href*="discord.gg"],
    #content > a[href="libraryhome.html"] {
        display: block; /* stack buttons on small screens */
        margin: 10px auto 15px auto; /* center stacked buttons */
        width: 80%; /* give stacked buttons a width */
        max-width: 300px; /* max width for stacked */
    }
}