/* Reset básico */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea, #764ba2);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    color: #333;
    line-height: 1.5;
    transition: background 0.5s;
}

/* Container principal */
.container {
    background: #fff;
    padding: 40px 30px;
    border-radius: 25px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.25);
    width: 420px;
    max-width: 95%;
    text-align: center;
    transition: all 0.3s ease;
}

.container:hover {
    transform: translateY(-5px);
    box-shadow: 0 25px 50px rgba(0,0,0,0.35);
}

h2 {
    font-size: 2rem;
    margin-bottom: 25px;
    color: #333;
}

/* Mensagem de erro */
.erro {
    color: #d9534f;
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 15px;
    transition: opacity 0.5s;
}

/* Input */
input[type="number"] {
    width: 100%;
    padding: 16px;
    margin-bottom: 20px;
    border-radius: 12px;
    border: 1px solid #ccc;
    font-size: 1.05rem;
    background: #fefefe;
    transition: border 0.3s, box-shadow 0.3s;
}

input[type="number"]:focus {
    border-color: #764ba2;
    outline: none;
    box-shadow: 0 0 15px rgba(118, 75, 162, 0.3);
}

/* Botões */
button {
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s, transform 0.2s, box-shadow 0.2s;
    margin-top: 10px;
    color: white;
}

button:active {
    transform: scale(0.98);
}

/* Botões diferenciados */
.btn-primario {
    background: linear-gradient(135deg,#764ba2,#5e3790);
}
.btn-primario:hover {
    background: linear-gradient(135deg,#5e3790,#4a2e7f);
    transform: scale(1.03);
    box-shadow: 0 6px 18px rgba(0,0,0,0.25);
}

.btn-secundario {
    background: linear-gradient(135deg,#667eea,#4a5bd1);
}
.btn-secundario:hover {
    background: linear-gradient(135deg,#4a5bd1,#3c4fae);
    transform: scale(1.03);
    box-shadow: 0 6px 18px rgba(0,0,0,0.25);
}

.btn-perigo {
    background: linear-gradient(135deg,#d9534f,#b52b27);
}
.btn-perigo:hover {
    background: linear-gradient(135deg,#b52b27,#93201f);
    transform: scale(1.03);
    box-shadow: 0 6px 18px rgba(0,0,0,0.25);
}

/* Resultado */
.resultado {
    margin-top: 30px;
    background: #f9f9ff;
    padding: 25px;
    border-radius: 18px;
    text-align: left;
    box-shadow: inset 0 0 15px rgba(0,0,0,0.05);
    font-size: 1.05rem;
    transition: all 0.5s ease, opacity 0.5s ease;
}

.resultado p {
    margin: 12px 0;
}

.resultado strong {
    font-size: 1.25rem;
    color: #764ba2;
}

/* Canvas do gráfico */
canvas#grafico {
    margin-top: 25px;
    border-radius: 15px;
    background: #fff;
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
    padding: 15px;
    transition: all 0.5s ease;
    max-width: 100%;
    height: auto;
}

/* Histórico */
.historico {
    margin-top: 30px;
    text-align: left;
    background: #f5f5ff;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.05);
    overflow-x: hidden;
}

.historico h3 {
    margin-bottom: 12px;
    color: #333;
}

.historico ul {
    list-style: none;
    max-height: 160px;
    overflow-y: auto;
    padding-left: 10px;
}

.historico li {
    padding: 8px 6px;
    border-bottom: 1px solid #ccc;
    font-size: 0.95rem;
    transition: background 0.3s, transform 0.2s;
}

.historico li:hover {
    background: #e2e2ff;
    transform: translateX(2px);
}

.historico li:last-child {
    background: #e8e8ff;
    border-radius: 5px;
    padding: 8px;
    font-weight: bold;
}

/* Scrollbar estilizada */
.historico ul::-webkit-scrollbar {
    width: 8px;
}
.historico ul::-webkit-scrollbar-thumb {
    background: #764ba2;
    border-radius: 10px;
}

/* Responsividade */
@media (max-width: 450px) {
    .container {
        padding: 30px 20px;
    }

    h2 {
        font-size: 1.6rem;
    }

    button {
        font-size: 1rem;
        padding: 14px;
    }

    .resultado {
        font-size: 1rem;
    }

    canvas#grafico {
        height: 180px;
    }
}

/* Ocultar elementos */
.hidden {
    display: none !important;
}
