:root {
  --ws-blue-top: #1435a8;
  --ws-blue-mid: #0a1f6b;
  --ws-blue-bottom: #000a2e;
  --ws-yellow: #ffd400;
  --ws-white: #f2f4ff;
  --ws-cyan: #6fe3ff;
  --ws-red: #e8332a;
  --ws-green: #2ee66b;
  --panel-border: #5c7cff;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: #000;
  font-family: 'VT323', monospace;
  font-size: 20px;
  letter-spacing: 0.4px;
  overflow: hidden;
}

#crt {
  position: relative;
  width: 100%;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: radial-gradient(ellipse at top, var(--ws-blue-top) 0%, var(--ws-blue-mid) 45%, var(--ws-blue-bottom) 100%);
  color: var(--ws-white);
  text-shadow: 0 0 2px rgba(255,255,255,0.35);
}

.scanlines {
  pointer-events: none;
  position: absolute;
  inset: 0;
  z-index: 50;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0,0,0,0.15) 0px,
    rgba(0,0,0,0.15) 1px,
    transparent 2px,
    transparent 3px
  );
  mix-blend-mode: multiply;
  opacity: 0.5;
}

/* ---------- Top bar ---------- */
#topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px;
  background: linear-gradient(to bottom, rgba(0,0,0,0.35), transparent);
  border-bottom: 2px solid var(--panel-border);
}

.brand {
  font-family: 'Press Start 2P', monospace;
  font-size: 20px;
  color: var(--ws-white);
  letter-spacing: 1px;
}
.brand-accent { color: var(--ws-yellow); }

.location {
  font-size: 26px;
  color: var(--ws-cyan);
  letter-spacing: 1px;
  display: none;
}

@media (min-width: 640px) {
  .location { display: block; }
}

.clock {
  font-family: 'Press Start 2P', monospace;
  font-size: 18px;
  color: var(--ws-yellow);
}

/* ---------- Alert banner ---------- */
.alert-banner {
  background: repeating-linear-gradient(45deg, var(--ws-red), var(--ws-red) 10px, #8f0000 10px, #8f0000 20px);
  color: #fff;
  font-family: 'Press Start 2P', monospace;
  font-size: 16px;
  padding: 8px 14px;
  text-align: center;
}
.alert-banner.hidden { display: none; }

/* ---------- Screens ---------- */
main#screens {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.screen {
  position: absolute;
  inset: 0;
  padding: 18px 26px;
  display: none;
  flex-direction: column;
  animation: fadein 0.35s ease;
}
.screen.active { display: flex; }

@keyframes fadein {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.screen-title {
  font-family: 'Press Start 2P', monospace;
  font-size: 22px;
  color: var(--ws-yellow);
  margin: 0 0 16px 0;
  text-align: center;
  letter-spacing: 1px;
}

/* ---------- Current conditions ---------- */
.current-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 20px;
  flex: 1;
}
.current-icon img { width: 120px; height: 120px; image-rendering: pixelated; }
.current-temp {
  font-family: 'Press Start 2P', monospace;
  font-size: 72px;
  color: var(--ws-white);
}
.current-desc {
  font-size: 36px;
  color: var(--ws-cyan);
  width: 100%;
  text-align: center;
}
.current-details {
  font-size: 26px;
  color: var(--ws-white);
  width: 100%;
  display: flex;
  justify-content: center;
  gap: 24px;
  flex-wrap: wrap;
}
.obs-note {
  text-align: center;
  font-size: 18px;
  color: rgba(242,244,255,0.6);
}

/* ---------- Local forecast cards ---------- */
.local-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px;
  flex: 1;
  align-content: start;
}
.local-card {
  background: rgba(10, 25, 90, 0.55);
  border: 2px solid var(--panel-border);
  border-radius: 6px;
  padding: 10px;
  text-align: center;
}
.local-card h3 {
  color: var(--ws-yellow);
  margin: 0 0 6px 0;
  font-family: 'Press Start 2P', monospace;
  font-size: 13px;
}
.local-card img { width: 56px; height: 56px; image-rendering: pixelated; }
.local-card .temp { font-size: 34px; color: var(--ws-white); }
.local-card .desc { font-size: 20px; color: var(--ws-cyan); min-height: 40px; }
.local-card .pop { font-size: 18px; color: #9fd3ff; }

/* ---------- Extended forecast ---------- */
.extended-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  gap: 10px;
  flex: 1;
  align-content: start;
}
.extended-day {
  background: rgba(10, 25, 90, 0.55);
  border: 2px solid var(--panel-border);
  border-radius: 6px;
  padding: 8px 6px;
  text-align: center;
}
.extended-day h4 {
  margin: 0 0 4px 0;
  font-size: 18px;
  color: var(--ws-yellow);
}
.extended-day img { width: 40px; height: 40px; image-rendering: pixelated; }
.extended-day .hi { color: var(--ws-white); font-size: 26px; }
.extended-day .lo { color: #9fbaff; font-size: 22px; }
.extended-day .pop { color: #9fd3ff; font-size: 17px; }
.extended-note {
  margin-top: 10px;
  font-size: 17px;
  color: rgba(242,244,255,0.55);
  text-align: center;
}

/* ---------- Hourly forecast ---------- */
.hourly-row {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
}
.hourly-item {
  flex: 0 0 auto;
  min-width: 92px;
  background: rgba(10, 25, 90, 0.55);
  border: 2px solid var(--panel-border);
  border-radius: 6px;
  padding: 10px 6px;
  text-align: center;
}
.hourly-item .time { font-size: 16px; color: var(--ws-yellow); font-family: 'Press Start 2P', monospace; font-size: 11px; }
.hourly-item img { width: 40px; height: 40px; image-rendering: pixelated; margin: 6px 0; }
.hourly-item .temp { font-size: 26px; color: var(--ws-white); }
.hourly-item .pop { font-size: 15px; color: #9fd3ff; }
.hourly-item .wind { font-size: 13px; color: rgba(242,244,255,0.6); }

/* ---------- Almanac ---------- */
.screen[data-screen="almanac"] {
  justify-content: center;
}
.almanac-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 28px 48px;
  align-content: center;
  justify-content: center;
  align-items: center;
}
.almanac-item {
  text-align: center;
  min-width: 140px;
}
.almanac-item .label {
  font-family: 'Press Start 2P', monospace;
  font-size: 14px;
  color: var(--ws-yellow);
  margin-bottom: 6px;
}
.almanac-item .value { font-size: 36px; color: var(--ws-white); }

/* ---------- Radar ---------- */
#radarMap {
  flex: 1;
  min-height: 200px;
  border: 2px solid var(--panel-border);
  border-radius: 6px;
  filter: saturate(1.1) brightness(0.95);
}
.radar-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding-top: 10px;
  font-size: 22px;
}
.radar-controls button {
  font-family: 'VT323', monospace;
  font-size: 22px;
  background: var(--ws-blue-top);
  color: var(--ws-white);
  border: 2px solid var(--panel-border);
  border-radius: 4px;
  padding: 6px 14px;
  cursor: pointer;
}
.radar-controls button:hover { background: var(--ws-blue-mid); }

/* ---------- Forecaster / AI narration ---------- */
.forecaster-box {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: rgba(10, 25, 90, 0.4);
  border: 2px solid var(--panel-border);
  border-radius: 8px;
  padding: 24px;
  text-align: center;
}
.forecaster-avatar { font-size: 48px; }
#forecasterText {
  font-size: 30px;
  max-width: 640px;
  color: var(--ws-white);
  line-height: 1.4;
}
.refresh-btn {
  align-self: center;
  margin-top: 10px;
  font-family: 'VT323', monospace;
  font-size: 20px;
  background: var(--ws-blue-top);
  color: var(--ws-yellow);
  border: 2px solid var(--ws-yellow);
  border-radius: 4px;
  padding: 8px 16px;
  cursor: pointer;
}
.refresh-btn:hover { background: var(--ws-blue-mid); }
.refresh-btn:disabled { opacity: 0.5; cursor: default; }

/* ---------- Tabs ---------- */
#tabs {
  display: flex;
  justify-content: center;
  gap: 4px;
  padding: 8px 10px;
  background: rgba(0,0,0,0.35);
  border-top: 2px solid var(--panel-border);
  flex-wrap: wrap;
}
.tab {
  font-family: 'VT323', monospace;
  font-size: 20px;
  background: transparent;
  color: var(--ws-white);
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  padding: 4px 12px;
  cursor: pointer;
}
.tab.active {
  background: var(--ws-yellow);
  color: #000;
  font-weight: bold;
}

/* ---------- Ticker ---------- */
.ticker {
  background: #000;
  border-top: 2px solid var(--ws-yellow);
  overflow: hidden;
  white-space: nowrap;
  height: 40px;
  display: flex;
  align-items: center;
}
.ticker-track {
  display: inline-block;
  padding-left: 100%;
  color: var(--ws-yellow);
  font-size: 26px;
  animation: ticker-scroll 30s linear infinite;
}
@keyframes ticker-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-100%); }
}
