:root {
    --accent: #d51007;
    --accent-soft: rgba(213, 16, 7, 0.35);
    --scrim: rgba(8, 8, 12, 0.72);
    --fg: #f5f5f7;
    --fg-dim: rgba(245, 245, 247, 0.65);
    --card-bg: rgba(255, 255, 255, 0.06);
    --card-border: rgba(255, 255, 255, 0.12);
    --radius: 16px;
    --transition-slow: 900ms ease;
    --color-transition: 5s ease;
}

* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--fg);
    background: #0b0b10;
    overflow-x: hidden;
}

/* --- Dynamic background: two crossfading layers built from the current album art --- */

.bg {
    position: fixed;
    inset: 0;
    z-index: -2;
    background: #0b0b10;
}

.bg-layer {
    position: absolute;
    inset: -5%;
    background-size: cover;
    background-position: center;
    filter: blur(60px) saturate(1.3);
    transform: scale(1.1);
    opacity: 0;
    transition: opacity var(--transition-slow), background-image 0ms;
}

.bg-layer.visible {
    opacity: 1;
}

.bg-scrim {
    position: fixed;
    inset: 0;
    z-index: -1;
    background: linear-gradient(180deg, var(--scrim), rgba(8, 8, 12, 0.9));
    transition: background var(--transition-slow);
}

/* --- Layout --- */

.wrap {
    max-width: 1080px;
    margin: 0 auto;
    padding: 32px 20px 64px;
}

.site-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 28px;
    flex-wrap: wrap;
}

.site-header h1 {
    font-size: 1.4rem;
    margin: 0;
    letter-spacing: 0.02em;
}

.site-header .updated {
    font-size: 0.8rem;
    color: var(--fg-dim);
}

.error-banner {
    background: rgba(213, 16, 7, 0.2);
    border: 1px solid rgba(213, 16, 7, 0.5);
    padding: 14px 18px;
    border-radius: var(--radius);
    margin-bottom: 24px;
    font-size: 0.9rem;
}

/* --- Now playing hero --- */

.now-playing {
    display: flex;
    gap: 24px;
    align-items: center;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 24px;
    margin-bottom: 32px;
    transition: border-color var(--transition-slow), backdrop-filter 150ms ease;
}

/* Toggled by assets/app.js while the hero's art tooltip is open and
   overlapping this card — see positionArtTooltip()/setBlurSuppressed() for
   why: Chromium has a confirmed bug where a backdrop-filter element's
   content bleeds through another backdrop-filter element positioned over
   it, regardless of z-index. Dropping the blur on both sides for the
   tooltip's duration avoids it without moving any layout. */
.now-playing.blur-suppressed,
.panel.blur-suppressed {
    backdrop-filter: none;
}

.art-tile {
    position: relative;
    width: 140px;
    height: 140px;
    flex: none;
    border-radius: 16px;
    overflow: hidden;
    background: linear-gradient(135deg, var(--accent), #222);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
    transition: background var(--color-transition);
}

.art-tile img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.art-tile-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 3rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7);
}

/* Hover-info tooltip, shared by the now-playing hero art, the previously-
   played thumb, and every track-row thumbnail. The wrapper carries
   position:relative (and flex:none, harmless outside a flex container) so
   the tooltip — not clipped by the art's own overflow:hidden, since it's a
   sibling rather than a child of it — can anchor against it. */
.art-hover {
    position: relative;
    flex: none;
}

.art-tooltip {
    position: absolute;
    bottom: 100%;
    left: 0;
    margin-bottom: 10px;
    min-width: 170px;
    max-width: 260px;
    padding: 10px 12px;
    border-radius: 10px;
    background: #121216;
    border: 1px solid var(--card-border);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.5);
    opacity: 0;
    pointer-events: none;
    transform: translateY(4px);
    transition: opacity 150ms ease, transform 150ms ease;
    z-index: 30;
}

.art-hover:hover .art-tooltip {
    opacity: 1;
    transform: translateY(0);
}

/* Toggled by assets/app.js on hover when there's no room above the trigger
   to open the tooltip upward (the default) without clipping it above the
   viewport — see positionArtTooltip(). */
.art-hover-below .art-tooltip {
    bottom: auto;
    top: 100%;
    margin-bottom: 0;
    margin-top: 10px;
}

.art-tooltip-track {
    font-size: 0.85rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.art-tooltip-artist {
    margin-top: 2px;
    font-size: 0.78rem;
    color: var(--fg-dim);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.art-tooltip-album {
    margin-top: 2px;
    font-size: 0.74rem;
    color: var(--fg-dim);
    opacity: 0.75;
    font-style: italic;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.art-tooltip-stats {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.72rem;
    color: var(--fg-dim);
    white-space: nowrap;
}

.art-tooltip-you {
    margin-top: 3px;
    font-size: 0.72rem;
    color: var(--accent);
    font-weight: 600;
    white-space: nowrap;
    transition: color var(--color-transition);
}

.art-tooltip-rank {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.72rem;
    color: var(--fg-dim);
    white-space: nowrap;
}

.art-tooltip-first {
    margin-top: 3px;
    font-size: 0.72rem;
    color: var(--fg-dim);
    white-space: nowrap;
}

.art-tooltip-recency {
    margin-top: 3px;
    font-size: 0.74rem;
    color: var(--accent);
    font-weight: 700;
    white-space: normal;
    transition: color var(--color-transition);
}

.art-tooltip-films {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.72rem;
    color: var(--fg-dim);
    white-space: normal;
}

.now-playing .info {
    min-width: 0;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--fg-dim);
    margin-bottom: 8px;
}

.status-badge.live {
    color: var(--accent);
    transition: color var(--color-transition);
}

.eq {
    display: inline-flex;
    align-items: flex-end;
    gap: 2px;
    height: 12px;
}

.eq span {
    width: 3px;
    background: var(--accent);
    animation: eq 900ms ease-in-out infinite;
    border-radius: 2px;
    transition: background var(--color-transition);
}

.eq span:nth-child(1) { animation-delay: 0ms; }
.eq span:nth-child(2) { animation-delay: 150ms; }
.eq span:nth-child(3) { animation-delay: 300ms; }

@keyframes eq {
    0%, 100% { height: 3px; }
    50% { height: 12px; }
}

/* .track-name is a flex row (truncating name-text + an always-visible
   heart) rather than letting the heart sit inside the name's own
   white-space:nowrap/ellipsis box, where a long, truncated name would
   push it out of view entirely. */
.now-playing .track-name {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    margin: 0 0 4px;
}

.now-playing .track-name .track-name-text {
    font-size: 1.6rem;
    font-weight: 700;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* The little "loved on Last.fm" badge, used inline next to a track name
   wherever one's shown — the hero, the previously-played card, and every
   Favourite Tracks/Trending row. A tinted, bordered circle rather than a
   bare icon so it actually catches the eye among everything else on the
   row instead of blending into the text. */
.loved-heart-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    flex: none;
    border-radius: 50%;
    background: rgba(255, 59, 107, 0.16);
    border: 1px solid rgba(255, 59, 107, 0.55);
    box-shadow: 0 0 6px rgba(255, 59, 107, 0.35);
}

.loved-heart {
    display: block;
    color: #ff3b6b;
}

.grammy-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    flex: none;
    border-radius: 50%;
    background: rgba(255, 196, 64, 0.16);
    border: 1px solid rgba(255, 196, 64, 0.55);
    box-shadow: 0 0 6px rgba(255, 196, 64, 0.35);
}

.grammy-icon {
    display: block;
    color: #ffc440;
}

/* Sales certification disc (see renderCertBadge()) — coloured by the
   highest tier reached, with the multiplier beside it for multi-Platinum
   and multi-Diamond. */
.cert-badge {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    flex: none;
    height: 20px;
    padding: 0 4px;
    border-radius: 10px;
    cursor: default;
}

.cert-icon {
    display: block;
}

.cert-multiplier {
    font-size: 0.66rem;
    font-weight: 700;
    line-height: 1;
}

.cert-multiplier:empty {
    display: none;
}

.cert-silver {
    color: #c9ced6;
    background: rgba(201, 206, 214, 0.16);
}

.cert-gold {
    color: #e8b84a;
    background: rgba(232, 184, 74, 0.16);
}

.cert-platinum {
    color: #e6eef5;
    background: rgba(160, 190, 215, 0.22);
}

.cert-diamond {
    color: #9fe7ff;
    background: rgba(120, 220, 255, 0.18);
}

/* The boxed "E" streaming services use for explicit tracks. Sized in em so
   it scales with whichever track-name line it sits on. */
.explicit-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    min-width: 1.35em;
    height: 1.35em;
    padding: 0 0.2em;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.22);
    color: var(--fg);
    font-size: 0.62em;
    font-weight: 700;
    font-style: normal;
    line-height: 1;
    letter-spacing: 0;
    vertical-align: middle;
    cursor: default;
}

.now-playing .track-artist {
    margin: 0;
    color: var(--fg-dim);
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.now-playing .track-album {
    margin: 4px 0 0;
    color: var(--fg-dim);
    font-size: 0.85rem;
    opacity: 0.8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.listen-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
}

.listen-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--fg);
    font-size: 0.78rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 150ms ease, transform 150ms ease;
}

.listen-link:hover {
    background: rgba(255, 255, 255, 0.16);
    transform: translateY(-1px);
}

.listen-spotify svg {
    color: #1db954;
}

.listen-youtube svg {
    color: #ff0000;
}

.listen-apple svg {
    color: #fa57c1;
}

.listen-amazon svg {
    color: #00a8e1;
}

.listen-video svg {
    color: #ff0000;
}

.prev-track {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
    padding-left: 24px;
    border-left: 1px solid var(--card-border);
    flex: none;
    max-width: 220px;
}

.prev-track-thumb {
    position: relative;
    width: 56px;
    height: 56px;
    flex: none;
    border-radius: 10px;
    overflow: hidden;
    background: linear-gradient(135deg, var(--accent-soft), rgba(255, 255, 255, 0.08));
    transition: background var(--color-transition);
}

.prev-track-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.prev-track-thumb-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--fg);
}

.prev-track-info {
    min-width: 0;
}

.prev-track-label {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--fg-dim);
    margin-bottom: 4px;
}

.prev-track-name {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
}

.prev-track-name .track-name-text {
    font-size: 0.88rem;
    font-weight: 600;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.prev-track-artist {
    font-size: 0.78rem;
    color: var(--fg-dim);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mini-listen-links {
    display: flex;
    gap: 4px;
    margin-top: 4px;
}

.mini-listen-links:empty {
    display: none;
}

.mini-listen-links .listen-icon {
    width: 20px;
    height: 20px;
}

/* JS refills these with the 14px hover-link icons; keep them at the
   server-rendered 12px so the row doesn't resize on the first poll. */
.mini-listen-links svg {
    width: 12px;
    height: 12px;
}

/* --- Panels --- */

.panels {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

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

    .now-playing {
        flex-direction: column;
        align-items: flex-start;
        text-align: left;
    }

    .art-tile {
        width: 100%;
        height: 200px;
    }

    .prev-track {
        margin-left: 0;
        padding-left: 0;
        padding-top: 16px;
        border-left: none;
        border-top: 1px solid var(--card-border);
        width: 100%;
        max-width: none;
    }
}

.panel {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(20px);
    border-radius: var(--radius);
    padding: 20px;
}

.panel h2 {
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--fg-dim);
    margin: 0 0 16px;
}

.track-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.track-row {
    display: grid;
    grid-template-columns: 22px 40px 1fr auto;
    align-items: center;
    gap: 12px;
}

.track-row .rank {
    color: var(--fg-dim);
    font-size: 0.8rem;
    text-align: right;
}

.track-row .thumb {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    overflow: hidden;
    background: linear-gradient(135deg, var(--accent-soft), rgba(255, 255, 255, 0.08));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--fg-dim);
    flex: none;
    transition: background var(--color-transition);
}

.track-row .thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.track-row .meta {
    min-width: 0;
}

.track-row .meta .name {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
}

.track-row .meta .name .track-name-text {
    font-size: 0.9rem;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.track-row .meta .artist {
    font-size: 0.78rem;
    color: var(--fg-dim);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.track-row .count {
    grid-column: 4;
    grid-row: 1;
    text-align: right;
    font-size: 0.78rem;
    color: var(--fg-dim);
    min-width: 64px;
    transition: opacity 150ms ease;
}

/* Overlaid on the same grid cell as .count, swapped in on hover so the row
   doesn't reflow or need extra width reserved when not hovered. */
.listen-links-hover {
    grid-column: 4;
    grid-row: 1;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 6px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 150ms ease;
}

.track-row:hover .count {
    opacity: 0;
    pointer-events: none;
}

.track-row:hover .listen-links-hover {
    opacity: 1;
    pointer-events: auto;
}

.listen-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    transition: background 150ms ease;
}

.listen-icon:hover {
    background: rgba(255, 255, 255, 0.2);
}

.listen-icon.listen-spotify {
    color: #1db954;
}

.listen-icon.listen-youtube {
    color: #ff0000;
}

.listen-icon.listen-apple {
    color: #fa57c1;
}

.listen-icon.listen-amazon {
    color: #00a8e1;
}

.listen-icon.listen-video {
    color: #ff0000;
}

.track-row .bar {
    height: 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.1);
    margin-top: 4px;
    overflow: hidden;
}

.track-row .bar-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
    transition: background var(--color-transition);
}

.panel-wide {
    margin-top: 24px;
}

.panel-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}

.panel-header-row h2 {
    margin: 0;
}

.genre-controls {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.genre-threshold-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    color: var(--fg-dim);
}

.genre-threshold-label select {
    background: rgba(255, 255, 255, 0.05);
    color: var(--fg);
    border: 1px solid var(--card-border);
    border-radius: 7px;
    padding: 5px 8px;
    font-size: 0.78rem;
    font-family: inherit;
    cursor: pointer;
}

.genre-legend-item.genre-hidden {
    display: none;
}

.period-picker {
    display: flex;
    gap: 4px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 3px;
}

.period-btn {
    border: none;
    background: transparent;
    color: var(--fg-dim);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 7px;
    cursor: pointer;
    transition: background 150ms ease, color 150ms ease;
}

.period-btn:hover {
    color: var(--fg);
}

.period-btn.active {
    background: var(--accent);
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.genre-bar {
    display: flex;
    width: 100%;
    height: 16px;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.06);
    margin-bottom: 18px;
}

.genre-segment {
    height: 100%;
    min-width: 2px;
    transition: opacity 200ms ease;
}

.genre-segment:hover {
    opacity: 0.8;
}

.genre-legend {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 10px 24px;
}

.genre-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
}

.genre-swatch {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    flex: none;
}

.genre-name {
    color: var(--fg);
}

.genre-pct {
    color: var(--fg-dim);
    font-size: 0.78rem;
}

.stats-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.stat-item {
    flex: 1 1 120px;
    text-align: center;
    padding: 12px 8px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
}

.stat-icon {
    display: block;
    margin: 0 auto 6px;
    color: var(--accent);
    transition: color var(--color-transition);
}

.stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--fg);
}

.stat-label {
    margin-top: 4px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--fg-dim);
}

@media (max-width: 480px) {
    .stat-item {
        flex-basis: 40%;
    }
}

.empty-state {
    color: var(--fg-dim);
    font-size: 0.85rem;
}

.site-footer {
    margin-top: 32px;
    text-align: center;
    font-size: 0.75rem;
    color: var(--fg-dim);
}

.site-footer a {
    color: inherit;
}

.lastfm-profile-line a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--fg-dim);
    text-decoration: none;
    transition: color 150ms ease;
}

.lastfm-profile-line a:hover {
    color: var(--fg);
    text-decoration: underline;
}

.lastfm-icon {
    color: #d51007;
    flex: none;
}

.powered-by-line {
    margin-top: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.powered-by-line a {
    display: inline-flex;
    color: var(--fg-dim);
    transition: color 150ms ease;
}

.powered-by-line a:hover {
    color: var(--fg);
}

.security-line {
    margin-top: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    flex-wrap: wrap;
}

.security-check {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--fg-dim);
    text-decoration: none;
    transition: color 150ms ease;
}

.security-check:hover {
    color: var(--fg);
    text-decoration: underline;
}

.security-check svg {
    flex: none;
}

.security-ok svg {
    color: #1db954;
}

.security-fail svg {
    color: #e5484d;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.version-line {
    margin-top: 6px;
    opacity: 0.8;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
}

.version-gh-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--fg-dim);
    text-decoration: none;
    transition: color 150ms ease;
}

.version-gh-link:hover {
    color: var(--fg);
    text-decoration: underline;
}

.version-muted {
    color: var(--fg-dim);
}

.version-ok {
    color: #6fd07c;
}

.cron-line {
    margin-top: 4px;
    font-size: 0.7rem;
    color: var(--fg-dim);
    opacity: 0.7;
}

.version-update {
    color: var(--accent);
    font-weight: 600;
    text-decoration: none;
    transition: color var(--color-transition);
}

.version-update:hover {
    text-decoration: underline;
}

/* --- Insight widgets --- */

.widget-grid {
    margin-top: 24px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 14px;
}

.widget-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    text-align: left;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 16px 18px;
    cursor: pointer;
    color: inherit;
    font: inherit;
    transition: border-color 200ms ease, transform 200ms ease, background 200ms ease;
}

.widget-card:hover {
    border-color: var(--accent-soft);
    background: rgba(255, 255, 255, 0.09);
    transform: translateY(-2px);
}

.widget-card:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.widget-card-icon {
    color: var(--accent);
    margin-bottom: 2px;
    transition: color var(--color-transition);
}

.widget-card-title {
    font-weight: 700;
    font-size: 0.95rem;
}

.widget-card-teaser {
    font-size: 0.8rem;
    color: var(--fg-dim);
    line-height: 1.35;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    background: rgba(4, 4, 6, 0.75);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay[hidden] {
    display: none;
}

.modal {
    position: relative;
    width: 100%;
    max-width: 560px;
    max-height: 85vh;
    overflow-y: auto;
    background: #14141a;
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 32px 28px 28px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.08);
    color: var(--fg);
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.16);
}

.widget-loading,
.widget-empty {
    color: var(--fg-dim);
    font-size: 0.9rem;
    text-align: center;
    padding: 24px 0;
}

.widget-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0 0 4px;
}

.widget-headline {
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    margin: 8px 0;
}

.widget-subtext {
    text-align: center;
    font-size: 0.8rem;
    color: var(--fg-dim);
    margin-top: 8px;
}

/* Listening clock */

.clock-svg {
    display: block;
    width: 100%;
    max-width: 260px;
    margin: 8px auto;
}

.clock-svg text {
    fill: var(--fg-dim);
    font-size: 9px;
}

/* Energy curve */

.energy-bars {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    height: 140px;
    margin: 16px 0 8px;
}

.energy-bar-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    height: 100%;
}

.energy-bar {
    width: 100%;
    border-radius: 6px 6px 0 0;
    background: var(--accent);
    min-height: 4px;
    transition: background var(--color-transition);
}

.energy-bar-col.peak .energy-bar {
    background: linear-gradient(180deg, #fff, var(--accent));
}

.energy-bar-label {
    font-size: 0.72rem;
    color: var(--fg-dim);
}

/* Distance listened */

.distance-list {
    list-style: none;
    margin: 16px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.distance-list li {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 8px;
}

.distance-count {
    font-weight: 700;
    color: var(--accent);
    transition: color var(--color-transition);
}

/* Distance Listened's rows additionally carry a progress bar for how far
   into the current unit you are — .distance-list li's flex row above still
   applies unchanged to Before They Were Famous's simpler two-column rows. */
.distance-list li.distance-row {
    display: block;
}

.distance-row-top {
    display: flex;
    justify-content: space-between;
}

.distance-bar {
    height: 5px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.1);
    margin-top: 8px;
    overflow: hidden;
}

.distance-bar-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    transition: background var(--color-transition);
}

/* Festival poster */

.festival-poster {
    text-align: center;
    padding: 12px 0;
}

.festival-poster-title {
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.festival-poster-sub {
    font-size: 0.75rem;
    color: var(--fg-dim);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-bottom: 18px;
}

.festival-tier {
    margin: 14px 0;
}

.festival-tier-headliner {
    font-size: 1.6rem;
    font-weight: 800;
    line-height: 1.5;
}

.festival-tier-main {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--fg-dim);
    line-height: 1.6;
}

.festival-tier-tent {
    font-size: 0.85rem;
    color: var(--fg-dim);
    opacity: 0.75;
    line-height: 1.7;
}

/* Mood weather */

.mood-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 10px 0;
}

.mood-name {
    flex: none;
    width: 90px;
    font-size: 0.85rem;
    text-transform: capitalize;
}

.mood-bar-track {
    flex: 1;
    height: 10px;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
}

.mood-bar-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 5px;
    transition: background var(--color-transition);
}

.mood-pct {
    flex: none;
    width: 42px;
    text-align: right;
    font-size: 0.8rem;
    color: var(--fg-dim);
}

/* BPM heart-rate monitor — a looping ECG-style trace, one blip scrolling by
   per beat of the track's average BPM. Fixed "monitor green" rather than
   the page's dynamic accent colour, since the whole point is reading as a
   literal heart-rate monitor. .ecg-track's width and the -40px shift in
   ecg-scroll must stay in sync with ECG_UNIT_WIDTH in app.js. */

.ecg-monitor {
    position: relative;
    width: 100%;
    height: 90px;
    margin: 14px 0;
    border-radius: 10px;
    overflow: hidden;
    background:
        linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px),
        #0a100c;
    background-size: 20px 20px, 20px 20px, 100% 100%;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.ecg-track {
    height: 100%;
    animation-name: ecg-scroll;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
}

.ecg-track svg {
    display: block;
    height: 100%;
}

.ecg-trace {
    fill: none;
    stroke: #3dff88;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    filter: drop-shadow(0 0 4px rgba(61, 255, 136, 0.7));
}

@keyframes ecg-scroll {
    from { transform: translateX(0); }
    to   { transform: translateX(-40px); }
}
