/* Weather Signal — early-90s cable look: banded colors, bevels, pixel type, CRT glass */
@font-face { font-family: 'VT323'; font-style: normal; font-weight: 400; font-display: swap; src: url(/fonts/VT323-400.ttf) format('truetype'); }
@font-face { font-family: 'Share Tech Mono'; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/ShareTechMono-400.ttf) format('truetype'); }
:root {
  --text: #ffffff;
  --accent: #ffd400;
  --cyan: #7ff0ff;
  --edge: #ff9d00;
  --ink: #000;
  --out: -2px -2px 0 #000, 2px -2px 0 #000, -2px 2px 0 #000, 2px 2px 0 #000, 4px 4px 0 #000;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: #050505; color: var(--text); font-family: 'Share Tech Mono', monospace; max-width: 100%; overflow-x: hidden; }

#stage { width: 100%; display: flex; justify-content: center; align-items: flex-start; padding: 12px 0; overflow: hidden; }
#screen {
  position: relative; flex: none; width: 640px; height: 480px; overflow: hidden; transform-origin: top center;
  font-family: 'VT323', monospace; text-shadow: var(--out); user-select: none;
  -webkit-font-smoothing: none; font-smooth: never;
  /* hard color bands instead of a smooth gradient */
  background: linear-gradient(180deg,
    #10063d 0 14%, #160852 14% 26%, #1d0b68 26% 38%, #250e7c 38% 50%,
    #2f128d 50% 62%, #3b1597 62% 74%, #4a1a9c 74% 86%, #5c1f9a 86% 100%);
  filter: saturate(1.15) contrast(1.06);
  border-radius: 14px;
}
/* CRT: scanlines + vignette + slight flicker */
#screen.scanlines::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 50;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,.32) 0 1px, transparent 1px 3px);
  animation: flicker 4s infinite steps(1);
}
#screen::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 51; border-radius: 14px;
  background: radial-gradient(ellipse at center, transparent 58%, rgba(0,0,0,.55) 100%);
  box-shadow: inset 0 0 40px rgba(120,160,255,.18);
}
@keyframes flicker { 0%,100% { opacity: 1; } 47% { opacity: .9; } 48% { opacity: 1; } 83% { opacity: .95; } }

/* Header bar */
#topbar { position: relative; height: 76px; display: flex; align-items: center; padding: 0 14px; gap: 12px;
  background: linear-gradient(180deg, #2a0f86 0 25%, #220b72 25% 50%, #1a085d 50% 75%, #130548 75% 100%);
  border-bottom: 4px solid var(--edge); box-shadow: 0 3px 0 #000, 0 6px 0 #ffd400; }
#brand { display: flex; align-items: center; gap: 6px; }
.logo { width: 52px; height: 52px; display: block; }
.logo svg { width: 100%; height: 100%; }
.brandtext { font-size: 25px; line-height: .85; color: #fff; text-transform: uppercase; letter-spacing: 1px; }
.brandtext b { display: block; color: var(--accent); font-weight: normal; }
#title { flex: 1; text-align: left; line-height: .9; padding-left: 14px; font-style: italic; }
#title1 { font-size: 34px; color: var(--accent); text-transform: uppercase; }
#title2 { font-size: 34px; color: #fff; text-transform: uppercase; }
#clock { text-align: right; font-size: 26px; line-height: .95; }
#date { color: var(--cyan); text-transform: uppercase; }

/* Main panel: banded fill + chunky bevel */
#panel { position: absolute; top: 92px; left: 18px; right: 18px; bottom: 60px; padding: 10px 16px;
  background: linear-gradient(180deg, #1650b0 0 20%, #1346a0 20% 40%, #103c90 40% 60%, #0d3280 60% 80%, #0a2870 80% 100%);
  border: 4px solid; border-color: #6fb0ff #04163f #04163f #6fb0ff;
  box-shadow: 0 0 0 3px #000, 6px 6px 0 3px rgba(0,0,0,.55); }
.wipe { animation: wipe .5s steps(8) both; }
@keyframes wipe { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }

#progress { position: absolute; left: 18px; right: 18px; bottom: 48px; height: 6px; background: #000; }
#progressbar { height: 100%; width: 0; background: repeating-linear-gradient(90deg, var(--accent) 0 6px, transparent 6px 8px); }

/* Ticker: beveled bar */
#ticker { position: absolute; bottom: 0; left: 0; right: 0; height: 42px; overflow: hidden; color: #fff;
  background: linear-gradient(180deg, #c9c9d6 0 3px, #8a8aa3 3px 6px, #4d4d6e 6px 100%);
  border-top: 3px solid #000; }
#ticker.alert { background: linear-gradient(180deg, #ff8a8a 0 3px, #c41919 3px 6px, #7d0000 6px 100%); }
#tickertext { white-space: nowrap; font-size: 31px; line-height: 44px; position: absolute; left: 100%; will-change: transform; }

/* Helpers */
.big { font-size: 74px; line-height: .9; }
.mid { font-size: 33px; }
.sm { font-size: 25px; }
.yellow { color: var(--accent); }
.cyan { color: var(--cyan); }
.center { text-align: center; }
.cols { display: flex; gap: 14px; height: 100%; }
.col { flex: 1; }
.pix { image-rendering: pixelated; shape-rendering: crispEdges; }
table.data { width: 100%; border-collapse: collapse; font-size: 28px; }
table.data td { padding: 0 4px; line-height: 1.05; }
table.data td:first-child { color: var(--cyan); }
table.data td:last-child { text-align: right; }

/* Current */
.cur-left { display: flex; flex-direction: column; align-items: center; justify-content: center; }
.cur-left svg { width: 128px; height: 112px; margin: 4px 0; }

/* Extended forecast */
.days { display: flex; gap: 8px; height: 100%; }
.day { flex: 1; text-align: center; padding: 6px 2px; display: flex; flex-direction: column; justify-content: space-between;
  background: linear-gradient(180deg, #0b2f84 0 50%, #082670 50% 100%);
  border: 3px solid; border-color: #5c9cff #021034 #021034 #5c9cff; }
.day svg { width: 80px; height: 70px; margin: 0 auto; }
.day .name { font-size: 32px; color: var(--accent); text-transform: uppercase; }
.day .cond { font-size: 21px; min-height: 42px; line-height: 1; }
.day .hi { font-size: 36px; }
.day .lo { font-size: 28px; color: var(--cyan); }

/* Text forecast */
.textfc { font-size: 29px; line-height: 1.05; }
.textfc .period { color: var(--accent); text-transform: uppercase; }

/* Hourly */
#hgraph { width: 560px; height: 150px; image-rendering: pixelated; }
.hours { display: flex; justify-content: space-between; }
.hour { text-align: center; font-size: 23px; flex: 1; line-height: 1; }
.hour svg { width: 44px; height: 38px; }

/* Radar */
#radarwrap { position: absolute; inset: 0; overflow: hidden; background: #0b1530; }
#radarwrap .layer { position: absolute; }
#radarwrap img { position: absolute; }
#radarwrap .basemap img { filter: brightness(1.25) sepia(1) saturate(1.6) hue-rotate(50deg) contrast(1.8) brightness(.55); image-rendering: pixelated; }
#radarwrap .labels img { filter: brightness(2.2) drop-shadow(1px 1px 0 #000) drop-shadow(-1px -1px 0 #000); }
#radarwrap .frame img { image-rendering: pixelated; }
.radar-time { position: absolute; right: 8px; top: 6px; font-size: 28px; background: #000; padding: 0 8px; border: 3px solid; border-color: #6fb0ff #04163f #04163f #6fb0ff; z-index: 5; }
.radar-pin { position: absolute; width: 12px; height: 12px; background: var(--accent); outline: 3px solid #000; z-index: 6; transform: translate(-50%,-50%); }
.radar-legend { position: absolute; left: 8px; bottom: 6px; z-index: 5; font-size: 22px; background: #000; padding: 0 8px; }

/* Almanac */
.moons { display: flex; justify-content: space-around; margin-top: 8px; }
.moon { text-align: center; font-size: 23px; }
.moon svg { width: 56px; height: 56px; }

/* Alerts */
.alertbox { background: #7d0000; border: 3px solid; border-color: #ff8a8a #3a0000 #3a0000 #ff8a8a; padding: 6px 8px; margin-bottom: 8px; }
.alertbox .h { color: #ffe9a0; font-size: 32px; text-transform: uppercase; }
.alertbox .d { font-size: 24px; }

/* Settings (outside the TV) */
#settings { max-width: 900px; margin: 6px auto 30px; padding: 12px 16px; background: #14112a; border: 1px solid #3a2f7a; border-radius: 8px; font-size: 14px; }
#settings .row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 8px 0; position: relative; }
#settings label { display: flex; align-items: center; gap: 6px; }
#settings label.grow { flex: 1; flex-direction: column; align-items: stretch; }
#settings input[type=text], #settings select { background: #0b0920; color: #fff; border: 1px solid #4b3fa0; padding: 6px 8px; border-radius: 4px; font-family: inherit; }
#locinput { width: 260px; }
#settings button { background: #ff9d00; color: #10063d; border: 0; padding: 7px 12px; border-radius: 4px; cursor: pointer; font-family: inherit; font-weight: bold; }
#settings button:hover { background: #ffd400; }
#locresults { position: absolute; top: 36px; left: 70px; margin: 0; padding: 0; list-style: none; background: #0b0920; border: 1px solid #4b3fa0; z-index: 10; min-width: 300px; }
#locresults li { padding: 6px 10px; cursor: pointer; }
#locresults li:hover { background: #2d1b78; }
#locresults:empty { display: none; }
#status { color: #9fe3a0; }
.credits { color: #9a93c9; font-size: 12px; }
.credits a { color: #c8c1ff; }

/* Kiosk */
body.kiosk #settings { display: none; }
body.kiosk { overflow: hidden; }
body.kiosk #stage { padding: 0; height: 100vh; }
body.kiosk #screen, body.kiosk #screen::before { border-radius: 0; }

/* ---------- Hand-drawn maps ---------- */
#mapwrap { position: absolute; inset: 0; overflow: hidden; background: #0c1748; }
#mapwrap .mapcanvas, .fieldlayer canvas { position: absolute; left: 0; top: 0; image-rendering: pixelated; }
.fieldlayer { position: absolute; inset: 0; }
.radarframe { position: absolute; inset: 0; }
.radarframe img { position: absolute; image-rendering: pixelated; }
#mapwrap .radar-time { z-index: 8; }
.maplabel { position: absolute; transform: translate(-50%, -50%); text-align: center; z-index: 7; line-height: .85; white-space: nowrap; }
.maplabel .mlname { font-size: 22px; color: #fff; }
.maplabel .mlrow { display: flex; align-items: center; justify-content: center; gap: 2px; }
.maplabel .mltemp { font-size: 36px; color: var(--accent); }
.maplabel svg { width: 38px; height: 33px; }
.maplabel.home .mlname { color: var(--cyan); }
.maplabel.small .mltemp { font-size: 36px; }
.maplabel.city { font-size: 21px; transform: translate(-4px, -50%); text-align: left; display: flex; align-items: center; gap: 4px; }
.maplabel.city i { display: inline-block; width: 7px; height: 7px; background: #fff; outline: 2px solid #000; }
.maplabel.city.home i { background: var(--accent); width: 10px; height: 10px; }
.maplegend { position: absolute; left: 8px; bottom: 6px; z-index: 8; font-size: 20px; background: #000; padding: 2px 8px; line-height: 1; border: 2px solid; border-color: #6fb0ff #04163f #04163f #6fb0ff; }
.maplegend span { display: inline-block; width: 14px; height: 12px; margin-right: 1px; vertical-align: middle; }

/* ---------- Grid tables ---------- */
table.grid { font-size: 27px; }
table.grid tr.hdr td { color: var(--accent); border-bottom: 3px solid #000; box-shadow: 0 2px 0 #6fb0ff; }
table.grid td { text-align: left; }
table.grid td:not(:first-child) { text-align: right; }
table.grid td.ic { text-align: center; width: 48px; }
table.grid td.ic svg { width: 36px; height: 30px; vertical-align: middle; }
table.travel td, table.hourtab td { line-height: 1; }

/* HBN: narrow viewports scale the 640x480 screen to fit (JS fit() sets the scale); controls reflow, nothing overflows sideways */
#settings { width: calc(100% - 24px); }
#settings input[type=text], #settings select { max-width: 100%; }
@media (max-width: 700px) {
  #settings { margin: 6px 12px 24px; padding: 10px 12px; }
  #settings .row { gap: 8px; }
  #settings label.grow, #settings label:has(#locinput) { flex: 1 1 100%; }
  #locinput, #customtext { width: 100%; }
  #locresults { left: 0; right: 0; min-width: 0; }
  .credits { overflow-wrap: anywhere; }
}

/* HBN clean broadcast: options stay in the DOM for app.js, but are hidden; screen is centered and scaled to fit */
#settings { display: none !important; }
html, body {
  margin: 0;
  height: 100%;
  max-width: 100%;
  background: #050505;
  overflow: hidden;
}
#stage {
  width: 100%;
  height: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 0;
  margin: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}
#screen { transform-origin: center center; }
