/* --- ESTILOS ESPECÍFICOS: PROFILE --- */

.profile-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.profile-card-wrap {
    position: relative;
    width: 100%;
    max-width: 860px;
    margin: 40px 0 35px;

    background-image: url('../img/card.png');
    background-repeat: no-repeat;
    background-size: 100% 100%;
    background-position: center;

    padding: 34px 54px 42px;

    display: flex;
    flex-direction: column;
    align-items: stretch;

    filter: drop-shadow(5px 10px 10px rgba(0, 0, 0, 0.6));
}

/* ── Cabecera del perfil ── */
.profile-header {
    display: flex;
    align-items: center;
    gap: 20px;
    padding-bottom: 24px;
    border-bottom: 1px solid rgba(255, 202, 40, 0.28);
    margin-bottom: 24px;
}

.profile-avatar {
    font-size: 3.2rem;
    line-height: 1;
    flex-shrink: 0;
}

.profile-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.profile-nickname {
    font-family: 'Pirata One', cursive;
    font-size: 2rem;
    color: var(--gold-treasure);
    text-shadow:
        2px 2px 0px var(--text-dark),
        -1px -1px 0px var(--text-dark),
        1px -1px 0px var(--text-dark),
        -1px 1px 0px var(--text-dark);
    margin: 0;
    line-height: 1.1;
}

.profile-nickname-input {
    background: transparent;
    border: none;
    border-bottom: 2px solid rgba(255, 202, 40, 0.35);
    border-radius: 0;
    color: var(--gold-treasure);
    font-family: 'Pirata One', cursive;
    font-size: 2rem;
    line-height: 1.1;
    padding: 2px 4px;
    width: 100%;
    outline: none;
    transition: border-color 0.2s;
    text-shadow:
        2px 2px 0px var(--text-dark),
        -1px -1px 0px var(--text-dark),
        1px -1px 0px var(--text-dark),
        -1px 1px 0px var(--text-dark);
}

.profile-nickname-input::placeholder {
    color: rgba(255, 202, 40, 0.35);
    text-shadow: none;
}

.profile-nickname-input:focus {
    border-bottom-color: var(--gold-treasure);
}

.profile-edit-hint {
    font-size: 0.82rem;
    color: rgba(255, 202, 40, 0.75);
    margin: 4px 0 0;
}

.input-error {
    font-size: 0.8rem;
    color: #ff6b6b;
    margin: 4px 0 0;
}
.input-error.hidden { display: none; }

/* ── Banner mejor racha ── */
.profile-best {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 18px;
    background: rgba(255, 202, 40, 0.18);
    border: 2px solid rgba(255, 202, 40, 0.55);
    border-radius: 14px;
    box-shadow: 0 0 10px rgba(255, 179, 0, 0.2);
    margin-bottom: 28px;
}

.profile-best.hidden { display: none; }

.profile-best-label {
    font-family: 'Pirata One', cursive;
    font-size: 1rem;
    color: #ffca28;
    text-shadow: 1px 1px 0 #211512;
    white-space: nowrap;
}

.profile-best-value {
    font-family: 'Pirata One', cursive;
    font-size: 1.5rem;
    color: #ffca28;
    text-shadow: 1.5px 1.5px 0 #211512;
    display: flex;
    align-items: center;
    gap: 6px;
}

.profile-best-unit {
    font-size: 1rem;
    color: rgba(255, 202, 40, 0.75);
}

.profile-best-game {
    font-size: 1rem;
    color: rgba(255, 202, 40, 0.75);
}

.profile-best-game::before {
    content: '·';
    margin-right: 6px;
    color: rgba(255, 202, 40, 0.5);
}

/* ── Sin datos ── */
.profile-no-data {
    font-family: 'Pirata One', cursive;
    font-size: 1.1rem;
    color: rgba(255, 202, 40, 0.65);
    text-align: center;
    padding: 30px 0;
}

.profile-no-data.hidden { display: none; }

/* ── Grid de juegos ── */
.profile-games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

/* ── Tarjeta de juego ── */
.profile-game-card {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 202, 40, 0.2);
    border-radius: 14px;
    padding: 16px 14px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: border-color 0.2s, transform 0.15s;
    position: relative;
}

.profile-game-card:hover {
    border-color: rgba(255, 202, 40, 0.5);
    transform: translateY(-2px);
}

.profile-game-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 202, 40, 0.15);
}

.profile-game-icon-img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    flex-shrink: 0;
}

.profile-game-name {
    font-family: 'Pirata One', cursive;
    font-size: 0.95rem;
    color: var(--gold-treasure);
    text-shadow: 1px 1px 0 #211512;
    line-height: 1.1;
}

.profile-game-stats {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.profile-stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.profile-stat-label {
    font-size: 0.75rem;
    color: rgba(255, 202, 40, 0.65);
    font-family: 'Roboto', sans-serif;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.profile-stat-value {
    font-family: 'Pirata One', cursive;
    font-size: 1.05rem;
    color: #ffca28;
    text-shadow: 1px 1px 0 #211512;
    display: flex;
    align-items: center;
    gap: 3px;
}

.profile-stat-value.record {
    color: #ffd700;
    font-size: 1.15rem;
}

/* Tarjeta no jugada */
.profile-game-card.not-played {
    opacity: 0.6;
    filter: grayscale(40%);
}

.profile-not-played-label {
    font-size: 0.78rem;
    color: rgba(255, 202, 40, 0.5);
    font-family: 'Roboto', sans-serif;
    font-style: italic;
    text-align: center;
    padding: 6px 0;
}

/* Badge "jugado hoy" */
.profile-played-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 10px;
    height: 10px;
    background: #4caf50;
    border-radius: 50%;
    box-shadow: 0 0 6px rgba(76, 175, 80, 0.7);
    title: attr(data-title);
}

/* Divider entre racha actual y récord */
.profile-stat-divider {
    height: 1px;
    background: rgba(255, 202, 40, 0.15);
    margin: 2px 0;
}

.back-container {
    margin-bottom: 30px;
}

/* ── Responsive ── */
@media (max-width: 600px) {
    .profile-card-wrap {
        margin: 15px 0;
        padding: 28px 22px 32px;
    }

    .profile-header {
        gap: 14px;
        padding-bottom: 18px;
        margin-bottom: 18px;
    }

    .profile-avatar {
        font-size: 2.4rem;
    }

    .profile-nickname {
        font-size: 1.5rem;
    }

    .profile-best {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
        margin-bottom: 20px;
    }

    .profile-games-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .profile-game-card {
        padding: 12px 10px 10px;
    }

    .profile-game-name {
        font-size: 0.85rem;
    }
}

@media (max-width: 360px) {
    .profile-games-grid {
        grid-template-columns: 1fr;
    }
}
