# Day and night world map tooltip

> A world map with the night shadow worked out for now: each city shows its local time, its offset and whether it is day.

- Category: [Tooltips](https://library.aimran.es/components/tooltips)
- Built with: HTML + CSS
- Live editor: https://library.aimran.es/blocks/uv-tip-daynight-map
- Library: AIMRAN Library (https://library.aimran.es), free, no sign-up, by Aimran Oukham

## Where to use it

A low poly world map whose night side is calculated in the browser from the date and time, using the solar declination and the subsolar longitude, with a small sun marking where it is overhead. Hover or focus a city and a tooltip gives its local time and UTC offset through Intl in the page language, with a sun or moon icon depending on the sky there.

The main color sets the city dots, the second the ocean. Add cities with their coordinates and IANA time zone, and the shadow refreshes every thirty seconds. It suits remote teams, travel planners and event pages across time zones.

## Code

### HTML

```html
<div class="uvq08-tz" role="group" aria-label="Time around the world"><div class="wm"><svg viewBox="0 0 360 180" preserveAspectRatio="none" aria-hidden="true"><path class="gr" d="M0 45H360M0 90H360M0 135H360M60 0V180M120 0V180M180 0V180M240 0V180M300 0V180"/><polygon points="20,30 60,20 110,20 130,35 115,60 100,75 85,85 75,75 55,60 35,50 20,40"/><polygon points="100,95 120,95 145,110 135,135 120,160 110,150 105,120"/><polygon points="170,40 200,30 225,35 215,50 195,55 175,55"/><polygon points="165,70 200,65 225,85 230,105 215,130 200,145 190,125 185,100 165,95"/><polygon points="215,30 280,20 340,30 350,50 320,70 300,85 270,95 250,75 230,65 220,50"/><polygon points="290,120 320,115 335,130 320,145 295,140"/><polygon points="120,10 150,8 160,20 140,28 125,22"/><path class="nt" d="M0,0 L0,90.0 L6,67.8 L12,50.9 L18,39.6 L24,32.2 L30,27.1 L36,23.5 L42,20.9 L48,19.0 L54,17.5 L60,16.4 L66,15.6 L72,15.0 L78,14.6 L84,14.4 L90,14.3 L96,14.4 L102,14.6 L108,15.0 L114,15.6 L120,16.4 L126,17.5 L132,19.0 L138,20.9 L144,23.5 L150,27.1 L156,32.2 L162,39.6 L168,50.9 L174,67.8 L180,90.0 L186,112.2 L192,129.1 L198,140.4 L204,147.8 L210,152.9 L216,156.5 L222,159.1 L228,161.0 L234,162.5 L240,163.6 L246,164.4 L252,165.0 L258,165.4 L264,165.6 L270,165.7 L276,165.6 L282,165.4 L288,165.0 L294,164.4 L300,163.6 L306,162.5 L312,161.0 L318,159.1 L324,156.5 L330,152.9 L336,147.8 L342,140.4 L348,129.1 L354,112.2 L360,90.0 L360,0 Z"/></svg><i class="sun" aria-hidden="true" style="left:25.0%;top:58.0%"></i><button type="button" class="ct hc" style="left:22.5%;top:39.2%" data-tz="America/Mexico_City" data-lon="-99.1" data-lat="19.4" aria-label="Mexico City" aria-describedby="uvq08-tz-0"><span class="tt" role="tooltip" id="uvq08-tz-0"><b>Mexico City</b><span class="tm">12:00</span><span class="of"><svg class="d" viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="12" r="4.5"/><path d="M12 2.5v2.5M12 19v2.5M2.5 12H5M19 12h2.5M5.3 5.3l1.8 1.8M16.9 16.9l1.8 1.8M5.3 18.7l1.8-1.8M16.9 7.1l1.8-1.8"/></svg><svg class="n" viewBox="0 0 24 24" aria-hidden="true"><path d="M19.5 14.5A8 8 0 0 1 9.5 4.5a8 8 0 1 0 10 10z"/></svg><span class="ofs">GMT-6</span></span></span></button><button type="button" class="ct hc" style="left:29.4%;top:27.4%" data-tz="America/New_York" data-lon="-74" data-lat="40.7" aria-label="New York" aria-describedby="uvq08-tz-1"><span class="tt" role="tooltip" id="uvq08-tz-1"><b>New York</b><span class="tm">14:00</span><span class="of"><svg class="d" viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="12" r="4.5"/><path d="M12 2.5v2.5M12 19v2.5M2.5 12H5M19 12h2.5M5.3 5.3l1.8 1.8M16.9 16.9l1.8 1.8M5.3 18.7l1.8-1.8M16.9 7.1l1.8-1.8"/></svg><svg class="n" viewBox="0 0 24 24" aria-hidden="true"><path d="M19.5 14.5A8 8 0 0 1 9.5 4.5a8 8 0 1 0 10 10z"/></svg><span class="ofs">GMT-4</span></span></span></button><button type="button" class="ct hc nite pk" style="left:49.0%;top:27.6%" data-tz="Europe/Madrid" data-lon="-3.7" data-lat="40.4" aria-label="Madrid" aria-describedby="uvq08-tz-2"><span class="tt" role="tooltip" id="uvq08-tz-2"><b>Madrid</b><span class="tm">19:00</span><span class="of"><svg class="d" viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="12" r="4.5"/><path d="M12 2.5v2.5M12 19v2.5M2.5 12H5M19 12h2.5M5.3 5.3l1.8 1.8M16.9 16.9l1.8 1.8M5.3 18.7l1.8-1.8M16.9 7.1l1.8-1.8"/></svg><svg class="n" viewBox="0 0 24 24" aria-hidden="true"><path d="M19.5 14.5A8 8 0 0 1 9.5 4.5a8 8 0 1 0 10 10z"/></svg><span class="ofs">GMT+1</span></span></span></button><button type="button" class="ct hr nite" style="left:88.8%;top:30.2%" data-tz="Asia/Tokyo" data-lon="139.7" data-lat="35.7" aria-label="Tokyo" aria-describedby="uvq08-tz-3"><span class="tt" role="tooltip" id="uvq08-tz-3"><b>Tokyo</b><span class="tm">03:00</span><span class="of"><svg class="d" viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="12" r="4.5"/><path d="M12 2.5v2.5M12 19v2.5M2.5 12H5M19 12h2.5M5.3 5.3l1.8 1.8M16.9 16.9l1.8 1.8M5.3 18.7l1.8-1.8M16.9 7.1l1.8-1.8"/></svg><svg class="n" viewBox="0 0 24 24" aria-hidden="true"><path d="M19.5 14.5A8 8 0 0 1 9.5 4.5a8 8 0 1 0 10 10z"/></svg><span class="ofs">GMT+9</span></span></span></button><button type="button" class="ct hr nite" style="left:92.0%;top:68.8%" data-tz="Australia/Sydney" data-lon="151.2" data-lat="-33.9" aria-label="Sydney" aria-describedby="uvq08-tz-4"><span class="tt" role="tooltip" id="uvq08-tz-4"><b>Sydney</b><span class="tm">05:00</span><span class="of"><svg class="d" viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="12" r="4.5"/><path d="M12 2.5v2.5M12 19v2.5M2.5 12H5M19 12h2.5M5.3 5.3l1.8 1.8M16.9 16.9l1.8 1.8M5.3 18.7l1.8-1.8M16.9 7.1l1.8-1.8"/></svg><svg class="n" viewBox="0 0 24 24" aria-hidden="true"><path d="M19.5 14.5A8 8 0 0 1 9.5 4.5a8 8 0 1 0 10 10z"/></svg><span class="ofs">GMT+11</span></span></span></button></div><p class="hd" aria-hidden="true">Time around the world</p></div>
```

### CSS

```css
.uvq08-tz {
  --c1: #ffcf5c;
  --c2: #123a5e;
  --s: 16px;
  /* tamaño */
  --k: 1;
  /* velocidad */
  --fg: #1d1d1f;
  /* texto */
  --bg: #f5f5f7;
  /* fondo */
}

.uvq08-tz {
  font-family: -apple-system,BlinkMacSystemFont,"SF Pro Text","Inter",system-ui,sans-serif;
  font-size: var(--s);
  color: var(--fg);
  -webkit-tap-highlight-color: transparent;
  width: 18em;
  padding-top: 3.4em;
}

.uvq08-tz .hd {
  margin: .55em 0 0;
  font-size: .78em;
  font-weight: 700;
  text-align: center;
  color: color-mix(in srgb,var(--fg) 55%,transparent);
}

.uvq08-tz .wm {
  position: relative;
  height: 9em;
  border-radius: .8em;
  background: var(--c2);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08),0 1.2em 2em -1em rgba(0,0,0,.55);
}

.uvq08-tz .wm>svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: .8em;
}

.uvq08-tz .gr {
  fill: none;
  stroke: rgba(255,255,255,.08);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.uvq08-tz polygon {
  fill: #4f8f78;
  stroke: #3a6f5d;
  stroke-width: 1;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.uvq08-tz .nt {
  fill: rgba(2,6,23,.55);
  filter: blur(2px);
  transition: d calc(1s / var(--k)) linear;
}

.uvq08-tz .sun {
  position: absolute;
  width: 1.5em;
  height: 1.5em;
  translate: -50% -50%;
  border-radius: 50%;
  background: radial-gradient(circle,#fff6d1 0 22%,rgba(255,214,102,.5) 24% 30%,transparent 32%),repeating-conic-gradient(rgba(255,214,102,.85) 0 8deg,transparent 8deg 30deg);
  -webkit-mask: radial-gradient(circle,#000 0 62%,transparent 66%);
  mask: radial-gradient(circle,#000 0 62%,transparent 66%);
  pointer-events: none;
  animation: uvq08-tz-s 20s linear infinite;
}

@keyframes uvq08-tz-s {
  to {
    rotate: 360deg;
  }
}

.uvq08-tz .ct {
  font: inherit;
  color: inherit;
  border: 0;
  margin: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  position: absolute;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 1.7em;
  height: 1.7em;
  translate: -50% -50%;
  border-radius: 50%;
}

.uvq08-tz .ct::before {
  content: "";
  width: .6em;
  height: .6em;
  border-radius: 50%;
  background: var(--c1);
  box-shadow: 0 0 0 2px rgba(0,0,0,.35),0 0 .5em var(--c1);
  transition: transform calc(0.3s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uvq08-tz .ct:hover::before,.uvq08-tz .ct.pk::before {
  transform: scale(1.4);
}

.uvq08-tz .ct:active::before {
  transform: scale(.8);
}

.uvq08-tz .ct:focus-visible {
  outline: 2px solid var(--c1);
  outline-offset: 1px;
}

.uvq08-tz .tt {
  position: absolute;
  bottom: calc(100% + .25em);
  z-index: 3;
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  gap: 0 .7em;
  width: max-content;
  padding: .45em .7em;
  border-radius: .7em;
  font-size: .74em;
  line-height: 1.25;
  text-align: left;
  color: var(--bg);
  background: var(--fg);
  box-shadow: 0 .8em 1.6em -.6em rgba(0,0,0,.45);
  transform: translateY(.3em);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: all calc(0.2s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq08-tz .hc .tt {
  left: 50%;
  translate: -50% 0;
}

.uvq08-tz .hr .tt {
  right: 0;
}

.uvq08-tz .tt b {
  grid-column: 1/-1;
  font-size: .85em;
  opacity: .75;
}

.uvq08-tz .tm {
  font-size: 1.5em;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
}

.uvq08-tz .of {
  display: grid;
  justify-items: center;
  gap: .1em;
  font-size: .8em;
  font-weight: 650;
}

.uvq08-tz .of svg {
  width: 1.3em;
  height: 1.3em;
  fill: none;
  stroke: #f59e0b;
  stroke-width: 2;
  stroke-linecap: round;
}

.uvq08-tz .of .n {
  display: none;
  fill: #a5b4fc;
  stroke: none;
}

.uvq08-tz .nite .of .d {
  display: none;
}

.uvq08-tz .nite .of .n {
  display: block;
}

.uvq08-tz .ct:is(:hover,:focus-visible,.pk) {
  z-index: 4;
}

.uvq08-tz .ct:is(:hover,:focus-visible,.pk) .tt {
  transform: none;
  opacity: 1;
  visibility: visible;
}

@media (prefers-reduced-motion:reduce) {
  .uvq08-tz,.uvq08-tz *,.uvq08-tz *::before,.uvq08-tz *::after {
    animation-duration: .01ms!important;
    animation-iteration-count: 1!important;
    transition-duration: .01ms!important;
  }
}
```

### JavaScript

```js
document.querySelectorAll(".uvq08-tz").forEach(el => {
  const unpk=()=>{el.classList.remove("pk");el.querySelectorAll(".pk").forEach(x=>x.classList.remove("pk"))};el.addEventListener("pointerover",unpk,{once:true});el.addEventListener("focusin",unpk,{once:true});const nt=el.querySelector(".nt"),sun=el.querySelector(".sun"),lang=document.documentElement.lang||undefined,R=Math.PI/180;
const calc=d=>{const n=Math.floor((d.getTime()-Date.UTC(d.getUTCFullYear(),0,0))/864e5),dec=-23.44*Math.cos(2*Math.PI/365*(n+10))*R,ls=(12-d.getUTCHours()-d.getUTCMinutes()/60)*15,pts=[];for(let x=0;x<=360;x+=6)pts.push(x+","+(90-Math.atan(-Math.cos((x-180-ls)*R)/Math.tan(dec))/R).toFixed(1));const e=dec<0?0:180;return{p:"M0,"+e+" L"+pts.join(" L")+" L360,"+e+" Z",ls,dec}};
const upd=()=>{const d=new Date(),o=calc(d);nt.setAttribute("d",o.p);sun.style.left=(((o.ls+180)%360+360)%360/3.6)+"%";sun.style.top=((90-o.dec/R)/1.8)+"%";
el.querySelectorAll(".ct").forEach(c=>{const tz=c.dataset.tz,lat=+c.dataset.lat*R,lon=+c.dataset.lon;try{c.querySelector(".tm").textContent=d.toLocaleTimeString(lang,{timeZone:tz,hour:"2-digit",minute:"2-digit"});const p=new Intl.DateTimeFormat(lang,{timeZone:tz,timeZoneName:"shortOffset"}).formatToParts(d).find(x=>x.type==="timeZoneName");if(p)c.querySelector(".ofs").textContent=p.value}catch(e){}
const h=Math.sin(lat)*Math.sin(o.dec)+Math.cos(lat)*Math.cos(o.dec)*Math.cos((lon-o.ls)*R);c.classList.toggle("nite",h<0)})};
upd();const iv=setInterval(upd,30000);return()=>clearInterval(iv)
});
```

### React

```tsx
// @ts-nocheck: setup() es JavaScript del DOM sin tipos, el mismo de la pestaña JS.
import { useEffect, useRef, type CSSProperties } from "react";

const css = `
.uvq08-tz {
  font-family: -apple-system,BlinkMacSystemFont,"SF Pro Text","Inter",system-ui,sans-serif;
  font-size: var(--s);
  color: var(--fg);
  -webkit-tap-highlight-color: transparent;
  width: 18em;
  padding-top: 3.4em;
}

.uvq08-tz .hd {
  margin: .55em 0 0;
  font-size: .78em;
  font-weight: 700;
  text-align: center;
  color: color-mix(in srgb,var(--fg) 55%,transparent);
}

.uvq08-tz .wm {
  position: relative;
  height: 9em;
  border-radius: .8em;
  background: var(--c2);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08),0 1.2em 2em -1em rgba(0,0,0,.55);
}

.uvq08-tz .wm>svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: .8em;
}

.uvq08-tz .gr {
  fill: none;
  stroke: rgba(255,255,255,.08);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.uvq08-tz polygon {
  fill: #4f8f78;
  stroke: #3a6f5d;
  stroke-width: 1;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.uvq08-tz .nt {
  fill: rgba(2,6,23,.55);
  filter: blur(2px);
  transition: d calc(1s / var(--k)) linear;
}

.uvq08-tz .sun {
  position: absolute;
  width: 1.5em;
  height: 1.5em;
  translate: -50% -50%;
  border-radius: 50%;
  background: radial-gradient(circle,#fff6d1 0 22%,rgba(255,214,102,.5) 24% 30%,transparent 32%),repeating-conic-gradient(rgba(255,214,102,.85) 0 8deg,transparent 8deg 30deg);
  -webkit-mask: radial-gradient(circle,#000 0 62%,transparent 66%);
  mask: radial-gradient(circle,#000 0 62%,transparent 66%);
  pointer-events: none;
  animation: uvq08-tz-s 20s linear infinite;
}

@keyframes uvq08-tz-s {
  to {
    rotate: 360deg;
  }
}

.uvq08-tz .ct {
  font: inherit;
  color: inherit;
  border: 0;
  margin: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  position: absolute;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 1.7em;
  height: 1.7em;
  translate: -50% -50%;
  border-radius: 50%;
}

.uvq08-tz .ct::before {
  content: "";
  width: .6em;
  height: .6em;
  border-radius: 50%;
  background: var(--c1);
  box-shadow: 0 0 0 2px rgba(0,0,0,.35),0 0 .5em var(--c1);
  transition: transform calc(0.3s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uvq08-tz .ct:hover::before,.uvq08-tz .ct.pk::before {
  transform: scale(1.4);
}

.uvq08-tz .ct:active::before {
  transform: scale(.8);
}

.uvq08-tz .ct:focus-visible {
  outline: 2px solid var(--c1);
  outline-offset: 1px;
}

.uvq08-tz .tt {
  position: absolute;
  bottom: calc(100% + .25em);
  z-index: 3;
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  gap: 0 .7em;
  width: max-content;
  padding: .45em .7em;
  border-radius: .7em;
  font-size: .74em;
  line-height: 1.25;
  text-align: left;
  color: var(--bg);
  background: var(--fg);
  box-shadow: 0 .8em 1.6em -.6em rgba(0,0,0,.45);
  transform: translateY(.3em);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: all calc(0.2s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq08-tz .hc .tt {
  left: 50%;
  translate: -50% 0;
}

.uvq08-tz .hr .tt {
  right: 0;
}

.uvq08-tz .tt b {
  grid-column: 1/-1;
  font-size: .85em;
  opacity: .75;
}

.uvq08-tz .tm {
  font-size: 1.5em;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
}

.uvq08-tz .of {
  display: grid;
  justify-items: center;
  gap: .1em;
  font-size: .8em;
  font-weight: 650;
}

.uvq08-tz .of svg {
  width: 1.3em;
  height: 1.3em;
  fill: none;
  stroke: #f59e0b;
  stroke-width: 2;
  stroke-linecap: round;
}

.uvq08-tz .of .n {
  display: none;
  fill: #a5b4fc;
  stroke: none;
}

.uvq08-tz .nite .of .d {
  display: none;
}

.uvq08-tz .nite .of .n {
  display: block;
}

.uvq08-tz .ct:is(:hover,:focus-visible,.pk) {
  z-index: 4;
}

.uvq08-tz .ct:is(:hover,:focus-visible,.pk) .tt {
  transform: none;
  opacity: 1;
  visibility: visible;
}

@media (prefers-reduced-motion:reduce) {
  .uvq08-tz,.uvq08-tz *,.uvq08-tz *::before,.uvq08-tz *::after {
    animation-duration: .01ms!important;
    animation-iteration-count: 1!important;
    transition-duration: .01ms!important;
  }
}
`;

// Interacción en JavaScript del DOM: la misma que en la pestaña JS.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function setup(el: any) {
  const unpk=()=>{el.classList.remove("pk");el.querySelectorAll(".pk").forEach(x=>x.classList.remove("pk"))};el.addEventListener("pointerover",unpk,{once:true});el.addEventListener("focusin",unpk,{once:true});const nt=el.querySelector(".nt"),sun=el.querySelector(".sun"),lang=document.documentElement.lang||undefined,R=Math.PI/180;
const calc=d=>{const n=Math.floor((d.getTime()-Date.UTC(d.getUTCFullYear(),0,0))/864e5),dec=-23.44*Math.cos(2*Math.PI/365*(n+10))*R,ls=(12-d.getUTCHours()-d.getUTCMinutes()/60)*15,pts=[];for(let x=0;x<=360;x+=6)pts.push(x+","+(90-Math.atan(-Math.cos((x-180-ls)*R)/Math.tan(dec))/R).toFixed(1));const e=dec<0?0:180;return{p:"M0,"+e+" L"+pts.join(" L")+" L360,"+e+" Z",ls,dec}};
const upd=()=>{const d=new Date(),o=calc(d);nt.setAttribute("d",o.p);sun.style.left=(((o.ls+180)%360+360)%360/3.6)+"%";sun.style.top=((90-o.dec/R)/1.8)+"%";
el.querySelectorAll(".ct").forEach(c=>{const tz=c.dataset.tz,lat=+c.dataset.lat*R,lon=+c.dataset.lon;try{c.querySelector(".tm").textContent=d.toLocaleTimeString(lang,{timeZone:tz,hour:"2-digit",minute:"2-digit"});const p=new Intl.DateTimeFormat(lang,{timeZone:tz,timeZoneName:"shortOffset"}).formatToParts(d).find(x=>x.type==="timeZoneName");if(p)c.querySelector(".ofs").textContent=p.value}catch(e){}
const h=Math.sin(lat)*Math.sin(o.dec)+Math.cos(lat)*Math.cos(o.dec)*Math.cos((lon-o.ls)*R);c.classList.toggle("nite",h<0)})};
upd();const iv=setInterval(upd,30000);return()=>clearInterval(iv)
}

export default function TipDaynightMap() {
  const ref = useRef<HTMLDivElement>(null);

  useEffect(() => {
    const el = ref.current?.firstElementChild;
    return el ? setup(el) : undefined;
  }, []);

  return (
    <>
      <style>{css}</style>
      <div
        ref={ref} style={{
          "--c1": "#ffcf5c",
          "--c2": "#123a5e",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <div className="uvq08-tz" role="group" aria-label="Time around the world"><div className="wm"><svg viewBox="0 0 360 180" preserveAspectRatio="none" aria-hidden="true"><path className="gr" d="M0 45H360M0 90H360M0 135H360M60 0V180M120 0V180M180 0V180M240 0V180M300 0V180" /><polygon points="20,30 60,20 110,20 130,35 115,60 100,75 85,85 75,75 55,60 35,50 20,40" /><polygon points="100,95 120,95 145,110 135,135 120,160 110,150 105,120" /><polygon points="170,40 200,30 225,35 215,50 195,55 175,55" /><polygon points="165,70 200,65 225,85 230,105 215,130 200,145 190,125 185,100 165,95" /><polygon points="215,30 280,20 340,30 350,50 320,70 300,85 270,95 250,75 230,65 220,50" /><polygon points="290,120 320,115 335,130 320,145 295,140" /><polygon points="120,10 150,8 160,20 140,28 125,22" /><path className="nt" d="M0,0 L0,90.0 L6,67.8 L12,50.9 L18,39.6 L24,32.2 L30,27.1 L36,23.5 L42,20.9 L48,19.0 L54,17.5 L60,16.4 L66,15.6 L72,15.0 L78,14.6 L84,14.4 L90,14.3 L96,14.4 L102,14.6 L108,15.0 L114,15.6 L120,16.4 L126,17.5 L132,19.0 L138,20.9 L144,23.5 L150,27.1 L156,32.2 L162,39.6 L168,50.9 L174,67.8 L180,90.0 L186,112.2 L192,129.1 L198,140.4 L204,147.8 L210,152.9 L216,156.5 L222,159.1 L228,161.0 L234,162.5 L240,163.6 L246,164.4 L252,165.0 L258,165.4 L264,165.6 L270,165.7 L276,165.6 L282,165.4 L288,165.0 L294,164.4 L300,163.6 L306,162.5 L312,161.0 L318,159.1 L324,156.5 L330,152.9 L336,147.8 L342,140.4 L348,129.1 L354,112.2 L360,90.0 L360,0 Z" /></svg><i className="sun" aria-hidden="true" style={{ left: "25.0%", top: "58.0%" }}></i><button type="button" className="ct hc" style={{ left: "22.5%", top: "39.2%" }} data-tz="America/Mexico_City" data-lon="-99.1" data-lat="19.4" aria-label="Mexico City" aria-describedby="uvq08-tz-0"><span className="tt" role="tooltip" id="uvq08-tz-0"><b>Mexico City</b><span className="tm">12:00</span><span className="of"><svg className="d" viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="12" r="4.5" /><path d="M12 2.5v2.5M12 19v2.5M2.5 12H5M19 12h2.5M5.3 5.3l1.8 1.8M16.9 16.9l1.8 1.8M5.3 18.7l1.8-1.8M16.9 7.1l1.8-1.8" /></svg><svg className="n" viewBox="0 0 24 24" aria-hidden="true"><path d="M19.5 14.5A8 8 0 0 1 9.5 4.5a8 8 0 1 0 10 10z" /></svg><span className="ofs">GMT-6</span></span></span></button><button type="button" className="ct hc" style={{ left: "29.4%", top: "27.4%" }} data-tz="America/New_York" data-lon="-74" data-lat="40.7" aria-label="New York" aria-describedby="uvq08-tz-1"><span className="tt" role="tooltip" id="uvq08-tz-1"><b>New York</b><span className="tm">14:00</span><span className="of"><svg className="d" viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="12" r="4.5" /><path d="M12 2.5v2.5M12 19v2.5M2.5 12H5M19 12h2.5M5.3 5.3l1.8 1.8M16.9 16.9l1.8 1.8M5.3 18.7l1.8-1.8M16.9 7.1l1.8-1.8" /></svg><svg className="n" viewBox="0 0 24 24" aria-hidden="true"><path d="M19.5 14.5A8 8 0 0 1 9.5 4.5a8 8 0 1 0 10 10z" /></svg><span className="ofs">GMT-4</span></span></span></button><button type="button" className="ct hc nite pk" style={{ left: "49.0%", top: "27.6%" }} data-tz="Europe/Madrid" data-lon="-3.7" data-lat="40.4" aria-label="Madrid" aria-describedby="uvq08-tz-2"><span className="tt" role="tooltip" id="uvq08-tz-2"><b>Madrid</b><span className="tm">19:00</span><span className="of"><svg className="d" viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="12" r="4.5" /><path d="M12 2.5v2.5M12 19v2.5M2.5 12H5M19 12h2.5M5.3 5.3l1.8 1.8M16.9 16.9l1.8 1.8M5.3 18.7l1.8-1.8M16.9 7.1l1.8-1.8" /></svg><svg className="n" viewBox="0 0 24 24" aria-hidden="true"><path d="M19.5 14.5A8 8 0 0 1 9.5 4.5a8 8 0 1 0 10 10z" /></svg><span className="ofs">GMT+1</span></span></span></button><button type="button" className="ct hr nite" style={{ left: "88.8%", top: "30.2%" }} data-tz="Asia/Tokyo" data-lon="139.7" data-lat="35.7" aria-label="Tokyo" aria-describedby="uvq08-tz-3"><span className="tt" role="tooltip" id="uvq08-tz-3"><b>Tokyo</b><span className="tm">03:00</span><span className="of"><svg className="d" viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="12" r="4.5" /><path d="M12 2.5v2.5M12 19v2.5M2.5 12H5M19 12h2.5M5.3 5.3l1.8 1.8M16.9 16.9l1.8 1.8M5.3 18.7l1.8-1.8M16.9 7.1l1.8-1.8" /></svg><svg className="n" viewBox="0 0 24 24" aria-hidden="true"><path d="M19.5 14.5A8 8 0 0 1 9.5 4.5a8 8 0 1 0 10 10z" /></svg><span className="ofs">GMT+9</span></span></span></button><button type="button" className="ct hr nite" style={{ left: "92.0%", top: "68.8%" }} data-tz="Australia/Sydney" data-lon="151.2" data-lat="-33.9" aria-label="Sydney" aria-describedby="uvq08-tz-4"><span className="tt" role="tooltip" id="uvq08-tz-4"><b>Sydney</b><span className="tm">05:00</span><span className="of"><svg className="d" viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="12" r="4.5" /><path d="M12 2.5v2.5M12 19v2.5M2.5 12H5M19 12h2.5M5.3 5.3l1.8 1.8M16.9 16.9l1.8 1.8M5.3 18.7l1.8-1.8M16.9 7.1l1.8-1.8" /></svg><svg className="n" viewBox="0 0 24 24" aria-hidden="true"><path d="M19.5 14.5A8 8 0 0 1 9.5 4.5a8 8 0 1 0 10 10z" /></svg><span className="ofs">GMT+11</span></span></span></button></div><p className="hd" aria-hidden="true">Time around the world</p></div>
      </div>
    </>
  );
}
```

## Prompt for AI assistants

Paste this into ChatGPT, Claude, Cursor, v0 or Lovable to adapt the block to your stack (Tailwind, Vue, Svelte…):

````text
I want to add the “Day and night world map tooltip” block (Tooltips) from AIMRAN Library to my project.

## What it is
A world map with the night shadow worked out for now: each city shows its local time, its offset and whether it is day.

## Chosen settings
- Main color: #ffcf5c
- Secondary color: #123a5e
- Size: 16px (from 12 to 24px)
- Speed: 1x (from 0.5 to 2x)
- Text: "Hora en el mundo"

## What I need
1. Add it to my project with the same look and animation as the reference code: same sizes, colours, radii, shadows, timings and easing.
2. It is built with plain HTML and CSS (the reference wraps it in a React component with its CSS). If my project uses something else (Vue, Svelte, Astro, plain HTML…), translate it without losing any behaviour. If I use Tailwind, turn the styles into classes; if not, keep the CSS in its own file.
3. Expose the settings above as props (or CSS variables) with those values as defaults.
4. Make it work well on phones: nothing that depends only on hover, touch targets of at least 44 px and no overflow on 320 px screens.
5. Make it look right in light and dark mode.
6. Keep it accessible: semantic HTML, roles and aria-* where needed, visible focus and keyboard support.
7. Respect prefers-reduced-motion: with reduced motion, no big animations but the same end result.

## Reference code
```tsx
// @ts-nocheck: setup() es JavaScript del DOM sin tipos, el mismo de la pestaña JS.
import { useEffect, useRef, type CSSProperties } from "react";

const css = `
.uvq08-tz {
  font-family: -apple-system,BlinkMacSystemFont,"SF Pro Text","Inter",system-ui,sans-serif;
  font-size: var(--s);
  color: var(--fg);
  -webkit-tap-highlight-color: transparent;
  width: 18em;
  padding-top: 3.4em;
}

.uvq08-tz .hd {
  margin: .55em 0 0;
  font-size: .78em;
  font-weight: 700;
  text-align: center;
  color: color-mix(in srgb,var(--fg) 55%,transparent);
}

.uvq08-tz .wm {
  position: relative;
  height: 9em;
  border-radius: .8em;
  background: var(--c2);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08),0 1.2em 2em -1em rgba(0,0,0,.55);
}

.uvq08-tz .wm>svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: .8em;
}

.uvq08-tz .gr {
  fill: none;
  stroke: rgba(255,255,255,.08);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.uvq08-tz polygon {
  fill: #4f8f78;
  stroke: #3a6f5d;
  stroke-width: 1;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.uvq08-tz .nt {
  fill: rgba(2,6,23,.55);
  filter: blur(2px);
  transition: d calc(1s / var(--k)) linear;
}

.uvq08-tz .sun {
  position: absolute;
  width: 1.5em;
  height: 1.5em;
  translate: -50% -50%;
  border-radius: 50%;
  background: radial-gradient(circle,#fff6d1 0 22%,rgba(255,214,102,.5) 24% 30%,transparent 32%),repeating-conic-gradient(rgba(255,214,102,.85) 0 8deg,transparent 8deg 30deg);
  -webkit-mask: radial-gradient(circle,#000 0 62%,transparent 66%);
  mask: radial-gradient(circle,#000 0 62%,transparent 66%);
  pointer-events: none;
  animation: uvq08-tz-s 20s linear infinite;
}

@keyframes uvq08-tz-s {
  to {
    rotate: 360deg;
  }
}

.uvq08-tz .ct {
  font: inherit;
  color: inherit;
  border: 0;
  margin: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  position: absolute;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 1.7em;
  height: 1.7em;
  translate: -50% -50%;
  border-radius: 50%;
}

.uvq08-tz .ct::before {
  content: "";
  width: .6em;
  height: .6em;
  border-radius: 50%;
  background: var(--c1);
  box-shadow: 0 0 0 2px rgba(0,0,0,.35),0 0 .5em var(--c1);
  transition: transform calc(0.3s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uvq08-tz .ct:hover::before,.uvq08-tz .ct.pk::before {
  transform: scale(1.4);
}

.uvq08-tz .ct:active::before {
  transform: scale(.8);
}

.uvq08-tz .ct:focus-visible {
  outline: 2px solid var(--c1);
  outline-offset: 1px;
}

.uvq08-tz .tt {
  position: absolute;
  bottom: calc(100% + .25em);
  z-index: 3;
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  gap: 0 .7em;
  width: max-content;
  padding: .45em .7em;
  border-radius: .7em;
  font-size: .74em;
  line-height: 1.25;
  text-align: left;
  color: var(--bg);
  background: var(--fg);
  box-shadow: 0 .8em 1.6em -.6em rgba(0,0,0,.45);
  transform: translateY(.3em);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: all calc(0.2s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq08-tz .hc .tt {
  left: 50%;
  translate: -50% 0;
}

.uvq08-tz .hr .tt {
  right: 0;
}

.uvq08-tz .tt b {
  grid-column: 1/-1;
  font-size: .85em;
  opacity: .75;
}

.uvq08-tz .tm {
  font-size: 1.5em;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
}

.uvq08-tz .of {
  display: grid;
  justify-items: center;
  gap: .1em;
  font-size: .8em;
  font-weight: 650;
}

.uvq08-tz .of svg {
  width: 1.3em;
  height: 1.3em;
  fill: none;
  stroke: #f59e0b;
  stroke-width: 2;
  stroke-linecap: round;
}

.uvq08-tz .of .n {
  display: none;
  fill: #a5b4fc;
  stroke: none;
}

.uvq08-tz .nite .of .d {
  display: none;
}

.uvq08-tz .nite .of .n {
  display: block;
}

.uvq08-tz .ct:is(:hover,:focus-visible,.pk) {
  z-index: 4;
}

.uvq08-tz .ct:is(:hover,:focus-visible,.pk) .tt {
  transform: none;
  opacity: 1;
  visibility: visible;
}

@media (prefers-reduced-motion:reduce) {
  .uvq08-tz,.uvq08-tz *,.uvq08-tz *::before,.uvq08-tz *::after {
    animation-duration: .01ms!important;
    animation-iteration-count: 1!important;
    transition-duration: .01ms!important;
  }
}
`;

// Interacción en JavaScript del DOM: la misma que en la pestaña JS.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function setup(el: any) {
  const unpk=()=>{el.classList.remove("pk");el.querySelectorAll(".pk").forEach(x=>x.classList.remove("pk"))};el.addEventListener("pointerover",unpk,{once:true});el.addEventListener("focusin",unpk,{once:true});const nt=el.querySelector(".nt"),sun=el.querySelector(".sun"),lang=document.documentElement.lang||undefined,R=Math.PI/180;
const calc=d=>{const n=Math.floor((d.getTime()-Date.UTC(d.getUTCFullYear(),0,0))/864e5),dec=-23.44*Math.cos(2*Math.PI/365*(n+10))*R,ls=(12-d.getUTCHours()-d.getUTCMinutes()/60)*15,pts=[];for(let x=0;x<=360;x+=6)pts.push(x+","+(90-Math.atan(-Math.cos((x-180-ls)*R)/Math.tan(dec))/R).toFixed(1));const e=dec<0?0:180;return{p:"M0,"+e+" L"+pts.join(" L")+" L360,"+e+" Z",ls,dec}};
const upd=()=>{const d=new Date(),o=calc(d);nt.setAttribute("d",o.p);sun.style.left=(((o.ls+180)%360+360)%360/3.6)+"%";sun.style.top=((90-o.dec/R)/1.8)+"%";
el.querySelectorAll(".ct").forEach(c=>{const tz=c.dataset.tz,lat=+c.dataset.lat*R,lon=+c.dataset.lon;try{c.querySelector(".tm").textContent=d.toLocaleTimeString(lang,{timeZone:tz,hour:"2-digit",minute:"2-digit"});const p=new Intl.DateTimeFormat(lang,{timeZone:tz,timeZoneName:"shortOffset"}).formatToParts(d).find(x=>x.type==="timeZoneName");if(p)c.querySelector(".ofs").textContent=p.value}catch(e){}
const h=Math.sin(lat)*Math.sin(o.dec)+Math.cos(lat)*Math.cos(o.dec)*Math.cos((lon-o.ls)*R);c.classList.toggle("nite",h<0)})};
upd();const iv=setInterval(upd,30000);return()=>clearInterval(iv)
}

export default function TipDaynightMap() {
  const ref = useRef<HTMLDivElement>(null);

  useEffect(() => {
    const el = ref.current?.firstElementChild;
    return el ? setup(el) : undefined;
  }, []);

  return (
    <>
      <style>{css}</style>
      <div
        ref={ref} style={{
          "--c1": "#ffcf5c",
          "--c2": "#123a5e",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <div className="uvq08-tz" role="group" aria-label="Time around the world"><div className="wm"><svg viewBox="0 0 360 180" preserveAspectRatio="none" aria-hidden="true"><path className="gr" d="M0 45H360M0 90H360M0 135H360M60 0V180M120 0V180M180 0V180M240 0V180M300 0V180" /><polygon points="20,30 60,20 110,20 130,35 115,60 100,75 85,85 75,75 55,60 35,50 20,40" /><polygon points="100,95 120,95 145,110 135,135 120,160 110,150 105,120" /><polygon points="170,40 200,30 225,35 215,50 195,55 175,55" /><polygon points="165,70 200,65 225,85 230,105 215,130 200,145 190,125 185,100 165,95" /><polygon points="215,30 280,20 340,30 350,50 320,70 300,85 270,95 250,75 230,65 220,50" /><polygon points="290,120 320,115 335,130 320,145 295,140" /><polygon points="120,10 150,8 160,20 140,28 125,22" /><path className="nt" d="M0,0 L0,90.0 L6,67.8 L12,50.9 L18,39.6 L24,32.2 L30,27.1 L36,23.5 L42,20.9 L48,19.0 L54,17.5 L60,16.4 L66,15.6 L72,15.0 L78,14.6 L84,14.4 L90,14.3 L96,14.4 L102,14.6 L108,15.0 L114,15.6 L120,16.4 L126,17.5 L132,19.0 L138,20.9 L144,23.5 L150,27.1 L156,32.2 L162,39.6 L168,50.9 L174,67.8 L180,90.0 L186,112.2 L192,129.1 L198,140.4 L204,147.8 L210,152.9 L216,156.5 L222,159.1 L228,161.0 L234,162.5 L240,163.6 L246,164.4 L252,165.0 L258,165.4 L264,165.6 L270,165.7 L276,165.6 L282,165.4 L288,165.0 L294,164.4 L300,163.6 L306,162.5 L312,161.0 L318,159.1 L324,156.5 L330,152.9 L336,147.8 L342,140.4 L348,129.1 L354,112.2 L360,90.0 L360,0 Z" /></svg><i className="sun" aria-hidden="true" style={{ left: "25.0%", top: "58.0%" }}></i><button type="button" className="ct hc" style={{ left: "22.5%", top: "39.2%" }} data-tz="America/Mexico_City" data-lon="-99.1" data-lat="19.4" aria-label="Mexico City" aria-describedby="uvq08-tz-0"><span className="tt" role="tooltip" id="uvq08-tz-0"><b>Mexico City</b><span className="tm">12:00</span><span className="of"><svg className="d" viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="12" r="4.5" /><path d="M12 2.5v2.5M12 19v2.5M2.5 12H5M19 12h2.5M5.3 5.3l1.8 1.8M16.9 16.9l1.8 1.8M5.3 18.7l1.8-1.8M16.9 7.1l1.8-1.8" /></svg><svg className="n" viewBox="0 0 24 24" aria-hidden="true"><path d="M19.5 14.5A8 8 0 0 1 9.5 4.5a8 8 0 1 0 10 10z" /></svg><span className="ofs">GMT-6</span></span></span></button><button type="button" className="ct hc" style={{ left: "29.4%", top: "27.4%" }} data-tz="America/New_York" data-lon="-74" data-lat="40.7" aria-label="New York" aria-describedby="uvq08-tz-1"><span className="tt" role="tooltip" id="uvq08-tz-1"><b>New York</b><span className="tm">14:00</span><span className="of"><svg className="d" viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="12" r="4.5" /><path d="M12 2.5v2.5M12 19v2.5M2.5 12H5M19 12h2.5M5.3 5.3l1.8 1.8M16.9 16.9l1.8 1.8M5.3 18.7l1.8-1.8M16.9 7.1l1.8-1.8" /></svg><svg className="n" viewBox="0 0 24 24" aria-hidden="true"><path d="M19.5 14.5A8 8 0 0 1 9.5 4.5a8 8 0 1 0 10 10z" /></svg><span className="ofs">GMT-4</span></span></span></button><button type="button" className="ct hc nite pk" style={{ left: "49.0%", top: "27.6%" }} data-tz="Europe/Madrid" data-lon="-3.7" data-lat="40.4" aria-label="Madrid" aria-describedby="uvq08-tz-2"><span className="tt" role="tooltip" id="uvq08-tz-2"><b>Madrid</b><span className="tm">19:00</span><span className="of"><svg className="d" viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="12" r="4.5" /><path d="M12 2.5v2.5M12 19v2.5M2.5 12H5M19 12h2.5M5.3 5.3l1.8 1.8M16.9 16.9l1.8 1.8M5.3 18.7l1.8-1.8M16.9 7.1l1.8-1.8" /></svg><svg className="n" viewBox="0 0 24 24" aria-hidden="true"><path d="M19.5 14.5A8 8 0 0 1 9.5 4.5a8 8 0 1 0 10 10z" /></svg><span className="ofs">GMT+1</span></span></span></button><button type="button" className="ct hr nite" style={{ left: "88.8%", top: "30.2%" }} data-tz="Asia/Tokyo" data-lon="139.7" data-lat="35.7" aria-label="Tokyo" aria-describedby="uvq08-tz-3"><span className="tt" role="tooltip" id="uvq08-tz-3"><b>Tokyo</b><span className="tm">03:00</span><span className="of"><svg className="d" viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="12" r="4.5" /><path d="M12 2.5v2.5M12 19v2.5M2.5 12H5M19 12h2.5M5.3 5.3l1.8 1.8M16.9 16.9l1.8 1.8M5.3 18.7l1.8-1.8M16.9 7.1l1.8-1.8" /></svg><svg className="n" viewBox="0 0 24 24" aria-hidden="true"><path d="M19.5 14.5A8 8 0 0 1 9.5 4.5a8 8 0 1 0 10 10z" /></svg><span className="ofs">GMT+9</span></span></span></button><button type="button" className="ct hr nite" style={{ left: "92.0%", top: "68.8%" }} data-tz="Australia/Sydney" data-lon="151.2" data-lat="-33.9" aria-label="Sydney" aria-describedby="uvq08-tz-4"><span className="tt" role="tooltip" id="uvq08-tz-4"><b>Sydney</b><span className="tm">05:00</span><span className="of"><svg className="d" viewBox="0 0 24 24" aria-hidden="true"><circle cx="12" cy="12" r="4.5" /><path d="M12 2.5v2.5M12 19v2.5M2.5 12H5M19 12h2.5M5.3 5.3l1.8 1.8M16.9 16.9l1.8 1.8M5.3 18.7l1.8-1.8M16.9 7.1l1.8-1.8" /></svg><svg className="n" viewBox="0 0 24 24" aria-hidden="true"><path d="M19.5 14.5A8 8 0 0 1 9.5 4.5a8 8 0 1 0 10 10z" /></svg><span className="ofs">GMT+11</span></span></span></button></div><p className="hd" aria-hidden="true">Time around the world</p></div>
      </div>
    </>
  );
}
```

Give me the complete final code, ready to paste, and tell me in one line where to put it in my project.
````
