:root {
  color-scheme: light;
  --meteoclim-blue: #00AFCE;
  --meteo-blue-dark: #008eaa;
  --meteo-orange: rgb(241, 93, 34);
  --meteo-green: rgb(141, 198, 63);
  --text: rgb(69, 85, 96);
  --heading: rgb(80, 89, 92);
  --muted: rgb(107, 116, 124);
  --soft: #f4f7f8;
  --panel: #ffffff;
  --line: rgba(69, 85, 96, 0.16);
  --warn: rgb(241, 93, 34);
  --error: #d94242;
  --ok: rgb(141, 198, 63);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  font-family: "Lato", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    linear-gradient(180deg, rgba(0, 175, 206, 0.12), rgba(255, 255, 255, 0) 36%),
    linear-gradient(135deg, #ffffff 0%, #f4f7f8 52%, #eef4f6 100%);
  color: var(--text);
  letter-spacing: 0;
}

.shell {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: max(8px, env(safe-area-inset-top)) 8px max(8px, env(safe-area-inset-bottom));
}

.hero {
  width: min(100%, 480px);
  min-height: calc(100svh - 16px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 24px 70px rgba(69, 85, 96, 0.18);
}

.brandbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 40px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.brand-logo {
  display: block;
  width: 132px;
  height: auto;
}

.brandbar span {
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 900;
  text-align: right;
  text-transform: uppercase;
}

.topbar,
.meta-grid {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.eyebrow,
.label {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 1.22rem;
  line-height: 1.08;
  color: var(--heading);
  font-weight: 900;
}

.status {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--soft);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--warn);
}

.status.ok .status-dot {
  background: var(--ok);
}

.status.error .status-dot {
  background: var(--error);
}

.readout {
  display: grid;
  gap: 10px;
}

.speed-panel,
.compass-panel,
.meta-grid > div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 12px 34px rgba(69, 85, 96, 0.08);
}

.speed-panel {
  position: relative;
  padding: 12px;
  overflow: hidden;
  border-top: 5px solid var(--meteoclim-blue);
}

.speed-line {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

#speedValue {
  font-variant-numeric: tabular-nums;
  font-size: clamp(3.35rem, 19vw, 6.4rem);
  line-height: 0.92;
  color: var(--heading);
  font-weight: 900;
}

.unit {
  color: var(--meteoclim-blue);
  font-size: 1.05rem;
  font-weight: 900;
}

.speed-sub {
  display: flex;
  gap: 10px;
  margin-top: 8px;
  color: var(--muted);
}

.speed-sub span {
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  font-weight: 900;
}

.speed-sub span:first-child {
  color: var(--meteoclim-blue);
}

.speed-sub span:last-child {
  color: var(--meteo-orange);
}

.compass-panel {
  display: grid;
  place-items: center;
  padding: 10px 10px 9px;
  border-top: 5px solid var(--meteo-green);
}

.compass {
  position: relative;
  width: min(64vw, 245px, 32svh);
  aspect-ratio: 1;
}

.ring,
.cardinal,
.tick,
.history,
.history-mark,
.needle,
.hub {
  position: absolute;
}

.ring {
  inset: 0;
  border-radius: 50%;
}

.ring-outer {
  border: 1px solid rgba(69, 85, 96, 0.22);
  background:
    radial-gradient(circle, #ffffff 0 56%, rgba(0, 175, 206, 0.08) 57% 59%, transparent 60%);
}

.ring-inner {
  inset: 16%;
  border: 1px solid rgba(69, 85, 96, 0.14);
}

.cardinal {
  color: var(--heading);
  font-size: 0.82rem;
  font-weight: 900;
}

.north { top: 8px; left: 50%; transform: translateX(-50%); color: var(--meteo-orange); }
.east { right: 11px; top: 50%; transform: translateY(-50%); }
.south { bottom: 8px; left: 50%; transform: translateX(-50%); }
.west { left: 11px; top: 50%; transform: translateY(-50%); }

.tick {
  left: 50%;
  top: 50%;
  width: 1px;
  height: 48%;
  transform-origin: 50% 0%;
}

.tick::before {
  content: "";
  position: absolute;
  top: 0;
  left: -1px;
  width: 3px;
  height: 12px;
  border-radius: 999px;
  background: rgba(69, 85, 96, 0.28);
}

.history {
  inset: 8%;
  border-radius: 50%;
  pointer-events: none;
}

.history-mark {
  left: 50%;
  top: 50%;
  width: 8px;
  height: 43%;
  transform-origin: 50% 100%;
  transform: translate(-50%, -100%) rotate(0deg);
}

.history-mark::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 2%;
  width: var(--mark-width, 4px);
  height: var(--mark-height, 60%);
  border-radius: 999px;
  transform: translateX(-50%);
  background: var(--meteoclim-blue);
  opacity: var(--mark-opacity, 0.18);
}

.t0 { transform: rotate(0deg) translateY(-50%); }
.t30 { transform: rotate(30deg) translateY(-50%); }
.t60 { transform: rotate(60deg) translateY(-50%); }
.t90 { transform: rotate(90deg) translateY(-50%); }
.t120 { transform: rotate(120deg) translateY(-50%); }
.t150 { transform: rotate(150deg) translateY(-50%); }
.t180 { transform: rotate(180deg) translateY(-50%); }
.t210 { transform: rotate(210deg) translateY(-50%); }
.t240 { transform: rotate(240deg) translateY(-50%); }
.t270 { transform: rotate(270deg) translateY(-50%); }
.t300 { transform: rotate(300deg) translateY(-50%); }
.t330 { transform: rotate(330deg) translateY(-50%); }

.needle {
  left: 50%;
  top: 50%;
  width: 6px;
  height: 39%;
  transform-origin: 50% 100%;
  transform: translate(-50%, -100%) rotate(0deg);
  transition: transform 700ms cubic-bezier(.2,.9,.2,1);
}

.needle::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--meteo-orange), var(--meteoclim-blue));
  box-shadow: none;
}

.needle-head {
  position: absolute;
  left: 50%;
  top: -8px;
  width: 0;
  height: 0;
  transform: translateX(-50%);
  border-left: 9px solid transparent;
  border-right: 9px solid transparent;
  border-bottom: 18px solid var(--meteo-orange);
}

.hub {
  left: 50%;
  top: 50%;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: var(--heading);
  box-shadow: 0 0 0 7px rgba(0, 175, 206, 0.10);
}

.direction {
  display: flex;
  align-items: baseline;
  gap: 7px;
  margin-top: 6px;
}

#directionValue {
  font-size: 1.7rem;
  color: var(--heading);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.degree,
#directionName {
  color: var(--muted);
  font-weight: 900;
}

#directionName {
  margin: 0;
}

.meta-grid {
  display: grid;
  grid-template-columns: 1fr;
}

.meta-grid > div {
  min-width: 0;
  padding: 9px 10px;
}

.meta-grid strong {
  display: block;
  overflow: hidden;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meta-grid > div:nth-child(2) {
  display: none;
}

@media (max-height: 720px) {
  .brandbar {
    min-height: 34px;
  }

  .brand-logo {
    width: 118px;
  }

  .brandbar span {
    display: none;
  }

  .hero {
    gap: 8px;
    padding: 10px;
  }

  .speed-panel,
  .compass-panel {
    border-top-width: 4px;
  }

  .compass {
    width: min(58vw, 210px, 30svh);
  }
}

@media (min-width: 760px) {
  .hero {
    min-height: 720px;
  }

  .readout {
    grid-template-columns: 1fr;
  }

  .meta-grid {
    grid-template-columns: 0.82fr 1.18fr;
  }

  .meta-grid > div:nth-child(2) {
    display: block;
  }
}
