/* SnowScout web: same look as the Android app (icy blue, rating badges). */

:root {
  --bg: #F6F9FC;
  --surface: #FFFFFF;
  --surface-2: #EEF3F8;
  --text: #14212E;
  --muted: #5A6B7B;
  --primary: #1E4E79;
  --on-primary: #FFFFFF;
  --primary-soft: #D3E4F5;
  --accent: #2E7D6B;      /* fresh snow highlight */
  --secondary: #3F6496;   /* notes */
  --border: #D5DEE7;
  --error: #B3261E;
  --error-bg: #FDECEA;
  --mine: #F57C00;        /* "my sites" on the map */
  --shadow: 0 1px 2px rgba(16, 32, 48, .08), 0 2px 8px rgba(16, 32, 48, .08);

  /* Rating badges: fixed colours that read with white text in both themes */
  --r-epic: #5E35B1;
  --r-good: #2E7D32;
  --r-fair: #1565C0;
  --r-marginal: #B26A00;
  --r-nogo: #C62828;
  --r-nodata: #616161;

  --radius: 14px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0E141B;
    --surface: #17202A;
    --surface-2: #1E2935;
    --text: #E6EDF3;
    --muted: #9AA9B8;
    --primary: #9CC7F0;
    --on-primary: #0A2540;
    --primary-soft: #1E4E79;
    --accent: #8FD3C1;
    --secondary: #AFC6EA;
    --border: #2A3644;
    --error: #F2B8B5;
    --error-bg: #3A1D1B;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }

.screen { min-height: 100dvh; display: flex; flex-direction: column; }

/* ---- Top bar ---- */
.topbar {
  position: sticky; top: 0; z-index: 1000;
  display: flex; align-items: center; gap: 4px;
  padding: calc(8px + var(--safe-top)) 8px 8px 16px;
  background: var(--bg);
}
.topbar.has-back { padding-left: 4px; }
.topbar h1 { font-size: 22px; font-weight: 600; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.title-block { flex: 1; min-width: 0; }
.title-block h1 { flex: none; }
.title-block .sub { font-size: 12px; color: var(--muted); }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border: 0; border-radius: 50%;
  background: transparent; cursor: pointer; flex: none; color: var(--text);
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn svg { fill: currentColor; }

.content { padding: 4px 16px calc(96px + var(--safe-bottom)); display: flex; flex-direction: column; gap: 12px; }

/* ---- Chips & segmented ---- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 16px 6px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.content .chips { padding-left: 0; padding-right: 0; }
.chip {
  flex: none; border: 1px solid var(--border); background: var(--surface);
  border-radius: 10px; padding: 7px 14px; font-size: 14px; cursor: pointer; white-space: nowrap;
}
.chip[aria-pressed="true"] { background: var(--primary-soft); border-color: transparent; font-weight: 600; }

.segmented { display: flex; margin: 0 16px 8px; border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.segmented button {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px; border: 0; background: var(--surface); cursor: pointer; font-size: 15px;
}
.segmented button + button { border-left: 1px solid var(--border); }
.segmented button[aria-selected="true"] { background: var(--primary-soft); font-weight: 600; }
.segmented svg { width: 18px; height: 18px; fill: currentColor; }

/* ---- Cards ---- */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
.site-card { display: flex; align-items: center; gap: 16px; padding: 16px; }
.site-main { flex: 1; min-width: 0; }
.site-name { font-size: 17px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.site-sub { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.note { margin-top: 8px; font-size: 13px; font-weight: 500; color: var(--secondary); }
.asof { margin-top: 4px; font-size: 12px; color: var(--muted); }
.asof.warn { color: var(--mine); font-weight: 600; }

.metrics { display: flex; justify-content: space-between; gap: 8px; margin-top: 10px; }
.metric { text-align: center; min-width: 0; }
.metric b { display: block; font-size: 17px; font-weight: 600; }
.metric span { font-size: 11px; color: var(--muted); }
.metric.hot b { color: var(--accent); font-weight: 700; }

.badge {
  flex: none; width: 64px; height: 64px; border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: #fff; line-height: 1.05;
}
.badge b { font-size: 22px; font-weight: 700; }
.badge span { font-size: 10px; white-space: nowrap; }
.badge.lg { width: 84px; height: 84px; }
.badge.lg b { font-size: 30px; }
.badge.lg span { font-size: 12px; }
.badge.epic { background: var(--r-epic); }
.badge.good { background: var(--r-good); }
.badge.fair { background: var(--r-fair); }
.badge.marginal { background: var(--r-marginal); }
.badge.nogo { background: var(--r-nogo); }
.badge.nodata { background: var(--r-nodata); }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 999px; padding: 12px 22px; cursor: pointer;
  background: var(--primary); color: var(--on-primary); font-weight: 600; font-size: 15px;
}
.btn svg { width: 20px; height: 20px; fill: currentColor; }
.btn.outline { background: transparent; color: var(--primary); border: 1px solid var(--border); }
.btn.block { width: 100%; }

.fab {
  position: fixed; right: 16px; bottom: calc(20px + var(--safe-bottom)); z-index: 900;
  display: inline-flex; align-items: center; gap: 8px; padding: 16px 20px;
  border-radius: 16px; background: var(--primary-soft); color: var(--text);
  font-weight: 600; box-shadow: 0 3px 10px rgba(0, 0, 0, .2);
}
.fab svg { width: 24px; height: 24px; fill: currentColor; }

/* ---- Status ---- */
.banner {
  display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 16px;
  background: var(--error-bg); color: var(--error); border-radius: var(--radius); font-size: 14px;
}
.banner span { flex: 1; }
.banner button { border: 0; background: transparent; color: inherit; font-weight: 700; cursor: pointer; padding: 6px 10px; }

/* Phone app closed-beta invitation (dashboard card, settings card) */
.invite {
  position: relative; padding: 14px 44px 14px 16px; border-radius: var(--radius);
  background: var(--primary-soft); color: var(--text); font-size: 14px;
}
.invite b { display: block; font-size: 15px; margin-bottom: 2px; }
.invite p { margin: 0; }
.invite a { color: var(--primary); font-weight: 600; }
.invite .btn { margin-top: 10px; padding: 9px 18px; font-size: 14px; color: var(--on-primary); }
.invite .x {
  position: absolute; top: 6px; right: 6px; border: 0; background: transparent; cursor: pointer;
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: var(--muted);
}
.invite .x svg { width: 20px; height: 20px; fill: currentColor; }
.content > .invite + .chips, .empty + .invite { margin-top: 12px; }
.empty + .invite { margin-left: 16px; margin-right: 16px; }

.spinner {
  width: 32px; height: 32px; border-radius: 50%;
  border: 3px solid var(--primary-soft); border-top-color: var(--primary);
  animation: spin .8s linear infinite; margin: 32px auto;
}
.spinner.sm { width: 24px; height: 24px; margin: 0; }
@keyframes spin { to { transform: rotate(360deg); } }
.progress { height: 3px; background: var(--primary-soft); overflow: hidden; border-radius: 2px; }
.progress::after { content: ""; display: block; height: 100%; width: 40%; background: var(--primary); animation: slide 1.1s ease-in-out infinite; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(250%); } }

.muted { color: var(--muted); }
.small { font-size: 13px; }

.empty { text-align: center; padding: 64px 24px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty > svg { width: 72px; height: 72px; fill: var(--primary); }
.empty h2 { font-size: 22px; font-weight: 500; margin-top: 6px; }
.empty p { color: var(--muted); max-width: 340px; }
.empty .btn { margin-top: 14px; }

/* ---- Site picker ---- */
.sites-screen { height: 100dvh; overflow: hidden; }
.controls { flex: none; }
.search {
  display: flex; align-items: center; gap: 8px; margin: 0 16px 10px; padding: 0 6px 0 14px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
}
.search svg { fill: var(--muted); flex: none; }
.search input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text);
  font-size: 16px; /* 16px stops iOS zooming in on focus */ padding: 13px 0;
}
.search input::-webkit-search-cancel-button { display: none; }
.search:focus-within { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }

.sites-body { flex: 1; min-height: 0; position: relative; }
.list { height: 100%; overflow-y: auto; padding-bottom: var(--safe-bottom); }
.list .count { padding: 4px 16px; font-size: 13px; color: var(--muted); }
.row {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  border-bottom: 1px solid var(--border); cursor: pointer;
}
.row-text { flex: 1; min-width: 0; }
.row-title { font-size: 16px; }
.row-sub { font-size: 13px; color: var(--muted); }
.row input { width: 22px; height: 22px; accent-color: var(--primary); flex: none; }

.map-wrap { position: absolute; inset: 0; }
.map { position: absolute; inset: 0; background: #e8ecef; }
.legend {
  position: absolute; z-index: 500; top: 10px; left: 10px; padding: 6px 10px;
  background: var(--surface); border-radius: 8px; box-shadow: var(--shadow); font-size: 12px;
}
.legend div { display: flex; align-items: center; gap: 6px; }
.legend .legend-grid { display: grid; grid-template-columns: auto auto auto; column-gap: 10px; }
.legend .muted { font-size: 11px; margin-top: 2px; }
.legend .legend-foot { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot.ring { width: 12px; height: 12px; background: var(--surface); box-shadow: inset 0 0 0 3px #14212E; }
.preview {
  position: absolute; z-index: 600; left: 12px; right: 12px; bottom: calc(26px + var(--safe-bottom));
  padding: 12px 8px 12px 16px;
}
.preview-top { display: flex; align-items: center; gap: 12px; }
.preview .site-main .line { font-size: 15px; }
.preview .btn { margin: 10px 8px 0 0; width: calc(100% - 8px); }
.leaflet-container { font: inherit; }
.leaflet-control-attribution { font-size: 11px; }

/* ---- Detail ---- */
.summary { padding: 16px; }
.summary-top { display: flex; align-items: center; gap: 16px; }
.summary-top .notes { font-size: 13px; color: var(--secondary); }
.summary .metrics { margin-top: 16px; }
.section-title { font-size: 17px; font-weight: 600; margin: 10px 0 2px; }
.chart { padding: 12px; }
.chart svg { display: block; width: 100%; height: auto; }
.chart .bar { fill: var(--primary); }
.chart .axis { stroke: var(--border); stroke-width: 1; }
.chart text { fill: var(--muted); font-size: 11px; text-anchor: middle; }
/* Hourly chart: softer bars so the temperature line on top of them stands out. */
.chart .bar.soft { opacity: .45; }
.chart .temp { fill: none; stroke: var(--mine); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart .temp-halo { fill: none; stroke: var(--surface); stroke-width: 6; stroke-linejoin: round; stroke-linecap: round; }
.chart .freeze { stroke: var(--mine); stroke-width: 1.2; stroke-dasharray: 3 3; opacity: .8; }
.chart text.freeze-label { text-anchor: start; fill: var(--mine); font-size: 10px; font-weight: 600;
  stroke: var(--surface); stroke-width: 3px; paint-order: stroke; }
.chart .gap { fill: var(--mine); opacity: .12; }
.chart text.gap-label { fill: var(--mine); font-size: 11px; font-weight: 600; }
.forecast { display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
.forecast .what { flex: 1; min-width: 0; }
.forecast .name { font-weight: 600; font-size: 15px; }
.forecast .short.snow { color: var(--accent); font-weight: 600; }
.forecast .temp { font-weight: 600; white-space: nowrap; }
table.daily { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
table.daily th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; padding: 4px 4px 4px 0; }
table.daily td { padding: 8px 4px 8px 0; border-top: 1px solid var(--border); }
table.daily td.hot { color: var(--accent); font-weight: 600; }
.footnote { font-size: 12px; color: var(--muted); margin-top: 8px; }

/* Remove / add button at the bottom of a site's page, and the 25-site limit message */
.saved-site { margin: 16px 0 calc(24px + var(--safe-bottom)); }
.limit-msg { color: var(--error); margin: 6px 0 0; }

/* "Removed Beartown · Undo" bar on the dashboard */
.snackbar {
  position: fixed; left: 16px; right: 16px; bottom: calc(88px + var(--safe-bottom)); z-index: 950;
  max-width: 560px; margin: 0 auto; display: flex; align-items: center; gap: 12px;
  padding: 12px 8px 12px 16px; border-radius: 10px; background: #2B3640; color: #fff;
  font-size: 14px; box-shadow: 0 3px 10px rgba(0, 0, 0, .3);
}
.snackbar span { flex: 1; }
.snackbar button { border: 0; background: transparent; color: #9CC7F0; font-weight: 700; cursor: pointer; padding: 6px 10px; }

/* ---- Avalanche forecast (North American danger scale colours, same in light and dark) ---- */
.avy { padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.avy-head { display: flex; align-items: center; gap: 12px; }
.avy-head .danger { font-size: 15px; padding: 6px 10px; }
.avy-zone { font-weight: 600; font-size: 15px; }
.danger { display: inline-block; border-radius: 8px; padding: 3px 8px; font-size: 13px; font-weight: 600;
  white-space: nowrap; border: 1px solid rgba(0, 0, 0, .18); }
.danger.d-low { background: #50B848; color: #0B1F0C; }
.danger.d-moderate { background: #FFF200; color: #1F1D00; }
.danger.d-considerable { background: #F7941E; color: #241300; }
.danger.d-high { background: #ED1C24; color: #FFFFFF; }
.danger.d-extreme { background: #231F20; color: #FFFFFF; border-color: #ED1C24; }
.danger.d-none { background: transparent; color: var(--muted); border-color: var(--border); font-weight: 500; }
table.avy-bands { width: 100%; border-collapse: collapse; font-size: 14px; }
table.avy-bands th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; padding: 4px 6px 4px 0; }
table.avy-bands tbody th { color: var(--text); font-size: 14px; }
table.avy-bands td, table.avy-bands tbody th { padding: 6px 6px 6px 0; border-top: 1px solid var(--border); }
.avy-problems { font-size: 14px; }
.avy-problems ul { margin: 4px 0 0 18px; padding: 0; }
.avy-summary { line-height: 1.45; }
.avy-link { font-weight: 600; color: var(--primary); }

/* ---- Settings ---- */
.switch-row { display: flex; align-items: center; gap: 16px; cursor: pointer; }
.switch-row > span { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.switch-title { font-size: 17px; font-weight: 500; }
input[role="switch"] {
  appearance: none; -webkit-appearance: none; flex: none; position: relative; cursor: pointer;
  width: 52px; height: 32px; border-radius: 16px; margin: 0;
  background: var(--surface-2); border: 2px solid var(--muted); transition: background .15s;
}
input[role="switch"]::after {
  content: ""; position: absolute; top: 4px; left: 4px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--muted); transition: transform .15s;
}
input[role="switch"]:checked { background: var(--primary); border-color: var(--primary); }
input[role="switch"]:checked::after { transform: translateX(20px); background: var(--on-primary); }
input[role="switch"]:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.setting { padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.setting h3 { font-size: 17px; font-weight: 500; }
input[type="range"] { width: 100%; accent-color: var(--primary); height: 32px; }
.score-line { display: flex; justify-content: space-between; gap: 12px; font-size: 15px; }
.score-line b { font-weight: 600; }
.steps { margin: 4px 0 0; padding-left: 20px; }
.steps li { margin: 4px 0; }

/* StashFinder X */
.x-tag { display: inline-block; padding: 0 6px; margin-left: 2px; border-radius: 6px; background: #C2410C; color: #fff; font-size: 0.7em; vertical-align: 2px; }
.x-notice { border-color: #C2410C; }

