/* cards.css - Card rendering, rarity glows, element badges */

.game-card {
    width: var(--card-w);
    height: var(--card-h);
    border-radius: 8px;
    background: linear-gradient(160deg, #1a1a30, #0e0e20);
    border: 2px solid rgba(255,255,255,0.15);
    position: relative;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    overflow: hidden;
    flex-shrink: 0;
    user-select: none;
}
.game-card:hover {
    transform: translateY(-8px) scale(1.05);
    z-index: 10;
}
.game-card.selected {
    border-color: var(--gold);
    box-shadow: 0 0 16px rgba(255,215,0,0.4);
    transform: translateY(-12px) scale(1.08);
}
.game-card.disabled {
    opacity: 0.5;
    pointer-events: none;
}
.game-card.face-down {
    background-image: url('../assets/cards/black_back_intricate.png');
    background-size: cover;
    border-color: rgba(100,100,150,0.3);
}
.game-card.face-down * { visibility: hidden; }

/* Rarity borders */
.game-card.common { border-color: var(--common); }
.game-card.uncommon { border-color: var(--uncommon); box-shadow: 0 0 8px rgba(51,204,85,0.2); }
.game-card.rare { border-color: var(--rare); box-shadow: 0 0 10px rgba(51,153,255,0.3); }
.game-card.legendary {
    border-color: var(--legendary);
    box-shadow: 0 0 16px rgba(255,153,0,0.4);
    animation: legendaryPulse 2s ease-in-out infinite;
}
@keyframes legendaryPulse {
    0%, 100% { box-shadow: 0 0 12px rgba(255,153,0,0.3); }
    50% { box-shadow: 0 0 24px rgba(255,153,0,0.6); }
}

/* Card layout */
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 6px 2px;
}
.card-mana {
    width: 22px; height: 22px;
    background: linear-gradient(135deg, #2255bb, #4488ff);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 900; color: #fff;
    border: 1px solid rgba(255,255,255,0.3);
    text-shadow: 0 1px 2px rgba(0,0,0,0.6);
}
.card-element-badge {
    width: 18px; height: 18px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 10px;
}
.card-element-badge img {
    width: 16px; height: 16px;
    object-fit: contain;
}
.card-art-area {
    width: 100%;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 2px;
}
.card-art-area img {
    max-width: 60px;
    max-height: 58px;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
    image-rendering: auto;
}
.card-name {
    font-size: 10px;
    font-weight: 700;
    text-align: center;
    padding: 1px 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}
.card-desc {
    font-size: 8px;
    text-align: center;
    padding: 1px 5px;
    color: var(--text-dim);
    line-height: 1.2;
    max-height: 24px;
    overflow: hidden;
}
.card-stats {
    display: flex;
    justify-content: space-around;
    padding: 3px 4px;
    font-size: 11px;
    font-weight: 700;
}
.card-stat {
    display: flex;
    align-items: center;
    gap: 2px;
}
.card-stat-atk { color: #ff6644; }
.card-stat-def { color: #4499ff; }
.card-stat-hp { color: #44cc55; }
.card-type-label {
    position: absolute;
    top: 0; left: 50%;
    transform: translateX(-50%);
    font-size: 7px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.4);
    padding: 1px 6px;
    background: rgba(0,0,0,0.4);
    border-radius: 0 0 4px 4px;
}

/* Element colors on card background */
.game-card.el-fire { background: linear-gradient(160deg, #2a1510, #0e0e20); }
.game-card.el-water { background: linear-gradient(160deg, #10182a, #0e0e20); }
.game-card.el-nature { background: linear-gradient(160deg, #0e2a10, #0e0e20); }
.game-card.el-light { background: linear-gradient(160deg, #2a2810, #0e0e20); }
.game-card.el-dark { background: linear-gradient(160deg, #1a0e2a, #0e0e20); }
.game-card.el-neutral { background: linear-gradient(160deg, #1a1a25, #0e0e20); }

/* Card type markers */
.game-card.type-spell .card-art-area { background: radial-gradient(circle, rgba(100,60,200,0.15), transparent); }
.game-card.type-trap .card-art-area { background: radial-gradient(circle, rgba(200,60,60,0.15), transparent); }

/* Field card (smaller) */
.field-card {
    width: var(--field-card-w);
    height: var(--field-card-h);
}
.field-card .card-art-area { height: 50px; }
.field-card .card-art-area img { max-width: 46px; max-height: 44px; }
.field-card .card-mana { width: 18px; height: 18px; font-size: 10px; }
.field-card .card-name { font-size: 9px; }
.field-card .card-desc { display: none; }
.field-card .card-stats { font-size: 10px; }
.field-card .card-element-badge { width: 14px; height: 14px; }
.field-card .card-element-badge img { width: 12px; height: 12px; }

/* HP bar on field cards */
.field-hp-bar {
    width: calc(100% - 8px);
    height: 4px;
    background: rgba(0,0,0,0.5);
    border-radius: 2px;
    margin: 0 auto 2px;
    overflow: hidden;
}
.field-hp-fill {
    height: 100%;
    background: linear-gradient(90deg, #44cc55, #22aa33);
    transition: width 0.3s;
    border-radius: 2px;
}
.field-hp-fill.low { background: linear-gradient(90deg, #ee3344, #cc2233); }

/* Card in hand hover detail */
.card-detail-popup {
    position: fixed;
    width: 240px;
    background: var(--panel-bg);
    border: 2px solid rgba(255,255,255,0.2);
    border-radius: 12px;
    padding: 16px;
    z-index: 60;
    pointer-events: none;
    box-shadow: 0 8px 32px rgba(0,0,0,0.6);
}
.card-detail-art { text-align: center; margin-bottom: 8px; }
.card-detail-art img { width: 80px; height: 80px; object-fit: contain; }
.card-detail-name { font-size: 16px; font-weight: 700; text-align: center; margin-bottom: 4px; }
.card-detail-type { font-size: 11px; color: var(--text-dim); text-align: center; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 8px; }
.card-detail-stats { display: flex; justify-content: center; gap: 16px; margin-bottom: 8px; font-size: 14px; font-weight: 700; }
.card-detail-desc { font-size: 12px; color: var(--text-dim); text-align: center; line-height: 1.5; margin-bottom: 8px; }
.card-detail-flavor { font-size: 11px; color: rgba(255,255,255,0.25); font-style: italic; text-align: center; }

/* Deck pile visual */
.deck-pile {
    width: 80px;
    height: 110px;
    position: relative;
    cursor: pointer;
}
.deck-pile-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.5);
}
.deck-pile-count {
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-dark);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 10px;
    padding: 1px 8px;
    font-size: 11px;
    font-weight: 700;
}

@media(max-width:640px){
    :root{--card-w:80px;--card-h:115px;--field-card-w:70px;--field-card-h:92px}
    .game-card{border-radius:6px;min-width:75px}
    .game-card .card-header{padding:3px 4px 1px}
    .game-card .card-art-area{height:44px}
    .game-card .card-art-area img{max-width:40px;max-height:38px}
    .game-card .card-name{font-size:9px;padding:1px 3px}
    .game-card .card-desc{font-size:7px;max-height:16px;padding:0 3px}
    .game-card .card-stats{font-size:10px;padding:2px 3px}
    .game-card .card-mana{width:20px;height:20px;font-size:11px;font-weight:900}
    .game-card .card-stat{gap:1px}
    .field-card{min-width:65px}
    .field-card .card-art-area{height:34px}
    .field-card .card-art-area img{max-width:32px;max-height:30px}
    .field-card .card-name{font-size:8px}
    .field-card .card-stats{font-size:9px}
    .field-card .card-mana{width:16px;height:16px;font-size:9px}
    .field-hp-bar{height:5px;margin:0 auto 1px}
    .card-detail-popup{width:200px;padding:10px}
    .card-detail-name{font-size:14px}
    .card-detail-desc{font-size:11px}
    .deck-pile{width:55px;height:78px}
    .reward-card-wrapper .game-card{width:110px;height:155px}
    .reward-card-wrapper .game-card .card-art-area{height:50px}
    .reward-card-wrapper .game-card .card-name{font-size:10px}
    .reward-card-wrapper .game-card .card-stats{font-size:11px}
}
@media(max-width:400px){
    :root{--card-w:78px;--card-h:110px;--field-card-w:66px;--field-card-h:88px}
    .game-card{min-width:72px}
    .game-card .card-art-area{height:40px}
    .game-card .card-name{font-size:8px}
    .field-card{min-width:60px}
    .reward-card-wrapper .game-card{width:100px;height:140px}
}
