:root {
    color-scheme: dark;
    --primary-bg: #0a0a0a;
    --secondary-bg: #1a1a1a;
    --accent-blue: #00d4ff;
    --accent-orange: #ff6b35;
    --accent-teal: #00d3d6;
    --text-primary: #ffffff;
    --text-secondary: #b3b3b3;
    --grid-color: rgb(0 212 255 / 10%);
    --panel: #141717;
    --panel-hover: #142126;
    --border: rgb(0 212 255 / 32%);
    --border-soft: rgb(0 212 255 / 14%);
}

* {
    box-sizing: border-box;
}

html {
    background: var(--primary-bg);
}

body {
    background: var(--primary-bg);
    color: var(--text-primary);
    font-family: "Courier New", Courier, monospace;
    margin: 0 auto;
    max-width: 1120px;
    min-height: 100vh;
    padding: 30px 0 42px;
    position: relative;
    width: calc(100% - 32px);
}

body::before {
    background-image:
        linear-gradient(var(--grid-color) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-color) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: grid-move 20s linear infinite;
    content: "";
    inset: 0;
    pointer-events: none;
    position: fixed;
    z-index: 0;
}

@keyframes grid-move {
    from {
        transform: translate(0, 0);
    }

    to {
        transform: translate(50px, 50px);
    }
}

body > * {
    position: relative;
    z-index: 1;
}

.download-header {
    padding: 2rem 0 1.5rem;
    text-align: center;
}

.download-brand {
    display: inline-block;
}

@keyframes breathe {
    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.02);
    }
}

.download-brand img {
    animation: breathe 6s ease-in-out infinite;
    background: rgb(255 255 255 / 92%);
    border-radius: 8px;
    box-shadow:
        0 0 0 1px rgb(255 255 255 / 18%),
        0 3px 10px rgb(0 0 0 / 55%);
    display: block;
    height: 70px;
    padding: 8px 14px;
    transition: background-color 300ms ease, transform 300ms ease;
}

.download-brand:hover img {
    background: rgb(255 255 255 / 98%);
    transform: translateY(-2px);
}

/* Compatibility with the original header markup. Uploading the new CSS
   before header.html must never allow the source logo to render full-size. */
.download-header > img {
    animation: breathe 6s ease-in-out infinite;
    background: rgb(255 255 255 / 92%);
    border-radius: 8px;
    box-shadow:
        0 0 0 1px rgb(255 255 255 / 18%),
        0 3px 10px rgb(0 0 0 / 55%);
    display: block;
    height: 70px;
    margin: 0 auto;
    max-width: calc(100vw - 40px);
    object-fit: contain;
    padding: 8px 14px;
    width: auto;
}

.download-header > div {
    margin-top: 1.25rem;
    text-align: center;
}

.download-header > div h2 {
    color: var(--text-primary);
    font-size: clamp(1.25rem, 3vw, 1.7rem);
    margin: 0 0 0.65rem;
}

.download-header > div p {
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0;
}

.portal-subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
    letter-spacing: 2px;
    margin: 0.65rem 0 0;
}

.download-toolbar {
    align-items: center;
    background:
        linear-gradient(135deg, var(--secondary-bg), rgb(26 26 26 / 80%));
    border: 1px solid var(--accent-blue);
    border-radius: 15px;
    display: flex;
    gap: 24px;
    justify-content: space-between;
    padding: 18px 22px;
}

.download-eyebrow {
    color: var(--accent-blue);
    font-size: 0.72rem;
    letter-spacing: 0.15em;
    margin: 0 0 7px;
    text-transform: uppercase;
}

.download-toolbar h2 {
    color: var(--text-primary);
    font-size: clamp(1.25rem, 3vw, 1.7rem);
    line-height: 1.15;
    margin: 0 0 7px;
}

.download-summary {
    color: var(--text-secondary);
    font-family: "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 0.9rem;
    letter-spacing: normal;
    line-height: 1.5;
    margin: 0;
}

.portal-link {
    align-items: center;
    border: 1px solid rgb(0 212 255 / 40%);
    border-radius: 999px;
    color: var(--accent-blue);
    display: inline-flex;
    font-size: 0.78rem;
    font-weight: 700;
    gap: 8px;
    padding: 10px 14px;
    text-decoration: none;
    white-space: nowrap;
}

.portal-link::before {
    content: "←";
    font-size: 1rem;
}

.portal-link:hover {
    background: rgb(0 212 255 / 10%);
    border-color: var(--accent-teal);
    box-shadow: 0 0 18px rgb(0 212 255 / 15%);
    transform: translateY(-2px);
}

#indexlist {
    background: rgb(20 23 23 / 96%);
    border: 1px solid var(--border);
    border-collapse: separate;
    border-radius: 15px;
    border-spacing: 0;
    margin-top: 16px;
    overflow: hidden;
    table-layout: fixed;
    width: 100%;
}

/* Apache inserts separator rows containing only <hr>. They are structural
   leftovers, not useful content, and were responsible for the large bands. */
#indexlist .indexbreakrow {
    display: none;
}

#indexlist .indexhead th {
    background: rgb(0 212 255 / 8%);
    border-bottom: 1px solid var(--border);
    color: var(--accent-blue);
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    padding: 14px 16px;
    text-align: left;
    text-transform: uppercase;
}

#indexlist td {
    border-bottom: 1px solid var(--border-soft);
    color: var(--text-secondary);
    font-family: "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 0.95rem;
    height: 56px;
    letter-spacing: normal;
    padding: 12px 16px;
    text-align: left;
    transition: background-color 140ms ease, color 140ms ease;
}

#indexlist tr:last-child td {
    border-bottom: 0;
}

#indexlist tr:hover td {
    background: var(--panel-hover);
    color: var(--text-primary);
}

#indexlist a {
    color: var(--accent-blue);
    font-weight: 600;
    overflow-wrap: anywhere;
    text-decoration: none;
}

#indexlist a:hover {
    color: #fff;
    text-decoration: underline;
    text-decoration-color: var(--accent-blue);
    text-underline-offset: 4px;
}

#indexlist a:focus-visible,
.portal-link:focus-visible,
.download-brand:focus-visible {
    border-radius: 4px;
    outline: 2px solid var(--accent-blue);
    outline-offset: 4px;
}

#indexlist .indexcolicon {
    padding-left: 18px;
    padding-right: 4px;
    text-align: center;
    width: 58px;
}

#indexlist .indexhead .indexcolicon {
    font-size: 0;
}

#indexlist .indexhead .indexcolicon img {
    display: none;
}

#indexlist td.indexcolicon img {
    display: none;
}

#indexlist td.indexcolicon::before {
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 7px;
    color: var(--accent-blue);
    content: "↓";
    display: inline-flex;
    font-family: Arial, sans-serif;
    font-size: 0.95rem;
    height: 28px;
    justify-content: center;
    width: 28px;
}

#indexlist td.indexcolicon:has(img[alt="[DIR]"])::before {
    content: "▰";
}

#indexlist td.indexcolicon:has(img[alt="[PARENTDIR]"])::before {
    content: "←";
}

#indexlist .indexcollastmod {
    font-variant-numeric: tabular-nums;
    width: 205px;
}

#indexlist .indexcolsize {
    font-variant-numeric: tabular-nums;
    text-align: right;
    width: 105px;
}

.download-footer {
    align-items: center;
    color: var(--text-secondary);
    display: flex;
    font-size: 0.78rem;
    gap: 12px;
    justify-content: space-between;
    margin-top: 18px;
    padding: 0 4px;
}

.download-footer p {
    margin: 0;
}

.download-footer strong {
    color: var(--text-primary);
}

.server-status {
    align-items: center;
    display: inline-flex;
    gap: 8px;
}

.server-status::before {
    background: #00ff00;
    border-radius: 50%;
    box-shadow: 0 0 10px rgb(0 255 0 / 65%);
    content: "";
    height: 7px;
    width: 7px;
}

address {
    color: #70797c;
    font-size: 0.7rem;
    margin-top: 14px;
    text-align: center;
}

@media (max-width: 760px) {
    body {
        padding: 16px 0 30px;
        width: calc(100% - 20px);
    }

    .download-header {
        padding: 1.5rem 0 1.25rem;
    }

    .download-brand img,
    .download-header > img {
        height: 50px;
    }

    .portal-subtitle {
        font-size: 0.88rem;
        letter-spacing: 1px;
    }

    .download-toolbar {
        gap: 14px;
        padding: 16px;
    }

    .portal-link {
        padding: 9px 11px;
    }

    #indexlist .indexhead th,
    #indexlist td {
        padding: 11px 10px;
    }

    #indexlist .indexcollastmod,
    #indexlist .indexcolsize {
        display: none;
    }

    #indexlist .indexcolicon {
        padding-left: 10px;
        padding-right: 2px;
        width: 46px;
    }

    .download-footer {
        align-items: flex-start;
        flex-direction: column;
        gap: 7px;
    }
}

@media (max-width: 480px) {
    .download-toolbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .portal-link {
        align-self: stretch;
    }

    .portal-link {
        justify-content: center;
    }

    .download-toolbar h2 {
        font-size: 1.2rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    body::before,
    .download-brand img,
    .download-header > img {
        animation: none;
    }

    #indexlist td {
        transition: none;
    }
}

