.nav-weather-root {
  position: fixed;
  right: 72px;
  top: 10px;
  z-index: 10002;
}

.nav-weather-root[hidden] {
  display: none !important;
}

body.has-nav-weather .nav-ai-quota-btn {
  right: 168px;
}

body.has-nav-weather .nav-ai-quota-panel {
  right: 168px;
}

.nav-weather-btn {
  height: 30px;
  min-width: 82px;
  padding: 0 6px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: rgba(29, 29, 31, 0.82);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font: inherit;
  font-size: 12px;
  line-height: 1;
  letter-spacing: 0;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.18s ease, opacity 0.18s ease, transform 0.12s ease;
}

.nav-weather-btn:hover,
.nav-weather-btn[aria-expanded="true"] {
  color: #1d1d1f;
}

.nav-weather-btn:hover {
  opacity: 0.76;
}

.nav-weather-btn:active {
  transform: scale(0.97);
}

.nav-weather-btn:focus-visible {
  outline: 2px solid rgba(10, 103, 212, 0.26);
  outline-offset: 2px;
}

.nav-weather-icon-wrap {
  width: 17px;
  height: 17px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 17px;
  color: #3579a9;
}

.nav-weather-qicon,
.nav-weather-fallback {
  grid-area: 1 / 1;
  font-size: 16px;
  line-height: 1;
}

.nav-weather-qicon {
  display: none;
}

.qweather-icons-ready .nav-weather-qicon {
  display: block;
}

.qweather-icons-ready .nav-weather-fallback {
  display: none;
}

.nav-weather-city {
  max-width: 38px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-weather-temperature {
  font-weight: 650;
  color: inherit;
}

.nav-weather-panel {
  position: fixed;
  top: 64px;
  right: 40px;
  z-index: 10002;
  width: min(340px, calc(100vw - 20px));
  padding: 15px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.24);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    inset 0 -1px 0 rgba(255, 255, 255, 0.28),
    0 18px 48px rgba(31, 39, 52, 0.16),
    0 3px 10px rgba(31, 39, 52, 0.07);
  backdrop-filter: blur(36px) saturate(180%);
  -webkit-backdrop-filter: blur(36px) saturate(180%);
}

/* The panel is portaled to body so backdrop-filter samples the workbench. */

.nav-weather-panel[hidden] {
  display: none !important;
}

.nav-weather-current {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
}

.nav-weather-place {
  margin: 0 0 5px;
  color: var(--text, #1d1d1f);
  font-size: 15px;
  font-weight: 650;
}

.nav-weather-source {
  margin-left: 5px;
  color: var(--muted, #777);
  font-size: 10px;
  font-weight: 500;
}

.nav-weather-condition {
  color: var(--muted, #777);
  font-size: 12px;
  line-height: 1.5;
}

.nav-weather-current-value {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text, #1d1d1f);
}

.nav-weather-current-value .nav-weather-icon-wrap {
  width: 28px;
  height: 28px;
  color: #3579a9;
}

.nav-weather-current-value .nav-weather-qicon,
.nav-weather-current-value .nav-weather-fallback {
  font-size: 27px;
}

.nav-weather-current-temp {
  font-size: 27px;
  font-weight: 620;
  line-height: 1;
}

.nav-weather-days {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(0, 0, 0, 0.065);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
}

.nav-weather-day {
  min-width: 0;
  padding: 5px 2px;
  display: grid;
  justify-items: center;
  gap: 5px;
  border-radius: 8px;
}

.nav-weather-day-name,
.nav-weather-day-condition,
.nav-weather-day-rain {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-weather-day-name {
  color: var(--muted, #777);
  font-size: 10px;
}

.nav-weather-day .nav-weather-icon-wrap {
  width: 23px;
  height: 23px;
}

.nav-weather-day .nav-weather-qicon,
.nav-weather-day .nav-weather-fallback {
  font-size: 22px;
}

.nav-weather-day-condition {
  color: var(--text, #1d1d1f);
  font-size: 11px;
}

.nav-weather-day-temperature {
  color: var(--text, #1d1d1f);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.nav-weather-day-temperature span {
  color: var(--muted, #777);
}

.nav-weather-day-rain {
  color: #467da3;
  font-size: 9px;
}

.nav-weather-footer {
  margin-top: 11px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  color: var(--muted, #777);
  font-size: 9px;
  line-height: 1.4;
}

.nav-weather-updated {
  margin-left: auto;
}

.nav-weather-footer a {
  color: inherit;
  text-decoration: none;
}

.nav-weather-footer a:hover {
  color: var(--text, #1d1d1f);
  text-decoration: underline;
}

html.theme-dark .nav-weather-btn {
  background: transparent;
  color: rgba(240, 240, 240, 0.82);
}

html.theme-dark .nav-weather-btn:hover,
html.theme-dark .nav-weather-btn[aria-expanded="true"] {
  background: transparent;
  color: #fff;
}

html.theme-dark .nav-weather-panel {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(31, 31, 33, 0.54);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.17),
    inset 0 -1px 0 rgba(255, 255, 255, 0.05),
    0 20px 52px rgba(0, 0, 0, 0.38);
}

html.theme-dark .nav-weather-days {
  border-top-color: rgba(255, 255, 255, 0.07);
}

@media (max-width: 920px) {
  .nav-weather-root { right: 64px; }
  .nav-weather-panel { right: 32px; }
  body.has-nav-weather .nav-ai-quota-btn,
  body.has-nav-weather .nav-ai-quota-panel { right: 160px; }
}

@media (max-width: 620px) {
  .nav-weather-btn {
    min-width: 48px;
    padding: 0 7px;
  }
  .nav-weather-city { display: none; }
  body.has-nav-weather .nav-ai-quota-btn { right: 132px; }
  body.has-nav-weather .nav-ai-quota-panel { right: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .nav-weather-btn { transition: none; }
}

@media (prefers-reduced-transparency: reduce) {
  .nav-weather-panel {
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  html.theme-dark .nav-weather-panel {
    background: rgba(31, 31, 33, 0.96);
  }
}

@media (prefers-contrast: more) {
  .nav-weather-panel {
    border-color: rgba(0, 0, 0, 0.34);
    background: rgba(255, 255, 255, 0.92);
  }

  html.theme-dark .nav-weather-panel {
    border-color: rgba(255, 255, 255, 0.52);
    background: rgba(24, 24, 25, 0.92);
  }
}
