* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #120a06 url('zion-narrows.jpg') center / cover no-repeat fixed;
    color: #ede0d4;
    line-height: 1.5;
    min-height: 100vh;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 0;
    background: rgba(18, 10, 6, 0.55);
    pointer-events: none;
}

/* Header */
header {
    position: relative;
    z-index: 1;
    background: linear-gradient(135deg, rgba(28, 25, 23, 0.8) 0%, rgba(18, 10, 6, 0.8) 100%);
    border-bottom: 1px solid rgba(196, 149, 106, 0.1);
    padding: 1.5rem 1rem 1.25rem;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.header-content {
    max-width: 640px;
    margin: 0 auto;
    text-align: center;
}

.header-icon {
    color: #c4956a;
    margin-bottom: 0.5rem;
}

header h1 {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #ede0d4;
}

.subtitle {
    font-size: 0.8rem;
    color: #8b7355;
    margin-top: 0.15rem;
    font-weight: 500;
}

/* Main */
main {
    position: relative;
    z-index: 1;
    max-width: 640px;
    margin: 0 auto;
    padding: 0.75rem;
}

/* Loading */
.loading {
    text-align: center;
    padding: 4rem 1rem;
    color: #8b7355;
}

.loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(28, 25, 23, 0.75);
    border-top-color: #c4956a;
    border-radius: 50%;
    margin: 0 auto 1rem;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Status badge */
.status-card {
    background: rgba(48, 40, 35, 0.55);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(196, 149, 106, 0.1);
    border-radius: 16px;
    padding: 1.75rem 1.5rem;
    text-align: center;
    margin-bottom: 0.75rem;
    position: relative;
    overflow: hidden;
    color: #ede0d4;
}

.status-label {
    font-size: 2.25rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
}

.status-label::before {
    content: "";
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-card.great .status-label::before { background: #22c55e; box-shadow: 0 0 8px #22c55e; }
.status-card.good .status-label::before { background: #86efac; box-shadow: 0 0 8px #86efac; }
.status-card.fair .status-label::before { background: #eab308; box-shadow: 0 0 8px #eab308; }
.status-card.poor .status-label::before { background: #f97316; box-shadow: 0 0 8px #f97316; }
.status-card.closed .status-label::before { background: #ef4444; box-shadow: 0 0 8px #ef4444; }

/* Status gauge bar */
.status-gauge {
    position: relative;
    width: 80%;
    max-width: 320px;
    margin: 0.75rem auto 0;
}

.status-gauge-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.55rem;
    font-weight: 600;
    opacity: 0.5;
    text-transform: uppercase;
    margin-bottom: 0.2rem;
}

.status-gauge-track {
    position: relative;
    height: 8px;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 4px;
    overflow: visible;
}

.status-gauge-seg {
    position: absolute;
    height: 100%;
}

.status-gauge-green {
    left: 0;
    width: 33.3%;
    background: rgba(34, 197, 94, 0.5);
    border-radius: 4px 0 0 4px;
}

.status-gauge-yellow {
    left: 33.3%;
    width: 33.4%;
    background: rgba(234, 179, 8, 0.5);
}

.status-gauge-red {
    left: 66.7%;
    width: 33.3%;
    background: rgba(239, 68, 68, 0.5);
    border-radius: 0 4px 4px 0;
}

.status-gauge-marker {
    position: absolute;
    top: -3px;
    width: 4px;
    height: 14px;
    background: #ede0d4;
    border-radius: 2px;
    transform: translateX(-50%);
    box-shadow: 0 0 6px rgba(0, 0, 0, 0.4);
}

.status-gauge-value {
    text-align: center;
    margin-top: 0.35rem;
}

.status-gauge-cfs {
    font-size: 0.9rem;
    font-weight: 700;
    position: relative;
}

.status-gauge-desc {
    font-size: 0.6rem;
    opacity: 0.6;
    margin-left: 0.3rem;
}


/* Cards */
.card {
    background: rgba(48, 40, 35, 0.55);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(196, 149, 106, 0.1);
    border-radius: 14px;
    padding: 1.25rem;
    margin-bottom: 0.75rem;
    min-width: 0;
    overflow: hidden;
}

.card h2 {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #8b7355;
    margin-bottom: 0.75rem;
    font-weight: 700;
}

/* Hike forecast */
.hike-scroll {
    display: flex;
    overflow-x: auto;
    gap: 0.5rem;
    padding-bottom: 0.5rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.hike-scroll::-webkit-scrollbar {
    display: none;
}

.hike-day {
    min-width: 72px;
    text-align: center;
    padding: 0.6rem 0.4rem;
    background: rgba(12, 10, 9, 0.6);
    border: 1px solid rgba(196, 149, 106, 0.08);
    border-radius: 10px;
    flex-shrink: 0;
    transition: transform 0.15s;
}

.hike-day:hover {
    transform: translateY(-2px);
}

.hike-day-name {
    font-size: 0.7rem;
    font-weight: 700;
    color: #ede0d4;
}

.hike-day-date {
    font-size: 0.6rem;
    color: #8b7355;
    font-weight: 500;
}

.hike-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin: 0.35rem auto;
    box-shadow: 0 0 8px currentColor;
}

.hike-rating {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.15rem;
}

.hike-cfs {
    font-size: 0.7rem;
    font-weight: 600;
    color: #c4956a;
}

.hike-temp {
    font-size: 0.65rem;
    color: #8b7355;
}

.hike-precip {
    font-size: 0.6rem;
    color: #c4956a;
}

/* River stats */
.river-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}

.stat {
    text-align: center;
    padding: 0.75rem 0.5rem;
    background: rgba(12, 10, 9, 0.6);
    border-radius: 10px;
    border: 1px solid rgba(196, 149, 106, 0.08);
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #ede0d4;
}

.stat-unit {
    font-size: 0.75rem;
    font-weight: 400;
    color: #78716c;
}

.stat-label {
    font-size: 0.65rem;
    color: #8b7355;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-top: 0.15rem;
    font-weight: 600;
}

.trend-rising { color: #f87171; }
.trend-falling { color: #4ade80; }
.trend-stable { color: #94a3b8; }

/* Weather */
.weather-current {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(196, 149, 106, 0.08);
}

.weather-temp {
    font-size: 2.5rem;
    font-weight: 700;
    color: #ede0d4;
    line-height: 1;
}

.weather-desc {
    font-size: 0.8rem;
    color: #c4956a;
    font-weight: 500;
}

.weather-icon {
    font-size: 1.5rem;
}

.forecast-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}

.forecast-day {
    text-align: center;
    padding: 0.75rem 0.5rem;
    background: rgba(12, 10, 9, 0.6);
    border-radius: 10px;
    border: 1px solid rgba(196, 149, 106, 0.08);
}

.forecast-date {
    font-size: 0.7rem;
    color: #8b7355;
    font-weight: 600;
}

.forecast-temps {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0.25rem 0;
    color: #ede0d4;
}

.forecast-temps .low {
    color: #78716c;
    font-weight: 400;
}

.forecast-precip {
    font-size: 0.7rem;
    color: #c4956a;
    font-weight: 500;
}

/* Alerts */
.alert-item {
    padding: 0.75rem;
    background: rgba(239, 68, 68, 0.08);
    border-left: 3px solid #ef4444;
    border-radius: 0 8px 8px 0;
    margin-bottom: 0.5rem;
}

.alert-item.info {
    background: rgba(196, 149, 106, 0.08);
    border-left-color: #c4956a;
}

.alert-item.caution-alert {
    background: rgba(234, 179, 8, 0.08);
    border-left-color: #eab308;
}

.alert-item:last-child {
    margin-bottom: 0;
}

.alert-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
}

.alert-title {
    font-weight: 600;
    font-size: 0.85rem;
    color: #ede0d4;
}

.alert-date {
    font-size: 0.7rem;
    color: #8b7355;
    white-space: nowrap;
    flex-shrink: 0;
}

.alert-desc {
    font-size: 0.75rem;
    color: #c4956a;
    margin-top: 0.2rem;
    line-height: 1.4;
}

.alert-source {
    display: inline-block;
    font-size: 0.7rem;
    color: #c4956a;
    text-decoration: none;
    margin-top: 0.3rem;
    font-weight: 500;
}

.alert-source:hover {
    text-decoration: underline;
}

.no-alerts {
    color: #4ade80;
    font-weight: 500;
    font-size: 0.9rem;
    padding: 0.5rem 0;
}

/* Flow Guide */
.flow-guide-row {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    padding: 0.55rem 0;
    border-bottom: 1px solid rgba(196, 149, 106, 0.06);
}

.flow-guide-row:last-of-type {
    border-bottom: none;
}

.flow-guide-swatch {
    width: 6px;
    min-height: 32px;
    border-radius: 3px;
    flex-shrink: 0;
    margin-top: 2px;
}

.flow-guide-info {
    flex: 1;
    min-width: 0;
}

.flow-guide-header {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.flow-guide-label {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.flow-guide-range {
    font-size: 0.75rem;
    color: #c4956a;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.flow-guide-desc {
    font-size: 0.72rem;
    color: #8b7355;
    margin-top: 0.1rem;
    line-height: 1.4;
}

.flow-guide-note {
    margin-top: 0.75rem;
    padding-top: 0.65rem;
    border-top: 1px solid rgba(196, 149, 106, 0.1);
    font-size: 0.68rem;
    color: #78716c;
    line-height: 1.5;
}

.flow-guide-note strong {
    color: #ef4444;
    font-weight: 700;
}

/* Chart */
.chart-container {
    position: relative;
    height: 280px;
}

.seasonal-context {
    font-size: 0.8rem;
    color: #8b7355;
    text-align: center;
    margin-top: 0.75rem;
    font-style: italic;
}

/* Footer */
footer {
    position: relative;
    z-index: 1;
    max-width: 640px;
    margin: 0 auto;
    padding: 1.5rem 1rem 2rem;
    text-align: center;
    font-size: 0.7rem;
    color: #78716c;
}

.footer-sources {
    margin-bottom: 0.25rem;
}

footer a {
    color: #8b7355;
    text-decoration: none;
}

footer a:hover {
    color: #c4956a;
    text-decoration: underline;
}

#last-updated {
    margin-top: 0.25rem;
    color: #78716c;
}

/* Animations */
@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

.trend-arrow {
    display: inline-block;
    animation: bounce 600ms ease-in-out;
}

/* Closure Risk Card */
.closure-risk-card {
    text-align: center;
}

.risk-summary {
    margin-bottom: 1.5rem;
}

.risk-headline {
    font-size: 3rem;
    font-weight: 800;
    line-height: 1;
}

.risk-label {
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: 0.25rem;
}

.risk-subtitle {
    font-size: 0.8rem;
    color: #64748b;
    margin-top: 0.25rem;
}

.risk-chart {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin: 1.5rem 0 1rem;
    align-items: flex-end;
    height: 140px;
}

.risk-day {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    min-width: 0;
}

.risk-bar-container {
    width: 100%;
    max-width: 28px;
    height: 80px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.risk-bar {
    width: 100%;
    border-radius: 3px 3px 0 0;
    min-height: 2px;
    transition: height 0.3s ease;
}

.risk-pct {
    font-size: 0.7rem;
    font-weight: 600;
    color: #e2e8f0;
    margin-top: 0.25rem;
}

.risk-day-name {
    font-size: 0.65rem;
    color: #94a3b8;
    margin-top: 0.15rem;
}

.risk-day-date {
    font-size: 0.6rem;
    color: #64748b;
}

.risk-model-label {
    font-size: 0.75rem;
    color: #94a3b8;
    font-weight: 600;
    margin-top: 0.5rem;
}

.risk-model-desc {
    font-size: 0.7rem;
    color: #64748b;
    margin-top: 0.25rem;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

/* Risk model breakdown */
.risk-details {
    margin-top: 1rem;
}

.risk-details-toggle {
    font-size: 0.8rem;
    color: #94a3b8;
    cursor: pointer;
    user-select: none;
}

.risk-details-toggle:hover {
    color: #e2e8f0;
}

.risk-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0.75rem;
    font-size: 0.75rem;
}

.risk-table th {
    color: #94a3b8;
    font-weight: 600;
    text-align: center;
    padding: 0.4rem 0.5rem;
    border-bottom: 1px solid #334155;
}

.risk-table td {
    text-align: center;
    padding: 0.35rem 0.5rem;
    color: #e2e8f0;
    border-bottom: 1px solid #1e293b;
}

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

.risk-details .risk-model-desc {
    margin-top: 0.75rem;
    text-align: left;
    line-height: 1.6;
}

/* Responsive */
@media (max-width: 400px) {
    .river-stats {
        gap: 0.35rem;
    }

    .stat-value {
        font-size: 1.25rem;
    }

    .forecast-grid {
        gap: 0.35rem;
    }
}

/* Wrapper spacing at all widths */
.tablet-row {
    margin-bottom: 0.75rem;
}

.desktop-grid {
    margin-bottom: 0.75rem;
}

@media (min-width: 640px) {
    main {
        max-width: 800px;
    }

    .header-content {
        max-width: 800px;
    }

    footer {
        max-width: 800px;
    }

    .tablet-row {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }

    .tablet-row > .card {
        margin-bottom: 0;
    }
}

@media (min-width: 1024px) {
    main {
        max-width: 960px;
    }

    .header-content {
        max-width: 960px;
    }

    footer {
        max-width: 960px;
    }

    .desktop-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }

    .desktop-col {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
        min-width: 0;
    }

    .desktop-col > .card {
        margin-bottom: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .trend-arrow {
        animation: none;
    }
}

/* Closure Risk History */
.closure-risk-card h2 {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.risk-history-trigger {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
}

.risk-history-icon {
    display: flex;
    align-items: center;
    color: #c4956a;
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.risk-history-trigger:hover .risk-history-icon {
    opacity: 1;
}

.risk-history-dialog {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    width: 280px;
    background: rgba(18, 10, 6, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(196, 149, 106, 0.15);
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    z-index: 100;
    text-align: left;
}

.risk-history-trigger:hover .risk-history-dialog {
    display: block;
}

.history-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
}

.history-sparkline {
    width: 100%;
    height: 50px;
    margin-bottom: 12px;
}

.history-list {
    max-height: 200px;
    overflow-y: auto;
}

.history-list::-webkit-scrollbar {
    width: 4px;
}

.history-list::-webkit-scrollbar-track {
    background: transparent;
}

.history-list::-webkit-scrollbar-thumb {
    background: rgba(196, 149, 106, 0.2);
    border-radius: 2px;
}

.history-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid rgba(196, 149, 106, 0.08);
    font-size: 13px;
}

.history-row:last-child {
    border-bottom: none;
}

.history-date {
    color: #94a3b8;
}

.history-value {
    font-weight: 600;
    white-space: nowrap;
}

@media (max-width: 600px) {
    .risk-history-dialog {
        width: 260px;
        right: -8px;
    }
}
