
:root{
  --bg:#06121d;
  --panel:#081b2b;
  --text:#f3f8fb;
  --muted:#90a7b9;
  --line:#193a50;
  --accent:#1eb7eb;
  --good:#8be5aa;
  --warn:#ffc56d;
  --mil:#ff6161;
  --civil:#5dc9ff;
  --ship:#52e39b;
}

*{box-sizing:border-box}

html,body{
  width:100%;
  height:100%;
  margin:0;
  overflow:hidden;
  background:var(--bg);
  color:var(--text);
  font-family:Inter,system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
}

button{font:inherit}

.app{
  width:100vw;
  height:100dvh;
  display:grid;
  grid-template-rows:
    clamp(42px,4.8dvh,54px)
    minmax(0,1fr)
    clamp(28px,3.4dvh,34px)
    clamp(16px,1.9dvh,21px);
}

.topbar{
  display:grid;
  grid-template-columns:1fr auto 1fr;
  align-items:center;
  gap:12px;
  padding:0 clamp(12px,1.2vw,24px);
  background:#071827;
  border-bottom:1px solid var(--line);
}

.brand{
  font-size:clamp(14px,1.05vw,21px);
  font-weight:800;
  white-space:nowrap;
}

.location{
  font-size:clamp(11px,.95vw,18px);
  font-weight:750;
  letter-spacing:.07em;
  white-space:nowrap;
}

.top-status{
  justify-self:end;
  display:flex;
  gap:6px;
  align-items:center;
}

.status-pill{
  padding:3px 7px;
  border:1px solid rgba(139,229,170,.32);
  border-radius:999px;
  color:var(--good);
  background:rgba(14,44,41,.55);
  font-size:10px;
  white-space:nowrap;
}

.status-pill.muted{
  border-color:rgba(144,167,185,.28);
  color:var(--muted);
  background:rgba(14,31,44,.62);
}

.map-shell{
  position:relative;
  min-height:0;
  overflow:hidden;
  background:#020b12;
}

#map{
  width:100%;
  height:100%;
  background:#020b12;
}

.leaflet-container{
  font-family:inherit;
  background:#020b12;
}

.leaflet-control-attribution{
  background:rgba(6,18,29,.76)!important;
  color:#b1c0ca!important;
  font-size:9px!important;
}

.leaflet-control-attribution a{color:#b8d9eb!important}

.leaflet-control-zoom a{
  background:#0b1f2f!important;
  color:#eef8ff!important;
  border-color:#1b4058!important;
}

.map-tools{
  position:absolute;
  z-index:900;
  top:12px;
  right:12px;
  display:flex;
  padding:4px;
  gap:4px;
  background:rgba(6,18,29,.9);
  border:1px solid var(--line);
  border-radius:9px;
  backdrop-filter:blur(6px);
}

.map-tools button{
  border:0;
  border-radius:6px;
  padding:6px 10px;
  color:var(--muted);
  background:transparent;
  cursor:pointer;
  font-size:11px;
}

.map-tools button.active{
  background:var(--accent);
  color:#051018;
  font-weight:800;
}

.legend{
  position:absolute;
  left:12px;
  bottom:12px;
  z-index:850;
  display:flex;
  gap:12px;
  padding:6px 9px;
  border:1px solid var(--line);
  border-radius:8px;
  background:rgba(6,18,29,.88);
  color:#c8d8e3;
  font-size:9px;
  backdrop-filter:blur(5px);
}

.legend > div{
  display:flex;
  align-items:center;
  gap:5px;
}

.legend-dot{
  width:8px;
  height:8px;
  border-radius:50%;
  display:inline-block;
}

.ship-dot{background:var(--ship)}
.civil-dot{background:var(--civil)}
.military-dot{background:var(--mil)}

.traffic-panel{
  position:absolute;
  z-index:850;
  right:12px;
  top:53px;
  width:min(340px,29vw);
  max-height:calc(100% - 88px);
  overflow:auto;
  border:1px solid var(--line);
  border-radius:10px;
  background:rgba(6,18,29,.92);
  backdrop-filter:blur(7px);
}

.panel-head{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:8px;
  padding:8px 10px;
  border-bottom:1px solid var(--line);
  font-size:11px;
}

.panel-head span{
  color:var(--good);
  font-size:9px;
}


.traffic-section{
  border-top:1px solid var(--line);
}

.traffic-section:first-of-type{
  border-top:0;
}

.section-title{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:8px;
  padding:6px 10px 4px;
  color:#c6d5df;
  font-size:8px;
  letter-spacing:.08em;
}

.section-title span:last-child{
  color:var(--good);
}

.ship-list{
  max-height:170px!important;
}

.air-list{
  max-height:150px!important;
}

.traffic-list{
  max-height:210px;
  overflow:auto;
}

.traffic-item{
  display:grid;
  grid-template-columns:1fr auto;
  gap:2px 8px;
  padding:6px 10px;
  border-top:1px solid rgba(26,59,81,.55);
  font-size:9px;
}

.primary{
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  font-weight:750;
}

.secondary{
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  color:var(--muted);
}

.badge{
  align-self:start;
  border-radius:5px;
  padding:1px 4px;
  font-size:7px;
  letter-spacing:.07em;
}

.badge.mil{
  color:#ffd1d1;
  border:1px solid rgba(255,97,97,.45);
}

.empty{
  padding:9px 10px 10px;
  color:var(--muted);
  font-size:9px;
}

.mil-alert{
  position:absolute;
  z-index:1000;
  left:50%;
  top:12px;
  transform:translateX(-50%);
  display:none;
  max-width:min(720px,65vw);
  padding:8px 13px;
  border:1px solid rgba(255,97,97,.6);
  border-radius:9px;
  background:rgba(55,12,16,.93);
  color:#ffd4d4;
  text-align:center;
  font-size:11px;
  font-weight:800;
  backdrop-filter:blur(5px);
}

.mil-alert.show{display:block}


.ship-marker{
  width:24px!important;
  height:24px!important;
  margin-left:-12px!important;
  margin-top:-12px!important;
  border:none!important;
  background:transparent!important;
}

.vehicle-icon.ship{
  color:var(--ship);
  font-size:15px;
}

.badge.ship{
  color:#d5ffe9;
  border:1px solid rgba(82,227,155,.45);
}

.aircraft-marker{
  width:24px!important;
  height:24px!important;
  margin-left:-12px!important;
  margin-top:-12px!important;
  border:none!important;
  background:transparent!important;
}

.vehicle-icon{
  width:24px;
  height:24px;
  display:flex;
  align-items:center;
  justify-content:center;
  transform-origin:center;
  filter:drop-shadow(0 1px 2px rgba(0,0,0,.85));
}

.vehicle-icon.air{
  font-size:17px;
  color:var(--civil);
}

.vehicle-icon.air.military{
  color:var(--mil);
  font-size:19px;
}

.popup-title{
  font-weight:800;
  margin-bottom:5px;
}

.popup-row{
  margin:2px 0;
  color:#334956;
}

.ticker{
  min-height:0;
  display:grid;
  grid-template-columns:repeat(6,minmax(0,1fr));
  background:var(--panel);
  border-top:1px solid var(--line);
}

.tick{
  min-width:0;
  display:grid;
  grid-template-columns:auto auto;
  grid-template-rows:auto auto;
  align-content:center;
  column-gap:6px;
  padding:1px 7px;
  border-right:1px solid var(--line);
}

.tick:last-child{border-right:0}

.tick span{
  color:var(--muted);
  font-size:8px;
  letter-spacing:.07em;
  white-space:nowrap;
}

.tick strong{
  font-size:14px;
  line-height:1;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.tick small{
  grid-column:1/-1;
  margin-top:1px;
  overflow:hidden;
  text-overflow:ellipsis;
  color:var(--muted);
  font-size:7px;
  white-space:nowrap;
}

footer{
  display:flex;
  align-items:center;
  justify-content:center;
  padding:0 10px;
  border-top:1px solid var(--line);
  background:#030c14;
  color:#6f8798;
  font-size:clamp(7px,.52vw,10px);
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.error{color:var(--warn)}

@media (max-width:1100px){
  .traffic-panel{width:280px}
}

@media (max-aspect-ratio:4/3){
  html,body{overflow:auto}

  .app{
    height:auto;
    min-height:100dvh;
    grid-template-rows:48px 65dvh auto 22px;
  }

  .location{
    max-width:54vw;
    overflow:hidden;
    text-overflow:ellipsis;
    font-size:10px;
  }

  .traffic-panel{
    top:51px;
    right:8px;
    width:min(300px,76vw);
    max-height:48%;
  }

  .ticker{
    grid-template-columns:repeat(3,minmax(0,1fr));
  }

  .tick{
    min-height:38px;
  }
}
