/* === PLAY OR POSTPONE — Play Score UI === */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

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

:root {
    --bg-0: #050814;
    --bg-1: #0a1024;
    --panel: rgba(12, 22, 48, 0.72);
    --panel-solid: #0c1630;
    --panel-border: rgba(80, 140, 255, 0.22);
    --panel-glow: rgba(56, 189, 248, 0.08);
    --text: #e8eefc;
    --muted: #8b9bb8;
    --label: #6b7c99;
    --line: rgba(120, 160, 230, 0.18);
    --green: #22e36a;
    --green-dim: rgba(34, 227, 106, 0.15);
    --yellow: #f5c542;
    --orange: #ff8a3d;
    --red: #ff4d5e;
    --blue: #3b9eff;
    --cyan: #2dd4bf;
    --purple: #a78bfa;
    --radius: 16px;
    --radius-sm: 12px;
    --font: 'Plus Jakarta Sans', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
    --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

html {
    font-size: 16px;
    background: var(--bg-0);
}

body {
    min-height: 100vh;
    color: var(--text);
    font-family: var(--font);
    line-height: 1.45;
    background: radial-gradient(1200px 600px at 15% -10%, rgba(56, 120, 255, 0.18), transparent 55%),
                radial-gradient(900px 500px at 90% 20%, rgba(120, 40, 200, 0.16), transparent 50%),
                linear-gradient(180deg, #070b18 0%, #050814 45%, #04060f 100%);
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    align-items: center;
}

.app-bg {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background:
        radial-gradient(ellipse 80% 50% at 10% 80%, rgba(30, 80, 180, 0.12), transparent 60%),
        radial-gradient(ellipse 60% 40% at 90% 70%, rgba(90, 40, 160, 0.14), transparent 55%);
    opacity: 0.9;
}

.app-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 20% 30%, rgba(80, 140, 255, 0.04) 0, transparent 40%),
        radial-gradient(circle at 80% 60%, rgba(140, 80, 255, 0.05) 0, transparent 35%);
}

/* --- Top bar --- */
.top-bar-wrap {
    position: relative;
    z-index: 10;
    padding: 0px 30px;
}

.top-bar {
    max-width: 980px;
    margin: 0 0 0 20px;
    display: flex;
    align-items: flex-end;
    gap: 10px;
    flex-wrap: nowrap;
}

.brand {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    margin-bottom: 2px;
    text-decoration: none;
    line-height: 0;
}

.brand-logo {
    display: block;
    height: 52px;
    width: auto;
    max-width: min(280px, 42vw);
    object-fit: contain;
    object-position: left center;
}

.input-row {
    display: flex;
    flex: 1 1 auto;
    flex-wrap: nowrap;
    gap: 8px;
    align-items: flex-end;
    min-width: 0;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.field-label {
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    color: var(--label);
    text-transform: uppercase;
    padding-left: 2px;
}

.field-control {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(8, 14, 32, 0.85);
    border: 1px solid rgba(100, 140, 220, 0.28);
    border-radius: 12px;
    padding: 0 10px;
    height: 44px;
    min-width: 0;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field-control:focus-within {
    border-color: rgba(56, 189, 248, 0.55);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.12);
}

.field-icon {
    width: 16px;
    height: 16px;
    color: #64748b;
    flex-shrink: 0;
    display: grid;
    place-items: center;
}
.field-icon svg { width: 16px; height: 16px; }

.field-control input,
.field-control select {
    appearance: none;
    -webkit-appearance: none;
    background: transparent;
    background-color: transparent;
    border: 0;
    color: var(--text);
    font-family: var(--font);
    font-size: 0.88rem;
    font-weight: 500;
    width: 100%;
    min-width: 0;
    outline: none;
    height: 100%;
    /* Prevent UA white flash on focus / selection */
    color-scheme: dark;
}

.field-control input:focus,
.field-control input:focus-visible,
.field-control input:active,
.field-control select:focus,
.field-control select:focus-visible,
.field-control select:active {
    background: transparent;
    background-color: transparent;
    color: var(--text);
    outline: none;
    box-shadow: none;
}

/* Keep autofilled fields on the dark control background */
.field-control input:-webkit-autofill,
.field-control input:-webkit-autofill:hover,
.field-control input:-webkit-autofill:focus,
.field-control input:-webkit-autofill:active {
    -webkit-text-fill-color: var(--text);
    caret-color: var(--text);
    transition: background-color 99999s ease-in-out 0s;
    box-shadow: 0 0 0 1000px transparent inset;
    -webkit-box-shadow: 0 0 0 1000px rgba(8, 14, 32, 0.85) inset;
}

.field-control select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0 center;
    background-color: transparent;
    padding-right: 14px;
    cursor: pointer;
}

.field-control input::placeholder { color: #475569; }

.field-control input[type="date"],
.field-control input[type="time"] {
    background-color: transparent;
    cursor: pointer;
}

/* One calendar control only (right-side native indicator); click opens picker via JS */
.field-control input[type="date"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: 0.75;
    filter: invert(0.7);
}

.field-control-split {
    gap: 2px;
    padding-left: 8px;
    padding-right: 6px;
}

/* Breathing room between clock icon and time dropdown */
.field-time .field-control-split .field-icon {
    margin-right: 4px;
}

.field-control-split select {
    width: auto;
    flex: 0 0 auto;
    background-position: right 0 center;
    padding-right: 12px;
    min-width: 0;
}

.field-control-split select[name="time12"] {
    min-width: 3.6rem;
    flex: 1 1 auto;
}

.field-control-split select[name="ampm"] {
    min-width: 2.4rem;
    flex: 0 0 auto;
}

.field-zip { flex: 1 1 120px; max-width: 150px; }
.field-sport { flex: 1 1 110px; max-width: 140px; }
.field-date { flex: 0 1 132px; max-width: 148px; }
.field-time { flex: 0 0 132px; max-width: 132px; }
.field-duration { flex: 0 0 88px; max-width: 88px; }

.field-duration .field-control {
    padding-left: 8px;
    padding-right: 8px;
}

.top-bar-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    padding-bottom: 0;
}

.btn-primary {
    height: 44px;
    padding: 0 14px;
    border: 0;
    border-radius: 12px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 45%, #7c3aed 100%);
    color: #fff;
    font-family: var(--font);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    cursor: pointer;
    white-space: nowrap;
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.35);
    transition: transform 0.12s ease, filter 0.12s ease;
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:active { transform: translateY(1px); }
.btn-primary:disabled {
    cursor: not-allowed;
    opacity: 0.55;
    filter: grayscale(0.5);
    box-shadow: none;
    transform: none;
}
.btn-primary:disabled:hover { filter: grayscale(0.5); }

/* --- Event action buttons (watch / share) --- */
.event-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}
.event-action-btn {
    font-size: 0.78rem;
}
.event-action-btn.is-watched {
    background: linear-gradient(135deg, #16a34a 0%, #15803d 55%, #166534 100%);
    box-shadow: 0 8px 24px rgba(22, 163, 74, 0.35);
}

.btn-ghost {
    height: 44px;
    padding: 0 14px;
    border-radius: 12px;
    border: 1px solid rgba(100, 140, 220, 0.25);
    background: transparent;
    color: var(--muted);
    font-family: var(--font);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}
.btn-ghost:hover { color: var(--text); border-color: rgba(100, 140, 220, 0.45); }

.btn-icon-reset {
    width: 44px;
    height: 44px;
    padding: 0;
    display: grid;
    place-items: center;
    border-radius: 12px;
    border: 1px solid rgba(100, 140, 220, 0.25);
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    flex-shrink: 0;
    transition: color 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}
.btn-icon-reset svg {
    width: 18px;
    height: 18px;
}
.btn-icon-reset:hover {
    color: var(--text);
    border-color: rgba(100, 140, 220, 0.45);
    background: rgba(8, 14, 32, 0.55);
}

/* --- Main --- */
.ws-main {
    position: relative;
    z-index: 1;
    flex: 1;
    width: 100%;
    max-width: 980px;
    margin: 0 0 0 20px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.card {
    background: linear-gradient(180deg, rgba(16, 28, 58, 0.85) 0%, rgba(10, 18, 40, 0.9) 100%);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(10px);
}

.card-empty,
.card-loading {
    padding: 36px 28px;
    text-align: center;
}

.empty-title {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #93c5fd;
    margin-bottom: 8px;
}

.empty-copy {
    color: var(--muted);
    font-size: 0.98rem;
    max-width: 36rem;
    margin: 0 auto;
}

.form-error {
    color: #fca5a5;
    font-size: 0.92rem;
    font-weight: 600;
    max-width: 36rem;
    margin: 12px auto 0;
}

/* Highlights the area on screen that needs attention instead of showing a
   blocking native alert() popup. */
.form-panel-highlight {
    border-color: #f87171;
    box-shadow: 0 0 0 2px rgba(248, 113, 113, 0.5), var(--shadow);
    animation: form-panel-pulse 1.4s ease-in-out 2;
}

.form-panel-error .empty-title,
.form-panel-error .empty-copy {
    display: none;
}

.field-control-highlight {
    border-color: #f87171 !important;
    box-shadow: 0 0 0 2px rgba(248, 113, 113, 0.4);
}

@keyframes form-panel-pulse {
    0%, 100% { box-shadow: 0 0 0 2px rgba(248, 113, 113, 0.5), var(--shadow); }
    50% { box-shadow: 0 0 0 5px rgba(248, 113, 113, 0.25), var(--shadow); }
}

.loading-text {
    font-size: 1rem;
    font-weight: 600;
    color: #93c5fd;
    margin-bottom: 16px;
}

.loading-bar {
    height: 6px;
    width: min(320px, 100%);
    margin: 0 auto;
    border-radius: 999px;
    background: rgba(30, 50, 90, 0.9);
    overflow: hidden;
}

.loading-bar-fill {
    height: 100%;
    width: 40%;
    border-radius: inherit;
    background: linear-gradient(90deg, #38bdf8, #818cf8);
    animation: load-slide 1.4s ease-in-out infinite;
}

@keyframes load-slide {
    0% { transform: translateX(-120%); }
    100% { transform: translateX(320%); }
}

/* --- Results --- */
.results {
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding-right: 20px;
}

#locationBar{
    margin-top: 30px;
}

.event-strip {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 16px;
    padding: 14px 18px;
    background: linear-gradient(180deg, rgba(14, 26, 54, 0.9) 0%, rgba(10, 18, 40, 0.92) 100%);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.event-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.92rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text);
}

.event-icon {
    width: 18px;
    height: 18px;
    color: #38bdf8;
    display: grid;
    place-items: center;
}
.event-icon svg { width: 18px; height: 18px; }

.event-sep {
    width: 1px;
    height: 18px;
    background: var(--line);
}

/* Score card */
.score-card {
    padding: 28px 28px 18px;
    overflow: hidden;
}

.score-layout {
    display: flex;
    align-items: flex-start;
    gap: clamp(20px, 4vw, 48px);
    flex-wrap: wrap;
    justify-content: center;
    padding-bottom: 8px;
}

.ws-dial-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 0 0 auto;
}

.ws-dial-chart-box {
    width: clamp(200px, 28vw, 280px);
    aspect-ratio: 1;
    position: relative;
    filter: drop-shadow(0 0 28px rgba(34, 227, 106, 0.22));
}

.ws-dial-canvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
}

.ws-dial-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    pointer-events: none;
    box-sizing: border-box;
}

.ws-dial-score {
    font-size: clamp(3.2rem, 8vw, 4.6rem);
    font-weight: 800;
    line-height: 0.95;
    letter-spacing: -0.03em;
    color: var(--green);
    text-shadow: 0 0 28px rgba(34, 227, 106, 0.35);
}

.ws-dial-center-label {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--muted);
    margin-top: 2px;
}

.ws-dial-scale {
    width: clamp(200px, 28vw, 280px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    margin-top: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--muted);
}

.scale-track {
    flex: 1;
    height: 3px;
    border-radius: 999px;
    background: rgba(80, 100, 140, 0.35);
    position: relative;
    overflow: hidden;
}

.scale-fill {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 0%;
    border-radius: inherit;
    background: linear-gradient(90deg, #22e36a, #4ade80);
    box-shadow: 0 0 10px rgba(34, 227, 106, 0.5);
    transition: width 0.6s ease;
}

.ws-score-label {
    margin-top: 10px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    color: var(--muted);
}

.ws-decision-info {
    min-width: 0;
    max-width: 420px;
}

.ws-recommendation {
    font-size: clamp(2.6rem, 7vw, 4rem);
    font-weight: 800;
    letter-spacing: 0.04em;
    line-height: 1;
    color: var(--green);
    text-transform: uppercase;
    text-shadow: 0 0 30px rgba(34, 227, 106, 0.25);
    padding-bottom: 10px;
    border-bottom: 3px solid currentColor;
    display: inline-block;
    min-width: 4.5ch;
}

.ws-confidence {
    margin-top: 14px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #7dd3fc;
}

.ws-confidence .sep {
    color: rgba(125, 211, 252, 0.35);
    margin: 0 0.55em;
}

.ws-reason-short {
    margin-top: 14px;
    color: var(--muted);
    font-size: 0.98rem;
    line-height: 1.55;
    max-width: 34rem;
}

/* Metrics */
.ws-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    margin-top: 22px;
    border-top: 1px solid var(--line);
}

.ws-metric {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 18px 12px;
    border-right: 1px solid var(--line);
    min-width: 0;
}
.ws-metric:last-child { border-right: 0; }

.ws-metric-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}
.ws-metric-icon svg { width: 22px; height: 22px; }

.ws-metric-icon.rain { color: #38bdf8; background: rgba(56, 189, 248, 0.12); }
.ws-metric-icon.temp { color: #fb923c; background: rgba(251, 146, 60, 0.12); }
.ws-metric-icon.wind { color: #2dd4bf; background: rgba(45, 212, 191, 0.12); }
.ws-metric-icon.gust { color: #a78bfa; background: rgba(167, 139, 250, 0.12); }

.ws-metric-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.ws-metric-label {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: var(--muted);
}

.ws-metric-value {
    font-size: clamp(1.15rem, 2.4vw, 1.45rem);
    font-weight: 800;
    line-height: 1.1;
    white-space: nowrap;
}

.ws-metric-value.rain { color: #38bdf8; }
.ws-metric-value.temp { color: #fb923c; }
.ws-metric-value.wind { color: #2dd4bf; }
.ws-metric-value.gust { color: #a78bfa; }
.ws-metric-value.aqi {
    white-space: normal;
    line-height: 1.1;
    font-size: 0.85rem;
}
.ws-metric-value.aqi-good { color: var(--green); }
.ws-metric-value.aqi-moderate { color: var(--yellow); }
.ws-metric-value.aqi-unhealthy-sg { color: var(--orange); }
.ws-metric-value.aqi-unhealthy { color: var(--red); }
.ws-metric-value.aqi-very-unhealthy { color: var(--purple); }
.ws-metric-value.aqi-hazardous { color: #8b0000; }

/* Alerts container — hide when empty so it doesn't add an extra gap */
.details-alerts:empty {
    display: none;
}

/* Risk banner */
.risk-banner {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    padding: 16px 18px;
    border-radius: var(--radius);
    border: 1px solid rgba(34, 227, 106, 0.35);
    background: linear-gradient(180deg, rgba(12, 40, 28, 0.75) 0%, rgba(8, 24, 20, 0.85) 100%);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
}

.risk-banner.risk-mid {
    border-color: rgba(245, 197, 66, 0.4);
    background: linear-gradient(180deg, rgba(48, 36, 10, 0.8) 0%, rgba(28, 20, 8, 0.88) 100%);
}
.risk-banner.risk-high {
    border-color: rgba(255, 77, 94, 0.45);
    background: linear-gradient(180deg, rgba(48, 14, 20, 0.82) 0%, rgba(28, 8, 12, 0.9) 100%);
}

.risk-icon {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    color: var(--green);
    margin-top: 1px;
}
.risk-banner.risk-mid .risk-icon { color: var(--yellow); }
.risk-banner.risk-high .risk-icon { color: var(--red); }
.risk-icon svg { width: 28px; height: 28px; }

.risk-title {
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    color: var(--green);
    margin-bottom: 4px;
}
.risk-banner.risk-mid .risk-title { color: var(--yellow); }
.risk-banner.risk-high .risk-title { color: #ff7a88; }

.risk-copy {
    color: #b7c4d8;
    font-size: 0.92rem;
    line-height: 1.5;
}

/* Learn more */
.learn-more-wrap {
    display: flex;
    justify-content: center;
    padding: 6px 0;
}

.learn-more-btn {
    appearance: none;
    border: 0;
    background: transparent;
    color: #7dd3fc;
    font-family: var(--font);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 999px;
    transition: color 0.15s ease, background 0.15s ease;
}
.learn-more-btn:hover {
    color: #bae6fd;
    background: rgba(56, 189, 248, 0.08);
}
.learn-more-btn[aria-expanded="true"] .learn-more-chevron {
    transform: rotate(180deg);
}
.learn-more-chevron {
    display: inline-block;
    transition: transform 0.2s ease;
    font-size: 0.85em;
}

/* "Why this suggestion?" link under the score description */
.why-suggestion-btn {
    appearance: none;
    border: 0;
    background: transparent;
    color: #7dd3fc;
    font-family: var(--font);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 0;
    margin-top: 8px;
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: color 0.15s ease;
}
.why-suggestion-btn:hover {
    color: #bae6fd;
}

.details-panel {
    display: flex;
    flex-direction: column;
    gap: 14px;
    animation: fade-in 0.25s ease;
}

@keyframes fade-in {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: none; }
}

.details-card {
    padding: 18px 20px 8px;
}

.details-title {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 12px;
}

.ws-models {
    display: block;
}

/* --- Score breakdown ("How we got this score") --- */
.ws-breakdown-intro {
    font-size: 0.82rem;
    color: var(--muted);
    margin-bottom: 14px;
    line-height: 1.5;
}

.ws-breakdown {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
}

.ws-breakdown-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: rgba(15, 23, 42, 0.45);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 12px 14px;
}

.ws-breakdown-base {
    background: rgba(59, 158, 255, 0.06);
    border-color: rgba(59, 158, 255, 0.25);
}

.ws-breakdown-total {
    background: rgba(34, 227, 106, 0.06);
    border-color: rgba(34, 227, 106, 0.28);
}

.ws-breakdown-icon {
    font-size: 1.15rem;
    line-height: 1.4;
    flex-shrink: 0;
    width: 22px;
    text-align: center;
}

.ws-breakdown-body {
    flex: 1 1 auto;
    min-width: 0;
}

.ws-breakdown-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
}

.ws-breakdown-label {
    font-size: 0.86rem;
    font-weight: 700;
    color: var(--text);
}

.ws-breakdown-impact {
    font-size: 0.82rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
    white-space: nowrap;
}

.ws-impact-down { color: var(--red); }
.ws-impact-up { color: var(--green); }
.ws-impact-neutral { color: var(--muted); }

.ws-breakdown-detail {
    font-size: 0.8rem;
    color: var(--muted);
    line-height: 1.5;
    margin-top: 3px;
}

.ws-breakdown-detail strong {
    color: var(--text);
}

/* --- Per-source readings --- */
.ws-source-readings {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ws-source-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 12px;
    background: rgba(15, 23, 42, 0.45);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px 14px;
}

.ws-source-name {
    font-size: 0.84rem;
    font-weight: 700;
    color: var(--text);
    flex: 1 1 160px;
    min-width: 0;
}

.ws-source-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.ws-source-chip {
    font-size: 0.74rem;
    font-weight: 600;
    color: var(--muted);
    background: rgba(59, 158, 255, 0.08);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 3px 10px;
    white-space: nowrap;
}

.ws-source-chip-alert {
    color: var(--red);
    background: rgba(255, 77, 94, 0.14);
    border-color: rgba(255, 77, 94, 0.45);
}

.ws-source-row-alert {
    border-color: rgba(255, 77, 94, 0.55);
    background: rgba(255, 77, 94, 0.08);
    box-shadow: inset 0 0 0 1px rgba(255, 77, 94, 0.25);
}

.ws-source-flag {
    flex: 1 1 100%;
    font-size: 0.74rem;
    font-weight: 600;
    color: var(--red);
    margin-top: 2px;
}

.ws-model-empty {
    color: var(--muted);
    font-size: 0.82rem;
    padding: 8px 0;
}

/* Guidance wrap and combined legend */
.ws-guidance-wrap {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ws-combined-legend {
    background: rgba(15, 23, 42, 0.45);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px 14px;
}

.ws-combined-legend-inner {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 16px;
    align-items: center;
    justify-content: center;
}

.ws-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.74rem;
    font-weight: 600;
    color: var(--text);
}

.ws-legend-color {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.ws-legend-label {
    letter-spacing: 0.02em;
}

/* Widgets grid & square-like cards */
.ws-widgets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
}

.ws-widget-card {
    background: rgba(20, 30, 50, 0.55);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    aspect-ratio: 1 / 1;
    min-height: 280px;
}

.ws-widget-header {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--muted);
    text-transform: uppercase;
    margin-bottom: 8px;
}

.ws-widget-icon {
    font-size: 0.95rem;
    line-height: 1;
}

.ws-widget-canvas-wrap {
    flex: 1;
    position: relative;
    width: 100%;
    min-height: 0;
}

/* Model guidance: grouped by metric (Rain / Temp / Wind), each showing
   every source over time as an aligned row list. */
.ws-mg-groups {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.ws-mg-group-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--muted);
    text-transform: uppercase;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 2px;
}

.ws-mg-group-icon {
    font-size: 0.9rem;
    line-height: 1;
}

.ws-mg-group-table {
    display: flex;
    flex-direction: column;
}

.ws-mg-grow {
    display: grid;
    grid-template-columns: minmax(8rem, 13rem) 5rem 1fr;
    align-items: center;
    column-gap: 10px;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    font-size: 0.75rem;
}
.ws-mg-group-table .ws-mg-grow:last-child {
    border-bottom: 0;
}

.ws-mg-grow-consensus {
    background: rgba(59,158,255,0.06);
    border-bottom: 1px solid var(--line) !important;
    border-radius: 4px;
}
.ws-mg-grow-consensus .ws-mg-name {
    color: #93c5fd;
    font-weight: 800;
}

.ws-mg-gcell {
    min-width: 0;
    display: flex;
    align-items: center;
}

.ws-mg-gstat {
    flex-direction: column;
    align-items: flex-start;
    flex-shrink: 0;
}

.ws-mg-gspark {
    width: 100%;
}

.ws-mg-gspark .ws-mg-spark {
    width: 100%;
    max-width: none;
    height: 28px;
    display: block;
    overflow: visible;
}

.ws-mg-name-col {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
    padding-right: 8px;
}

.ws-mg-name {
    font-weight: 700;
    color: #cbd5e1;
    font-size: 0.75rem;
    letter-spacing: 0.02em;
    white-space: normal;
    word-break: break-word;
    line-height: 1.3;
    display: block;
}

.ws-mg-name-link {
    color: #93c5fd;
    text-decoration: none;
}
.ws-mg-name-link:hover {
    text-decoration: underline;
    color: #bfdbfe;
}

.ws-mg-short {
    font-size: 0.62rem;
    color: var(--muted);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.ws-mg-peak {
    display: block;
    font-weight: 700;
    color: #e8eefc;
    font-size: 0.82rem;
}

.ws-mg-avg {
    display: block;
    font-size: 0.65rem;
    color: var(--muted);
    letter-spacing: 0.02em;
}

.ws-mg-amount {
    display: block;
    font-size: 0.65rem;
    color: #7dd3fc;
    letter-spacing: 0.02em;
}

.ws-mg-errors {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 12px;
}

.ws-mg-err-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    font-size: 0.75rem;
}
.ws-mg-err-row .ws-mg-name {
    color: var(--red);
}

.ws-mg-err-msg {
    color: var(--muted);
    font-size: 0.7rem;
    font-style: italic;
}

/* Alerts */
.ws-alert {
    background: linear-gradient(180deg, rgba(80, 18, 28, 0.9) 0%, rgba(40, 10, 16, 0.95) 100%);
    border: 1px solid rgba(255, 77, 94, 0.45);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    margin-bottom: 10px;
    color: #fecdd3;
}

.ws-alert-darkness {
    background: linear-gradient(180deg, rgba(72, 40, 12, 0.92) 0%, rgba(36, 20, 8, 0.95) 100%);
    border-color: rgba(251, 146, 60, 0.45);
    color: #ffedd5;
}

.ws-alert-title {
    font-size: 0.95rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    color: #fda4af;
    margin-bottom: 4px;
}
.ws-alert-darkness .ws-alert-title { color: #fdba74; }

.ws-alert a {
    color: #7dd3fc;
    text-decoration: underline;
}

.ws-reason-short a {
    color: #7dd3fc;
    text-decoration: underline;
    font-weight: 600;
}

.ws-alert-source {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: rgba(254, 205, 211, 0.7);
    margin-left: 4px;
}

/* Minute-by-minute precipitation (Apple WeatherKit next-hour nowcast) */
.minutely-precip-card {
    padding: 18px 20px;
}

.mp-title {
    font-size: 0.95rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    color: #93c5fd;
}

.mp-source {
    font-weight: 600;
    color: var(--muted);
    text-transform: none;
    letter-spacing: 0;
}

.mp-subtitle {
    font-size: 0.85rem;
    color: var(--muted);
    margin-top: 4px;
    margin-bottom: 14px;
}

.mp-bars {
    display: flex;
    align-items: flex-end;
    gap: 1px;
    height: 70px;
    background: rgba(20, 32, 62, 0.5);
    border-radius: var(--radius-sm);
    padding: 6px 4px 0;
}

.mp-bar-wrap {
    flex: 1 1 auto;
    height: 100%;
    display: flex;
    align-items: flex-end;
}

.mp-bar {
    width: 100%;
    min-height: 2px;
    border-radius: 2px 2px 0 0;
    background: linear-gradient(180deg, #38bdf8 0%, #3b9eff 100%);
}

.mp-axis {
    display: flex;
    justify-content: space-between;
    font-size: 0.72rem;
    color: var(--muted);
    margin-top: 6px;
}

.ws-disclaimer {
    text-align: center;
    font-size: 0.82rem;
    color: #64748b;
    padding: 4px 8px 8px;
    line-height: 1.5;
}

.ws-footer {
    position: relative;
    z-index: 1;
    text-align: center;
    color: #475569;
    font-size: 0.78rem;
    padding: 14px 16px 22px;
    letter-spacing: 0.02em;
    line-height: 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.ws-footer a,
.ws-footer a:visited {
    color: #64748b;
}
.ws-footer-inner{
    max-width: 920px;
    margin-left: 10px;
    margin-right: 10px;
    text-align: justify;
}

.hidden { display: none !important; }

/* --- User Nav Bar --- */
.user-nav-bar {
    position: relative;
    z-index: 10;
    width: 100%;
    padding: 0px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    font-family: var(--font);
    font-size: 0.85rem;
    color: var(--muted, #94a3b8);
    padding-bottom: 14px;
    margin-bottom: 10px;
}

.user-nav-bar .brand {
}

.user-nav-bar .brand-logo {
    height: 86px;
    max-width: 300px;
    margin-bottom: 0;
}

.user-nav-bar .nav-links {
    display: flex;
    gap: 25px;
    align-items: center;
}

.user-nav-bar .signed-in-text,
.user-nav-bar .signed-in-text strong {
    color: var(--muted, #94a3b8);
    font-weight: 500;
}

.user-nav-bar a {
    color: #ffffff;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.15s ease;
}

.user-nav-bar a.my-events-link {
    color: #ffffff;
}

.user-nav-bar a.my-events-link:hover {
    color: #e2e8f0;
    text-decoration: underline;
}

.user-nav-bar a:hover {
    color: #60a5fa;
    text-decoration: underline;
}

.user-nav-bar a.sign-out {
    color: #ffffff;
    font-weight: 500;
}

.user-nav-bar a.sign-out:hover {
    color: #f87171;
    text-decoration: underline;
}

.user-nav-bar a.sign-up-btn {
    color: #ffffff;
    background: none;
    border: none;
    padding: 0;
    font-weight: 600;
    text-decoration: none;
    transition: color 0.15s ease;
}

.user-nav-bar a.sign-up-btn:hover {
    color: #60a5fa;
    text-decoration: underline;
}

@media (max-width: 720px) {
    .user-nav-bar {
        justify-content: center;
        flex-wrap: wrap;
        gap: 12px;
        padding: 12px 16px 0;
        font-size: 0.82rem;
    }
}

/* --- Responsive --- */
@media (max-width: 900px) {
    .ws-metrics { grid-template-columns: repeat(2, 1fr); }
    .ws-metric:nth-child(2) { border-right: 0; }
    .ws-metric:nth-child(1),
    .ws-metric:nth-child(2) { border-bottom: 1px solid var(--line); }
}

@media (max-width: 1100px) {
    .top-bar,
    .input-row { flex-wrap: wrap; }
}

@media (max-width: 720px) {
    .top-bar-wrap { padding: 12px 16px 4px; }
    .top-bar {
        gap: 14px;
        flex-wrap: wrap;
        justify-content: center;
        max-width: 380px;
        margin: 0 auto;
    }
    .brand {
        width: 100%;
        justify-content: center;
        padding: 0 12px;
        box-sizing: border-box;
    }
    .brand-logo {
        height: auto;
        width: 100%;
        max-width: min(340px, calc(100vw - 48px));
        object-position: center center;
    }
    .input-row {
        width: 100%;
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
    }
    .field {
        align-items: center;
    }
    .field-label {
        width: 100%;
        text-align: center;
    }
    .field-control {
        width: 100%;
        justify-content: center;
    }
    .field-location,
    .field-sport,
    .field-duration { flex: 1 1 100%; max-width: 340px; }
    .field-date,
    .field-time { flex: 1 1 calc(50% - 5px); max-width: 165px; }
    .field-time .field-control-split select[name="time12"] { min-width: 0; }
    .top-bar-actions {
        width: 100%;
        flex-direction: column-reverse;
        align-items: center;
        gap: 8px;
        margin-bottom: 16px;
    }
    .btn-primary {
        flex: none;
        width: 100%;
        max-width: 260px;
    }
    .btn-icon-reset { display: none; }
    .ws-main { padding: 12px 12px 28px; }
    .card-empty { display: none; }
    .score-card { padding: 20px 16px 16px; }
    .score-layout { flex-direction: column; text-align: left; align-items: center; }
    .ws-decision-info { text-align: center; max-width: none; }
    .ws-reason-short { margin-left: auto; margin-right: auto; }
    .event-strip { gap: 10px; }
    .event-sep { display: none; }
    .ws-mg-grow { grid-template-columns: minmax(7rem, 10rem) 4rem 1fr; }
}

@media (max-width: 420px) {
    .top-bar { max-width: 260px; }
    .field-location,
    .field-sport,
    .field-duration { flex: 1 1 100%; max-width: 260px; }
    .field-date,
    .field-time { flex: 1 1 calc(50% - 5px); max-width: 125px; }
    .field-time .field-control-split select[name="time12"] { min-width: 0; }
    .ws-metrics { grid-template-columns: 1fr 1fr; }
}

.map-card {
    padding: 18px 18px 16px;
}

.map-label {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 12px;
}

.weather-map {
    height: 300px;
    border-radius: var(--radius-sm);
    background: #050814;
    overflow: hidden;
}

/* Leaflet tweaks */
.leaflet-container {
    background: #050814 !important;
}

.map-tiles-dark {
    filter: invert(1) hue-rotate(180deg) brightness(0.85) contrast(0.75) saturate(0.2);
}

.ws-chart-container {
    margin-top: 20px;
    height: 300px;
}

/* Radar interactive timeline */
.radar-timeline {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    padding: 8px 4px 2px;
}

.radar-play-btn {
    flex: 0 0 32px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid rgba(59, 158, 255, 0.4);
    background: rgba(5, 8, 20, 0.7);
    color: #93c5fd;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    padding: 0;
}
.radar-play-btn:hover {
    background: rgba(59, 130, 246, 0.25);
    border-color: rgba(59, 158, 255, 0.8);
}

.radar-scrubber-wrap {
    flex: 1;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.radar-ticks {
    position: relative;
    height: 16px;
    pointer-events: none;
}

.radar-tick-label {
    position: absolute;
    transform: translateX(-50%);
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: rgba(147, 197, 253, 0.55);
    white-space: nowrap;
    text-align: center;
}
.radar-tick-label.active {
    color: #93c5fd;
}

.radar-scrubber {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    border-radius: 2px;
    background: rgba(59, 130, 246, 0.2);
    outline: none;
    cursor: pointer;
    accent-color: #3b9eff;
}
.radar-scrubber::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #3b9eff;
    border: 2px solid #fff;
    box-shadow: 0 0 6px rgba(59, 158, 255, 0.6);
    cursor: grab;
    transition: box-shadow 0.15s;
}
.radar-scrubber::-webkit-slider-thumb:active {
    cursor: grabbing;
    box-shadow: 0 0 12px rgba(59, 158, 255, 0.9);
}
.radar-scrubber::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #3b9eff;
    border: 2px solid #fff;
    box-shadow: 0 0 6px rgba(59, 158, 255, 0.6);
    cursor: grab;
}

/* Radar animation timestamp badge */
.map-radar-ts {
    background: rgba(5, 8, 20, 0.82);
    color: #93c5fd;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    padding: 4px 9px;
    border-radius: 4px;
    border: 1px solid rgba(59, 158, 255, 0.3);
    pointer-events: none;
    white-space: nowrap;
    font-family: inherit;
}

.map-lightning-bolt {
    background: transparent;
    border: 0;
}
.map-lightning-bolt span {
    display: block;
    width: 14px;
    height: 22px;
    margin: 0 auto;
    background: #facc15;
    clip-path: polygon(
        58% 0,
        12% 48%,
        43% 48%,
        28% 100%,
        88% 38%,
        57% 38%
    );
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.85));
}
