
:root {
    font-family: Inter, Arial, sans-serif;
    color: #20232b;
    background: #f5f6f8;

    --bg: #f5f6f8;
    --panel: #ffffff;
    --text: #20232b;
    --muted: #858b98;
    --line: #e8eaf0;
    --accent: #ed4c55;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    transition: 0.2s;
}

body.dark {
    --bg: #15171c;
    --panel: #20232b;
    --text: #f2f3f6;
    --muted: #a1a6b1;
    --line: #343842;
}

a {
    color: inherit;
    text-decoration: none;
}

.site-header {
    height: 72px;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
}

.header-inner,
.hero,
.database-section,
.footer-inner {
    width: min(1160px, calc(100% - 48px));
    margin: auto;
}

.header-inner {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--accent);
    color: white;
    display: grid;
    place-items: center;
    font-weight: 800;
}

.brand-copy {
    display: flex;
    flex-direction: column;
}

.brand-copy strong {
    font-size: 14px;
}

.brand-copy small {
    font-size: 9px;
    color: var(--muted);
    letter-spacing: 0.16em;
    margin-top: 4px;
}

.header-inner nav {
    display: flex;
    gap: 28px;
    font-size: 13px;
    color: var(--muted);
    font-weight: 600;
}

.header-inner nav .active,
.header-inner nav a:hover {
    color: var(--text);
}

button,
select {
    font-family: inherit;
}

.theme-toggle {
    width: 36px;
    height: 36px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--panel);
    color: var(--text);
    font-size: 18px;
    cursor: pointer;
}

/* HERO */

.hero {
    min-height: 360px;
    margin-top: 34px;
    border-radius: 18px;
    background: #20232b;
    color: #fff;
    position: relative;
    overflow: hidden;
    padding: 54px 64px;
    display: flex;
    align-items: center;
}

.hero-inner {
    position: relative;
    z-index: 2;
    max-width: 570px;
}

.eyebrow {
    font-size: 10px;
    letter-spacing: 0.16em;
    font-weight: 800;
    color: #ff9298;
    display: flex;
    align-items: center;
    gap: 8px;
}

.eyebrow i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #ff6c75;
}

.hero h1 {
    font-size: 48px;
    line-height: 1.06;
    letter-spacing: -0.055em;
    margin: 18px 0 14px;
}

.hero h1 span {
    color: #ff737b;
}

.hero p {
    font-size: 14px;
    line-height: 1.7;
    color: #b9bdc7;
    max-width: 410px;
}

.hero-bottom {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-top: 28px;
}

.primary-button {
    border: 0;
    border-radius: 9px;
    background: var(--accent);
    color: white;
    padding: 13px 17px;
    font-size: 12px;
    font-weight: 700;
    display: inline-flex;
    gap: 18px;
    cursor: pointer;
}

.primary-button:hover {
    background: #d93e48;
}

.hero-stat {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.hero-stat strong {
    font-size: 20px;
}

.hero-stat span {
    font-size: 10px;
    color: #aeb3bf;
}

.hero-side {
    position: absolute;
    right: 100px;
    top: 55px;
    width: 210px;
    height: 250px;
}

.hero-card {
    position: absolute;
    width: 170px;
    height: 225px;
    border-radius: 14px;
    border: 1px solid #ffffff30;
    background: #303540;
    padding: 13px;
}

.hero-card.back {
    right: 0;
    top: 15px;
    transform: rotate(10deg);
    background: #383d49;
}

.hero-card.front {
    left: 0;
    top: 0;
    transform: rotate(-7deg);
    box-shadow: 0 18px 45px #1118;
}

.card-topline,
.card-bottom {
    display: flex;
    justify-content: space-between;
    font-size: 8px;
    letter-spacing: 0.1em;
    color: #b8bdc7;
}

.card-art {
    height: 112px;
    margin: 12px 0 8px;
    border-radius: 9px;
    background: #454c59;
    display: grid;
    place-items: center;
    font-size: 58px;
    font-weight: 800;
    color: #ff7a82;
}

.card-name {
    font-size: 15px;
    line-height: 1.1;
    font-weight: 800;
}

.card-bottom {
    position: absolute;
    bottom: 12px;
    left: 13px;
    right: 13px;
    font-size: 6px;
}

/* DATABASE */

.database-section {
    padding: 65px 0 78px;
}

.section-heading {
    display: flex;
    justify-content: space-between;
    align-items: end;
    margin-bottom: 25px;
}

.eyebrow.muted {
    color: var(--accent);
}

h2 {
    font-size: 29px;
    letter-spacing: -0.045em;
    margin: 8px 0;
}

.section-heading p {
    font-size: 12px;
    color: var(--muted);
    margin: 0;
}

.count-pill {
    border: 1px solid var(--line);
    background: var(--panel);
    border-radius: 8px;
    padding: 9px 12px;
    font-size: 11px;
    color: var(--muted);
}

.toolbar {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.search-box {
    height: 43px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 13px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 9px;
    flex: 1;
    color: var(--muted);
}

.search-box input {
    width: 100%;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text);
    font: 12px Inter;
}

.toolbar select,
.reset-button {
    height: 43px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--panel);
    color: var(--text);
    padding: 0 13px;
    font-size: 11px;
}

.reset-button {
    cursor: pointer;
}

.rarity-filters {
    display: flex;
    gap: 7px;
    flex-wrap: wrap;
    margin-bottom: 22px;
}

.rarity-filter {
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--panel);
    padding: 8px 12px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
}

.rarity-filter.active {
    background: var(--text);
    border-color: var(--text);
    color: var(--panel);
}

/* BRAINROT CARDS */

.brainrot-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.brainrot-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    min-width: 0;
    transition: transform 0.16s;
}

.brainrot-card:hover {
    transform: translateY(-3px);
}

.brainrot-art {
    height: 145px;
    background: #eceef2;
    display: grid;
    place-items: center;
    overflow: hidden;
}

.dark .brainrot-art {
    background: #2a2e38;
}

.brainrot-art img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 13px;
}

.art-placeholder {
    font-size: 42px;
    font-weight: 800;
    color: #c1c5ce;
}

.brainrot-info {
    padding: 13px;
}

.brainrot-name {
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0 0 9px;
}

.brainrot-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
}

.rarity-tag {
    display: inline-block;
    border-radius: 5px;
    padding: 5px 7px;
    background: #f0f1f4;
    color: #626977;
    font-size: 9px;
    font-weight: 700;
}

.dark .rarity-tag {
    background: #343945;
    color: #d0d3da;
}

.card-price,
.card-income {
    font-size: 10px;
    color: var(--muted);
    font-weight: 600;
}

.card-income {
    margin-top: 9px;
}

/* EMPTY AND ERROR STATES */

.catalog-error,
.empty-state {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
    text-align: center;
    padding: 35px 20px;
    margin-bottom: 18px;
}

.catalog-error p,
.empty-state p {
    font-size: 12px;
    color: var(--muted);
}

.empty-icon {
    font-size: 30px;
    color: var(--muted);
}

.primary-button.small {
    padding: 10px 14px;
}

/* FOOTER */

footer {
    border-top: 1px solid var(--line);
    background: var(--panel);
}

.footer-inner {
    min-height: 65px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    color: var(--muted);
    font-size: 10px;
}

.footer-inner strong {
    color: var(--text);
}

/* DETAIL MODAL */

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: #111a;
    z-index: 20;
}

.detail-modal {
    position: fixed;
    z-index: 21;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: min(490px, calc(100% - 30px));
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 16px;
    display: grid;
    grid-template-columns: 190px 1fr;
    overflow: hidden;
}

.detail-modal[hidden],
.modal-backdrop[hidden] {
    display: none;
}

.modal-close {
    position: absolute;
    right: 10px;
    top: 8px;
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 25px;
    cursor: pointer;
}

.modal-image-wrap {
    background: #eef0f3;
    display: grid;
    place-items: center;
    min-height: 230px;
}

.dark .modal-image-wrap {
    background: #2a2e38;
}

.modal-image-wrap img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 15px;
}

.modal-content {
    padding: 34px 20px 20px;
}

.modal-content h2 {
    font-size: 21px;
}

.modal-content p {
    font-size: 11px;
    color: var(--muted);
}

.modal-stats {
    display: grid;
    gap: 9px;
    margin-top: 18px;
}

.modal-stats div {
    display: flex;
    justify-content: space-between;
    border-top: 1px solid var(--line);
    padding-top: 9px;
    font-size: 10px;
}

.modal-stats span {
    color: var(--muted);
}

/* RESPONSIVE */

@media (max-width: 800px) {
    .hero {
        padding: 42px 35px;
    }

    .hero-side {
        right: 30px;
        opacity: 0.4;
    }

    .brainrot-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 580px) {
    .header-inner,
    .hero,
    .database-section,
    .footer-inner {
        width: calc(100% - 28px);
    }

    .hero {
        padding: 35px 24px;
        min-height: 330px;
    }

    .hero h1 {
        font-size: 38px;
    }

    .hero-side {
        right: -65px;
        opacity: 0.2;
    }

    .brainrot-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .brainrot-art {
        height: 125px;
    }

    .toolbar {
        flex-wrap: wrap;
    }

    .search-box {
        flex-basis: 100%;
    }

    .toolbar select {
        flex: 1;
    }

    .footer-inner {
        padding: 16px 0;
        flex-wrap: wrap;
    }

    .detail-modal {
        grid-template-columns: 1fr;
    }

    .modal-image-wrap {
        min-height: 170px;
        max-height: 190px;
    }
}



/* BRAINROT CARD FIX */

.brainrot-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 16px;
    align-items: start;
}

.brainrot-card {
    width: 100%;
    min-width: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.card-image {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    height: auto;
    min-height: unset;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-image img {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
}

.card-placeholder {
    display: none !important;
}

.card-image .rarity-badge {
    display: none !important;
}

.card-info {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 9px;
    min-width: 0;
}

.card-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 7px;
    width: 100%;
    min-width: 0;
}

.card-name {
    flex: 1;
    min-width: 0;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.card-title-row .rarity-badge {
    position: static !important;
    flex-shrink: 0;
    max-width: 50%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.card-stats {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

@media (max-width: 600px) {
    .brainrot-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }
}
