*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

*:focus,
*:focus-visible {
    outline: none !important;
    box-shadow: none !important;
}

input:focus,
button:focus,
select:focus,
textarea:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    box-shadow: none !important;
}

:root {
    --bg-base:       #050a10;
    --cyan:          #00e5ff;
    --purple:        rgba(168,85,247,1);
    --txt:           #f0f4ff;
    --bg-card:       rgba(255,255,255,0.04);
    --bg-card-hover: rgba(255,255,255,0.07);
    --border:        rgba(255,255,255,0.08);
    --border-accent: rgba(78,141,242,0.4);
    --text-primary:  #f0f4ff;
    --text-secondary:#8fa3c0;
    --text-muted:    #4e6882;
    --accent:        #4e8df2;
    --accent-dim:    rgba(78,141,242,0.15);
    --green:         #3ed0a4;
    --green-dim:     rgba(62,208,164,0.15);
    --red:           #f05a4e;
    --red-dim:       rgba(240,90,78,0.15);
    --radius:        12px;
    --radius-sm:     8px;
    --radius-pill:   999px;
    --font:          'Inter', 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    background: var(--bg-base);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    outline: none;
    overflow-x: hidden;
}

body:focus, body:focus-visible {
    outline: none;
}

.radio-shell {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    min-height: 100dvh;
    background: var(--bg-base);
}

a {
    color: var(--accent);
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

/* ── Radio page layout ────────────────────────────────── */
.radio-page {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.25rem;
    background:
        radial-gradient(ellipse 80% 60% at 50% 0%, rgba(78,141,242,0.12) 0%, transparent 70%),
        var(--bg-base);
}

/* ── Header ───────────────────────────────────────────── */
.radio-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.radio-header__logo {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.75rem;
}

.radio-header__dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 8px var(--green);
    animation: pulse-dot 2s ease-in-out infinite;
}

.radio-header__dot--idle {
    background: var(--text-muted);
    box-shadow: none;
    animation: none;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.6; transform: scale(0.85); }
}

.radio-header__title {
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-primary);
}

.radio-header__subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

/* ── Player card ──────────────────────────────────────── */
.radio-card {
    width: 100%;
    max-width: 720px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    backdrop-filter: blur(12px);
}

/* ── Now playing ──────────────────────────────────────── */
.radio-now {
    margin-bottom: 1.75rem;
    text-align: center;
}

.radio-now__eyebrow {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.radio-now__track {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
    min-height: 1.6em;
}

.radio-now__track-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.7rem;
}

.radio-like-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid rgba(240,90,78,0.24);
    border-radius: var(--radius-pill);
    background: rgba(240,90,78,0.08);
    color: rgba(255,190,199,0.92);
    cursor: pointer;
    transform: translateY(0) scale(1);
    transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease, color 0.16s ease;
}

.radio-like-btn:hover:not(:disabled) {
    border-color: rgba(240,90,78,0.58);
    background: rgba(240,90,78,0.16);
    box-shadow: 0 0 18px rgba(240,90,78,0.2);
    transform: translateY(-1px) scale(1.04);
}

.radio-like-btn:active:not(:disabled) {
    transform: translateY(0) scale(0.96);
}

.radio-like-btn:disabled {
    cursor: default;
    opacity: 0.38;
}

.radio-like-btn__heart {
    font-size: 1rem;
    line-height: 1;
    transform-origin: center;
}

/* Calibración: acción secundaria, discreta — la usa el dueño una vez por dispositivo. */
.radio-calibrate-btn {
    margin-top: 0.4rem;
    padding: 0.18rem 0.6rem;
    border: 1px solid rgba(255,255,255,0.14);
    border-radius: var(--radius-pill);
    background: transparent;
    color: rgba(255,255,255,0.42);
    font-size: 0.7rem;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: color 0.16s ease, border-color 0.16s ease;
}

.radio-calibrate-btn:hover:not(:disabled) {
    color: rgba(255,255,255,0.78);
    border-color: rgba(255,255,255,0.3);
}

.radio-calibrate-btn:disabled {
    cursor: default;
    opacity: 0.4;
}

.radio-calibrate-hint {
    margin: 0.25rem 0 0;
    font-size: 0.68rem;
    color: rgba(255,255,255,0.38);
}

.radio-like-btn.is-liked {
    border-color: rgba(240,90,78,0.72);
    background: rgba(240,90,78,0.2);
    color: #ff6b7f;
}

.radio-like-btn.just-liked .radio-like-btn__heart {
    animation: like-pop 0.5s cubic-bezier(.2,1.7,.35,1);
}

.radio-like-btn.has-error {
    animation: like-shake 0.24s ease;
}

@keyframes like-pop {
    0% { transform: scale(1); }
    35% { transform: scale(1.48) rotate(-10deg); }
    68% { transform: scale(0.92) rotate(5deg); }
    100% { transform: scale(1); }
}

@keyframes like-shake {
    0%, 100% { transform: translateX(0); }
    35% { transform: translateX(-2px); }
    70% { transform: translateX(2px); }
}

.radio-now__track-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 8px var(--green);
    flex-shrink: 0;
    animation: pulse-dot 2s ease-in-out infinite;
}

.radio-now__meta {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-top: 0.35rem;
}

/* ── Status chips ─────────────────────────────────────── */
.radio-chips {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 0.9rem;
}

.radio-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.7rem;
    border-radius: var(--radius-pill);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    border: 1px solid transparent;
}

.radio-chip--live {
    background: var(--green-dim);
    border-color: rgba(62,208,164,0.25);
    color: var(--green);
}

.radio-chip--idle {
    background: rgba(255,255,255,0.04);
    border-color: var(--border);
    color: var(--text-muted);
}

.radio-chip--accent {
    background: var(--accent-dim);
    border-color: var(--border-accent);
    color: var(--accent);
}

/* ── Audio player ─────────────────────────────────────── */
.radio-player-wrap {
    margin-bottom: 1.5rem;
}

.radio-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255,255,255,0.05);
    border-radius: var(--radius-pill);
    padding: 6px 16px 6px 6px;
    height: 44px;
}

.radio-play-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: var(--purple);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 0 16px rgba(168,85,247,0.35);
    transition: background 0.15s, box-shadow 0.15s, transform 0.1s;
}

.radio-play-btn:hover {
    background: #9333ea;
    box-shadow: 0 0 22px rgba(168,85,247,0.55);
    transform: scale(1.05);
}

.radio-play-btn:active {
    transform: scale(0.95);
}

.radio-live-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--green);
}

.radio-live-badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 8px rgba(62,208,164,0.75);
    animation: pulse-dot 2s ease-in-out infinite;
}

.radio-volume {
    display: inline-flex;
    align-items: center;
    gap: 0;
    margin-left: auto;
    color: rgba(127,182,255,0.82);
}

.radio-volume__btn {
    background: none;
    border: none;
    cursor: pointer;
    color: inherit;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    opacity: 0.85;
    transition: opacity 0.15s;
}

.radio-volume__btn:hover {
    opacity: 1;
}

.radio-volume__icon {
    flex-shrink: 0;
    display: block;
}

.radio-volume__slider-wrap {
    overflow: hidden;
    width: 0;
    opacity: 0;
    transition: width 0.25s ease, opacity 0.2s ease;
}

.radio-volume:hover .radio-volume__slider-wrap {
    width: 100px;
    opacity: 1;
}

.radio-volume__slider {
    width: 100px;
    height: 4px;
    accent-color: var(--purple);
    cursor: pointer;
    display: block;
    margin-left: 6px;
}

.radio-volume__slider::-webkit-slider-runnable-track {
    height: 4px;
    border-radius: var(--radius-pill);
    background: rgba(127,182,255,0.22);
}

.radio-volume__slider::-webkit-slider-thumb {
    margin-top: -5px;
}

.radio-volume__slider::-moz-range-track {
    height: 4px;
    border-radius: var(--radius-pill);
    background: rgba(127,182,255,0.22);
}

/* ── Offline / idle state ─────────────────────────────── */
.radio-offline {
    text-align: center;
    padding: 1.5rem 1rem;
}

.radio-offline__icon {
    font-size: 2rem;
    line-height: 1;
    margin-bottom: 0.6rem;
    opacity: 0.4;
}

.radio-offline__msg {
    font-size: 0.88rem;
    color: var(--text-secondary);
}

/* ── Links row ────────────────────────────────────────── */
.radio-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
}

.radio-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 1rem;
    border-radius: var(--radius-pill);
    font-size: 0.8rem;
    font-weight: 500;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    background: transparent;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.radio-link:hover {
    border-color: var(--border-accent);
    color: var(--accent);
    background: var(--accent-dim);
    text-decoration: none;
}

/* ── Footer ───────────────────────────────────────────── */
.radio-footer {
    margin-top: 2.5rem;
    text-align: center;
    font-size: 0.72rem;
    color: var(--text-muted);
}

/* ── Error boundary ───────────────────────────────────── */
.blazor-error-boundary {
    background: var(--red-dim);
    border: 1px solid rgba(240,90,78,0.3);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    color: var(--red);
    font-size: 0.82rem;
}

/* ── Visualizer background canvas ───────────────────── */
.visualizer-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    width: 100%;
    height: 100%;
    display: block;
    pointer-events: none;
}

/* ── DJ page layout ──────────────────────────────────── */
.dj-stack {
    position: relative;
    z-index: 10;
    width: min(1400px, 66vw);
    display: flex;
    flex-direction: column;
    gap: 32px;
    align-items: center;
    padding: 56px 22px 32px;
    margin: 0 auto;
    min-height: 100dvh;
    justify-content: flex-start;
}

/* ── Glass card ──────────────────────────────────────── */
.dj-card {
    width: 100%;
    padding: 30px 40px;
    border-radius: 24px;
    background: rgba(7,30,36,0.3);
    border: 1px solid rgba(217,70,239,0.15);
    box-shadow: 0 0 40px rgba(7,30,36,0.4);
    position: relative;
    backdrop-filter: blur(4px);
    outline: none;
}

.dj-card::before {
    content: "";
    position: absolute;
    inset: -1px;
    border-radius: 26px;
    background: linear-gradient(90deg,
        rgba(0,229,255,0.22),
        rgba(168,85,247,0.28),
        rgba(0,229,255,0.18));
    filter: blur(14px);
    opacity: 0.18;
    z-index: -1;
}

/* ── Title card — sin fondo ni borde, solo el texto ─── */
.title-card {
    text-align: center;
    background: transparent;
    border: none;
    box-shadow: none;
    backdrop-filter: none;
    padding: 10px 40px;
}

.title-card::before {
    display: none;
}

.title-link {
    text-decoration: none;
    cursor: pointer;
    transition: opacity 0.2s;
}
.title-link:hover { opacity: 0.8; }

h1 {
    margin: 0;
    font-size: clamp(32px, 5vw, 64px);
    font-weight: 500;
    letter-spacing: 0.05em;
    color: var(--txt);
    text-shadow:
        0 0 10px rgba(168,85,247,0.6),
        0 0 20px rgba(0,229,255,0.3);
    white-space: nowrap;
}

/* ── Mixcloud player container ───────────────────────── */
.mc-player {
    min-height: 140px;
    background: rgba(0,0,0,0.3);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mc-player__loading {
    font-size: 0.8rem;
    color: var(--text-muted, #4e6882);
}

/* ── Radio card — centrado, algo más ancha para alojar Top tracks ── */
.radio-card {
    width: min(720px, 100%);
    padding: 28px 36px;
    align-self: center;
    margin-top: 24px;
}

/* ── Top tracks (dentro de radio-card) ───────────────── */
.top-tracks {
    margin-top: 28px;
    animation: top-tracks-fade-in 0.5s ease both;
}

.top-tracks__eyebrow {
    text-align: center;
    margin-bottom: 12px;
}

@keyframes top-tracks-fade-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.top-tracks__tabs {
    display: flex;
    gap: 6px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.top-tracks__tab {
    padding: 5px 14px;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-pill, 999px);
    color: var(--text-muted, #9fb0c3);
    font-size: 0.74rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.top-tracks__tab:hover {
    border-color: rgba(217,70,239,0.35);
}

.top-tracks__tab--active {
    background: rgba(217,70,239,0.18);
    border-color: rgba(217,70,239,0.5);
    color: var(--txt);
}

/* Alto reservado para 10 filas (PageSize) para que el card no cambie de
   tamaño (y no "salte" en la página) al cambiar de período/página con menos
   resultados. */
.top-tracks__body {
    display: flex;
    flex-direction: column;
    min-height: calc(10 * 46px + 9 * 4px);
}

.top-tracks__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: opacity 0.15s ease;
}

.top-tracks__list--loading {
    opacity: 0.35;
}

.top-tracks__item {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 46px;
    padding: 0 10px;
    border-radius: 10px;
    transition: background 0.16s ease;
}

.top-tracks__item:hover {
    background: rgba(217,70,239,0.06);
}

.top-tracks__item--enter {
    animation: top-tracks-item-in 0.32s ease both;
}

@keyframes top-tracks-item-in {
    from { opacity: 0; transform: translateX(-6px); }
    to   { opacity: 1; transform: translateX(0); }
}

.top-tracks__item:nth-child(odd) {
    background: rgba(255,255,255,0.02);
}

.top-tracks__rank {
    flex: 0 0 auto;
    min-width: 28px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted, #9fb0c3);
    text-align: right;
}

.top-tracks__meta {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}

.top-tracks__title {
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--txt);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.top-tracks__artist {
    font-size: 0.76rem;
    color: var(--text-muted, #9fb0c3);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.top-tracks__count {
    flex: 0 0 auto;
    font-size: 0.76rem;
    font-weight: 600;
    color: rgba(217,70,239,0.9);
}

.top-tracks__empty {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted, #9fb0c3);
    padding: 12px 0;
}

.top-tracks__empty[hidden] {
    display: none;
}

.top-tracks__pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 14px;
}

.top-tracks__page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.12);
    background: transparent;
    color: var(--txt);
    cursor: pointer;
    transition: background 0.16s ease, border-color 0.16s ease;
}

.top-tracks__page-btn:hover:not(:disabled) {
    background: rgba(217,70,239,0.14);
    border-color: rgba(217,70,239,0.4);
}

.top-tracks__page-btn:disabled {
    opacity: 0.3;
    cursor: default;
}

.top-tracks__page-indicator {
    font-size: 0.76rem;
    color: var(--text-muted, #9fb0c3);
    min-width: 44px;
    text-align: center;
}

/* ── Footer ──────────────────────────────────────────── */
.dj-footer {
    text-align: center;
    font-size: 0.72rem;
    color: var(--text-muted, #4e6882);
    padding-bottom: 1rem;
}

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 760px) {
    .dj-stack {
        width: 95vw;
        padding: 28px 12px 20px;
        gap: 22px;
    }
    .dj-card {
        padding: 20px;
        border-radius: 16px;
    }
    .title-card {
        padding: 8px 20px;
    }
    .radio-card {
        width: 100%;
        padding: 20px;
        margin-top: 10px;
    }
    .radio-volume__slider {
        width: 76px;
    }
    h1 {
        font-size: 28px;
        white-space: normal;
    }
    .top-tracks__title,
    .top-tracks__artist {
        max-width: 42vw;
    }
}
