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

:root {
    --color-bg: #ffffff;
    --color-surface: #ffffff;
    --color-primary: #0063a3;
    --color-primary-dark: #00508a;
    --color-on-primary: #ffffff;
    --color-secondary: #0063a3;
    --color-secondary-dark: #00508a;
    --color-on-secondary: #ffffff;
    --color-text: #111827;
    --color-text-secondary: #4b5563;
    --color-muted: #9ca3af;
    --color-border: #f0f0f0;
    --color-border-strong: #e5e7eb;
    --color-hover: #f0f7ff;
    --color-cold: #2563eb;
    --color-mild: #059669;
    --color-warm: #d97706;
    --color-precip: #3b82f6;
    --shadow-fab: 0 4px 16px rgba(0,0,0,0.18);
    --radius-chip: 20px;
    --min-touch-target: 44px;
}

body {
    font-family: 'Roboto', 'Segoe UI', sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.5;
    padding: 0;
    max-width: 600px;
    margin: 0 auto;
}

/* Skip to content link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--color-primary);
    color: var(--color-on-primary);
    padding: 8px 16px;
    text-decoration: none;
    z-index: 100;
    border-radius: 0 0 8px 0;
}

.skip-link:focus {
    top: 0;
}

/* Screen reader only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

.hidden {
    display: none !important;
}

/* Header / App Bar */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: var(--color-primary);
    color: var(--color-on-primary);
    position: sticky;
    top: 0;
    z-index: 30;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.location-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: var(--color-on-primary);
    border-radius: 4px;
    min-height: var(--min-touch-target);
}

.location-btn:hover .location {
    text-decoration: underline;
    text-underline-offset: 2px;
}

.location-btn:focus-visible {
    outline: 2px solid rgba(255,255,255,0.8);
    outline-offset: 2px;
}

.location-chevron {
    opacity: 0.75;
    flex-shrink: 0;
}

.location-row {
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

/* "Open in Google Maps" button sitting on the coloured header. */
.header-gmaps-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--color-on-primary);
    opacity: 0.85;
    padding: 6px;
    border-radius: 50%;
    text-decoration: none;
    flex-shrink: 0;
    min-width: var(--min-touch-target);
    min-height: var(--min-touch-target);
}

.header-gmaps-btn:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.15);
}

.header-gmaps-btn:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.8);
    outline-offset: 2px;
}

/* The map page's Google Maps icon shares the coloured header, so keep it light. */
.map-gmaps-btn {
    color: var(--color-on-primary);
    text-decoration: none;
}

.map-gmaps-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

.location {
    font-size: 18px;
    font-weight: 500;
    letter-spacing: 0.01em;
    color: var(--color-on-primary);
}

.last-updated {
    font-size: 12px;
    color: rgba(255,255,255,0.75);
    margin-top: 2px;
}

.unit-toggle {
    display: flex;
    border: 1.5px solid rgba(255,255,255,0.5);
    border-radius: var(--radius-chip);
    overflow: hidden;
}

.unit-toggle button,
.unit-btn {
    min-width: 44px;
    min-height: 44px;
    border: none;
    background: transparent;
    padding: 8px 14px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    color: rgba(255,255,255,0.75);
    font-family: 'Roboto', sans-serif;
    transition: background 0.15s, color 0.15s;
}

.unit-toggle button[aria-pressed="true"],
.unit-btn.active {
    background: rgba(255,255,255,0.22);
    color: #FFFFFF;
}

.unit-toggle button:hover:not([aria-pressed="true"]),
.unit-btn:hover:not(.active) {
    background: rgba(255,255,255,0.12);
}

.unit-toggle button:focus-visible,
.unit-btn:focus-visible {
    outline: 2px solid rgba(255,255,255,0.8);
    outline-offset: -2px;
}

.lang-toggle {
    display: flex;
    border: 1.5px solid rgba(255,255,255,0.5);
    border-radius: var(--radius-chip);
    overflow: hidden;
}

.lang-btn {
    min-width: 36px;
    min-height: 36px;
    border: none;
    background: transparent;
    padding: 6px 10px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    color: rgba(255,255,255,0.75);
    font-family: 'Roboto', sans-serif;
    transition: background 0.15s, color 0.15s;
}

.lang-btn.active {
    background: rgba(255,255,255,0.22);
    color: #FFFFFF;
}

.lang-btn:hover:not(.active) {
    background: rgba(255,255,255,0.12);
}

.lang-btn:focus-visible {
    outline: 2px solid rgba(255,255,255,0.8);
    outline-offset: -2px;
}

/* Header controls */
.header-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Source selector in header */
.source-selector-header {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.3);
    color: rgba(255,255,255,0.9);
    font-family: 'Roboto', sans-serif;
    font-size: 12px;
    font-weight: 500;
    padding: 5px 8px;
    border-radius: 8px;
    cursor: pointer;
    min-height: var(--min-touch-target);
    max-width: 100px;
}

.source-selector-header:focus-visible {
    outline: 2px solid rgba(255,255,255,0.8);
    outline-offset: 2px;
}

.source-selector-header option {
    background: var(--color-primary);
    color: #fff;
}

/* Main content */
main {
    display: flex;
    flex-direction: column;
    padding-bottom: calc(60px + env(safe-area-inset-bottom, 0px));
    background: #ffffff;
}

/* Current Weather — full-bleed, no card */
.current-weather {
    padding: 16px 20px 14px;
    border-bottom: 1px solid var(--color-border);
}

.current-hero {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.weather-icon {
    display: inline-block;
    width: 60px;
    height: 60px;
    flex-shrink: 0;
    margin-top: 6px;
}

.weather-icon svg {
    width: 100%;
    height: 100%;
}

.current-hero-text {
    flex: 1;
    min-width: 0;
}

.current-big-row {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 6px;
}

.current-temp {
    font-size: clamp(52px, 14vw, 72px);
    font-weight: 200;
    line-height: 1;
    letter-spacing: -3px;
    flex-shrink: 0;
}

.current-wind-rain-col {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.current-wind-val {
    font-size: clamp(36px, 10vw, 46px);
    font-weight: 200;
    line-height: 1;
    letter-spacing: -2px;
    color: var(--color-text-secondary);
}

.current-wind-unit {
    font-size: 0.3em;
    font-weight: 400;
    letter-spacing: 0;
    color: var(--color-muted);
    vertical-align: middle;
}

.current-rain-area {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.current-rain-label {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-muted);
}

.current-rain-val {
    font-size: 18px;
    font-weight: 400;
    color: var(--color-text-secondary);
}

.feels-like {
    font-size: 12px;
    color: var(--color-muted);
    margin-top: 3px;
}

.current-condition {
    font-size: 16px;
    font-weight: 400;
    color: var(--color-text-secondary);
    margin-top: 2px;
}

/* Legacy — no longer rendered */
.current-stats {
    display: none;
}

/* Stats row below temp — three equal columns */
.current-stats-row {
    display: flex;
    gap: 0;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--color-border);
}

.current-stat {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.current-stat + .current-stat {
    border-left: 1px solid var(--color-border);
    padding-left: 16px;
}

.current-stat-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-muted);
}

.current-stat-value {
    font-size: 15px;
    font-weight: 500;
    color: var(--color-text);
    white-space: nowrap;
}

/* Legacy — kept for compatibility */
.current-meta-row { display: none; }
.current-meta { display: none; }

.wind-arrow {
    display: inline-block;
    font-weight: 700;
    font-size: 2em;
    line-height: 1;
    vertical-align: middle;
}

.consensus-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--color-border);
    font-size: 12px;
}

.source-vote-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.source-vote-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border: 1px solid var(--color-border);
    border-radius: 20px;
    background: var(--color-hover);
    font-family: inherit;
    font-size: 12px;
    cursor: pointer;
    color: var(--color-text-secondary);
}

.source-vote-btn.active {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}

.source-vote-btn:hover:not(.active) {
    background: var(--color-border);
}

.source-vote-btn.limited {
    opacity: 0.45;
    border-style: dashed;
}

.source-vote-btn.limited.active {
    opacity: 1;
}

/* Mixed pseudo-source: blends all sources per metric */
.mixed-vote-btn {
    border-color: var(--color-text);
    font-weight: 600;
}

.mixed-vote-btn .svb-conf {
    letter-spacing: 0.5px;
}

.limited-data-notice {
    font-size: 11px;
    color: var(--color-text-secondary);
    border: 1px dashed var(--color-border);
    padding: 6px 10px;
    margin-bottom: 8px;
    border-radius: 4px;
}

.extended-forecast-separator {
    font-size: 10px;
    font-family: 'IBM Plex Mono', monospace;
    letter-spacing: 0.08em;
    color: var(--color-text-secondary);
    border-top: 1px dashed var(--color-border);
    padding: 6px 0 4px;
    margin-top: 4px;
    opacity: 0.7;
}

.no-data-row {
    text-align: center;
    color: var(--color-text-secondary);
    font-size: 12px;
    padding: 16px;
}

/* ── Settings panel ──────────────────────────────────────────────────────── */

.settings-container {
    max-height: 80vh;
    overflow-y: auto;
}

.settings-heading {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

.settings-section {
    padding: 16px 0;
    border-bottom: 1px solid var(--color-border);
}

.settings-section:last-child {
    border-bottom: none;
}

.settings-section-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text-secondary);
    margin: 0 0 12px;
}

.settings-hint {
    font-size: 12px;
    color: var(--color-text-secondary);
    margin: 0 0 12px;
}

/* Override unit-toggle inside settings (white background, needs dark text) */
.settings-container .unit-toggle {
    border: 1.5px solid var(--color-border);
    width: fit-content;
}

.settings-container .unit-btn {
    color: var(--color-text-secondary);
}

.settings-container .unit-btn.active {
    background: var(--color-secondary);
    color: #fff;
}

.settings-container .unit-btn:hover:not(.active) {
    background: var(--color-hover);
    color: var(--color-text);
}

.settings-container .unit-btn:focus-visible {
    outline: 2px solid var(--color-secondary);
}

.settings-sources-list {
    display: flex;
    flex-direction: column;
}

.settings-source-group {
    margin-bottom: 8px;
}

.settings-source-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 0 4px;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 2px;
}

.settings-source-group-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-secondary);
}

.settings-group-toggle {
    font-size: 11px;
    color: var(--color-secondary);
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 4px;
    font-family: inherit;
}

.settings-source-item {
    display: grid;
    grid-template-columns: 20px 1fr;
    align-items: start;
    gap: 10px;
    padding: 9px 4px;
    cursor: pointer;
    border-bottom: 1px solid var(--color-border);
}

.settings-source-item:last-child {
    border-bottom: none;
}

.settings-source-item:hover {
    background: var(--color-hover);
}

.settings-source-cb {
    width: 16px;
    height: 16px;
    margin-top: 2px;
    accent-color: var(--color-secondary);
    cursor: pointer;
    flex-shrink: 0;
}

.settings-notify-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 4px;
    cursor: pointer;
}

.settings-notify-toggle input {
    width: 16px;
    height: 16px;
    accent-color: var(--color-secondary);
    cursor: pointer;
    flex-shrink: 0;
}

.settings-notify-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text);
    line-height: 1.3;
}

.settings-notify-status {
    margin: 4px 0 0;
}

.settings-source-info {
    display: block;
}

.settings-source-name {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text);
    line-height: 1.3;
}

.settings-source-desc {
    display: block;
    font-size: 11px;
    color: var(--color-text-secondary);
    margin-top: 1px;
    line-height: 1.3;
}

.settings-active-count {
    font-size: 12px;
    color: var(--color-text-secondary);
    font-weight: normal;
    margin-left: 6px;
}

.settings-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    padding-top: 16px;
    border-top: 1px solid var(--color-border);
    margin-top: 8px;
}

.settings-cancel-btn {
    padding: 10px 20px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: none;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    color: var(--color-text-secondary);
}

.settings-cancel-btn:hover {
    background: var(--color-hover);
}

.settings-save-btn {
    padding: 10px 24px;
    border: none;
    border-radius: 8px;
    background: var(--color-secondary);
    color: #fff;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.settings-save-btn:hover {
    opacity: 0.9;
}

.svb-name {
    font-weight: 500;
}

.svb-conf {
    font-size: 11px;
    opacity: 0.8;
}

.consensus-source {
    font-weight: 600;
    color: var(--color-secondary);
}

.consensus-label {
    font-size: 12px;
    color: var(--color-muted);
}

/* Source dropdown */
.source-more {
    position: relative;
}

.source-more-toggle {
    list-style: none;
    cursor: pointer;
    font-size: 11px;
    color: var(--color-muted);
    padding: 4px 10px;
    border: 1px solid var(--color-border);
    border-radius: 20px;
    background: none;
    user-select: none;
    display: inline-flex;
    align-items: center;
}

.source-more-toggle::-webkit-details-marker { display: none; }

.source-more[open] .source-more-toggle,
.source-more-toggle.custom-active {
    color: var(--color-primary);
    border-color: var(--color-primary);
}

.source-more-list {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    background: var(--color-surface);
    border: 1px solid var(--color-border-strong);
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    z-index: 20;
    min-width: 180px;
    max-width: calc(100vw - 24px);
}

.source-more-list .source-vote-btn {
    width: 100%;
    justify-content: space-between;
    border-radius: 6px;
}

.source-more-list .svb-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}

.source-more-list .svb-conf {
    flex-shrink: 0;
    margin-left: 6px;
}

.consensus-confidence {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 11px;
    color: var(--color-muted);
    background: var(--color-border);
    border-radius: 10px;
    padding: 2px 7px;
    cursor: default;
}

/* Sections — full-bleed, separated by border */
section {
    margin: 0;
    padding: 20px 20px 24px;
    background: transparent;
    border-bottom: 1px solid var(--color-border);
}

section:last-of-type {
    border-bottom: none;
}

h2 {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text-secondary);
    margin-bottom: 14px;
    padding-left: 10px;
    border-left: 3px solid var(--color-primary);
}

/* Forecast tables */
.forecast-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    table-layout: auto;
}

.forecast-table th,
.forecast-table td {
    padding: 10px 8px;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
    vertical-align: middle;
    box-sizing: border-box;
}

.forecast-table th {
    white-space: nowrap;
}

.forecast-table th {
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-muted);
    border-bottom: 1px solid var(--color-border);
}

.forecast-table tbody tr:hover {
    background: var(--color-hover);
}

.forecast-table tbody tr:last-child td {
    border-bottom: none;
}

/* Table cells */
.cell-time {
    font-weight: 500;
    min-width: 50px;
}

.cell-icon {
    width: 32px;
    text-align: center;
}

.cell-icon svg {
    width: 24px;
    height: 24px;
}

.cell-temp {
    font-weight: 600;
    font-size: 16px;
    min-width: 45px;
}

.cell-weather {
    text-align: center;
    min-width: 50px;
    vertical-align: middle;
}

.weather-icon-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 28px;
}

.weather-icon-wrap svg {
    display: block;
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    color: var(--color-text);
}

.weather-desc {
    font-size: 11px;
    color: var(--color-text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cell-wind {
    text-align: center;
    min-width: 80px;
}

.cell-rain {
    text-align: center;
    min-width: 45px;
    font-size: 13px;
    font-weight: 500;
    color: #1565C0;
}

.wind-desc {
    font-size: 11px;
    color: var(--color-text);
    font-weight: 500;
    margin-bottom: 2px;
}

.wind-speed {
    font-size: 12px;
    color: var(--color-muted);
}

/* Daily table */
.daily-table .cell-day {
    white-space: nowrap;
}

.daily-table .day-content {
    display: flex;
    align-items: center;
    gap: 6px;
    overflow: hidden;
}

.daily-table .day-name {
    font-weight: 600;
}

.daily-table .day-num {
    color: var(--color-muted);
}

.daily-table .day-badge {
    font-size: 10px;
    padding: 2px 8px;
    background: var(--color-primary);
    color: var(--color-on-primary);
    border-radius: 10px;
    font-weight: 500;
}

.cell-high {
    font-weight: 600;
    font-size: 15px;
}

.cell-low {
    color: var(--color-muted);
    font-size: 14px;
}

.cell-hour-temp {
    font-size: 13px;
    text-align: center;
    min-width: 35px;
}

.cell-hour-temp.cell-empty {
    color: var(--color-muted);
}

.cell-source {
    text-align: right;
}

.source-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    color: var(--color-secondary);
    background: var(--color-hover);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    padding: 0;
}

.source-btn:hover {
    background: #FFE0CC;
}

.source-label {
    font-size: 11px;
    color: var(--color-muted);
}

.source-conf {
    display: inline-block;
    margin-left: 4px;
    font-size: 11px;
    font-weight: 600;
    color: var(--color-secondary);
}

.daily-hourly-row td {
    padding: 0 4px 10px;
}

.daily-main-row td {
    padding-bottom: 2px;
}

/* Temperature color coding */
.temp-cold { color: var(--color-cold); }
.temp-mild { color: var(--color-mild); }
.temp-warm { color: var(--color-warm); }

/* ── Hourly Strip ──────────────────────────────────────────────────────── */

.hourly-strip {
    display: flex;
    overflow-x: auto;
    gap: 0;
    padding: 4px 0 8px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.hourly-strip::-webkit-scrollbar {
    display: none;
}

.hour-card {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 8px 10px;
    min-width: 58px;
    position: relative;
}

.hour-card-time {
    font-size: 12px;
    font-weight: 500;
    color: var(--color-muted);
}

.hour-card.hour-now .hour-card-time {
    color: var(--color-primary);
    font-weight: 700;
}

.hour-card.hour-now::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 2px;
    background: var(--color-primary);
    border-radius: 1px;
}

.hour-card-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
}

.hour-card-icon svg {
    width: 30px;
    height: 30px;
}

.hour-card-temp {
    font-size: 15px;
    font-weight: 600;
    line-height: 1;
}

.hour-card-meta {
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 10px;
    white-space: nowrap;
}

.hour-card-wind {
    color: var(--color-muted);
    font-weight: 500;
}

.hour-meta-sep {
    color: var(--color-border-strong);
    font-size: 9px;
}

.hour-card-precip {
    font-weight: 600;
}

/* Rain probability colour scale */
.rain-low  { color: var(--color-muted); font-weight: 500; }
.rain-med  { color: #f59e0b; font-weight: 600; }
.rain-high { color: var(--color-precip); font-weight: 700; }

/* Legacy — kept for analysis page */
.hours-grid { overflow-x: auto; }

.hour-icon {
    display: inline-block;
    width: 28px;
    height: 28px;
}

.hour-icon svg {
    width: 100%;
    height: 100%;
}

/* ── Daily List ──────────────────────────────────────────────────────────── */

.daily-list {
    display: flex;
    flex-direction: column;
}

.daily-entry {
    border-bottom: 1px solid var(--color-border);
}

.daily-entry:last-child {
    border-bottom: none;
}

/* day | icon | temp | spacer | wind | rain% */
.daily-summary {
    display: grid;
    grid-template-columns: 52px 32px 48px 1fr 54px 38px;
    align-items: center;
    gap: 6px;
    padding: 13px 0;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.1s;
}

.daily-summary:active {
    background: var(--color-hover);
}

.daily-day-col {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.daily-dayname {
    font-size: 15px;
    font-weight: 600;
    color: var(--color-text);
}

.daily-daynum {
    font-size: 12px;
    color: var(--color-muted);
}

.daily-badge {
    font-size: 11px;
    font-weight: 600;
    color: var(--color-primary);
}

.daily-icon-col {
    display: flex;
    align-items: center;
    justify-content: center;
}

.daily-icon-col svg,
.daily-icon-col .hour-icon {
    width: 30px;
    height: 30px;
    display: block;
}

.daily-icon-col .hour-icon svg {
    width: 30px;
    height: 30px;
}

.daily-desc-col {
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: hidden;
}

.daily-condition {
    font-size: 14px;
    color: var(--color-text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.daily-wind-col {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.daily-wind-val {
    font-size: 12px;
    color: var(--color-muted);
    font-weight: 500;
    white-space: nowrap;
}

.daily-rain-col {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.daily-rain-label {
    font-size: 13px;
    color: var(--color-precip);
    font-weight: 600;
}

.daily-temps-col {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.daily-high {
    font-size: 17px;
    font-weight: 600;
    line-height: 1;
}

.daily-low {
    font-size: 13px;
    color: var(--color-muted);
    line-height: 1;
}

/* Daily expandable hourly sub-row */
.daily-hourly-detail {
    padding: 0 0 10px;
}

.daily-hourly-detail.hidden {
    display: none;
}

.source-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    font-size: 10px;
    font-weight: 600;
    background: var(--color-primary);
    color: var(--color-on-primary);
    border-radius: 9px;
    margin-left: 4px;
}

.sources-popup {
    position: absolute;
    z-index: 1000;
    background: var(--color-surface);
    border-radius: var(--radius-card);
    min-width: 220px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.18);
    overflow: hidden;
}

.sources-popup-header {
    font-size: 12px;
    font-weight: 500;
    color: var(--color-primary);
    padding: 10px 14px;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-hover);
}

.sources-popup-list {
    max-height: 220px;
    overflow-y: auto;
}

.sources-popup-item {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 8px;
    padding: 8px 14px;
    font-size: 13px;
    border-bottom: 1px solid var(--color-border);
}

.sources-popup-item:last-child {
    border-bottom: none;
}

.sources-popup-item.selected {
    background: var(--color-hover);
    color: var(--color-primary);
}

.popup-source-name {
    font-weight: 500;
}

.popup-source-temp {
    font-weight: 600;
}

.popup-source-points {
    font-size: 11px;
    color: var(--color-muted);
    min-width: 28px;
    text-align: right;
}

.popup-source-confidence {
    font-weight: 600;
    min-width: 35px;
    text-align: right;
    color: var(--color-primary);
}

.day-name {
    font-size: 15px;
    font-weight: 500;
}

/* Relative dates */
.day-badge {
    display: inline;
    background: none;
    color: var(--color-text-secondary);
    font-size: 14px;
    font-weight: 400;
    padding: 0;
    margin-left: 6px;
    border-radius: 0;
}

.day-range {
    text-align: right;
    font-size: 17px;
    font-weight: 600;
}

.temp-low {
    color: var(--color-text-secondary);
    margin-left: 6px;
    font-weight: 400;
}

/* Condensed hourly (in daily expand) */
.day-hourly-condensed {
    display: flex;
    overflow-x: auto;
    gap: 0;
    padding: 2px 0 6px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.day-hourly-condensed::-webkit-scrollbar {
    display: none;
}

.day-hour-mini {
    flex-shrink: 0;
    padding: 6px 10px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    min-width: 52px;
}

.day-hour-time {
    font-weight: 500;
    font-size: 11px;
    color: var(--color-muted);
}

.day-hour-temp {
    font-size: 13px;
    font-weight: 600;
}

.day-hour-meta {
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 10px;
    white-space: nowrap;
}

.day-hour-wind {
    color: var(--color-muted);
    font-weight: 500;
}

.day-hour-precip {
    font-weight: 600;
}

/* ── Skeleton loading ───────────────────────────────────────────────────── */
@keyframes skel-pulse {
    0%, 100% { opacity: 0.45; }
    50%       { opacity: 0.9; }
}

.skel {
    background: var(--color-border);
    border-radius: 4px;
    animation: skel-pulse 1.4s ease-in-out infinite;
}

.skel-sm   { width: 32px; height: 10px; }
.skel-md   { width: 44px; height: 14px; }
.skel-icon { width: 28px; height: 28px; border-radius: 50%; }
.skel-line { width: 52px; height: 12px; }
.skel-temp { width: 38px; height: 16px; }

.skel-daily-row {
    pointer-events: none;
}

.day-no-hourly {
    padding: 12px;
    text-align: center;
    font-size: 12px;
    color: var(--color-muted);
    flex: 1;
}

/* Loading states */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    font-size: 14px;
    color: var(--color-text-secondary);
}

.loading-text {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    color: var(--color-text-secondary);
}

.loading::after,
.loading-text::after {
    content: '';
    width: 20px;
    height: 20px;
    margin-left: 12px;
    border: 2.5px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Error states */
.error {
    padding: 28px 24px;
    text-align: center;
}

.error-title {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--color-text);
}

.error-message {
    font-size: 14px;
    color: var(--color-text-secondary);
    margin-bottom: 20px;
}

.retry-button {
    background: var(--color-primary);
    color: var(--color-on-primary);
    border: none;
    padding: 12px 28px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--radius-chip);
    min-height: var(--min-touch-target);
    box-shadow: 0 2px 8px rgba(21,101,192,0.3);
    transition: background 0.15s;
}

.retry-button:hover {
    background: var(--color-primary-dark);
}

.retry-button:focus-visible {
    outline: 3px solid var(--color-primary);
    outline-offset: 3px;
}

/* Bottom navigation bar */
.bottom-bar {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 600px;
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: 60px;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: #ffffff;
    border-top: 1px solid var(--color-border);
    box-shadow: 0 -2px 12px rgba(0,0,0,0.06);
    z-index: 50;
}

.bottom-bar-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 44px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-muted);
    border-radius: 12px;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}

.bottom-bar-btn:hover {
    background: var(--color-hover);
    color: var(--color-primary);
}

.bottom-bar-btn:active {
    transform: scale(0.95);
}

.bottom-bar-btn:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

.bottom-bar-btn svg {
    width: 22px;
    height: 22px;
}

.refresh-icon.spinning {
    animation: spin 1s linear infinite;
}

/* Search overlay */
.search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 100;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 80px;
}

.search-container {
    background: var(--color-surface);
    border-radius: var(--radius-card);
    max-width: 500px;
    width: 90%;
    padding: 20px;
    position: relative;
    box-shadow: 0 16px 40px rgba(0,0,0,0.22);
}

.search-input-row {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 12px;
}

.search-input-row input {
    flex: 1;
    padding: 12px 16px;
    border: 1.5px solid var(--color-border);
    border-radius: 10px;
    font-family: inherit;
    font-size: 15px;
    color: var(--color-text);
    background: var(--color-surface);
    transition: border-color 0.15s;
}

.search-input-row input:focus {
    outline: none;
    border-color: var(--color-primary);
}

.gps-btn {
    color: var(--color-primary) !important;
    flex-shrink: 0;
}

.saved-locations {
    margin-bottom: 8px;
}

.saved-locations-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-muted);
    margin-bottom: 6px;
}

.saved-location-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    color: var(--color-text);
    transition: background 0.1s;
}

.saved-location-item:hover {
    background: var(--color-hover);
}

.saved-pin-icon {
    color: var(--color-secondary);
    flex-shrink: 0;
}

.search-container input {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid var(--color-border);
    border-radius: 10px;
    font-family: inherit;
    font-size: 15px;
    margin-bottom: 12px;
    color: var(--color-text);
    background: var(--color-surface);
    transition: border-color 0.15s;
}

.search-container input:focus {
    outline: none;
    border-color: var(--color-primary);
}

.icon-btn {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    font-size: 22px;
    font-family: inherit;
    min-width: var(--min-touch-target);
    min-height: var(--min-touch-target);
    color: var(--color-text-secondary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    background: var(--color-hover);
}

.icon-btn:focus-visible {
    outline: 3px solid var(--color-primary);
    outline-offset: 2px;
}

#close-search {
    flex-shrink: 0;
}

.search-results {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 300px;
    overflow-y: auto;
}

.search-result-item {
    padding: 12px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    color: var(--color-text);
    transition: background 0.1s;
}

.search-result-item:hover {
    background: var(--color-hover);
}

.search-result-item:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: -2px;
}

/* Day source label */
.day-source-label {
    font-size: 11px;
    color: var(--color-muted);
}

/* High contrast mode */
@media (prefers-contrast: high) {
    :root {
        --color-border: #767676;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
    }
}

/* Responsive */
@media (max-width: 420px) {
    header {
        padding: 10px 16px;
    }

    .current-weather {
        padding: 12px 16px 10px;
    }

    section {
        padding: 12px 16px 10px;
    }

    .current-temp {
        font-size: clamp(48px, 16vw, 72px);
    }

    .weather-icon {
        width: 60px;
        height: 60px;
    }

    .forecast-table {
        font-size: 12px;
    }

    .forecast-table th,
    .forecast-table td {
        padding: 8px 6px;
    }

    .daily-summary {
        grid-template-columns: 46px 28px 44px 1fr 50px 36px;
        gap: 5px;
    }
}

/* Credits footer */
.credits {
    text-align: center;
    padding: 20px 16px;
    font-size: 12px;
    color: var(--color-muted);
    margin-top: 12px;
}

.credits a {
    color: var(--color-primary);
    text-decoration: none;
}

.credits a:hover {
    text-decoration: underline;
}

.compare-link {
    font-weight: 500;
    font-size: 13px;
    display: inline-block;
    margin-bottom: 8px;
    color: var(--color-primary);
}

/* RTL support */
[dir="rtl"] .temp-low {
    margin-left: 0;
    margin-right: 6px;
}

[dir="rtl"] .day-badge {
    margin-left: 0;
    margin-right: 6px;
}

/* ─── Analysis page ─────────────────────────────────────────────────── */

body.analysis-page {
    max-width: 100%;
}

body.analysis-page header,
body.analysis-page nav.view-tabs,
body.analysis-page .source-filter,
body.analysis-page main,
body.analysis-page footer.credits {
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
}

.back-link {
    display: inline-block;
    font-size: 12px;
    font-weight: 500;
    color: rgba(255,255,255,0.75);
    text-decoration: none;
    margin-bottom: 2px;
    letter-spacing: 0.02em;
}

.back-link:hover {
    color: #FFFFFF;
}

/* Analysis tabs */
.view-tabs {
    display: flex;
    background: var(--color-surface);
    padding: 0 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.tab-btn {
    font-family: 'Roboto', sans-serif;
    font-size: 14px;
    font-weight: 500;
    padding: 14px 20px;
    border: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -1px;
    background: none;
    color: var(--color-text-secondary);
    cursor: pointer;
    min-height: var(--min-touch-target);
    letter-spacing: 0.02em;
    transition: color 0.15s;
}

.tab-btn.active,
.tab-btn[aria-pressed="true"] {
    color: var(--color-secondary);
    border-bottom-color: var(--color-secondary);
}

.tab-btn:hover:not(.active) {
    background: var(--color-hover);
    color: var(--color-text);
}

.tab-btn:focus-visible {
    outline: 3px solid var(--color-primary);
    outline-offset: -3px;
}

/* Source filter chip strip */
.source-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 16px;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    min-height: 52px;
}

.source-chip {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    border-radius: var(--radius-chip);
    border: 1.5px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text-secondary);
    font-family: 'Roboto', sans-serif;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    min-height: 34px;
}

.source-chip.active {
    background: var(--color-secondary);
    color: var(--color-on-secondary);
    border-color: var(--color-secondary);
}

.source-chip:hover:not(.active) {
    border-color: var(--color-secondary);
    color: var(--color-secondary);
    background: var(--color-hover);
}

.source-chip:focus-visible {
    outline: 3px solid var(--color-primary);
    outline-offset: 2px;
}

/* Consensus + the user's algorithms — set apart from the raw model chips. */
.source-chip-virtual {
    border-color: var(--color-primary);
    color: var(--color-primary);
    font-weight: 700;
}

.source-chip-virtual.active {
    background: var(--color-primary);
    color: var(--color-on-primary, #fff);
    border-color: var(--color-primary);
}

.source-chip.no-data {
    opacity: 0.4;
    cursor: default;
    border-style: dashed;
    text-decoration: line-through;
}

.source-chip.no-data:hover {
    background: var(--color-surface);
    border-color: var(--color-border);
    color: var(--color-text-secondary);
}

/* Analysis table */
.analysis-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.analysis-table {
    min-width: max-content;
    table-layout: auto;
}

.analysis-table .cell-time-label {
    position: sticky;
    left: 0;
    background: var(--color-surface);
    z-index: 2;
    min-width: 70px;
    border-right: 1px solid var(--color-border);
}

.analysis-table .cell-source-header {
    min-width: 90px;
    text-align: center;
    white-space: nowrap;
}

.analysis-table .cell-time {
    position: sticky;
    left: 0;
    background: var(--color-surface);
    z-index: 1;
    font-weight: 500;
    border-right: 1px solid var(--color-border);
}

.analysis-table tr.row-current td {
    background: var(--color-hover);
}

.analysis-table tr.row-current .cell-time {
    background: var(--color-hover);
}

.cell-temp-analysis {
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    min-width: 70px;
}

.cell-day-temps {
    font-size: 13px;
    text-align: center;
    min-width: 100px;
    white-space: nowrap;
}

.temp-low-label {
    color: var(--color-text-secondary);
    font-size: 12px;
}

.day-sep {
    color: var(--color-border);
}

.day-badge-today {
    font-size: 10px;
    padding: 2px 8px;
    background: var(--color-primary);
    color: var(--color-on-primary);
    border-radius: 10px;
    font-weight: 500;
    margin-left: 4px;
}

#main-content {
    padding: 0;
}

body.analysis-page #main-content {
    padding: 0;
}

body.analysis-page section,
body.analysis-page .analysis-scroll {
    margin: 0;
    border-radius: 0;
    box-shadow: none;
}

/* ── Kids Weather Page ─────────────────────────────────────────────────── */

body.kids-page {
    background: #FFFDF7;
    min-height: 100vh;
    min-height: 100dvh;
}

body.kids-page #main-content {
    padding: 0;
}

.kids-loading {
    text-align: center;
    padding: 60px 20px;
    font-size: 18px;
    color: var(--color-muted);
}

/* Section layout */
.kids-section {
    padding: 0 16px 12px;
}

.kids-section-first {
    padding-top: 16px;
}

.kids-section-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--color-text);
}

/* Clothing grid — prominent */
.kids-clothing-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.kids-clothing-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 14px;
    background: var(--color-surface);
    border-radius: 18px;
    box-shadow: var(--shadow-card);
    border: 2px solid var(--color-border, #e0e0e0);
}

.kids-clothing-emoji {
    font-size: 36px;
    flex-shrink: 0;
    width: 44px;
    text-align: center;
}

.kids-clothing-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--color-text);
    line-height: 1.2;
}

.kids-clothing-desc {
    font-size: 13px;
    color: var(--color-muted);
    line-height: 1.3;
    margin-top: 2px;
}

/* Bike section — bold and clear */
.kids-bike-inline {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-radius: 18px;
    font-size: 20px;
    font-weight: 600;
    color: var(--color-text);
    border: 2px solid transparent;
}

.kids-bike-inline span:first-child {
    font-size: 28px;
}

.kids-bike-inline.kids-bike-yes {
    background: #E8F5E9;
    border-color: #A5D6A7;
}

.kids-bike-inline.kids-bike-no {
    background: #FBE9E7;
    border-color: #FFAB91;
}

/* Muted section title for weather */
.kids-section-title-muted {
    font-size: 16px;
    font-weight: 500;
    color: var(--color-muted);
}

/* Weather summary — subtle */
.kids-weather-summary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-radius: 14px;
    opacity: 0.8;
}

.kids-summary-emoji {
    font-size: 28px;
    line-height: 1;
}

.kids-summary-temp {
    font-size: 22px;
    font-weight: 700;
    color: var(--color-text);
}

.kids-summary-label {
    font-size: 14px;
    color: var(--color-text-secondary);
}

@media (max-width: 380px) {
    .kids-clothing-grid {
        grid-template-columns: 1fr;
    }
}

/* ── Kids Theme Bar ─────────────────────────────────────────────────────── */

.kids-theme-bar {
    display: flex;
    justify-content: center;
    gap: 4px;
    padding: 8px 16px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 20;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

body.kids-page main {
    padding-bottom: 72px;
}

.theme-btn {
    font-size: 22px;
    padding: 4px 8px;
    border-radius: 10px;
    border: 2px solid transparent;
    background: transparent;
    cursor: pointer;
    transition: transform 0.12s, border-color 0.15s, background 0.15s;
    min-height: 40px;
    min-width: 40px;
    line-height: 1;
    flex-shrink: 0;
}

.theme-btn:hover:not(.active) {
    transform: scale(1.15);
    background: rgba(255,255,255,0.4);
}

.theme-btn.active {
    border-color: var(--color-text);
    background: rgba(255,255,255,0.5);
    transform: scale(1.05);
}

.theme-btn:focus-visible {
    outline: 2px solid var(--color-text);
    outline-offset: 2px;
}

/* ── Kids Themes ────────────────────────────────────────────────────────── */

/* Pink & Candy */
body.kids-page.theme-pink {
    background: #FFF0F8;
    --color-primary: #D81B60;
    --color-primary-dark: #AD1457;
    --color-on-primary: #FFFFFF;
    --color-surface: #FFF0F8;
    --color-text: #2C0A1F;
    --color-text-secondary: #880E4F;
    --color-muted: #AD1457;
    --color-border: #F8BBD9;
    --color-hover: #FCE4EC;
}

body.kids-page.theme-pink .kids-section-title {
    color: #D81B60;
}

body.kids-page.theme-pink .kids-clothing-card {
    background: #FCE4EC;
    border-color: #F48FB1;
}

body.kids-page.theme-pink .kids-bike-inline.kids-bike-yes {
    background: #F8BBD9;
    border-color: #F06292;
    color: #2C0A1F;
}

body.kids-page.theme-pink .kids-bike-inline.kids-bike-no {
    background: #FCE4EC;
    border-color: #EF9A9A;
    color: #2C0A1F;
}

body.kids-page.theme-pink .kids-theme-bar {
    background: rgba(216,27,96,0.1);
    border-color: #F48FB1;
}

/* Gamer */
body.kids-page.theme-gamer {
    background: #0D0D18;
    --color-primary: #1A1A2E;
    --color-primary-dark: #0D0D18;
    --color-on-primary: #00E5FF;
    --color-surface: #16213E;
    --color-text: #E0E0FF;
    --color-text-secondary: #B0BEC5;
    --color-muted: #7986CB;
    --color-border: #0F3460;
    --color-hover: #0F3460;
}

body.kids-page.theme-gamer .kids-section-title {
    color: #00E5FF;
}

body.kids-page.theme-gamer .kids-clothing-card {
    background: #1E1E3A;
    border-color: #3D5AFE;
}

body.kids-page.theme-gamer .kids-bike-inline.kids-bike-yes {
    background: #0A2744;
    border-color: #00E5FF;
    color: #E0E0FF;
}

body.kids-page.theme-gamer .kids-bike-inline.kids-bike-no {
    background: #3B0D0D;
    border-color: #FF1744;
    color: #E0E0FF;
}

body.kids-page.theme-gamer .kids-weather-summary {
    background: #1E1E3A !important;
    opacity: 1;
}

body.kids-page.theme-gamer .kids-summary-temp,
body.kids-page.theme-gamer .kids-summary-label {
    color: #E0E0FF;
}

body.kids-page.theme-gamer .kids-theme-bar {
    background: rgba(0,229,255,0.08);
    border-color: #0F3460;
}

/* Fortnite */
body.kids-page.theme-fortnite {
    background: #111B30;
    --color-primary: #0F1F3D;
    --color-primary-dark: #090F1F;
    --color-on-primary: #FFE100;
    --color-surface: #1A2A4A;
    --color-text: #FFFFFF;
    --color-text-secondary: #B0C4DE;
    --color-muted: #7B97C3;
    --color-border: #2A4070;
    --color-hover: #243558;
}

body.kids-page.theme-fortnite .kids-section-title {
    color: #FFE100;
}

body.kids-page.theme-fortnite .kids-clothing-card {
    background: #1A2A4A;
    border-color: #3D5A8A;
}

body.kids-page.theme-fortnite .kids-bike-inline.kids-bike-yes {
    background: #0D2B0D;
    border-color: #00C853;
    color: #FFFFFF;
}

body.kids-page.theme-fortnite .kids-bike-inline.kids-bike-no {
    background: #3B0D00;
    border-color: #FF3D00;
    color: #FFFFFF;
}

body.kids-page.theme-fortnite .kids-weather-summary {
    background: #1A2A4A !important;
    opacity: 1;
}

body.kids-page.theme-fortnite .kids-summary-temp,
body.kids-page.theme-fortnite .kids-summary-label {
    color: #FFFFFF;
}

body.kids-page.theme-fortnite .kids-theme-bar {
    background: rgba(255,225,0,0.08);
    border-color: #2A4070;
}

/* Matrix */
body.kids-page.theme-matrix {
    background: #000000;
    --color-primary: #001100;
    --color-primary-dark: #000800;
    --color-on-primary: #00FF41;
    --color-surface: #001A00;
    --color-text: #00FF41;
    --color-text-secondary: #00CC33;
    --color-muted: #009922;
    --color-border: #003300;
    --color-hover: #002200;
    font-family: 'Courier New', Courier, monospace;
}

body.kids-page.theme-matrix .kids-section-title {
    color: #00FF41;
    text-shadow: 0 0 8px rgba(0,255,65,0.6);
}

body.kids-page.theme-matrix .kids-clothing-card {
    background: #001A00;
    border-color: #00AA22;
}

body.kids-page.theme-matrix .kids-clothing-name,
body.kids-page.theme-matrix .kids-clothing-desc {
    color: #00FF41;
    font-family: 'Courier New', Courier, monospace;
}

body.kids-page.theme-matrix .kids-clothing-desc {
    color: #009922;
}

body.kids-page.theme-matrix .kids-bike-inline.kids-bike-yes {
    background: #002800;
    border-color: #00FF41;
    color: #00FF41;
}

body.kids-page.theme-matrix .kids-bike-inline.kids-bike-no {
    background: #280000;
    border-color: #FF3333;
    color: #FF6666;
}

body.kids-page.theme-matrix .kids-weather-summary {
    background: #001A00 !important;
    opacity: 1;
}

body.kids-page.theme-matrix .kids-summary-temp,
body.kids-page.theme-matrix .kids-summary-label {
    color: #00FF41;
}

body.kids-page.theme-matrix .kids-theme-bar {
    background: #000800;
    border-color: #003300;
}

/* ── Trip Forecast (Vacation) Page ──────────────────────────────────────────── */

.vac-add-btn {
    background: rgba(255,255,255,0.18);
    border: 1.5px solid rgba(255,255,255,0.5);
    color: #fff;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    padding: 6px 16px;
    border-radius: var(--radius-chip);
    cursor: pointer;
    min-height: 36px;
    letter-spacing: 0.02em;
    transition: background 0.15s;
}

.vac-add-btn:hover {
    background: rgba(255,255,255,0.3);
}

.vac-add-btn:focus-visible {
    outline: 2px solid rgba(255,255,255,0.8);
    outline-offset: 2px;
}

/* Active bottom bar icon */
.bottom-bar-btn.active-page {
    color: var(--color-primary);
}

/* Vacation list */
.vac-list {
    padding: 16px 16px 80px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Empty state */
.vac-empty {
    text-align: center;
    padding: 64px 20px 40px;
    color: var(--color-text-secondary);
}

.vac-empty-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 16px;
}

.vac-empty-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 8px;
}

.vac-empty-hint {
    font-size: 14px;
    color: var(--color-text-secondary);
}

/* Trip card */
.vac-card {
    border: 1px solid var(--color-border-strong);
    border-radius: 12px;
    overflow: hidden;
    background: var(--color-surface);
}

.vac-card-header {
    padding: 14px 16px 10px;
    cursor: default;
}

.vac-card-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.vac-location-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vac-trip-label {
    font-size: 11px;
    font-weight: 500;
    color: var(--color-text-secondary);
    background: var(--color-border);
    padding: 2px 8px;
    border-radius: var(--radius-chip);
    white-space: nowrap;
    flex-shrink: 0;
}

.vac-remove-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-muted);
    font-size: 18px;
    line-height: 1;
    padding: 0;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.1s, color 0.1s;
}

.vac-remove-btn:hover {
    color: var(--color-text);
    background: var(--color-hover);
}

.vac-remove-btn:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

.vac-card-date-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.vac-date-text {
    font-size: 13px;
    color: var(--color-text-secondary);
}

.vac-duration-text {
    font-size: 11px;
    color: var(--color-muted);
    font-weight: 500;
}

.vac-days-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    background: var(--color-hover);
    color: var(--color-primary);
    border-radius: var(--radius-chip);
    border: 1px solid var(--color-border);
}

/* Card body */
.vac-card-body {
    border-top: 1px solid var(--color-border);
}

.vac-card-status {
    font-size: 13px;
    color: var(--color-text-secondary);
    padding: 14px 16px;
}

.vac-status-error {
    color: #dc2626;
}

/* Per-day list inside a trip */
.vac-days {
    display: flex;
    flex-direction: column;
}

.vac-day {
    border-bottom: 1px solid var(--color-border);
}

.vac-day:last-child {
    border-bottom: none;
}

/* Tappable day summary row */
.vac-day-summary {
    width: 100%;
    display: grid;
    /* Fixed date column so the weather icons line up in a single column
       across every row and card (Roboto is proportional, so an auto-width
       date drifts the icon for different weekdays / single-digit days). */
    grid-template-columns: 5.5rem auto 1fr auto auto;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: none;
    border: none;
    font-family: inherit;
    text-align: left;
    color: var(--color-text);
    cursor: pointer;
    transition: background 0.1s;
}

.vac-day-summary:hover {
    background: var(--color-hover);
}

.vac-day-summary[disabled] {
    cursor: default;
}

.vac-day-summary[disabled] .vac-day-chevron {
    display: none;
}

.vac-day-date {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text);
    white-space: nowrap;
}

.vac-day-icon {
    display: flex;
    align-items: center;
}

.vac-day-icon .hour-icon {
    width: 28px;
    height: 28px;
    display: block;
}

.vac-day-body {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.vac-day-cond {
    font-size: 13px;
    color: var(--color-text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vac-day-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--color-muted);
    white-space: nowrap;
}

.vac-day-sep {
    color: var(--color-border-strong);
}

.vac-day-wind {
    font-weight: 500;
}

.vac-day-precip {
    font-weight: 600;
}

.vac-day-temps {
    display: flex;
    align-items: baseline;
    gap: 4px;
    white-space: nowrap;
    justify-self: end;
}

.vac-temp-high {
    font-size: 18px;
    font-weight: 600;
    line-height: 1;
}

.vac-temp-sep {
    color: var(--color-muted);
    font-size: 13px;
}

.vac-temp-low {
    font-size: 14px;
    color: var(--color-muted);
    font-weight: 400;
}

.vac-day-chevron {
    font-size: 12px;
    color: var(--color-muted);
    transition: transform 0.15s;
}

.vac-day-open .vac-day-chevron {
    transform: rotate(180deg);
}

/* Empty / unavailable day */
.vac-day-empty {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 16px;
}

.vac-day-empty .vac-day-note {
    font-size: 12px;
    color: var(--color-muted);
}

/* Hourly breakdown for a day */
.vac-day-hourly {
    padding: 0 8px 8px;
    background: var(--color-hover);
}

.vac-day-hourly.hidden {
    display: none;
}

/* Add trip form */
.add-trip-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 4px;
}

.add-trip-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.add-trip-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--color-text-secondary);
}

.add-trip-optional {
    font-size: 10px;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    color: var(--color-muted);
}

.add-trip-input {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--color-border-strong);
    border-radius: 10px;
    font-family: inherit;
    font-size: 15px;
    color: var(--color-text);
    background: var(--color-surface);
    transition: border-color 0.15s;
}

.add-trip-input:focus {
    outline: none;
    border-color: var(--color-primary);
}

/* Start / end date pair */
.add-trip-dates {
    display: flex;
    gap: 12px;
}

.add-trip-date-col {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.add-trip-sublabel {
    font-size: 11px;
    color: var(--color-muted);
    font-weight: 500;
}

/* Share button on trip card */
.vac-share-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-muted);
    padding: 6px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: var(--min-touch-target);
    min-height: var(--min-touch-target);
    transition: color 0.15s, background 0.15s;
}

.vac-share-btn:hover {
    color: var(--color-primary);
    background: var(--color-hover);
}

.vac-share-btn:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* Share invite overlay */
.share-invite-container {
    text-align: center;
}

.share-invite-body {
    padding: 20px 0 16px;
}

.share-invite-icon {
    font-size: 40px;
    display: block;
    margin-bottom: 12px;
}

.share-invite-name {
    font-size: 20px;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 6px;
}

.share-invite-dates {
    font-size: 14px;
    color: var(--color-text-secondary);
    margin-bottom: 4px;
}

.share-invite-label {
    font-size: 13px;
    color: var(--color-muted);
    font-style: italic;
}

.share-invite-prompt {
    font-size: 15px;
    color: var(--color-text-secondary);
    margin-bottom: 16px;
}

/* Toast notification */
.vac-toast {
    position: fixed;
    bottom: 88px;
    left: 50%;
    transform: translateX(-50%) translateY(8px);
    background: var(--color-text);
    color: var(--color-bg);
    font-size: 14px;
    font-weight: 500;
    padding: 10px 20px;
    border-radius: 24px;
    opacity: 0;
    transition: opacity 0.2s, transform 0.2s;
    pointer-events: none;
    z-index: 1000;
    white-space: nowrap;
}

.vac-toast.vac-toast-show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

@media (max-width: 420px) {
    .vac-list {
        padding: 12px 12px 80px;
    }

    .vac-day-summary {
        gap: 8px;
        padding: 10px 12px;
    }

    .vac-temp-high {
        font-size: 17px;
    }

    .vac-temp-low {
        font-size: 13px;
    }
}

/* ── Model Lab Page ────────────────────────────────────────────────────── */

.lab-page main {
    padding: 16px;
}

.lab-section {
    background: var(--color-surface);
    border: 1px solid var(--color-border-strong);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 20px;
}

.lab-section h2 {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.lab-hint {
    font-size: 12px;
    color: var(--color-text-secondary);
    margin-bottom: 12px;
}

.lab-chart svg {
    display: block;
    width: 100%;
    height: auto;
}

/* Chart primitives */
.lab-grid {
    stroke: var(--color-border-strong);
    stroke-width: 1;
}

.lab-daysep {
    stroke: var(--color-muted);
    stroke-width: 1;
    stroke-dasharray: 4 3;
}

.lab-axis {
    font-family: 'Roboto', sans-serif;
    font-size: 11px;
    fill: var(--color-text-secondary);
}

.lab-axis-dim {
    fill: var(--color-muted);
}

.lab-day-label {
    font-weight: 700;
    fill: var(--color-text);
}

.lab-band {
    fill: rgba(0, 99, 163, 0.10);
    stroke: none;
}

.lab-band-high {
    fill: rgba(217, 119, 6, 0.16);
    stroke: none;
}

.lab-band-low {
    fill: rgba(37, 99, 235, 0.14);
    stroke: none;
}

.lab-line {
    fill: none;
    stroke: #c3cbd4;
    stroke-width: 1;
}

.lab-line.hl {
    stroke: #111827;
    stroke-width: 2.5;
}

.lab-median {
    fill: none;
    stroke: var(--color-secondary);
    stroke-width: 2.5;
}

.lab-median-low {
    fill: none;
    stroke: var(--color-cold);
    stroke-width: 2;
    stroke-dasharray: 6 4;
}

/* Legend chips */
.lab-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.lab-chip {
    font-family: inherit;
    font-size: 11px;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: var(--radius-chip);
    border: 1.5px solid var(--color-border-strong);
    background: var(--color-surface);
    color: var(--color-text-secondary);
    cursor: pointer;
}

.lab-chip:hover {
    border-color: var(--color-secondary);
    color: var(--color-secondary);
}

.lab-chip.hl {
    background: var(--color-text);
    border-color: var(--color-text);
    color: var(--color-surface);
}

.lab-chip:focus-visible {
    outline: 3px solid var(--color-primary);
    outline-offset: 2px;
}

/* Agreement strip */
.lab-agree.agree-locked { fill: #059669; }
.lab-agree.agree-good   { fill: #0063a3; }
.lab-agree.agree-split  { fill: #d97706; }
.lab-agree.agree-chaos  { fill: #dc2626; }

.lab-agree-txt {
    font-family: 'Roboto', sans-serif;
    font-size: 9px;
    font-weight: 700;
    fill: #ffffff;
    pointer-events: none;
}

.lab-agree-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.lab-agree-key {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #ffffff;
    padding: 2px 8px;
    border-radius: 3px;
}

.lab-agree-key.agree-locked { background: #059669; }
.lab-agree-key.agree-good   { background: #0063a3; }
.lab-agree-key.agree-split  { background: #d97706; }
.lab-agree-key.agree-chaos  { background: #dc2626; }

/* Precipitation heatmap */
.lab-heatmap-table {
    border-collapse: collapse;
    width: 100%;
}

.lab-hm-label {
    font-size: 11px;
    font-weight: 500;
    text-align: left;
    color: var(--color-text-secondary);
    padding: 2px 8px 2px 0;
    white-space: nowrap;
}

.lab-hm-hour {
    font-size: 10px;
    font-weight: 400;
    color: var(--color-muted);
    text-align: center;
    padding-bottom: 4px;
}

.lab-hm-cell {
    height: 20px;
    min-width: 12px;
    border: 1px solid var(--color-surface);
}

.lab-hm-empty { background: transparent; }
.hm-0  { background: #f3f6f9; }
.hm-1  { background: rgba(59, 130, 246, 0.10); }
.hm-2  { background: rgba(59, 130, 246, 0.20); }
.hm-3  { background: rgba(59, 130, 246, 0.30); }
.hm-4  { background: rgba(59, 130, 246, 0.40); }
.hm-5  { background: rgba(59, 130, 246, 0.50); }
.hm-6  { background: rgba(59, 130, 246, 0.60); }
.hm-7  { background: rgba(59, 130, 246, 0.70); }
.hm-8  { background: rgba(59, 130, 246, 0.80); }
.hm-9  { background: rgba(59, 130, 246, 0.90); }
.hm-10 { background: rgba(59, 130, 246, 1.0); }

/* Scoreboard */
.lab-score-table {
    width: 100%;
    border-collapse: collapse;
}

.lab-score-table th,
.lab-score-table td {
    padding: 8px 10px;
    text-align: left;
    border-bottom: 1px solid var(--color-border-strong);
    font-size: 13px;
}

.lab-score-table th {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-secondary);
}

.lab-score-rank { width: 40px; text-align: center; }
.lab-score-mae,
.lab-score-n { text-align: right; font-variant-numeric: tabular-nums; }

.lab-score-best td {
    font-weight: 700;
    background: rgba(5, 150, 105, 0.08);
}

.lab-score-empty {
    border: 1.5px dashed var(--color-border-strong);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    color: var(--color-text-secondary);
    font-size: 13px;
}

.lab-score-empty-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 6px;
}

@media (max-width: 600px) {
    .lab-page main {
        padding: 10px;
    }

    .lab-section {
        padding: 12px;
    }

    .lab-hm-label {
        font-size: 10px;
    }
}

/* ── Wind Lab Page ─────────────────────────────────────────────────────── */

.wind-now-grid {
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
}

.wind-now-main {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.wind-now-speed {
    font-size: 52px;
    font-weight: 700;
    line-height: 1;
}

.wind-now-unit {
    font-size: 18px;
    color: var(--color-text-secondary);
}

.wind-now-main .wind-arrow {
    font-size: 28px;
    display: inline-block;
}

.wind-now-stats {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.wind-now-stat {
    display: flex;
    flex-direction: column;
}

.wns-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-muted);
}

.wns-val {
    font-size: 16px;
    font-weight: 500;
}

.wind-gusty-badge {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: #fff;
    padding: 3px 10px;
    border-radius: 3px;
}

.gusty-low  { background: #059669; }
.gusty-mid  { background: #d97706; }
.gusty-high { background: #dc2626; }

/* Wind chart */
.wind-band {
    fill: rgba(0, 99, 163, 0.12);
    stroke: none;
}

.wind-median {
    fill: none;
    stroke: var(--color-secondary);
    stroke-width: 2.5;
}

.wind-gust-line {
    fill: none;
    stroke: #dc2626;
    stroke-width: 1.8;
    stroke-dasharray: 6 4;
}

.wind-svg-arrow path {
    fill: var(--color-text-secondary);
}

.wind-chart-legend {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    margin-top: 8px;
    font-size: 11px;
    color: var(--color-text-secondary);
}

.wcl-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.wcl-swatch {
    display: inline-block;
    width: 16px;
    height: 4px;
    border-radius: 2px;
}

.wcl-median { background: var(--color-secondary); }
.wcl-gust   { background: repeating-linear-gradient(90deg, #dc2626 0 4px, transparent 4px 7px); }
.wcl-band   { background: rgba(0, 99, 163, 0.2); height: 10px; }
.wcl-wave   { background: #0063a3; }
.wcl-swell  { background: repeating-linear-gradient(90deg, #7c3aed 0 4px, transparent 4px 7px); }

/* Presets + range */
.wind-presets {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.wind-preset-range {
    opacity: 0.7;
    font-weight: 400;
}

.wind-range-row {
    margin-bottom: 14px;
}

.wind-range-label {
    font-size: 12px;
    color: var(--color-text-secondary);
}

.wind-range-input {
    width: 56px;
    padding: 5px 8px;
    font-family: inherit;
    font-size: 13px;
    border: 1.5px solid var(--color-border-strong);
    border-radius: 6px;
    text-align: center;
}

.wind-range-input:focus-visible {
    outline: 3px solid var(--color-primary);
    outline-offset: 1px;
}

/* Window cards */
.wind-window {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 12px 14px;
    border: 1.5px solid var(--color-border-strong);
    border-radius: 8px;
    margin-bottom: 8px;
}

.wind-window-best {
    border-color: #059669;
    background: rgba(5, 150, 105, 0.06);
}

.wind-window-when {
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.ww-day {
    font-size: 15px;
    font-weight: 700;
}

.ww-time {
    font-size: 14px;
    font-variant-numeric: tabular-nums;
}

.ww-len {
    font-size: 11px;
    font-weight: 700;
    color: var(--color-on-secondary);
    background: var(--color-secondary);
    border-radius: 3px;
    padding: 1px 6px;
}

.wind-window-stats {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    font-size: 13px;
    color: var(--color-text-secondary);
}

.ww-stat strong {
    color: var(--color-text);
    font-size: 15px;
}

.ww-agree {
    font-size: 11px;
    font-weight: 700;
    color: #059669;
    border: 1.5px solid #059669;
    border-radius: 3px;
    padding: 1px 6px;
}

/* Wind rose */
.wind-rose-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.wind-rose-svg {
    max-width: 400px;
}

.rose-ring {
    fill: none;
    stroke: var(--color-border-strong);
    stroke-width: 1;
}

.rose-cardinal {
    font-family: 'Roboto', sans-serif;
    font-size: 13px;
    font-weight: 700;
    fill: var(--color-text-secondary);
}

.rose-bin { stroke: #ffffff; stroke-width: 0.5; }
.rose-b0 { fill: #bfdbfe; }
.rose-b1 { fill: #60a5fa; }
.rose-b2 { fill: #1d4ed8; }
.rose-b3 { fill: #dc2626; }

.rose-swatch-b0 { background: #bfdbfe; height: 10px; }
.rose-swatch-b1 { background: #60a5fa; height: 10px; }
.rose-swatch-b2 { background: #1d4ed8; height: 10px; }
.rose-swatch-b3 { background: #dc2626; height: 10px; }

/* Marine */
.marine-wave {
    fill: none;
    stroke: #0063a3;
    stroke-width: 2.5;
}

.marine-swell {
    fill: none;
    stroke: #7c3aed;
    stroke-width: 1.8;
    stroke-dasharray: 6 4;
}

@media (max-width: 600px) {
    .wind-now-speed {
        font-size: 40px;
    }

    .wind-now-grid {
        gap: 14px;
    }
}

/* ── Weather Map Page ──────────────────────────────────────────────────── */

.map-layers {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.map-layer-chip[disabled] {
    opacity: 0.4;
    cursor: not-allowed;
}

.map-canvas {
    height: 440px;
    border: 1px solid var(--color-border-strong);
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    z-index: 0; /* keep Leaflet panes under the app's overlays */
}

.map-canvas .loading-text {
    padding-top: 190px;
    text-align: center;
}

/* Forecast-cell value labels ride on Leaflet tooltips; strip the bubble. */
.map-cell-tip {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
    pointer-events: none;
    text-align: center;
}

.map-cell-tip::before {
    display: none;
}

.mct-val {
    display: block;
    font-family: 'Roboto', sans-serif;
    font-size: 13px;
    font-weight: 700;
    color: #111827;
    text-shadow: 0 0 3px #ffffff, 0 0 6px #ffffff;
}

.mct-arrow {
    display: block;
    margin: 0 auto;
}

.mct-arrow path {
    fill: #1f2937;
    stroke: #ffffff;
    stroke-width: 1.5;
}

/* Numbered beach pins (Leaflet divIcons) */
.map-pin-icon span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #111827;
    border: 2px solid #ffffff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
    color: #ffffff;
    font-family: 'Roboto', sans-serif;
    font-size: 13px;
    font-weight: 700;
}

.leaflet-container {
    font-family: 'Roboto', 'Segoe UI', sans-serif;
}

/* Animated wind streaks */
.wind-particle-canvas {
    pointer-events: none;
}

.wind-particle-hidden {
    visibility: hidden;
}

/* Isobar labels (pressure layer) */
.iso-label span {
    display: block;
    text-align: center;
    font-family: 'Roboto', sans-serif;
    font-size: 11px;
    font-weight: 700;
    color: #334155;
    background: rgba(255, 255, 255, 0.75);
    border-radius: 7px;
    padding: 0 4px;
}

.map-legend {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
    font-size: 12px;
    color: var(--color-text-secondary);
}

.map-legend-bar {
    flex: 1;
    min-width: 120px;
    height: 10px;
    border-radius: 5px;
    border: 1px solid var(--color-border-strong);
}

.map-legend-hint {
    flex-basis: 100%;
    color: var(--color-muted);
}

.map-time-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
}

.map-play-btn {
    flex: none;
    width: 36px;
    height: 36px;
    border: 1.5px solid var(--color-border-strong);
    border-radius: 50%;
    background: var(--color-surface);
    font-size: 14px;
    cursor: pointer;
}

.map-play-btn:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.map-time-slider {
    flex: 1;
    accent-color: var(--color-primary);
    min-width: 0;
}

.map-time-label {
    flex: none;
    font-size: 13px;
    font-weight: 700;
    min-width: 96px;
    text-align: right;
}

.map-cell-info[hidden] {
    display: none;
}

.map-cell-info {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    margin-top: 12px;
    padding: 10px 12px;
    border: 1px solid var(--color-border-strong);
    border-radius: 8px;
    background: var(--color-hover);
    font-size: 13px;
}

.mci-title {
    flex-basis: 100%;
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-secondary);
}

.mci-label {
    color: var(--color-text-secondary);
    margin-right: 2px;
}

/* Beaches */

.beach-reco-card {
    border: 2px solid var(--color-border-strong);
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 14px;
}

.beach-reco-card.surf-epic { border-color: #059669; background: #ecfdf5; }
.beach-reco-card.surf-good { border-color: #0063a3; background: #eff6ff; }

.beach-reco-card.family { border-color: #0284c7; background: #f0f9ff; }
.beach-reco-card.family.family-poor { border-color: #94a3b8; background: #f8fafc; }

.beach-reco-head {
    display: flex;
    align-items: center;
    gap: 12px;
}

.beach-reco-emoji {
    font-size: 28px;
}

.beach-reco-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-secondary);
}

.beach-reco-name {
    font-size: 17px;
    font-weight: 700;
}

.beach-reco-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    margin-top: 10px;
    font-size: 13px;
    color: var(--color-text);
}

.beach-suit {
    font-weight: 500;
}

.beach-score-badge {
    margin-left: auto;
    font-size: 22px;
    font-weight: 700;
    padding: 6px 12px;
    border-radius: 8px;
    background: var(--color-text);
    color: var(--color-surface);
}

.beach-score-badge small {
    font-size: 11px;
    font-weight: 400;
    opacity: 0.7;
}

.beach-score-badge.surf-epic { background: #059669; }
.beach-score-badge.surf-good { background: #0063a3; }
.beach-score-badge.surf-fair { background: #d97706; }
.beach-score-badge.surf-poor,
.beach-score-badge.surf-flat { background: #6b7280; }

.beach-score-badge.family-great { background: #0369a1; }
.beach-score-badge.family-good { background: #0284c7; }
.beach-score-badge.family-fair { background: #0891b2; }
.beach-score-badge.family-poor { background: #6b7280; }

.beach-row {
    display: flex;
    gap: 12px;
    padding: 12px 4px;
    border-bottom: 1px solid var(--color-border);
}

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

.beach-row-nosurf {
    opacity: 0.8;
}

.beach-num {
    flex: none;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #111827;
    color: #ffffff;
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 2px;
}

.beach-row-main {
    flex: 1;
    min-width: 0;
}

.beach-row-name {
    font-size: 15px;
    font-weight: 700;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.beach-dist {
    font-size: 12px;
    font-weight: 400;
    color: var(--color-text-secondary);
}

.beach-rating {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 2px 8px;
    border-radius: 10px;
    color: #ffffff;
    background: #6b7280;
}

.beach-rating.surf-epic { background: #059669; }
.beach-rating.surf-good { background: #0063a3; }
.beach-rating.surf-fair { background: #d97706; }
.beach-rating.surf-none { background: #9ca3af; }

.beach-rating.family-great { background: #0369a1; }
.beach-rating.family-good { background: #0284c7; }
.beach-rating.family-fair { background: #0891b2; }
.beach-rating.family-poor { background: #6b7280; }
.beach-rating.family-none { background: #9ca3af; }

.beach-row-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 12px;
    margin-top: 4px;
    font-size: 12.5px;
    color: var(--color-text-secondary);
}

.beach-wind-chip {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 2px 7px;
    border-radius: 9px;
    color: #ffffff;
}

.beach-wind-chip.wind-off   { background: #059669; }
.beach-wind-chip.wind-cross { background: #d97706; }
.beach-wind-chip.wind-on    { background: #dc2626; }

.beach-outlook {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}

.beach-day-chip {
    font-size: 11px;
    padding: 3px 9px;
    border-radius: 10px;
    border: 1.5px solid var(--color-border-strong);
    color: var(--color-text-secondary);
}

.beach-day-chip strong {
    color: var(--color-text);
}

.beach-day-chip.surf-epic { border-color: #059669; background: #ecfdf5; }
.beach-day-chip.surf-good { border-color: #0063a3; background: #eff6ff; }
.beach-day-chip.surf-fair { border-color: #d97706; background: #fffbeb; }
.beach-day-chip.wind-epic { border-color: #6d28d9; background: #f5f3ff; }
.beach-day-chip.wind-good { border-color: #7c3aed; background: #f5f3ff; }
.beach-day-chip.wind-fair { border-color: #8b5cf6; background: #faf5ff; }
.beach-day-chip.family-great { border-color: #0369a1; background: #f0f9ff; }
.beach-day-chip.family-good { border-color: #0284c7; background: #f0f9ff; }
.beach-day-chip.family-fair { border-color: #0891b2; background: #ecfeff; }

/* ── Beach categories (surf / windsurf / family) ───────────────────────── */

.beach-cat {
    margin-bottom: 26px;
}

.beach-cat-title {
    font-size: 15px;
    font-weight: 700;
    margin: 0 0 2px;
}

.beach-cat-blurb {
    font-size: 12px;
    color: var(--color-text-secondary);
    margin: 0 0 10px;
}

.beach-cat-empty {
    font-size: 13px;
    color: var(--color-text-secondary);
    padding: 10px 12px;
    border: 1px dashed var(--color-border-strong);
    border-radius: 8px;
}

.beach-reco-card.wave   { border-color: #0891b2; background: #ecfeff; }
.beach-reco-card.wind   { border-color: #7c3aed; background: #f5f3ff; }
.beach-reco-card.wave.surf-poor,
.beach-reco-card.wave.surf-flat { border-color: #94a3b8; background: #f8fafc; }
.beach-reco-card.wind.wind-poor { border-color: #94a3b8; background: #f8fafc; }

.beach-score-badge.wind-epic { background: #6d28d9; }
.beach-score-badge.wind-good { background: #7c3aed; }
.beach-score-badge.wind-fair { background: #8b5cf6; }
.beach-score-badge.wind-poor { background: #6b7280; }

.beach-rating.wind-epic { background: #6d28d9; }
.beach-rating.wind-good { background: #7c3aed; }
.beach-rating.wind-fair { background: #8b5cf6; }
.beach-rating.wind-poor { background: #6b7280; }
.beach-rating.wind-none { background: #9ca3af; }

/* Extra rows stay hidden until the category is expanded. */
.beach-row-extra { display: none; }
.beach-cat.expanded .beach-row-extra { display: flex; }

.beach-expand {
    margin-top: 4px;
    width: 100%;
    padding: 9px;
    background: none;
    border: 1.5px solid var(--color-border-strong);
    border-radius: 8px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text);
    cursor: pointer;
}

.beach-expand:hover { background: var(--color-surface-alt, #f1f5f9); }

.beach-maps-link {
    font-size: 12px;
    font-weight: 600;
    color: #0063a3;
    text-decoration: none;
    white-space: nowrap;
}

.beach-maps-link:hover { text-decoration: underline; }

@media (max-width: 600px) {
    .map-canvas {
        height: 360px;
    }

    .map-time-label {
        min-width: 84px;
        font-size: 12px;
    }
}

/* ── App tab navigation ────────────────────────────────────────────────── */

.app-tabs {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    border-bottom: 1px solid var(--color-border-strong);
    background: var(--color-surface);
    position: sticky;
    top: 0;
    z-index: 50;
}

.app-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 8px 2px 6px;
    text-decoration: none;
    color: var(--color-text-secondary);
    font-size: 10.5px;
    font-weight: 500;
    letter-spacing: 0.01em;
    border-bottom: 2.5px solid transparent;
    min-width: 0;
}

.app-tab svg {
    width: 20px;
    height: 20px;
    flex: none;
}

.app-tab span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.app-tab:hover {
    color: var(--color-primary);
}

.app-tab-active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
    font-weight: 700;
}

.app-tab:focus-visible {
    outline: 3px solid var(--color-primary);
    outline-offset: -3px;
}

.app-tab-expert {
    background: none;
    border: none;
    border-bottom: 2.5px solid transparent;
    font-family: inherit;
    cursor: pointer;
}

/* ── Watchlist ─────────────────────────────────────────────────────────── */

.watch-type-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.watch-type-chip {
    font-size: 12.5px;
    padding: 7px 12px;
}

.watch-type-icon {
    font-size: 18px;
    flex: none;
}

.watch-verdict {
    flex: none;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 2px 8px;
    border-radius: 10px;
    color: #ffffff;
    background: #6b7280;
}

.watch-verdict.verdict-great { background: #059669; }
.watch-verdict.verdict-good  { background: #0063a3; }
.watch-verdict.verdict-iffy  { background: #d97706; }
.watch-verdict.verdict-poor  { background: #dc2626; }

.watch-best-badge {
    font-size: 11px;
    font-weight: 700;
    color: #059669;
    background: #ecfdf5;
    border: 1px solid #059669;
    border-radius: 10px;
    padding: 1px 8px;
}

/* Day-row layout with the verdict chip present: let the text column shrink
   and truncate instead of running under the chip. */
.vac-day-summary {
    gap: 8px;
}

.vac-day-body {
    min-width: 0;
    overflow: hidden;
}

.vac-day-body .vac-day-cond,
.vac-day-body .vac-day-meta {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

/* ── Algorithm Lab ─────────────────────────────────────────────────────── */

.algo-title-badge {
    font-size: 13px;
    font-weight: 700;
    color: #ffffff;
    white-space: nowrap;
}

.algo-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.algo-pipeline {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 56px;
    border: 2px dashed transparent;
    border-radius: 10px;
    transition: border-color 0.15s;
}

.algo-pipeline.algo-drop-ready {
    border-color: var(--color-primary);
    background: var(--color-hover);
}

.algo-empty {
    padding: 16px;
    text-align: center;
    color: var(--color-muted);
    font-size: 13px;
}

.algo-block {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    border: 1.5px solid var(--color-border-strong);
    border-radius: 10px;
    padding: 10px;
    background: var(--color-surface);
}

.algo-block.algo-dragging {
    opacity: 0.65;
    border-color: var(--color-primary);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
}

.algo-drag-handle {
    flex: none;
    cursor: grab;
    touch-action: none;
    font-size: 16px;
    color: var(--color-muted);
    padding: 4px 6px;
    margin: -4px 0 0 -4px;
    user-select: none;
}

.algo-block-main {
    flex: 1;
    min-width: 0;
}

.algo-block-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.algo-block-icon { flex: none; }

.algo-block-label {
    font-weight: 700;
    font-size: 13.5px;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.algo-weight-wrap {
    flex: none;
    font-size: 11px;
    color: var(--color-text-secondary);
    display: flex;
    align-items: center;
    gap: 4px;
}

.algo-weight {
    width: 58px;
    font-family: inherit;
    font-size: 13px;
    padding: 3px 6px;
    border: 1.5px solid var(--color-border-strong);
    border-radius: 6px;
}

.algo-remove {
    flex: none;
    width: 26px;
    height: 26px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--color-muted);
    font-size: 17px;
    cursor: pointer;
}

.algo-remove:hover { background: #fee2e2; color: #dc2626; }

.algo-expr {
    width: 100%;
    font-family: 'Roboto Mono', ui-monospace, monospace;
    font-size: 12.5px;
    padding: 6px 8px;
    border: 1.5px solid var(--color-border-strong);
    border-radius: 6px;
    background: #f8fafc;
}

.algo-expr:focus {
    outline: none;
    border-color: var(--color-primary);
}

.algo-expr-bad {
    border-color: #dc2626;
    background: #fef2f2;
}

.algo-expr-error {
    font-size: 11.5px;
    color: #dc2626;
    margin-top: 4px;
}

.algo-combine-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    font-size: 13px;
    color: var(--color-text-secondary);
}

.algo-combine-select {
    font-family: inherit;
    font-size: 13px;
    padding: 5px 8px;
    border: 1.5px solid var(--color-border-strong);
    border-radius: 6px;
    background: var(--color-surface);
}

/* Palette */

.algo-vars-list {
    font-family: ui-monospace, monospace;
    font-size: 11px;
    color: var(--color-primary);
    word-break: break-word;
}

.algo-palette {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 8px;
}

.algo-card {
    position: relative;
    border: 1.5px solid var(--color-border-strong);
    border-radius: 10px;
    padding: 10px 10px 8px;
    background: var(--color-surface);
    cursor: grab;
    touch-action: none;
    user-select: none;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.algo-card:hover { border-color: var(--color-primary); }

.algo-card-icon { font-size: 18px; }

.algo-card-label {
    font-weight: 700;
    font-size: 12.5px;
}

.algo-card-hint {
    font-size: 11px;
    color: var(--color-text-secondary);
    line-height: 1.3;
}

.algo-card-add {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 24px;
    height: 24px;
    border: 1.5px solid var(--color-border-strong);
    border-radius: 50%;
    background: var(--color-surface);
    color: var(--color-primary);
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
}

.algo-card-add:hover { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }

.algo-ghost {
    position: fixed;
    z-index: 1000;
    width: 150px;
    pointer-events: none;
    transform: translate(-50%, -50%) rotate(-2deg);
    opacity: 0.9;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.25);
}

/* Sources */

.algo-sources {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* Results */

.algo-days {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 6px;
}

.algo-day {
    flex: none;
    width: 92px;
    border: 1.5px solid var(--color-border-strong);
    border-radius: 10px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    align-items: center;
    text-align: center;
}

.algo-day-date { font-size: 11px; font-weight: 700; color: var(--color-text-secondary); }

.algo-day-winner {
    font-size: 12px;
    font-weight: 700;
    color: var(--color-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.algo-day-temps { font-size: 12px; }

.algo-day-score {
    font-size: 10.5px;
    color: #ffffff;
    background: var(--color-primary);
    border-radius: 8px;
    padding: 1px 7px;
}

.algo-day-none { font-size: 11px; color: var(--color-muted); }

.algo-subheading {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin: 14px 0 8px;
    color: var(--color-text-secondary);
}

.algo-ranking { display: flex; flex-direction: column; gap: 6px; }

.algo-rank-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
}

.algo-rank-pos {
    flex: none;
    width: 20px;
    text-align: center;
    font-weight: 700;
    color: var(--color-text-secondary);
}

.algo-rank-top .algo-rank-pos { color: #059669; }

.algo-rank-name {
    flex: none;
    width: 96px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
}

.algo-rank-bar-wrap {
    flex: 1;
    height: 10px;
    background: var(--color-border);
    border-radius: 5px;
    overflow: hidden;
}

.algo-rank-bar {
    display: block;
    height: 100%;
    background: var(--color-primary);
    border-radius: 5px;
}

.algo-rank-top .algo-rank-bar { background: #059669; }

.algo-rank-meta {
    flex: none;
    font-size: 11px;
    color: var(--color-text-secondary);
    white-space: nowrap;
}

@media (max-width: 600px) {
    .algo-rank-name { width: 78px; }
    .algo-rank-meta { font-size: 10px; }
}

/* Algorithm apply-to-app toggle + source button */

.algo-apply-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    font-size: 13px;
    cursor: pointer;
}

.algo-apply-row input {
    width: 17px;
    height: 17px;
    accent-color: var(--color-primary);
}

.algo-apply-hint a {
    color: var(--color-primary);
}

.source-vote-btn.algo-vote-btn .svb-name {
    color: var(--color-primary);
}

.source-vote-btn.algo-vote-btn.active .svb-name {
    color: inherit;
}

/* ── Algo help, info & tutorial ────────────────────────────────────────── */

.algo-tour-chip {
    margin-top: 10px;
    border-color: var(--color-primary);
    color: var(--color-primary);
    font-weight: 700;
}

/* My algorithms — save the current pipeline under a name and reload it later. */
.algo-saved-block {
    margin-bottom: 12px;
}

.algo-saved-chip {
    display: inline-flex;
    align-items: stretch;
}

.algo-saved-chip .algo-saved-load {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.algo-saved-del {
    border: 1.5px solid var(--color-border-strong);
    border-left: none;
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
    background: var(--color-surface);
    color: var(--color-text-secondary);
    font-size: 16px;
    line-height: 1;
    padding: 0 8px;
    cursor: pointer;
}

.algo-saved-del:hover {
    color: #dc2626;
    border-color: #dc2626;
}

.algo-saved-row {
    display: flex;
    gap: 6px;
}

.algo-save-name {
    flex: 1;
    min-width: 0;
    padding: 7px 10px;
    border: 1.5px solid var(--color-border-strong);
    border-radius: 8px;
    font-family: inherit;
    font-size: 13px;
    background: var(--color-surface);
    color: var(--color-text);
}

.algo-save-btn {
    white-space: nowrap;
}

.algo-help {
    border: 1.5px solid var(--color-border-strong);
    border-radius: 10px;
    margin-bottom: 8px;
    overflow: hidden;
}

.algo-help summary {
    padding: 10px 12px;
    font-size: 13.5px;
    font-weight: 700;
    cursor: pointer;
    background: var(--color-surface);
}

.algo-help summary:hover { color: var(--color-primary); }

.algo-help[open] summary { border-bottom: 1px solid var(--color-border); }

.algo-help-body {
    padding: 10px 12px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--color-text);
}

.algo-help-body p { margin-bottom: 8px; }

.algo-help-list {
    margin: 0 0 8px 18px;
}

.algo-help-list li { margin-bottom: 5px; }

.algo-ref-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
}

.algo-ref-table td {
    padding: 5px 8px 5px 0;
    border-bottom: 1px solid var(--color-border);
    vertical-align: top;
}

.algo-ref-table code {
    font-family: ui-monospace, monospace;
    font-size: 12px;
    color: var(--color-primary);
    white-space: nowrap;
}

.algo-ref-unit {
    color: var(--color-muted);
    white-space: nowrap;
}

/* Palette card info */

.algo-card-actions {
    position: absolute;
    top: 6px;
    right: 6px;
    display: flex;
    gap: 4px;
}

.algo-card-actions .algo-card-add {
    position: static;
}

.algo-card-info-btn {
    width: 24px;
    height: 24px;
    border: 1.5px solid var(--color-border-strong);
    border-radius: 50%;
    background: var(--color-surface);
    color: var(--color-text-secondary);
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
}

.algo-card-info-btn:hover,
.algo-card-info-btn[aria-expanded="true"] {
    background: var(--color-text);
    color: #fff;
    border-color: var(--color-text);
}

.algo-card-info {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px dashed var(--color-border-strong);
    font-size: 11.5px;
    line-height: 1.45;
    color: var(--color-text);
    cursor: auto;
    user-select: text;
}

.algo-card-info-expr {
    display: block;
    margin-top: 5px;
    font-family: ui-monospace, monospace;
    font-size: 11px;
    color: var(--color-primary);
    word-break: break-all;
}

/* Tour */

.tour-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    z-index: 900;
}

.tour-highlight {
    position: relative;
    z-index: 950;
    outline: 3px solid #fbbf24;
    outline-offset: 4px;
    border-radius: 8px;
    background: var(--color-surface);
    box-shadow: 0 0 0 9999px rgba(15, 23, 42, 0.08);
}

.tour-card {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 14px;
    max-width: 480px;
    margin: 0 auto;
    background: var(--color-surface);
    border-radius: 14px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
    padding: 14px 16px;
    z-index: 1000;
}

.tour-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.tour-progress {
    font-size: 11px;
    font-weight: 700;
    color: var(--color-muted);
    letter-spacing: 0.05em;
}

.tour-skip {
    border: none;
    background: none;
    color: var(--color-text-secondary);
    font-size: 12px;
    cursor: pointer;
    padding: 4px;
}

.tour-title {
    font-size: 15.5px;
    font-weight: 700;
    margin-bottom: 4px;
}

.tour-text {
    font-size: 13px;
    line-height: 1.5;
    color: var(--color-text);
    margin-bottom: 12px;
}

.tour-actions {
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.tour-actions button {
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 8px;
    border: 1.5px solid var(--color-border-strong);
    background: var(--color-surface);
    cursor: pointer;
}

.tour-actions button:disabled { opacity: 0.4; cursor: default; }

.tour-primary {
    background: var(--color-primary) !important;
    border-color: var(--color-primary) !important;
    color: #fff;
    font-weight: 700;
}

/* ── Source Explorer (admin.html) ────────────────────────────────────────────
   Secret-linked diagnostics view. Deliberately plain: it shows raw upstream
   payloads, so readability of long JSON beats visual polish. */

.adm-page {
    max-width: 1100px;
    margin: 0 auto;
    padding: 16px;
    background: var(--color-bg);
    color: var(--color-text);
}

.adm-locked {
    text-align: center;
    padding: 80px 20px;
    color: var(--color-text-secondary);
}
.adm-locked-title { font-size: 1.4rem; font-weight: 500; margin: 0 0 8px; }
.adm-locked-text { margin: 0; font-size: 0.95rem; }

/* Overrides the app's sticky blue `header` bar: this is a tool page, not a
   forecast view, and the branded bar made its own subtitle unreadable. */
.adm-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    position: static;
    padding: 4px 0 12px;
    background: none;
    color: var(--color-text);
    border-bottom: 1px solid var(--color-border-strong);
}
.adm-title { font-size: 1.35rem; font-weight: 700; margin: 0; }
.adm-subtitle { font-size: 0.85rem; color: var(--color-text-secondary); }

.adm-warning {
    margin: 12px 0;
    padding: 10px 12px;
    border-left: 3px solid var(--color-warm);
    background: #fff8ed;
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    border-radius: 4px;
}

.adm-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}
.adm-field {
    border: 1px solid var(--color-border-strong);
    border-radius: 8px;
    padding: 10px 12px 12px;
    margin: 0;
    min-width: 0;
}
.adm-field legend {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-secondary);
    padding: 0 4px;
}
.adm-row { display: block; margin-bottom: 8px; }
.adm-row-split { display: flex; gap: 8px; flex-wrap: wrap; }
.adm-subfield { flex: 1 1 120px; min-width: 0; }
.adm-label {
    display: block;
    font-size: 0.78rem;
    color: var(--color-text-secondary);
    margin-bottom: 3px;
}
.adm-input {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 10px;
    font: inherit;
    font-size: 0.9rem;
    color: var(--color-text);
    background: var(--color-surface);
    border: 1px solid var(--color-border-strong);
    border-radius: 6px;
    min-height: var(--min-touch-target);
}
.adm-input:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 1px; }
.adm-textarea { min-height: 88px; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 0.82rem; }
.adm-hint { font-size: 0.75rem; color: var(--color-muted); margin: 6px 0 0; }
.adm-check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    padding: 6px 0;
    cursor: pointer;
}
.adm-source-meta {
    font-size: 0.78rem;
    color: var(--color-text-secondary);
    line-height: 1.5;
    word-break: break-word;
}
.adm-source-meta code { font-size: 0.75rem; background: var(--color-hover); padding: 1px 4px; border-radius: 3px; }

.adm-place-results:not(:empty) {
    border: 1px solid var(--color-border-strong);
    border-radius: 6px;
    margin-bottom: 8px;
    max-height: 190px;
    overflow-y: auto;
}
.adm-place-item {
    padding: 9px 10px;
    font-size: 0.82rem;
    cursor: pointer;
    border-bottom: 1px solid var(--color-border);
}
.adm-place-item:last-child { border-bottom: none; }
.adm-place-item:hover, .adm-place-item:focus-visible { background: var(--color-hover); }

.adm-actions { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.adm-btn {
    padding: 10px 16px;
    font: inherit;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--color-text);
    background: var(--color-surface);
    border: 1px solid var(--color-border-strong);
    border-radius: 6px;
    cursor: pointer;
    min-height: var(--min-touch-target);
}
.adm-btn:hover:not(:disabled) { background: var(--color-hover); }
.adm-btn:disabled { opacity: 0.5; cursor: default; }
.adm-btn-primary {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: var(--color-on-primary);
}
.adm-btn-primary:hover:not(:disabled) { background: var(--color-primary-dark); }
.adm-btn-quiet { border: none; background: none; color: var(--color-text-secondary); text-decoration: underline; }
.adm-btn-small { padding: 5px 10px; font-size: 0.78rem; min-height: 0; }

.adm-status { font-size: 0.85rem; color: var(--color-text-secondary); padding: 8px 0; min-height: 20px; }
.adm-status-ok { color: var(--color-mild); }
.adm-status-bad { color: #b91c1c; }

.adm-result-title { font-size: 1rem; font-weight: 500; margin: 12px 0 8px; word-break: break-word; }

.adm-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.adm-table th {
    text-align: left;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-secondary);
    padding: 6px 8px;
    border-bottom: 1px solid var(--color-border-strong);
}
.adm-table td { padding: 7px 8px; border-bottom: 1px solid var(--color-border); }
.adm-table tr:hover td { background: var(--color-hover); }

.adm-pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--radius-chip);
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
}
.adm-ok   { background: #dcfce7; color: #166534; }
.adm-bad  { background: #fee2e2; color: #991b1b; }
.adm-warn { background: #fef3c7; color: #92400e; }
.adm-dead { background: #e5e7eb; color: #374151; }

.adm-panel { border: 1px solid var(--color-border-strong); border-radius: 8px; margin-top: 12px; overflow: hidden; }
.adm-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: var(--color-hover);
}
.adm-meta-item { font-size: 0.8rem; color: var(--color-text-secondary); }
.adm-url {
    flex-basis: 100%;
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.72rem;
    color: var(--color-text-secondary);
    word-break: break-all;
}

.adm-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--color-border-strong); }
.adm-tab {
    padding: 8px 14px;
    font: inherit;
    font-size: 0.82rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--color-text-secondary);
    cursor: pointer;
}
.adm-tab-active { color: var(--color-primary); border-bottom-color: var(--color-primary); font-weight: 500; }

.adm-toolbar { display: flex; gap: 6px; padding: 8px 12px 0; }
.adm-json {
    margin: 8px 0 0;
    padding: 12px;
    max-height: 70vh;
    overflow: auto;
    background: #0f172a;
    color: #e2e8f0;
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.75rem;
    line-height: 1.5;
    white-space: pre;
    tab-size: 2;
}

@media (prefers-color-scheme: dark) {
    .adm-warning { background: #2a2010; }
    .adm-ok   { background: #14532d; color: #bbf7d0; }
    .adm-bad  { background: #7f1d1d; color: #fecaca; }
    .adm-warn { background: #78350f; color: #fde68a; }
    .adm-dead { background: #374151; color: #e5e7eb; }
}
