/* Character Selection */

#character-selection-screen {
    position: fixed;
    top: 0; 
    left: 0;
    width: 100%; 
    height: 100%;
    background: radial-gradient(circle at center, rgba(10, 15, 20, 0.95) 0%, #000 100%);
    z-index: 2900;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
    animation: screenFadeIn 0.3s ease-out;
}

#char-select-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    width: 100%;
    padding: 5px 60px;
}

.char-card {
    background: linear-gradient(180deg, rgba(20, 25, 35, 0.95) 0%, rgba(5, 5, 10, 0.98) 100%);
    border: 1px solid #333;
    border-top: 4px solid #444;
    border-radius: 4px;
    width: 360px;
    min-width: 360px;
    min-height: 350px;
    display: flex;
    flex-direction: column;
    padding: 4px 15px;
    transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
    cursor: pointer;
    position: relative;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.char-card.selected {
    border-color: var(--accent);
    border-top-color: var(--accent);
    box-shadow: 
        0 0 30px rgba(0, 217, 255, 0.15),
        inset 0 0 20px rgba(0, 217, 255, 0.05);
    background: linear-gradient(180deg, rgba(20, 35, 45, 0.95) 0%, rgba(5, 10, 15, 0.98) 100%);
    transform: translateY(-5px) scale(1.02);
    z-index: 10;
}

.char-card.locked-char {
    opacity: 0.6;
    filter: grayscale(100%);
    background: repeating-linear-gradient(
        45deg,
        #080808,
        #080808 10px,
        #111 10px,
        #111 20px
    );
    border-color: #222;
    cursor: not-allowed;
}

.char-card.locked-char::after {
    content: '🔒';
    position: absolute;
    right: 20px;
    font-size: 2rem;
    opacity: 0.2;
}

.char-header {
    display: flex;
    gap: 15px;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 10px;
}

.char-portrait-lg {
    width: 50px;
    height: 50px;
    background: #000;
    border: 2px solid #444;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.8);
}

@keyframes border-surge {
    0%, 100% {
        border-color: var(--accent);
        box-shadow: 0 0 10px var(--accent-glow);
    }
    50% {
        border-color: #ffffff; 
        box-shadow: 0 0 25px var(--accent), 0 0 8px #ffffff; 
    }
}

/* 3. Apply animations to the selected portrait */
.char-card.selected .char-portrait-lg {
    animation: border-surge 3s infinite ease-in-out;
    position: relative;
    z-index: 5;
    background-color: #000;
}

.char-card.selected .char-portrait-lg::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.2),
        rgba(0, 0, 0, 0.2) 1px,
        transparent 1px,
        transparent 2px
    );
    pointer-events: none;
    z-index: 3;
}

.char-title {
    flex: 1;
}

.char-name {
    font-family: 'Courier New', monospace;
    font-size: 1rem;
    font-weight: 900;
    color: #fff;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.char-card.selected .char-name {
    color: var(--accent);
    text-shadow: 0 0 10px rgba(0, 217, 255, 0.4);
}

.char-desc {
    font-size: 0.75rem;
    color: #889;
    line-height: 1.3;
    font-style: italic;
}

.char-passives-list {
    flex: 1;
    background: transparent;
    padding: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Individual Passive Row - Matches Diff Stats */
.char-passive-row {
    display: flex;
    gap: 6px;
    padding: 4px;
    background: rgba(0, 0, 0, 0.4);
    border-left: 3px solid #333;
    border-radius: 0 4px 4px 0;
    align-items: center;
    transition: all 0.2s;
}

.char-passive-row.unlocked {
    border-left-color: var(--success);
    background: linear-gradient(90deg, rgba(0, 255, 136, 0.05) 0%, transparent 100%);
}

.char-passive-row.locked {
    border-left-color: #444;
    color: #555;
    opacity: 0.7;
}

.cp-info {
    display: flex;
    flex-direction: column;
}

.cp-name {
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    font-weight: 800;
    color: #eee;
    margin-bottom: 2px;
    text-transform: uppercase;
}

.char-passive-row.unlocked .cp-name {
    color: var(--success);
    text-shadow: 0 0 5px rgba(0, 255, 136, 0.3);
}

.cp-desc {
    font-size: 0.75rem;
    color: #999;
    line-height: 1.2;
}

/* --- BUTTONS --- */
.char-select-btn {
    width: 100%;
    padding: 10px 0;
    background: transparent;
    border: 2px solid #444;
    color: #888;
    font-family: 'Rajdhani', sans-serif;
    font-weight: 800;
    font-size: 0.9rem;
    letter-spacing: 2px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 4px;
    text-transform: uppercase;
}

.char-card.selected .char-select-btn {
    background: var(--accent);
    color: #000;
    border-color: var(--accent);
    box-shadow: 0 0 15px var(--accent-glow);
}

.char-select-btn:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
    border-color: #fff;
}

.char-select-btn.disabled {
    border-color: #331111;
    color: #522;
    background: rgba(20, 0, 0, 0.5);
    pointer-events: none;
}

/* Back Button */
#close-char-btn {
    background: transparent;
    border: 2px solid #555;
    color: #888;
    font-family: 'Rajdhani', sans-serif;
    font-weight: 700;
    font-size: 1.2rem;
    letter-spacing: 3px;
    padding: 12px 20px;
    border-radius: 4px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s ease;
}

#char-bios-btn {
    flex: 1;
    background: transparent;
    border: 2px solid rgb(0, 255, 136);
    color: rgb(0, 255, 136);
    font-family: 'Rajdhani', sans-serif;
    font-weight: 700;
    font-size: 1.2rem;
    letter-spacing: 3px;
    padding: 12px 20px;
    border-radius: 4px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s ease;
}

#close-char-btn:hover, #char-bios-btn:hover {
    border-color: #fff;
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.results-char-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: fadeDown 0.8s ease forwards;
}

.res-char-img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 3px solid var(--accent);
    background-color: #000;
    background-position: center;
    background-size: cover;
    box-shadow: 0 0 20px rgba(0, 217, 255, 0.3);
    margin-bottom: 10px;
}

.res-char-name {
    font-size: 1.2rem;
    font-weight: bold;
    color: #fff;
    letter-spacing: 2px;
    text-shadow: 0 0 10px rgba(255,255,255,0.3);
}

.char-card.mastered-char {
    border-color: #ffd700;
    border-top-color: #ffd700;
    box-shadow: 0 5px 20px rgba(255, 215, 0, 0.15);
}

.char-card.mastered-char:hover {
    box-shadow: 0 10px 30px rgba(255, 215, 0, 0.3);
}

.char-card.mastered-char.selected {
    border-color: #ffd700;
    border-top-color: #ffd700;
    box-shadow: 
        0 0 30px rgba(255, 215, 0, 0.4),
        inset 0 0 20px rgba(255, 215, 0, 0.1);
}

.char-card.mastered-char .char-name {
    color: #ffd700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.4);
}

.char-card.mastered-char.selected .char-portrait-lg {
    animation: gold-border-surge 3s infinite ease-in-out;
}

@keyframes gold-border-surge {
    0%, 100% {
        border-color: #ffd700;
        box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
    }
    50% {
        border-color: #ffffff; 
        box-shadow: 0 0 25px #ffd700, 0 0 8px #ffffff; 
    }
}