:root {
    --bg: #f5efe3;
    --bg-soft: #fffaf0;
    --paper: rgba(255, 252, 245, 0.92);
    --ink: #1f1c18;
    --muted: #74695b;
    --line: rgba(68, 52, 29, 0.16);
    --accent: #b34f3d;
    --accent-dark: #8d3c2d;
    --olive: #6f7b4b;
    --yes: #276749;
    --yes-bg: rgba(39, 103, 73, 0.12);
    --no: #9b2c2c;
    --no-bg: rgba(155, 44, 44, 0.12);
    --shadow: 0 22px 48px rgba(73, 57, 34, 0.14);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at top left, rgba(179, 79, 61, 0.18), transparent 34%),
        radial-gradient(circle at top right, rgba(111, 123, 75, 0.12), transparent 28%),
        linear-gradient(180deg, #f8f2e8 0%, #f4ecdf 50%, #efe4d1 100%);
    min-height: 100vh;
}

.page-shell {
    width: min(1220px, calc(100% - 32px));
    margin: 0 auto;
    padding: 32px 0 56px;
}

.hero,
.overview-panel,
.search-panel,
.empty-state,
.pagination {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 28px;
    box-shadow: var(--shadow);
}

.hero {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    padding: 28px;
    margin-bottom: 22px;
}

.eyebrow {
    margin: 0 0 8px;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--accent);
    font-size: 12px;
    font-weight: 700;
}

.hero h1 {
    margin: 0 0 10px;
    font-size: clamp(32px, 5vw, 52px);
    line-height: 1;
}

.hero-copy {
    margin: 0;
    max-width: 720px;
    color: var(--muted);
    font-size: 18px;
}

.hero-meta {
    display: grid;
    gap: 14px;
    min-width: 250px;
}

.hero-actions {
    display: flex;
    justify-content: flex-end;
}

.hero-chip {
    padding: 16px 18px;
    background: var(--bg-soft);
    border-radius: 20px;
    border: 1px solid var(--line);
}

.hero-chip-label {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 13px;
}

.search-panel {
    padding: 22px;
    margin-bottom: 22px;
}

.overview-panel {
    padding: 22px;
    margin-bottom: 22px;
}

.overview-panel-header {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: end;
    margin-bottom: 18px;
}

.overview-panel-meta {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}

.overview-panel-header h2 {
    margin: 0;
    font-size: clamp(24px, 3.2vw, 34px);
    line-height: 1.05;
}

.overview-total {
    min-width: 210px;
    padding: 16px 18px;
    border-radius: 20px;
    background: var(--bg-soft);
    border: 1px solid var(--line);
}

.overview-total-label {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 13px;
}

.overview-type-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
}

.overview-type-content[hidden] {
    display: none !important;
}

.overview-toggle {
    white-space: nowrap;
}

.overview-type-card {
    padding: 14px 16px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.64);
    border: 1px solid rgba(68, 52, 29, 0.08);
}

.overview-type-label {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.search-form {
    display: grid;
    grid-template-columns: minmax(0, 1.9fr) repeat(3, minmax(170px, 0.8fr)) auto;
    gap: 14px;
    align-items: end;
}

.search-grow {
    min-width: 0;
}

.search-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.search-field label {
    color: var(--muted);
    font-size: 14px;
    font-weight: 600;
}

.search-field input,
.search-field select {
    width: 100%;
    padding: 13px 15px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fffdfa;
    color: var(--ink);
    font-size: 15px;
}

.search-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px 18px;
    border-radius: 999px;
    text-decoration: none;
    border: none;
    cursor: pointer;
    font-weight: 700;
    font-size: 14px;
}

.btn-primary {
    background: linear-gradient(180deg, var(--accent), var(--accent-dark));
    color: #fff8f3;
}

.btn-secondary {
    background: rgba(111, 123, 75, 0.1);
    color: var(--ink);
    border: 1px solid rgba(111, 123, 75, 0.22);
}

.btn.is-disabled {
    opacity: 0.45;
    pointer-events: none;
}

.login-shell {
    width: min(100%, 640px);
    margin: 0 auto;
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px 18px;
}

.login-card {
    width: 100%;
    padding: 30px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 28px;
    box-shadow: var(--shadow);
}

.login-card h1 {
    margin: 0 0 14px;
    font-size: clamp(34px, 7vw, 48px);
    line-height: 1;
}

.login-form {
    display: grid;
    gap: 16px;
    margin-top: 22px;
}

.login-submit {
    width: 100%;
    margin-top: 8px;
}

.flash-message {
    margin-top: 18px;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid var(--line);
    font-weight: 600;
}

.flash-error {
    color: var(--no);
    background: var(--no-bg);
}

.flash-success {
    color: var(--yes);
    background: var(--yes-bg);
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
    align-items: start;
}

.collection-card {
    display: grid;
    gap: 14px;
    padding: 18px;
    background: rgba(255, 251, 245, 0.88);
    border: 1px solid var(--line);
    border-radius: 24px;
    box-shadow: var(--shadow);
}

.collection-card-cover {
    aspect-ratio: 1 / 1;
    border-radius: 18px;
    overflow: hidden;
    background: linear-gradient(180deg, rgba(179, 79, 61, 0.12), rgba(111, 123, 75, 0.08));
}

.cover-button {
    width: 100%;
    height: 100%;
    border: 0;
    padding: 0;
    background: transparent;
    cursor: pointer;
}

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

.cover-placeholder {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    color: var(--muted);
    font-weight: 600;
}

.collection-card-header {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.type-pill {
    display: inline-flex;
    align-items: center;
    padding: 7px 11px;
    border-radius: 999px;
    background: rgba(179, 79, 61, 0.12);
    color: var(--accent-dark);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.type-pill.soft {
    background: rgba(111, 123, 75, 0.12);
    color: #47532b;
}

.collection-card h2 {
    margin: 0;
    font-size: 23px;
    line-height: 1.1;
}

.item-title {
    margin: 0;
    color: var(--muted);
    font-size: 16px;
}

.item-related-artists {
    margin: -4px 0 0;
    padding: 10px 12px;
    border-radius: 14px;
    background: rgba(111, 123, 75, 0.1);
    color: #44502a;
    font-size: 14px;
    line-height: 1.45;
}

.item-related-label {
    display: block;
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 0;
}

.detail-grid div {
    padding: 12px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.64);
    border: 1px solid rgba(68, 52, 29, 0.08);
}

.detail-grid dt {
    margin: 0 0 4px;
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.detail-grid dd {
    margin: 0;
    font-size: 15px;
    overflow-wrap: anywhere;
}

.presence-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.public-card-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.public-card-actions .btn {
    margin: 0;
}

.collection-card-more {
    display: grid;
    gap: 12px;
    padding-top: 4px;
}

.collection-card-more[hidden] {
    display: none !important;
}

.detail-grid-expanded {
    margin-top: 0;
}

.info-block {
    padding: 12px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.64);
    border: 1px solid rgba(68, 52, 29, 0.08);
}

.info-block-text {
    color: var(--ink);
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.presence-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 9px 12px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
}

.presence-chip.is-yes {
    color: var(--yes);
    background: var(--yes-bg);
}

.presence-chip.is-no {
    color: var(--no);
    background: var(--no-bg);
}

.empty-state,
.pagination {
    padding: 20px 24px;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 22px;
}

.pagination-status {
    color: var(--muted);
    font-weight: 600;
}

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 999;
    display: grid;
    place-items: center;
    padding: 34px 18px 26px;
    background: rgba(18, 16, 13, 0.92);
}

.lightbox[hidden] {
    display: none;
}

.lightbox-stage {
    width: min(92vw, 1120px);
    height: min(74vh, 780px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-stage img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 18px;
    box-shadow: 0 22px 48px rgba(0, 0, 0, 0.45);
    background: #111;
}

.lightbox-close,
.lightbox-nav {
    position: absolute;
    border: 0;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    cursor: pointer;
}

.lightbox-close {
    top: 16px;
    right: 18px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    font-size: 28px;
}

.lightbox-nav {
    top: 50%;
    transform: translateY(-50%);
    width: 56px;
    height: 56px;
    border-radius: 50%;
    font-size: 28px;
}

.lightbox-prev {
    left: 16px;
}

.lightbox-next {
    right: 16px;
}

.lightbox-caption {
    margin-top: 12px;
    color: #fff6ea;
    text-align: center;
}

.lightbox-thumbs {
    margin-top: 14px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    max-width: min(92vw, 980px);
}

.lightbox-thumbs img {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 10px;
    cursor: pointer;
    border: 2px solid transparent;
}

.lightbox-thumbs img.active {
    border-color: #fff1d0;
}

@media (max-width: 960px) {
    .hero {
        flex-direction: column;
    }

    .overview-panel-header {
        flex-direction: column;
        align-items: stretch;
    }

    .overview-panel-meta {
        justify-content: flex-start;
    }

    .search-form {
        grid-template-columns: 1fr 1fr;
    }

    .search-actions {
        grid-column: 1 / -1;
    }

    .results-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .results-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 680px) {
    .page-shell {
        width: min(100%, calc(100% - 18px));
        padding-top: 18px;
    }

    .login-card {
        padding: 22px;
    }

    .search-form,
    .detail-grid {
        grid-template-columns: 1fr;
    }

    .pagination {
        flex-direction: column;
    }

    .lightbox-nav {
        width: 48px;
        height: 48px;
    }

    .results-grid {
        grid-template-columns: 1fr;
    }
}
