* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: #f4f6f8;
    color: #1f2937;
}

header {
    background: #111827;
    color: white;
    padding: 22px 0;
}

.container {
    width: 92%;
    max-width: 1200px;
    margin: 0 auto;
}

.brand {
    font-size: 28px;
    font-weight: bold;
    margin: 0;
}

.tagline {
    margin: 6px 0 0;
    color: #cbd5e1;
}

main {
    padding: 32px 0;
}

h2 {
    margin-top: 0;
}

.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
    margin-bottom: 35px;
}

.stat-card {
    background: white;
    border-radius: 10px;
    padding: 22px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.stat-number {
    font-size: 32px;
    font-weight: bold;
    margin: 0;
}

.stat-label {
    margin: 7px 0 0;
    color: #64748b;
}

.table-card {
    background: white;
    border-radius: 10px;
    padding: 22px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    padding: 12px;
    border-bottom: 2px solid #e5e7eb;
    color: #475569;
}

td {
    padding: 12px;
    border-bottom: 1px solid #e5e7eb;
}

tbody tr:hover {
    background: #f8fafc;
}

footer {
    text-align: center;
    padding: 30px;
    color: #64748b;
}

@media (max-width: 700px) {
    .stats {
        grid-template-columns: 1fr;
    }

    .brand {
        font-size: 24px;
    }

    th,
    td {
        padding: 9px;
        font-size: 14px;
    }
}
.search-section {
    margin-bottom: 30px;
}

.search-form {
    display: flex;
    gap: 10px;
}

.search-input {
    flex: 1;
    padding: 15px 18px;
    font-size: 17px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    outline: none;
}

.search-input:focus {
    border-color: #64748b;
}

.search-button {
    padding: 0 25px;
    border: none;
    border-radius: 8px;
    background: #111827;
    color: white;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
}

.search-button:hover {
    background: #374151;
}

@media (max-width: 600px) {
    .search-form {
        flex-direction: column;
    }

    .search-button {
        padding: 14px;
    }
}

/* Header and navigation */

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 30px;
}

.branding {
    flex-shrink: 0;
}

.brand-link {
    color: white;
    text-decoration: none;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 24px;
}

.main-nav a {
    color: #cbd5e1;
    text-decoration: none;
    font-size: 15px;
    font-weight: 600;
}

.main-nav a:hover {
    color: white;
}


/* Navigation on smaller screens */

@media (max-width: 850px) {

    .header-content {
        flex-direction: column;
        align-items: flex-start;
    }

    .main-nav {
        width: 100%;
        gap: 18px;
        overflow-x: auto;
        padding-bottom: 4px;
    }

    .main-nav a {
        white-space: nowrap;
    }
}

/* Artist pages */

.artist-header {
    margin-bottom: 25px;
}

.artist-header h2 {
    font-size: 34px;
    margin-bottom: 5px;
}

.artist-subtitle {
    margin: 0;
    color: #64748b;
}

.artist-section {
    margin-bottom: 25px;
}
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin: 30px 0;
    flex-wrap: wrap;
}

.pagination a {
    display: inline-block;
    padding: 10px 16px;
    background: #111827;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
}

.pagination a:hover {
    opacity: 0.85;
}

.pagination span {
    font-weight: 600;
}

.chart-period-selector {
    display: flex;
    gap: 10px;
    margin: 20px 0 30px;
    flex-wrap: wrap;
}

.chart-period-selector a {
    display: inline-block;
    padding: 10px 16px;
    background: #e5e7eb;
    color: #111827;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
    transition: 0.2s ease;
}

.chart-period-selector a:hover {
    background: #d1d5db;
}

.chart-period-selector a.active {
    background: #111827;
    color: white;
}
.chart-filter {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 20px 0 10px;
    flex-wrap: wrap;
}

.chart-filter label {
    font-weight: 600;
}

.chart-filter select {
    min-width: 240px;
    padding: 10px 38px 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: white;
    color: #111827;
    font: inherit;
    font-weight: 500;
    cursor: pointer;
}

.chart-filter select:focus {
    outline: none;
    border-color: #111827;
}
.chart-station-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 20px 0 10px;
    flex-wrap: wrap;
}

.chart-station-selector label {
    font-weight: 600;
}

.chart-station-selector select {
    min-width: 240px;
    padding: 10px 38px 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: white;
    color: #111827;
    font: inherit;
    font-weight: 500;
    cursor: pointer;
}

.chart-station-selector select:focus {
    outline: none;
    border-color: #111827;
}
/* Reusable action buttons */

.station-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 20px;
}

.action-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;

    padding: 12px 20px;
    border-radius: 10px;

    background: #2563eb;
    color: #ffffff;
    text-decoration: none;

    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;

    transition:
        background 0.2s ease,
        transform 0.2s ease,
        box-shadow 0.2s ease;
}

.action-button:visited {
    color: #ffffff;
}

.action-button:hover {
    background: #1d4ed8;
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.25);
}

.action-button:focus-visible {
    outline: 2px solid #93c5fd;
    outline-offset: 3px;
}

.action-button:active {
    transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
    .action-button {
        transition: none;
    }
}
/* Secondary action button */

.action-button-secondary {
    background: transparent;
    color: #93c5fd;
    border: 1px solid #475569;
}

.action-button-secondary:visited {
    color: #93c5fd;
}

.action-button-secondary:hover {
    background: #1e293b;
    color: #ffffff;
    border-color: #64748b;
}
/* Stations directory search form */

.chart-station-selector input[type="search"] {
    min-width: 220px;
    padding: 11px 14px;

    background: #0f172a;
    color: #f8fafc;

    border: 1px solid #475569;
    border-radius: 10px;

    font: inherit;
    font-size: 14px;

    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.chart-station-selector input[type="search"]::placeholder {
    color: #94a3b8;
}

.chart-station-selector input[type="search"]:focus {
    outline: none;
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.15);
}
/* Match the Stations country dropdown to the search field */

.chart-station-selector select {
    min-width: 220px;
    padding: 11px 14px;

    background: #0f172a;
    color: #f8fafc;

    border: 1px solid #475569;
    border-radius: 10px;

    font: inherit;
    font-size: 14px;

    cursor: pointer;

    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.chart-station-selector select:focus {
    outline: none;
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.15);
}
/* Homepage statistics: four responsive cards */

.stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

.stats .stat-card {
    min-width: 0;
}

@media (max-width: 900px) {
    .stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 480px) {
    .stats {
        grid-template-columns: 1fr;
    }
}

/* Homepage introduction */

.home-hero {
    padding: 34px 0 28px;
    max-width: 850px;
}

.hero-eyebrow {
    margin-bottom: 12px;
    color: #2563eb;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 2px;
}

.home-hero h1 {
    margin: 0 0 16px;
    font-size: clamp(32px, 4vw, 48px);
    font-weight: 750;
    letter-spacing: -1.5px;
    line-height: 1.15;
}

.hero-description {
    max-width: 680px;
    color: #64748b;
    font-size: 17px;
    line-height: 1.7;
}

/* Homepage country exploration */

.home-countries {
    margin: 32px 0;
}

.home-section-heading {
    margin-bottom: 20px;
}

.home-section-heading h2 {
    margin: 0 0 8px;
    font-size: 23px;
    font-weight: 700;
}

.home-section-heading p {
    margin: 0;
    color: #64748b;
    font-size: 14px;
    line-height: 1.6;
}

/* Country card layout */

.country-card-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.country-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;

    padding: 24px;
    min-width: 0;

    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;

    text-decoration: none;
    color: #0f172a;

    transition:
        transform 0.2s ease,
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.country-card:visited {
    color: #0f172a;
}

.country-card:hover {
    transform: translateY(-3px);
    border-color: #93c5fd;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

.country-card:focus-visible {
    outline: 3px solid #60a5fa;
    outline-offset: 3px;
}

.country-card-flag {
    font-size: 32px;
    line-height: 1.2;
}

.country-card-name {
    font-size: 18px;
    font-weight: 700;
}

.country-card-link {
    margin-top: 4px;
    color: #2563eb;
    font-size: 13px;
    font-weight: 600;
}

/* Responsive layout */

@media (max-width: 700px) {
    .country-card-grid {
        grid-template-columns: 1fr;
    }

    .country-card {
        padding: 20px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .country-card {
        transition: none;
    }
}

/* AirplayChecker header branding */

.branding {
    display: flex;
    align-items: center;
}

.brand-link {
    display: inline-flex;
    align-items: center;
    gap: 13px;
    text-decoration: none;
    color: inherit;
}

.brand-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;

    width: 46px;
    height: 46px;

    background: #203a51;
    color: #52d4c5;

    border: 1px solid #34566c;
    border-radius: 11px;

    font-size: 19px;
    font-weight: 800;
    letter-spacing: -1px;
}

.brand-text {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.brand-text .brand {
    display: block;
    margin: 0;
    color: #ffffff;
    font-size: 21px;
    font-weight: 750;
    line-height: 1.15;
}

.brand-text .tagline {
    display: block;
    margin: 0;
    color: #a5b4c6;
    font-size: 12px;
    line-height: 1.3;
}

.brand-link:hover .brand-logo {
    border-color: #52d4c5;
}

.brand-link:focus-visible {
    outline: 2px solid #52d4c5;
    outline-offset: 5px;
    border-radius: 4px;
}

/* Navigation refinements */

.main-nav a {
    display: inline-flex;
    align-items: center;
    padding: 10px 12px;

    color: #cbd5e1;
    text-decoration: none;
    font-weight: 500;

    border-bottom: 2px solid transparent;
    transition: color 0.2s ease, border-color 0.2s ease;
}

.main-nav a:hover {
    color: #ffffff;
    border-bottom-color: #64748b;
}

.main-nav a.active {
    color: #52d4c5;
    border-bottom-color: #52d4c5;
    font-weight: 650;
}

.main-nav a:focus-visible {
    outline: 2px solid #52d4c5;
    outline-offset: 3px;
    border-radius: 3px;
}

@media (prefers-reduced-motion: reduce) {
    .main-nav a {
        transition: none;
    }
}

/* AirplayChecker header branding */

.brand-link {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

.site-logo {
    display: block;
    width: 230px;
    max-width: 100%;
    height: auto;
    object-fit: contain;
}

.branding .tagline {
    margin: 3px 0 0;
    font-size: 11px;
    color: #aab8c7;
}

@media (max-width: 600px) {
    .site-logo {
        width: 180px;
    }
}

/* =========================================
   AirplayChecker - Mobile refinements
   ========================================= */

@media (max-width: 700px) {

    /* Header branding */

    .header-content {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
    }

    .branding {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
        min-width: 0;
    }

    .site-logo {
        width: 200px;
        max-width: 100%;
        height: auto;
    }

    .branding .tagline {
        margin: 0;
        font-size: 11px;
        line-height: 1.4;
    }

    /* Navigation */

    .main-nav {
        display: flex;
        width: 100%;
        max-width: 100%;
        gap: 8px;
        overflow-x: auto;
        padding-bottom: 8px;
        -webkit-overflow-scrolling: touch;
    }

    .main-nav a {
        flex-shrink: 0;
        white-space: nowrap;
        padding: 10px;
        font-size: 14px;
    }

    /* Homepage */

    .home-hero {
        padding: 20px 0;
    }

    .home-hero h1 {
        font-size: 32px;
        letter-spacing: -0.8px;
    }

    .hero-description {
        font-size: 15px;
        line-height: 1.6;
    }

    /* Statistics */

    .stat-card {
        padding: 18px;
    }

    .stat-number {
        font-size: 27px;
    }

    /* Tables */

    .table-card {
        max-width: 100%;
        overflow-x: auto;
        padding: 14px;
    }

    table {
        min-width: 600px;
    }

    th,
    td {
        padding: 10px;
        font-size: 13px;
    }

    /* Filters */

    .chart-filter select,
    .chart-station-selector select,
    .chart-station-selector input[type="search"] {
        width: 100%;
        min-width: 0;
        max-width: 100%;
    }

    /* Station buttons */

    .station-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .action-button {
        width: 100%;
        text-align: center;
    }

}

/* Modern station tables — scoped to station.html only */
:is(.modern-station-table, .modern-home-table) {
    padding: 22px;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    box-shadow: 0 5px 22px rgba(15, 23, 42, .06);
}
:is(.modern-station-table, .modern-home-table) h2 {
    margin: 0 0 18px;
    font-size: 22px;
    letter-spacing: -.35px;
    color: #172338;
}
:is(.modern-station-table, .modern-home-table) table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    min-width: 560px;
    border: 1px solid #dce5f0;
    border-radius: 10px;
    overflow: hidden;
}
:is(.modern-station-table, .modern-home-table) thead th {
    padding: 15px 17px;
    background: #10365a;
    color: #fff;
    border: 0;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .045em;
    text-transform: uppercase;
    white-space: nowrap;
}
:is(.modern-station-table, .modern-home-table) tbody td {
    padding: 15px 17px;
    border: 0;
    border-bottom: 1px solid #e4ebf3;
    color: #334155;
    line-height: 1.45;
}
:is(.modern-station-table, .modern-home-table) tbody tr:nth-child(even) { background: #f0f5fb; }
:is(.modern-station-table, .modern-home-table) tbody tr:hover { background: #e3f3fa; }
:is(.modern-station-table, .modern-home-table) tbody tr:last-child td { border-bottom: 0; }
:is(.modern-station-table, .modern-home-table) td a {
    color: #145c85;
    font-weight: 600;
    text-decoration: none;
}
:is(.modern-station-table, .modern-home-table) td a:hover { color: #0e7490; text-decoration: underline; }
:is(.modern-station-table, .modern-home-table) td a:focus-visible { outline: 2px solid #0e7490; outline-offset: 3px; }
:is(.modern-station-table, .modern-home-table) .rank-col,
:is(.modern-station-table, .modern-home-table) .rank-cell { width: 54px; text-align: center; }
:is(.modern-station-table, .modern-home-table) .rank-cell { color: #0e7490; font-weight: 700; font-variant-numeric: tabular-nums; }
:is(.modern-station-table, .modern-home-table) .count-col,
:is(.modern-station-table, .modern-home-table) .count-cell { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
:is(.modern-station-table, .modern-home-table) .count-cell { color: #172338; font-weight: 700; }
:is(.modern-station-table, .modern-home-table) .time-cell { white-space: nowrap; color: #64748b; font-variant-numeric: tabular-nums; }
@media (max-width: 700px) {
    :is(.modern-station-table, .modern-home-table) { padding: 14px; }
    :is(.modern-station-table, .modern-home-table) h2 { font-size: 20px; }
    :is(.modern-station-table, .modern-home-table) thead th,
    :is(.modern-station-table, .modern-home-table) tbody td { padding: 12px; font-size: 13px; }
}

/* Homepage table: keep the introductory text comfortably spaced. */
.modern-home-table .home-section-heading { margin-bottom: 18px; }
.modern-home-table .home-section-heading h2 { margin-bottom: 8px; }
.modern-home-table .home-section-heading p { margin: 0; }


/* Directory pages and artist profiles — consistent with the new station/home tables */
.modern-directory-table {
    padding: 22px;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    box-shadow: 0 5px 22px rgba(15,23,42,.06);
    margin-bottom: 25px;
    overflow-x: auto;
}
.modern-directory-table h2 { color: #172338; font-size: 22px; margin: 0 0 18px; }
.modern-directory-table table {
    width: 100%; min-width: 560px; border-collapse: separate; border-spacing: 0;
    border: 1px solid #dce5f0; border-radius: 10px; overflow: hidden;
}
.modern-directory-table thead th {
    padding: 15px 17px; background: #10365a; color: white; border: 0;
    font-size: 12px; font-weight: 700; letter-spacing: .045em;
    text-transform: uppercase; white-space: nowrap;
}
.modern-directory-table tbody td {
    padding: 15px 17px; border: 0; border-bottom: 1px solid #e4ebf3;
    color: #334155; line-height: 1.45;
}
.modern-directory-table tbody tr:nth-child(even) { background: #f0f5fb; }
.modern-directory-table tbody tr:hover { background: #e3f3fa; }
.modern-directory-table tbody tr:last-child td { border-bottom: 0; }
.modern-directory-table td a { color: #145c85; font-weight: 600; text-decoration: none; }
.modern-directory-table td a:hover { color: #0e7490; text-decoration: underline; }
.modern-directory-table td a:focus-visible { outline: 2px solid #0e7490; outline-offset: 3px; }
.modern-directory-table .count-col, .modern-directory-table .count-cell {
    text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums;
}
.modern-directory-table .count-cell { color: #172338; font-weight: 700; }
.modern-directory-table .time-cell { white-space: nowrap; color: #64748b; font-variant-numeric: tabular-nums; }
.modern-directory-table .country-cell { white-space: nowrap; }
.directory-filters {
    background: white; border: 1px solid #e2e8f0; border-radius: 14px;
    padding: 18px 20px; margin: 18px 0 24px;
}
.directory-filters form { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.directory-filters .action-button { border: 0; cursor: pointer; font-family: inherit; }
.directory-country-grid {
    display: grid; grid-template-columns: repeat(3, minmax(0,1fr));
    gap: 18px; margin: 24px 0 35px;
}
.directory-country-card {
    display: flex; flex-direction: column; align-items: flex-start; gap: 12px;
    min-width: 0; padding: 26px; background: white;
    border: 1px solid #e2e8f0; border-radius: 14px;
    text-decoration: none; color: #0f172a;
    box-shadow: 0 5px 22px rgba(15,23,42,.04);
    transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.directory-country-card:visited { color: #0f172a; }
.directory-country-card:hover {
    transform: translateY(-3px); border-color: #93c5fd;
    box-shadow: 0 8px 24px rgba(15,23,42,.08);
}
.directory-country-card:focus-visible { outline: 3px solid #60a5fa; outline-offset: 3px; }
.directory-country-flag { font-size: 34px; line-height: 1.2; }
.directory-country-name { font-size: 20px; font-weight: 700; }
.directory-country-count { font-size: 14px; color: #64748b; }
.directory-country-link { margin-top: 8px; color: #145c85; font-size: 14px; font-weight: 700; }
@media (max-width: 700px) {
    .directory-country-grid { grid-template-columns: 1fr; }
    .modern-directory-table { padding: 14px; }
    .modern-directory-table thead th, .modern-directory-table tbody td { padding: 12px; font-size: 13px; }
    .directory-filters form { align-items: stretch; flex-direction: column; }
    .directory-filters label, .directory-filters select,
    .directory-filters input[type="search"], .directory-filters button { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
    .directory-country-card { transition: none; }
}

/* Artists directory: fine-tuning */
.artists-directory-table { margin-top: 22px; }
.artists-directory-table .artists-empty { text-align: center; padding: 30px; color: #64748b; }


/* Charts page — matching AirplayChecker table system */
.modern-chart-table {
    background: #fff;
    padding: 22px;
    margin: 0 0 26px;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    box-shadow: 0 5px 22px rgba(15,23,42,.06);
    overflow-x: auto;
}
.modern-chart-table h2 { color: #172338; font-size: 22px; letter-spacing: -.35px; margin: 0 0 9px; }
.modern-chart-table .chart-context { color: #64748b; font-size: 14px; line-height: 1.5; margin: 0 0 20px; }
.modern-chart-table table {
    width: 100%; min-width: 850px; border-collapse: separate; border-spacing: 0;
    border: 1px solid #dce5f0; border-radius: 10px; overflow: hidden;
}
.modern-chart-table thead th {
    background: #10365a; color: #fff; border: 0; padding: 15px 14px;
    font-size: 12px; font-weight: 700; text-transform: uppercase;
    letter-spacing: .045em; white-space: nowrap;
}
.modern-chart-table tbody td {
    color: #334155; border: 0; border-bottom: 1px solid #e4ebf3;
    padding: 14px; line-height: 1.45;
}
.modern-chart-table tbody tr:nth-child(even) { background: #f0f5fb; }
.modern-chart-table tbody tr:hover { background: #e3f3fa; }
.modern-chart-table tbody tr:last-child td { border-bottom: 0; }
.modern-chart-table td a { color: #145c85; font-weight: 600; text-decoration: none; }
.modern-chart-table td a:hover { color: #0e7490; text-decoration: underline; }
.modern-chart-table td a:focus-visible { outline: 2px solid #0e7490; outline-offset: 3px; }
.modern-chart-table .rank-col, .modern-chart-table .rank-cell { width: 48px; text-align: center; }
.modern-chart-table .rank-cell { color: #0e7490; font-weight: 700; font-variant-numeric: tabular-nums; }
.modern-chart-table .count-col, .modern-chart-table .count-cell { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.modern-chart-table .count-cell { color: #172338; font-weight: 700; }
.modern-chart-table .time-cell { white-space: nowrap; color: #64748b; font-variant-numeric: tabular-nums; }
.chart-modern-filter { display: inline-flex; margin: 14px 14px 8px 0; vertical-align: top; }
.chart-modern-filter form { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.chart-modern-filter label { color: #334155; font-weight: 700; }
.chart-modern-filter select { max-width: 100%; }
@media (max-width: 700px) {
    .modern-chart-table { padding: 14px; }
    .modern-chart-table h2 { font-size: 20px; }
    .modern-chart-table thead th, .modern-chart-table tbody td { padding: 12px; font-size: 13px; }
    .chart-modern-filter { display: flex; margin-right: 0; }
    .chart-modern-filter form, .chart-modern-filter select { width: 100%; }
}

/* Track detail: uses the established directory table design. */
.modern-track-table h2 { letter-spacing: -.35px; }
.modern-track-table .time-cell { white-space: nowrap; }
.modern-track-table tbody td:first-child a { overflow-wrap: anywhere; }

/* Mobile header and homepage polish — desktop layout unchanged. */
@media (max-width: 700px) {
    header { padding: 18px 0 14px; }
    .header-content { align-items: stretch; gap: 18px; }
    .branding { width: 100%; align-items: center; text-align: center; gap: 7px; }
    .branding .brand-link { justify-content: center; max-width: 100%; }
    .site-logo { display: block; width: min(230px, 76vw); max-width: 100%; height: auto; margin: 0 auto; }
    .branding .tagline { max-width: 100%; margin: 0; font-size: 12px; line-height: 1.45; text-align: center; }
    .main-nav { align-items: center; gap: 6px; padding: 0 0 7px; overscroll-behavior-x: contain; scrollbar-width: thin; scrollbar-color: #64748b transparent; }
    .main-nav a { padding: 10px 12px; min-height: 42px; justify-content: center; font-size: 14px; }
    main.container { padding-top: 18px; }
    .home-hero { padding: 14px 0 18px; }
    .home-hero h1 { font-size: clamp(29px, 8vw, 36px); line-height: 1.16; letter-spacing: -0.8px; }
    .hero-description { margin-bottom: 0; font-size: 15px; line-height: 1.6; }
    .search-input { width: 100%; min-width: 0; font-size: 16px; }
    .search-button { min-height: 48px; }
    .stats { gap: 12px; }
    .stat-card { padding: 18px; }
}

/* Homepage airplay table view selector */
.home-airplay-views {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 0 0 20px;
}

.airplay-view-button {
    padding: 11px 18px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #f1f5f9;
    color: #172338;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, border-color .15s;
}

.airplay-view-button:hover {
    background: #dceaf5;
}

.airplay-view-button.active {
    background: #10365a;
    border-color: #10365a;
    color: #fff;
}

.airplay-view-button:focus-visible {
    outline: 3px solid #0e7490;
    outline-offset: 3px;
}

@media (max-width: 480px) {
    .airplay-view-button {
        flex: 1;
        padding: 12px 10px;
        font-size: 13px;
    }
}

/* Native dark mode — follows the visitor's device preference */
@media (prefers-color-scheme: dark) {
    :root {
        color-scheme: dark;
    }

    body {
        background: #111827;
        color: #e2e8f0;
    }

    .stat-card,
    .table-card {
        background: #1e293b;
        color: #e2e8f0;
    }

    .stat-label,
    footer {
        color: #94a3b8;
    }

    .modern-home-table h2,
    .modern-station-table h2 {
        color: #f1f5f9;
    }

    :is(.modern-home-table, .modern-station-table) {
        border-color: #334155;
    }

    :is(.modern-home-table, .modern-station-table) table {
        border-color: #475569;
    }

    :is(.modern-home-table, .modern-station-table) thead th {
        background: #102b4e;
        color: #f8fafc;
    }

    :is(.modern-home-table, .modern-station-table) tbody td {
        color: #e2e8f0;
        border-bottom-color: #334155;
    }

    :is(.modern-home-table, .modern-station-table) tbody tr:nth-child(even) {
        background: #263449;
    }

    :is(.modern-home-table, .modern-station-table) tbody tr:hover {
        background: #334155;
    }

    :is(.modern-home-table, .modern-station-table) td a {
        color: #93c5fd;
    }

    .airplay-view-button {
        background: #334155;
        border-color: #475569;
        color: #e2e8f0;
    }

    .airplay-view-button:hover {
        background: #475569;
    }

    .airplay-view-button.active {
        background: #164b78;
        border-color: #3b82f6;
        color: #ffffff;
    }
}

/* Native dark mode — directories, charts and country cards */
@media (prefers-color-scheme: dark) {

    .modern-directory-table,
    .modern-chart-table,
    .directory-filters,
    .directory-country-card {
        background: #1e293b;
        border-color: #334155;
        color: #e2e8f0;
    }

    .directory-country-card:visited {
        color: #e2e8f0;
    }

    .directory-country-card:hover {
        background: #263449;
        border-color: #60a5fa;
    }

    .directory-country-name,
    .modern-directory-table h2,
    .modern-chart-table h2 {
        color: #f1f5f9;
    }

    .directory-country-count,
    .modern-chart-table .chart-context,
    .artists-directory-table .artists-empty {
        color: #aab8c7;
    }

    .directory-country-link {
        color: #93c5fd;
    }

    :is(.modern-directory-table, .modern-chart-table) table {
        border-color: #475569;
    }

    :is(.modern-directory-table, .modern-chart-table) thead th {
        background: #102b4e;
        color: #f8fafc;
    }

    :is(.modern-directory-table, .modern-chart-table) tbody td {
        color: #e2e8f0;
        border-bottom-color: #334155;
    }

    :is(.modern-directory-table, .modern-chart-table) tbody tr:nth-child(even) {
        background: #263449;
    }

    :is(.modern-directory-table, .modern-chart-table) tbody tr:hover {
        background: #334155;
    }

    :is(.modern-directory-table, .modern-chart-table) td a {
        color: #93c5fd;
    }

    :is(.modern-directory-table, .modern-chart-table) td a:hover {
        color: #67e8f9;
    }

    :is(.modern-directory-table, .modern-chart-table) .rank-cell,
    :is(.modern-directory-table, .modern-chart-table) .count-cell {
        color: #e2e8f0;
    }

    :is(.modern-directory-table, .modern-chart-table) .time-cell {
        color: #aab8c7;
    }

    .chart-modern-filter label,
    .directory-filters label {
        color: #e2e8f0;
    }

    .directory-filters input,
    .directory-filters select,
    .chart-modern-filter select {
        background: #0f172a;
        color: #f1f5f9;
        border-color: #475569;
    }
}

/* Native dark mode — homepage countries and chart periods */
@media (prefers-color-scheme: dark) {

    .country-card,
    .country-card:visited {
        background: #1e293b;
        border-color: #334155;
        color: #f1f5f9;
    }

    .country-card:hover {
        background: #263449;
        border-color: #60a5fa;
    }

    .country-card-link {
        color: #93c5fd;
    }

    .chart-period-selector a,
    .chart-period-selector a:visited {
        display: inline-block;
        background: #334155;
        border: 1px solid #475569;
        border-radius: 8px;
        color: #e2e8f0;
        text-decoration: none;
    }

    .chart-period-selector a:hover {
        background: #475569;
        color: #ffffff;
    }

    .chart-period-selector a.active,
    .chart-period-selector a.active:visited {
        background: #164b78;
        border-color: #3b82f6;
        color: #ffffff;
    }

    .chart-period-selector a:focus-visible {
        outline: 3px solid #60a5fa;
        outline-offset: 3px;
    }
}
