@import url('https://fonts.googleapis.com/css2?family=Exo:ital,wght@0,100..900;1,100..900&display=swap');

html {
    -webkit-text-size-adjust: 100%; /* Impede o iOS de redimensionar o texto sozinho */
}

/* Garante que os textos da carta tenham altura de linha controlada */
.texto-codinome, .texto-nome, .texto-bonus, .texto-frase, 
.texto-hab-lider-titulo, .texto-hab-lider-desc, 
.texto-hab-descarte-titulo, .texto-hab-descarte-desc {
    line-height: 1 !important; /* Força o texto a ocupar apenas o seu tamanho real */
}

/* Adicione estas variáveis no seu :root existente */
:root {
    --bg-dark: #1e1e24;
    --bg-panel: #2b2b36;
    --text-light: #f0f0f0;
    --primary: #d9453a;
    --primary-hover: #b83a31;
    
    /* Novas variáveis para as cores da carta */
    --cor-carta-1: #802a32;
    --cor-carta-2: #922636;
    --cor-carta-3: #d9a05b;
}

@font-face {
    font-family: 'SF Proverbial Gothic';
    src: url('../assets/SF Proverbial Gothic Bold Oblique.ttf') format('truetype');
    font-weight: bold;
    font-style: italic; /* Oblique/Italic */
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    background-color: var(--bg-dark);
    color: var(--text-light);
    font-family: sans-serif;
    height: 100vh;
    display: flex;
    overflow: hidden;
}

.app-container {
    display: flex;
    width: 100%;
    height: 100dvh;
}

/* Menu Lateral */
.sidebar {
    padding: 0; /* Tiramos o padding geral para controlar as áreas internas */
    display: flex;
    flex-direction: column;
}

.sidebar-fixed-top {
    padding: 20px;
    background-color: var(--bg-panel);
    border-bottom: 2px solid #111;
    position: relative;
    z-index: 10;
}

.sidebar-fixed-top h2.title {
    font-family: 'SF Proverbial Gothic', sans-serif;
    font-size: 1.6em;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: bold;
    font-style: italic; /* Para combinar com o estilo Bold Oblique da fonte */
    color: var(--primary);
    margin-bottom: 5px;
}

.sidebar-scrollable-content {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.top-button-group {
    display: flex;
    gap: 5px;
    margin-top: 10px;
}

.top-button-group button {
    flex: 1;
    padding: 8px 2px;
    font-size: 0.75em;
    white-space: nowrap;
}

/* Botão de Ajuda */
.btn-help {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    padding: 0;
    background: #555;
    font-size: 0.8em;
}

/* Créditos no rodapé */
.sidebar-footer {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #444;
    font-size: 0.7em;
    color: #777;
    text-align: center;
    line-height: 1.4;
}

/* --- Modal --- */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px); /* Efeito de desfoque no fundo */
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: linear-gradient(145deg, #2b2b36, #1e1e24);
    margin: 10vh auto;
    padding: 30px;
    border: 1px solid rgba(217, 69, 58, 0.3); /* Bordas suaves com a cor primária */
    box-shadow: 0 0 30px rgba(0,0,0,0.5), inset 0 0 10px rgba(217, 69, 58, 0.1);
    width: 90%;
    max-width: 450px;
    border-radius: 16px;
    position: relative;
    color: #f0f0f0;
}

.modal-content h3 {
    font-family: 'SF Proverbial Gothic', sans-serif;
    color: var(--primary);
    font-size: 1.5em;
    margin-bottom: 20px;
    border-bottom: 1px solid #444;
    padding-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.modal-content ul {
    list-style: none;
    padding: 0;
}

.modal-content li {
    margin-bottom: 15px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    line-height: 1.4;
    font-size: 0.95em;
}

/* Pequenos marcadores estilizados */
.modal-content li::before {
    content: '▶';
    color: var(--primary);
    font-size: 0.7em;
    margin-top: 5px;
}

.modal-content strong {
    color: #fff;
    display: block;
    margin-bottom: 2px;
}

.close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 24px;
    color: #888;
    cursor: pointer;
    transition: color 0.2s;
}

.close:hover {
    color: var(--primary);
}

.btn-modal-close {
    background: var(--primary);
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    margin-top: 10px;
    letter-spacing: 1px;
    text-transform: uppercase;
    transition: transform 0.2s, background 0.2s;
}

.btn-modal-close:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

/* Animação de entrada */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.title { margin-bottom: 10px; border-bottom: 2px solid var(--primary); padding-bottom: 5px; }

.form-group { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }

.form-group label {
    font-family: 'Exo', sans-serif;
    font-size: 0.9em;
    font-weight: 700; /* Peso mais forte para destacar */
    color: #9898b3;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.form-group input, .form-group select {
    padding: 8px; border-radius: 4px; border: 1px solid #444; background: #1e1e24; color: #fff;
}

.form-group textarea {
    padding: 8px;
    border-radius: 4px;
    border: 1px solid #444;
    background: #1e1e24;
    color: #fff;
    font-family: 'Exo', sans-serif;
    
    /* ESTA É A LINHA QUE RESOLVE: */
    resize: vertical; 
    
    /* Opcional: define uma altura mínima e máxima para não sumir ou crescer infinito */
    min-height: 60px;
    max-height: 300px;
}

.color-group { 
    display: flex; 
    flex-direction: column; /* Coloca as 3 cores uma embaixo da outra para não espremer */
    gap: 10px; 
}
.color-group .form-group { flex: 1; }

/* --- ESTILIZAÇÃO DA BARRA DE SCROLL --- */

/* Largura da barra de scroll */
.sidebar-scrollable-content::-webkit-scrollbar {
    width: 8px;
}

/* Fundo da barra (Track) */
.sidebar-scrollable-content::-webkit-scrollbar-track {
    background: var(--bg-dark);
    border-radius: 10px;
}

/* Parte que desliza (Thumb) */
.sidebar-scrollable-content::-webkit-scrollbar-thumb {
    background: #444; /* Cor neutra para não brigar com as cores da carta */
    border-radius: 10px;
    border: 2px solid var(--bg-dark); /* Cria um espaçamento elegante */
}

/* Quando o usuário passa o mouse na barra */
.sidebar-scrollable-content::-webkit-scrollbar-thumb:hover {
    background: var(--primary); /* Destaque com o vermelho do seu tema */
}

/* Suporte para Firefox */
.sidebar-scrollable-content {
    scrollbar-width: thin;
    scrollbar-color: #444 var(--bg-dark);
}

/* Botões */
.button-group {
    display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 20px;
    padding-top: 15px; border-top: 1px solid #444;
}
button { padding: 10px; cursor: pointer; border: none; border-radius: 4px; font-weight: bold; background: #444; color: #fff; }
.btn-primary { background: var(--primary); grid-column: span 2; }
.btn-primary:hover { background: var(--primary-hover); }

/* Área da Carta */
.preview-area {
    flex: 1; display: flex; align-items: center; justify-content: center;
    background: radial-gradient(circle, #333, #111);
}

/* --- ÁREA DA CARTA (DOBRADA PARA 700PX) --- */
.card-preview {
    width: 700px; /* Base visual no browser DOBRADA */
    aspect-ratio: 63 / 88; /* Proporção oficial mantida */
    background-color: #000;
    border-radius: 24px; /* DOBRADO */
    position: relative;
    overflow: hidden; /* Corta o que sobrar das camadas */
    box-shadow: 0 20px 60px rgba(0,0,0,0.8); /* DOBRADO */
    
    /* O Truque: Exibe com metade do tamanho na tela para não quebrar o layout */
    transform: scale(0.6);
    transform-origin: center center;
    margin: -35% 0; /* Compensa o espaço deixado pelo scale para alinhar direitinho */
}

/* Camadas */
.card-layer {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
}

#camada-cenario {
	z-index: 0;
    position: absolute;
    top: 50%;
    left: 50%;
    background-repeat: no-repeat;
    transform-origin: center center;
}

#camada-arte {
    z-index: 1;
    position: absolute;
    top: 50%;
    left: 50%;
    background-size: cover;
    background-position: center; /* Mudamos para center para o zoom funcionar a partir do meio */
    background-repeat: no-repeat;
    transform-origin: center center;
}

/* Novas camadas sobrepostas */
#camada-fundo-preto {
    z-index: 2;
    background-image: url('../assets/fundo_preto.svg');
    background-size: 100% 100%;
    pointer-events: none; /* Deixa os cliques passarem direto para não bugar controles futuros */
}

#camada-moldura-principal {
    z-index: 3; /* Desceu uma posição (agora fica imediatamente atrás da sombra) */
    pointer-events: none;
}

/* Isso garante que o SVG colado ocupe o espaço certinho da carta */
#camada-moldura-principal svg {
    width: 100%;
    height: 100%;
    display: block;
}

#camada-habilidade {
    z-index: 4; /* NOVO: Habilidade SVG (Fica na frente da moldura) */
    pointer-events: none;
}

/* Garante que o SVG da habilidade tenha o tamanho certo */
#camada-habilidade svg {
    width: 100%;
    height: 100%;
    display: block;
}

#camada-sombra {
    z-index: 5; /* Subiu para a frente do SVG (trazendo o volume e acabamento por cima das cores) */
    background-image: url('../assets/moldura.png');
    background-size: 100% 100%;
    pointer-events: none;
}

/* Controles de Imagem */
.image-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
    background: #222;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid #444;
}

.control-row {
    display: flex;
    align-items: center;
    gap: 5px;
}

.control-row span {
    font-size: 0.8em;
    color: #bbb;
    width: 45px;
}

.control-row button {
    flex: 1;
    padding: 6px;
    font-size: 0.9em;
    background: #333;
}

.control-row button:hover {
    background: #555;
}

/* --- CORREÇÃO DOS BOTÕES DE COR --- */
.color-group input[type="color"] {
    width: 100%;
    height: 42px;
    padding: 0; /* Tira o preenchimento que estava esmagando a cor */
    background: none; /* Tira o fundo escuro do botão */
    border: none;
    cursor: pointer;
}

/* --- ESTILO DOS SELETORES DE COR E HEX --- */
.color-input-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.color-input-wrapper input[type="text"] {
    flex-grow: 1;
    width: 100%; /* Força a respeitar o limite de largura */
    min-width: 0; /* Permite que a caixa encolha além do padrão do navegador */
    padding: 8px 4px; /* Reduz um pouquinho o preenchimento interno */
    text-transform: uppercase;
    font-family: monospace;
    font-size: 0.9em; /* Diminui levemente a fonte para caber melhor */
    text-align: center; /* Centraliza o código Hex para ficar mais bonito */
}

/* Ajustes estéticos da cor para os navegadores */
.color-input-wrapper input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.color-input-wrapper input[type="color"]::-webkit-color-swatch { border: 1px solid #444; border-radius: 4px; }
.color-input-wrapper input[type="color"]::-moz-color-swatch { border: 1px solid #444; border-radius: 4px; }

/* --- TEXTOS DA CARTA --- */
#camada-textos {
    z-index: 7; /* Fica na frente da sombra (que é o 5) */
    pointer-events: none; /* Para não atrapalhar o clique e arraste da imagem */
}

/* Textos multiplicados por 2 */
.texto-codinome {
    position: absolute;
    top: 43px;
    right: 50px;
    text-align: right;
    color: #ffffff;
    font-size: 56px;
    font-family: 'SF Proverbial Gothic', sans-serif;
    text-transform: uppercase;
    /*letter-spacing: -1px;*/
    text-shadow:
		/*se*/
	    -4px -4px 1px #000,
		/*s*/
	     0px -4px 1px #000,
		/*sd*/
	     8px -4px 1px #000,
		/*e*/	
        -4px  0px 1px #000,
		/*d*/	
         8px  0px 1px #000,
		/*ie*/
        -4px  8px 1px #000,
		/*i*/
		 0px  8px 1px #000,
		/*id*/
         8px  8px 1px #000;
    white-space: pre-wrap;
}

.texto-nome {
    position: absolute;
    top: 94px;
    right: 50px;
    text-align: right;
    color: #ffffff;
    font-size: 26px;
    font-family: 'SF Proverbial Gothic', sans-serif;
    text-shadow:
		/*se*/
	    -2px -2px 1px #000,
		/*s*/
	     0px -2px 1px #000,
		/*sd*/
	     4px -2px 1px #000,
		/*e*/	
        -2px  0px 1px #000,
		/*d*/	
         4px  0px 1px #000,
		/*ie*/
        -2px  4px 1px #000,
		/*i*/
		 0px  4px 1px #000,
		/*id*/
         4px  4px 1px #000;
    white-space: pre-wrap;
}

.texto-bonus {
    position: absolute;
    top: 50px;
    left: 38px;
    width: 120px;
    text-align: center;
    color: #ffffff;
    font-size: 116px;
    font-family: 'SF Proverbial Gothic', sans-serif;
    text-shadow: 10px 0px 0 var(--cor-carta-1);  
    letter-spacing: -1px;
}

.texto-frase {
    position: absolute;
    top: 504px;
    text-align: center;
    width: 100%;
    color: #ffffff;
    font-size: 24px;
    font-family: 'SF Proverbial Gothic', sans-serif;
    padding: 0 40px;
    text-shadow:
		/*se*/
	    -2px -2px 1px #000,
		/*s*/
	     0px -2px 1px #000,
		/*sd*/
	     4px -2px 1px #000,
		/*e*/	
        -2px  0px 1px #000,
		/*d*/	
         4px  0px 1px #000,
		/*ie*/
        -2px  4px 1px #000,
		/*i*/
		 0px  4px 1px #000,
		/*id*/
         4px  4px 1px #000;
    line-height: 24px;
    white-space: pre-wrap;
}

/* --- BRASÕES DAS EQUIPES NA CARTA --- */
#camada-equipe {
    z-index: 6; /* Logo acima da sombra/moldura */
    pointer-events: none;
}

/* Brasões multiplicados por 2 */
#display-equipe1 {
    position: absolute;
    top: 180px;
    left: 50px;
    width: 120px;
    height: 120px;
    object-fit: contain;
}

#display-equipe2 {
    position: absolute;
    top: 290px;
    left: 50px;
    width: 120px;
    height: 120px;
    object-fit: contain;
}

/* --- TEXTOS DAS HABILIDADES --- */
.texto-hab-lider-titulo, .texto-hab-descarte-titulo {
    position: absolute;
    left: 120px;
    width: 340px;
    text-align: left;
    color: #fff;
    font-size: 30px;
    font-family: 'SF Proverbial Gothic', sans-serif;
        text-shadow:
		/*se*/
	    -2px -2px 1px #000,
		/*s*/
	     0px -2px 1px #000,
		/*sd*/
	     4px -2px 1px #000,
		/*e*/	
        -2px  0px 1px #000,
		/*d*/	
         4px  0px 1px #000,
		/*ie*/
        -2px  4px 1px #000,
		/*i*/
		 0px  4px 1px #000,
		/*id*/
         4px  4px 1px #000;
}

.texto-hab-lider-desc, .texto-hab-descarte-desc {
    position: absolute;
    width: 80%;
	left: 70px;
    text-align: center;
    color: #ffffff;
    font-size: 24px;
    font-family: 'Exo', sans-serif;
    white-space: pre-wrap;
    line-height: 26px;
        text-shadow:
		/*se*/
	    -2px -2px 1px #000,
		/*s*/
	     0px -2px 1px #000,
		/*sd*/
	     4px -2px 1px #000,
		/*e*/	
        -2px  0px 1px #000,
		/*d*/	
         4px  0px 1px #000,
		/*ie*/
        -2px  4px 1px #000,
		/*i*/
		 0px  4px 1px #000,
		/*id*/
         4px  4px 1px #000;
}

/* Posições Provisórias Multiplicadas por 2 */
.texto-hab-lider-titulo { top: 566px; }
.texto-hab-lider-desc { top: 624px; }

.texto-hab-descarte-titulo { top: 742px; }
.texto-hab-descarte-desc { top: 800px; }

/* --- ÍCONES DOS TIPOS DE HABILIDADE --- */
#camada-tipos-hab {
    z-index: 6; /* Fica na mesma "profundidade" dos brasões de equipe */
    pointer-events: none;
}

#display-tipoHabLider {
    position: absolute;
    top: 524px;
    right: 40px;
    width: 106px;
    height: 106px;
    object-fit: contain;
}

#display-tipoHabDescarte {
    position: absolute;
    top: 700px;
    right: 40px;
    width: 106px;
    height: 106px;
    object-fit: contain;
}

/* Container de Navegação */
.nav-builders {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 2px solid #111;
}

.nav-title {
    font-family: 'Exo', sans-serif;
    font-size: 0.8em;
    color: #9898b3;
    text-transform: uppercase;
    margin-bottom: 10px;
    text-align: center;
}

/* Grid: 4 colunas para a primeira linha */
.nav-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

/* Estilo dos botões */
.btn-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #333;
    color: #fff;
    text-decoration: none;
    font-size: 0.7em;
    font-weight: bold;
    padding: 8px 2px;
    border-radius: 4px;
    text-align: center;
    transition: background 0.2s;
}

.btn-nav:hover {
    background: var(--primary);
}

/* Ocupar a linha de baixo inteira para o botão Páginas */
.btn-full {
    grid-column: span 4;
    margin-top: 2px;
}

/* --- VERSÃO MOBILE: CARTA COM FUNDO ATUALIZADO + BOTÃO AJUDA --- */
@media (max-width: 768px) {
    body {
        overflow: hidden;
    }

    .app-container {
        flex-direction: column;
        height: 100dvh;
    }

    /* 1. Área da Carta: Altura mínima garantida e novo Gradiente */
    .preview-area {
		position: sticky;
		top: 0;
		z-index: 100;
        flex: 0 0 auto;
        height: 60vh;
        min-height: 380px;
        width: 100%;
        /* Novo fundo solicitado */
        background: radial-gradient(circle, #222, #525271);
        display: flex;
        align-items: center;
        justify-content: center;
        overflow: hidden;
        order: 1;
    }

    .card-preview { 
        transform: scale(0.45); 
        transform-origin: center center;
        flex-shrink: 0;
    }

    /* 2. Sidebar / Menu: Dinâmico no espaço restante */
    .sidebar {
        flex: 1; 
        width: 100%;
        order: 2;
        border-right: none;
        border-top: 3px solid var(--primary);
        display: flex;
        flex-direction: column;
        overflow: hidden;
        background-color: var(--bg-panel);
    }

    .sidebar-scrollable-content {
        flex: 1;
        overflow-y: auto !important;
        padding: 15px;
        -webkit-overflow-scrolling: touch;
    }

    .sidebar-fixed-top {
        padding: 5px 15px;
        flex-shrink: 0;
        position: relative; /* Garante que o btn-help se posicione em relação a este topo */
    }
	
	.sidebar-fixed-top h2.title {
		font-size: 1em;
	}

    /* Ajuste de posição do Botão de Ajuda no Mobile */
    .btn-help {
        top: 5px;
        right: 15px; /* Mantendo o alinhamento à direita */
    }

    .top-button-group {
        display: flex;
        flex-wrap: nowrap;
        gap: 4px;
    }

    .top-button-group button {
        flex: 1;
        padding: 8px 2px;
        font-size: 0.6em;
        white-space: nowrap;
    }
}