/* =========================
   Global Card Styles
   ========================= */

.card {
    background: #121212;
    border-radius: 10px;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
    color: #fff;
    min-height: 320px;
    overflow: hidden;
    padding: 10px;
    position: relative;
    text-align: center;
    transition: transform 0.3s ease-in-out;
    will-change: transform;
}

.card:hover {
    transform: scale(1.1);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.4);
    z-index: 2; /* keep hover from being clipped by neighbors */
}

.card.selectable {
    cursor: pointer;
}

.card.selected {
    outline: 4px solid #28a745;
}

/* Card: Rarity Color Effects */

.card.rarity-common {
    background: linear-gradient(145deg, #555555, #7a7a7a);
    border: 3px solid #8c8c8c;
}

.card.rarity-rare {
    background: linear-gradient(145deg, #004e92, #007bff);
    border: 3px solid #007bff;
}

.card.rarity-epic {
    background: linear-gradient(145deg, #9b59b6, #8e44ad);
    border: 3px solid #8e44ad;
}

.card.rarity-legendary {
    background: linear-gradient(145deg, #f1c40f, #f39c12);
    border: 3px solid #f39c12;
}

/* Card: Layout */

.card .card-body {
    display: flex;
    flex-direction: column;
    padding: 12px;
}

.card .card-top {
    align-items: center;
    display: flex;
    height: 3.6rem;
    justify-content: center;
    margin-bottom: 6px;
    padding: 0 8px;
    text-align: center;
}

.card .card-title {
    box-orient: vertical;
    font-size: 1.2rem;
    color: #fff;
    display: -webkit-box;
    font-weight: 700;
    line-clamp: 2;
    line-height: 1.2;
    margin: 0;
    max-width: 100%;
    overflow: hidden;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.6);
    white-space: normal;
    word-break: break-word;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.card .card-meta {
    align-items: center;
    column-gap: 10px;
    display: grid;
    grid-template-columns: 40px 1fr;
    height: 36px;
    margin-bottom: 8px;
    padding: 0 8px;
    width: 100%;
}

.card .flag {
    display: block;
    height: 24px;
    width: 40px;
}

.card .team-name {
    font-size: 1.05rem;
    color: #ffffff;
    font-style: italic;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
    min-width: 0;             /* required for ellipsis in grid/flex */
    overflow: hidden;
    text-overflow: ellipsis;

    /* Single-line clamp (standard + webkit) */
    display: -webkit-box;
    -webkit-box-orient: vertical;
    box-orient: vertical;
    line-clamp: 1;            /* standard */
    -webkit-line-clamp: 1;    /* webkit */

    white-space: nowrap;      /* ensure single line */
}

/* =========================
   Stats List
   ========================= */
.card .stats-list {
    padding: 0;
    list-style: none;
    font-size: 1rem;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 10px 0 0;
    text-align: left;
    align-items: flex-start;

    /* Fill remaining space; scroll internally if too long */
    flex: 1 1 auto;
    overflow-y: auto;
    max-height: none;
}
.card .stats-list li {
    font-size: 0.9rem;
    font-weight: 400;
    color: #f1f1f1;
}
.card .stats-list li span {
    font-weight: 700;
}

/* =========================
   Responsive Tweaks
   ========================= */
@media (max-width: 768px) {
    .card {
        margin-bottom: 15px;
        height: auto; /* let it grow on small screens */
    }
}
@media (max-width: 576px) {
    .card .card-top { height: 4.2rem; }  /* give names a touch more vertical room */
    .card .card-meta { height: 40px; }
}
