/* ── Reset & tokens ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    /* Brand colours extracted from the LibreDeck logo */
    --teal:          #1a9aaa;
    --teal-h:        #22b5c8;
    --teal-dark:     #136e7a;
    --green:         #46c14a;
    --green-h:       #55d659;
    --grad:          linear-gradient(135deg, #1a9aaa 0%, #46c14a 100%);
    --grad-glow:     linear-gradient(135deg, rgba(26,154,170,.35) 0%, rgba(70,193,74,.25) 100%);

    /* Backgrounds – dark with subtle teal tint */
    --bg:            #080d0e;
    --bg-2:          #0c1415;
    --surface:       #101c1e;
    --surface-2:     #162224;
    --border:        #1c3236;
    --border-h:      #2a4e54;

    /* Text */
    --text:          #dff0f2;
    --text-muted:    #6e9ea6;
    --text-dim:      #3a6068;

    --radius:        14px;
    --radius-sm:     8px;
}

html { scroll-behavior: smooth; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
strong { color: var(--text); }

/* ── Layout ── */
.section-inner {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 1.5rem;
}
.section-title {
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 800;
    letter-spacing: -.5px;
    margin-bottom: .5rem;
}
.section-sub {
    color: var(--text-muted);
    font-size: 1.05rem;
    margin-bottom: 2.5rem;
}
.accent { color: var(--teal); }

/* ── Navbar ── */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(8,13,14,.88);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
}
.nav-inner {
    max-width: 1000px;
    margin: 0 auto;
    padding: .7rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.nav-logo {
    height: 40px;
    width: auto;
    display: block;
}

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    background: var(--grad);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    padding: .6rem 1.25rem;
    font-size: .95rem;
    font-weight: 700;
    cursor: pointer;
    transition: filter .15s, box-shadow .15s;
    white-space: nowrap;
    line-height: 1;
}
.btn:hover {
    filter: brightness(1.12);
    box-shadow: 0 0 22px rgba(26,154,170,.4), 0 0 22px rgba(70,193,74,.2);
}
.btn-sm  { font-size: .82rem; padding: .45rem .9rem; border-radius: 6px; }
.btn-lg  { font-size: 1rem; padding: .8rem 1.9rem; border-radius: 10px; }

/* ── Hero ── */
.hero {
    padding: 6rem 0 5rem;
    background:
        radial-gradient(ellipse 55% 45% at 65% 0%, rgba(26,154,170,.13) 0%, transparent 70%),
        radial-gradient(ellipse 35% 30% at 80% 80%, rgba(70,193,74,.08) 0%, transparent 70%);
}
.hero-inner {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 4rem;
    align-items: center;
}
.hero-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.hero-brand-logo {
    width: 260px;
    height: auto;
    filter: drop-shadow(0 0 32px rgba(26,154,170,.5)) drop-shadow(0 0 64px rgba(70,193,74,.25));
    animation: logoPulse 5s ease-in-out infinite;
}
@keyframes logoPulse {
    0%, 100% {
        filter: drop-shadow(0 0 32px rgba(26,154,170,.5))  drop-shadow(0 0 64px rgba(70,193,74,.25));
    }
    50% {
        filter: drop-shadow(0 0 48px rgba(26,154,170,.75)) drop-shadow(0 0 96px rgba(70,193,74,.4));
    }
}
.hero-eyebrow {
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--teal);
    margin-bottom: 1rem;
}
.hero-text h1 {
    font-size: clamp(2rem, 5vw, 3.2rem);
    font-weight: 900;
    letter-spacing: -1.5px;
    line-height: 1.15;
    margin-bottom: 1.25rem;
}
.hero-sub {
    color: var(--text-muted);
    font-size: 1.1rem;
    max-width: 480px;
    margin-bottom: 2rem;
    line-height: 1.7;
}

/* ── Card Mockups ── */
.hero-cards {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    flex-shrink: 0;
}
.card-mockup {
    width: 120px;
    height: 120px;
    border-radius: 10px;
    border: 1px solid rgba(26,154,170,.3);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    position: relative;
    overflow: hidden;
    background: #fff;
    color: #111;
    box-shadow: 0 8px 32px rgba(0,0,0,.5), 0 0 0 1px rgba(26,154,170,.15);
}
.card-mockup.small  { width: 90px; height: 90px; border-radius: 7px; }
.card-front         { margin-top: 20px; }

.mock-year   { font-size: 22px; font-weight: 900; color: #1a7a8a; letter-spacing: -1px; line-height: 1; }
.mock-divider { width: 70%; height: 1px; background: #c5e6ea; margin: 2px 0; }
.mock-artist { font-size: 8.5px; color: #555; text-align: center; padding: 0 6px; line-height: 1.2; }
.mock-title  { font-size: 8.5px; font-weight: 700; color: #1a7a8a; text-align: center; padding: 0 6px; line-height: 1.2; }
.mock-brand  { position: absolute; bottom: 4px; font-size: 6px; color: #aac; letter-spacing: .05em; }

.card-mockup.small .mock-year   { font-size: 16px; }
.card-mockup.small .mock-artist,
.card-mockup.small .mock-title  { font-size: 6.5px; }

.mock-qr { width: 80px; height: 80px; display: flex; align-items: center; justify-content: center; }
.qr-grid {
    width: 72px; height: 72px;
    background-image:
        linear-gradient(#1a7a8a 0, #1a7a8a 100%),
        linear-gradient(#1a7a8a 0, #1a7a8a 100%),
        linear-gradient(#1a7a8a 0, #1a7a8a 100%),
        repeating-linear-gradient(90deg, transparent 0, transparent 6px, #1a7a8a 6px, #1a7a8a 8px),
        repeating-linear-gradient(0deg,  transparent 0, transparent 6px, #1a7a8a 6px, #1a7a8a 8px);
    background-size: 18px 18px, 18px 18px, 18px 18px, 100% 100%, 100% 100%;
    background-position: 0 0, calc(100% - 0px) 0, 0 calc(100% - 0px), 0 0, 0 0;
    background-repeat: no-repeat, no-repeat, no-repeat, repeat, repeat;
    opacity: .8;
    border: 1px solid #c5e6ea;
    border-radius: 2px;
}

/* ── How it works ── */
.how-section {
    padding: 5rem 0;
    background: var(--bg-2);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}
.steps {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-top: 2.5rem;
    flex-wrap: wrap;
}
.step {
    flex: 1;
    min-width: 200px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.75rem 1.5rem;
    transition: border-color .2s;
}
.step:hover { border-color: var(--border-h); }

.step-icon {
    width: 44px; height: 44px;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(26,154,170,.15), rgba(70,193,74,.1));
    border: 1px solid rgba(26,154,170,.25);
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 1.25rem;
    color: var(--teal);
}
.step-icon svg { width: 22px; height: 22px; }
.step h3 { font-size: 1rem; font-weight: 700; margin-bottom: .5rem; color: var(--text); }
.step p  { font-size: .9rem; color: var(--text-muted); line-height: 1.55; margin: 0; }

.step-arrow {
    font-size: 1.5rem;
    color: var(--text-dim);
    align-self: center;
    flex-shrink: 0;
    margin-top: -1rem;
}

/* ── Card detail ── */
.detail-section { padding: 5rem 0; }
.detail-inner {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
}
.detail-text h2 {
    font-size: clamp(1.4rem, 2.5vw, 1.9rem);
    font-weight: 800;
    letter-spacing: -.5px;
    margin-bottom: 1.75rem;
}
.detail-list { list-style: none; display: flex; flex-direction: column; gap: 1.25rem; }
.detail-list li { display: flex; gap: 1rem; align-items: flex-start; }
.detail-icon {
    flex-shrink: 0;
    width: 34px; height: 34px;
    border-radius: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    display: flex; align-items: center; justify-content: center;
    font-size: .7rem; font-weight: 800;
    color: var(--teal);
}
.detail-list strong { display: block; font-size: .95rem; margin-bottom: .2rem; }
.detail-list p { font-size: .875rem; color: var(--text-muted); margin: 0; line-height: 1.5; }

/* ── Card grid: 2 × 3, each card slightly tilted ── */
.preview-stack {
    display: grid;
    grid-template-columns: repeat(2, max-content);
    gap: 10px;
    padding: 8px;
}
.preview-stack .card-mockup:nth-child(1) { transform: rotate(-4deg) translate(0,  3px); }
.preview-stack .card-mockup:nth-child(2) { transform: rotate( 3deg) translate(0,  6px); }
.preview-stack .card-mockup:nth-child(3) { transform: rotate( 5deg) translate(2px, -4px); }
.preview-stack .card-mockup:nth-child(4) { transform: rotate(-3deg) translate(0,  -2px); }
.preview-stack .card-mockup:nth-child(5) { transform: rotate(-2deg) translate(-3px, 5px); }
.preview-stack .card-mockup:nth-child(6) { transform: rotate( 4deg) translate(1px, -3px); }

/* ── Generator ── */
.generator-section {
    padding: 5rem 0 6rem;
    background: var(--bg-2);
    border-top: 1px solid var(--border);
}
.generator-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2.5rem;
    max-width: 680px;
    margin: 0 auto;
    box-shadow: 0 0 60px rgba(26,154,170,.06);
}
.field-label {
    display: block;
    font-size: .82rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .07em;
    margin-bottom: .6rem;
}
.input-row { display: flex; gap: .75rem; flex-wrap: wrap; }
.url-input {
    flex: 1;
    min-width: 200px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 1rem;
    padding: .7rem 1rem;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}
.url-input::placeholder { color: var(--text-dim); }
.url-input:focus {
    border-color: var(--teal);
    box-shadow: 0 0 0 3px rgba(26,154,170,.2);
}

/* ── Hint details ── */
.hint-details {
    margin-top: 1.5rem;
    border-top: 1px solid var(--border);
    padding-top: 1.25rem;
}
.hint-details summary {
    font-size: .88rem;
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
    list-style: none;
    display: flex;
    align-items: center;
    gap: .4rem;
}
.hint-details summary::before {
    content: '▶';
    font-size: .65rem;
    color: var(--teal);
    transition: transform .15s;
}
.hint-details[open] summary::before { transform: rotate(90deg); }
.hint-steps {
    color: var(--text-muted);
    font-size: .88rem;
    padding-left: 1.5rem;
    margin: .75rem 0;
}
.hint-steps li  { margin-bottom: .3rem; }
.hint-example   { font-size: .82rem; color: var(--text-muted); margin: 0; }
.hint-example code {
    background: var(--bg);
    border: 1px solid var(--border);
    padding: .15rem .5rem;
    border-radius: 5px;
    font-size: .8rem;
}

/* ── Review section ── */
.review-section {
    margin-top: 2rem;
    border-top: 1px solid var(--border);
    padding-top: 1.75rem;
}
.review-heading {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: .5rem;
}
.review-sub {
    font-size: .88rem;
    color: var(--text-muted);
    margin-bottom: 1.25rem;
    line-height: 1.55;
}
.review-table {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    margin-bottom: 1.5rem;
}
.review-row {
    display: grid;
    grid-template-columns: 1fr 1.5fr 90px auto;
    gap: .75rem;
    align-items: center;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: .6rem .9rem;
}
.review-artist {
    font-size: .85rem;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.review-track-title {
    font-size: .85rem;
    color: var(--text);
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.review-row .year-input {
    min-width: 0;
    text-align: center;
    padding: .45rem .5rem;
    font-size: .9rem;
}
.btn-check {
    background: transparent;
    border: 1px solid var(--border-h);
    color: var(--text-muted);
    border-radius: 6px;
    padding: .35rem .7rem;
    font-size: .8rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: border-color .15s, color .15s;
    line-height: 1;
}
.btn-check:hover:not(:disabled) { border-color: var(--teal); color: var(--teal); }
.btn-check:disabled { opacity: .45; cursor: default; }

.year-suggestion {
    display: flex;
    align-items: center;
    gap: .35rem;
    font-size: .8rem;
    color: var(--text-muted);
    white-space: nowrap;
}
.suggestion-year { color: var(--teal); font-weight: 700; }
.suggestion-accept, .suggestion-reject {
    background: transparent;
    border: 1px solid var(--border-h);
    border-radius: 4px;
    padding: .2rem .45rem;
    font-size: .75rem;
    cursor: pointer;
    line-height: 1;
    transition: background .12s, color .12s;
}
.suggestion-accept { color: var(--green); }
.suggestion-accept:hover { background: rgba(70,193,74,.15); }
.suggestion-reject { color: var(--text-muted); }
.suggestion-reject:hover { background: rgba(255,255,255,.06); }

.check-cell {
    display: flex;
    align-items: center;
    gap: .5rem;
}

.review-row--missing {
    border-color: rgba(180,120,30,.4);
    background: rgba(180,120,30,.06);
}
.year-input--missing {
    border-color: rgba(180,120,30,.5) !important;
}
.review-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .75rem;
    flex-wrap: wrap;
}
.bulk-progress {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-bottom: .25rem;
}
.bulk-progress-label {
    font-size: .85rem;
    color: var(--text-muted);
    white-space: nowrap;
}
.review-row--updated {
    border-color: rgba(26,154,170,.45);
    background: rgba(26,154,170,.06);
}
.btn-outline {
    background: transparent;
    border: 1px solid var(--border-h);
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    padding: .6rem 1.25rem;
    font-size: .95rem;
    font-weight: 700;
    cursor: pointer;
    transition: border-color .15s, color .15s;
    white-space: nowrap;
    line-height: 1;
}
.btn-outline:hover { border-color: var(--teal); color: var(--teal); }

/* ── Error ── */
.error-msg {
    background: rgba(180,30,30,.12);
    border: 1px solid rgba(180,30,30,.35);
    color: #ffaaaa;
    border-radius: var(--radius-sm);
    padding: .8rem 1rem;
    margin-top: 1rem;
    font-size: .9rem;
}

/* ── Loading overlay ── */
#loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(8,13,14,.92);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.25rem;
    z-index: 999;
}
#loading-overlay p { color: var(--text); font-size: 1.1rem; margin: 0; }
.loading-sub { color: var(--text-muted) !important; font-size: .9rem !important; }

.btn-cancel {
    background: transparent;
    border: 1px solid var(--border-h);
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    padding: .45rem 1.1rem;
    font-size: .85rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color .15s, color .15s;
    margin-top: .25rem;
}
.btn-cancel:hover { border-color: var(--text-muted); color: var(--text); }

.spotify-auth-box {
    margin-top: 1.25rem;
    padding: 1rem 1.25rem;
    border: 1px solid #1db954;
    border-radius: var(--radius-sm);
    background: rgba(29,185,84,.07);
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}
.spotify-auth-box p { margin: 0; font-size: .9rem; color: var(--text-muted); flex: 1; }
.spotify-btn { background: #1db954; }
.spotify-btn:hover { filter: brightness(1.1); }

#progressWrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .6rem;
    width: 260px;
}
.progress-bar-bg {
    width: 100%;
    height: 6px;
    background: var(--border);
    border-radius: 99px;
    overflow: hidden;
}
.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: var(--grad);
    border-radius: 99px;
    transition: width .35s ease;
}

.spinner {
    width: 44px; height: 44px;
    border: 3px solid var(--border);
    border-top-color: var(--teal);
    border-right-color: var(--green);
    border-radius: 50%;
    animation: spin .75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Modal dialog ── */
#deezerNotice,
#bulkCheckDialog {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}
.dialog-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(8,13,14,.75);
    backdrop-filter: blur(4px);
}
.dialog-box {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border-h);
    border-radius: var(--radius);
    padding: 2rem 2rem 1.75rem;
    max-width: 460px;
    width: calc(100% - 2rem);
    box-shadow: 0 24px 64px rgba(0,0,0,.6), 0 0 0 1px rgba(26,154,170,.15);
}
.dialog-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 1rem;
}
.dialog-body {
    font-size: .9rem;
    color: var(--text-muted);
    line-height: 1.65;
    margin-bottom: 1.5rem;
}
.dialog-body strong { color: var(--text); }
.dialog-actions { display: flex; justify-content: flex-end; }

/* ── Footer ── */
.site-footer {
    background: var(--bg);
    border-top: 1px solid var(--border);
    padding: 2.5rem 0;
}
.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}
.footer-logo-img { height: 32px; width: auto; opacity: .8; }
.site-footer p { color: var(--text-dim); font-size: .82rem; margin: 0; }

/* ── Spotify Playlist Picker ── */
.picker-label { font-size: .85rem; color: var(--text-muted); margin: 1rem 0 0; }
.playlist-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
    max-height: 340px;
    overflow-y: auto;
    margin-top: .75rem;
}
.playlist-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: .6rem;
    cursor: pointer;
    transition: border-color .15s, background .15s;
    display: flex;
    flex-direction: column;
    gap: .4rem;
}
.playlist-card:hover { border-color: #1db954; background: var(--surface-2); }
.playlist-card img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 4px; background: var(--surface-2); }
.playlist-card-nocover {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 4px;
    background: var(--surface-2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
}
.playlist-card-name { font-size: .8rem; font-weight: 600; color: var(--text); line-height: 1.3; }
.playlist-card-count { font-size: .72rem; color: var(--text-muted); }

/* ── Responsive ── */
@media (max-width: 760px) {
    .hero-inner          { grid-template-columns: 1fr; gap: 2.5rem; }
    .hero-brand          { justify-content: center; }
    .hero-brand-logo     { width: 200px; }
    .hero-cards          { justify-content: center; }
    .detail-inner        { grid-template-columns: 1fr; gap: 3rem; }
    .steps               { flex-direction: column; }
    .step-arrow          { display: none; }
    .hero                { padding: 4rem 0 3rem; }
    .generator-card      { padding: 1.75rem 1.25rem; }
    .review-row          { grid-template-columns: 1fr 90px auto; }
    .review-artist       { display: none; }
}
