:root {
    --bg-color: #000;
    --card-border-neon: #ff1493; 
    --card-bg-gradient: linear-gradient(145deg, #1f000f, #0f0007);
    --primary-pink: #ff1493;
    --light-pink: #ffb6c1;
    --dark-pink: #8b0050;
    --text-color: #ffe6f0;
    --glow-strong: 0 0 25px rgba(255, 20, 147, 0.7);
    --title-font: 'Playfair Display', serif; 
    --body-font: 'Montserrat', sans-serif; 
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    text-transform: lowercase; 
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--body-font);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start; /* Alterado para permitir scroll em telas pequenas */
    min-height: 100vh;
    overflow-x: hidden;
    overflow-y: auto; /* Liberado o scroll vertical */
    padding: 4rem 1rem 2rem 1rem; /* Espaço extra no topo para o seletor de idioma */
    background-image: radial-gradient(circle at 50% 0%, #3a001c 0%, transparent 50%);
}

.screen {
    display: none;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 400px;
    animation: fadeIn 0.5s ease;
}

.screen.active { display: flex; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Personalizando a cor de seleção do texto */
::selection {
    background: var(--primary-pink);
    color: #ffffff;
    text-shadow: none; /* Tiramos o text-shadow na seleção para a leitura ficar limpa */
}

/* Suporte para navegadores baseados em Mozilla mais antigos */
::-moz-selection {
    background: var(--primary-pink);
    color: #ffffff;
    text-shadow: none;
}

/* Estilos do Seletor de Idiomas */
.lang-container {
    position: absolute;
    top: 15px;
    right: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--primary-pink);
    z-index: 100;
}

select {
    background: rgba(26, 0, 13, 0.8);
    color: var(--light-pink);
    border: 1px solid var(--dark-pink);
    border-radius: 5px;
    padding: 6px;
    font-family: var(--body-font);
    font-size: 0.85rem;
    outline: none;
    cursor: pointer;
}

/* Ecrã de Configuração */
.setup-container {
    width: 100%;
    text-align: center;
}

/* Estilo base do input (garantindo que não tenha outline feio) */
input {
    width: 100%;
    background: #1a000d;
    border: 1px solid var(--dark-pink);
    padding: 1rem;
    margin: 0.5rem 0 1.5rem;
    border-radius: 15px;
    color: var(--light-pink);
    font-family: var(--body-font);
    text-align: center;
    font-size: 1.1rem;
    outline: none; /* Remove a borda azul/preta padrão do navegador */
    transition: border-color 0.3s, box-shadow 0.3s;
}

input::placeholder { 
    color: rgba(255, 182, 193, 0.4); 
}

/* Quando o usuário clica no campo para digitar */
input:focus {
    border-color: var(--primary-pink);
    box-shadow: 0 0 10px rgba(255, 20, 147, 0.3);
    background: #1a000d; /* Garante que o fundo continua escuro */
}

/* O GRANDE TRUQUE: Evita que o preenchimento automático deixe o fundo branco/amarelo */
input:-webkit-autofill,
input:-webkit-autofill:hover, 
input:-webkit-autofill:focus, 
input:-webkit-autofill:active{
    -webkit-box-shadow: 0 0 0 30px #1a000d inset !important;
    -webkit-text-fill-color: var(--light-pink) !important;
    transition: background-color 5000s ease-in-out 0s;
}

label { color: var(--primary-pink); font-size: 0.9rem; letter-spacing: 1px; }

/* Elementos do Jogo */
.level-indicator {
    font-size: 0.8rem;
    color: var(--primary-pink);
    margin-bottom: 1rem;
    letter-spacing: 2px;
    border: 1px solid var(--dark-pink);
    padding: 4px 12px;
    border-radius: 20px;
}

/* Container da Carta */
.card-container {
    width: 100%;
    height: 420px; /* Altura levemente reduzida para caber tudo */
    position: relative;
    margin-bottom: 1rem;
}

.card {
    width: 100%; height: 100%;
    background: var(--card-bg-gradient);
    border: 2px solid var(--card-border-neon);
    border-radius: 20px;
    box-shadow: var(--glow-strong);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem 1.5rem; /* Menos padding para ganhar espaço interno */
    text-align: center;
    position: relative;
    transition: transform 0.4s ease, opacity 0.4s ease;
    overflow: hidden; 
}

.corner-hearts-tl { position: absolute; top: 15px; left: 15px; color: var(--primary-pink); font-size: 2rem; opacity: 0.8; }
.corner-hearts-br { position: absolute; bottom: 15px; right: 15px; color: var(--primary-pink); font-size: 2rem; opacity: 0.8; transform: rotate(180deg); }

/* Conteúdo da carta usa Flex: 1 para empurrar o timer para baixo */
#card-content { 
    width: 100%; 
    flex: 1; 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    justify-content: center;
    overflow-y: auto; /* Se o texto for enorme, rola só aqui dentro */
}

.card-title { 
    font-family: var(--title-font); font-size: 1.8rem; color: var(--light-pink); 
    margin-bottom: 1rem; font-weight: 600; width: 90%;
    padding-bottom: 0.5rem; border-bottom: 1px solid rgba(255, 182, 193, 0.2); 
}

.card-text { font-size: 1.05rem; line-height: 1.5; font-weight: 300; margin-bottom: 0.5rem; }

/* Timer Section travado no fundo da carta */
#timer-section { 
    display: none; 
    flex-direction: column; 
    align-items: center; 
    flex-shrink: 0; /* Impede que seja esmagado pelo texto */
    min-height: 80px;
    margin-top: 10px;
}

#timer-display { font-size: 2.2rem; font-family: var(--title-font); color: var(--primary-pink); margin-bottom: 5px; }

.play-btn {
    background: transparent; color: var(--primary-pink); border: 2px solid var(--primary-pink);
    border-radius: 50%; width: 45px; height: 45px; font-size: 1rem; cursor: pointer;
    display: flex; align-items: center; justify-content: center; transition: all 0.3s;
    box-shadow: 0 0 10px rgba(255, 20, 147, 0.2); padding-left: 3px; 
}

.play-btn:hover, .play-btn:active { background: var(--primary-pink); color: white; box-shadow: 0 0 15px rgba(255, 20, 147, 0.6); }

/* Estilos do Board de Tokens */
.tokens-board {
    display: none; 
    gap: 10px;
    width: 100%;
    margin-bottom: 1.5rem;
}

.tokens-board.active { display: flex; }

.token-card {
    flex: 1;
    border: 1px solid rgba(255, 20, 147, 0.3);
    border-radius: 12px;
    padding: 10px;
    background: rgba(26, 0, 13, 0.4);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    text-align: center;
    transition: all 0.3s ease;
    min-height: 110px; /* Garante tamanho uniforme */
}

.token-owner { font-size: 0.75rem; color: var(--light-pink); opacity: 0.8; margin-bottom: 4px; }
.token-name { font-family: var(--title-font); color: var(--primary-pink); font-size: 1rem; font-weight: 600; margin-bottom: 4px; }
.token-desc { font-size: 0.75rem; line-height: 1.3; color: var(--text-color); font-weight: 300; margin-bottom: auto; }

.token-btn {
    background: transparent; color: var(--primary-pink); border: 1px solid var(--primary-pink);
    padding: 4px 15px; border-radius: 15px; font-size: 0.75rem; font-family: var(--body-font);
    cursor: pointer; transition: all 0.2s; margin-top: 8px;
}

.token-btn:hover { background: rgba(255, 20, 147, 0.2); }

.token-card.used { border-color: #333; opacity: 0.5; }
.token-card.used .token-name, .token-card.used .token-desc { text-decoration: line-through; color: #888; }
.token-card.used .token-btn { border-color: #555; color: #555; cursor: not-allowed; background: transparent; }

/* Botões Principais */
.btn {
    background: linear-gradient(45deg, var(--dark-pink), var(--primary-pink));
    color: white; border: none; padding: 1rem 2.5rem; font-family: var(--body-font);
    border-radius: 30px; box-shadow: 0 0 15px rgba(255, 20, 147, 0.4); cursor: pointer;
    letter-spacing: 2px; width: 100%; margin-bottom: 0.5rem;
}

.btn:disabled { opacity: 0.5; filter: grayscale(1); cursor: not-allowed; }

.btn-ghost {
    background: transparent; color: var(--dark-pink); border: none; padding: 0.5rem;
    font-family: var(--body-font); font-size: 0.85rem; cursor: pointer;
    text-decoration: underline; transition: color 0.3s; letter-spacing: 1px;
}

.btn-ghost:hover { color: var(--primary-pink); }

.logo { font-size: 2.8rem; color: var(--primary-pink); font-family: var(--title-font); font-style: italic; margin-bottom: 1.5rem; text-shadow: 0 0 10px var(--primary-pink); }

/* Estilos do Modal de Regras */
.modal {
    display: none; /* Escondido por padrão */
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
}

.modal-content {
    max-width: 360px;
    height: auto;
    padding: 2.5rem 1.5rem;
}

/* Container das regras */
.rules-text {
    text-align: left;
    font-size: 0.95rem;
    line-height: 1.5;
    font-weight: 300;
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    gap: 0; /* Tiramos o gap, pois agora vamos usar o padding de cada item */
}

/* Estilo de cada regra individual */
.rules-text p {
    padding: 15px 0; /* Espaço em cima e embaixo do texto */
    margin: 0;
    border-bottom: 1px solid rgba(255, 20, 147, 0.2); /* Linha sutil separadora */
}

/* Remove a linha separadora da última regra para um acabamento perfeito */
.rules-text p:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

/* Opcional: Adiciona um respiro extra na primeira regra */
.rules-text p:first-child {
    padding-top: 0;
}

/* Botão Global de Regras */
#global-rules-btn {
    position: absolute;
    top: 15px;
    left: 15px; /* Fica no canto superior esquerdo */
    background: transparent;
    color: var(--primary-pink);
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 100;
    transition: transform 0.3s, text-shadow 0.3s;
    outline: none;
}

#global-rules-btn:hover {
    transform: scale(1.1);
    text-shadow: var(--glow-strong);
}