/* =========================================
   MOBILE PATCH - SOLUÇÃO DE RESPONSIVIDADE
   ========================================= */
@media (max-width: 768px) {

    /* 1. Ajuste Geral */
    body, html {
        overflow-x: hidden; /* Impede rolagem lateral indesejada */
        font-size: 16px; /* Letra legível */
    }

    /* 2. Containers ocupam 100% da tela */
    .container, .main-content, .card, .dashboard-container {
        width: 100% !important;
        padding: 10px !important;
        margin: 0 !important;
        box-sizing: border-box;
    }

    /* 3. CHAT: A correção da rolagem travada */
    .chat-list, .message-area, #msgArea, #chatList {
        height: 60vh !important; /* Define altura fixa baseada na tela */
        max-height: 60vh !important;
        overflow-y: auto !important; /* Força barra de rolagem */
        -webkit-overflow-scrolling: touch; /* Rolagem lisa no iPhone */
    }

    /* 4. Botões grandes para dedos */
    button, .btn-action, input[type="submit"] {
        min-height: 44px; /* Tamanho mínimo recomendado pela Apple/Google */
        font-size: 16px;
        margin-bottom: 5px;
    }

    /* 5. Inputs de texto não dão zoom automático */
    input[type="text"], input[type="password"], textarea {
        font-size: 16px !important; /* Evita zoom no iPhone ao clicar */
        padding: 10px;
    }

    /* 6. Modais ocupam a tela toda */
    .modal-content {
        width: 90% !important;
        margin: 5% auto;
        padding: 20px;
    }

    /* 7. Ajuste do NPC Display (para não tapar o chat) */
    #npcDisplay {
        width: 150px !important; /* Menor no celular */
        right: 0 !important;
        bottom: 60px !important; /* Sobe um pouco pra não ficar em cima do input */
    }
}

:root {
    --bg-color: #E0F7FA;
    --leaf-color-1: #81D4FA;
    --leaf-color-2: #FFCC80;
    --primary-blue: #007AFF;
    --heartstopper-yellow: #FFF59D;
    --heartstopper-blue: #4DD0E1;
    --font-hand: 'Caveat', cursive;
    --font-main: 'Nunito', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none; /* Previne seleção de texto para parecer app nativo */
}

body {
    background: linear-gradient(135deg, #fdfbfb 0%, #ebedee 100%);
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: var(--font-main);
    overflow: hidden;
}

/* --- Animação de Folhas (Heartstopper Vibe - Orgânico) --- */
.leaves-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
    /* Perspectiva para dar um leve 3D se quisermos girar no eixo Y/X */
    perspective: 1000px;
}

.leaf {
    position: absolute;
    /* Não definimos a imagem aqui mais, o JS vai fazer isso */
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    /* Começa invisível e fora da tela */
    top: -10%; 
    opacity: 0;
    will-change: transform, opacity; /* Otimização de performance */
}

/* --- Estilos de Queda (Keyframes) --- */

/* Estilo 1: Balanço suave para a direita */
@keyframes fall-style-1 {
    0% {
        opacity: 0;
        transform: translateY(0) translateX(0) rotate(0deg) rotateX(0deg);
    }
    10% { opacity: 0.8; }
    30% {
        transform: translateY(30vh) translateX(-30px) rotate(90deg) rotateX(45deg);
    }
    60% {
        transform: translateY(60vh) translateX(40px) rotate(180deg) rotateX(0deg);
    }
    100% {
        opacity: 0;
        transform: translateY(110vh) translateX(-20px) rotate(360deg) rotateX(60deg);
    }
}

/* Estilo 2: Balanço mais amplo para a esquerda */
@keyframes fall-style-2 {
    0% {
        opacity: 0;
        transform: translateY(0) translateX(0) rotate(0deg);
    }
    10% { opacity: 0.9; }
    40% {
        transform: translateY(40vh) translateX(60px) rotate(-120deg);
    }
    70% {
        transform: translateY(70vh) translateX(-50px) rotate(-240deg);
    }
    100% {
        opacity: 0;
        transform: translateY(110vh) translateX(20px) rotate(-360deg);
    }
}

/* Estilo 3: Queda mais reta, girando rápido */
@keyframes fall-style-3 {
    0% {
        opacity: 0;
        transform: translateY(0) rotate(0deg) scale(1);
    }
    15% { opacity: 0.7; }
    100% {
        opacity: 0;
        transform: translateY(110vh) rotate(720deg) scale(0.8);
    }
}

/* Estilo 4: Flutuando devagar */
@keyframes fall-style-4 {
    0% { opacity: 0; transform: translateY(0) translateX(0); }
    20% { opacity: 1; transform: translateY(20vh) translateX(-20vw) rotate(45deg); }
    50% { transform: translateY(50vh) translateX(10vw) rotate(-45deg); }
    100% { opacity: 0; transform: translateY(110vh) translateX(-10vw) rotate(90deg); }
}

/* --- O Celular (Frame) --- */
.phone-frame {
    width: 375px;
    height: 812px;
    background: #fff;
    border-radius: 40px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.2), 0 0 0 10px #333;
    position: relative;
    overflow: hidden;
    z-index: 10;
    transition: transform 0.3s ease;
}


.notch {
    width: 150px;
    height: 25px;
    background: #333;
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    border-bottom-left-radius: 20px;
    border-bottom-right-radius: 20px;
    z-index: 100;
}

.home-indicator {
    width: 130px;
    height: 5px;
    background: #000;
    border-radius: 10px;
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0.2;
    cursor: pointer;
    z-index: 200;
}

/* --- Telas --- */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('https://i.pinimg.com/originals/c9/22/68/c92268d92cf2dbf96e3195638d923ebc.jpg'); /* Exemplo de fundo */
    background-size: cover;
    background-position: center;
    display: flex;
    flex-direction: column;
    padding-top: 50px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
    border-radius: 40px;
    overflow: hidden;
}

.screen.active {
    opacity: 1;
    pointer-events: all;
}

/* Tela de Login */
.login-screen {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    align-items: center;
    justify-content: center;
    z-index: 50;
}

.clock { font-size: 80px; font-weight: 200; color: #333; }
.date { font-size: 20px; color: #666; margin-bottom: 40px; }

.login-form input {
    display: block;
    width: 250px;
    padding: 15px;
    margin: 10px 0;
    border: 1px solid #ddd;
    border-radius: 15px;
    font-family: var(--font-main);
    font-size: 16px;
    outline: none;
    transition: 0.3s;
}

.login-form input:focus { border-color: var(--heartstopper-blue); }

.btn-primary {
    background: var(--heartstopper-blue);
    color: white;
    border: none;
    padding: 15px 40px;
    border-radius: 25px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    width: 100%;
    margin-top: 10px;
    transition: transform 0.2s;
}
.btn-primary:active { transform: scale(0.95); }

/* Home Screen */
.status-bar {
    display: flex;
    justify-content: space-between;
    padding: 0 25px;
    font-size: 14px;
    font-weight: bold;
    color: #333;
    margin-bottom: 20px;
}

.app-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px 10px;
    padding: 20px;
}

.dock {
    position: absolute;
    bottom: 30px;
    width: 90%;
    left: 5%;
    background: rgba(255,255,255,0.4);
    backdrop-filter: blur(15px);
    border-radius: 30px;
    padding: 15px;
    display: flex;
    justify-content: space-around;
}

.app-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: transform 0.2s;
}

.app-icon:active { transform: scale(0.9); }

.icon-box {
    width: 60px;
    height: 60px;
    border-radius: 18px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 30px;
    color: white;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    margin-bottom: 5px;
}

.app-icon span { font-size: 12px; font-weight: 600; color: #333; }

/* Cores dos Apps */
.color-blue { background: #4facfe; }
.color-yellow { background: #f093fb; background-image: linear-gradient(120deg, #f6d365 0%, #fda085 100%); }
.color-dark { background: #434343; }
.color-red { background: #ff9a9e; }
.color-pink { background: #ff758c; }
.color-green { background: #43e97b; }
.color-purple { background: #a18cd1; }

/* --- Janelas dos Apps (Modais) --- */
.app-window {
    position: absolute;
    top: 100%; /* Começa escondido embaixo */
    left: 0;
    width: 100%;
    height: 100%;
    background: #f5f5f7;
    z-index: 60;
    transition: top 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    display: flex;
    flex-direction: column;
}

.app-window.open { top: 0; }

.app-header {
    height: 60px;
    background: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 15px;
    padding-top: 15px; /* Compensar notch visualmente se precisar */
    border-bottom: 1px solid #eee;
}

.app-header h3 { font-size: 18px; }
.back-btn { background: none; border: none; font-size: 24px; color: #007AFF; cursor: pointer; }

.app-content {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.padding-20 { padding: 20px; }

/* Estilos Específicos dos Apps */
.chat-item {
    display: flex;
    align-items: center;
    padding: 10px;
    background: white;
    border-radius: 15px;
    margin-bottom: 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    flex-shrink: 0 !important;
    background: #ddd;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    color: white;
    margin-right: 15px;
}

.affection-card {
    background: white;
    padding: 20px;
    border-radius: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.affection-card h4 { font-family: var(--font-hand); font-size: 28px; margin-bottom: 15px; }

.progress-bar {
    width: 100%;
    height: 10px;
    background: #eee;
    border-radius: 5px;
    margin-bottom: 15px;
    overflow: hidden;
}

.fill { height: 100%; border-radius: 5px; }
.fill.pink { background: #ff758c; }
.fill.blue { background: #4facfe; }

/* Scrollbar Bonita */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-thumb { background: #ccc; border-radius: 10px; }

.gm-access-link {
    position: fixed;
    bottom: 20px;
    right: 20px;
    color: #999;
    text-decoration: none;
    font-size: 14px;
    background: rgba(255,255,255,0.8);
    padding: 10px 15px;
    border-radius: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: 0.3s;
    font-family: var(--font-main);
}

.gm-access-link:hover {
    color: var(--primary-blue);
    background: white;
    transform: translateY(-2px);
}

/* --- Estilos Específicos dos Apps --- */

/* App Notas (Papel Amarelo) */
.note-paper {
    background: #fffdf0; /* Cor de Post-it suave */
    height: 100%;
}
.note-paper textarea {
    width: 100%;
    height: 100%;
    background: transparent;
    border: none;
    padding: 20px;
    font-family: var(--font-hand); /* Fonte manuscrita */
    font-size: 24px;
    line-height: 1.5;
    resize: none;
    outline: none;
    color: #444;
}

/* App Dados */
/* --- Novo Estilo do App de Dados --- */

.centered-top {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 30px;
}

.dice-section-label {
    font-size: 14px;
    color: #888;
    margin-bottom: 10px;
    font-weight: 600;
    width: 100%;
    text-align: center;
}

/* Seletor de Quantidade (+ e -) */
.quantity-selector {
    display: flex;
    align-items: center;
    background: white;
    padding: 5px;
    border-radius: 50px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    margin-bottom: 25px;
}

.qty-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: #f0f0f0;
    font-size: 20px;
    cursor: pointer;
    color: #333;
    transition: 0.2s;
}
.qty-btn:active { background: #ddd; transform: scale(0.9); }

#diceQtyDisplay {
    font-size: 24px;
    font-weight: bold;
    width: 60px;
    text-align: center;
    color: var(--primary-blue);
}

/* Grid de Tipos (d4, d6...) */
.dice-type-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-bottom: 30px;
    max-width: 300px;
}

.die-btn {
    width: 50px;
    height: 50px;
    border: 2px solid #eee;
    background: white;
    border-radius: 12px;
    font-weight: bold;
    color: #666;
    cursor: pointer;
    transition: 0.3s;
}

.die-btn:hover { border-color: var(--primary-blue); color: var(--primary-blue); }

.die-btn.active {
    background: var(--primary-blue);
    color: white;
    border-color: var(--primary-blue);
    box-shadow: 0 4px 10px rgba(0,122,255,0.3);
    transform: translateY(-2px);
}

/* Botão ROLAR */
.btn-roll-action {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    border: none;
    padding: 15px 50px;
    border-radius: 30px;
    font-size: 18px;
    font-weight: 800;
    box-shadow: 0 5px 20px rgba(79, 172, 254, 0.4);
    cursor: pointer;
    transition: transform 0.2s;
    width: 80%;
}
.btn-roll-action:active { transform: scale(0.95); }

/* Área de Resultados */
.results-area {
    margin-top: 30px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    min-height: 80px;
    width: 100%;
}

.placeholder-text { color: #ccc; margin-top: 20px; }

/* O dado individual gerado */
.result-die {
    width: 50px;
    height: 50px;
    background: white;
    border: 2px solid var(--primary-blue);
    color: var(--primary-blue);
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    font-size: 18px;
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.result-die.crit {
    background: #43e97b; /* Verde para critico */
    border-color: #43e97b;
    color: white;
}

.result-die.fumble {
    background: #ff758c; /* Vermelho para falha */
    border-color: #ff758c;
    color: white;
}

@keyframes popIn {
    from { opacity: 0; transform: scale(0.5); }
    to { opacity: 1; transform: scale(1); }
}

.total-display {
    font-size: 20px;
    color: #333;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
    width: 100%;
    text-align: center;
}
.total-display span { font-weight: 900; font-size: 28px; color: var(--primary-blue); }

/* App Boletim */
.school-card {
    background: white;
    padding: 20px;
    border-radius: 10px;
    border: 1px solid #eee;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}
.school-header { display: flex; align-items: center; margin-bottom: 20px; border-bottom: 2px solid var(--heartstopper-yellow); padding-bottom: 10px;}
.school-logo { width: 40px; height: 40px; background: #ccc; border-radius: 50%; margin-right: 15px; }
.grades-table { width: 100%; border-collapse: collapse; }
.grades-table th { text-align: left; color: #999; font-size: 12px; padding-bottom: 10px; }
.grades-table td { padding: 10px 0; border-bottom: 1px solid #f5f5f5; font-weight: 600; }
.grade-a { color: #43e97b; }
.grade-b { color: #4facfe; }
.grade-c { color: #ff9a9e; }

/* App Cena */
.scene-viewer {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    position: relative;
}
.scene-overlay {
    position: absolute;
    bottom: 0;
    width: 100%;
    padding: 20px;
    background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
    color: white;
}
.no-padding { padding: 0 !important; }

/* App Rutherford (Placeholder) */
.pdf-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #999;
}
.pdf-placeholder i { font-size: 60px; margin-bottom: 10px; }

/* --- Botão Físico Lateral (Power) --- */
.side-button.power-btn {
    position: absolute;
    top: 150px;
    right: -18px;      /* Joga para fora do Wrapper (negativo) */
    width: 8px;        /* Um pouco mais largo para garantir clique */
    height: 60px;
    background: #222;  /* Cor da borda */
    border-radius: 4px;
    cursor: pointer;
    z-index: 5;        /* Fica atrás do celular visualmente se sobrepor */
    transition: background 0.3s;
}

.side-button.power-btn:hover {
    background: #ff4757;
}

/* 4. Ajuste da Label Flutuante */
.power-label {
    position: absolute;
    top: 165px;
    left: 100%;        /* Começa logo após o wrapper */
    margin-left: 20px; /* Dá um espacinho */
    display: flex;
    align-items: center;
    gap: 10px;
    color: #666;
    font-family: 'Nunito', sans-serif;
    font-size: 14px;
    opacity: 0.5;
    pointer-events: none;
    white-space: nowrap;
}

.phone-wrapper {
    position: relative; /* O botão vai se posicionar em relação a isso */
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    z-index: 100;
}

/* Responsividade para telas menores que o frame */
@media (max-width: 400px) {
    .phone-frame {
        width: 100%;
        height: 100%;
        border-radius: 0;
        box-shadow: none;
        border: none;
    }
}
/* Animação da setinha se movendo */
.power-label i {
    font-size: 20px;
    animation: pointLeft 1.5s infinite ease-in-out;
}

@keyframes pointLeft {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(-5px); }
}

/* Quando passa o mouse no botão, o texto acende */
.side-button.power-btn:hover + .power-label {
    opacity: 1;
    color: #ff4757;
    transform: translateX(-5px);
}

/* --- CHAT STYLES --- */
.chat-history {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-bottom: 60px; /* Espaço para input */
}

.message-bubble {
    max-width: 70%;
    padding: 10px 15px;
    border-radius: 20px;
    font-size: 14px;
    position: relative;
    word-wrap: break-word;
}

.message-bubble small {
    display: block;
    font-size: 10px;
    opacity: 0.7;
    margin-bottom: 2px;
}

/* Minhas mensagens (Direita) */
.msg-me {
    align-self: flex-end;
    background: #007AFF; /* Cor padrão, será sobrescrita pelo style inline */
    color: white;
    border-bottom-right-radius: 5px;
}

/* Mensagens dos outros (Esquerda) */
.msg-other {
    align-self: flex-start;
    background: #E5E5EA;
    color: black;
    border-bottom-left-radius: 5px;
}

/* Área de Input Fixa */
.chat-input-area {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background: white;
    border-top: 1px solid #eee;
    display: flex;
    align-items: center;
    padding: 0 10px;
    gap: 10px;
}

.chat-input-area input {
    flex: 1;
    padding: 10px;
    border-radius: 20px;
    border: 1px solid #ddd;
    outline: none;
}

.chat-input-area button {
    background: none;
    border: none;
    font-size: 24px;
    color: #007AFF;
    cursor: pointer;
}

.btn-new-chat {
    width: 100%;
    padding: 10px;
    margin-bottom: 10px;
    background: #f0f0f0;
    border: none;
    border-radius: 10px;
    color: var(--primary-blue);
    font-weight: bold;
    cursor: pointer;
}

/* --- ANIMAÇÃO DE DIGITANDO (TYPING INDICATOR) --- */
.typing-indicator {
    background-color: #E5E5EA;
    padding: 10px 15px;
    border-radius: 20px;
    border-bottom-left-radius: 2px; /* Estilo balão recebido */
    display: inline-block;
    align-self: flex-start;
    margin-bottom: 10px;
    width: fit-content;
}

.typing-indicator span {
    display: inline-block;
    width: 8px;
    height: 8px;
    background-color: #999;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
    margin: 0 2px;
}

.typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator span:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Modal de Contatos (Forçando sobreposição) */
.contact-list-modal {
    position: absolute;
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%;
    background-color: #ffffff !important; /* Branco forçado */
    z-index: 9999 !important; /* Garante que fique acima de tudo */
    display: none; /* Começa oculto */
    flex-direction: column;
}

.contact-item {
    display: flex;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background 0.2s;
}
.contact-item:active { background: #f5f5f5; }

/* Garante que o botão + apareça */
.btn-new-chat-icon {
    cursor: pointer;
    padding: 5px;
    transition: transform 0.2s;
}
.btn-new-chat-icon:active { transform: scale(0.9); }
.contact-avatar {
    width: 40px; height: 40px;
    background: #ddd;
    border-radius: 50%;
    margin-right: 15px;
    display: flex; justify-content: center; align-items: center;
    color: white; font-weight: bold;
}

/* --- ESTILO DOS CARDS DE LAÇOS --- */

.bond-card {
    background: white;
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08); /* Sombra suave */
    border: 1px solid #f0f0f0;
}

.bond-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.bond-name {
    font-weight: bold;
    font-size: 1.1em;
    color: #333;
}

.bond-dt {
    background: #eee;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.8em;
    color: #666;
    font-weight: bold;
}

/* --- A BARRA SOCIAL (O DEGRADÊ) --- */

/* O "Trilho" cinza por onde a barra corre */
.social-track-container {
    display: flex;
    height: 12px;           /* Altura da barra */
    background-color: #eee; /* Fundo cinza */
    border-radius: 6px;
    position: relative;     /* Necessário para o marcador central */
    overflow: hidden;       /* Corta o que passar das bordas */
    margin-top: 5px;
}

/* A linha central que divide negativo/positivo */
.track-center-marker {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 2px;
    background-color: #ccc; /* Cor da linha do meio */
    z-index: 10;
    transform: translateX(-50%);
}

/* Divide o trilho em 2 metades (Esquerda e Direita) */
.track-side {
    flex: 1; /* Cada um ocupa 50% */
    display: flex;
    align-items: center;
}

/* Lado Negativo (Esquerda) */
.track-negative {
    justify-content: flex-end; /* Barra cresce em direção ao centro */
}

/* Lado Positivo (Direita) */
.track-positive {
    justify-content: flex-start; /* Barra cresce a partir do centro */
}

/* --- CORES DOS DEGRADÊS --- */

/* Barra Positiva (Azul/Verde) */
.fill-social-pos {
    height: 100%;
    background: linear-gradient(90deg, #4facfe 0%, #00f2fe 100%); /* Degradê Azul Ciano */
    border-radius: 0 4px 4px 0;
}

/* Barra Negativa (Vermelho/Laranja) */
.fill-social-neg {
    height: 100%;
    background: linear-gradient(90deg, #ff9a9e 0%, #fecfef 99%, #feada6 100%); /* Degradê Avermelhado */
    /* Ou use este mais forte se preferir: */
    background: linear-gradient(90deg, #ff416c, #ff4b2b); 
    border-radius: 4px 0 0 4px;
}

/* --- BARRA DE AFETO (CORAÇÃO) --- */
.afetivo-container {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
}

.heart-icon {
    color: #ff4757;
    font-size: 1.2em;
}

.afetivo-track {
    flex: 1;
    height: 6px;
    background: #ffeaa7; /* Fundo amarelinho claro */
    border-radius: 3px;
    overflow: hidden;
}

.fill-afetivo {
    height: 100%;
    background: #ff4757; /* Vermelho sólido */
}

/* --- ESTILOS DO MODAL DE GRUPO --- */

/* Fundo escuro transparente */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6); z-index: 2000;
    display: flex; justify-content: center; align-items: center;
    backdrop-filter: blur(3px); /* Efeito de desfoque moderno */
}

/* A caixa do modal em si */
.group-modal-box {
    background: white; width: 90%; max-width: 500px;
    border-radius: 15px; box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    overflow: hidden; animation: slideUp 0.3s ease-out;
}
@keyframes slideUp { from {transform: translateY(20px); opacity: 0;} to {transform: translateY(0); opacity: 1;} }

/* Cabeçalho e Rodapé */
.modal-header { padding: 20px; background: #f8f9fa; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #eee; }
.modal-footer { padding: 15px 20px; background: #f8f9fa; display: flex; justify-content: flex-end; gap: 10px; border-top: 1px solid #eee; }
.close-btn { background: none; border: none; font-size: 24px; color: #888; cursor: pointer; }

/* Corpo do Modal */
.modal-body { padding: 20px; }
.input-group { margin-bottom: 20px; }
.input-group label { display: block; margin-bottom: 8px; font-weight: 600; color: #555; }
.input-group input { width: 100%; padding: 12px; border: 1px solid #ddd; border-radius: 8px; font-size: 14px; }

/* --- LISTA DE CHECKBOXES CUSTOMIZADA --- */
.checkbox-list-container {
    max-height: 250px; /* Altura máxima com rolagem */
    overflow-y: auto;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 5px;
    background: #fafafa;
}

/* O item da lista (a linha inteira) */
.user-checkbox-item {
    display: flex; align-items: center;
    padding: 10px 15px;
    margin: 5px 0;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}
.user-checkbox-item:hover { background: #f0f4ff; }

/* Esconde o checkbox padrão feio do navegador */
.user-checkbox-item input[type="checkbox"] { display: none; }

/* O nosso checkbox customizado (a bolinha/quadrado) */
.checkmark {
    height: 22px; width: 22px;
    background-color: #eee;
    border-radius: 6px;
    margin-right: 15px;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s;
    border: 2px solid #ddd;
}

/* Quando estiver marcado: Muda a cor do container e do checkmark */
.user-checkbox-item input:checked ~ .checkmark {
    background-color: #5d5fef; /* Cor principal (roxo/azul) */
    border-color: #5d5fef;
    color: white;
}
/* Adiciona um "✔" quando marcado */
.user-checkbox-item input:checked ~ .checkmark::after {
    content: '✔'; font-size: 14px;
}
/* Muda a borda da linha inteira quando marcado */
.user-checkbox-item input:checked ~ .user-name { font-weight: bold; color: #5d5fef; }
.user-checkbox-item:has(input:checked) { border-color: #5d5fef; background: #f8f9ff; }

.user-name { font-size: 15px; color: #333; }

/* Botões */
.btn-confirm, .btn-cancel { padding: 10px 20px; border-radius: 8px; cursor: pointer; border: none; font-weight: 600; }
.btn-confirm { background: #5d5fef; color: white; }
.btn-confirm:hover { background: #4b4ddb; }
.btn-cancel { background: #ddd; color: #333; }
.btn-cancel:hover { background: #ccc; }

/* --- ESTILO NOVO DO BOLETIM (TABELA) --- */

.boletim-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    overflow: hidden;
    border: 1px solid #e0e0e0;
}

/* Cabeçalho da Tabela */
.boletim-header-row {
    display: flex;
    background: #f4f4f4;
    padding: 10px 15px;
    font-weight: bold;
    color: #555;
    font-size: 13px;
    text-transform: uppercase;
    border-bottom: 2px solid #ddd;
}

/* Linhas da Tabela */
.boletim-row {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
}

.boletim-row:last-child { border-bottom: none; }

/* Colunas */
.col-materia { flex: 1; font-weight: 600; color: #333; }
.col-nota { width: 60px; text-align: center; }

/* A "Etiqueta" da Nota */
.nota-badge {
    display: inline-block;
    padding: 4px 0;
    width: 100%;
    text-align: center;
    border-radius: 6px;
    font-weight: bold;
    font-size: 14px;
    color: #555;
    background: #eee; /* Cor padrão se não bater com nada */
}

/* --- CORES DAS NOTAS (Conforme pedido) --- */

/* Verde: A+, A, A-, B+ */
.nota-verde { background-color: #d1f7c4; color: #0f5132; border: 1px solid #badbcc; }

/* Amarelo: B, B- */
.nota-amarela { background-color: #fff3cd; color: #664d03; border: 1px solid #ffecb5; }

/* Laranja: C+, C */
.nota-laranja { background-color: #ffe5d0; color: #fd7e14; border: 1px solid #ffccb0; }

/* Vermelho: C-, F */
.nota-vermelha { background-color: #f8d7da; color: #842029; border: 1px solid #f5c2c7; }
/* --- EFEITOS VISUAIS (HEARTSTOPPER STYLE) --- */

/* 1. CORAÇÕES (LOVE) */
.particle-heart {
    position: absolute;
    color: #ff4757;
    font-size: 24px;
    animation: floatUp 3s linear forwards;
    opacity: 0;
}
@keyframes floatUp {
    0% { transform: translateY(100vh) scale(0.5); opacity: 0; }
    10% { opacity: 1; }
    100% { transform: translateY(-10vh) scale(1.2) rotate(20deg); opacity: 0; }
}

/* --- 2. ANSIEDADE REFEITA (Túnel de Névoa Parado + Conteúdo Tremendo) --- */

/* O que treme é apenas o wrapper do conteúdo */
.anxiety-mode {
    animation: shakeContent 0.15s infinite linear;
}

/* Uma tremedeira mais rápida e curta, tipo nervoso */
@keyframes shakeContent {
    0% { transform: translate(0, 0); }
    25% { transform: translate(2px, 1px); }
    50% { transform: translate(0, -1px); }
    75% { transform: translate(-2px, 0px); }
    100% { transform: translate(0, 0); }
}

/* O TÚNEL DE NÉVOA (Vignette) - Fica parado por cima de tudo */
.anxiety-vignette {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: 99998;
    /* Base escura pulsante */
    background: radial-gradient(circle at center, transparent 30%, rgba(0,10,20,0.8) 70%, #00050a 100%);
    animation: tunnel-pulse 3s infinite ease-in-out alternate;
    overflow: hidden; /* Garante que a fumaça não vaze da tela */
}

/* Camadas de Fumaça (Smoke Layers) usando pseudo-elementos */
.anxiety-vignette::before, 
.anxiety-vignette::after {
    content: "";
    position: absolute;
    top: 50%; left: 50%;
    /* Criamos formas gigantescas que excedem a tela */
    width: 200vmax; 
    height: 200vmax;
    /* Centraliza */
    transform: translate(-50%, -50%);
    /* Bordas irregulares para parecer nuvem */
    border-radius: 40% 60% 50% 40% / 50% 40% 60% 50%;
    /* Gradiente que simula fumaça escura */
    background: radial-gradient(circle at center, transparent 40%, rgba(30, 30, 30, 0.4) 60%, rgba(0,0,0,0.8) 85%);
    mix-blend-mode: multiply; /* Mistura para escurecer */
    /* Animação de rotação lenta */
    animation: rotateSmoke 20s infinite linear;
}

/* A segunda camada gira ao contrário para dar caos */
.anxiety-vignette::after {
    border-radius: 50% 40% 60% 50% / 40% 60% 50% 40%;
    background: radial-gradient(circle at center, transparent 35%, rgba(20, 40, 50, 0.3) 55%, rgba(0,0,0,0.7) 80%);
    animation-direction: reverse;
    animation-duration: 28s;
    opacity: 0.7;
}

/* Animação do túnel base pulsando (fechando a visão) */
@keyframes tunnel-pulse {
    0% { background: radial-gradient(circle at center, transparent 40%, rgba(0,10,20,0.7) 70%, #00050a 100%); }
    100% { background: radial-gradient(circle at center, transparent 25%, rgba(0,10,20,0.9) 65%, #00050a 100%); }
}

/* Animação da fumaça girando */
@keyframes rotateSmoke {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* --- 3. BORBOLETAS (Batendo Asas + Espalhadas) --- */

.particle-butterfly {
    position: fixed;
    left: 50%;
    top: var(--start-y); /* Altura inicial mais variada */
    /* Removemos font-size, pois agora é uma imagem */
    width: 50px; /* Tamanho base da borboleta */
    height: auto;
    z-index: 999999 !important;
    pointer-events: none;
    will-change: transform;
    
    /* Animação principal: Órbita + Flutuação */
    animation: 
        orbitButterfly var(--duration) linear infinite,
        floatButterfly var(--float-speed) ease-in-out infinite alternate;
    
    /* Filtro opcional: muda a cor da borboleta azul para outras cores aleatoriamente no JS */
    filter: hue-rotate(var(--hue-angle));
}

/* Animação da órbita (Ajustada para não virar de ponta cabeça) */
@keyframes orbitButterfly {
    0% {
        /* Começa na direita, um pouco menor */
        transform: translateX(var(--orbit-radius)) scale(0.8);
        opacity: 0;
    }
    10% { opacity: 1; } 
    25% {
        /* Frente: maior */
        transform: translateX(0) translateY(calc(var(--orbit-radius) / 2)) scale(1.3);
    }
    50% {
        /* Esquerda: tamanho normal */
        transform: translateX(calc(var(--orbit-radius) * -1)) scale(0.8);
    }
    75% {
        /* Fundo: menor e transparente */
        transform: translateX(0) translateY(calc(var(--orbit-radius) / -2)) scale(0.6);
        opacity: 0.7;
    }
    90% { opacity: 1; }
    100% {
        /* Volta ao início */
        transform: translateX(var(--orbit-radius)) scale(0.8);
        opacity: 0;
    }
}

/* Animação secundária: flutuação vertical mais ampla */
@keyframes floatButterfly {
    from { margin-top: -40px; }
    to { margin-top: 40px; }
}

/* 4. CHOQUE (RAIOS/ESTÁTICA) */
.shock-flash {
    background: white; /* Cor do clarão */
    opacity: 0;
    /* 0.2s é a velocidade, '2' é quantas vezes pisca */
    animation: flashBang 0.2s 2; 
    
    /* ADICIONE ISSO SE NÃO ESTIVER FUNCIONANDO: */
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: 999999; /* Garante que fique na frente de tudo */
}

@keyframes flashBang {
    0% { opacity: 0; }
    50% { opacity: 0.9; } /* Aumente para 1.0 se quiser cegar o player */
    100% { opacity: 0; }
}

/* Efeito de Fade */
#sceneImage {
    transition: opacity 1.5s ease-in-out; /* Demora 1.5s para trocar */
    opacity: 1;
}
.fading-out {
    opacity: 0 !important;
}

/* Container do NPC (Fica flutuando no canto ou ocupa a tela) */
.npc-display-container {
    position: fixed;
    bottom: 0;
    right: -10vw; /* Um pouco para fora para não cobrir o chat todo */
    height: 85vh; /* Ocupa 85% da altura da tela! */
    width: auto;
    z-index: 9999;
    pointer-events: none; /* Permite clicar através dele */
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform-origin: bottom center;
    display: flex;
    align-items: flex-end;
}

/* A Imagem do NPC */
.npc-avatar {
    height: 100%; /* A imagem segue a altura do container */
    width: auto; /* A largura se ajusta sozinha */
    max-width: none;
    filter: drop-shadow(0 0 20px rgba(0,0,0,0.5)); /* Sombra para destacar */
    transform-origin: bottom center; /* O pulo começa de baixo */
}

/* A Animação do Pulo */
.npc-pop {
    animation: popJump 0.4s ease-out;
}

@keyframes popJump {
    0% { transform: scale(1) translateY(0); opacity: 1; }
    30% { transform: scale(1.05) translateY(-20px); opacity: 0.8; } /* Sobe e cresce */
    50% { opacity: 0.5; } /* Troca a imagem aqui visualmente */
    60% { transform: scale(0.95) translateY(10px); opacity: 0.8; } /* Desce */
    100% { transform: scale(1) translateY(0); opacity: 1; } /* Estabiliza */
}

/* No celular, diminuímos um pouco */
@media (max-width: 768px) {
    .npc-avatar {
        height: 65vh; 
        right: -20px;
    }
}

/* Força a rolagem em listas de chat */
.chat-list, .message-area, #chatList, #msgArea {
    /* Permite rolar para baixo */
    overflow-y: auto !important; 
    
    /* Faz a rolagem ser suave no iPhone/Android */
    -webkit-overflow-scrolling: touch !important; 
    
    /* IMPORTANTE: Define um limite de altura. 
       Se não tiver limite, ele não cria a barra de rolagem. 
       Ajuste o 70vh para mais ou menos conforme sua tela. */
    max-height: 70vh; 
    height: 70vh;
    
    /* Garante que o toque funcione */
    touch-action: pan-y;
}

/* App Diário */
.diary-subject {
    background: white;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 15px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}
.diary-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-weight: bold;
    color: #2c3e50;
}
.bonus-badge {
    background: #f1c40f;
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
}
.study-row {
    display: flex;
    align-items: center;
    margin-bottom: 5px;
}
.study-label {
    width: 60px;
    font-size: 12px;
    font-weight: bold;
}
.checkbox-group {
    display: flex;
    gap: 5px;
}
.custom-check {
    width: 20px;
    height: 20px;
    border: 2px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: 0.2s;
}
/* Cores das caixinhas */
.check-success.checked { background: #2ecc71; border-color: #2ecc71; }
.check-fail.checked { background: #e74c3c; border-color: #e74c3c; }

/* Ícone de Sanidade na Status Bar */
.sanity-indicator {
    display: flex;
    align-items: center;
    gap: 3px;
    margin-right: 8px;
    font-size: 12px;
    font-weight: bold;
    color: #333;
}
/* --- SPOTTED APP (Visual Instagram) --- */
.spotted-header {
    background: #fff; border-bottom: 1px solid #dbdbdb; padding: 10px;
    display: flex; justify-content: space-between; align-items: center;
    position: sticky; top: 0; z-index: 10;
}
.spotted-logo { font-family: 'Caveat', cursive; font-size: 24px; font-weight: bold; }

/* FEED */
.spotted-post { background: white; margin-bottom: 15px; padding-bottom: 10px; }
.post-header { display: flex; align-items: center; padding: 10px; }
.post-avatar { width: 32px; height: 32px; border-radius: 50%; margin-right: 10px; object-fit: cover; border: 1px solid #eee; }
.post-user { font-weight: bold; font-size: 14px; color: #262626; }
.post-image-container { position: relative; width: 100%; padding-top: 100%; /* Quadrado */ overflow: hidden; background: #fafafa; }
.post-image { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; }

/* Ações e Legenda */
.post-actions { padding: 10px; display: flex; gap: 15px; font-size: 24px; }
.action-btn { cursor: pointer; transition: transform 0.1s; border: none; background: none; padding: 0; }
.action-btn:active { transform: scale(0.9); }
.like-heart.liked { color: #ed4956; } /* Vermelho Instagram */
.post-likes-count { padding: 0 10px; font-weight: bold; font-size: 14px; margin-bottom: 5px; }
.post-caption { padding: 0 10px; font-size: 14px; margin-bottom: 5px; }
.post-comments { padding: 0 10px; color: #8e8e8e; font-size: 13px; }

/* Modal de Coração (Double Tap) */
.big-heart {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%) scale(0);
    color: rgba(255, 255, 255, 0.9); font-size: 80px; pointer-events: none;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.big-heart.animate { transform: translate(-50%, -50%) scale(1.2); }

/* Login/Setup Inicial */
.spotted-setup-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: white; z-index: 100; display: flex; flex-direction: column;
    align-items: center; justify-content: center; padding: 20px;
}

/* Stories Bar (Placeholder) */
.stories-bar {
    display: flex; gap: 15px; padding: 15px; overflow-x: auto;
    border-bottom: 1px solid #efefef; background: #fafafa;
}
.story-circle {
    width: 60px; height: 60px; border-radius: 50%; padding: 2px;
    background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
}
.story-circle img { width: 100%; height: 100%; border-radius: 50%; border: 2px solid white; object-fit:cover; }

/* --- 2. CONTAGEM REGRESSIVA (LOGIN) --- */
/* --- CONTAGEM REGRESSIVA (ESTILO DESTAQUE) --- */
.countdown-box {
    margin-top: 25px;
    text-align: center;
    position: relative;
    z-index: 10;
}

.countdown-label {
    /* Texto "PRÓXIMA SESSÃO" em cor escura para ler no branco */
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 3px;
    color: #555; /* Cinza escuro */
    font-weight: 800;
    margin-bottom: 5px;
}

.countdown-timer {
    /* O visual de "Placa Digital" */
    background: #2c3e50; /* Fundo Azul Escuro */
    color: #f1c40f;      /* Texto Amarelo Ouro (Chama atenção!) */
    
    font-size: 26px;
    font-family: 'Courier New', monospace; /* Fonte estilo digital/hacker */
    font-weight: bold;
    
    padding: 8px 20px;       /* Espaço interno */
    border-radius: 50px;     /* Bordas bem redondas (Pílula) */
    display: inline-block;   /* Ocupa só o espaço necessário */
    
    /* Efeitos de Profundidade */
    border: 2px solid #34495e;
    box-shadow: 0 4px 15px rgba(44, 62, 80, 0.4); /* Sombra suave */
}

/* Animação suave para mostrar que está ativo */
.countdown-timer {
    animation: pulseBorder 2s infinite;
}

@keyframes pulseBorder {
    0% { box-shadow: 0 0 0 0 rgba(241, 196, 15, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(241, 196, 15, 0); }
    100% { box-shadow: 0 0 0 0 rgba(241, 196, 15, 0); }
}
.qty-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #e74c3c; /* Vermelho */
    color: white;
    font-size: 10px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 10px;
    border: 2px solid white; /* Bordinha branca para destacar */
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
/* Botões de Presente na Visita */
.gift-btn {
    border: 2px solid white;
    color: white;
    padding: 10px 15px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 14px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    transition: transform 0.1s;
    display: flex;
    align-items: center;
    gap: 5px;
}
.gift-btn:active {
    transform: scale(0.95);
}