/* =======================================================
   === IDENTIDADE VISUAL E ANIMAÇÕES ===
   ======================================================= */

@font-face {
    font-family: 'Tilda Script';
    src: url('../fonts/tilda-script-bold.woff2') format('woff2'),
        url('../fonts/tilda-script-bold.woff') format('woff');
    font-weight: bold;
    font-style: normal;
    font-display: swap;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

:root {
    --bg: #171d26;
    --panel: #232a33;
    --accent: #1e90ff;
    --accent2: #ff7b00;
    --card-radius: 10px;
    --dotted: 3px dotted rgba(255, 255, 255, 0.12);
    --text: #e6eef6;
    --muted: rgba(230, 238, 246, 0.25);
    --active: #00ff73;
}

/* =======================================================
   === AMBIENTAÇÃO E ILUMINAÇÃO (VIGNETTE) ===
   ======================================================= */

/* Ambientação Mobile-First */
.vignette {
    position: fixed;
    top: 0;
    left: 0;
    /* Mude de 100% para estas unidades de viewport */
    width: 100vw;
    height: 100vh;
    /* No mobile: Centro mais aberto (60%) e bordas mais claras (0.5) */
    background: radial-gradient(circle, transparent 60%, rgba(0, 0, 0, 0.5) 100%);
    pointer-events: none;
    z-index: 9000;
    will-change: opacity;
    /* Otimização leve */
}


.board {
    will-change: transform;
    /* Otimização de GPU */
    transition: none;
    /* O JS cuidará da suavidade, não precisamos de transition aqui */
}


/* =======================================================
   === SIMULAÇÃO DE MONITOR CRT (TEXTURAS) ===
   ======================================================= */

/* Escondido por padrão */
.crt-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    /* Camada de Scanlines e Grille (sem curvatura) */
    background:
        linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.1) 50%),
        linear-gradient(90deg, rgba(255, 0, 0, 0.02), rgba(0, 255, 0, 0.01), rgba(0, 0, 255, 0.02));
    background-size: 100% 3px, 3px 100%;
    z-index: 10000;
    pointer-events: none;
}

/* Cintilação (Flicker) */
@keyframes flicker {
    0% {
        opacity: 0.98;
    }

    5% {
        opacity: 0.96;
    }

    10% {
        opacity: 0.99;
    }

    100% {
        opacity: 1;
    }
}

.crt-overlay::before {
    content: " ";
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: rgba(18, 16, 16, 0.02);
    animation: flicker 0.1s infinite;
}

/* =======================================================
   === APLICAÇÃO CONDICIONAL (MODO VHS ATIVO) ===
   ======================================================= */

body.vhs-enabled .crt-overlay {
    display: block;
}

body.vhs-enabled .container {
    /* Aplica apenas o filtro de cor e ruído, sem o rotateX/perspective */
    filter: url(#vhs-filter);
    transition: none !important;
}

/* O fundo fica mais escuro para destacar o "brilho" do CRT */
body.vhs-enabled {
    background-color: #050505;
}


/* =======================================================
   === Vídeo de Fundo Dinâmico ===
   ======================================================= */

/* Estilo Base do Vídeo de Fundo */
.video-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    object-fit: cover;
    /* Garante que o vídeo preencha a tela sem distorcer */
    z-index: 0;
    /* Acima do fundo do body, mas abaixo do conteúdo */
    opacity: 0.3;
    /* Deixa o efeito sutil */
    pointer-events: none;
    display: none;
    /* Escondido por padrão, ativado pelo JS */
}

/* Ativação via classe condicional no body */
body.video-bg-enabled .video-background {
    display: block;
}

/* Ajuste crítico no container para que ele fique por cima do vídeo */
.container {
    position: relative;
    z-index: 1;
}



/* =======================================================
   === MODO TRANSPARENTE (OVERRIDE) ===
   ======================================================= */

/* Remove fundos e bordas quando a classe está ativa no body */
body.transparent-mode header {
    background: transparent !important;
    border-radius: 50px !important;
}

body.transparent-mode .board {
    background: transparent !important;
    border-style: none !important;
    box-shadow: none !important;
    /* Remove a sombra para flutuar melhor no vídeo */
}

body.transparent-mode .asylum-area,
body.transparent-mode .deck-area {
    background: transparent !important;
}

/* --- A NOVIDADE: Ícones da Top-Row no Modo Transparente --- */
body.transparent-mode .controls button,
body.transparent-mode .resetBtn {
    background-color: transparent !important;
    border: 2px solid #ffffff0f !important;
    backdrop-filter: blur(4px);
    /* Opcional: efeito de vidro fosco no vídeo */
}

/* Efeito de hover exclusivo para o modo transparente */
body.transparent-mode .controls button:hover,
body.transparent-mode .resetBtn:hover {
    background-color: rgba(255, 255, 255, 0.05) !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
}



/* =======================================================
   === RESET GERAL E TIPOGRAFIA ===
   ======================================================= */
* {
    font-family: "Cinzel", serif !important;
}

html {
    margin: 0;
    background: #0a0c10;
}

body {
    margin: 0;
    background: #0a0c10;
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
    scroll-behavior: smooth;
}


body {
    /* 1. LIBERA A ROLAGEM: overflow-y: auto permite descer a página */
    overflow-x: hidden;
    overflow-y: auto;
    /* 2. ALTURA DINÂMICA: Mude de height: 100% para min-height: 100vh */
    /* Isso permite que o fundo ocupe a tela toda, mas a página cresça se houver conteúdo abaixo */
    min-height: 100vh;
    height: auto;
    margin: 0;
    background: #0a0c10;
    color: var(--text);
    scroll-behavior: smooth;
    /* Previne que o Parallax ou animações criem barras horizontais fantasmas */
    position: relative;
    /* --- OCULTAR BARRA (Firefox e Edge antigo) --- */
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* Internet Explorer e Edge */
}

/* --- OCULTAR BARRA (Chrome, Safari e Opera) --- */
body::-webkit-scrollbar {
    display: none;
}

/* Remove para Chrome, Safari e Opera */
html::-webkit-scrollbar,
body::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
}

/* ////////////////////////////////////////////////////// */

p {
    margin: 0;
    padding: 0;
}

h2 {
    margin-top: 0;
    /* Adicione esta linha para remover o espaço no topo */
}

.container {
    max-width: 1100px;
    margin: auto;
    padding: 12px;
}

.container {
    position: relative;
    z-index: 1;
    min-height: 100%;
    /* Permite que o container cresça conforme as cartas */
}





/* Garante que o container acompanhe o crescimento do conteúdo */
.container {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Overlay de Carregamento */
#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #14171e;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #232a33;
    border-top: 4px solid #1e90ff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}


/* =======================================================
       === 3. CABEÇALHO DA SALA (HEADER) ===
       ======================================================= */
header {
    border-radius: 10px 10px 0px 0px;
    border: 2px solid #ffffff1f;
    padding: 10px 18px;
    text-align: center;
    background: var(--bg);
    color: #ffffff;
    display: block;
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
}

header:active {
    transform: scale(0.98);
}

/* Quando o código é copiado */
header.copied {
    /* Em vez de fundo verde sólido, usamos um brilho suave */
    background-color: rgba(30, 144, 255, 0.05) !important;
    border-color: var(--accent) !important;
    /* Borda Verde Neon */
    color: var(--accent) !important;
    /* Texto Verde Neon */
    box-shadow: 0 0 15px rgba(30, 144, 255, 0.3);
    /* Glow opcional */
}

/* Garante que o H1 (o código) mude para a cor ativa */
header.copied h1 {
    color: var(--accent) !important;
}

/* Texto de instrução "CÓDIGO COPIADO!" */
header.copied .copy-instruction {
    opacity: 1 !important;
    font-weight: bold;
    /* Aqui garantimos que ele pegue a mesma cor do pai (o código) */
    color: var(--accent) !important;
    letter-spacing: 2px;
    /* Um charme extra */
}

header h1 {
    margin: 0;
    font-size: 18px;
    letter-spacing: 1px;
}


header p {
    margin: 6px 0 0;
    color: #444;
}



/* =======================================================
       === BOTÕES DE CONTROLE E SLIDER (UI SUPERIOR) ===
       ======================================================= */

.resetBtn,
.infoBtn,
.shuffleBtn,
.configBtn,
.musicBtn,
.altRulesBtn,
.fullscreenBtn {
    /* Adicionado aqui */
    width: 36px;
    height: 36px;
}

/* Adicione também para a imagem interna preencher o botão */
.altRulesBtn img {
    width: 20px;
    /* Tamanho padrão dos seus ícones de controle */
    height: 20px;
    display: block;
    /* Mágica para deixar qualquer ícone preto em branco puro */
    filter: brightness(0) invert(1);
    transition: transform 0.2s ease;
}

.shuffleBtn {
    display: none !important;
}

.infoBtn img,
.configBtn img,
.musicBtn img {
    width: 100%;
    height: 100%;
    display: block;
}

.musicBtn.muted {
    opacity: 0.4;
    filter: grayscale(100%);
}

/* Slider de Volume */
#volumeSlider {
    width: 60px;
    height: 6px;
    background: #232a33;
    border-radius: 5px;
    outline: none;
    opacity: 0.7;
    transition: opacity .2s;
    cursor: pointer;
    align-self: center;
    accent-color: #1e90ff;
}

#volumeSlider:hover {
    opacity: 1;
}

.spectatorBtn {
    width: 36px;
    height: 36px;
    background: transparent;
    border: none;
    cursor: pointer;
}

.spectatorBtn img {
    width: 100%;
    height: 100%;
    filter: brightness(0) invert(1);
    /* Deixa o fantasma branco */
    transition: transform 0.2s;
}


.spectator-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 300px;
    overflow-y: auto;
    text-align: center;
}

.spectator-target-btn {
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    color: white;
    transition: background 0.2s;
}

.spectator-target-btn:hover {
    background: rgba(30, 144, 255, 0.2);
    border-color: #1e90ff;
}

.spectator-target-btn img {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
}


/* Classe para botões de ação larga no modal */
.settings-action-btn {
    color: white;
    padding: 10px;
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    width: 100%;
    font-weight: bold;
    transition: transform 0.2s, filter 0.2s;
}

.settings-action-btn:hover {
    transform: scale(1.02);
    filter: brightness(1.1);
}

/* Estilo Ghost para o botão de saída */

/* #leaveRoomBtn {
    background: transparent !important;
    border: 1px solid #ff3b3b !important;
    color: #ff3b3b !important;
    margin-top: 30px;
    transition: all 0.2s ease;
}

#leaveRoomBtn:hover {
    background: #ff3b3b !important;
    color: white !important;
    box-shadow: 0 0 15px rgba(255, 59, 59, 0.3);
} */


/* =======================================================
       === ESTRUTURA DO TABULEIRO (BOARD LAYOUT) ===
       ======================================================= */

.board {
    background: var(--bg);
    border-radius: 0px 0px 10px 10px;
    border-style: solid;
    border-width: 0 2px 2px 2px;
    border-color: rgba(255, 255, 255, 0.12);
    padding: 10px;
    box-shadow: 0 8px 24px rgba(10, 10, 12, 0.08);
}

.top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.room {
    color: var(--muted);
    font-size: 14px;
}

.controls {
    display: flex;
    gap: 12px;
    align-items: center;
}

.controls button,
.resetBtn {
    padding: 8px;
    border-radius: 8px;
    border: 0;
    background: var(--panel);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Seleciona todos os botões dentro de .controls e o botão Reset */
.controls button,
.resetBtn {
    transition: transform 0.2s ease, background-color 0.2s ease;
    /* Transição suave para escala e cor */
}

/* Aplica o efeito de hover e foco (acessibilidade) a todos os botões do cabeçalho */
.controls button:hover,
.resetBtn:hover {
    transform: scale(1.15) translateY(-2px);
    /* Efeito de zoom e leve subida */
    background-color: #2c3540;
    /* Destaque sutil no fundo do botão */
}

/* Garante que as imagens dentro dos botões sigam o estilo branco */
.controls button img,
.resetBtn img {
    width: 20px;
    /* Padronização de tamanho */
    height: 20px;
    filter: brightness(0) invert(1);
    /* Mantém ícones brancos */
    pointer-events: none;
    /* Evita que o ícone interfira no clique do botão */
}

/* Layout Central */
.center-area {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Container dos Jogadores */
.player-hands-container {
    display: grid;
    gap: 18px;
}

/* Wrapper Asilo e Deck */
.decks-wrapper {
    display: grid;
    gap: 18px;
    margin-top: 18px;
}




/* =======================================================
       === ÁREA DO JOGADOR (AVATAR, PONTOS, RELIGIÃO) ===
       ======================================================= */
.player-area {
    border-radius: 10px;
    border: 2px solid #ffffff0f;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    position: relative;
}


/* Botão Kickar/Remover */
.points {
    display: flex;
    align-items: center;
    margin-top: 4px;
    margin-bottom: 8px;
    justify-content: center;
}

.remove-player {
    position: absolute;
    right: 8px;
    top: 8px;
    background: #ff3b3b;
    width: 12px;
    height: 12px;
    color: white;
    font-size: 0;
    line-height: 0;
    border-radius: 50%;
    border: 1px solid white;
    cursor: pointer;
    padding: 0;
}

.remove-player:hover {
    background: #ff5555;
}

/* Estilo para os ícones de religião */
.religion-icon {
    width: 10px;
    height: 10px;
    margin-right: 0px;
    vertical-align: middle;
    filter: brightness(0) invert(1);
    /* Deixa o SVG branco */
    display: inline-block;
}



/* Badge de Religião */
.religion-status {
    border-radius: 6px;
    color: white;
    cursor: pointer;
    user-select: none;
    border: 1px solid #ffffff4d;
}

.religion-status.catolico {
    background-color: #3b5998;
}

.religion-status.protestante {
    background-color: #f01f4f;
}


/* Nome e Foto */
.player-title {
    font-weight: 600;
    margin-bottom: 0px;
    color: var(--muted);
}

.player-area.local-player .player-title {
    color: var(--accent);
    font-weight: 700;
}

.player-header {
    display: flex;
    align-items: center;
    gap: 4px;
    justify-content: center;
}

.player-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid var(--accent);
    object-fit: cover;
}





/* =======================================================
       === 7. ÁREAS ESPECIAIS (ASILO, DECK, CEMITÉRIO) ===
       ======================================================= */


.free-area.has-cards .muted {
    display: none !important;
}

/* Deck Principal */
.deck-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px;
    border-radius: 12px;
    border: 2px var(--accent) solid;
    background: var(--panel);
}

.deck {
    width: 72px;
    height: 107px;
    border-radius: 7px;
    border: 3px solid #3b5998;
    cursor: pointer;
    background-image: url('../img/back.png');
    background-size: cover;
    background-position: center;
    text-indent: -9999px;
    overflow: hidden;
}

.pile-info {
    margin: 0px !important;
    display: flex;
    gap: 4px;
    align-items: center;
    text-align: center;
}

/* Asilo */
.asylum-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 18px;
    border-radius: 10px;
    border: 2px solid var(--accent2);
    background: var(--panel);
    text-align: center;
}

.asylum-area .muted {
    font-size: 14px;
    font-weight: bold;
}

.asylum-image {
    width: 76px;
    height: 76px;
    background-image: url('../img/asilo.png');
    background-size: cover;
    background-position: center;
    border-radius: 10px;
}

.asylum-points {
    display: flex;
    align-items: center;
}

.asylum-points button {
    background: #f6c204;
    color: #000;
    border: 0;
    cursor: pointer;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    font-size: 24px;
}

.asylum-points .score {
    min-width: 28px;
    text-align: center;
    color: #fff;
}

/* Cemitério (Free Area) */
.free-area {
    border-radius: 10px;
    border: 2px solid #ffffff1f;
    padding: 18px;
    min-height: 140px;
    display: flex;
    gap: 7px;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: flex-start;
    background: linear-gradient(180deg, #0000000d, #00000005);
    text-align: center;
    position: relative;
    z-index: 1;
    overflow: hidden;
}

.free-area::before {
    content: "";
    background-image: url('../img/skull.svg');
    background-repeat: no-repeat;
    background-position: center;
    background-size: 30%;
    opacity: 0.03;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}


/* Container da imagem do Asilo com suporte a efeitos e interatividade */
.asylum-image-wrapper {
    width: 64px;
    /* Tamanho padrão para telas intermediárias */
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    border-radius: 8px;
    transition: all 0.3s ease;
    /* Transição suave para o efeito de brilho */
}

/* Efeito de brilho dourado suavizado ao passar o mouse */
.asylum-image-wrapper:hover {
    transform: scale(1.03);
    /* Reduzido levemente o aumento de 1.05 para 1.03 */
    box-shadow: 0 0 12px 2px rgba(255, 185, 44, 0.6);
    /* Brilho reduzido e com transparência */
    cursor: pointer;
}

/* Garante que a imagem preencha o wrapper sem distorções */
.asylum-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}



/* =======================================================
       === REGRAS PARA O MODO: OCULTAR RELIGIÃO E ASILO ===
       ======================================================= */

/* Quando o body tiver a classe 'hide-religion', esconde os badges */
body.hide-religion .religion-status {
    display: none !important;
}

/* 1. Esconde o Asilo quando a classe estiver ativa no body */
body.hide-religion #asylumArea {
    display: none !important;
}

/* 2. Ajusta o layout do wrapper para 1 coluna em TODAS as resoluções
          quando o Asilo estiver oculto. O Deck ocupará todo o espaço. */

body.hide-religion .decks-wrapper {
    grid-template-columns: 1fr !important;
}

/* Ajuste específico para garantir que o Deck não fique esticado demais verticalmente no PC
       se você quiser manter a proporção, ou pode deixar ele preencher tudo.
       Aqui garantimos que ele centralize se sobrar espaço. */
@media (min-width: 1200px) {
    body.hide-religion .deck-area {
        width: 100%;
        box-sizing: border-box;
    }
}

/* =======================================================
       === ESTILOS DE CARTAS E SLOTS ===
       ======================================================= */

.card {
    /* --- Estética e Identidade --- */
    border-radius: 6px;
    border: 1px solid #3b5898;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
    cursor: grab;
    user-select: none;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    display: block;
    text-indent: -9999px;
    overflow: hidden;

    /* --- Layout e Performance --- */
    position: relative;
    will-change: transform;
    /* Otimiza o uso da GPU para animações fluidas */
    transition: transform 0.1s ease-out;
    /* Suaviza a volta da carta e o hover */
    transform-style: preserve-3d;
    /* CRÍTICO: Habilita a profundidade real para o efeito Balatro */

    /* --- Sistema de Onda (Flutuação) --- */
    --y-offset: 0px;
    /* Variável controlada pelo sistema senoidal no ui.js */

    /* IMPORTANTE: Sem o !important para permitir que o JS aplique a rotação no hover */
    transform: translateY(var(--y-offset));
}

.card:active {
    cursor: grabbing;
}

/* Garante que o container tenha perspectiva */
.player-stack,
.deck-area,
.free-area {
    perspective: 1000px;
}


.card:active {
    cursor: grabbing;
}

.card.back {
    background-image: url('../img/back.png');
    color: transparent
}

.card .label {
    padding: 6px;
    text-align: center;
    color: #0b0b0b
}

.player-hand {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    padding: 6px;
}

.player-stack {
    display: grid;
    grid-template-columns: repeat(4, auto);
    justify-content: center;
    align-items: center;
    padding: 6px;
    width: 100%;
    gap: 4px;
}

.points .plus,
.points .minus {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 0;
    background: #f6c204;
    color: #000;
    cursor: pointer;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    font-size: 24px;
}

.points .score {
    min-width: 28px;
    text-align: center;
    color: #fff;
}

.muted {
    color: var(--muted);
    font-size: 10px
}

.slot {
    /* width: 96px;
    height: 136px; */
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center
}



/* =======================================================
       === MODAIS, OVERLAYS E MENUS ===
       ======================================================= */


/*  Otimização do Modal de Configurações */

/* Define uma largura fixa e centraliza o conteúdo */
#settingsModal .modal-content {
    width: 80%;
    max-width: 380px;
    /* Largura fixa ideal para leitura */
    padding: 25px 15px 15px 25px;
    /* Ajuste de respiro */
}

/* Título principal do modal */
#settingsModal h2 {
    margin-bottom: 20px;
    font-size: 24px;
}

/* Títulos de seção (ex: Gráficos) */
#settingsModal .settings-container h2 {
    margin: 20px 0 10px 0;
    /* Ajustei levemente as margens para o centro */
    font-size: 20px;
    text-align: center;
    /* Alterado de 'left' para 'center' */
    border-bottom: 1px solid var(--muted);
    padding-bottom: 8px;
    color: var(--text);
}

/* Área de rolagem configurada */
.settings-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    /* Reduzi levemente o gap para compactar */
    max-height: 65vh;
    /* Limita a altura a 65% da tela para evitar cortes */
    overflow-y: auto;
    /* Ativa a barra de rolagem */
    padding-right: 12px;
    /* Espaço para a scrollbar não cobrir os botões */
}

/* Estilização da Barra de Rolagem (Estilo Coup Master) */
.settings-container::-webkit-scrollbar {
    width: 6px;
}

.settings-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.settings-container::-webkit-scrollbar-thumb {
    background: var(--accent);
    border-radius: 10px;
}



.modal-overlay {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    position: relative;
    padding: 20px;
    background: var(--panel);
    border-radius: 10px;
}

/* 2. Aplicar nos Títulos dos Modais (Configurações, Baralho, etc) */
.modal-content h2 {
    text-align: center;
}

.modal-actions-and-rules {
    position: relative;
    padding: 20px;
    border-radius: 10px;
}

.settings-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    min-width: 250px;
    padding: 10px;
}

.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    color: var(--text);
    font-size: 16px;
}

.config-title {
    margin-bottom: 0px;
}

.config-p-title {
    margin-top: 0px;
    margin-bottom: 20px;
    text-align: center;
}

.icon-btn {
    background: #232a33;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 8px 12px;
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: background 0.2s;
}

.icon-btn:hover {
    background: #2c3540;
}

#volumeSlider {
    accent-color: #1e90ff;
    flex-grow: 1;
    cursor: pointer;
}

.close-btn {
    position: absolute;
    top: -10px;
    right: -10px;
    z-index: 1001;
    color: #fff;
    background: #ff3b3b;
    border: 2px solid white;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    line-height: 30px;
    text-align: center;
}

.close-btn:hover {
    background: #ff5555;
}

/* =======================================================
   === CONFIGURAÇÃO DE BARALHO (LISTAS E INPUTS) ===
   ======================================================= */

/* Unifica o tamanho do modal com o de Configurações */
#configModal .modal-content {
    width: 80%;
    max-width: 380px;
    padding: 25px 15px 15px 25px;
}

/* Área de lista com rolagem interna e altura limitada */
.card-config-list {
    list-style: none;
    padding: 0 12px 0 0;
    /* Espaço para a scrollbar */
    margin: 0;
    max-height: 60vh;
    /* Mantém a proporção do outro modal */
    overflow-y: auto;
}

/* Títulos das Expansões (Estilo idêntico ao "Gráficos") */

.title-dlc-card-config-item {
    text-align: center;
    /* Alterado de 'left' para 'center' */
    font-size: 18px;
    font-weight: bold;
    margin: 25px 0 15px 0;
    /* Aumentei levemente o respiro superior */
    padding-bottom: 8px;
    border-bottom: 1px solid var(--muted);
    color: var(--text);
}

.title-dlc-card-config-item p {
    margin: 0;
    font-family: "Cinzel", serif !important;
    letter-spacing: 1px;
    /* Um pequeno espaçamento para dar um ar mais premium */
}

/* Itens da lista (Linha da Carta) */
.card-config-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.card-config-item label {
    font-size: 16px;
    color: var(--text);
}

/* Estilização dos Inputs Numéricos */
.card-config-item input {
    width: 50px;
    padding: 6px;
    border-radius: 6px;
    border: 1px solid var(--accent);
    background: var(--bg);
    color: white;
    font-size: 16px;
    text-align: center;
    outline: none;
}

.card-config-item input:focus {
    box-shadow: 0 0 8px var(--accent);
}

/* Botão de Aplicação (Visual Balatro/Neon) */
#applyDeckConfigBtn {
    width: 100%;
    padding: 14px;
    font-size: 16px;
    background: #00ff73;
    /* Verde neon */
    color: #000;
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    margin-top: 20px;
    font-weight: bold;
    transition: transform 0.2s, filter 0.2s;
}

#applyDeckConfigBtn:hover:not(:disabled) {
    transform: scale(1.02);
    filter: brightness(1.1);
}

/* Barra de Rolagem Customizada para a Lista */
.card-config-list::-webkit-scrollbar {
    width: 6px;
}

.card-config-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.card-config-list::-webkit-scrollbar-thumb {
    background: var(--accent);
    border-radius: 10px;
}



/* =======================================================
       === ANIMAÇÃO FLIP-CARD (REGRAS) ===
       ======================================================= */
.flip-card.is-flipped .flip-card-inner {
    transform: rotateY(-180deg);
}

.flip-horizontal-left .flip-card-back {
    transform: rotateY(-180deg);
}

.flip-card {
    background-color: transparent;
    width: 300px;
    height: 450px;
    perspective: 1000px;
}

.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 1s;
    transform-style: preserve-3d;
}

.flip-card-front,
.flip-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
}

.flip-card-front img,
.flip-card-back img {
    width: 100%;
    height: auto;
    border-radius: 20px;
    object-fit: cover;
}




/* =======================================================
       === EFEITOS VISUAIS (3D E BALATRO) ===
       ======================================================= */
.balatro-effect {
    transition: transform 0.1s ease, box-shadow 0.1s ease;
    will-change: transform, box-shadow;
    transform-style: preserve-3d;
}

.deck-area,
.card-slot,
.card-dropzone,
.hand {
    perspective: 600px;
}


/* =======================================================
       === EFEITO DE ARRASTAR (FLUTUANTE) ===
       ======================================================= */
.card.lifting {
    transform: scale(1.15) rotate(5deg) !important;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.6) !important;
    cursor: grabbing !important;
    z-index: 9999;
}

.card.is-dragging {
    opacity: 0.1 !important;
    transform: scale(0.9) !important;
    box-shadow: none !important;
}



/* ////////////////////////////////////////////////////////////////////////////////// */




/* --- BASE DO MODO COMPACTO (Compartilhado por todas as telas < 1200px) --- */
@media (max-width: 1199px) {
    .container {
        padding: 4px;
        max-width: 100%;
    }


    /* Áreas do Jogador */
    .player-area {
        min-height: 80px;
        padding: 4px;
    }

    .player-title {
        font-size: 8px !important;
        line-height: 10px;
        margin-bottom: 0 !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 60px;
    }

    .player-header {
        gap: 4px;
        margin-bottom: 0;
    }

    .player-avatar {
        width: 16px;
        height: 16px;
        border-width: 1px;
    }

    /* Cartas e Slots */
    .card,
    .slot {
        width: 40px;
        height: 56px;
    }

    .slot {
        border-radius: 7px;
    }

    .player-stack {
        display: grid;
        grid-template-columns: repeat(auto-fit, 40px);
        justify-content: center;
        gap: 6px;
        padding: 2px;
    }

    /* Controles e Religião */
    .points {
        margin-top: 4px !important;
        margin-bottom: 4px !important;
    }

    .points .plus,
    .points .minus {
        width: 16px;
        height: 16px;
        font-size: 20px;
    }

    .religion-status {
        font-size: 8px !important;
        padding: 2px 5px !important;
        margin-bottom: 4px !important;
        line-height: 10px;
        border-radius: 4px;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 2px;
        max-width: 60px !important;
        min-width: 60px !important;
        height: 15px;
    }

    .religion-icon {
        width: 10px !important;
        height: 10px !important;
    }

    /* Rodapé e Decks */
    .bottom-table-container {
        grid-template-columns: 1fr;
        gap: 4px;
    }

    .decks-wrapper {
        gap: 4px;
        margin-top: 8px;
        display: grid;
        grid-template-columns: 1fr 1fr;
        width: 100%;
    }

    .asylum-area {
        padding: 4px;
        gap: 4px;
        border-width: 2px;
        min-height: 80px;
        justify-content: center;
    }

    .asylum-points button {
        width: 16px;
        height: 16px;
        font-size: 20px;
    }

    .asylum-image-wrapper {
        width: 44px;
        height: 44px;
        border-radius: 6px;
    }

    .deck {
        width: 46px;
        height: 68px;
        border: 2px solid #3b5998;
    }

    #deck-count {
        font-size: 10px;
    }

    /* Cemitério */
    .free-area {
        min-height: 70px;
        padding: 4px;
        gap: 2px;
        justify-content: center;
        align-items: center;
    }

    .free-area .muted,
    .asylum-area .muted,
    .pile-info {
        font-size: 8px;
        line-height: 10px;
        margin: 0;
    }

    /* Quando o cabeçalho é ocultado, o tabuleiro ganha bordas superiores e margem */
    header[style*="display: none"]~.board,
    header.hidden~.board {
        margin-top: 1px !important;
        border: 2px solid #ffffff1f;
        border-top-left-radius: 10px;
        border-top-right-radius: 10px;
    }
}



/* --- REGRAS EXCLUSIVAS POR TAMANHO DE TELA --- */

/* Telas Mínimas (< 292px) */
@media (max-width: 292px) {
    header h1 {
        font-size: 20px;
    }

    .player-hands-container {
        grid-template-columns: 1fr;
        gap: 4px;
    }

    /* Ajusta o tamanho dos botões de controle e o Reset */
    .controls button,
    .resetBtn,
    .musicBtn,
    .altRulesBtn,
    .fullscreenBtn,
    .infoBtn,
    .configBtn {
        width: 28px !important;
        height: 28px !important;
        padding: 6px !important;
        border-radius: 6px !important;
    }

    /* Ajusta o tamanho das imagens/ícones dentro dos botões */
    .controls button img,
    .resetBtn img,
    .altRulesBtn img {
        width: 16px !important;
        height: 16px !important;

    }

    /* Ajuste específico para o slider de volume não quebrar o layout */
    #volumeSlider {
        width: 40px !important;
    }

    /* Reduz o espaçamento entre os botões */
    .controls {
        gap: 6px !important;
    }
}

/* Mobile Padrão (292px - 479px) */
@media (min-width: 292px) and (max-width: 479px) {
    .player-hands-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 4px;
    }

    /* Ajusta o tamanho dos botões de controle e o Reset */
    .controls button,
    .resetBtn,
    .musicBtn,
    .altRulesBtn,
    .fullscreenBtn,
    .infoBtn,
    .configBtn {
        width: 32px !important;
        height: 32px !important;
        padding: 8px !important;
        border-radius: 6px !important;
    }

    /* Ajusta o tamanho das imagens/ícones dentro dos botões */
    .controls button img,
    .resetBtn img,
    .altRulesBtn img {
        width: 16px !important;
        height: 16px !important;

    }

    /* Ajuste específico para o slider de volume não quebrar o layout */
    #volumeSlider {
        width: 40px !important;
    }

    /* Reduz o espaçamento entre os botões */
    .controls {
        gap: 6px !important;
    }
}

/* Tablets e Celulares Grandes (480px - 768px) */
@media (min-width: 480px) and (max-width: 768px) {
    .player-hands-container {
        grid-template-columns: repeat(3, 1fr);
        gap: 4px;
    }
}

/* Laptop Pequeno / Telas Médias (769px - 1200px) */
@media (min-width: 769px) and (max-width: 1200px) {
    .player-hands-container {
        grid-template-columns: repeat(4, 1fr);
        gap: 4px;
    }
}


/* ////////////////////////////////////////////////////////////////////// */


/* =======================================================
       === VERSÃO PC OTIMIZADA (TELAS > 1200px) ===
       ======================================================= */

@media (min-width: 1200px) {

    .vignette {
        /* O gradiente: transparente no centro, preto (ou azul escuro) nas bordas */
        background: radial-gradient(circle, transparent 50%, rgba(0, 0, 0, 0.5) 100%);
    }

    /* --- 1. ESTRUTURA GLOBAL E HEADER --- */
    .container {
        max-width: 90vw;
        padding: 5px;
    }

    #roomHeader {
        margin-top: 0px !important;
        padding: 6px 18px;
    }

    /* Regras de ajuste para quando o Header é ocultado */
    header[style*="display: none"],
    header.hidden {
        margin-bottom: 0 !important;
    }

    /* Quando o cabeçalho é ocultado, o tabuleiro ganha bordas superiores e margem */
    header[style*="display: none"]~.board,
    header.hidden~.board {
        margin-top: 20px !important;
        border: 2px solid #ffffff1f;
        /* Utiliza o azul #1e90ff definido no seu :root */
        border-top-left-radius: 10px;
        border-top-right-radius: 10px;
    }

    /* --- 2. GRID DE JOGADORES (5 COLUNAS) --- */
    .player-hands-container {
        grid-template-columns: repeat(5, 1fr);
        gap: 8px;
    }

    .player-area {
        min-height: 110px;
        padding: 5px;
    }

    .player-avatar {
        width: 20px;
        height: 20px;
    }

    .player-title {
        font-size: 11px;
    }

    /* --- 3. CARTAS E SLOTS --- */
    .card,
    .slot,
    .card.small,
    .slot.small {
        width: 55px;
        height: 76px;
    }

    .card {
        border-radius: 8px;
        border: 2px solid #3b5898;
    }

    .player-stack {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        align-items: center;
        padding: 6px;
        width: 100%;
        gap: 7px;
    }

    /* --- 4. STATUS E PONTUAÇÃO --- */
    .points {
        margin: 2px 0;
    }

    .religion-status {
        font-size: 10px;
        padding: 2px 6px;
        margin: 4px 0;
        width: 84px;
        height: 22px;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 1px;
        box-sizing: border-box;
    }

    .religion-icon {
        width: 12px;
        height: 12px;
    }

    /* --- 5. ÁREA CENTRAL E TABULEIRO INFERIOR --- */
    .center-area {
        gap: 8px;
    }

    .bottom-table-container {
        display: grid;
        grid-template-columns: 1fr auto;
        gap: 10px;
        align-items: stretch;
    }

    /* Cemitério */
    .free-area {
        min-height: 110px;
        align-content: center;
        justify-content: center;
    }

    .free-area::before {
        background-size: 14%;
    }

    /* Decks e Asilo */
    .decks-wrapper {
        margin-top: 0;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        width: 280px;
    }


    .asylum-area,
    .deck-area {
        min-height: 110px;
        padding: 8px;
        justify-content: center;
    }

    .deck {
        width: 66px;
        height: 94px;
        border-radius: 10px;
        border: 3px solid #3b5998;
    }

    .asylum-image-wrapper {
        width: 60px;
        height: 60px;
    }

    /* No seu style.css */
    .player-hands-container {
        display: grid;
        transition: grid-template-columns 0.3s ease;
        /* Suaviza a mudança de layout */
    }
}