/* === style.css FINAL (Banner Degradê Elegante) === */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }

body {
    font-family: 'Inter', sans-serif;
    background-color: #0f0f0f;
    color: #ffffff;
    display: flex;
    flex-direction: column;
}
a { text-decoration: none; color: inherit; }

/* --- MAIN GERAL --- */
main {
    flex: 1;
    width: 100%;
    display: flex;
    flex-direction: column;
}

/* --- REGRAS ESPECÍFICAS PARA A HOME (TELA INICIAL) --- */
body:not(.pagina-resultado) main {
    justify-content: center; /* Centraliza verticalmente */
    align-items: center;     /* Centraliza horizontalmente */
    padding: 20px;
}

.card-inicial {
    background-color: rgba(255, 255, 255, 0.05);
    padding: 40px;
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    text-align: center;
    max-width: 400px;
    width: 100%;
    box-shadow: 0 20px 40px rgba(0,0,0,0.4);
}
.card-inicial h1 { margin-bottom: 10px; font-weight: 700; }
.card-inicial p { color: #aaaaaa; margin-bottom: 30px; }
.input-group { display: flex; flex-direction: column; gap: 10px; }
input {
    padding: 15px; border-radius: 12px; border: 1px solid #333;
    background-color: #1a1a1a; color: white; font-size: 16px; outline: none;
    transition: border-color 0.3s;
}
input:focus { border-color: #bb86fc; }
button {
    padding: 15px; border-radius: 12px; border: none;
    background-color: #bb86fc; color: #000; font-weight: bold;
    font-size: 16px; cursor: pointer; transition: 0.2s;
}
button:hover { background-color: #a370f7; transform: scale(1.02); }
.erro { color: #ff5252; margin-top: 15px; min-height: 20px; font-size: 14px; }

/* --- PÁGINA DE RESULTADOS --- */
.topo-com-banner {
    position: relative;
    width: 100%;
    /* Aumentamos a altura mínima para dar mais espaço */
    min-height: 300px; 
    display: flex;
    align-items: flex-end; /* Mantém o perfil alinhado na parte de baixo */
    justify-content: center;
    padding-bottom: 30px;
    /* Adicionamos um respiro no topo para telas muito baixas não cortarem a foto */
    padding-top: 80px; 
}

/* Banner Fundo - Agora um Degradê Simples */
.banner-fundo {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    z-index: 1;
    /* Degradê que vai de um roxo escuro para o transparente (cor do fundo do body) */
    background: linear-gradient(to top, rgba(15,15,15,1) 0%, rgba(42,0,64,0.8) 100%);
}
/* Esconde a tag <img> do banner que o JS tentava preencher */
.banner-fundo img {
    display: none !important; /* !important garante que ela seja sempre escondida */
}

.perfil-container {
    position: relative; z-index: 10;
    display: flex; flex-direction: column; align-items: center; text-align: center;
}
.foto-perfil {
    width: 120px; height: 120px; /* Tamanho da foto do perfil */
    border-radius: 50%;
    border: 5px solid #0f0f0f; /* Borda da cor do fundo do body para destacar */
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    margin-bottom: 15px;
    background-color: #222; /* Cor de fundo se a imagem não carregar */
}
#userName { font-size: 2rem; font-weight: 700; margin-bottom: 5px; }
.scrobbles-info {
    background-color: rgba(187, 134, 252, 0.15); color: #e0baff;
    font-weight: bold; padding: 5px 15px; border-radius: 20px; font-size: 0.9rem;
}

.topo-fixo { position: absolute; top: 20px; left: 20px; z-index: 20; }
.btn-voltar {
    color: #fff; font-weight: bold; padding: 8px 15px;
    background-color: rgba(0,0,0,0.5); border-radius: 8px; backdrop-filter: blur(5px);
    transition: background-color 0.2s;
}
.btn-voltar:hover { background-color: rgba(255,255,255,0.2); }

.conteudo-charts {
    max-width: 1100px; margin: 0 auto; padding: 20px;
}
.charts-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 25px;
}
.chart-card {
    background-color: #181818; border: 1px solid #282828;
    border-radius: 16px; padding: 20px; box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}
.chart-card h2 {
    color: #bb86fc; margin-bottom: 20px; padding-bottom: 10px;
    border-bottom: 2px solid #282828; text-align: center;
}
.lista-top { display: flex; flex-direction: column; gap: 8px; }
.chart-item {
    padding: 12px; background-color: #222; border-radius: 10px;
    font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    transition: background-color 0.2s;
}
/* ... outras regras ... */

.chart-item {
    padding: 12px;
    background-color: #222;
    border-radius: 10px;
    font-size: 0.95rem;
    /* ESTAS 3 LINHAS SÃO O SEGREDO PARA NÃO QUEBRAR A TELA: */
    white-space: nowrap;       /* Impede que o texto pule para a linha de baixo */
    overflow: hidden;          /* Esconde tudo o que passar da largura do container */
    text-overflow: ellipsis;   /* Adiciona "..." no final do texto cortado */
    /* Garante que o item não tente ser maior que o pai dele */
    max-width: 100%; 
}

/* Precisamos também garantir que o pai (.lista-top) não estique */
.lista-top {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 100%; /* Limita a largura ao tamanho do card */
    overflow: hidden; /* Garante que nada vaze */
}

/* E que o avô (.chart-card) também não estique */
.chart-card {
    background-color: #181818;
    border: 1px solid #282828;
    border-radius: 16px;
    padding: 20px;
    /* Adicione isto para evitar que o card cresça mais que a tela */
    max-width: 100%; 
    overflow: hidden; /* Segurança extra */
}
.chart-item:hover { background-color: #2a2a2a; }
.chart-item.top-1 {
    background-color: rgba(187, 134, 252, 0.15); color: #fff; font-weight: bold;
    padding: 15px; margin-bottom: 10px; border: 1px solid rgba(187, 134, 252, 0.3);
}

footer {
    width: 100%; padding: 20px; background-color: #0a0a0a;
    display: flex; justify-content: space-between; align-items: center;
    color: #666; font-size: 12px; margin-top: auto;
}
.creditos a { color: #bb86fc; font-weight: bold; transition: color 0.2s; }
.creditos a:hover { color: #e0baff; }

/* Responsivo para celular */
@media (max-width: 600px) {
    /* AUMENTAMOS a altura aqui para a foto caber sem cortar em cima */
    .topo-com-banner {
        min-height: 280px; /* Era 180px ou menos, aumentei para garantir espaço */
        align-items: center; /* Centraliza verticalmente em telas pequenas pode ajudar */
        padding-top: 60px;   /* Mais espaço no topo */
    }
    
    .foto-perfil {
        width: 110px;  /* Um pouco menor para celular, mas ainda visível */
        height: 110px;
        margin-bottom: 10px;
    }
    
    #userName {
        font-size: 1.6rem; /* Nome um pouco menor para não quebrar linha fácil */
    }
    
    .charts-grid {
        grid-template-columns: 1fr; /* Garante 1 coluna só */
        gap: 15px; /* Menos espaço entre cards no celular */
    }
    
    /* Garante que o container principal não cause rolagem horizontal */
    .conteudo-charts {
        padding: 15px; /* Menos padding lateral em celulares */
        width: 100%;
        overflow-x: hidden; /* Impede rolagem horizontal indesejada */
    }

    footer {
        flex-direction: column;
        gap: 10px;
        text-align: center;
        padding-bottom: 20px;
    }
}

/* === ESTILOS DO CARD DE STORY (FINAL v4 - Sem Banner de Imagem) === */
#storyCard {
    width: 1080px;
    height: 1920px;
    color: #ffffff;
    font-family: 'Inter', sans-serif;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    /* Degradê de fundo roxo elegante para todo o card */
    background: radial-gradient(circle at top right, #3a0050, #0f0f0f 60%);
}

/* CABEÇALHO (Simplificado) */
.story-header {
    height: 450px; /* Aumentei um pouco a altura total da área */
    position: relative;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    margin-bottom: 40px; /* Um pouco menos de margem embaixo para compensar */
    padding-top: 120px; /* <--- AQUI: Mais espaço no topo para a foto não grudar */
}

/* Esconde a tag img do banner caso ainda esteja no HTML */
#storyBannerImg { display: none !important; }

.story-header-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    z-index: 2;
}

#storyUserImg {
    width: 250px;
    height: 250px;
    border-radius: 50%;
    border: 8px solid rgba(255,255,255,0.1); /* Borda sutil */
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    margin-bottom: 25px;
    background-color: #222;
}

#storyTitle {
    font-size: 4.5rem;
    font-weight: 900;
    margin-bottom: 10px;
    text-align: center;
    max-width: 90%;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    text-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.story-subtitle {
    font-size: 2rem;
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 5px;
    font-weight: 600;
    color: #bb86fc;
}

/* CORPO */
.story-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 40px 60px;
    gap: 40px;
}

.story-column {
    background-color: rgba(255,255,255,0.05); /* Fundo um pouco mais visível */
    padding: 30px 40px;
    border-radius: 30px;
    flex: 1;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(255,255,255,0.05); /* Borda sutil para definição */
}

.story-column h3 {
    font-size: 2.4rem;
    color: #fff;
    margin-bottom: 25px;
    text-transform: uppercase;
    font-weight: 800;
    letter-spacing: 1px;
    border-left: 8px solid #bb86fc;
    padding-left: 20px;
}

.story-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    flex: 1;
    justify-content: center;
}

.story-item {
    font-size: 2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    padding: 15px;
    background-color: rgba(0,0,0,0.3);
    border-radius: 15px;
}

.story-item:first-child {
    font-size: 2.2rem;
    font-weight: bold;
    background-color: rgba(187, 134, 252, 0.2);
    color: #fff;
    border: 2px solid rgba(187, 134, 252, 0.3);
}

.story-rank {
    color: #bb86fc;
    font-weight: 900;
    margin-right: 25px;
    min-width: 50px;
    text-align: right;
}

/* RODAPÉ (Corrigido para empilhar corretamente) */
.story-footer {
    padding: 40px 0 150px 0; /* Mais segurança na parte de baixo */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    gap: 40px; /* <--- AQUI: Mais espaço entre o card de stats e a marca */
    background: linear-gradient(to top, rgba(0,0,0,0.9), transparent);
}

.story-stat {
    width: 80%; /* Ocupa boa parte da largura para ficar bonito */
    max-width: 800px;
    background-color: rgba(187, 134, 252, 0.15); /* Fundo um pouco mais forte para destaque */
    padding: 25px 40px;
    border-radius: 25px;
    border: 2px solid rgba(187, 134, 252, 0.3);
    
    /* MUDANÇA PRINCIPAL: Flex em linha */
    display: flex;
    flex-direction: row; /* Garante que fica lado a lado */
    justify-content: space-between; /* Separa os itens nos extremos */
    align-items: center; /* Alinha verticalmente no centro */
}

.stat-label {
    font-size: 2.2rem; /* Fonte um pouco maior para equilibrar */
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 700;
    margin-bottom: 0; /* Remove margem inferior antiga */
    color: #e0baff; /* Cor levemente roxa para combinar */
}

.stat-value {
    font-size: 3.5rem; /* Número um pouco menor para caber na linha */
    font-weight: 900;
    color: #ffffff;
    line-height: 1;
}

.story-brand {
    font-size: 1.4rem;
    opacity: 0.5;
    letter-spacing: 3px;
    text-transform: uppercase;
    font-weight: 500;
}