* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: #f4f9ff;
    color: #222;
}

header {
    position: relative;
    padding: 30px;
    color: white;
    text-align: center;
    background: #1e3a5f;
}

.header__back {
    position: absolute;
    top: 50%;
    left: max(20px, calc((100% - 1060px) / 2));
    padding: 10px 15px;
    border: 2px solid #ffd21e;
    border-radius: 999px;
    color: #12345b;
    font-weight: bold;
    text-decoration: none;
    background: #ffd21e;
    transform: translateY(-50%);
}

.header__back:hover { background: #fff1a6; }
.header__back:focus-visible, .page-navigation__back:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }

header h1 {
    margin: 0;
    font-size: 34px;
}

header p {
    margin-top: 8px;
}

main {
    max-width: 1100px;
    margin: 30px auto;
    padding: 0 20px;
}

.card {
    background: white;
    padding: 25px;
    margin-bottom: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

h2 {
    margin-top: 0;
}

.formula {
    font-size: 24px;
    font-weight: bold;
    text-align: center;
}

.campos {
    display: flex;
    gap: 20px;
    margin: 20px 0;
    flex-wrap: wrap;
}

label {
    display: flex;
    flex-direction: column;
    font-weight: bold;
}

input {
    margin-top: 6px;
    padding: 10px;
    width: 150px;
    border: 1px solid #bbb;
    border-radius: 5px;
    font-size: 16px;
}

button {
    padding: 12px 25px;
    border: none;
    border-radius: 6px;
    background: #1e3a5f;
    color: white;
    font-size: 16px;
    cursor: pointer;
}

button:hover {
    background: #152a45;
}

.resultados div {
    padding: 7px 0;
    font-size: 17px;
}

.grafico {
    height: 500px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 10px;
    border-bottom: 1px solid #ddd;
    text-align: center;
}

th {
    background: #f0f2f5;
}

footer {
    text-align: center;
    padding: 25px;
    color: #666;
}

.page-navigation {
    display: flex;
    justify-content: center;
    padding: 4px 0 18px;
}

.page-navigation__back {
    display: inline-block;
    padding: 12px 20px;
    border: 2px solid #1e3a5f;
    border-radius: 999px;
    color: #1e3a5f;
    font-weight: bold;
    text-decoration: none;
    background: #fff;
    transition: background 0.2s ease, transform 0.2s ease;
}

.page-navigation__back:hover {
    transform: translateY(-2px);
    background: #ffd21e;
}

/* =========================================================
   PÁGINA INICIAL
   ========================================================= */

.home-card {
    padding: 35px;
}

.home-card > h2 {
    text-align: center;
    font-size: 30px;
    margin-bottom: 10px;
}

.home-intro {
    text-align: center;
    max-width: 700px;
    margin: 0 auto 35px;
    line-height: 1.6;
    color: #555;
}

.menu-matematica {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 25px;
}

.menu-card {
    position: relative;
    display: block;
    padding: 30px;
    border: 1px solid #d9dee7;
    border-radius: 12px;
    background: #fff;
    color: #222;
    text-decoration: none;
    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease,
        border-color 0.2s ease;
}

.menu-card:hover {
    transform: translateY(-5px);
    border-color: #1e3a5f;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.menu-numero {
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1e3a5f;
    color: #fff;
    border-radius: 10px;
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 20px;
}

.menu-card h3 {
    margin: 0;
    font-size: 24px;
}

.menu-formula {
    margin: 22px 0;
    padding: 16px;
    background: #f4f6f9;
    border-radius: 8px;
    text-align: center;
    font-size: 22px;
    font-weight: bold;
}

.menu-card p {
    min-height: 75px;
    line-height: 1.6;
    color: #555;
}

.menu-botao {
    display: inline-block;
    margin-top: 15px;
    padding: 11px 20px;
    background: #1e3a5f;
    color: #fff;
    border-radius: 6px;
    font-weight: 500;
}

.menu-card:hover .menu-botao {
    background: #294f7d;
}

footer {
    text-align: center;
    padding: 30px;
    color: #666;
}

@media (max-width: 700px) {

    header {
        padding: 20px 16px 24px;
    }

    .header__back {
        position: static;
        display: inline-block;
        margin-bottom: 18px;
        transform: none;
    }

    .menu-matematica {
        grid-template-columns: 1fr;
    }

    .home-card {
        padding: 20px;
    }

    .menu-card p {
        min-height: auto;
    }
}
