:root {
  --fondo: #f3f0ea;
  --carta: #ffffff;
  --inchiostro: #17150f;
  --grigio: #8b867b;
  --riga: rgba(23, 21, 15, 0.08);
  --accento: #2f5bea;
  --accento-tenue: #e9eefc;
  --terra: #ece7dc;
  --isolato: #e3ddd0;
  --strada: #fbfaf7;
  --parco: #dbe4cf;
  --acqua: #d3e0ea;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--fondo);
  color: var(--inchiostro);
  font-family: 'Mona Sans Variable', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

.palco {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.app {
  position: relative;
  width: min(400px, calc(100vw - 32px));
  height: min(600px, calc(100vh - 24px));
  display: flex;
  flex-direction: column;
  background: var(--carta);
  border: 1px solid var(--riga);
  border-radius: clamp(16px, 3.6vmin, 24px);
  box-shadow: 0 1px 2px rgba(23, 21, 15, 0.05), 0 24px 60px -24px rgba(23, 21, 15, 0.22);
  overflow: hidden;
}

.testa {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: clamp(12px, 3.4vmin, 20px) clamp(14px, 3.6vmin, 20px) clamp(10px, 2.4vmin, 14px);
  border-bottom: 1px solid var(--riga);
}

.testa-sx { min-width: 0; }

.marchio {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 620;
  color: var(--grigio);
}
.marchio svg { width: 13px; height: 13px; fill: none; stroke: var(--accento); stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }

.titolo {
  margin-top: 3px;
  font-size: clamp(15px, 4.4vmin, 20px);
  font-weight: 640;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.sotto {
  margin-top: 2px;
  height: 1.3em;
  overflow: hidden;
  font-size: clamp(10.5px, 2.8vmin, 12px);
  color: var(--grigio);
}
.sotto span { display: inline-block; white-space: nowrap; }

.scelta {
  position: relative;
  flex: none;
  display: flex;
  padding: 3px;
  border-radius: 999px;
  background: #f1efe9;
  border: 1px solid var(--riga);
}

.scelta-pillola {
  position: absolute;
  top: 3px;
  left: 0;
  height: calc(100% - 6px);
  width: 0;
  border-radius: 999px;
  background: var(--carta);
  box-shadow: 0 1px 2px rgba(23, 21, 15, 0.1), 0 4px 10px -4px rgba(23, 21, 15, 0.2);
}

.scelta-voce {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px clamp(8px, 2.4vmin, 12px);
  border: 0;
  background: none;
  font: inherit;
  font-size: 12px;
  font-weight: 560;
  color: var(--grigio);
  cursor: pointer;
  border-radius: 999px;
  transition: color 0.25s ease;
}
.scelta-voce svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.scelta-voce.attiva { color: var(--inchiostro); }
.scelta-voce:focus-visible { outline: 2px solid var(--accento); outline-offset: 1px; }

.corpo {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.mappa { position: absolute; inset: 0; }
.mappa svg { width: 100%; height: 100%; display: block; }
.m-terra { fill: var(--terra); }
.m-parco { fill: var(--parco); }
.m-acqua { fill: var(--acqua); }
.m-isolati rect { fill: var(--isolato); }
.m-strade path { stroke: var(--strada); stroke-width: 10; fill: none; }
.m-vie path { stroke: var(--strada); stroke-width: 5; fill: none; }

.lista {
  position: absolute;
  inset: 0;
  list-style: none;
  display: grid;
  grid-template-rows: repeat(5, 1fr);
  padding: 6px clamp(8px, 2.4vmin, 12px);
  visibility: hidden;
}

.riga {
  position: relative;
  display: flex;
  align-items: center;
  gap: clamp(8px, 2.4vmin, 12px);
  padding: 0 clamp(6px, 1.6vmin, 8px);
  min-height: 0;
  border-radius: 12px;
}
.riga + .riga::before {
  content: '';
  position: absolute;
  left: 8px;
  right: 8px;
  top: 0;
  height: 1px;
  background: var(--riga);
}
.riga-fondo {
  position: absolute;
  inset: 2px 0;
  border-radius: 12px;
  background: #f6f4ef;
  opacity: 0;
}

.icona {
  position: relative;
  flex: none;
  width: clamp(26px, 7vmin, 34px);
  height: clamp(26px, 7vmin, 34px);
  border-radius: 9px;
  background: #f1efe9;
  display: grid;
  place-items: center;
}
.icona svg { width: 58%; height: 58%; fill: none; stroke: var(--inchiostro); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }

.testi { position: relative; flex: 1; min-width: 0; }
.nome {
  display: block;
  font-size: clamp(12px, 3.3vmin, 14px);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dati {
  display: block;
  margin-top: 1px;
  font-size: clamp(10px, 2.7vmin, 11.5px);
  color: var(--grigio);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.posto { flex: none; width: 58px; height: 26px; }

.segnaposti { position: absolute; inset: 0; pointer-events: none; }

.pin {
  position: absolute;
  left: 0;
  top: 0;
  width: 58px;
  height: 26px;
  pointer-events: auto;
  cursor: pointer;
}
.pin-corpo {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1px;
  border-radius: 999px;
  background: var(--carta);
  color: var(--inchiostro);
  font-size: 12px;
  font-weight: 640;
  box-shadow: 0 0 0 1px var(--riga), 0 6px 14px -6px rgba(23, 21, 15, 0.35);
}
.pin-corpo small { font-size: 9.5px; font-weight: 520; color: var(--grigio); margin-left: 1px; }
.pin-stelo {
  position: absolute;
  left: 50%;
  top: 100%;
  width: 10px;
  height: 7px;
  margin-left: -5px;
  margin-top: -1px;
  transform-origin: 50% 0;
}
.pin-stelo svg { width: 100%; height: 100%; display: block; fill: var(--carta); }
.pin-ombra {
  position: absolute;
  left: 50%;
  top: calc(100% + 6px);
  width: 16px;
  height: 5px;
  margin-left: -8px;
  border-radius: 50%;
  background: rgba(23, 21, 15, 0.22);
  filter: blur(2px);
}

.nome-al-passaggio {
  position: absolute;
  left: 0;
  top: 0;
  padding: 5px 9px;
  border-radius: 8px;
  background: var(--inchiostro);
  color: #fff;
  font-size: 11px;
  font-weight: 560;
  white-space: nowrap;
  pointer-events: none;
  visibility: hidden;
}

.puntatore {
  position: absolute;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  fill: var(--inchiostro);
  stroke: #fff;
  stroke-width: 1.4;
  stroke-linejoin: round;
  visibility: hidden;
  pointer-events: none;
  z-index: 5;
}

@media (max-height: 470px) {
  .marchio { display: none; }
  .titolo { margin-top: 0; }
}
@media (max-width: 360px) {
  .scelta-voce svg { display: none; }
}
