/* CHARACTER SELECTION & LOADER STYLES (v7.2.1) */

#character-selection-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    width: 95%;
    max-width: 850px;
    margin: 0 auto;
    text-align: center;
}

/* Animations */
@keyframes fadeInSlide {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes titleShimmer {
    0% {
        background-position: 0% 50%;
    }

    100% {
        background-position: 200% 50%;
    }
}

/* Branding Section */
.brand-section {
    margin-bottom: 20px;
    animation: fadeInSlide 0.8s ease-out forwards;
}

.brand-title {
    color: #FFD580;
    font-family: 'Outfit', sans-serif;
    font-size: 2.8em !important;
    font-weight: 900;
    margin: 0 0 10px 0 !important;
    text-shadow: 0 0 20px rgba(255, 213, 128, 0.4);
    letter-spacing: 2px;
    background: linear-gradient(90deg, #FFD580, #FFA726, #FF9100, #FFD580);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: titleShimmer 3s linear infinite;
}

/* Fallback for title if gradient fails */
.brand-title:empty {
    color: #FFD580;
}

.brand-tagline {
    color: #FFFFFF;
    font-size: 1.1em !important;
    font-weight: 500;
    margin-top: 0 !important;
    margin-bottom: 8px !important;
    opacity: 0.9;
}

.brand-subtitle {
    color: rgba(255, 213, 128, 0.7);
    font-size: 0.85em !important;
    line-height: 1.6;
    max-width: 600px;
    margin: 0 auto 15px auto !important;
}

/* Character Selection Title */
#selection-title {
    color: #FFD580;
    font-family: 'Outfit', sans-serif;
    margin: 15px 0 10px 0;
    font-size: 1.4em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Cards Layout */
.character-cards-inline {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin: 10px 0;
    width: 100%;
    flex-wrap: nowrap;
    /* Prevent wrapping on desktop, handle with media queries */
}

.character-card-inline {
    width: 160px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    border-radius: 15px;
    padding: 10px;
    box-sizing: border-box;
}

.character-card-inline:hover {
    transform: translateY(-5px);
}

.character-image {
    width: 100%;
    aspect-ratio: 2/3;
    border-radius: 12px;
    border: 2px solid transparent;
    transition: all 0.3s;
    background: transparent;
    object-fit: contain;
}

.character-card-inline.selected .character-image {
    border-color: #FFD580;
    box-shadow: 0 0 25px rgba(255, 213, 128, 0.5);
}

.character-name-inline {
    font-size: 1em;
    margin-top: 10px;
    color: #fff;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* Stats Panel */
.character-stats-panel {
    background: rgba(20, 20, 20, 0.85);
    border: 1px solid rgba(255, 213, 128, 0.2);
    border-radius: 20px;
    padding: 20px 30px;
    width: 100%;
    max-width: 650px;
    backdrop-filter: blur(20px);
    text-align: left;
    margin-top: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);

    /* Initial state for JS animation */
    opacity: 0;
    visibility: hidden;
    transform: translateY(15px);
    transition: all 0.5s cubic-bezier(0.19, 1, 0.22, 1);
}

.character-stats-panel.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.char-desc {
    color: #FFD580;
    font-style: italic;
    font-size: 1em;
    margin-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 12px;
    line-height: 1.5;
}

.char-traits {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 20px;
    margin-bottom: 15px;
}

.char-trait {
    font-size: 0.9em;
    color: #fff;
    display: flex;
    align-items: center;
}

.stat-bar-container {
    margin-top: 15px;
}

.stat-row {
    display: flex;
    align-items: center;
    margin: 6px 0;
}

.stat-label {
    width: 110px;
    font-size: 0.75em;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 700;
}

.stat-bar-bg {
    flex-grow: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    overflow: hidden;
}

.stat-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #FFD580, #FFA726);
    width: 0%;
    transition: width 1.2s cubic-bezier(0.19, 1, 0.22, 1);
    box-shadow: 0 0 10px rgba(255, 167, 38, 0.3);
}

/* Inputs & Buttons */
#name-injection-point {
    margin: 10px 0 20px 0;
}

#username-input {
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 213, 128, 0.3) !important;
    border-radius: 12px !important;
    padding: 12px 24px !important;
    font-size: 18px !important;
    width: 280px !important;
    color: #FFF !important;
    text-align: center !important;
    outline: none !important;
    transition: all 0.3s !important;
}

#username-input:focus {
    background: rgba(255, 255, 255, 0.1) !important;
    border-color: #FFD580 !important;
    box-shadow: 0 0 15px rgba(255, 213, 128, 0.2) !important;
}

#play-button {
    margin: 20px 0 !important;
    background: linear-gradient(135deg, #4CAF50, #45a049) !important;
    color: white !important;
    border: none !important;
    border-radius: 15px !important;
    padding: 16px 50px !important;
    font-size: 20px !important;
    font-weight: 800 !important;
    text-transform: uppercase !important;
    letter-spacing: 2px !important;
    cursor: pointer !important;
    transition: all 0.3s !important;
    box-shadow: 0 10px 25px rgba(76, 175, 80, 0.3) !important;
}

#play-button:hover:not(:disabled) {
    transform: translateY(-3px) scale(1.05) !important;
    box-shadow: 0 15px 35px rgba(76, 175, 80, 0.4) !important;
}

#play-button:disabled {
    opacity: 0.4 !important;
    background: #555 !important;
    cursor: not-allowed !important;
    box-shadow: none !important;
}

/* Responsive Overrides */
@media (max-width: 600px) {
    #character-selection-container {
        padding-top: 25px;
        /* Prevent hitting the top */
        gap: 10px;
    }

    .brand-section {
        margin-bottom: 5px;
    }

    .brand-title {
        font-size: 1.8em !important;
        margin-bottom: 2px !important;
        margin-top: 5px !important;
    }

    .brand-tagline {
        font-size: 0.9em !important;
        margin-bottom: 4px !important;
    }

    .brand-subtitle {
        display: none;
        /* Crucial for one-page fit without scroll */
    }

    #selection-title {
        font-size: 1.1em;
        margin: 5px 0;
    }

    .character-cards-inline {
        flex-direction: row;
        /* Back to row! */
        justify-content: center;
        gap: 8px;
        margin: 5px 0;
    }

    .character-card-inline {
        width: 100px;
        /* Small thumbnails */
        padding: 5px;
    }

    .character-image {
        border-radius: 8px;
    }

    .character-name-inline {
        font-size: 0.8em;
        margin-top: 5px;
    }

    #username-input {
        width: 220px !important;
        padding: 10px 15px !important;
        font-size: 16px !important;
    }

    #play-button {
        padding: 12px 40px !important;
        font-size: 16px !important;
        margin: 10px 0 !important;
    }

    .character-stats-panel {
        padding: 15px;
        margin-top: 10px;
    }
}