/* Shared floating overlay chrome (meteogram, replay bar, shader menu, …) */
:root {
  --ws-overlay-bg: #13131f;
  --ws-overlay-bg-soft: rgba(10, 14, 22, 0.92);
  --ws-overlay-border: #252540;
  --ws-overlay-header-bg: linear-gradient(135deg, #191930, #0e0e22);
  --ws-overlay-text: #eee;
  --ws-overlay-muted: #889;
  --ws-overlay-control-bg: #1c1c30;
  --ws-overlay-radius: 12px;
  --ws-overlay-shadow: 0 8px 32px rgba(0, 0, 0, 0.75);
  --ws-overlay-font: Arial, sans-serif;
  --ws-z-panel: 1200;
  --ws-z-shader: 10000;
  --ws-z-replay: 10050;
}

.ws-overlay-panel {
  position: fixed;
  display: none;
  flex-direction: column;
  background: var(--ws-overlay-bg);
  border: 1px solid var(--ws-overlay-border);
  border-radius: var(--ws-overlay-radius);
  box-shadow: var(--ws-overlay-shadow);
  color: var(--ws-overlay-text);
  font-family: var(--ws-overlay-font);
  font-size: 12px;
  overflow: hidden;
  z-index: var(--ws-z-panel);
}

.ws-overlay-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--ws-overlay-header-bg);
  border-bottom: 1px solid var(--ws-overlay-border);
  cursor: move;
  user-select: none;
  flex-shrink: 0;
}

.ws-overlay-title {
  font-weight: 700;
  font-size: 13px;
  color: var(--ws-overlay-text);
  flex: 1;
  min-width: 0;
}

.ws-overlay-controls {
  display: flex;
  gap: 8px;
  align-items: center;
}

.ws-overlay-panel select,
.ws-overlay-panel button,
.ws-overlay-btn {
  background: var(--ws-overlay-control-bg);
  color: #ddd;
  border: 1px solid #333;
  border-radius: 6px;
  padding: 4px 8px;
  cursor: pointer;
  font: inherit;
}

.ws-overlay-close {
  background: rgba(255, 255, 255, 0.07);
  border: none;
  color: #777;
  cursor: pointer;
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 5px;
  line-height: 1;
  flex-shrink: 0;
}

.ws-overlay-close:hover {
  background: rgba(220, 60, 60, 0.35);
  color: #fff;
}

.ws-overlay-footer {
  padding: 6px 12px;
  color: var(--ws-overlay-muted);
  border-top: 1px solid #1c1c30;
  font-size: 11px;
}

.ws-overlay-bar {
  position: fixed;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  z-index: var(--ws-z-replay);
  display: none;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: var(--ws-overlay-bg-soft);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  color: var(--ws-overlay-text);
  font: 12px/1.3 var(--ws-overlay-font);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
  min-width: 420px;
  max-width: 90vw;
}

.ws-overlay-bar .ws-overlay-btn {
  padding: 4px 10px;
}

.ws-overlay-bar input[type="range"] {
  flex: 1;
  min-width: 160px;
}

.ws-overlay-bar .ws-overlay-status {
  white-space: nowrap;
  opacity: 0.9;
}

/* Feature layout hooks (chrome comes from shared classes above) */
#meteogramPanel {
  right: 16px;
  bottom: 16px;
  width: 660px;
  max-width: calc(100vw - 24px);
}

#meteogramPanel canvas {
  display: block;
  width: 100%;
  height: auto;
  background: #0a0a14;
  cursor: crosshair;
}

#shaderMenuPanel {
  top: 50px;
  right: 420px;
  width: 540px;
  max-height: 92vh;
  z-index: var(--ws-z-shader);
}

/* NWS-style Emergency Alert System crawl (created by js/eas.js if missing) */
#easCrawl,
.eas-crawl {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 11000;
  display: none;
  align-items: stretch;
  height: 44px;
  background: #0a0a0a;
  border-top: 3px solid #e02020;
  color: #fff;
  font-family: "Arial Narrow", Arial, sans-serif;
  overflow: hidden;
  pointer-events: none;
}

#easCrawl.visible,
.eas-crawl.visible {
  display: flex;
}

.eas-crawl-badge {
  flex: 0 0 auto;
  background: #c00000;
  color: #fff;
  font-weight: 900;
  letter-spacing: 0.14em;
  padding: 0 14px;
  display: flex;
  align-items: center;
  font-size: 15px;
}

.eas-crawl-product {
  flex: 0 0 auto;
  background: #1a0000;
  color: #ffe8a0;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.06em;
  padding: 0 12px;
  display: flex;
  align-items: center;
  white-space: nowrap;
  border-right: 1px solid #533;
}

.eas-crawl-track {
  flex: 1 1 auto;
  overflow: hidden;
  display: flex;
  align-items: center;
}

.eas-crawl-text {
  white-space: nowrap;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding-left: 100%;
  animation: eas-crawl-scroll 28s linear infinite;
}

#easCrawl[data-type="TOR_WARN"] { border-top-color: #ff2020; }
#easCrawl[data-type="SVR_WARN"] { border-top-color: #ffcc22; }
#easCrawl[data-type="FFW_WARN"] { border-top-color: #22dd66; }

@keyframes eas-crawl-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-100%); }
}

#easProductCard,
.eas-product-card {
  position: fixed;
  left: 16px;
  bottom: 64px;
  z-index: 10900;
  display: none;
  flex-direction: column;
  width: min(420px, calc(100vw - 32px));
  max-height: min(46vh, 420px);
  overflow: hidden;
  background: rgba(8, 10, 16, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
  color: #f4f4f4;
  font-family: "Segoe UI", Tahoma, sans-serif;
  pointer-events: auto;
}

#easProductCard.visible,
.eas-product-card.visible {
  display: flex;
}

.eas-product-card-bar {
  height: 6px;
  background: #ffb040;
  flex: 0 0 auto;
}

.eas-product-card-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #ddd;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.eas-product-card-close:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.eas-product-card-kicker {
  padding: 12px 40px 0 14px;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #c8c8c8;
}

.eas-product-card-title {
  margin: 4px 40px 0 14px;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.2;
}

.eas-product-card-until {
  padding: 4px 14px 0;
  font-size: 12px;
  color: #ffd48a;
}

.eas-product-card-body {
  margin: 10px 14px 14px;
  font-size: 13px;
  line-height: 1.45;
  overflow-y: auto;
}

#easProductCard[data-type="TOR_WARN"] .eas-product-card-bar { background: #ff2020; }
#easProductCard[data-type="SVR_WARN"] .eas-product-card-bar { background: #ffcc22; }
#easProductCard[data-type="FFW_WARN"] .eas-product-card-bar { background: #22dd66; }
#easProductCard[data-type="TOR_WATCH"] .eas-product-card-bar { background: #ff3a3a; }
#easProductCard[data-type="SVR_WATCH"] .eas-product-card-bar { background: #ff78c8; }
#easProductCard[data-type="MD"] .eas-product-card-bar { background: #ffb040; }

/* Postcard capture — hide chrome for clean export */
body.ws-postcard-hide-chrome .dg.ac,
body.ws-postcard-hide-chrome .dg.main,
body.ws-postcard-hide-chrome .ws-overlay-panel,
body.ws-postcard-hide-chrome .ws-overlay-bar,
body.ws-postcard-hide-chrome #soundingDashboard,
body.ws-postcard-hide-chrome #easCrawl,
body.ws-postcard-hide-chrome #easProductCard,
body.ws-postcard-hide-chrome #wsForecastChallenge,
body.ws-postcard-hide-chrome #wsChaseHud {
  visibility: hidden !important;
}

/* Forecast challenge */
.ws-fc-body {
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ws-fc-help {
  margin: 0;
  color: var(--ws-overlay-muted);
  line-height: 1.4;
}

.ws-fc-label {
  font-size: 11px;
  color: #aab;
  margin-top: 4px;
}

.ws-fc-input {
  background: var(--ws-overlay-control-bg);
  color: #eee;
  border: 1px solid #333;
  border-radius: 6px;
  padding: 6px 8px;
  font: inherit;
}

.ws-fc-actions {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

.ws-fc-status {
  min-height: 1.2em;
  color: #9cf;
}

.ws-fc-score {
  font-size: 18px;
  margin-bottom: 8px;
}

.ws-fc-breakdown {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ws-fc-row {
  display: grid;
  grid-template-columns: 90px 1fr auto;
  gap: 8px;
  align-items: start;
  font-size: 11px;
  padding: 6px 8px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 6px;
}

.ws-fc-row span:nth-child(2) {
  color: #9aa;
}

/* Chase cam HUD + windshield FX */
#wsChaseHud {
  position: fixed;
  left: 50%;
  top: 14px;
  transform: translateX(-50%);
  z-index: 90;
  display: none;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(8, 12, 20, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #e8eef2;
  font: 600 12px/1.2 "Segoe UI", Tahoma, sans-serif;
  letter-spacing: 0.04em;
  pointer-events: none;
}

#wsChaseRain {
  position: fixed;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  display: none;
  background:
    repeating-linear-gradient(
      105deg,
      transparent 0 14px,
      rgba(180, 200, 220, 0.07) 14px 15px
    );
  opacity: 0;
  transition: opacity 0.25s ease;
  mix-blend-mode: screen;
}

body.ws-chase-cam #wsChaseHud { display: block; }
body.ws-chase-cam #wsChaseRain { display: block; }

