@font-face { font-family: 'VT323'; src: url(vendor/fonts/vt323.woff2) format('woff2'); font-display: swap; }

/* ---------------------------------------------------------------- themes */
[data-theme=phosphor] { --bg:#030803; --panel:#071208; --panel2:#0d1f10; --fg:#3dff6e; --dim:#22a046; --hi:#c8ffd6;
  --line:#16612b; --accent:#3dff6e; --accentfg:#021003; --warn:#e9ff5a; --danger:#ff6b5a; --good:#a4ffb0;
  --rain:#7cf0ff; --glow:0 0 6px rgba(61,255,110,.45); --tiles:grayscale(1) invert(1) brightness(.62) sepia(1) hue-rotate(68deg) saturate(2.6) contrast(1.15); }
[data-theme=amber] { --bg:#080500; --panel:#130b00; --panel2:#1f1300; --fg:#ffb21e; --dim:#b47a10; --hi:#ffe3a8;
  --line:#6a4504; --accent:#ffb21e; --accentfg:#140b00; --warn:#fff07a; --danger:#ff6040; --good:#ffd56b;
  --rain:#ffd9a0; --glow:0 0 6px rgba(255,178,30,.4); --tiles:grayscale(1) invert(1) brightness(.62) sepia(1) hue-rotate(-12deg) saturate(3) contrast(1.15); }
[data-theme=dos] { --bg:#0000a8; --panel:#000088; --panel2:#000070; --fg:#c8c8c8; --dim:#8c9ae0; --hi:#ffffff;
  --line:#55ffff; --accent:#00a8a8; --accentfg:#000000; --warn:#ffff55; --danger:#ff5555; --good:#55ff55;
  --rain:#55ffff; --glow:none; --tiles:saturate(.85) contrast(1.05); }
[data-theme=daylight] { --bg:#f3efe2; --panel:#fffdf6; --panel2:#ebe5d1; --fg:#141414; --dim:#55534a; --hi:#000000;
  --line:#bdb498; --accent:#0b6b2c; --accentfg:#ffffff; --warn:#8a5300; --danger:#b3261e; --good:#0b6b2c;
  --rain:#0b5394; --glow:none; --tiles:none; }

/* ---------------------------------------------------------------- base */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg); }
body { font-family: 'VT323', ui-monospace, 'Courier New', monospace; font-size: 20px; line-height: 1.15;
  text-shadow: var(--glow); overscroll-behavior: none; -webkit-text-size-adjust: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; text-shadow: inherit; }
button:focus-visible, input:focus-visible { outline: 2px dashed var(--hi); outline-offset: 2px; }
svg { display: block; }
small { font-size: 16px; color: var(--dim); letter-spacing: 0; }
.dim { color: var(--dim); }
.warn { color: var(--warn); }
.danger { color: var(--danger); }
.good { color: var(--good); }
.rain { color: var(--rain); }
.hi { color: var(--hi); }
.blink { animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

#app { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }

/* ---------------------------------------------------------------- top bar */
.topbar { display: flex; align-items: center; gap: 2px; padding: calc(env(safe-area-inset-top, 0px) + 6px) 6px 6px;
  background: var(--panel); border-bottom: 2px solid var(--line); }
.loc { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 6px 10px;
  border: 2px solid var(--line); background: var(--bg); text-align: left; }
.loc .sic { width: 20px; height: 20px; flex: none; color: var(--dim); }
#locName { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 22px; color: var(--hi); }
.icon { width: 44px; height: 44px; flex: none; display: grid; place-items: center; }
.icon svg { width: 24px; height: 24px; }
#favBtn.on { color: var(--warn); }
.status { display: block; width: 100%; text-align: left; padding: 4px 12px; font-size: 17px; color: var(--dim);
  background: var(--panel); border-bottom: 1px solid var(--line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status u { color: var(--fg); }

/* ---------------------------------------------------------------- tabs */
main { flex: 1; min-height: 0; position: relative; }
.tab { position: absolute; inset: 0; overflow-y: auto; display: none; padding: 12px 12px 28px; -webkit-overflow-scrolling: touch; }
.tab.active { display: block; }
#tab-map { padding: 0; overflow: hidden; }
.bottomnav { display: flex; background: var(--panel); border-top: 2px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0px); }
.bottomnav button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 0 9px;
  font-size: 17px; letter-spacing: 1px; color: var(--dim); }
.bottomnav button svg { width: 24px; height: 24px; }
.bottomnav button.active { background: var(--accent); color: var(--accentfg); text-shadow: none; }

.sec { font-size: 20px; font-weight: normal; margin: 20px 2px 8px; color: var(--hi); letter-spacing: 2px; }
.card { background: var(--panel); border: 2px solid var(--line); padding: 12px; margin-bottom: 12px; }
.foot { color: var(--dim); font-size: 16px; margin: 18px 2px; }
.empty { padding: 40px 16px; text-align: center; color: var(--dim); font-size: 22px; }
.empty .btn { margin-top: 18px; }
.btn { display: inline-block; padding: 10px 16px; min-height: 44px; border: 2px solid var(--accent); color: var(--accent); font-size: 20px; letter-spacing: 1px; }
.btn.solid { background: var(--accent); color: var(--accentfg); text-shadow: none; }

/* ---------------------------------------------------------------- install banner */
.install { display: flex; gap: 10px; align-items: center; border: 2px dashed var(--accent); padding: 10px 12px; margin-bottom: 12px; }
.install div { flex: 1; font-size: 18px; }
.install .x { width: 32px; height: 32px; color: var(--dim); display: grid; place-items: center; }
.install .x svg { width: 16px; height: 16px; }

/* ---------------------------------------------------------------- hero */
.hero-top { display: flex; gap: 12px; align-items: center; }
.art { margin: 0; font-family: inherit; font-size: 17px; line-height: 1.02; color: var(--hi); white-space: pre; flex: none; }
.art.sun { color: var(--warn); }
.art.wet { color: var(--rain); }
.art.storm { color: var(--danger); }
.now-lbl { font-size: 16px; color: var(--dim); letter-spacing: 1px; }
.big { font-size: 88px; line-height: .85; color: var(--hi); }
.cond { font-size: 24px; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.stat { background: var(--panel2); padding: 7px 10px; border-left: 4px solid var(--line); }
.stat b { display: block; font-weight: normal; font-size: 15px; color: var(--dim); letter-spacing: 1px; }
.stat span { font-size: 25px; color: var(--hi); white-space: nowrap; }
.badges { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.badge { padding: 3px 9px; border: 2px solid currentColor; font-size: 19px; }
.badge.solid { background: currentColor; }
.badge.solid span { color: var(--bg); text-shadow: none; }
.campnote { margin-top: 8px; font-size: 18px; }

/* ---------------------------------------------------------------- hour strip */
.strip { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x proximity; scrollbar-width: thin; }
.hcell { flex: 0 0 62px; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 2px;
  background: var(--panel); border: 2px solid var(--line); scroll-snap-align: start; }
.hcell.night { background: var(--bg); }
.hcell.sel { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.hcell .ht { font-size: 17px; color: var(--dim); }
.hcell .hcond { font-size: 16px; padding: 0 3px; border: 1px solid currentColor; }
.hcell .htemp { font-size: 26px; color: var(--hi); }
.pbar { width: 16px; height: 38px; background: var(--panel2); border: 1px solid var(--line); position: relative; }
.pbar i { position: absolute; left: 0; right: 0; bottom: 0; background: var(--rain); }
.hcell .hp { font-size: 16px; color: var(--rain); }
.hcell .hw { font-size: 17px; white-space: nowrap; }
.arr { display: inline-block; }

/* ---------------------------------------------------------------- days */
.day { border: 2px solid var(--line); margin-bottom: 6px; background: var(--panel); }
.day.open { border-color: var(--accent); }
.drow { display: grid; grid-template-columns: 62px 42px minmax(0, 1fr) 104px 34px; gap: 6px; align-items: center;
  width: 100%; min-height: 54px; padding: 8px; text-align: left; }
.dname { font-size: 21px; color: var(--hi); line-height: 1; }
.dname small { display: block; font-size: 14px; }
.dcode { font-size: 17px; text-align: center; border: 1px solid currentColor; padding: 1px 0; }
.drain { font-size: 18px; color: var(--rain); white-space: nowrap; overflow: hidden; }
.drain.dry { color: var(--dim); }
.dtemp { display: flex; align-items: center; gap: 4px; font-size: 19px; }
.dtemp .lo { color: var(--dim); width: 28px; text-align: right; }
.dtemp .hi { width: 28px; color: var(--hi); }
.tbar { flex: 1; height: 8px; background: var(--panel2); position: relative; }
.tbar i { position: absolute; top: 0; bottom: 0; background: var(--fg); }
.dcamp { font-size: 20px; text-align: center; border: 2px solid currentColor; line-height: 26px; }
.ddetail { border-top: 2px dashed var(--line); padding: 10px; }
.dhead { display: flex; gap: 12px; align-items: flex-start; }
.dlines { flex: 1; min-width: 0; font-size: 18px; }
.dlines div { margin-bottom: 2px; }
.flag { display: inline-block; padding: 0 6px; margin: 2px 4px 0 0; background: var(--danger); color: var(--bg); text-shadow: none; }
.tablewrap { overflow-x: auto; margin-top: 10px; }
.htable { width: 100%; border-collapse: collapse; font-size: 18px; }
.htable th { font-weight: normal; color: var(--dim); text-align: right; padding: 2px 5px; font-size: 15px; white-space: nowrap; }
.htable td { text-align: right; padding: 5px; white-space: nowrap; }
.htable th:first-child, .htable td:first-child, .htable td.l { text-align: left; }
.htable tr.now td:first-child::before { content: '\25BA'; }
.htable tr.night td { color: var(--dim); }
.htable tr.sel td { background: var(--accent); color: var(--accentfg); text-shadow: none; }
.htable tbody tr { cursor: pointer; }
.dactions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- map */
#map { position: absolute; inset: 0; background: var(--bg); }
.leaflet-container { font-family: inherit; font-size: 18px; background: var(--bg); }
.leaflet-tile-pane { filter: var(--tiles); }
.wx-canvas { pointer-events: none; }
.chips { position: absolute; z-index: 600; top: 8px; left: 8px; right: 8px; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; padding: 6px 12px; min-height: 38px; background: var(--panel); border: 2px solid var(--line); font-size: 19px; }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accentfg); text-shadow: none; }
.chip.base { border-style: dashed; }
.mapbar { position: absolute; z-index: 600; left: 8px; right: 8px; bottom: 8px; background: var(--panel); border: 2px solid var(--line); padding: 6px 8px 8px; }
.legend { display: flex; font-size: 15px; line-height: 20px; }
.legend span { flex: 1; text-align: center; color: #000; text-shadow: none; white-space: nowrap; overflow: hidden; }
.legend .u { flex: none; padding-right: 6px; color: var(--dim); }
.scrub { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.scrub input { flex: 1; min-width: 0; accent-color: var(--accent); height: 30px; }
.play { width: 40px; height: 36px; border: 2px solid var(--accent); color: var(--accent); font-size: 18px; flex: none; }
.tlabel { flex: none; min-width: 112px; text-align: right; color: var(--hi); font-size: 19px; }
.mapmsg { position: absolute; z-index: 600; top: 56px; left: 50%; transform: translateX(-50%); background: var(--panel);
  border: 2px solid var(--line); padding: 4px 12px; font-size: 18px; display: none; white-space: nowrap; }
.mapmsg.show { display: block; }
.leaflet-bar a, .leaflet-bar a:hover { background: var(--panel); color: var(--fg); border-color: var(--line); font-family: inherit; }
.leaflet-control-zoom { margin-top: 60px !important; }
.leaflet-control-attribution { background: rgba(0,0,0,.55) !important; color: #ccc !important; font-size: 12px; }
.leaflet-control-attribution a { color: #fff !important; }
.leaflet-bottom { bottom: 88px; }
.pin { font-size: 30px; line-height: 30px; text-align: center; color: var(--danger); text-shadow: 0 0 3px #000, 0 0 8px #000; }
.pin.fav { font-size: 22px; color: var(--warn); }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--panel); color: var(--fg); border: 2px solid var(--accent); border-radius: 0; box-shadow: none; }
.leaflet-popup-content { margin: 10px 12px; font-size: 19px; line-height: 1.25; }
.leaflet-container a.leaflet-popup-close-button { color: var(--fg); }
.pop b { color: var(--hi); font-weight: normal; }
.popbtn { margin-top: 8px; padding: 6px 10px; background: var(--accent); color: var(--accentfg); text-shadow: none; width: 100%; }

/* ---------------------------------------------------------------- sources */
.dchips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 8px; }
.stable { width: 100%; border-collapse: collapse; font-size: 18px; }
.stable th { font-weight: normal; color: var(--dim); font-size: 15px; text-align: right; padding: 3px 4px; }
.stable td { padding: 6px 4px; text-align: right; border-top: 1px solid var(--line); white-space: nowrap; }
.stable th:first-child, .stable td:first-child { text-align: left; white-space: normal; }
.stable td small { display: block; }
.stable tr.cons td { color: var(--hi); border-top: 2px solid var(--accent); }
.st-ok { color: var(--good); } .st-fail { color: var(--danger); } .st-na { color: var(--dim); }
.about { font-size: 17px; color: var(--dim); margin-top: 16px; }
.about a { color: var(--fg); }

/* ---------------------------------------------------------------- sheets */
.sheet { position: fixed; inset: 0; z-index: 2000; display: flex; flex-direction: column; background: var(--bg); }
.sheet.hidden { display: none; }
.sheet-head { display: flex; align-items: center; gap: 4px; padding: calc(env(safe-area-inset-top, 0px) + 6px) 6px 6px;
  background: var(--panel); border-bottom: 2px solid var(--line); }
.sheet-title { font-size: 24px; color: var(--hi); letter-spacing: 2px; padding-left: 4px; }
#q { flex: 1; min-width: 0; font: inherit; font-size: 24px; color: var(--hi); background: var(--bg); border: 2px solid var(--accent);
  border-radius: 0; padding: 7px 10px; outline: none; -webkit-appearance: none; appearance: none; }
#q::-webkit-search-cancel-button { display: none; }
.scope { display: flex; gap: 6px; padding: 8px; border-bottom: 1px solid var(--line); }
.scope button { flex: 1; padding: 8px 4px; min-height: 40px; border: 2px solid var(--line); font-size: 18px; }
.scope button.on { background: var(--accent); border-color: var(--accent); color: var(--accentfg); text-shadow: none; }
.results { flex: 1; overflow-y: auto; padding-bottom: env(safe-area-inset-bottom, 0px); }
.res { display: flex; gap: 12px; align-items: center; width: 100%; min-height: 58px; padding: 8px 14px; border-bottom: 1px solid var(--line); text-align: left; }
.res .ri { width: 26px; flex: none; text-align: center; color: var(--accent); font-size: 24px; }
.res .rt { flex: 1; min-width: 0; }
.res .rn { font-size: 23px; color: var(--hi); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.res .rs { font-size: 16px; color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.res .rr { flex: none; font-size: 16px; color: var(--dim); text-align: right; }
.res mark { background: none; color: var(--accent); text-decoration: underline; }
.res.first { background: var(--panel); }
.rhead { padding: 12px 14px 4px; font-size: 16px; color: var(--dim); letter-spacing: 1px; }
.rmsg { padding: 18px 14px; color: var(--dim); font-size: 19px; }
.setbody { flex: 1; overflow-y: auto; padding: 8px 14px 30px; }
.setbody h3 { font-weight: normal; font-size: 18px; color: var(--dim); letter-spacing: 2px; margin: 18px 0 8px; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button { flex: 1 1 auto; min-height: 44px; padding: 6px 10px; border: 2px solid var(--line); font-size: 19px; }
.seg button.on { background: var(--accent); border-color: var(--accent); color: var(--accentfg); text-shadow: none; }
.setbody p { font-size: 18px; color: var(--dim); }
.setbody a { color: var(--fg); }

.toast { position: fixed; z-index: 3500; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  max-width: 92vw; background: var(--accent); color: var(--accentfg); text-shadow: none; padding: 8px 14px; font-size: 19px; }
.toast.hidden { display: none; }

/* CRT scanlines (off in daylight theme and when disabled) */
.crt { pointer-events: none; position: fixed; inset: 0; z-index: 3000;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,.16) 0 1px, transparent 1px 3px); }
body.nocrt .crt, [data-theme=daylight] .crt { display: none; }

/* ---------------------------------------------------------------- wide screens: forecast + map side by side */
@media (min-width: 900px) {
  main { display: grid; grid-template-columns: 440px 1fr; grid-template-rows: 100%; }
  .tab { position: relative; inset: auto; height: 100%; }
  #tab-forecast { display: block; border-right: 2px solid var(--line); }
  .bottomnav button[data-tab=forecast] { display: none; }
  .bottomnav { justify-content: flex-end; }
  .bottomnav button { flex: 0 0 160px; }
}
