/* BC Snow Forecast — dark mountain theme. Solid colors only. */

:root {
  --bg: #090d10;
  --surface: #151f28;
  --surface-2: #1b2836;
  --surface-3: #243443;
  --border: #2a3f54;
  --text: #edf3f8;
  --muted: #94a3b8;
  --faint: #64748b;
  --ice: #38bdf8;
  --ice-deep: #3d9fc4;
  --amber: #e8b34b;
  --green: #6fcf97;
  --red: #e07a7a;
  --radius: 14px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  font-feature-settings: "tnum" 1, "cv05" 1;
  -webkit-font-smoothing: antialiased;
}

/* ---------- header ---------- */

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 18px 18px 12px;
}

.header-inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  max-width: 720px;
  margin: 0 auto;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.app-header h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.refresh-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 14px;
  min-height: 44px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.refresh-btn:active { transform: scale(0.96); }
.edit-btn {
  display: inline-flex;
  align-items: center;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 16px;
  min-height: 44px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.edit-btn:active { transform: scale(0.96); }
body.editing .edit-btn { color: var(--ice); border-color: var(--ice-deep); }
.refresh-btn.loading svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.status-line {
  max-width: 720px;
  margin: 10px auto 0;
  display: flex;
  gap: 10px;
  align-items: baseline;
  font-size: 12.5px;
  color: var(--faint);
}
.cache-note { color: var(--amber); font-weight: 600; }

/* ---------- resort list & cards ---------- */

.resort-list {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.card.storm { border-color: var(--ice); }

.card-head {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 14px;
  align-items: center;
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  text-align: left;
  padding: 16px 16px 14px;
  cursor: pointer;
}

.resort-name {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
}
.resort-elev {
  margin: 3px 0 0;
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 500;
}

/* Powder badge: quiet by default, only shouts when there is snow. */
.score-badge {
  grid-row: span 2;
  justify-self: end;
  align-self: center;
  text-align: right;
}
.score-badge .score-num {
  font-size: 18px;
  font-weight: 500;
  line-height: 1.2;
  color: var(--faint);
}
.score-badge .score-cap {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--faint);
  margin-top: 2px;
}
.score-badge.high .score-num { font-size: 24px; font-weight: 800; color: var(--ice); }
.score-badge.high .score-cap { color: var(--muted); }

.week-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 0 16px 6px;
}
.week-total { font-size: 14px; color: var(--muted); font-weight: 400; }
.week-total strong { color: var(--text); font-size: 24px; font-weight: 800; }
.week-total .unit { font-size: 12px; color: var(--faint); }
.agreement { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--surface-3); color: var(--muted); }
.agreement.high { color: var(--green); }
.agreement.moderate { color: var(--amber); }
.agreement.low { color: var(--red); }

.verdict {
  margin: 8px 20px 16px;
  padding: 16px 20px;
  background: var(--surface-2);
  border-radius: 8px;
  font-size: 13.5px;
  color: var(--text);
}
.verdict .v-label { display: block; font-size: 11px; font-weight: 700; letter-spacing: 0.08em; color: var(--faint); margin-bottom: 4px; }

.card-error {
  margin: 0 16px 14px;
  padding: 10px 12px;
  border: 1px solid var(--red);
  border-radius: 8px;
  font-size: 13px;
  color: var(--red);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

/* ---------- detail ---------- */

.detail { border-top: 1px solid var(--border); padding: 4px 16px 18px; }

.day-strip {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin: 12px 0 4px;
}
.day-cell {
  background: var(--surface-2);
  border-radius: 10px;
  padding: 8px 4px;
  text-align: center;
  border: 1px solid transparent;
}
.day-cell.today { border-color: var(--ice-deep); }
.day-cell .d-name { display: block; font-size: 10px; font-weight: 700; letter-spacing: 0.06em; color: var(--faint); text-transform: uppercase; }
.day-cell .d-snow { display: block; font-size: 15px; font-weight: 700; margin-top: 2px; }
.day-cell .d-snow small { font-size: 10px; font-weight: 600; color: var(--faint); }
.day-cell .d-meta { display: block; font-size: 10px; color: var(--muted); margin-top: 2px; }

.chart-wrap { margin-top: 14px; }
.chart-title { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); margin: 0 0 8px; }
.chart-scroll { overflow-x: auto; }
.chart-scroll svg { display: block; min-width: 560px; width: 100%; height: auto; }
.chart-legend { display: flex; gap: 16px; margin-top: 8px; font-size: 12px; color: var(--muted); }
.legend-swatch { display: inline-block; width: 22px; height: 4px; border-radius: 2px; vertical-align: middle; margin-right: 6px; }

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 14px;
}
.metric {
  background: var(--surface-2);
  border-radius: 10px;
  padding: 10px 12px;
}
.metric .m-label { font-size: 10.5px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--faint); }
.metric .m-value { font-size: 19px; font-weight: 700; margin-top: 2px; }
.metric .m-sub { font-size: 11.5px; color: var(--muted); }

/* ---------- accuracy log ---------- */

.accuracy { margin-top: 16px; background: var(--surface-2); border-radius: 12px; padding: 14px; }
.accuracy h3 { margin: 0 0 4px; font-size: 14px; font-weight: 700; }
.accuracy .acc-desc { margin: 0 0 12px; font-size: 12.5px; color: var(--muted); }
.acc-form { display: flex; gap: 8px; flex-wrap: wrap; }
.acc-form input {
  font: inherit;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 9px 10px;
  font-size: 14px;
}
.acc-form input[type="date"] { flex: 1 1 140px; color-scheme: dark; }
.acc-form input[type="number"] { flex: 1 1 90px; }
.acc-list { list-style: none; margin: 12px 0 0; padding: 0; font-size: 13px; }
.acc-list li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 0;
  border-top: 1px solid var(--border);
  color: var(--muted);
}
.acc-list li strong { color: var(--text); }
.hit { color: var(--green); font-weight: 700; }
.miss { color: var(--amber); font-weight: 700; }
.acc-summary { margin-top: 10px; font-size: 13px; font-weight: 600; }

/* ---------- buttons / errors / footer ---------- */

.btn-primary {
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  background: var(--ice-deep);
  color: #06121a;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  cursor: pointer;
  white-space: nowrap;
}
.btn-ghost {
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  background: transparent;
  color: var(--ice);
  border: 1px solid var(--ice-deep);
  border-radius: 8px;
  padding: 6px 12px;
  cursor: pointer;
  white-space: nowrap;
}

.global-error {
  max-width: 720px;
  margin: 8px auto;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--red);
  border-radius: var(--radius);
}
.global-error p { margin: 0 0 8px; }
.global-error .muted { color: var(--muted); font-size: 13px; }

.skeleton {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px 16px;
  text-align: center;
  color: var(--faint);
  font-size: 14px;
}

.app-footer {
  max-width: 720px;
  margin: 0 auto;
  padding: 18px 18px 40px;
  color: var(--faint);
  font-size: 12px;
  line-height: 1.6;
}

/* ---------- resort reorder (edit mode) ---------- */

.reorder-controls { display: none; }
body.editing .reorder-controls {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 10px 12px 0;
}
.reorder-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  min-height: 44px;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  padding: 0;
}
.reorder-btn:disabled { opacity: 0.3; cursor: default; }
.reorder-btn svg { display: block; }
body.editing .card-head { cursor: default; }

@media (min-width: 560px) {
  .app-header h1 { font-size: 26px; }
  .resort-list { padding-top: 22px; }
}
