/* ================= DESIGN SYSTEM & VARIÁVEIS ================= */
:root {
    --bg-color: #0D0D0D;
    --primary-color: #8B1A2F;      /* Vermelho vinho */
    --primary-light: #A5263D;
    --secondary-color: #F2A7BB;    /* Rosa suave */
    --secondary-dark: #D47B92;
    --white: #FFFFFF;
    
    /* Tons de cinza escuro para profundidade */
    --gray-900: #121212;
    --gray-800: #1A1A1A;
    --gray-700: #262626;
    --gray-600: #333333;
    --gray-400: #A3A3A3;
    
    /* Efeitos de vidro */
    --glass-bg: rgba(26, 26, 26, 0.45);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-shadow: rgba(0, 0, 0, 0.65);
    
    /* Fontes */
    --font-title: 'Playfair Display', Georgia, serif;
    --font-sans: 'Plus Jakarta Sans', 'Inter', sans-serif;
    
    /* Cores das Categorias (Gradientes baseados na paleta do jogo) */
    --grad-conhecer: linear-gradient(135deg, #3a0d17 0%, #6e1324 100%);
    --grad-conectar: linear-gradient(135deg, #5c0f20 0%, #9e1b34 100%);
    --grad-futuro: linear-gradient(135deg, #49132e 0%, #8b1a52 100%);
    --grad-intimidade: linear-gradient(135deg, #28030b 0%, #520817 100%);
    --grad-desafios: linear-gradient(135deg, #601424 0%, #b24b60 100%);
    --grad-especial: linear-gradient(135deg, #8B1A2F 0%, #F2A7BB 100%);
}

/* ================= RESET & BÁSICO ================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-color);
    color: var(--white);
    font-family: var(--font-sans);
    min-height: 100vh;
    overflow-x: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

/* Fundo com Glow Dinâmico */
.bg-glow {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

#particles-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.glow-circle {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.15;
    mix-blend-mode: screen;
}

.glow-1 {
    top: -10%;
    right: -10%;
    width: 50vw;
    height: 50vw;
    background: radial-gradient(circle, var(--primary-color) 0%, transparent 70%);
    animation: floating-glow 25s infinite alternate ease-in-out;
}

.glow-2 {
    bottom: -10%;
    left: -10%;
    width: 60vw;
    height: 60vw;
    background: radial-gradient(circle, var(--secondary-color) 0%, transparent 70%);
    animation: floating-glow 30s infinite alternate-reverse ease-in-out;
}

@keyframes floating-glow {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(4%, 6%) scale(1.15); }
}

/* Container Principal da App */
.app-container {
    width: 100%;
    max-width: 480px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    z-index: 1;
    overflow: hidden;
}

#view-jogo {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    padding: 16px;
    box-sizing: border-box;
}


/* Estilo do Vidro (Glassmorphism) */
.card-glass {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 28px;
    box-shadow: 0 16px 40px var(--glass-shadow);
}

/* ================= CONTROLE DE TELAS (VIEWS) ================= */
.view {
    display: none;
    opacity: 0;
    transition: opacity 0.4s ease, transform 0.4s ease;
    transform: translateY(15px);
    width: 100%;
    height: 100vh;
    padding: 16px;
    box-sizing: border-box;
}

.view.active-view {
    display: flex;
    flex-direction: column;
    opacity: 1;
    transform: translateY(0);
}

.login-container, .config-container {
    margin: auto 0;
}

/* ================= BOTÕES ================= */
.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 24px;
    border-radius: 16px;
    font-family: var(--font-sans);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    width: 100%;
    outline: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: var(--white);
    box-shadow: 0 4px 15px rgba(139, 26, 47, 0.4);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 26, 47, 0.6);
    filter: brightness(1.1);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(1px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--gray-400);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.1);
    color: var(--white);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* ================= INPUTS E FORMULÁRIOS ================= */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
    width: 100%;
    text-align: left;
}

.input-group label {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--secondary-color);
}

.input-group input {
    width: 100%;
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    color: var(--white);
    font-family: var(--font-sans);
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
}

.input-group input:focus {
    border-color: var(--secondary-color);
    background: rgba(255, 255, 255, 0.07);
    box-shadow: 0 0 12px rgba(242, 167, 187, 0.2);
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper .input-icon {
    position: absolute;
    left: 16px;
    font-size: 1.1rem;
    pointer-events: none;
}

.input-wrapper input {
    padding-left: 48px;
}

/* Validação / Mensagens de Erro */
.error-message {
    font-size: 0.8rem;
    color: #ff4a5a;
    margin-top: 4px;
    display: none;
    animation: fadeIn 0.2s ease-out;
}

.input-group.invalid input {
    border-color: #ff4a5a;
    box-shadow: 0 0 8px rgba(255, 74, 90, 0.25);
}

.input-group.invalid .error-message {
    display: block;
}

/* ================= TELA DE LOGIN ================= */
.login-container {
    padding: 40px 30px;
    text-align: center;
    width: 100%;
}

.brand-header {
    margin-bottom: 35px;
}

.game-logo-img {
    height: 72px;
    width: auto;
    object-fit: contain;
    margin-bottom: 12px;
    display: inline-block;
    filter: drop-shadow(0 0 12px rgba(139, 26, 47, 0.45));
    animation: heartbeat 2.2s infinite ease-in-out;
}

@keyframes heartbeat {
    0% { transform: scale(1); }
    14% { transform: scale(1.05); }
    28% { transform: scale(1); }
    42% { transform: scale(1.05); }
    70% { transform: scale(1); }
}

.brand-slogan {
    font-size: 0.95rem;
    color: var(--gray-400);
    font-weight: 400;
}

.auth-form {
    margin-top: 20px;
}

.auth-form button {
    margin-top: 10px;
}

.login-footer {
    margin-top: 30px;
    font-size: 0.8rem;
    color: var(--gray-600);
}

/* ================= TELA DE CONFIGURAÇÃO ================= */
.config-container {
    padding: 40px 30px;
    text-align: center;
    width: 100%;
}

.view-title {
    font-family: var(--font-title);
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.view-subtitle {
    font-size: 0.9rem;
    color: var(--gray-400);
    margin-bottom: 25px;
    line-height: 1.4;
}

.config-form button {
    margin-top: 10px;
}

/* ================= TELA DO JOGO ================= */

/* Placar — tamanho fixo */
.game-header {
    flex-shrink: 0;
    padding: 12px 16px;
    margin-bottom: 8px;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.couple-progress {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.level-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.level-badge {
    background: rgba(242, 167, 187, 0.15);
    color: var(--secondary-color);
    padding: 4px 10px;
    border-radius: 30px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: 1px solid rgba(242, 167, 187, 0.2);
}

.level-name {
    font-family: var(--font-title);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--white);
}

.progress-bar-container {
    height: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.02);
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border-radius: 4px;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 8px rgba(242, 167, 187, 0.5);
}

.level-xp-text {
    font-size: 0.75rem;
    color: var(--gray-400);
    text-align: right;
}

.players-scoreboard {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
    padding: 10px 16px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.03);
}

.player-score {
    display: flex;
    flex-direction: column;
    gap: 2px;
    width: 45%;
}

#score-p1 {
    text-align: left;
}

#score-p2 {
    text-align: right;
}

.player-score .p-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--white);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.player-score .p-xp {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--secondary-color);
}

.score-divider {
    color: var(--primary-color);
    font-size: 1rem;
    opacity: 0.7;
    animation: pulse 2s infinite ease-in-out;
}

/* Área da carta — ocupa o espaço restante */
.card-area {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
}

/* Indicador de vez — tamanho fixo */
.turn-announcement {
    flex-shrink: 0;
    margin: 8px 0;
    font-size: 1rem;
    font-weight: 500;
    color: var(--gray-400);
    text-align: center;
    animation: float-text 3s infinite alternate ease-in-out;
}

.turn-announcement .highlight-name {
    color: var(--secondary-color);
    font-weight: 700;
    font-family: var(--font-title);
    font-size: 1.15rem;
    border-bottom: 2px solid rgba(242, 167, 187, 0.3);
    padding-bottom: 1px;
}

@keyframes float-text {
    0% { transform: translateY(0); }
    100% { transform: translateY(-4px); }
}

/* ================= CARTAS 3D FLIP ================= */
/* Container do flip — tamanho fixo, nunca cresce */
.card-3d-wrapper {
    width: 320px;
    height: 300px;
    flex-shrink: 0;
    position: relative;
    perspective: 1500px;
    cursor: pointer;
}

.game-card {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.15);
}

/* Estado virado */
.game-card.flipped {
    transform: rotateY(180deg);
}

/* Caras das cartas */
.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.5);
}

/* Frente da Carta (Costas do baralho, quando está oculta) */
.card-front {
    background: radial-gradient(circle at 50% 30%, #300810 0%, #0d0103 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.card-glow-layer {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    height: 80%;
    background: radial-gradient(circle, rgba(139, 26, 47, 0.3) 0%, transparent 65%);
    pointer-events: none;
    z-index: 1;
}

.card-pattern {
    position: absolute;
    top: 15px;
    left: 15px;
    right: 15px;
    bottom: 15px;
    border: 1px dashed rgba(242, 167, 187, 0.2);
    border-radius: 18px;
    pointer-events: none;
    z-index: 1;
}

.card-front-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    z-index: 2;
}

.card-logo-symbol {
    width: 90px;
    height: 90px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: inset 0 0 15px rgba(242, 167, 187, 0.1);
    animation: breathe 3s infinite ease-in-out;
}

@keyframes breathe {
    0%, 100% { transform: scale(1); box-shadow: inset 0 0 15px rgba(242, 167, 187, 0.1); }
    50% { transform: scale(1.04); box-shadow: inset 0 0 25px rgba(242, 167, 187, 0.25), 0 0 15px rgba(139, 26, 47, 0.2); }
}

.card-back-tap-prompt {
    font-size: 0.85rem;
    color: var(--secondary-color);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 600;
    opacity: 0.8;
}

/* Verso da Carta (Lado revelado, com a pergunta) */
.card-back {
    transform: rotateY(180deg);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    padding: 24px;
}

.card-back-glow {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at top right, rgba(255,255,255,0.08) 0%, transparent 60%);
    pointer-events: none;
}

.card-content-layout {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 100%;
    position: relative;
    z-index: 2;
}

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

.card-category-badge {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.card-xp-badge {
    background: rgba(0, 0, 0, 0.25);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--secondary-color);
    border: 1px solid rgba(242, 167, 187, 0.2);
}

.card-body {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 8px 0;
}

.card-question-text {
    font-family: var(--font-title);
    font-size: 1.25rem;
    line-height: 1.45;
    font-weight: 400;
    color: var(--white);
    text-shadow: 0 2px 10px rgba(0,0,0,0.4);
    animation: fadeIn 0.4s ease-out;
}

.card-card-footer {
    display: flex;
    justify-content: center;
    align-items: center;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.special-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--secondary-color);
    animation: pulse 1.5s infinite alternate ease-in-out;
}

/* ================= NOVOS CONTROLES DE AVALIAÇÃO ================= */
/* Botões — tamanho fixo na parte inferior */
.game-controls-container {
    flex-shrink: 0;
    padding: 12px 0;
    width: 100%;
}

.controls-group {
    display: flex;
    flex-direction: column;
    width: 100%;
    align-items: center;
    gap: 8px;
    animation: fadeIn 0.3s ease-out;
}

.tap-instruction {
    font-size: 0.85rem;
    color: var(--secondary-color);
    text-align: center;
    opacity: 0.7;
    animation: pulse 1.5s infinite alternate ease-in-out;
    padding: 10px;
}

.eval-prompt {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--white);
    text-align: center;
    margin-bottom: 2px;
}

.eval-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    width: 100%;
}

.btn-eval {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px 4px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
    color: var(--white);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    width: 100%;
}

.btn-eval:hover {
    background: rgba(255, 255, 255, 0.08);
}

.btn-eval:active {
    transform: scale(0.95);
}

.btn-eval .emoji {
    font-size: 1.35rem;
    margin-bottom: 2px;
}

.btn-eval .label {
    font-size: 0.75rem;
    font-weight: 700;
}

.btn-eval .points {
    font-size: 0.65rem;
    color: var(--secondary-color);
    margin-top: 1px;
}

.btn-raso:hover {
    border-color: rgba(242, 167, 187, 0.3);
    box-shadow: 0 0 10px rgba(242, 167, 187, 0.1);
}
.btn-boa:hover {
    border-color: rgba(242, 167, 187, 0.5);
    box-shadow: 0 0 12px rgba(242, 167, 187, 0.2);
}
.btn-incrivel:hover {
    border-color: var(--secondary-color);
    box-shadow: 0 0 15px rgba(242, 167, 187, 0.35);
}

.btn-concluimos {
    width: 100%;
    padding: 14px;
    border-radius: 16px;
    font-size: 1rem;
    font-weight: 700;
}


/* ================= MODAL DE NÍVEL ================= */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(13, 13, 13, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
    padding: 20px;
}

.modal-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    width: 100%;
    max-width: 400px;
    padding: 35px 30px;
    text-align: center;
    transform: scale(0.9);
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
}

.modal-overlay.open .modal-content {
    transform: scale(1);
}

.modal-particles span {
    position: absolute;
    font-size: 1.5rem;
    animation: floating-particle 4s infinite linear;
    opacity: 0;
}

.modal-particles span:nth-child(1) { left: 10%; top: 20%; animation-delay: 0s; }
.modal-particles span:nth-child(2) { right: 15%; top: 15%; animation-delay: 0.8s; }
.modal-particles span:nth-child(3) { left: 20%; bottom: 20%; animation-delay: 1.5s; }
.modal-particles span:nth-child(4) { right: 20%; bottom: 25%; animation-delay: 2.2s; }
.modal-particles span:nth-child(5) { left: 45%; top: 10%; animation-delay: 3s; }

@keyframes floating-particle {
    0% { transform: translateY(20px) rotate(0deg); opacity: 0; }
    30% { opacity: 0.7; }
    70% { opacity: 0.7; }
    100% { transform: translateY(-80px) rotate(360deg); opacity: 0; }
}

.modal-title {
    font-family: var(--font-title);
    font-size: 1.6rem;
    font-weight: 600;
    color: var(--white);
    margin-bottom: 15px;
}

.modal-heart-icon {
    font-size: 3.5rem;
    color: var(--primary-color);
    margin: 15px 0;
    animation: heartbeat 1.2s infinite ease-in-out;
}

.modal-text {
    font-size: 0.9rem;
    color: var(--gray-400);
    margin-bottom: 12px;
}

.modal-level-title {
    font-family: var(--font-title);
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--secondary-color);
    margin-bottom: 8px;
    text-shadow: 0 0 10px rgba(242, 167, 187, 0.3);
}

.modal-unlocked-desc {
    font-size: 0.85rem;
    color: var(--white);
    margin-bottom: 25px;
    font-weight: 500;
}

.modal-content button {
    margin-top: 10px;
}

/* ================= SHAKE ANIMATION FOR ERRORS ================= */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}

.shake {
    animation: shake 0.4s ease-in-out;
}

/* Spinner de carregamento do botão */
.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--white);
    animation: spin 0.8s linear infinite;
    display: inline-block;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

