:root {
    font-family:
        Inter, system-ui, -apple-system, BlinkMacSystemFont,
        "Segoe UI", sans-serif;

    color: #16202a;
    background: #eef2f6;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
}

.page-header {
    padding: 36px 24px;
    color: white;
    background:
        linear-gradient(135deg, #173f5f, #20639b);
}

.page-header > div,
.page-layout {
    max-width: 1200px;
    margin: 0 auto;
}

.eyebrow {
    margin: 0 0 6px;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    opacity: 0.8;
}

h1 {
    margin: 0;
    font-size: clamp(2rem, 5vw, 3.5rem);
}

.subtitle {
    max-width: 700px;
    margin-bottom: 0;
    line-height: 1.6;
    opacity: 0.9;
}

.page-layout {
    padding: 24px;
}

.panel {
    margin-bottom: 24px;
    padding: 24px;
    border-radius: 14px;
    background: white;
    box-shadow: 0 8px 24px rgba(22, 32, 42, 0.08);
}

.panel h2 {
    margin-top: 0;
}

.form-grid {
    display: grid;
    grid-template-columns:
        repeat(auto-fit, minmax(210px, 1fr));
    gap: 16px;
}

label {
    display: flex;
    flex-direction: column;
    gap: 7px;
    font-size: 0.9rem;
    font-weight: 650;
}

input,
select,
button {
    font: inherit;
}

input,
select {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid #bec9d4;
    border-radius: 8px;
    background: white;
}

input:focus,
select:focus {
    outline: 3px solid rgba(32, 99, 155, 0.18);
    border-color: #20639b;
}

button {
    margin-top: 22px;
    padding: 13px 18px;
    border: 0;
    border-radius: 9px;
    color: white;
    background: #20639b;
    font-weight: 750;
    cursor: pointer;
}

button:hover {
    background: #173f5f;
}

button:disabled {
    cursor: wait;
    opacity: 0.65;
}

.status {
    margin-top: 18px;
    padding: 12px 14px;
    border-radius: 8px;
}

.status.error {
    color: #8a1c1c;
    background: #fde8e8;
}

.status.info {
    color: #173f5f;
    background: #e5f0f8;
}

.summary-grid {
    display: grid;
    grid-template-columns:
        repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.result-card {
    padding: 18px;
    border-radius: 12px;
    background: white;
    box-shadow: 0 8px 24px rgba(22, 32, 42, 0.08);
}

.result-card span {
    display: block;
    margin-bottom: 8px;
    color: #617080;
    font-size: 0.82rem;
}

.result-card strong {
    font-size: 1.25rem;
}

.chart-container {
    position: relative;
    min-height: 340px;
}

.table-wrapper {
    overflow-x: auto;
}

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

th,
td {
    padding: 11px 12px;
    border-bottom: 1px solid #dbe2e8;
    text-align: right;
    white-space: nowrap;
}

th:first-child,
td:first-child {
    text-align: left;
}

thead {
    background: #f2f6f9;
}

@media (max-width: 600px) {
    .page-layout {
        padding: 14px;
    }

    .panel {
        padding: 18px;
    }

    .chart-container {
        min-height: 280px;
    }
}

.length-mode {
    min-width: 0;
    margin: 0;
    padding: 12px;
    border: 1px solid #bec9d4;
    border-radius: 8px;
}

.length-mode legend {
    padding: 0 5px;
    font-size: 0.9rem;
    font-weight: 650;
}

.radio-option {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    margin: 7px 0;
    font-weight: 500;
}

.radio-option input {
    width: auto;
    margin: 0;
}

#total-length-field small {
    color: #617080;
    font-size: 0.76rem;
    font-weight: 400;
}

input:disabled {
    color: #75818d;
    background: #edf1f4;
    cursor: not-allowed;
}

.page-nav {
    margin-bottom: 18px;
}

.page-nav a {
    color: white;
    font-weight: 700;
    text-decoration: none;
    opacity: 0.9;
}

.page-nav a:hover {
    text-decoration: underline;
    opacity: 1;
}

.classic-tool {
    display: flex;
    gap: 20px;
    align-items: center;
    justify-content: space-between;
    max-width: 900px;
    margin-top: 24px;
    padding: 16px 18px;
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.1);
}

.classic-tool div {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.classic-tool span {
    max-width: 650px;
    line-height: 1.45;
    opacity: 0.9;
}

.classic-tool a {
    flex: 0 0 auto;
    padding: 10px 14px;
    border-radius: 8px;
    color: #173f5f;
    background: white;
    font-weight: 750;
    text-decoration: none;
}

.classic-tool a:hover {
    background: #eef4f8;
}

@media (max-width: 700px) {
    .classic-tool {
        flex-direction: column;
        align-items: flex-start;
    }
}

/*
 * Contenedor específico del corte vertical.
 * El gráfico utiliza todo el ancho disponible manteniendo
 * una proporción aproximada de dos unidades horizontales
 * por una vertical.
 */
.elevation-chart-container {
    width: 100%;
    max-width: 960px;
    min-height: 0;
    aspect-ratio: 2 / 1;
    margin: 0 auto;
}

.elevation-chart-container canvas {
    width: 100% !important;
    height: 100% !important;
}

@media (max-width: 700px) {
    .elevation-chart-container {
        aspect-ratio: 1.35 / 1;
    }
}


/*
 * Los dos patrones de radiación usan la misma superficie visual
 * para facilitar su comparación.
 */
.radiation-chart-container {
    position: relative;
    width: min(100%, 760px);
    height: 430px;
    min-height: 430px;
    margin: 0 auto;
}

.radiation-chart-container canvas {
    width: 100% !important;
    height: 100% !important;
}

@media (max-width: 700px) {
    .radiation-chart-container {
        width: 100%;
        height: 330px;
        min-height: 330px;
    }
}
