:root {
    --accent: #c8102e;
    --accent-soft: rgba(200, 16, 46, 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 backdrop/poster --- */

.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(200, 16, 46, 0.2);
    border: 1px solid rgba(200, 16, 46, 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);
}

.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);
}

.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; }
}

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

.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);
}

/* Streaming Changes widget rows: a track-row without the rank column */

.track-row.change-row {
    grid-template-columns: 32px 1fr auto;
}

.change-service {
    display: flex;
    align-items: center;
    gap: 6px;
}

.change-service img {
    width: 16px;
    height: 16px;
    border-radius: 3px;
}

.change-watchlist {
    display: inline-block;
    margin-top: 4px;
    padding: 1px 6px;
    border-radius: 999px;
    background: var(--accent-soft);
    font-size: 0.68rem;
    font-weight: 600;
}

/* Streaming services the title's on, beside "View on Trakt" */

.watch-links {
    display: contents;
}

.watch-link img {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    flex: none;
}

.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: 320px;
}

.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;
    white-space: nowrap;
}

.prev-track-name {
    font-size: 0.88rem;
    font-weight: 600;
    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;
}

/* --- 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 {
    font-size: 0.9rem;
    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;
}

.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: var(--accent);
    transition: color var(--color-transition);
    flex: none;
}

.powered-by-line {
    margin-top: 6px;
    color: var(--fg-dim);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.powered-by-line a {
    display: inline-flex;
    opacity: 0.75;
    transition: opacity 150ms ease, transform 150ms ease;
}

.powered-by-line a:hover {
    opacity: 1;
    transform: translateY(-1px);
}

/* DNSSEC / security headers ticks, under Powered by */

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

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

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

.site-check-icon {
    width: 14px;
    height: 14px;
    stroke-width: 3;
}

.site-check-ok {
    color: #6fd07c;
}

.site-check-fail {
    color: #e5484d;
}

.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);
}

/* Trailer player: a wider modal holding a 16:9 video */

.modal-video .modal {
    max-width: 960px;
    padding: 44px 16px 16px;
}

.trailer-frame {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    border: 0;
    border-radius: 12px;
    background: #000;
}

.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);
}

/* --- Posters: portrait (2:3) versions of the square album-art tiles --- */

.art-tile-poster {
    width: 120px;
    height: 180px;
}

.prev-track-thumb-poster {
    width: 48px;
    height: 72px;
}

.track-row .thumb-poster {
    width: 32px;
    height: 48px;
    border-radius: 6px;
}

.track-row {
    grid-template-columns: 22px 32px 1fr auto;
}

.track-row .meta .name a {
    color: inherit;
    text-decoration: none;
}

.track-row .meta .name a:hover {
    text-decoration: underline;
}

@media (max-width: 720px) {
    .art-tile.art-tile-poster {
        width: 120px;
        height: 180px;
    }
}

.listen-link-icon {
    width: 16px;
    height: 16px;
    color: var(--accent);
    transition: color var(--color-transition);
}

/* --- Live watch progress (scrobble/check-in start → expected end) --- */

.watch-progress {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    max-width: 360px;
}

.watch-progress-bar {
    flex: 1;
    height: 5px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.12);
    overflow: hidden;
}

.watch-progress-fill {
    height: 100%;
    width: 0;
    background: var(--accent);
    border-radius: 3px;
    transition: width 1s linear, background var(--color-transition);
}

.watch-progress-label {
    font-size: 0.75rem;
    color: var(--fg-dim);
    white-space: nowrap;
}

/* --- History-sync status --- */

.sync-banner {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    padding: 12px 18px;
    border-radius: var(--radius);
    margin-bottom: 24px;
    font-size: 0.85rem;
    color: var(--fg-dim);
}

/* --- Widget extras --- */

.widget-section-label {
    margin: 20px 0 8px;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--fg-dim);
}

.modal .track-list {
    margin-top: 16px;
}

.decade-bars,
.rating-bars {
    gap: 6px;
}

/* Streaks: GitHub-style calendar, one column per week, Monday on top.
   Columns share the available width (squares sized to fit) rather than
   being a fixed size, so the whole year fits without a scrollbar. */

.streak-grid-wrap {
    margin: 16px 0 8px;
}

.streak-grid {
    display: grid;
    grid-template-rows: repeat(7, auto);
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    gap: 2px;
    width: 100%;
}

.streak-cell {
    aspect-ratio: 1;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.06);
}

.streak-cell.streak-l1 { background: var(--accent); opacity: 0.35; }
.streak-cell.streak-l2 { background: var(--accent); opacity: 0.55; }
.streak-cell.streak-l3 { background: var(--accent); opacity: 0.8; }
.streak-cell.streak-l4 { background: var(--accent); opacity: 1; }

/* Hot takes */

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

.take-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 0.85rem;
}

.take-title {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.take-scores {
    flex: none;
    color: var(--fg-dim);
    font-size: 0.78rem;
}

/* --- auth.php --- */

.auth-wrap {
    max-width: 520px;
}

.auth-code {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.auth-link {
    color: var(--accent);
    margin-left: 12px;
}

/* --- Score chips (IMDb / Trakt viewer rating / Rotten Tomatoes Popcornmeter) --- */

.rating-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}

.rating-chip {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 1px 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--fg);
    white-space: nowrap;
}

.rating-label {
    font-weight: 700;
}

.rating-imdb .rating-label {
    color: #f5c518;
}

.rating-trakt .rating-label {
    color: #ed2224;
}

.hero-ratings .rating-chips {
    margin-top: 10px;
}

.hero-ratings .rating-chip {
    font-size: 0.75rem;
    padding: 3px 9px;
}

/* The previously-watched card is narrow, so its chips are smaller and
   kept to one row: any that don't fit are hidden whole (they wrap onto a
   second row that's clipped away) instead of stacking up untidily. */
.prev-track .rating-chips {
    margin-top: 6px;
    max-height: 18px;
    overflow: hidden;
}

.prev-track .rating-chip {
    font-size: 0.66rem;
    line-height: 18px;
    padding: 0 6px;
}

/* Awards chip: titles with nominations but no wins are dimmer */

.rating-awards.rating-noms {
    color: var(--fg-dim);
}

/* Set by fitAwardChips() in app.js when the chip would wrap to a new row */
.rating-awards.compact .rating-value {
    display: none;
}

/* Show progress chip: episodes watched vs. aired */

.rating-progress .rating-label {
    color: var(--fg-dim);
}

.rating-progress.rating-complete .rating-label {
    color: #6fd07c;
}

/* --- Poster hover card (shows and films) --- */

.info-card {
    position: absolute;
    z-index: 60; /* above the widget modal (50), whose Binge Report rows have posters too */
    width: 340px;
    max-width: calc(100vw - 24px);
    background: #14141a;
    border: 1px solid var(--card-border);
    border-radius: 14px;
    padding: 14px 16px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55);
    font-size: 0.82rem;
    pointer-events: none;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 120ms ease, transform 120ms ease;
}

.info-card.visible {
    opacity: 1;
    transform: none;
}

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

.info-card-tagline {
    margin-top: 2px;
    font-style: italic;
    color: var(--fg-dim);
}

.info-card-facts,
.info-card-genres {
    color: var(--fg-dim);
    margin-top: 3px;
}

/* BBFC symbol at the start of the facts line */
.cert-badge {
    height: 20px;
    width: auto;
    vertical-align: middle;
    margin: -2px 6px 0 0;
}

.info-card-watch {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 10px;
    margin-top: 6px;
}

.info-card-watch-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-weight: 600;
}

.info-card-watch-item img {
    width: 16px;
    height: 16px;
    border-radius: 3px;
}

.info-card .rating-chips {
    margin-top: 8px;
}

.info-card-overview {
    margin: 10px 0 0;
    line-height: 1.45;
    color: var(--fg);
    display: -webkit-box;
    -webkit-line-clamp: 6;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.info-card-rows {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 4px 10px;
    margin: 10px 0 0;
    padding-top: 10px;
    border-top: 1px solid var(--card-border);
}

.info-card-rows dt {
    color: var(--fg-dim);
}

.info-card-rows dd {
    margin: 0;
}
