:root {
    --bg: #080b12;
    --bg-secondary: #101622;
    --card: rgba(20, 27, 39, 0.96);
    --card-soft: rgba(27, 36, 52, 0.72);

    --border: #29364a;
    --border-hover: #3d5270;
    --text: #f1f5f9;
    --text-soft: #a7b4c7;
    --text-muted: #718096;

    --primary: #55d6be;
    --primary-dark: #189b91;
    --primary-glow: rgba(85, 214, 190, 0.25);

    --blue: #70a7ff;
    --yellow: #f2c66d;
    --red: #ff7b8b;

    --heading-font: Georgia, "Times New Roman", serif;

    --body-font:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        "Helvetica Neue",
        Arial,
        sans-serif;

    --radius-small: 8px;
    --radius-medium: 14px;
    --radius-large: 22px;

    --shadow-card:
        0 24px 80px rgba(0, 0, 0, 0.45),
        0 0 0 1px rgba(255, 255, 255, 0.02);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    color-scheme: dark;
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    margin: 0;

    background:
        radial-gradient(
            circle at 10% 0%,
            rgba(36, 93, 130, 0.28),
            transparent 34%
        ),
        radial-gradient(
            circle at 95% 95%,
            rgba(28, 110, 103, 0.2),
            transparent 30%
        ),
        var(--bg);

    color: var(--text);
    font-family: var(--body-font);
    line-height: 1.6;
}

button,
input {
    font: inherit;
}

a {
    color: inherit;
}


/* =========================================================
   Estructura principal
   ========================================================= */

.page-wrapper {
    width: 100%;
    min-height: 100vh;
    padding: 40px 18px;
}

.main-card {
    width: min(1120px, 100%);
    margin: 0 auto;
    padding: clamp(24px, 5vw, 56px);

    background:
        linear-gradient(
            145deg,
            rgba(35, 49, 70, 0.72),
            rgba(17, 23, 34, 0.96)
        );

    border: 1px solid var(--border);
    border-radius: var(--radius-large);
    box-shadow: var(--shadow-card);

    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}


/* =========================================================
   Encabezado
   ========================================================= */

.page-header {
    max-width: 760px;
    margin: 0 auto 32px;
    text-align: center;
}

.brand-icon {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 54px;
    height: 54px;
    margin: 0 auto 20px;

    background: linear-gradient(
        135deg,
        var(--primary),
        var(--primary-dark)
    );

    border-radius: 50%;
    box-shadow: 0 0 30px var(--primary-glow);

    color: #062d2c;
    font-family: Georgia, serif;
    font-size: 2.2rem;
    font-weight: bold;
}

.eyebrow {
    margin: 0 0 12px;

    color: var(--primary);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

h1,
h2 {
    font-family: var(--heading-font);
    font-weight: 700;
}

h1 {
    margin: 0 0 16px;

    color: var(--text);
    font-size: clamp(2rem, 5vw, 3.4rem);
    line-height: 1.12;
}

.intro {
    max-width: 650px;
    margin: 0 auto;

    color: var(--text-soft);
    font-size: 1.05rem;
    line-height: 1.7;
}


/* =========================================================
   Mensajes informativos
   ========================================================= */

.notice,
.alert {
    max-width: 820px;
    margin: 0 auto 28px;
    padding: 15px 18px;

    border-radius: var(--radius-small);
    font-size: 0.92rem;
    line-height: 1.55;
}

.notice {
    background: rgba(242, 198, 109, 0.1);
    border: 1px solid rgba(242, 198, 109, 0.42);
    color: #f7d99a;
}

.alert-error {
    background: rgba(255, 123, 139, 0.1);
    border: 1px solid rgba(255, 123, 139, 0.5);
    color: #ffabb5;
}


/* =========================================================
   Secciones
   ========================================================= */

.form-section,
.ranges-section {
    margin-top: 36px;
}

.section-heading {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 22px;
}

.section-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-width: 46px;
    height: 30px;
    padding: 0 10px;

    background: rgba(85, 214, 190, 0.1);
    border: 1px solid rgba(85, 214, 190, 0.28);
    border-radius: 999px;

    color: var(--primary);
    font-size: 0.75rem;
    font-weight: bold;
    letter-spacing: 0.08em;
}

.section-heading h2 {
    margin: 0 0 3px;

    color: var(--text);
    font-size: 1.5rem;
    line-height: 1.25;
}

.section-heading p {
    margin: 0;

    color: var(--text-muted);
    font-size: 0.9rem;
}


/* =========================================================
   Formulario
   ========================================================= */

.prediction-form {
    margin: 0;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.input-group {
    padding: 18px;

    background: rgba(10, 15, 24, 0.55);
    border: 1px solid var(--border);
    border-radius: var(--radius-medium);

    transition:
        border-color 0.2s ease,
        background-color 0.2s ease,
        transform 0.2s ease;
}

.input-group:hover {
    background: rgba(28, 39, 56, 0.7);
    border-color: var(--border-hover);
    transform: translateY(-2px);
}

.input-group label {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 9px;

    color: var(--text);
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.4;
}

.input-group label span {
    color: var(--primary);
    font-size: 0.78rem;
    font-weight: 500;
    white-space: nowrap;
}

.input-group input {
    display: block;
    width: 100%;
    height: 46px;
    padding: 10px 12px;

    background: rgba(5, 9, 16, 0.72);
    border: 1px solid var(--border);
    border-radius: var(--radius-small);
    outline: none;

    color: var(--text);
    font-size: 1rem;

    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        background-color 0.2s ease;
}

.input-group input::placeholder {
    color: var(--text-muted);
}

.input-group input:hover {
    background: rgba(8, 14, 23, 0.9);
}

.input-group input:focus {
    background: rgba(8, 14, 23, 0.96);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.input-group input:invalid:not(:placeholder-shown) {
    border-color: var(--red);
}

.input-group small {
    display: block;
    min-height: 38px;
    margin-top: 9px;

    color: var(--text-muted);
    font-size: 0.78rem;
    line-height: 1.45;
}


/* =========================================================
   Botón
   ========================================================= */

.submit-button {
    display: flex;
    align-items: center;
    justify-content: space-between;

    width: 100%;
    margin-top: 28px;
    padding: 15px 20px;

    background: linear-gradient(
        135deg,
        var(--primary),
        var(--primary-dark)
    );

    border: 0;
    border-radius: var(--radius-small);
    box-shadow: 0 10px 26px var(--primary-glow);

    color: #062d2c;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 800;

    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease,
        filter 0.2s ease;
}

.submit-button:hover {
    box-shadow: 0 14px 32px rgba(85, 214, 190, 0.36);
    filter: brightness(1.08);
    transform: translateY(-2px);
}

.submit-button:active {
    transform: translateY(0);
}

.submit-button:focus-visible {
    outline: 3px solid rgba(112, 167, 255, 0.6);
    outline-offset: 3px;
}

.arrow {
    font-size: 1.35rem;
}


/* =========================================================
   Tabla de rangos
   ========================================================= */

.ranges-section {
    padding-top: 12px;
}

.table-wrapper {
    overflow-x: auto;

    border: 1px solid var(--border);
    border-radius: var(--radius-medium);
}

.ranges-table {
    width: 100%;
    min-width: 700px;
    border-collapse: collapse;

    background: rgba(8, 12, 19, 0.62);
    font-size: 0.88rem;
}

.ranges-table th,
.ranges-table td {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(41, 54, 74, 0.7);
    text-align: left;
    vertical-align: top;
}

.ranges-table th {
    background: rgba(85, 214, 190, 0.1);

    color: var(--primary);
    font-size: 0.76rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.ranges-table td {
    color: var(--text-soft);
}

.ranges-table td:first-child {
    color: var(--text);
    font-weight: 700;
}

.ranges-table td:nth-child(2) {
    color: var(--blue);
    font-weight: 700;
    white-space: nowrap;
}

.ranges-table tr:last-child td {
    border-bottom: 0;
}

.ranges-table tbody tr {
    transition: background-color 0.2s ease;
}

.ranges-table tbody tr:hover {
    background: rgba(112, 167, 255, 0.06);
}


/* =========================================================
   Pie de página
   ========================================================= */

.page-footer {
    margin-top: 34px;
    padding-top: 20px;

    border-top: 1px solid var(--border);
    text-align: center;
}

.page-footer p {
    margin: 0;

    color: var(--text-muted);
    font-size: 0.82rem;
    line-height: 1.55;
}


/* =========================================================
   Diseño responsivo
   ========================================================= */

@media (max-width: 760px) {
    .page-wrapper {
        padding: 20px 10px;
    }

    .main-card {
        padding: 26px 18px;
        border-radius: var(--radius-medium);
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .input-group small {
        min-height: auto;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 2.1rem;
    }

    .intro {
        font-size: 0.96rem;
    }

    .section-heading h2 {
        font-size: 1.3rem;
    }

    .input-group label {
        align-items: flex-start;
        flex-direction: column;
        gap: 4px;
    }

    .input-group label span {
        white-space: normal;
    }

    .submit-button {
        min-height: 52px;
    }
}


/* =========================================================
   Accesibilidad
   ========================================================= */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}

/* =========================================================
   Página de resultados
   ========================================================= */

.result-page-card {
    max-width: 820px;
}

.result-icon {
    background: linear-gradient(
        135deg,
        var(--blue),
        #536dfe
    );

    color: #071326;
}

.prediction-result {
    max-width: 760px;
    margin: 34px auto 0;
}

.result-status {
    display: flex;
    align-items: flex-start;
    gap: 20px;

    padding: 28px;
    border-radius: var(--radius-medium);
}

.result-status-risk {
    background: rgba(255, 123, 139, 0.1);
    border: 1px solid rgba(255, 123, 139, 0.48);
}

.result-status-normal {
    background: rgba(85, 214, 190, 0.1);
    border: 1px solid rgba(85, 214, 190, 0.42);
}

.status-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;

    width: 48px;
    height: 48px;

    border-radius: 50%;

    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.8rem;
    font-weight: bold;
}

.result-status-risk .status-icon {
    background: rgba(255, 123, 139, 0.18);
    color: var(--red);
}

.result-status-normal .status-icon {
    background: rgba(85, 214, 190, 0.18);
    color: var(--primary);
}

.result-label {
    margin: 0 0 7px;

    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.result-status h2 {
    margin: 0 0 12px;

    color: var(--text);
    font-family: var(--heading-font);
    font-size: clamp(1.45rem, 4vw, 2.1rem);
    line-height: 1.25;
}

.result-message {
    max-width: 570px;
    margin: 0;

    color: var(--text-soft);
    font-size: 0.98rem;
    line-height: 1.65;
}

.result-actions {
    max-width: 760px;
    margin: 24px auto 0;
}

.result-button {
    display: flex;
    align-items: center;
    justify-content: space-between;

    width: 100%;

    color: #062d2c;
    text-decoration: none;
}

.result-button:hover {
    color: #062d2c;
    text-decoration: none;
}

.result-notice {
    max-width: 760px;
    margin: 28px auto 0;
}

@media (max-width: 600px) {
    .result-status {
        align-items: center;
        flex-direction: column;
        padding: 22px 18px;
        text-align: center;
    }

    .result-message {
        font-size: 0.92rem;
    }

    .result-actions {
        margin-top: 20px;
    }
}