:root {
    --legend-none: #99ff99;
    --legend-minor: #f1c86a;
    --legend-moderate: #ed7645;
    --legend-major: #ce2754;
    --legend-extreme: #9f00a6;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, Ubuntu, 'Noto Sans', sans-serif;
    line-height: 1.4;
    color: #111
}

.container {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem
}

.column {
    flex: 1 1 300px;
    min-width: 280px
}

h2 {
    margin: 0.5rem 0 0.25rem
}

h3 {
    margin: 0.25rem 0
}

#updateTime {
    margin: 0.25rem 0 0.5rem;
    color: #444
}

/* Map */
#map {
    width: 100%;
    height: 60vh;
    min-height: 420px;
    border: 1px solid #ccc;
    border-radius: 6px;
    overflow: hidden
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse
}

th, td {
    border: 1px solid #ddd;
    padding: 8px
}

th {
    background: #f7f7f7
}

td.center {
    text-align: center
}

/* Risk legend colors */
.off_season {
    background: #646464;
    color: #fff
}

/* Infographic */
.infographic {
    width: 100%;
    height: auto;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer
}

/* Forecast images */
.forecast img {
    width: 100%;
    height: auto;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    inset: 0;
    background: rgba(0, 0, 0, .9);
    overflow: auto;
    padding: 80px 16px 32px
}

.modal-content {
    display: block;
    margin: 0 auto;
    max-width: 100%;
    height: auto
}

#caption {
    margin: 16px auto 0;
    max-width: 900px;
    color: #ccc;
    font-size: 1.125rem;
    text-align: center
}

.close {
    position: fixed;
    top: 16px;
    right: 24px;
    color: #fff;
    font-size: 40px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer
}

.close:focus, .close:hover {
    color: #bbb;
    outline: none
}

/* Leaflet layer control label */
.layer-control-label {
    font-weight: 600;
    padding: 4px 0 6px
}

/* Small devices */
@media (max-width: 700px) {
    .modal-content {
        width: 100%
    }
}

/* Risk table */
.risk-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed; /* equal day columns */
    overflow: hidden;
    border: 1px solid #ddd;
    border-radius: 8px;
}

.risk-table th,
.risk-table td {
    border-right: 1px solid #ddd;
    border-bottom: 1px solid #ddd;
    padding: 10px;
    vertical-align: middle;
}

.risk-table thead th {
    background: #fff; /* cleaner than grey */
    text-align: center;
    font-weight: 700;
}

.risk-table th.scar {
    text-align: left; /* scar names align left */
    width: 28%; /* consistent first column */
}

.risk-table td {
    text-align: center;
    font-weight: 600;
}

.risk-table tr:last-child td,
.risk-table tr:last-child th {
    border-bottom: 0;
}

.risk-table td:last-child,
.risk-table th:last-child {
    border-right: 0;
}

/* keep your color classes (just ensuring contrast) */
.major, .extreme {
    color: #fff;
}

/* Legend spacing tidy-up */
[aria-label='Daily Flood Risk Legend'] {
    margin-top: .75rem;
}

/* Legend */
.legend {
    border: 1px solid #ddd;
    border-radius: 10px;
    overflow: hidden;
    margin: .75rem 0 0;
    background: #fff;
}

.legend-title {
    text-align: center;
    font-weight: 600;
    padding: .5rem .75rem;
    color: #555;
}

.legend-scale {
    display: flex;
    align-items: stretch;
}

.legend-item {
    flex: 1 1 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: .6rem .25rem;
    font-weight: 700;
    font-style: italic;
    line-height: 1;
}

.legend-item + .legend-item {
    /* faint divider between segments for clarity */
    box-shadow: inset 2px 0 0 rgba(255, 255, 255, .6);
}

/* reuse your existing color classes */
.none {
    background: #99ff99;
    color: #000;
}

.minor {
    background: #f1c86a;
    color: #000;
}

.moderate {
    background: #ed7645;
    color: #000;
}

.major {
    background: #ce2754;
    color: #fff;
}

.extreme {
    background: #9f00a6;
    color: #fff;
}

/* small screens – keep labels readable */
@media (max-width: 420px) {
    .legend-item {
        font-size: .9rem;
        padding: .55rem .2rem;
    }
}