.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(var(--card-min-size), 1fr));
    gap: 24px;
    margin-top: 36px;
    overflow: visible;
}

.card {
    position: relative;
    padding: 16px;
    background: transparent;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 0;
    box-shadow: none;
    transition: all 0.2s ease;
    clip-path: polygon(0 0, 100% 0, 100% calc(100% - 20px), calc(100% - 20px) 100%, 0 100%);
    transform: skew(-2deg);
}

.card-large {
    grid-column: span 2;
}

@media (max-width: 800px) {
    .card-large {
        grid-column: span 1;
    }
}

.card>*,
.card-details>* {
    display: block;
    padding: 8px 0;
}

.card>*+*,
.card-details>*+* {
    border-top: 1px solid rgba(255, 255, 255, .08);
}

.card p strong {
    text-decoration: underline;
    text-underline-offset: 4px;
    text-decoration-color: rgba(255, 255, 255, 0.2);
}

.card::before {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 28px;
    height: 28px;
    background: transparent;
    border-top: 2px solid rgba(255, 255, 255, 0.4);
    transform: rotate(-45deg) translate(14px, 14px);
    transition: all 0.2s ease;
    pointer-events: none;
}

.card:hover {
    border-color: white;
    background: rgba(255, 255, 255, 0.05);
    transform: translateY(-5px) skew(-2deg);
    box-shadow: none;
}

.card:hover::before {
    border-top-color: white;
}

.rarity,
.price-tag {
    position: absolute;
    top: -8px;
    padding: 3px 8px;
    font-size: .65rem;
    font-weight: bold;
    background: #000;
    border: 1px solid;
    border-radius: 0;
    z-index: 10;
}

.rarity {
    right: 6px
}

.price-tag {
    left: 6px;
    color: #0f0;
    border-color: #0f0;
    box-shadow: 0 0 8px #0f0;
    text-shadow: 0 0 5px #0f0
}

.rarity,
.price-tag {
    position: absolute;
    top: -8px;
    padding: 3px 8px;
    font-size: .65rem;
    font-weight: bold;
    background: #000;
    border: 1px solid;
    border-radius: 0;
    z-index: 10;
}

.rarity {
    right: 6px
}

.price-tag {
    left: 6px;
    color: #0f0;
    border-color: #0f0;
    box-shadow: 0 0 8px #0f0;
    text-shadow: 0 0 5px #0f0
}

.rarity-mission {
    color: #99f;
    border-color: #99f;
    text-shadow: 0 0 10px #99f;
}

.rarity-common {
    color: #999;
    border-color: #999
}

.rarity-uncommon {
    color: #0f0;
    border-color: #0f0;
    text-shadow: 0 0 10px #0f0
}

.rarity-epic {
    color: #c0f;
    border-color: #c0f
}

.rarity-mythic {
    color: #f00;
    border-color: #f00;
    text-shadow: 0 0 10px #f00
}

.rarity-legendary {
    color: #ff0;
    border-color: #ff0;
    text-shadow: 0 0 15px #ff0
}

.rarity-unobtainable {
    color: rgb(255, 255, 255);
    border-color: rgb(255, 255, 255);
    text-shadow: 0 0 15px rgb(0, 0, 0)
}

.rarity-easy {
    color: #0f0;
    border-color: #0f0;
    text-shadow: 0 0 10px #0f0
}

.rarity-medium {
    color: #ff0;
    border-color: #ff0;
    text-shadow: 0 0 15px #ff0
}

.rarity-hard {
    color: #f00;
    border-color: #f00;
    text-shadow: 0 0 10px #f00
}

.rarity-neutral {
    color: #0f0;
    border-color: #0f0;
    text-shadow: 0 0 10px #0f0
}

.rarity-police {
    color: #00f;
    border-color: #00f;
    text-shadow: 0 0 10px #00f
}

.rarity-criminal {
    color: #f00;
    border-color: #f00;
    text-shadow: 0 0 10px #f00
}

.rarity-christmas-limited {
    color: #0f0;
    border-color: #f00;
    text-shadow: 0 0 10px #f00
}

.rarity-easter {
    color: rgb(255, 80, 194);
    border-color: rgb(255, 80, 194);
    text-shadow: 0 0 10px rgb(255, 80, 194)
}

.rarity-4th-of-july {
    color: #e53935;
    border-color: #e53935;
    text-shadow: 0 0 10px #e53935;
}

.sort-buttons {
    text-align: center;
    margin: 15px 0
}

.sort-btn {
    display: inline-block;
    margin: 0 4px 6px;
    padding: 5px 12px;
    background: #000;
    border: 1px solid #666;
    font-size: .8rem;
    cursor: pointer;
    transition: .2s;
    transform: skew(-15deg);
}

.sort-btn:hover,
.sort-btn.active {
    background: #333;
    border-color: var(--fg);
    box-shadow: 0 0 10px var(--fg);
}

.card-details {
    max-height: 500px;
    overflow-y: auto;
    overflow-x: hidden;
    transition: max-height 0.4s cubic-bezier(0.23, 1, 0.32, 1), opacity 0.3s ease;
    opacity: 1;
    margin-top: 10px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.card-details.collapsed {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
}

.card-details-toggle {
    width: 100%;
    padding: 8px 12px;
    margin-top: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    color: #999;
    font-family: 'Geist Pixel', system-ui;
    font-size: 0.75rem;
    font-weight: bold;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
    text-transform: uppercase;
    transform: skew(1deg);
}

.card-details-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--fg);
    color: var(--fg);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
}

.card-details-toggle:active {
    transform: skew(1deg) translateY(1px);
}

.card-details {
    max-height: 1000px;
    overflow: hidden;
    transition: max-height 0.3s ease-out, opacity 0.3s ease-out;
    opacity: 1;
}

.card-details.collapsed {
    max-height: 0;
    opacity: 0;
    padding: 0;
    border: none;
}

.card-details-toggle {
    width: 100%;
    padding: 8px;
    margin-top: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    color: #888;
    font-family: 'Geist Pixel', system-ui;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.card-details-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--fg);
    border-color: var(--fg);
}

body.always-show-more .card-details {
    max-height: 1000px;
    opacity: 1;
    padding: 6px 0;
}

body.always-show-more .card-details.collapsed {
    max-height: 1000px;
    opacity: 1;
    padding: 6px 0;
}

body.always-show-more .card-details-toggle {
    display: none;
}

.card-overlay-button {
    position: absolute;
    bottom: -8px;
    right: 6px;
    z-index: 10;
    padding: 3px 8px;
    font-size: .65rem;
    font-weight: bold;
    background: #000;
    border: 1px solid #fff;
    color: #fff;
    border-radius: 0;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: 0.3s;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.4);
    text-shadow: none;
    font-family: inherit;
}

.card-overlay-button:hover {
    background: #fff;
    color: #000;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.5);
    text-shadow: none;
}

.card-overlay {
    display: none;
    padding: 10px 15px;
    width: 100%;
    box-sizing: border-box;
    transform: none;
}

.card-overlay.active {
    display: block;
}

.card-overlay-title {
    font-size: 1rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 10px;
    color: #fff;
    text-align: center;
    transform: none;
}

.card-overlay-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.card-overlay-item {
    display: block;
    padding: 12px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    width: 100%;
    box-sizing: border-box;
    transform: none;
}

.card-overlay-item:first-child {
    border-top: none;
}

.card-overlay-item-name {
    font-weight: bold;
    color: #fff;
}

.card-overlay-item-value {
    color: #0f0;
    text-shadow: 0 0 5px #0f0;
    font-weight: bold;
}

.back-to-card-btn {
    display: block;
    width: 100%;
    padding: 8px;
    margin-top: 12px;
    background: #000;
    border: 1px solid #444;
    color: #fff;
    font-family: inherit;
    font-size: .75rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: 0.3s;
}

.back-to-card-btn:hover {
    border-color: #fff;
    background: #fff;
    color: #000;
}

.card-front-content.hidden {
    display: none;
}

.attachment-group {
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 4px;
}

.attachment-category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
    letter-spacing: normal;
    color: #fff;
    transition: opacity 0.2s;
    user-select: none;
    text-decoration: underline;
    text-underline-offset: 4px;
    text-decoration-color: rgba(255, 255, 255, 0.2);
    text-transform: none;
    transform: none;
}

.attachment-category-header:hover {
    opacity: 0.75;
}

.attachment-chevron {
    font-size: .6rem;
    transition: transform 0.3s ease;
    opacity: 0.6;
}

.attachment-group.open .attachment-chevron {
    transform: rotate(180deg);
}

.attachment-category-items {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease, padding 0.2s ease;
    padding: 0 0 0 8px;
}

.attachment-group.open .attachment-category-items {
    max-height: 3000px;
    padding: 10px 0 10px 5px;
    overflow-wrap: break-word;
}

.attachment-category-items .card-overlay-item {
    font-weight: normal;
    font-size: 1rem;
    letter-spacing: normal;
    opacity: 1;
}

.attachment-category-items .card-overlay-item-name {
    font-weight: normal;
    color: #fff;
}
