:root {
  --bg: #f5f5f7;
  --surface: rgba(255, 255, 255, .78);
  --text: #1d1d1f;
  --muted: #6e6e73;
  --line: rgba(0, 0, 0, .08);
  --blue: #007aff;
  --green: #34c759;
  --orange: #ff9500;
  --red: #ff3b30;
  --shadow: 0 22px 60px rgba(0, 0, 0, .08);
  --radius-xl: 34px;
  --radius-lg: 26px;
  --radius-md: 18px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", Roboto, Arial, sans-serif;
  background:
    radial-gradient(circle at 15% 0%, rgba(0, 122, 255, .14), transparent 32%),
    radial-gradient(circle at 85% 5%, rgba(52, 199, 89, .1), transparent 28%),
    linear-gradient(180deg, #fff 0%, var(--bg) 52%, #ededf0 100%);
  -webkit-font-smoothing: antialiased;
}

.app {
  width: min(1160px, calc(100% - 32px));
  margin: 0 auto;
  padding: 26px 0 44px;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.app-icon {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: linear-gradient(145deg, #fff, #eaf4ff);
  box-shadow: inset 0 0 0 1px var(--line), 0 14px 30px rgba(0, 122, 255, .16);
  overflow: hidden;
}

.app-icon img { width: 34px; height: 34px; display: block; }

.eyebrow,
.section-kicker {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 7px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(30px, 4.5vw, 48px);
  line-height: .95;
  letter-spacing: -.055em;
  font-weight: 780;
}

.subtitle { margin: 7px 0 0; color: var(--muted); font-size: 15px; }
.header-actions { display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0; }

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 15px;
  border-radius: 999px;
  color: #188038;
  background: rgba(52, 199, 89, .12);
  font-size: 14px;
  font-weight: 700;
}
.live-pill i { font-size: 8px; }

.refresh-btn {
  width: 40px;
  height: 40px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  background: rgba(255, 255, 255, .72);
  box-shadow: 0 10px 26px rgba(0, 0, 0, .07);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  cursor: pointer;
  transition: transform .18s ease, background .18s ease, opacity .18s ease;
}
.refresh-btn:hover { background: rgba(255, 255, 255, .92); }
.refresh-btn:active { transform: scale(.94); }
.refresh-btn.is-loading { opacity: .68; pointer-events: none; }
.refresh-btn.is-loading i { animation: refresh-spin .9s linear infinite; }
@keyframes refresh-spin { to { transform: rotate(360deg); } }

.hero-card {
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  gap: 16px;
  margin-bottom: 16px;
}

.current-card,
.metrics-card,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

.current-card {
  display: grid;
  grid-template-columns: .82fr 1fr;
  gap: 26px;
  align-items: center;
  padding: 28px;
}

.score-line { display: flex; align-items: flex-end; gap: 6px; margin-top: 8px; }
.score-line span { font-size: clamp(76px, 10vw, 118px); line-height: .82; font-weight: 800; letter-spacing: -.08em; }
.score-line small { margin-bottom: 10px; color: var(--muted); font-size: 26px; font-weight: 650; }
.status-label { display: inline-flex; margin-top: 16px; padding: 9px 14px; border-radius: 999px; background: rgba(0, 122, 255, .1); color: var(--blue); font-weight: 700; }
.advice-copy h2 { margin: 0; font-size: clamp(24px, 3.5vw, 38px); line-height: 1.02; letter-spacing: -.045em; }
.advice-copy p { margin: 12px 0 0; color: var(--muted); font-size: 16px; line-height: 1.45; }
.updated, .source-meta { display: flex; align-items: center; gap: 8px; font-size: 13px !important; }
.source-meta { color: var(--blue) !important; font-weight: 700; }

.metrics-card {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  padding: 28px;
}
.metric { padding: 18px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: rgba(255, 255, 255, .54); }
.metric span { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 16px; font-weight: 700; }
.metric strong { display: block; margin-top: 16px; font-size: clamp(38px, 6vw, 66px); line-height: .88; letter-spacing: -.06em; font-weight: 800; }
.metric.weather-metric { grid-column: span 2; }
.metric.weather-metric strong {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: clamp(26px, 4vw, 42px);
  line-height: 1;
  letter-spacing: -.04em;
}
.metric.weather-metric strong i { color: var(--blue); font-size: .9em; }


.panel { padding: 26px; margin-top: 16px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.section-head h2 { margin: 0; font-size: 28px; letter-spacing: -.04em; }
.section-head p { margin: 8px 0 0; color: var(--muted); }

.map-panel { position: relative; overflow: hidden; }
.windy-map { width: 100%; height: min(66vh, 560px); min-height: 390px; border-radius: var(--radius-lg); overflow: hidden; background: #dfe7ee; border: 1px solid var(--line); }
.spot-marker { position: absolute; left: 50%; top: calc(50% + 54px); transform: translate(-50%, -50%); z-index: 500; pointer-events: none; display: grid; place-items: center; gap: 10px; }
.wind-arrow { width: 76px; height: 76px; display: grid; place-items: center; transform-origin: center; transition: transform .35s ease; filter: drop-shadow(0 8px 18px rgba(0,0,0,.22)); }
.wind-arrow svg { width: 70px; height: 70px; overflow: visible; }
.wind-arrow path { fill: none; stroke: rgba(255,255,255,.95); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.wind-map-label { padding: 9px 15px; border-radius: 999px; background: rgba(245,245,247,.84); border: 1px solid rgba(255,255,255,.76); color: #2b2b30; font-size: 16px; font-weight: 760; box-shadow: 0 12px 30px rgba(0,0,0,.18); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }

.debug-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.debug-grid > div { padding: 16px; border-radius: var(--radius-md); border: 1px solid var(--line); background: rgba(255,255,255,.55); }
.debug-grid span { display:block; color: var(--muted); font-size: 13px; font-weight: 700; margin-bottom: 7px; }
.debug-grid strong { font-size: 18px; letter-spacing: -.02em; }

@media (max-width: 900px) {
  .app { width: min(100% - 24px, 1160px); padding-top: 18px; }
  .app-header { align-items: flex-start; }
  .hero-card, .current-card { grid-template-columns: 1fr; }
  .metrics-card { grid-template-columns: 1fr 1fr; }
  .windy-map { height: 520px; min-height: 420px; }
  .debug-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .app-header { gap: 12px; }
  .app-icon { width: 48px; height: 48px; border-radius: 16px; }
  .app-icon img { width: 30px; height: 30px; }
  .live-pill { display: none; }
  .current-card, .metrics-card, .panel { padding: 18px; border-radius: 26px; }
  .metrics-card { grid-template-columns: 1fr; }
  .metric strong { font-size: 52px; }
  .windy-map { min-height: 420px; height: 62vh; }
  .spot-marker { top: calc(50% + 46px); }
}

.forecast-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.forecast-day-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255,255,255,.55);
}
.forecast-day-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.forecast-day-head h3 {
  margin: 0;
  font-size: 19px;
  letter-spacing: -.03em;
}
.forecast-score {
  display: inline-flex;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(0,122,255,.1);
  color: var(--blue);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}
.forecast-slots {
  display: grid;
  gap: 8px;
}
.forecast-slot {
  display: grid;
  grid-template-columns: 52px .75fr .9fr .65fr .9fr 1.2fr .65fr;
  align-items: center;
  gap: 10px;
  padding: 10px 11px;
  border-radius: 15px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.62);
  font-size: 14px;
}
.forecast-slot strong {
  font-size: 15px;
}
.gust-slot, .rain-slot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.gust-slot i, .rain-slot i {
  color: var(--blue);
  font-size: 13px;
}
.wind-slot, .dir-slot, .temp-slot { white-space: nowrap; }
.forecast-slot span {
  color: var(--muted);
  font-weight: 700;
}

.weather-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-weight: 800;
  min-width: 0;
}
.weather-chip i { color: var(--blue); font-size: 15px; }
.weather-chip em {
  font-style: normal;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.forecast-empty {
  color: var(--muted);
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-lg);
}
.map-error {
  display: grid;
  place-items: center;
  min-height: 260px;
  padding: 22px;
  color: var(--muted);
  text-align: center;
}
.map-error strong { color: var(--text); display: block; margin-bottom: 6px; }
@media (max-width: 900px) {
  .forecast-list { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .forecast-slot { grid-template-columns: 42px .8fr .9fr .55fr .9fr 30px; gap: 7px; font-size: 13px; }
  .forecast-slot .temp-slot { display:none; }
  .weather-chip em { display: none; }
  .gust-slot, .rain-slot { gap: 4px; }
  .metric.weather-metric { grid-column: auto; }
}

.oasi-marker {
  width: 22px !important;
  height: 22px !important;
  border-radius: 999px;
  background: rgba(255,255,255,.96);
  border: 3px solid rgba(0,122,255,.95);
  box-shadow: 0 10px 26px rgba(0,0,0,.22);
}
.oasi-marker span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
}
.windy-map .leaflet-control-zoom {
  border: 0;
  box-shadow: 0 10px 26px rgba(0,0,0,.16);
}
.windy-map .leaflet-control-zoom a {
  border: 0;
  color: #1d1d1f;
  background: rgba(255,255,255,.9);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}


.wind-particle-icon {
  background: transparent !important;
  border: 0 !important;
  pointer-events: none;
}
.wind-particle {
  width: 34px;
  height: 18px;
  display: block;
  position: relative;
  opacity: var(--alpha, .72);
  transform: rotate(var(--rot, 0deg)) scale(var(--scale, 1));
  transform-origin: center;
  filter: drop-shadow(0 2px 5px rgba(0,0,0,.18));
}
.wind-particle i {
  position: absolute;
  left: 4px;
  top: 8px;
  width: 24px;
  height: 2px;
  border-radius: 999px;
  background: rgba(255,255,255,.78);
}
.wind-particle i::before,
.wind-particle i::after {
  content: "";
  position: absolute;
  right: -1px;
  width: 8px;
  height: 2px;
  border-radius: 999px;
  background: rgba(255,255,255,.78);
  transform-origin: right center;
}
.wind-particle i::before { transform: rotate(34deg); }
.wind-particle i::after { transform: rotate(-34deg); }
.windy-map .leaflet-marker-icon.wind-particle-icon {
  margin: 0 !important;
}


.install-footer {
  margin-top: 18px;
  padding: 18px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--line);
  background: rgba(255,255,255,.64);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.install-app-btn {
  appearance: none;
  border: 1px solid rgba(0,122,255,.22);
  border-radius: 999px;
  background: rgba(0,122,255,.1);
  color: var(--blue);
  min-height: 46px;
  padding: 8px 16px 8px 10px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition: transform .18s ease, background .18s ease, opacity .18s ease;
}
.install-app-btn:hover { background: rgba(0,122,255,.16); }
.install-app-btn:active { transform: scale(.96); }
.install-app-btn span {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,.84);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.04);
}
.install-app-btn.is-installed {
  color: #188038;
  background: rgba(52,199,89,.12);
  border-color: rgba(52,199,89,.22);
}
.install-footer p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
  flex: 1 1 260px;
}
.install-help {
  width: 100%;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: rgba(255,255,255,.72);
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}
.install-help strong {
  display: block;
  color: var(--text);
  margin-bottom: 4px;
}
.install-help span { display: block; }

@media (max-width: 560px) {
  .install-footer { padding: 14px; border-radius: 26px; align-items: stretch; }
  .install-app-btn { justify-content: center; width: 100%; }
  .install-footer p { text-align: center; flex-basis: 100%; }
}
