/* ═══════════════════════════════════════════════════════════════════
   Token Clash — Card Detail Modal (TC-DNA)
   ───────────────────────────────────────────────────────────────────
   Central, TC-DNA-skinned styling for the shared card-detail modal
   (opened by the ⓘ info-button / long-press / right-click on any card
   grid — deck, collection, card library). Loaded LAST in index.html so
   it overrides the older scattered .card-detail-* rules that live in
   collection.css / cardlibrary.css / battle.css.

   Also styles the ⓘ info-button (.tc-info-btn) that sits on card tiles
   and the "Add to Deck" button (.card-detail-add) rendered when the
   caller passes an onAdd callback (deck builder).
   ═══════════════════════════════════════════════════════════════════ */

/* ── ⓘ info-button on card tiles (below the count, clear of the role
   watermark) ─────────────────────────────────────────────────────── */
.tc-info-btn {
    position: absolute;
    top: 26%;
    right: 5%;
    z-index: 8;
    width: 21px;
    height: 21px;
    padding: 0;
    border-radius: 50%;
    cursor: pointer;
    color: #46E0FF;
    background: rgba(6, 9, 15, .85);
    border: 1px solid rgba(70, 224, 255, .6);
    box-shadow: 0 1px 3px rgba(0, 0, 0, .7);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s ease;
}
.tc-info-btn svg { width: 12px; height: 12px; display: block; }
.tc-info-btn:hover { background: rgba(70, 224, 255, .2); }

/* ── backdrop ─────────────────────────────────────────────────────── */
.card-detail-overlay {
    position: fixed;
    inset: 0;
    background: rgba(4, 7, 14, .82);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 20000;
    animation: fadeIn .2s ease-out;
    padding: 18px;
}

/* ── modal shell = notched gunmetal panel + gradient top edge ─────── */
.card-detail-modal {
    background: linear-gradient(180deg, rgba(20, 28, 46, .96), rgba(10, 14, 24, .98)) !important;
    border: 1px solid rgba(120, 160, 210, .18) !important;
    border-radius: 16px !important;
    padding: 22px !important;
    max-width: 420px !important;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: scaleIn .2s ease-out;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .6) !important;
    clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 18px 100%, 0 calc(100% - 18px));
}
.card-detail-modal::before {
    content: "";
    position: absolute;
    left: 0; top: 0;
    height: 3px; width: 100%;
    background: linear-gradient(96deg, #FFC95C, #46E0FF);
    opacity: .9;
}
/* Rarity accent = coloured top edge (kills the old solid rarity borders + pulse) */
.card-detail-modal.rare::before      { background: linear-gradient(96deg, #46E0FF, #9CEBFF); }
.card-detail-modal.epic::before      { background: linear-gradient(96deg, #b07bff, #46E0FF); }
.card-detail-modal.legendary::before { background: linear-gradient(96deg, #FFB347, #FFE6A6); }
.card-detail-modal.common,
.card-detail-modal.rare,
.card-detail-modal.epic,
.card-detail-modal.legendary {
    animation: scaleIn .2s ease-out !important;
}

.card-detail-close {
    position: absolute;
    top: 12px; right: 14px;
    width: 32px; height: 32px;
    background: rgba(13, 19, 32, .7);
    border: 1px solid rgba(120, 160, 210, .16);
    border-radius: 9px;
    color: #8595b0;
    font-size: 15px;
    cursor: pointer;
    z-index: 3;
    transition: color .15s, border-color .15s;
}
.card-detail-close:hover { color: #e8eefb; border-color: rgba(120, 160, 210, .34); }

/* ── card image (keeps the SVG frame overlay + sparkle/foil children) ── */
.card-detail-image {
    width: 100%;
    aspect-ratio: 3 / 4;
    max-width: 240px;
    margin: 2px auto 16px !important;
    background: #0d0d1a !important;
    border-radius: 12px !important;
    position: relative;
    overflow: hidden;
    isolation: isolate;
}
.card-detail-image img {
    width: 100%; height: 100%;
    object-fit: cover;
    object-position: center top;
    display: block;
}

.card-detail-info { text-align: center; }

.card-detail-name {
    font-family: 'Space Grotesk', sans-serif !important;
    font-weight: 700 !important;
    font-size: 1.4rem !important;
    letter-spacing: .3px;
    margin-bottom: 10px !important;
    background: linear-gradient(96deg, #FFC95C 0%, #FFE6A6 35%, #9CEBFF 70%, #46E0FF 100%);
    -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* ── meta chips ───────────────────────────────────────────────────── */
.card-detail-meta {
    display: flex; justify-content: center; flex-wrap: wrap;
    gap: 7px; margin-bottom: 16px;
}
.card-detail-rarity,
.card-detail-role,
.card-detail-type,
.card-detail-ecosystem,
.card-detail-chain {
    padding: 4px 10px !important;
    border-radius: 8px !important;
    font-size: .68rem !important;
    font-weight: 700;
    letter-spacing: .4px;
    border: 1px solid rgba(120, 160, 210, .18);
    background: rgba(13, 19, 32, .6) !important;
    color: #cfe0f5 !important;
    text-transform: uppercase;
}
.card-detail-rarity.common      { color: #8aa0bf !important; }
.card-detail-rarity.rare         { color: #46E0FF !important; border-color: rgba(70,224,255,.35); }
.card-detail-rarity.epic         { color: #b07bff !important; border-color: rgba(176,123,255,.4); }
.card-detail-rarity.legendary    { color: #0a0a12 !important; border: none;
    background: linear-gradient(96deg, #FFC95C, #FFE6A6) !important; }
.card-detail-role                { color: #46E0FF !important; border-color: rgba(70,224,255,.3); }
.card-detail-ecosystem           { color: #9CEBFF !important; }

/* ── stat cards (HP / ATK / DEF / GAS) ────────────────────────────── */
.card-detail-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}
.card-detail-stat {
    background: rgba(8, 12, 22, .6) !important;
    border: 1px solid rgba(120, 160, 210, .14) !important;
    border-radius: 11px !important;
    padding: 10px 4px !important;
    text-align: center;
}
.card-detail-stat-icon { font-size: .95rem; margin-bottom: 3px; }
.card-detail-stat-value {
    font-family: 'JetBrains Mono', monospace !important;
    font-weight: 800 !important;
    font-size: 1.3rem !important;
    line-height: 1;
    color: #e8eefb !important;
}
.card-detail-stat-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: .58rem !important;
    font-weight: 700;
    letter-spacing: 1px;
    color: #8595b0 !important;
    margin-top: 3px;
}
.card-detail-stat-sublabel {
    font-size: .5rem !important;
    color: #8595b0 !important;
    opacity: .7;
    margin-top: 2px;
}
/* per-stat colours (HP · ATK · DEF · GAS order) */
.card-detail-stats .card-detail-stat:nth-child(1) .card-detail-stat-value { color: #ffb0b0 !important; }
.card-detail-stats .card-detail-stat:nth-child(2) .card-detail-stat-value { color: #ffdd9a !important; }
.card-detail-stats .card-detail-stat:nth-child(3) .card-detail-stat-value { color: #9fe0ff !important; }
.card-detail-stats .card-detail-stat:nth-child(4) .card-detail-stat-value { color: #8fe0ff !important; }
/* TX / Trap detail has a single GAS stat → keep it cyan, not HP-red */
.card-detail-modal.tx-detail .card-detail-stat-value { color: #8fe0ff !important; }

/* ── ability block (cyan) ─────────────────────────────────────────── */
.card-detail-ability {
    background: rgba(70, 224, 255, .05) !important;
    border: 1px solid rgba(70, 224, 255, .22) !important;
    border-radius: 12px !important;
    padding: 13px 15px !important;
    text-align: left;
}
.card-detail-ability-header {
    display: flex; align-items: center; gap: 9px; margin-bottom: 7px;
}
.card-detail-ability-trigger {
    font-family: 'JetBrains Mono', monospace !important;
    font-weight: 700;
    font-size: .6rem !important;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #0a0a12 !important;
    background: linear-gradient(96deg, #9CEBFF, #46E0FF) !important;
    padding: 3px 8px !important;
    border-radius: 6px !important;
}
.card-detail-ability-title {
    color: #46E0FF !important;
    font-weight: 700;
    font-size: .88rem !important;
}
.card-detail-ability-text {
    color: #e8eefb !important;
    font-size: .85rem !important;
    line-height: 1.45;
}

/* ── combo block (gold) ───────────────────────────────────────────── */
.card-detail-combo {
    margin-top: 12px;
    background: rgba(255, 201, 92, .05) !important;
    border: 1px solid rgba(255, 201, 92, .25) !important;
    border-left: 1px solid rgba(255, 201, 92, .25) !important;
    border-radius: 12px !important;
    padding: 13px 15px !important;
    text-align: left;
}
.card-detail-combo-header { color: #FFE6A6 !important; font-weight: 700; font-size: .85rem !important; margin-bottom: 8px; }
.card-detail-combo-item + .card-detail-combo-item { border-top: 1px solid rgba(255, 201, 92, .2); margin-top: 8px; padding-top: 8px; }
.combo-partner-label { color: #8595b0 !important; font-size: .75rem; }
.combo-partner-name  { color: #FFE6A6 !important; font-weight: 700; font-size: .75rem; }
.card-detail-combo-name   { color: #FFE6A6 !important; font-weight: 700; font-size: .82rem !important; margin-bottom: 4px; }
.card-detail-combo-effect { color: #8595b0 !important; font-size: .78rem !important; line-height: 1.4; }

/* ── TX / Trap badge next to the name ─────────────────────────────── */
.tx-badge-detail {
    font-size: .6rem !important;
    font-weight: 700;
    letter-spacing: .5px;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 6px;
    background: rgba(70, 224, 255, .14);
    color: #46E0FF;
    vertical-align: middle;
}
.tx-badge-detail.trap-badge-detail { background: rgba(255, 170, 60, .16); color: #ffb340; }

/* ── "Add to Deck" CTA (deck builder only) ────────────────────────── */
.card-detail-add {
    width: 100%;
    margin-top: 16px;
    padding: 13px !important;
    border: none !important;
    border-radius: 12px !important;
    cursor: pointer;
    font-family: 'Space Grotesk', sans-serif !important;
    font-weight: 700 !important;
    letter-spacing: 1px;
    font-size: 15px !important;
    color: #0a0a12 !important;
    background: linear-gradient(96deg, #FFC95C 0%, #FFE6A6 30%, #9CEBFF 70%, #46E0FF 100%) !important;
    box-shadow: 0 10px 26px rgba(70, 224, 255, .22), 0 4px 10px rgba(255, 201, 92, .18);
    display: flex; align-items: center; justify-content: center; gap: 8px;
}
.card-detail-add:hover { filter: brightness(1.05); }
.card-detail-add-plus { font-size: 20px; line-height: 0; font-weight: 800; }
