:root {
  --weather-bar-top: var(--safe-top, 0px);
  --weather-change-toast-top: calc(var(--topbarHeight, 0px) + 12px);
}

.dsc-weather-bar {
  position: fixed;
  top: var(--weather-bar-top);
  left: 0;
  right: 0;
  z-index: 3450;
  min-height: 38px;
  color: #fff;
  box-shadow: 0 6px 18px var(--panel-shadow);
  transform: translateY(0);
  transition: top .2s ease, opacity .18s ease, transform .2s ease;
}

.dsc-weather-bar[hidden] { display: none; }

.dsc-weather-bar__button {
  width: 100%;
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px max(14px, env(safe-area-inset-right)) 6px max(14px, env(safe-area-inset-left));
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, .28);
  border-radius: 0;
  background: transparent;
  color: inherit;
  font: 650 13px/1.25 system-ui, -apple-system, "Segoe UI", sans-serif;
  text-align: left;
  cursor: pointer;
}

.dsc-weather-bar--topbar-collapsed .dsc-weather-bar__button {
  padding-left: 100px;
}

.dsc-weather-bar--yellow { background: #806600; color: #fffceb; }
.dsc-weather-bar--orange { background: #a94700; color: #fff8f1; }
.dsc-weather-bar--red { background: #a61d28; color: #fff5f6; }
.dsc-weather-bar--vigilance { background: #135f9d; color: #f5fbff; }

body.theme-light .dsc-weather-bar--yellow { background: #f5d547; color: #302600; }
body.theme-light .dsc-weather-bar--orange { background: #ee7a1a; color: #2f1200; }
body.theme-light .dsc-weather-bar--red { background: #d93a46; color: #fff; }
body.theme-light .dsc-weather-bar--vigilance { background: #d9edff; color: #07385f; }

.dsc-weather-bar__icon { flex: 0 0 auto; font-size: 15px; }
.dsc-weather-bar__brand { flex: 0 0 auto; font-size: 12px; letter-spacing: .035em; }
.dsc-weather-bar__divider { align-self: stretch; width: 1px; background: currentColor; opacity: .42; }
.dsc-weather-bar__text { min-width: 0; }
.dsc-weather-bar__text--compact { display: none; }
.dsc-weather-bar__zone { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: .94; }
.dsc-weather-bar__zone::before,
.dsc-weather-bar__expiry::before { content: "·"; margin-right: 9px; opacity: .68; }
.dsc-weather-bar__expiry { flex: 0 0 auto; opacity: .9; }

.dsc-weather-bar__button:focus-visible,
.dsc-weather-panel button:focus-visible,
.dsc-weather-change-toast button:focus-visible {
  outline: 3px solid #fff;
  outline-offset: -4px;
}

.dsc-weather-panel-overlay {
  position: fixed;
  inset: 0;
  z-index: 2147483001;
  display: grid;
  place-items: center;
  padding: max(18px, var(--safe-top, 0px)) 18px max(18px, var(--safe-bottom, 0px));
  background: rgba(3, 8, 13, .72);
  backdrop-filter: blur(5px);
}

.dsc-weather-panel-overlay[hidden] { display: none; }

.dsc-weather-panel {
  width: min(560px, 100%);
  max-height: min(720px, calc(100dvh - 36px));
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 22px 70px rgba(0, 0, 0, .48);
}

.dsc-weather-panel__header {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--panel) 94%, transparent);
  backdrop-filter: blur(8px);
}

.dsc-weather-panel__eyebrow { margin: 0 0 3px; color: var(--info); font-size: 11px; font-weight: 800; letter-spacing: .08em; }
.dsc-weather-panel h2 { margin: 0; font-size: 21px; }
.dsc-weather-panel__close {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 9px;
  background: var(--hover-bg);
  color: var(--text);
  font-size: 25px;
  cursor: pointer;
}

.dsc-weather-panel__content { padding: 18px 20px 22px; }
.dsc-weather-detail-zone { margin: 0 0 16px; }
.dsc-weather-detail-zone strong { display: block; font-size: 18px; }
.dsc-weather-detail-zone span { color: var(--muted); font-size: 12px; }
.dsc-weather-detail-section { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.dsc-weather-detail-section h3 { margin: 0 0 10px; font-size: 12px; letter-spacing: .06em; }
.dsc-weather-detail-summary { margin: 0 0 10px; font-weight: 800; }
.dsc-weather-detail-list { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.dsc-weather-detail-list li { display: flex; justify-content: space-between; gap: 16px; font-size: 13px; }
.dsc-weather-detail-list span:last-child { color: var(--muted); text-align: right; }
.dsc-weather-validity { margin: 11px 0 0; color: var(--muted); font-size: 12px; }
.dsc-weather-source,
.dsc-weather-disclaimer,
.dsc-weather-stale { font-size: 12px; line-height: 1.45; }
.dsc-weather-source { margin: 0 0 8px; }
.dsc-weather-disclaimer { margin: 0; color: var(--muted); }
.dsc-weather-stale { margin: 0 0 13px; padding: 9px 10px; border: 1px solid #d39b2a; border-radius: 8px; background: color-mix(in srgb, #d39b2a 14%, transparent); }

.dsc-weather-change-toast {
  position: fixed;
  top: var(--weather-change-toast-top);
  left: 14px;
  z-index: 10030;
  width: min(350px, calc(100vw - 28px));
  box-sizing: border-box;
  padding: 16px 16px 13px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--info);
  border-radius: 12px;
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 14px 38px rgba(0, 0, 0, .34);
  opacity: 0;
  transform: translate3d(-12px, 0, 0);
  transition: opacity .2s ease, transform .2s ease, top .2s ease;
}

.dsc-weather-change-toast[hidden] { display: none; }
.dsc-weather-change-toast.is-visible { opacity: 1; transform: translate3d(0, 0, 0); }
.dsc-weather-change-toast__title { display: block; padding-right: 30px; font-size: 15px; }
.dsc-weather-change-toast__message { margin: 7px 0 12px; color: var(--muted); font-size: 13px; line-height: 1.45; }
.dsc-weather-change-toast__close { position: absolute; top: 7px; right: 8px; width: 32px; height: 32px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 22px; cursor: pointer; }
.dsc-weather-change-toast__cta { display: block; margin-left: auto; padding: 7px 9px; border: 1px solid var(--border); border-radius: 8px; background: var(--hover-bg); color: var(--text); font: 700 12px/1 system-ui, sans-serif; cursor: pointer; }

@media (max-width: 640px) {
  .dsc-weather-bar__button { gap: 6px; padding-left: 10px; padding-right: 10px; }
  .dsc-weather-bar--topbar-collapsed .dsc-weather-bar__button { padding-left: 96px; }
  body.pwa-standalone .dsc-news-ticker.is-visible ~ .dsc-weather-bar--topbar-collapsed .dsc-weather-bar__button {
    padding-left: max(10px, env(safe-area-inset-left));
  }
  .dsc-weather-bar__brand { font-size: 11px; }
  .dsc-weather-bar__text--full,
  .dsc-weather-bar__expiry { display: none; }
  .dsc-weather-bar__text--compact { display: inline; }
  .dsc-weather-bar__zone { font-size: 12px; }
  .dsc-weather-panel-overlay { padding: 10px; }
  .dsc-weather-panel { max-height: calc(100dvh - 20px); border-radius: 13px; }
  .dsc-weather-panel__header,
  .dsc-weather-panel__content { padding-left: 15px; padding-right: 15px; }
  .dsc-weather-change-toast { left: 10px; width: min(330px, calc(100vw - 20px)); }
}

@media (max-width: 430px) {
  .dsc-weather-bar__zone { max-width: 34vw; }
}

@media (prefers-reduced-motion: reduce) {
  .dsc-weather-bar,
  .dsc-weather-change-toast { transition: none; }
}
