/* =========================================
   1. RESET, FONTES E VARIÁVEIS
========================================= */
* { margin: 0; padding: 0; box-sizing: border-box; }

@font-face {
    font-family: 'MK11';
    src: url('assets/SevenElevenSerif-Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

:root {
    --color-bg: #030303;
    --color-box-bg: #0A0A0A;
    --color-text: #C4C4C4;
    --color-gold: #CFA348;
    --color-gold-dark: #8B733D;
    --color-gold-darkII: #3a3019;
    --color-blood: #8A0303;
    --color-blood-dark: #590202;
    --font-title: 'MK11', 'Cinzel', serif;
    --font-text: 'Rajdhani', sans-serif;
}

body {
    background-color: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-text);
    overflow-x: hidden;
}

h1, h2, h3, h4 { font-family: var(--font-title); color: var(--color-gold); text-transform: uppercase; font-weight: normal; letter-spacing: 2px; }
.container { max-width: 1000px; margin: 0 auto; padding: 60px 20px; }

/* =========================================
   1.5. STICKY HEADER
========================================= */
.sticky-header {
    position: sticky;
    top: 0;
    width: 100%;
    height: 65px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 40px;
    background-color: #050505;
    border-bottom: 2px solid var(--color-gold-dark);
    z-index: 100;
}

.header-left, .header-right {
    flex: 1;
    display: flex;
    align-items: center;
    height: 100%;
}

.header-left { gap: 30px; }
.header-right { justify-content: flex-end; }
.header-center { flex: 0 1 auto; display: flex; justify-content: center; align-items: center; height: 100%; }

.header-logo { height: 28px; object-fit: contain; opacity: 0.9; }
.jam-logo { height: 18px; }
.header-mk-logo { height: 35px; object-fit: contain; filter: drop-shadow(0px 2px 5px rgba(0,0,0,0.8)); }

.btn-header {
    margin: 0 !important;
    padding: 8px 24px;
    font-size: 0.9rem;
    opacity: 0;
    visibility: hidden; 
    transform: translateY(-10px); 
    transition: all 0.3s ease-in-out;
}

.btn-header.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* =========================================
   2. HERO E LAYOUT BASE
========================================= */
.roster-hero {
    display: flex;
    justify-content: center;
    align-items: center;
    height: calc(100vh - 65px);
    background: radial-gradient(circle at center, #080808 0%, var(--color-bg) 70%);
    position: relative;
    border-bottom: 2px solid var(--color-gold-dark);
    overflow: hidden; 
}

.portrait {
    position: absolute; 
    bottom: -2%;
    width: 38%;
    height: 102%;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 3; 
    pointer-events: none; 
}

.p1-portrait { left: 0%; }
.p2-portrait { right: 0%; transform: scaleX(-1); }
.p2-portrait .portrait-overlay { transform: scaleX(-1); }

.portrait img {
    width: 100%;
    height: 100%;
    object-fit: contain; 
    object-position: bottom center;
    transition: opacity 0.4s ease-in-out;
}

.portrait-overlay {
    position: absolute;
    bottom: 0; left: 0;
    width: 100%; height: 35%;
    background: linear-gradient(to top, var(--color-bg) 5%, transparent 100%);
}

/* =========================================
   3. CENTRO - TÍTULOS E BOTÃO
========================================= */
.roster-center {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.title-group { margin-bottom: 30px; }
.title-group h4 { color: var(--color-gold-dark); font-size: 1.1rem; margin-bottom: 10px; letter-spacing: 2px; }
.title-group h1 { font-size: clamp(2.5rem, 4vw, 4.5rem); margin-bottom: 15px; line-height: 1.1; letter-spacing: 2px; }
.hero-date { font-size: 1.1rem; color: #EAEAEA; font-weight: 500; letter-spacing: 1px; }

.btn-kombat {
    display: inline-block;
    background-color: #0A0A0A;
    border: 1px solid var(--color-gold) !important;
    color: var(--color-gold);
    font-family: var(--font-title);
    font-size: 1.2rem;
    padding: 14px 40px;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 40px;
    transition: all 0.3s;
    pointer-events: auto; 
}

.btn-kombat:hover {
    background-color: var(--color-blood-dark);
    border-color: var(--color-blood);
    color: #FFFFFF;
    box-shadow: 0 0 20px rgba(138, 3, 3, 0.6);
}

/* =========================================
   4. GRID DE PERSONAGENS
========================================= */
.roster-row {
    display: flex;
    flex-direction: row;
    gap: 5px;
    padding: 10px;
    margin-bottom: 20px;
    background: transparent;
    border: none;
}

.roster-slot {
    width: 65px;
    height: 85px;
    background-color: #111;
    border: 2px solid #333;
    position: relative;
    overflow: visible; 
}

.roster-slot > img.avatar-img {
    width: 100%; height: 100%;
    object-fit: cover;
    opacity: 0.5;
    transition: opacity 0.3s;
}

.roster-slot.p1-active, .roster-slot.p2-active { 
    border-color: var(--color-gold); 
    box-shadow: 0 0 12px rgba(207, 163, 72, 0.7); 
    z-index: 2; 
}

.roster-slot.p1-active > img.avatar-img, 
.roster-slot.p2-active > img.avatar-img { opacity: 1; }

.marker-icon {
    position: absolute;
    bottom: -14px;
    left: 50%;
    transform: translateX(-50%);
    width: 32px;
    height: 32px;
    display: none;
    z-index: 5;
    filter: drop-shadow(0px 3px 6px rgba(0,0,0,0.9));
}

.roster-slot.p1-active .marker-p1 { display: block; }
.roster-slot.p2-active .marker-p2 { display: block; }

/* =========================================
   5. TEXTO "VS"
========================================= */
.vs-text {
    font-family: var(--font-text);
    font-size: 1.8rem;
    font-weight: 500;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    max-width: 550px;
    margin: 0 auto;
    color: #fff;
}

.name-p1, .name-p2 { 
    text-transform: capitalize; 
    width: 220px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis; 
}

.name-p1 { text-align: right; }
.name-p2 { text-align: left; }

.vs-text .vs { 
    font-family: var(--font-title);
    font-size: 2.2rem; 
    color: var(--color-gold); 
    font-weight: normal; 
    text-align: center;
    width: 80px; 
    flex-shrink: 0;
}

/* =========================================
   6. DEMAIS SEÇÕES
========================================= */
.box { background: var(--color-box-bg); border: 1px solid #3A3A3A; border-top: 3px solid var(--color-gold-dark); padding: 40px; }
.box h2 { margin-bottom: 25px; border-bottom: 1px solid #222; padding-bottom: 15px; }
.box p { margin-bottom: 20px; font-size: 1.2rem; line-height: 1.6; }

.grid-regras { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); 
    gap: 20px; 
    margin-top: 40px; 
}

.card { 
    background: #111; 
    border: 1px solid #222; 
    border-left: 4px solid var(--color-blood); 
    padding: 25px 20px; 
    transition: transform 0.3s, border-color 0.3s; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
}

.card:hover { 
    transform: translateY(-5px); 
    border-color: var(--color-gold); 
    border-left-color: var(--color-gold); 
}

.card-text {
    flex: 1; 
}

.card h3 { font-size: 1.3rem; margin-bottom: 5px; }
.card p { font-size: 1.1rem; margin: 0; }

.card-icon {
    width: 45px; 
    height: 45px;
    object-fit: contain; 
    opacity: 0.5; 
    transition: all 0.3s ease;
}

.card:hover .card-icon {
    opacity: 1;
    transform: scale(1.15) rotate(5deg);
    filter: drop-shadow(0 0 8px rgba(207, 163, 72, 0.6));
}

footer { text-align: center; padding: 30px; background: #080808; border-top: 1px solid #222; color: #666; font-family: var(--font-title); }

/* =========================================
   7. CHAVEAMENTO VERTICAL E GUIDE LINES (GRID MATEMÁTICO)
========================================= */

.roster-center {
    z-index: 5;
}

/* Novo título maior e mais próximo do chaveamento */
.arena-title {
    text-align: center;
    font-size: 2.2rem;
    margin-bottom: -5px; 
    font-family: var(--font-title);
    color: var(--color-gold);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.vertical-arena {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 10px; 
    height: 720px; 
    position: relative;
    overflow: hidden;
}

.vertical-tree {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 820px; 
    background: var(--color-box-bg);
    padding: 30px 15px;
    border: 1px solid #333;
    border-radius: 8px;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.8);
    z-index: 5;
}

/* Camadas Horizontais */
.tier-row {
    display: flex;
    width: 100%;
    justify-content: space-around;
    align-items: center;
}

.slot {
    flex: 1;
    display: flex;
    justify-content: center;
    position: relative;
}

/* Camadas de Linhas (Forks perfeitamente alinhados aos centros) */
.lines-row {
    display: flex;
    width: 100%;
    height: 35px; 
}

.fork-up {
    flex: 1;
    position: relative;
}

.line-left {
    position: absolute;
    bottom: 0;
    left: 25%;
    width: 25%;
    height: 50%;
    border-left: 2px solid var(--color-gold-darkII);
    border-top: 2px solid var(--color-gold-darkII);
    border-top-left-radius: 4px;
    transition: all 0.4s ease;
}

.line-right {
    position: absolute;
    bottom: 0;
    right: 25%;
    width: 25%;
    height: 50%;
    border-right: 2px solid var(--color-gold-darkII);
    border-top: 2px solid var(--color-gold-darkII);
    border-top-right-radius: 4px;
    transition: all 0.4s ease;
}

.line-center {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 50%;
    background: var(--color-gold-darkII);
    transition: all 0.4s ease;
}

/* Brilho Dourado nas Linhas do Caminho Vencedor */
.line-left.lit, .line-right.lit {
    border-color: var(--color-gold) !important;
    filter: drop-shadow(0 0 4px var(--color-gold));
    z-index: 10;
}
.line-center.lit {
    background: var(--color-gold) !important;
    box-shadow: 0 0 6px var(--color-gold);
    z-index: 10;
}

/* Caixas de Luta (Cards) */
.bracket-box {
    width: 70px;
    height: 64px;
    background: #0A0A0A;
    border: 2px solid var(--color-gold-darkII);
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: all 0.4s ease;
    opacity: 0.35;
    z-index: 12;
}

.bracket-box.active-match {
    border-color: var(--color-gold);
    box-shadow: 0 0 15px rgba(207, 163, 72, 0.7);
    transform: scale(1.15);
    opacity: 1;
}

.bracket-box.eliminated {
    filter: grayscale(100%) brightness(0.25);
    opacity: 0.25;
    border-color: #222;
}

.bracket-box.winner-box {
    border-color: var(--color-gold);
    box-shadow: 0 0 20px var(--color-gold);
    opacity: 1;
}

.box-fighter {
    flex: 1;
    width: 100%;
    position: relative;
    overflow: hidden;
}

.box-fighter.f1 {
    background: #590202;
    border-bottom: 1px solid rgba(207, 163, 72, 0.4);
}

.box-fighter.f2 {
    background: #021a3d;
}

.box-fighter img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
}

/* Esconde as imagens quebradas nas fases que ainda não ocorreram */
.box-fighter img[src=""],
.box-fighter img:not([src]) {
    display: none !important;
}

.match-label {
    font-family: var(--font-title);
    color: var(--color-gold);
    font-size: 0.9rem;
    text-align: center;
    letter-spacing: 2px;
    margin-top: 20px;
    margin-bottom: 5px;
}

.champ-box {
    width: 85px;
    height: 80px;
}
.champ-box.active {
    border-color: var(--color-gold);
    box-shadow: 0 0 35px var(--color-gold);
    transform: scale(1.2);
    opacity: 1;
}

/* =========================================
   7.5. SEPARAÇÃO DAS QUARTAS DE FINAL (CORRIGIDO)
========================================= */

/* Espaçamento extra (gap) para separar os DUELOS de forma simétrica */
.tier-row:last-of-type {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-column-gap: 1px; /* Gap base */
}

/* Adiciona margem entre as DUPLAS (Luta 1 e Luta 2, Luta 3 e Luta 4) */
.tier-row:last-of-type .slot:nth-child(2),
.tier-row:last-of-type .slot:nth-child(4),
.tier-row:last-of-type .slot:nth-child(6) {
    margin-right: 18px; 
}

/* Alinha exatamente as linhas guias com os espaços gerados acima */
.lines-row:last-of-type {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
}

.lines-row:last-of-type .fork-up:nth-child(1),
.lines-row:last-of-type .fork-up:nth-child(2),
.lines-row:last-of-type .fork-up:nth-child(3) {
    margin-right: 18px; 
}

/* Previne que as caixas da base encolham abaixo do tamanho necessário */
.bracket-box {
    min-width: 65px;
    z-index: 12;
}

/* Ajusta o Z-Index durante a animação para o card sempre pular para a frente */
.bracket-box.active-match, 
.bracket-box.winner-box {
    z-index: 25; 
    transform: scale(1.1); /* Um pouco menor o scale para não vazar a borda */
}

/* =========================================
   8. EXIBIÇÃO LATERAL (CAIXAS 512x256 SEM CORTE NAS LATERAIS)
========================================= */
.team-showcase {
    position: absolute;
    top: 0;
    width: 280px; 
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center; 
    transition: all 0.6s ease;
    opacity: 0;
    pointer-events: none;
    z-index: 2; 
}

.left-showcase { left: 15px; }
.right-showcase { right: 15px; }

.team-showcase.active { opacity: 1 !important; }

/* -------------------------------------
   CAIXAS ESTRUTURAIS DOS LUTADORES
------------------------------------- */
.fighter-box {
    width: 100%;
    aspect-ratio: 2 / 1; 
    position: relative;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    background-color: #111;
    background-size: cover;
    background-position: center;
    border: 3px solid #333; 
    border-radius: 6px;
    margin-bottom: 12px; 
    transition: all 0.5s ease;
}

.bottom-box {
    margin-bottom: 0; 
}

/* -------------------------------------
   RENDERS (AS IMAGENS DENTRO DA CAIXA)
------------------------------------- */
.team-showcase .char-render {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: bottom center;
    opacity: 0; 
}

@keyframes popInLeft {
    0% { transform: scaleX(-1) translateY(20px) scaleY(0.9); opacity: 0; }
    100% { transform: scaleX(-1) translateY(0) scaleY(1); opacity: 1; }
}
@keyframes popInRight {
    0% { transform: scaleX(1) translateY(20px) scaleY(0.9); opacity: 0; }
    100% { transform: scaleX(1) translateY(0) scaleY(1); opacity: 1; }
}

.left-showcase.active .char-render { animation: popInLeft 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; }
.right-showcase.active .char-render { animation: popInRight 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; }

/* -------------------------------------
   ESTADOS DE FIM DE PARTIDA NAS CAIXAS
------------------------------------- */
.team-showcase.loser {
    z-index: 1;
    opacity: 0.7 !important;
}

.team-showcase.loser .fighter-box {
    filter: grayscale(100%) brightness(0.4);
    border-color: #1a1a1a;
    transform: scale(0.95);
}

.team-showcase.winner {
    z-index: 15; 
}

.team-showcase.winner .fighter-box {
    border-color: var(--color-gold);
    box-shadow: 0 0 25px rgba(207, 163, 72, 0.6);
    transform: scale(1.05);
}

/* SELO WINS - Posicionado no topo das caixas dos lutadores */
.wins-stamp {
    position: absolute;
    top: calc(50% - 190px); /* Empurra o selo exatamente para o topo do Jogador 1 */
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    opacity: 0;
    z-index: 30;
    width: 190px; /* Levemente menor para um encaixe mais elegante no topo */
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    filter: drop-shadow(0 10px 25px rgba(0,0,0,0.9));
}

.team-showcase.winner .wins-stamp { 
    transform: translate(-50%, -50%) scale(1); 
    opacity: 1; 
}

@media (max-width: 1100px) { 
    .team-showcase { display: none; } 
}

/* =========================================
   9. TEXTO DE GUIA DA ARENA (REGRAS DO TORNEIO)
========================================= */
.arena-guide-text {
    max-width: 900px;
    margin: 25px auto 0 auto; 
    background: var(--color-box-bg);
    border: 1px solid #333;
    border-top: 3px solid var(--color-blood);
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.8);
}

.arena-guide-text h3 {
    color: var(--color-gold);
    margin-bottom: 20px;
    text-align: center;
    font-size: 1.8rem;
    font-family: var(--font-title);
    letter-spacing: 2px;
    text-transform: uppercase;
}

.arena-guide-text p {
    font-size: 1.15rem;
    line-height: 1.6;
    margin-bottom: 20px;
    text-align: justify;
}

.kombat-rules-list {
    list-style: none;
    margin: 30px 0;
    padding: 0;
}

.kombat-rules-list li {
    font-size: 1.15rem;
    line-height: 1.6;
    margin-bottom: 15px;
    padding-left: 30px;
    position: relative;
}

.kombat-rules-list li::before {
    content: '►';
    position: absolute;
    left: 0;
    color: var(--color-blood);
    font-family: var(--font-title);
}

.kombat-rules-list strong {
    color: var(--color-gold);
}

.kombat-details {
    background: #111;
    padding: 15px;
    border-left: 4px solid var(--color-gold);
    margin-top: 30px;
    margin-bottom: 20px;
    text-align: center;
    border-radius: 4px;
}

.kombat-details p {
    margin: 0;
    font-size: 1.1rem;
    text-align: center;
    color: #ddd;
}

.kombat-details strong {
    color: var(--color-gold);
}

.final-call {
    text-align: center;
    font-size: 1.25rem !important;
    color: #fff;
    margin-top: 30px;
    margin-bottom: 0;
}

.final-call strong {
    display: block;
    color: var(--color-gold);
    margin-top: 10px;
    font-family: var(--font-title);
    letter-spacing: 1px;
}

/* =========================================
   RESPONSIVIDADE MOBILE: HERO E CHAVEAMENTO
========================================= */
@media (max-width: 900px) {
    /* 1. Garante que o grid forme exatamente 3 em cima e 3 embaixo */
    .roster-row {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        max-width: 240px; 
        gap: 8px;
        padding: 0; 
        margin: 0 auto 20px auto;
    }

    /* 2. Traz os personagens de corpo inteiro de volta nas laterais */
    .portrait {
        display: flex !important; 
        width: 35%; 
        height: 55%; 
        z-index: 1; 
        opacity: 0.7; 
    }

    /* Cola eles nas bordas extremas */
    .p1-portrait { left: -5%; }
    .p2-portrait { right: -5%; }

    /* 3. Garante que a área central (botões e grid) fique na frente */
    .roster-center {
        z-index: 5;
    }

    /* 4. Oculta apenas o chaveamento complexo no celular */
    .vertical-arena {
        display: none !important;
    }
}