/* Instrução da carta central */
.instrucao-carta {
    color: #fff;
    font-size: clamp(10px, 2vw, 12px);
    text-align: center;
    margin-top: 8px;
    opacity: 0.8;
    font-style: italic;
}* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    /* Fundo verde degradê simulando mesa 
    background: linear-gradient(135deg, #2d5a27 0%, #4a7c59 50%, #2d5a27 100%);
    */
    background-image: url("img/bg_dm_v4b.png");
    background-size: 100% 100%;
    /* Caso queira usar imagem como background:
    background: url('mesa.jpg') no-repeat center center fixed;
    background-size: cover;
    */
    min-height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
}

.game-container {
    position: relative;
    width: 100vw;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2px 20px;
    background: #332138;
    backdrop-filter: blur(10px);
    flex-wrap: wrap;
    gap: 10px;
    background-image: url("img/top-bar-bga.png");
    background-size: 100%;
}

.logo {
    font-size: clamp(18px, 4vw, 24px);
    font-weight: bold;
    color: #fff;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.timer {
    font-size: clamp(20px, 5vw, 28px);
    font-weight: bold;
    color: #fff;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.pontuacao {
    font-size: clamp(20px, 5vw, 28px);
    font-weight: bold;
    color: #fff;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}


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

.btn {
    padding: 8px 16px;
    background: #fbb914;
    color: #332138;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: clamp(12px, 2.5vw, 16px);
    font-weight: bold;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    white-space: nowrap;
}

.btn:hover {
    background: #fff;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.mute-btn {
    background: transparent;
    border: 2px solid #fff;
    color: #fff;
    width: clamp(35px, 8vw, 45px);
    height: clamp(35px, 8vw, 45px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(14px, 3vw, 18px);
    padding: 0;
}

/* Mesa principal */
.mesa {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 15px;
    padding-top: 20px;
    position: relative;
    min-height: 300px;
}

/* Cartas */
.carta {
    width: 140px;
    height: 160px;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    /* Background padrão das cartas */
    background-image: url("img/bg_card_cinzac4.png");
    background-position: center; 
    /* Caso queira usar imagem no background da carta:
    background: url('carta-bg.jpg') no-repeat center center;
    background-size: cover;
    */
    border: 3px solid #ddd;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 10px;
}

.carta:hover {
    transform: translateY(-10px) scale(1.05);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
}

.carta-titulo {
    font-size: clamp(14px, 2.5vw, 13px);
    font-weight: bold;
    color: #332138;
    margin-bottom: 8px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

.carta-significado {
    font-size: 12px;
    line-height: 1.2;
  color: #332138;
  line-height: 1.4;
  overflow-y: auto;
  max-height: 95%;
  padding: 5px;
  font-weight: bold;
}

.carta-jogador .carta-significado {
    display: none;
}

.carta-central .carta-titulo {
    display: none;
}

/* Instrução da carta central */
.instrucao-carta {
    color: #fff;
    font-size: clamp(10px, 2vw, 12px);
    text-align: center;
    margin-top: 8px;
    opacity: 0.8;
    font-style: italic;
}

/* Monte de cartas */
.monte-cartas {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.monte-stack {
    position: relative;
    width: clamp(120px, 20vw, 180px);
    height: clamp(160px, 25vw, 250px);
}

.monte-stack::before,
.monte-stack::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background-image: url("img/bg_card.png");
    background-position: center; 
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.monte-stack::before {
    top: -5px;
    left: -5px;
    z-index: 1;
}

.monte-stack::after {
    top: -10px;
    left: -10px;
    z-index: 0;
}

.monte-count {
    color: #fff;
    font-weight: bold;
    font-size: clamp(12px, 2.5vw, 16px);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    text-align: center;
    background-color: #033e03;
    border-radius: 5px;
    padding: 10px;


}

/* Carta central container */
.carta-central-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

/* Carta central */
#carta-central {
    animation: flipIn 0.6s ease-in-out;
     background-image: url("img/bg_card_cinzac4.png");
    background-position: center; 
    border-color: #6c71ac !important;
    width: 210px;
    height: 260px;
}

/* Cartas usadas */
.cartas-usadas {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;

}

.usadas-stack {
    position: relative;
    width: clamp(120px, 20vw, 180px);
    height: clamp(160px, 25vw, 250px);
}

.usadas-stack .carta {
    position: absolute;
    transform: scale(0.8);
    opacity: 0.7;
}

.carta-unica {
     background-image: url("img/bg_card.png");
    background-position: center; 
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    border: 3px solid #2c5282;
}

.usadas-stack::before,
.usadas-stack::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background-image: url("img/bg_card.png");
    background-position: center; 
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: opacity 0.3s;
}

.usadas-stack.empilhada::before {
    top: -5px;
    left: -5px;
    z-index: 1;
    opacity: 1;
}

.usadas-stack.empilhada::after {
    top: -10px;
    left: -10px;
    z-index: 0;
    opacity: 1;
}

.usadas-count {
    color: #fff;
    font-weight: bold;
    font-size: clamp(12px, 2.5vw, 16px);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    text-align: center;
    background-color: #033e03;
    border-radius: 5px;
    padding: 10px;
}

/* Pontuação */
.pontuacao2 {
    position: absolute;
    bottom: clamp(200px, 40vh, 320px);
    left: 50%;
    transform: translateX(-50%);
    font-size: clamp(24px, 6vw, 36px);
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    transition: all 0.3s;
    text-align: center;
    z-index: 5;
    padding: 10px;
     /*background-color: #005700;*/
}

.pontuacao.positivo {
    color: #4caf50;
    animation: pulse 0.6s;
}

.pontuacao.negativo {
    color: #f44336;
    animation: shake 0.6s;
}

.pontuacao.neutro {
    color: #fff;
}

/* Cartas do jogador */
.cartas-jogador {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: clamp(8px, 1.5vw, 15px);
    padding: 20px;
    justify-content: center;
    max-width: 100vw;
    width: 100vw;
    min-width: fit-content;
    box-sizing: border-box;
}

.carta-jogador {
    transform-origin: bottom center;
    animation: dealCard 0.8s ease-out;
    flex-shrink: 0;
}

.carta-jogador:nth-child(1) {
    transform: rotate(-15deg) translateY(-10px);
    animation-delay: 0.1s;
}

.carta-jogador:nth-child(2) {
    transform: rotate(-7deg) translateY(-5px);
    animation-delay: 0.2s;
}

.carta-jogador:nth-child(3) {
    transform: rotate(0deg);
    animation-delay: 0.3s;
}

.carta-jogador:nth-child(4) {
    transform: rotate(7deg) translateY(-5px);
    animation-delay: 0.4s;
}

.carta-jogador:nth-child(5) {
    transform: rotate(15deg) translateY(-10px);
    animation-delay: 0.5s;
}

.carta-jogador:hover {
    transform: translateY(-20px) scale(1.1) rotate(0deg) !important;
    z-index: 10;
}

/* Tela inicial */
.tela-inicial {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
}

.tela-inicial h1 {
    color: #fff;
    font-size: clamp(24px, 8vw, 48px);
    margin-bottom: 30px;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.5);
    text-align: center;
}

.btn-iniciar {
    font-size: clamp(16px, 4vw, 24px);
    padding: 15px 30px;
    background: #fbb914;
    animation: pulse 2s infinite;
}

.btn-reiniciar-final {
    background: #4caf50;
    margin-top: 10px;
}

.btn-reiniciar-final:hover {
    background: #45a049;
}

.regras-jogo {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 20px;
    margin-top: 30px;
    max-width: 600px;
    text-align: left;
}

.regras-jogo h3 {
    color: #ffeb3b;
    font-size: clamp(18px, 4vw, 24px);
    margin-bottom: 15px;
    text-align: center;
}

.regras-jogo ul {
    list-style: none;
    padding: 0;
    color: #fff;
}

.regras-jogo li {
    font-size: clamp(12px, 2.5vw, 16px);
    margin-bottom: 8px;
    line-height: 1.4;
    padding-left: 10px;
}

.regras-jogo strong {
    color: #4caf50;
}

/* Tela final */
.tela-final {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    color: #fff;
    text-align: center;
    padding: 20px;
    overflow-y: auto;
}

.tela-final h2 {
    font-size: clamp(20px, 6vw, 36px);
    margin-bottom: 20px;
}

.tela-final h3 {
    font-size: clamp(14px, 3vw, 20px);
    margin: 10px 0;
}

.tela-final p {
    font-size: clamp(12px, 2.5vw, 16px);
    margin: 5px 0;
}

.tela-final input {
    font-size: clamp(14px, 3vw, 18px);
    padding: 10px 15px;
    margin: 15px;
    border: none;
    border-radius: 10px;
    text-align: center;
    max-width: 250px;
    width: 80%;
}

.ranking {
    background: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 15px;
    margin-top: 20px;
    max-height: 250px;
    overflow-y: auto;
    width: 100%;
    max-width: 400px;
}

.ranking h3 {
    font-size: clamp(14px, 3vw, 18px);
    margin-bottom: 10px;
}

.ranking-item {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    font-size: clamp(10px, 2vw, 12px);
    gap: 10px;
}

.ranking-item span:first-child {
    flex: 1;
    text-align: left;
}

.ranking-item span:last-child {
    flex-shrink: 0;
    text-align: right;
}

/* Mensagem de match */
.match-message, .match-message-erro {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: clamp(24px, 8vw, 48px);
    font-weight: bold;
    color: #4caf50;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.5);
    z-index: 999;
    animation: matchAnimation 2s ease-out;
    pointer-events: none;
    text-align: center;
    padding: 20px;
}

/* Responsividade para dispositivos móveis */
@media (max-width: 768px) {
    .header {
        padding: 10px 15px;
        /*flex-direction: column;*/
        gap: 10px;
    }

    .carta-titulo {
    font-size: 10px;
    font-weight: bold;

}

    
    .mesa {
        flex-direction: column;
        gap: 20px;
        align-items: center;
        padding: 10px;
    }
    
    .monte-cartas, .cartas-usadas {
        order: 1;
        flex-direction: row;
        gap: 20px;
    }
    
    .carta-central-container {
        order: 2;
    }
    
    .pontuacao {
        position: relative;
        bottom: auto;
        left: auto;
        transform: none;
        order: 3;
        margin: 20px 0;
    }
    
    .cartas-jogador {
        position: relative;
        bottom: auto;
        left: auto;
        transform: none;
        order: 4;
        margin-top: 10px;
        flex-wrap: wrap;
        max-width: 100%;
        width: 100px;
    }
    
    .carta-jogador:nth-child(n) {
        transform: none !important;
        margin: 2px;
    }
    
    .carta-jogador:hover {
        transform: scale(1.1) !important;
    }
}

@media (max-width: 480px) {

    .carta-titulo {
    font-size: 10px;
    font-weight: bold;

}

.carta-central {

  /*  width: 210px;
    height: 280px;*/
}

    .cartas-jogador {
        gap: 3px;
        flex-wrap: wrap;
        width: 100%;
    }
    
    .carta {
        width: 133px;
        height: 126px;
        padding: 5px;
    }
    
    .monte-stack, .usadas-stack {
        width: clamp(80px, 18vw, 120px);
        height: clamp(110px, 23vw, 160px);
    }
}

/* Modo desktop - força layout horizontal das cartas */
@media (min-width: 769px) {
    .cartas-jogador {
        flex-wrap: nowrap;
        width: 100vw;
        min-width: 100vw;
        max-width: 100vw;
        overflow: visible;
        padding: 20px 10px;
    }
    
    .carta-jogador {
        flex-shrink: 0;
        min-width: clamp(120px, 15vw, 180px);
    }
    
    body {
        overflow-x: hidden;
    }
    
    .game-container {
        overflow-x: hidden;
    }
}

/* Animações */
@keyframes flipIn {
    0% {
        transform: rotateY(90deg);
        opacity: 0;
    }
    100% {
        transform: rotateY(0deg);
        opacity: 1;
    }
}

@keyframes dealCard {
    0% {
        transform: translateY(100px) scale(0);
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-10px);
    }
    75% {
        transform: translateX(10px);
    }
}

@keyframes matchAnimation {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 0;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0;
    }
}

.hidden {
    display: none !important;
}