body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #f4f7f6;
    color: #333;
    margin: 0;
    padding: 15px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
}

main {
    width: 100%;
    max-width: 1200px;
    margin: 20px auto;
    padding: 25px;
    background-color: #ffffff;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

h1 {
    color: #1a1a1a;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 10px;
    margin-top: 0;
}

h2 {
    margin-top: 25px;
    margin-bottom: 10px;
    color: #1a1a1a;
}

p.intro {
    margin-top: 10px;
    margin-bottom: 20px;
    color: #555;
}

/* Controls */
.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
    align-items: center;
}

.controls label {
    font-size: 0.95em;
    color: #555;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.controls select {
    font-size: 1em;
    padding: 8px 12px;
    border-radius: 5px;
    border: 1px solid #ccc;
    background-color: #e9e9eb;
    color: #333;
}

.travel-controls button {
    font-size: 1em;
    padding: 8px 14px;
    border-radius: 5px;
    border: none;
    background-color: #007aff;
    color: #fff;
    cursor: pointer;
}

.travel-controls button:hover {
    background-color: #0056b3;
}

#loading {
    text-align: center;
    font-size: 1.1em;
    color: #555;
    padding: 20px 0;
    display: none;
}

/* Summary grid (corridor + detail) */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 15px;
    background-color: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.summary-item {
    text-align: center;
}

.summary-item.full-width {
    grid-column: 1 / -1;
}

.summary-item .value {
    font-size: 1.8em;
    font-weight: 600;
    color: #111;
    line-height: 1.2;
}

.summary-item .label {
    font-size: 0.9em;
    color: #555;
    margin-top: 4px;
}

.summary-item .value .unit {
    font-size: 0.6em;
    font-weight: 500;
    color: #333;
}

/* Confidence Gauge */
.confidence-gauge {
    background-color: #e9ecef;
    border-radius: 8px;
    height: 35px;
    position: relative;
    overflow: hidden;
    border: 1px solid #ddd;
}

.confidence-bar {
    height: 100%;
    background-color: #34c759;
    border-radius: 7px;
    transition: width 0.5s ease-out;
    box-shadow: inset 0 -2px 4px rgba(0,0,0,0.1);
}

.confidence-label {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: #111;
    font-size: 1.05em;
    text-shadow: 0 1px 1px rgba(255,255,255,0.7);
}

/* I-95 matrix */
.matrix-wrapper {
    width: 100%;
    overflow-x: auto;
}

table#i95-matrix {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85em;
    min-width: 700px;
}

#i95-matrix thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background-color: #f9f9f9;
    border-bottom: 2px solid #ddd;
    padding: 6px 8px;
    text-align: center;
}

#i95-matrix th.location-col {
    text-align: left;
    min-width: 150px;
}

#i95-matrix tbody th {
    text-align: left;
    padding: 6px 8px;
    border-bottom: 1px solid #eee;
    background-color: #fafafa;
    position: sticky;
    left: 0;
    z-index: 1;
}

#i95-matrix td {
    border-bottom: 1px solid #eee;
    border-right: 1px solid #f2f2f2;
    padding: 4px 4px;
    text-align: center;
    cursor: pointer;
    min-width: 70px;
}

#i95-matrix td:last-child {
    border-right: none;
}

#i95-matrix tr:last-child td {
    border-bottom: none;
}

#i95-matrix td .cell-chance {
    font-weight: 600;
    font-size: 0.8em;
    margin-bottom: 2px;
}

#i95-matrix td .cell-mean {
    font-size: 0.8em;
}

#i95-matrix td.no-data {
    color: #aaa;
    cursor: default;
}

/* Heatmap classes reused for both matrix + detail calendar */
.snow-light  { background-color: #e6f7ff; }
.snow-medium { background-color: #b3e0ff; }
.snow-major  { background-color: #80cfff; }
.snow-heavy  { background-color: #4da6ff; color: #fff; }

.day-alert {
    box-shadow: inset 0 0 0 2px #d90000;
}

/* Detail section (calendar) */
.forecast-title {
    font-size: 1.4em;
    font-weight: 600;
    color: #111;
    margin-top: 25px;
    margin-bottom: 15px;
    text-align: left;
}

#calendar-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
    margin-bottom: 5px;
}

.header-cell {
    font-weight: 600;
    color: #555;
    font-size: 0.9em;
    text-align: center;
    padding: 8px;
    background-color: #f9f9f9;
    border-radius: 4px;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 5px;
    background-color: #fdfdfd;
    min-height: 200px;
}

.calendar-day {
    border: 1px solid #eee;
    border-radius: 5px;
    background-color: #fff;
    padding: 8px;
    min-height: 150px;
    display: flex;
    flex-direction: column;
    transition: all 0.2s ease-in-out;
}

.calendar-day.empty {
    background-color: #f9f9f9;
    border-color: #f0f0f0;
}

.day-header {
    font-weight: 600;
    color: #111;
    font-size: 0.95em;
    text-align: right;
    padding-bottom: 4px;
    border-bottom: 1px solid #f0f0f0;
}

.day-header .day-name {
    display: none;
}

.day-content {
    padding-top: 8px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.ensemble-data {
    background-color: rgba(255, 255, 255, 0.6);
    border-radius: 4px;
    padding: 8px 6px;
}

.chance,
.mean-amount,
.max-amount {
    font-weight: 600;
    display: block;
    margin-bottom: 5px;
}

.chance:last-child,
.mean-amount:last-child,
.max-amount:last-child {
    margin-bottom: 0;
}

.chance {
    color: #007aff;
    font-size: 1.1em;
}

.mean-amount {
    color: #ff9500;
    font-size: 1.0em;
}

.max-amount {
    color: #34c759;
    font-size: 1.0em;
}

.no-snow {
    color: #666;
    font-weight: 400;
    opacity: 0.8;
}

.models-list {
    margin: 8px 0 0 0;
    padding: 8px 0 0 0;
    list-style: none;
    font-size: 0.8em;
    color: #333;
    border-top: 1px dashed #bbb;
    font-style: normal;
}

.models-list li {
    margin-bottom: 2px;
}

.no-snow-message {
    padding: 40px 20px;
    text-align: center;
    font-size: 1.1em;
    color: #777;
    grid-column: 1 / -1;
}

.note {
    font-size: 0.85em;
    color: #666;
    padding: 15px;
    line-height: 1.6;
    background-color: #f9f9f9;
    border-top: 1px solid #eee;
    margin-top: 15px;
    border-radius: 5px;
}

/* --- Horizontal risk strip variant --- */
.risk-map-horizontal .risk-map-wrapper {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  overflow-x: auto;
  max-width: 100%;
}

.risk-inline-stop {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 60px; /* keeps labels from overlapping */
}

.risk-inline-stop .risk-stop-node {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #555;
}

.risk-inline-stop .risk-stop-label {
  font-size: 0.8em;
  color: #333;
  white-space: nowrap;
}

.risk-segment-inline {
  height: 10px;
  width: 64px;        /* segment length; tweak as you like */
  border-radius: 5px;
  flex: 0 0 auto;
}

/* make it a bit tighter on small screens */
@media (max-width: 600px) {
  .risk-inline-stop { min-width: 52px; }
  .risk-segment-inline { width: 52px; }
  .risk-inline-stop .risk-stop-label { font-size: 0.75em; }
}


/* Risk strip map */
.risk-map-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    font-size: 0.95em;
}

.risk-map-controls button {
    padding: 6px 10px;
    border-radius: 4px;
    border: none;
    background-color: #007aff;
    color: #fff;
    cursor: pointer;
    font-size: 0.9em;
}

.risk-map-controls button:hover {
    background-color: #0056b3;
}

#risk-day-label {
    font-weight: 600;
    color: #333;
}

.risk-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 0.85em;
    color: #555;
    margin-bottom: 10px;
}

.risk-legend span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.risk-color {
    display: inline-block;
    width: 14px;
    height: 10px;
    border-radius: 3px;
    border: 1px solid rgba(0,0,0,0.1);
}

/* Color classes reused by legend + segments */
.risk-green  { background-color: #28a745; }
.risk-yellow { background-color: #ffc107; }
.risk-red    { background-color: #dc3545; }
.risk-purple { background-color: #6f42c1; }

.risk-map-wrapper {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 10px 0;
}

.risk-stop-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.risk-stop-node {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #555;
}

.risk-stop-label {
    font-size: 0.9em;
    color: #333;
}

.risk-segment {
    width: 10px;
    height: 40px;
    border-radius: 4px;
    margin: 2px 0 2px 0;
    background-color: #28a745; /* default, overridden by risk-* classes */
}


#travel-and-map {
    display: block;
    margin-top: 10px;
}

@media (min-width: 900px) {
    #travel-and-map {
        display: grid;
        grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.3fr);
        gap: 20px;
        align-items: flex-start;
    }

    #travel-helper,
    #risk-map-section {
        margin-top: 0;
    }
}

/* Mobile tweak: center the strip a bit more */
@media (max-width: 800px) {
    .risk-map-wrapper {
        align-items: center;
    }
}


/* Mobile */
@media (max-width: 800px) {
    body {
        padding: 0;
    }

    main {
        padding: 15px;
        margin: 0;
        box-shadow: none;
        border-radius: 0;
    }

    .summary-grid {
        grid-template-columns: 1fr 1fr;
        padding: 15px;
    }

    .summary-item.full-width {
        grid-column: 1 / -1;
    }

    .summary-item .value {
        font-size: 1.5em;
    }

    #calendar-header {
        display: none;
    }

    .calendar-grid {
        grid-template-columns: 1fr;
        gap: 10px;
        border: none;
        padding: 0;
        background-color: transparent;
    }

    .calendar-day.empty {
        display: none;
    }

    .calendar-day {
        min-height: auto;
    }

    .day-header {
        text-align: left;
        font-size: 1.1em;
        border-bottom: none;
        padding-bottom: 0;
        display: flex;
        justify-content: space-between;
        width: 100%;
    }

    .day-header .day-name {
        display: inline;
        font-weight: 600;
    }

    .day-header .day-num {
        display: inline;
        font-weight: 400;
        color: #555;
    }

    .day-content {
        flex-direction: column-reverse;
        justify-content: flex-end;
    }

