:root {
    --primary: #38aef2;
    --primary-dark: #78cfff;
    --text: #eef6ff;
    --muted: #9cadc3;
    --border: #26364f;
    --surface: #121d2c;
    --soft: #0d1724;
    --danger: #ff8277;
    --success: #50d89b;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--text);
    background: #08111d;
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.5;
}

a {
    color: var(--primary-dark);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.container {
    width: min(1180px, calc(100% - 24px));
    margin: 0 auto;
}

.site-header {
    background: rgba(18, 29, 44, 0.94);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(14px);
    position: sticky;
    top: 0;
    z-index: 10;
}

.header-inner {
    align-items: center;
    display: flex;
    gap: 22px;
    min-height: 58px;
}

.brand {
    color: var(--primary-dark);
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.main-nav {
    align-items: center;
    display: flex;
    flex-wrap: nowrap;
    gap: 12px;
    margin-left: auto;
}

.menu-toggle {
    align-items: center;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 10px;
    display: none;
    flex-direction: column;
    gap: 4px;
    height: 38px;
    justify-content: center;
    margin-left: auto;
    padding: 0;
    width: 42px;
}

.menu-toggle span {
    background: var(--text);
    border-radius: 999px;
    display: block;
    height: 2px;
    width: 19px;
}

.main-nav a {
    color: var(--text);
    display: block;
    font-weight: 600;
    height: 38px;
    line-height: 38px;
    position: relative;
    top: 3px;
}

.admin-bar a {
    color: var(--text);
    font-weight: 600;
}

.site-search {
    align-items: center;
    display: flex;
    margin-left: 4px;
}

.site-search input {
    height: 38px;
    min-width: 170px;
    padding: 7px 9px;
}

.page {
    padding: 22px 0 36px;
    position: relative;
    z-index: 1;
}

.site-footer {
    border-top: 1px solid var(--border);
    color: var(--muted);
    padding: 18px 0;
    position: relative;
    z-index: 1;
}

.hero,
.card,
.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
}

.hero {
    padding: 20px;
    margin-bottom: 18px;
}

.artist-hero {
    align-items: center;
    display: flex;
    gap: 20px;
}

.artist-hero-thumb {
    aspect-ratio: 1;
    border-radius: 16px;
    flex: 0 0 132px;
    height: 132px;
    object-fit: cover;
    width: 132px;
}

.artist-hero-body {
    flex: 1;
    min-width: 0;
}

.hero h1,
.page-title {
    margin: 0 0 8px;
    font-size: clamp(28px, 5vw, 44px);
    letter-spacing: -0.04em;
}

.muted {
    color: var(--muted);
}

.grid {
    display: grid;
    gap: 14px;
}

.grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.card {
    overflow: hidden;
}

.card-body,
.panel {
    padding: 16px;
}

.page > .panel + .panel {
    margin-top: 18px;
}

.card-body h3 {
    margin: 0 0 8px;
}

.thumb {
    aspect-ratio: 16 / 9;
    background: #17263a;
    display: block;
    object-fit: cover;
    width: 100%;
}

.chart-row,
.stat-row,
.worldwide-row {
    align-items: center;
    border-bottom: 1px solid var(--border);
    display: grid;
    gap: 10px;
    grid-template-columns: 48px 120px 1fr auto;
    padding: 10px 0;
}

.worldwide-row {
    grid-template-columns: 48px 120px minmax(0, 1fr) 92px minmax(220px, 1.1fr);
}

.artist-trending-row {
    grid-template-columns: 48px 120px minmax(0, 1fr) 92px minmax(220px, 1.1fr);
}

.artist-video-row {
    grid-template-columns: 48px 120px minmax(0, 1fr) auto auto;
}

.position-row {
    gap: 6px;
    padding: 5px 0;
}

.position-row .rank {
    font-size: 18px;
}

.country-chart-link {
    color: inherit;
    text-decoration: none;
}

.country-chart-link:hover {
    color: inherit;
}

.channel-link {
    color: inherit;
}

.chart-row:last-child,
.stat-row:last-child,
.worldwide-row:last-child {
    border-bottom: 0;
}

.rank {
    color: var(--primary-dark);
    font-size: 22px;
    font-weight: 800;
}

.rank-with-movement {
    display: grid;
    gap: 4px;
    justify-items: start;
}

.movement {
    border-radius: 999px;
    display: inline-block;
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
    padding: 4px 7px;
}

.movement-up {
    background: rgba(80, 216, 155, 0.16);
    color: var(--success);
}

.movement-down {
    background: rgba(255, 130, 119, 0.16);
    color: var(--danger);
}

.movement-same,
.movement-new {
    background: #183451;
    color: var(--primary-dark);
}

.video-title {
    color: var(--text);
    font-weight: 800;
}

.chart-count {
    text-align: center;
}

.highlights {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.highlight-pill {
    background: #183451;
    border-radius: 999px;
    color: var(--primary-dark);
    display: inline-block;
    font-size: 12px;
    font-weight: 800;
    padding: 4px 8px;
}

.form-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

label {
    display: block;
    font-weight: 700;
    margin-bottom: 6px;
}

input,
select,
textarea {
    background: #0d1724;
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    font: inherit;
    padding: 9px 10px;
    width: 100%;
}

textarea {
    min-height: 110px;
}

.button,
button {
    background: var(--primary);
    border: 0;
    border-radius: 12px;
    color: white;
    cursor: pointer;
    display: inline-block;
    font: inherit;
    font-weight: 800;
    padding: 9px 14px;
}

.button.secondary {
    background: #183451;
    color: var(--primary-dark);
}

.button.danger {
    background: var(--danger);
}

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

.filter-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}

.filter-tabs a,
.filter-tabs button {
    background: #183451;
    border: 1px solid #183451;
    border-radius: 999px;
    color: var(--primary-dark);
    font-weight: 800;
    padding: 6px 10px;
    width: auto;
}

.filter-tabs button:not(.is-active) {
    background: #183451;
    color: var(--primary-dark);
}

.filter-tabs a.is-active,
.filter-tabs button.is-active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.search-controls {
    align-items: center;
    display: grid;
    gap: 12px;
    grid-template-columns: minmax(0, 1fr) 190px;
    margin-top: 18px;
}

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

.table th,
.table td {
    border-bottom: 1px solid var(--border);
    padding: 9px;
    text-align: left;
    vertical-align: top;
}

.table th {
    color: var(--muted);
    font-size: 13px;
    text-transform: uppercase;
}

.sortable-header {
    color: var(--primary-dark);
}

.notice {
    background: #102d45;
    border: 1px solid #245477;
    border-radius: 12px;
    margin-bottom: 14px;
    padding: 10px 12px;
}

.error {
    background: #351918;
    border-color: #6c2c29;
    color: var(--danger);
}

.admin-bar {
    background: var(--soft);
    border: 1px solid var(--border);
    border-radius: 14px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
    padding: 10px 12px;
}

.badge {
    background: #183451;
    border-radius: 999px;
    color: var(--primary-dark);
    display: inline-block;
    font-size: 12px;
    font-weight: 800;
    padding: 4px 8px;
    text-transform: uppercase;
}

.flag {
    border-radius: 3px;
    height: 16px;
    margin-right: 8px;
    object-fit: cover;
    vertical-align: -2px;
    width: 24px;
}

.video-embed {
    aspect-ratio: 16 / 9;
    border: 0;
    border-radius: 18px;
    width: 100%;
}

.video-embed-placeholder {
    aspect-ratio: 16 / 9;
    background: #000;
    border: 0;
    border-radius: 18px;
    color: var(--text);
    cursor: pointer;
    overflow: hidden;
    padding: 0;
    position: relative;
    width: 100%;
}

.video-embed-placeholder img {
    display: block;
    height: 100%;
    object-fit: cover;
    opacity: 0.82;
    transition: opacity 0.2s ease, transform 0.2s ease;
    width: 100%;
}

.video-embed-placeholder:hover img,
.video-embed-placeholder:focus-visible img {
    opacity: 0.94;
    transform: scale(1.02);
}

.video-play-button {
    background: rgba(56, 174, 242, 0.92);
    border-radius: 999px;
    box-shadow: 0 12px 34px rgba(0, 0, 0, 0.35);
    color: #06101c;
    font-weight: 800;
    left: 50%;
    padding: 14px 24px;
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
}

.video-summary-grid {
    align-items: stretch;
}

.video-embed-panel {
    display: flex;
}

.latest-stats-panel {
    height: 100%;
}

.video-page-bg {
    background-position: center;
    background-size: cover;
    filter: blur(22px);
    inset: -36px;
    opacity: 0.32;
    pointer-events: none;
    position: fixed;
    transform: scale(1.04);
    z-index: 0;
}

.video-page-bg::after {
    background: rgba(8, 17, 29, 0.72);
    content: "";
    inset: 0;
    position: absolute;
}

.chart-canvas {
    height: 320px;
    width: 100%;
}

.chart-wrap {
    position: relative;
}

.chart-tooltip {
    background: rgba(13, 23, 36, 0.96);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-size: 12px;
    line-height: 1.35;
    padding: 7px 9px;
    pointer-events: none;
    position: absolute;
    transform: translate(-50%, calc(-100% - 10px));
    white-space: nowrap;
    z-index: 2;
}

@media (max-width: 760px) {
    .site-header {
        position: static;
    }

    .header-inner {
        align-items: center;
        flex-wrap: wrap;
        min-height: 56px;
    }

    .menu-toggle {
        display: flex;
    }

    .main-nav {
        display: none;
        flex-basis: 100%;
        flex-direction: column;
        gap: 8px;
        margin-left: 0;
        padding: 0 0 12px;
        width: 100%;
    }

    .main-nav.is-open {
        display: flex;
    }

    .main-nav a {
        border-top: 1px solid var(--border);
        padding-top: 9px;
        top: 0;
    }

    .site-search {
        flex-direction: column;
    }

    .site-search input {
        min-width: 0;
    }

    .grid-2,
    .grid-3,
    .form-grid,
    .search-controls {
        grid-template-columns: 1fr;
    }

    .artist-hero {
        align-items: flex-start;
        flex-direction: column;
    }

    .artist-hero-thumb {
        flex-basis: auto;
        height: 104px;
        width: 104px;
    }

    .chart-row {
        grid-template-columns: 44px 96px 1fr;
    }

    .artist-video-row {
        grid-template-columns: 44px 96px 1fr;
    }

    .worldwide-row {
        align-items: start;
        grid-template-columns: 44px 96px 1fr;
    }

    .artist-trending-row {
        grid-template-columns: 44px 96px 1fr;
    }

    .chart-row .meta,
    .artist-video-row .chart-count,
    .artist-trending-row .meta,
    .artist-trending-row .highlights,
    .worldwide-row .meta,
    .worldwide-row .highlights {
        grid-column: 2 / -1;
    }

    .chart-count {
        text-align: left;
    }
}
