/* --- CONFIGURAÇÃO GERAL E VARIÁVEIS --- */
:root {
    --bg-color: #f8f9fa;
    --text-color: #212529;
    --primary-color: #007bff;
    --primary-hover: #0056b3;
    --border-color: #dee2e6;
    --glitch-color1: #ff00c1;
    --glitch-color2: #00ffff;
}

body {
    margin: 0;
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
    transition: background-color 0.5s ease;
}

.background-text {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 15vw;
    color: rgba(0, 0, 0, 0.03);
    font-weight: 700;
    z-index: -1;
    user-select: none;
    text-transform: uppercase;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 1s ease;
}

/* --- ESTILOS DAS TELAS --- */
.screen {
    width: 100%;
    max-width: 800px;
    padding: 20px;
    box-sizing: border-box;
    text-align: center;
}

#start-screen img {
    max-width: 100px;
    margin-bottom: 20px;
}

#question-screen, #cake-screen {
    display: none;
}

h1, h2, h3 {
    margin: 0 0 20px 0;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 1.8rem; }
p { font-size: 1.1rem; line-height: 1.6; }

.button {
    display: inline-block;
    padding: 15px 30px;
    font-size: 1.2rem;
    font-weight: 700;
    color: white;
    background-color: var(--primary-color);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
    text-decoration: none;
}

.button:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
}

/* --- ESTILOS DAS PERGUNTAS --- */
#question-container {
    min-height: 300px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}
#question-container canvas {
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
}


.options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-top: 20px;
    width: 100%;
    max-width: 600px;
}

.option-btn {
    padding: 20px;
    font-size: 1rem;
    background-color: white;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s, border-color 0.3s;
}

.option-btn:hover {
    background-color: #e9ecef;
    border-color: var(--primary-color);
}

.image-option {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    border: 3px solid transparent;
    transition: border-color 0.3s, transform 0.2s;
}

.image-option:hover {
    border-color: var(--primary-color);
    transform: scale(1.05);
}

.text-input {
    width: 80%;
    max-width: 400px;
    padding: 15px;
    font-size: 1.2rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    text-align: center;
    margin-top: 20px;
}

.progress-bar-container {
    width: 100%;
    height: 10px;
    background-color: #e9ecef;
    border-radius: 5px;
    margin-top: 30px;
    overflow: hidden;
}

#progress-bar {
    width: 0%;
    height: 100%;
    background-color: var(--primary-color);
    transition: width 0.5s ease;
}

.observer-text {
    margin-top: 20px;
    min-height: 25px;
    color: #6c757d;
    font-style: italic;
    transition: color 0.5s;
}


/* --- EFEITOS DE GLITCH E HORROR --- */
@keyframes glitch-anim {
    0% { transform: translate(0); }
    20% { transform: translate(-3px, 3px); }
    40% { transform: translate(-3px, -3px); }
    60% { transform: translate(3px, 3px); }
    80% { transform: translate(3px, -3px); }
    to { transform: translate(0); }
}

@keyframes glitch-skew {
    0% { transform: skew(0deg); }
    25% { transform: skew(0.5deg, -0.5deg); }
    50% { transform: skew(-0.8deg, 0.2deg); }
    75% { transform: skew(0.2deg, 0.8deg); }
    100% { transform: skew(0deg); }
}

.glitch {
    position: relative;
    animation: glitch-skew 150ms infinite;
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-color);
    overflow: hidden;
    clip: rect(0, 900px, 0, 0);
}

.glitch::before {
    left: 2px;
    text-shadow: -1px 0 var(--glitch-color1);
    animation: glitch-anim 1.5s infinite linear alternate-reverse;
}

.glitch::after {
    left: -2px;
    text-shadow: -1px 0 var(--glitch-color2), 1px 1px var(--glitch-color2);
    animation: glitch-anim 2.5s infinite linear alternate;
}

.body-shake {
    animation: glitch-skew 80ms infinite linear;
}

.final-crash {
    animation: glitch-anim 50ms infinite, glitch-skew 50ms infinite;
}


/* --- TELA DO BOLO --- */
#cake-screen {
    --happy-bg: #ffdeea;
    --happy-text: #d6336c;
    --happy-primary: #f06595;
    background-color: var(--happy-bg);
    color: var(--happy-text);
    font-family: 'Bungee', cursive;
}

#cake-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
}

#cake-dropzone {
    position: relative;
    width: 300px;
    height: 300px;
    /* VISÃO DE CIMA DO BOLO */
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="50" cy="50" r="45" fill="%23f3d9b1" stroke="%23c7a783" stroke-width="3"/><circle cx="50" cy="50" r="40" fill="%23fff0f5"/></svg>');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    border-radius: 50%; /* Faz a área de drop ser circular */
}

#cake-dropzone p {
    color: var(--happy-primary);
    opacity: 0.5;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

#toppings-box {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
    flex-wrap: wrap;
    background: rgba(255, 255, 255, 0.7);
    padding: 15px;
    border-radius: 10px;
    -webkit-user-select: none; /* Safari */
    -ms-user-select: none; /* IE 10+ */
    user-select: none; /* Standard */
}

.topping {
    width: 50px;
    height: 50px;
    cursor: grab;
    transition: transform 0.2s;
}

.topping:active {
    cursor: grabbing;
    transform: scale(1.2);
    z-index: 1001;
}

/* Estilo para o clone do item sendo arrastado no mobile */
.topping-clone {
    position: fixed;
    opacity: 0.8;
    pointer-events: none;
    z-index: 9999;
}

#confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 1000;
    pointer-events: none;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    background-color: #f06595;
    opacity: 0;
    animation: fall 5s linear infinite;
}

@keyframes fall {
    0% { transform: translateY(-10vh) rotate(0deg); opacity: 1; }
    100% { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}

/* --- RESPONSIVIDADE --- */
@media (max-width: 600px) {
    h1 { font-size: 2rem; }
    h2 { font-size: 1.5rem; }
    
    .options-grid {
        grid-template-columns: 1fr;
    }
    
    .button {
        padding: 12px 24px;
        font-size: 1rem;
    }
}