/* ═══════════════════════════════════════════════════════════════════
   iTunes Explorer — "Vinyl Noir" Design System
   ═══════════════════════════════════════════════════════════════════ */

/* ── Design Tokens ── */
:root {
    /* Surfaces */
    --bg-deep:       #0a0a0e;
    --bg-base:       #0d0d12;
    --bg-surface:    #141419;
    --bg-elevated:   #1a1a22;
    --bg-hover:      #22222e;

    /* Borders */
    --border-subtle:  rgba(212, 160, 74, 0.08);
    --border-medium:  rgba(212, 160, 74, 0.15);
    --border-accent:  rgba(212, 160, 74, 0.30);

    /* Accent palette */
    --gold:          #d4a04a;
    --gold-dim:      #b8893e;
    --gold-glow:     rgba(212, 160, 74, 0.15);
    --copper:        #b87333;
    --teal:          #2d9e9e;
    --coral:         #e07a5f;
    --slate:         #7b68ee;

    /* Text */
    --text-primary:   #ede4d4;
    --text-secondary: #9a9490;
    --text-tertiary:  #5e5a56;
    --text-gold:      #d4a04a;

    /* Typography */
    --font-display: 'Cormorant Garamond', 'Georgia', serif;
    --font-body:    'Manrope', 'Segoe UI', system-ui, sans-serif;

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 40px;
    --space-2xl: 64px;

    /* Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-full: 9999px;

    /* Transitions */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ── Reset & Base ── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    font-weight: 400;
    color: var(--text-primary);
    background: var(--bg-deep);
    line-height: 1.55;
    min-height: 100vh;
    overflow-x: hidden;

    /* Vinyl grooves background */
    background-image:
        repeating-radial-gradient(
            circle at 50% 130%,
            transparent 0,
            transparent 60px,
            rgba(212, 160, 74, 0.012) 60px,
            rgba(212, 160, 74, 0.012) 61px
        );
    background-attachment: fixed;
}

/* ── Grain Overlay ── */
.grain {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.035;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 256px 256px;
}

/* ── Scrollbar ── */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-deep);
}
::-webkit-scrollbar-thumb {
    background: var(--bg-elevated);
    border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--bg-hover);
}

/* ── Top Navigation ── */
.top-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: rgba(10, 10, 14, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-subtle);
    transform: translateY(-100%);
    transition: transform 0.4s var(--ease-out);
}

.top-nav.visible {
    transform: translateY(0);
}

.nav-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 var(--space-lg);
    height: 56px;
    display: flex;
    align-items: center;
    gap: var(--space-lg);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    text-decoration: none;
    color: var(--text-primary);
    flex-shrink: 0;
}

.brand-icon {
    font-size: 1.4rem;
    color: var(--gold);
}

.brand-text {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.15rem;
    letter-spacing: 0.01em;
}

.nav-links {
    display: flex;
    gap: var(--space-xs);
    flex: 1;
    justify-content: center;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: var(--radius-full);
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    position: relative;
    white-space: nowrap;
}

.nav-link:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.nav-link.active {
    color: var(--gold);
    background: var(--gold-glow);
}

.nav-link-soon {
    opacity: 0.5;
}

.soon-badge {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--bg-deep);
    background: var(--text-tertiary);
    padding: 1px 5px;
    border-radius: var(--radius-full);
    margin-left: 2px;
}

.nav-actions {
    flex-shrink: 0;
}

.nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-medium);
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font-body);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.nav-btn:hover {
    color: var(--text-primary);
    border-color: var(--border-accent);
    background: var(--bg-hover);
}

/* ── Main Content ── */
.main-content {
    max-width: 1280px;
    margin: 0 auto;
    padding: var(--space-lg);
    min-height: 100vh;
}

.top-nav.visible ~ .main-content {
    padding-top: calc(56px + var(--space-xl));
}

/* ── Views ── */
.view {
    display: none;
}
.view.active {
    display: block;
    animation: viewIn 0.4s var(--ease-out);
}

@keyframes viewIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ═══════════════════════════════════════
   UPLOAD VIEW
   ═══════════════════════════════════════ */

.upload-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 85vh;
    text-align: center;
    padding: var(--space-xl) 0;
}

/* ── Vinyl Record ── */
.upload-hero {
    margin-bottom: var(--space-xl);
}

.vinyl-record {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    margin: 0 auto var(--space-xl);
    position: relative;
    background: radial-gradient(circle,
        #111 0%,
        #111 18%,
        #1a1a1a 18.5%,
        #151515 22%,
        #1a1a1a 22.5%,
        #151515 100%
    );
    box-shadow:
        0 0 0 3px rgba(212, 160, 74, 0.08),
        0 0 60px rgba(0, 0, 0, 0.5),
        inset 0 0 30px rgba(0, 0, 0, 0.4);
    transition: transform 0.4s var(--ease-out);
}

.vinyl-groove {
    position: absolute;
    inset: 8%;
    border-radius: 50%;
    background: repeating-radial-gradient(
        circle,
        transparent 0,
        transparent 3px,
        rgba(255, 255, 255, 0.03) 3px,
        rgba(255, 255, 255, 0.03) 4px
    );
}

.vinyl-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 38%;
    height: 38%;
    border-radius: 50%;
    background: radial-gradient(circle, var(--gold-dim) 0%, var(--copper) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.vinyl-hole {
    width: 12%;
    height: 12%;
    border-radius: 50%;
    background: var(--bg-deep);
}

.vinyl-record.spinning {
    animation: spin 1.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.upload-title {
    font-family: var(--font-display);
    font-size: clamp(2.2rem, 5vw, 3.4rem);
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.01em;
    line-height: 1.15;
    margin-bottom: var(--space-md);
}

.upload-subtitle {
    font-size: 1.05rem;
    color: var(--text-secondary);
    max-width: 460px;
    margin: 0 auto;
    line-height: 1.6;
}

/* ── Drop Zone ── */
.drop-zone {
    width: 100%;
    max-width: 520px;
    padding: var(--space-2xl) var(--space-xl);
    border: 2px dashed var(--border-medium);
    border-radius: var(--radius-lg);
    background: var(--bg-surface);
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: var(--space-lg);
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: var(--gold);
    background: rgba(212, 160, 74, 0.03);
    box-shadow: 0 0 40px rgba(212, 160, 74, 0.06);
}

.drop-zone-icon {
    font-size: 2.8rem;
    color: var(--gold-dim);
    display: block;
    margin-bottom: var(--space-md);
}

.drop-zone-text {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
}

.drop-zone-or {
    font-size: 0.8rem;
    color: var(--text-tertiary);
    margin-bottom: var(--space-md);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.btn-gold {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 28px;
    border: none;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--gold), var(--copper));
    color: var(--bg-deep);
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 4px 20px rgba(212, 160, 74, 0.2);
}

.btn-gold:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 28px rgba(212, 160, 74, 0.3);
    filter: brightness(1.1);
}

/* ── Upload Progress ── */
.upload-progress {
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
    width: 100%;
    max-width: 400px;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--bg-elevated);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--gold), var(--copper));
    border-radius: var(--radius-full);
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* ── Upload Error ── */
.upload-error {
    margin-top: var(--space-md);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
    background: rgba(224, 122, 95, 0.1);
    border: 1px solid rgba(224, 122, 95, 0.3);
    color: var(--coral);
    font-size: 0.85rem;
    max-width: 520px;
}

/* ── Help Section ── */
.upload-help {
    margin-top: var(--space-2xl);
    width: 100%;
    max-width: 600px;
}

.help-title {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: var(--space-lg);
}

.help-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.help-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    text-align: center;
}

.help-card-icon {
    font-size: 1.6rem;
    color: var(--gold-dim);
    margin-bottom: var(--space-sm);
    display: block;
}

.help-card h4 {
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
}

.help-card p {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.help-privacy {
    font-size: 0.8rem;
    color: var(--text-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
}

.help-privacy i {
    color: var(--teal);
}

/* ═══════════════════════════════════════
   DASHBOARD VIEW
   ═══════════════════════════════════════ */

.dashboard {
    padding: var(--space-lg) 0;
}

/* ── Hero Stats ── */
.hero-stats {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
}

.hero-stat {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-xl) var(--space-lg);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero-stat::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--gold), transparent);
    opacity: 0.5;
}

.hero-stat-icon {
    font-size: 1.5rem;
    color: var(--gold-dim);
    display: block;
    margin-bottom: var(--space-sm);
}

.hero-stat-value {
    font-family: var(--font-display);
    font-size: clamp(1.6rem, 3vw, 2.2rem);
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    margin-bottom: var(--space-xs);
}

.hero-stat-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-tertiary);
}

/* ── Stat Grid ── */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

/* ── Stat Card ── */
.stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
}

.stat-card-wide {
    grid-column: span 1;
}

.stat-card-title {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-gold);
    margin-bottom: var(--space-md);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.stat-card-title i {
    font-size: 1rem;
    opacity: 0.7;
}

/* ── Stat Rows ── */
.stat-rows {
    display: flex;
    flex-direction: column;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 7px 0;
    border-bottom: 1px solid var(--border-subtle);
}

.stat-row:last-child {
    border-bottom: none;
}

.stat-label {
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.stat-value {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.stat-hint {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 13px;
    height: 13px;
    font-size: 9px;
    font-weight: 700;
    border-radius: 50%;
    border: 1px solid rgba(154, 148, 144, 0.45);
    color: rgba(154, 148, 144, 0.6);
    /* No opacity here — it cascades to ::after and makes tooltip transparent */
    cursor: help;
    margin-left: 4px;
    vertical-align: middle;
    line-height: 1;
    position: relative;
}

/* ── Custom CSS Tooltip (data-tooltip attribute) ── */
[data-tooltip] {
    position: relative;
}
[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: #22222e;
    color: #ddd8cc;
    font-size: 12px;
    font-family: var(--font-body);
    font-weight: 400;
    line-height: 1.5;
    padding: 8px 12px;
    border-radius: 7px;
    width: max-content;
    max-width: 280px;
    white-space: normal;
    word-wrap: break-word;
    z-index: 9000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
    border: 1px solid rgba(255,255,255,0.10);
    box-shadow: 0 6px 20px rgba(0,0,0,0.55);
    text-align: left;
}
[data-tooltip]::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 3px);
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: rgba(255,255,255,0.10);
    z-index: 9000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
}
[data-tooltip]:hover::after,
[data-tooltip]:hover::before {
    opacity: 1;
}
/* Pills show tooltip below (they're near the top of content) */
.pill[data-tooltip]::after {
    bottom: auto;
    top: calc(100% + 8px);
}
.pill[data-tooltip]::before {
    bottom: auto;
    top: calc(100% + 3px);
    border-top-color: transparent;
    border-bottom-color: rgba(255,255,255,0.10);
}

/* ── Release Type Badges ── */
.release-badge {
    display: inline-block;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.06em;
    padding: 1px 5px;
    border-radius: 3px;
    margin-left: 6px;
    vertical-align: middle;
    opacity: 0.8;
}
.release-badge--ep {
    background: rgba(45,158,158,0.15);
    color: var(--teal);
    border: 1px solid rgba(45,158,158,0.3);
}
.release-badge--single {
    background: rgba(224,122,95,0.15);
    color: var(--coral);
    border: 1px solid rgba(224,122,95,0.3);
}

/* ── Top Rows (snapshot cards) ── */
.top-rows {
    display: flex;
    flex-direction: column;
}

.top-row {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: 8px 0;
    border-bottom: 1px solid var(--border-subtle);
}

.top-row:last-child {
    border-bottom: none;
}

.top-rank {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--gold-dim);
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.top-name {
    font-size: 0.85rem;
    color: var(--text-primary);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.top-value {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

/* ═══════════════════════════════════════
   TOP LISTS VIEW
   ═══════════════════════════════════════ */

.toplists {
    padding: var(--space-lg) 0;
}

.toplists-controls {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-lg);
    margin-bottom: var(--space-xl);
    padding-bottom: var(--space-lg);
    border-bottom: 1px solid var(--border-subtle);
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.control-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-tertiary);
}

.pill-group {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.pill {
    padding: 5px 12px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-subtle);
    background: var(--bg-surface);
    color: var(--text-secondary);
    font-family: var(--font-body);
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.pill:hover {
    border-color: var(--border-medium);
    color: var(--text-primary);
    background: var(--bg-elevated);
}

.pill.active {
    background: var(--gold-glow);
    border-color: var(--gold);
    color: var(--gold);
    font-weight: 600;
}

/* ── Filter Select ── */
.filter-select {
    background: var(--bg-elevated);
    border: 1px solid var(--border-medium);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    padding: 5px 10px;
    font-family: var(--font-body);
    font-size: 0.8rem;
    cursor: pointer;
    max-width: 260px;
}

.filter-select:focus {
    outline: none;
    border-color: var(--gold);
}

.filter-select option {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

/* ── Data Table ── */
.top-table {
    width: 100%;
    border-collapse: collapse;
}

.top-table thead {
    position: sticky;
    top: 0;
}

.top-table th {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-tertiary);
    padding: var(--space-sm) var(--space-md);
    text-align: left;
    background: var(--bg-base);
    border-bottom: 1px solid var(--border-medium);
}

.top-table th.col-rank,
.top-table th.col-value {
    text-align: right;
}

.top-table td {
    padding: 10px var(--space-md);
    font-size: 0.84rem;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-primary);
}

.top-table td.col-rank {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    color: var(--gold-dim);
    text-align: right;
    width: 40px;
}

.top-table td.col-name {
    font-weight: 500;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.top-table td.col-detail {
    color: var(--text-secondary);
    font-size: 0.82rem;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.top-table td.col-value {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    text-align: right;
    color: var(--text-secondary);
    white-space: nowrap;
}

.top-table tbody tr {
    transition: background 0.1s ease;
}

.top-table tbody tr:hover {
    background: var(--bg-elevated);
}

/* ═══════════════════════════════════════
   CHARTS VIEW
   ═══════════════════════════════════════ */

.charts-page {
    padding: var(--space-lg) 0;
}

.charts-controls {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-lg);
    margin-bottom: var(--space-xl);
    padding-bottom: var(--space-lg);
    border-bottom: 1px solid var(--border-subtle);
}

.charts-bar-controls,
.charts-genre-controls {
    display: contents;
}

.chart-wrapper {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    position: relative;
    height: 500px;
    transition: height 0.3s ease;
}

/* ═══════════════════════════════════════
   TREE BROWSER VIEW
   ═══════════════════════════════════════ */

.tree-page {
    padding: var(--space-lg) 0;
}

.tree-search-bar {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-lg);
}

.tree-search-icon {
    color: var(--text-tertiary);
    font-size: 1rem;
    flex-shrink: 0;
}

.tree-search-input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.9rem;
}

.tree-search-input::placeholder {
    color: var(--text-tertiary);
}

.tree-count {
    font-size: 0.78rem;
    color: var(--text-tertiary);
    white-space: nowrap;
    flex-shrink: 0;
}

.tree-list {
    display: flex;
    flex-direction: column;
}

.tree-node {
    border-bottom: 1px solid var(--border-subtle);
}

.tree-node:last-child {
    border-bottom: none;
}

.tree-row {
    display: flex;
    align-items: flex-start;
    gap: var(--space-sm);
    padding: 10px var(--space-md);
    cursor: pointer;
    transition: background 0.1s ease;
    min-height: 42px;
}

/* ── Tree row body: vertical stack of name + stats ── */
.tree-row-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding-top: 1px;
}

.tree-name-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.tree-stats {
    font-size: 0.72rem;
    color: var(--text-tertiary);
    line-height: 1.4;
}

.tree-year-tag {
    font-size: 0.72rem;
    color: var(--text-secondary);
    opacity: 0.55;
    flex-shrink: 0;
}

.tree-expand {
    margin-top: 2px;
}

.tree-row:hover {
    background: var(--bg-elevated);
}

.tree-expand {
    width: 20px;
    text-align: center;
    color: var(--text-tertiary);
    font-size: 0.75rem;
    flex-shrink: 0;
    transition: transform 0.15s ease;
}

.tree-row-artist .tree-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.tree-row-album {
    padding-left: calc(var(--space-md) + 28px);
}

.tree-row-album .tree-name {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.85rem;
}

.tree-row-song {
    padding-left: calc(var(--space-md) + 56px);
    cursor: default;
    align-items: flex-start;
}

.tree-row-song:hover {
    background: var(--bg-elevated);
}

.tree-row-song .tree-name {
    font-size: 0.84rem;
    color: var(--text-primary);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tree-track-num {
    width: 28px;
    text-align: right;
    font-size: 0.78rem;
    color: var(--text-tertiary);
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

.tree-meta {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    margin-left: auto;
    white-space: nowrap;
    flex-shrink: 0;
}

.tree-song-stats {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    margin-left: auto;
    white-space: nowrap;
    flex-shrink: 0;
}

.tree-highlight {
    background: rgba(212, 160, 74, 0.06) !important;
}

.tree-highlight .tree-name {
    color: var(--gold) !important;
}

/* ═══════════════════════════════════════
   WRAPPED VIEW — INTRO PAGE
   ═══════════════════════════════════════ */

.wrapped-intro {
    padding: var(--space-xl) 0;
    text-align: center;
}

.wrapped-intro-content {
    max-width: 560px;
    margin: 0 auto var(--space-2xl);
}

.wrapped-vinyl {
    margin-bottom: var(--space-xl);
}

.wrapped-vinyl-record {
    width: 120px;
    height: 120px;
    margin: 0 auto;
    animation: spin 8s linear infinite;
}

.wrapped-intro-title {
    font-family: var(--font-display);
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.15;
    margin-bottom: var(--space-md);
}

.wrapped-intro-subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: var(--space-xl);
}

.wrapped-start-btn {
    font-size: 1rem;
    padding: 14px 36px;
    gap: 8px;
}

/* Preview cards */
.wrapped-preview-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-md);
    max-width: 720px;
    margin: 0 auto;
}

.wrapped-preview-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-lg) var(--space-md);
    text-align: center;
    transition: border-color 0.2s ease, transform 0.2s ease;
}

.wrapped-preview-card:hover {
    transform: translateY(-2px);
}

.wrapped-preview-card i {
    font-size: 1.4rem;
    display: block;
    margin-bottom: var(--space-sm);
}

.wrapped-preview-category {
    display: block;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-tertiary);
    margin-bottom: 4px;
}

.wrapped-preview-value {
    display: block;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ═══════════════════════════════════════
   WRAPPED — SLIDESHOW OVERLAY
   ═══════════════════════════════════════ */

.wrapped-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background-color: #07070b;
    background-image: radial-gradient(ellipse at 50% 40%, rgba(212,160,74,0.08) 0%, transparent 65%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.4s ease, background-image 0.6s ease;
    pointer-events: none;
}

.wrapped-overlay.visible {
    opacity: 1;
    pointer-events: all;
}

.wrapped-close {
    position: absolute;
    top: 20px;
    right: 24px;
    background: none;
    border: none;
    color: var(--text-tertiary);
    font-size: 1.3rem;
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-full);
    transition: color 0.2s, background 0.2s;
    z-index: 10;
}

.wrapped-close:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.wrapped-slide-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 640px;
    padding: var(--space-xl);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.wrapped-slide {
    text-align: center;
    position: relative;
}

.wrapped-slide-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, var(--accent) 0%, transparent 70%);
    opacity: 0.08;
    pointer-events: none;
}

.wrapped-slide-icon {
    font-size: 2.4rem;
    color: var(--accent, var(--gold));
    margin-bottom: var(--space-lg);
}

.wrapped-slide-category {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--accent, var(--gold));
    margin-bottom: var(--space-md);
}

.wrapped-slide-headline {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
}

.wrapped-slide-value {
    font-family: var(--font-display);
    font-size: clamp(2rem, 5vw, 3.2rem);
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    margin-bottom: var(--space-md);
}

.wrapped-slide-detail {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.5;
    max-width: 480px;
    margin: 0 auto;
}

/* Wrapped navigation */
.wrapped-nav {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
    padding: var(--space-lg);
}

.wrapped-nav-btn {
    background: none;
    border: 1px solid var(--border-medium);
    color: var(--text-secondary);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.wrapped-nav-btn:hover {
    border-color: var(--gold);
    color: var(--gold);
    background: var(--gold-glow);
}

.wrapped-dots {
    display: flex;
    gap: 6px;
}

.wrapped-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--bg-hover);
    cursor: pointer;
    transition: all 0.2s ease;
}

.wrapped-dot.active {
    background: var(--gold);
    transform: scale(1.25);
}

.wrapped-counter {
    position: absolute;
    bottom: 20px;
    right: 24px;
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

/* ═══════════════════════════════════════
   SHARE MODAL
   ═══════════════════════════════════════ */

.share-modal {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.share-modal.visible {
    opacity: 1;
    pointer-events: all;
}

.share-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(10, 10, 14, 0.85);
    backdrop-filter: blur(8px);
}

.share-modal-content {
    position: relative;
    background: var(--bg-surface);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    max-width: 480px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.95) translateY(10px);
    transition: transform 0.3s var(--ease-out);
}

.share-modal.visible .share-modal-content {
    transform: scale(1) translateY(0);
}

.share-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    color: var(--text-tertiary);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-full);
}

.share-modal-close:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.share-modal-title {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-lg);
}

.share-modal-preview {
    margin-bottom: var(--space-lg);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.share-modal-actions {
    display: flex;
    gap: var(--space-md);
}

.share-btn-outline {
    background: transparent !important;
    border: 1px solid var(--gold) !important;
    color: var(--gold) !important;
    box-shadow: none !important;
}

.share-btn-outline:hover {
    background: var(--gold-glow) !important;
}

/* ═══════════════════════════════════════
   NAV SHARE BUTTON
   ═══════════════════════════════════════ */

.nav-btn-gold {
    border-color: var(--gold);
    color: var(--gold);
}

.nav-btn-gold:hover {
    background: var(--gold-glow);
    color: var(--gold);
    border-color: var(--gold);
}

/* ═══════════════════════════════════════
   LOADING OVERLAY
   ═══════════════════════════════════════ */

#loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 14, 0.92);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

#loading-overlay.visible {
    opacity: 1;
    pointer-events: all;
}

.loading-content {
    text-align: center;
}

.vinyl-spinner-small {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    margin: 0 auto var(--space-md);
    background: radial-gradient(circle,
        #111 0%, #111 20%,
        #1a1a1a 20.5%, #151515 100%
    );
    box-shadow: 0 0 0 2px rgba(212, 160, 74, 0.1);
    animation: spin 1.5s linear infinite;
    position: relative;
}

.vinyl-spinner-small::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 30%;
    height: 30%;
    border-radius: 50%;
    background: var(--gold-dim);
}

.loading-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* ═══════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════ */

@media (max-width: 900px) {
    .hero-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .nav-links {
        gap: 2px;
    }

    .nav-link {
        padding: 6px 10px;
        font-size: 0.78rem;
    }

    .wrapped-preview-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .main-content {
        padding: var(--space-md);
    }

    .hero-stats {
        grid-template-columns: 1fr 1fr;
    }

    .hero-stat {
        padding: var(--space-lg) var(--space-md);
    }

    .stat-grid {
        grid-template-columns: 1fr;
    }

    .nav-inner {
        padding: 0 var(--space-md);
    }

    .brand-text {
        display: none;
    }

    .help-cards {
        grid-template-columns: 1fr;
    }

    .toplists-controls {
        gap: var(--space-md);
    }

    .top-table td.col-detail {
        display: none;
    }

    .top-table th.col-detail {
        display: none;
    }
}
