body {
    font-family: 'Courier New', Courier, monospace;
    background-color: #000;
    color: #0f0;
    padding: 20px;
    position: relative;
    min-height: 100vh;
    overflow-x: hidden;
}

input {
    background-color: #303030;
    color: #0f0;
    border: 1px solid #0f0;
    padding: 5px;
}

input[type="submit"], button, .back-button {
    cursor: pointer;
    transition: background 0.3s ease;
    background-color: #303030;
    color: #0f0;
    border: 1px solid #0f0;
    padding: 5px 12px;
    font-family: inherit;
    font-size: 1em;
}

input[type="submit"]:hover, button:hover, .back-button:hover {
    background-color: #0f0;
    color: #000;
}

.search-forms {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 720px;
    margin: 0 auto 20px;
}

.search-forms form {
    display: flex;
    gap: 8px;
    align-items: center;
}

.search-forms input[type="text"] {
    flex: 1;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
}

.search-forms input[type="submit"] {
    flex: 0 0 140px;
    width: 140px;
}

.back-button {
    display: inline-block;
    text-decoration: none;
    margin-bottom: 12px;
}

.back-button:hover {
    text-decoration: none;
}

.table-scroll {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 20px 0;
    border: 1px solid #0f0;
}

.table-scroll > table {
    margin: 0;
    border: none;
}

.table-scroll::-webkit-scrollbar {
    height: 10px;
}

.table-scroll::-webkit-scrollbar-track {
    background: #111;
}

.table-scroll::-webkit-scrollbar-thumb {
    background: #0f0;
}

table, th, tr, td {
    border: 1px solid #0f0;
    border-collapse: collapse;
    padding: 10px;
}

table {
    margin: 20px 0;
    width: 100%;
    table-layout: fixed;
}

table tr:hover {
    background-color: #303030;
}

table tr:hover td {
    box-shadow: inset 0 0 10px #0f0;
}

th {
    color: #f00;
    text-transform: uppercase;
}

/* Column widths for results tables to prevent layout shift */
table.results-table th:nth-child(1) { width: 18%; }
table.results-table th:nth-child(2) { width: 12%; }
table.results-table th:nth-child(3) { width: 12%; }
table.results-table th:nth-child(4) { width: 16%; }
table.results-table th:nth-child(5) { width: 12%; }
table.results-table th:nth-child(6) { width: 10%; }
table.results-table th:nth-child(7) { width: 20%; }
table.results-table.no-sources th:nth-child(1) { width: 20%; }
table.results-table.no-sources th:nth-child(2) { width: 15%; }
table.results-table.no-sources th:nth-child(3) { width: 15%; }
table.results-table.no-sources th:nth-child(4) { width: 20%; }
table.results-table.no-sources th:nth-child(5) { width: 20%; }
table.results-table.no-sources th:nth-child(6) { width: 10%; }

td {
    word-wrap: break-word;
    overflow-wrap: break-word;
    overflow: hidden;
}

a {
    color: #0ff;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Keep source track IDs in the DOM but hide them from view */
#source-tracks-table .source-track-id {
    display: none;
}

h1 {
    color: #f00;
    font-size: 2em;
    text-align: center;
    margin-bottom: 20px;
}

h2 {
    word-wrap: break-word;
    overflow-wrap: anywhere;
}

.rotating-text {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: #0f0;
    animation: rotate 5s linear infinite;
}

@keyframes rotate {
    from {
        transform: translateX(-50%) rotate(0deg);
    }
    to {
        transform: translateX(-50%) rotate(360deg);
    }
}

@media (max-width: 900px) {
    body {
        padding: 12px;
    }

    h1 {
        font-size: 1.35em;
    }

    .table-scroll {
        margin: 12px 0;
    }

    .table-scroll:has(.results-table)::after {
        content: "scroll →";
        display: block;
        padding: 6px 10px;
        color: #0a0;
        font-size: 0.85em;
        border-top: 1px solid #0f0;
        background: #0a0a0a;
        letter-spacing: 0.05em;
    }

    table.results-table {
        table-layout: fixed;
        width: 960px;
        min-width: 960px;
    }

    table.results-table th,
    table.results-table td {
        padding: 8px;
        overflow: visible;
        white-space: normal;
    }

    table.results-table th:nth-child(1) { width: 180px; }
    table.results-table th:nth-child(2) { width: 130px; }
    table.results-table th:nth-child(3) { width: 130px; }
    table.results-table th:nth-child(4) { width: 160px; }
    table.results-table th:nth-child(5) { width: 90px; }
    table.results-table th:nth-child(6) { width: 100px; }
    table.results-table th:nth-child(7) { width: 170px; }

    table.results-table.no-sources {
        width: 800px;
        min-width: 800px;
    }

    table.results-table.no-sources th:nth-child(1) { width: 180px; }
    table.results-table.no-sources th:nth-child(2) { width: 140px; }
    table.results-table.no-sources th:nth-child(3) { width: 140px; }
    table.results-table.no-sources th:nth-child(4) { width: 170px; }
    table.results-table.no-sources th:nth-child(5) { width: 90px; }
    table.results-table.no-sources th:nth-child(6) { width: 80px; }

    #source-tracks-table {
        table-layout: auto;
        width: 100%;
    }
}

@media (max-width: 520px) {
    .search-forms form {
        flex-direction: column;
        align-items: stretch;
    }

    .search-forms input[type="submit"] {
        flex: none;
        width: 100%;
    }
}
