/* Sondy meteo u Szafy - styl spójny z /energia (zielony szklany motyw) */
*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  background: radial-gradient(circle at 50% 0%, #00422b 0%, #131313 100%);
  background-attachment: fixed; min-height: 100vh;
  font-family: "Montserrat", system-ui, sans-serif; color: #e8e8f0;
}
a { color: #4edea3; text-decoration: none; }
a:hover { text-decoration: underline; }
.mono { font-family: "JetBrains Mono", ui-monospace, monospace; font-variant-numeric: tabular-nums; }

.glass-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  background: rgba(8,18,12,0.82); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(78,222,163,0.12); padding: .6rem 1.1rem;
}
.hdr-inner { max-width: 1300px; margin: 0 auto; display: flex; align-items: center; gap: .75rem; }
.hdr-logo { width: 42px; height: 42px; border-radius: 50%; overflow: hidden; flex-shrink: 0; border: 2px solid rgba(78,222,163,.35); }
.hdr-logo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hdr-titles h1 { color: #fff; font-size: 1.05rem; font-weight: 700; margin: 0; line-height: 1.2; }
.hdr-titles p { color: #4edea3; font-size: .62rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; margin: 0; }
.hdr-back { margin-left: auto; font-size: .8rem; font-weight: 600; white-space: nowrap; }

main { max-width: 1300px; margin: 0 auto; padding: 72px 1rem 60px; }
.legend .updated { margin-left: auto; color: rgba(255,255,255,.45); font-style: italic; }
h2 { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .14em; color: rgba(255,255,255,.5); margin: 0 0 .7rem; }
h2 small { color: #4edea3; letter-spacing: 0; font-size: .8rem; margin-left: .3rem; }

.layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 1rem; align-items: start; }
@media (max-width: 900px) { .layout { grid-template-columns: 1fr; } }

/* Mapa */
.map {
  position: relative; height: min(70vh, 640px); min-height: 360px; overflow: hidden;
  border-radius: 16px; border: 1px solid rgba(78,222,163,.18); background: #e5e3df;
  touch-action: none; cursor: grab; user-select: none;
}
.map.drag { cursor: grabbing; }
.tiles-layer, .overlay { position: absolute; inset: 0; width: 100%; height: 100%; }
.tiles-layer { filter: saturate(.9); }
.tiles-layer img { position: absolute; width: 256px; height: 256px; pointer-events: none; }
.overlay { pointer-events: none; }
.overlay .klik { pointer-events: auto; cursor: pointer; }
.map-ctrl { position: absolute; top: 10px; right: 10px; display: flex; flex-direction: column; gap: 4px; z-index: 2; }
.map-ctrl button {
  width: 34px; height: 34px; border-radius: 9px; border: 1px solid rgba(78,222,163,.3);
  background: rgba(8,18,12,.85); color: #e8e8f0; font: 600 1.1rem/1 "Montserrat", sans-serif; cursor: pointer;
}
.map-ctrl button:hover, .map-ctrl button:focus-visible { border-color: #4edea3; outline: none; }
.map-hist { position: absolute; left: 10px; top: 10px; z-index: 2; background: rgba(8,18,12,.85); border-radius: 9px;
  padding: .3rem .55rem; font-size: .72rem; color: rgba(255,255,255,.7); border: 1px solid rgba(78,222,163,.2); }
.map-attr { position: absolute; right: 0; bottom: 0; z-index: 2; font-size: .62rem; color: rgba(255,255,255,.55);
  background: rgba(8,18,12,.75); padding: 2px 6px; border-top-left-radius: 6px; }
.map-attr a { color: rgba(255,255,255,.75); }

.legend { display: flex; flex-wrap: wrap; gap: .4rem 1rem; font-size: .7rem; color: rgba(255,255,255,.55); margin: .6rem .2rem 0; }
.legend span { display: inline-flex; align-items: center; gap: .35rem; }
.lg { display: inline-block; width: 18px; height: 0; border-top: 2px solid; font-style: normal; }
.lg-dom { width: 10px; height: 10px; border: 2px solid #fff; background: #4edea3; border-radius: 50%; }
.lg-ring { border-top: 2px dashed #ff7a59; }
.lg-trk { border-color: #6b8cff; }
.lg-pred { border-top: 2px dashed #6b8cff; }
.lg-land { border: 0; width: auto; color: #ff7a59; font-weight: 700; font-size: 1rem; line-height: 0; }
.lg-hist { width: 9px; height: 9px; border: 0; border-radius: 50%; background: #8a9a92; }

/* Lista sond */
.side { min-width: 0; }
.lista { display: flex; flex-direction: column; gap: .6rem; max-height: min(70vh, 640px); overflow-y: auto; padding-right: 2px; }
.karta {
  background: rgba(255,255,255,.03); border: 1px solid rgba(78,222,163,.12); border-radius: 14px;
  padding: .7rem .85rem; cursor: pointer; transition: border-color .15s;
}
.karta:hover, .karta:focus-visible, .karta.wybrana { border-color: rgba(78,222,163,.55); outline: none; }
.karta.blisko { border-color: rgba(255,122,89,.6); background: rgba(255,122,89,.07); }
.karta__top { display: flex; align-items: center; gap: .45rem; margin-bottom: .45rem; }
.kropka { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; box-shadow: 0 0 0 2px #fff; }
.karta__serial { font-weight: 700; color: #fff; font-size: .92rem; }
.karta__typ { font-size: .7rem; color: rgba(255,255,255,.5); margin-left: auto; }
.chip { display: inline-block; font-size: .62rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  border-radius: 99px; padding: .12rem .45rem; margin-right: .25rem; }
.chip--ja { background: rgba(78,222,163,.16); color: #4edea3; }
.chip--up { background: rgba(120,170,255,.15); color: #9cc0ff; }
.chip--down { background: rgba(255,209,102,.15); color: #ffd166; }
.chip--lost { background: rgba(255,255,255,.08); color: rgba(255,255,255,.6); }
.chip--blisko { background: rgba(255,122,89,.18); color: #ff9c80; }
.karta dl { display: grid; grid-template-columns: auto 1fr; gap: .15rem .7rem; margin: .4rem 0 0; font-size: .76rem; }
.karta dt { color: rgba(255,255,255,.45); }
.karta dd { margin: 0; color: #e8e8f0; font-family: "JetBrains Mono", ui-monospace, monospace; font-variant-numeric: tabular-nums; }
.pusto { color: rgba(255,255,255,.45); font-size: .85rem; padding: 1rem; text-align: center;
  border: 1px dashed rgba(78,222,163,.2); border-radius: 14px; }

/* Historia */
.hist { margin-top: 1.8rem; }
.tbl-wrap { overflow-x: auto; border: 1px solid rgba(78,222,163,.12); border-radius: 14px; }
table { width: 100%; border-collapse: collapse; font-size: .78rem; }
th { text-align: left; font-size: .64rem; text-transform: uppercase; letter-spacing: .1em; color: rgba(255,255,255,.45);
  padding: .55rem .7rem; border-bottom: 1px solid rgba(78,222,163,.12); white-space: nowrap; }
td { padding: .45rem .7rem; border-bottom: 1px solid rgba(255,255,255,.04); white-space: nowrap;
  font-family: "JetBrains Mono", ui-monospace, monospace; font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: 0; }
td.blisko { color: #ff9c80; font-weight: 600; }

.note { color: rgba(255,255,255,.45); font-size: .76rem; line-height: 1.6; max-width: 70ch; margin: 1.4rem 0 0; }
footer { text-align: center; color: rgba(255,255,255,.35); font-size: .72rem; padding: 1.5rem 1rem 2rem; }

@media (max-width: 520px) {
  main { padding-left: 16px; padding-right: 16px; }
  .hdr-back { display: none; }
  .map { height: 62vh; }
}
@media (prefers-reduced-motion: reduce) { .karta { transition: none; } }

/* Mapa powiększona do 95% okna */
.map.duza { position: fixed; top: 2.5vh; left: 2.5vw; right: 2.5vw; bottom: 2.5vh; width: auto; height: auto; min-height: 0; max-height: none; z-index: 200;
  box-shadow: 0 0 0 100vmax rgba(0,0,0,.6), 0 20px 60px rgba(0,0,0,.5); }
.map.duza .map-hist { top: 10px; }
body.mapa-duza { overflow: hidden; }

/* Mój odbiornik */
.kanaly { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0 0 .7rem; font-size: .74rem; color: rgba(255,255,255,.55); }
.kanal { background: rgba(255,255,255,.04); border: 1px solid rgba(78,222,163,.14); border-radius: 99px; padding: .2rem .65rem;
  font-family: "JetBrains Mono", ui-monospace, monospace; font-variant-numeric: tabular-nums; }
.kanal b { color: #fff; font-weight: 600; }
.chip--off { background: rgba(255,90,90,.15); color: #ff8a8a; }
td.swieza { color: #4edea3; font-weight: 600; }

.moj-puls { transform-box: fill-box; transform-origin: center; animation: puls 2s ease-out infinite; }
@keyframes puls { 0% { opacity: 1; } 70% { opacity: .35; } 100% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .moj-puls { animation: none; } }
.lg-moj { width: 12px; height: 12px; border: 2.5px solid #0f9e6e; background: rgba(78,222,163,.3); border-radius: 50%; }

.kropka-puls { transform-box: fill-box; transform-origin: center; animation: kropka 1.4s ease-in-out infinite; }
@keyframes kropka { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(.7); } }
@media (prefers-reduced-motion: reduce) { .kropka-puls { animation: none; } }

.btn-gmaps { display: inline-block; font-family: "Montserrat", sans-serif; font-size: .68rem; font-weight: 700; letter-spacing: .03em;
  padding: .22rem .6rem; margin-right: .35rem; border-radius: 99px; background: #4edea3; color: #06231a; white-space: nowrap; }
.btn-gmaps:hover, .btn-gmaps:focus-visible { background: #7af0c0; text-decoration: none; outline: none; }

/* Mapa w oknie - dynamiczne jednostki (pasek adresu w telefonie, zoom przeglądarki) */
@supports (height: 100dvh) {
  .map.duza { top: 2.5dvh; bottom: 2.5dvh; }
  .map { height: min(70dvh, 640px); }
}
/* Niskie okno (np. zoom 125-150% na laptopie): mniejsze kontrolki, mapa nie wyższa niż okno */
@media (max-height: 700px) {
  .map { min-height: 300px; height: calc(100vh - 150px); }
  .map-ctrl { top: 6px; right: 6px; gap: 3px; }
  .map-ctrl button { width: 30px; height: 30px; font-size: 1rem; }
  .map-hist { top: 6px; left: 6px; }
  .lista { max-height: calc(100vh - 150px); }
}

.btn-teren { background: #ffd166; color: #2a1e00; }
.btn-teren:hover, .btn-teren:focus-visible { background: #ffe08f; }

/* ekrany dotykowe: większe przyciski mapy */
@media (pointer: coarse) {
  .map-ctrl { gap: 6px; }
  .map-ctrl button { width: 44px; height: 44px; font-size: 1.35rem; touch-action: manipulation; }
}
/* strzalka wznoszenia/opadania i RX przy ID sondy (26.11) */
.strz { font-size: .8rem; line-height: 1; }
.strz--up { color: #6ea8ff; }
.strz--down { color: #ff9f43; }
.karta__top .chip--rx { margin: 0; }
/* checkbox historii wysrodkowany w pionie z napisem i ramka (26.11) */
.map-hist { display: flex; align-items: center; gap: .4rem; line-height: 1.2; cursor: pointer; }
.map-hist input { margin: 0; width: 14px; height: 14px; flex: none; cursor: pointer; }
/* RX wczesniej - SQ7BCE-1 odebral sonde, teraz nie slyszy (szary) */
.chip--rxbyl { background: rgba(255,255,255,.08); color: rgba(255,255,255,.45); }
.chip--h2 { vertical-align: middle; position: relative; top: -2px; margin-right: .5rem; }

/* ID sondy, ktora wyladowala w zasiegu (user 27.11) */
.karta__serial--zasieg { color: #ff9c80; }
