/* ══════════════════════════════════════════════════════════════════════════
   MAPPATURA MEDIA DIGITALI — Arcadia × Liberi Network
   Interfaccia tecnica: caselle, filetti, croci di registro. Tema chiaro/scuro.
   ══════════════════════════════════════════════════════════════════════════ */

@font-face {
  font-family: 'Bebas Neue';
  src: url('../fonts/bebas-802c4853.woff2') format('woff2');
  font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Archivo';
  src: url('../fonts/archivo-99b80741.woff2') format('woff2');
  font-weight: 400 700; font-style: normal; font-display: swap;
}

/* ---------------------------------------------------------------- token */
:root {
  --font-mono: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, 'DejaVu Sans Mono', Consolas, monospace;
  --font-body: 'Archivo', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display: 'Bebas Neue', 'Haettenschweiler', sans-serif;

  --bar-h: 52px;
  --status-h: 0px;            /* la barra di stato è confluita nella scatola vista */
  --rail-w: 282px;
  --opts-w: 258px;
  --card-w: 372px;

  --ease: cubic-bezier(0.2, 0.9, 0.3, 1);
  --t: 160ms;
}

:root[data-theme="light"] {
  --bg:        #F1EFED;
  --surface:   #FFFFFF;
  --surface-2: #F7F6F4;
  --ink:       #14161A;
  --ink-2:     #3C4046;
  --muted:     #797E86;
  --line:      #CFCAC4;
  --line-soft: #E2DEDA;
  --grid:      rgba(20, 22, 26, .30);
  --grid-line: rgba(20, 22, 26, .055);
  --edge:      #A9A39C;
  --edge-off:  #C6C1BB;
  --node-off:  #B6B0A9;
  --accent:    #EC008C;
  --accent-2:  #2C3E8F;
  --halo:      rgba(241, 239, 237, .92);
  --shadow:    0 24px 60px -34px rgba(11, 12, 15, .45);
  --cross: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='11' height='11'><path d='M5.5 0.5v10M0.5 5.5h10' stroke='%23BDB7B0' stroke-width='1'/></svg>");
  --cross-soft: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='9' height='9'><path d='M4.5 0v9M0 4.5h9' stroke='%23DCD7D1' stroke-width='1'/></svg>");
}

:root[data-theme="dark"] {
  --bg:        #0B0D10;
  --surface:   #12151A;
  --surface-2: #171B21;
  --ink:       #E9E7E4;
  --ink-2:     #B9BCC1;
  --muted:     #7E858E;
  --line:      #2A2F37;
  --line-soft: #21262D;
  --grid:      rgba(233, 231, 228, .26);
  --grid-line: rgba(233, 231, 228, .05);
  --edge:      #4A515B;
  --edge-off:  #2E343C;
  --node-off:  #454C55;
  --accent:    #FF2FA6;
  --accent-2:  #7B93FF;
  --halo:      rgba(11, 13, 16, .9);
  --shadow:    0 24px 60px -30px rgba(0, 0, 0, .8);
  --cross: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='11' height='11'><path d='M5.5 0.5v10M0.5 5.5h10' stroke='%23343A43' stroke-width='1'/></svg>");
  --cross-soft: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='9' height='9'><path d='M4.5 0v9M0 4.5h9' stroke='%23232830' stroke-width='1'/></svg>");
}

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

html, body { height: 100%; overflow: hidden; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: inherit; }
input { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* Al primo fotogramma dopo lo sblocco niente deve transire: ogni elemento vede
   il suo stato iniziale e basta (vedi openMap in graph.js). Valeva all'inizio
   solo per i pannelli, ma il difetto colpisce anche i figli: pulsanti e
   opzioni partivano dal grigio di default del browser e la transizione verso
   il bianco restava a metà. Il gate è escluso, così la sua dissolvenza resta. */
html.senza-transizioni *:not(.gate),
html.senza-transizioni *:not(.gate)::before,
html.senza-transizioni *:not(.gate)::after { transition: none !important; }

/* croci di registro agli angoli di ogni casella */
.tech { position: relative; }
.tech::after {
  content: ''; position: absolute; inset: -6px; pointer-events: none; z-index: 2;
  background-image: var(--cross), var(--cross), var(--cross), var(--cross);
  background-repeat: no-repeat;
  background-position: left .5px top .5px, right .5px top .5px,
                       left .5px bottom .5px, right .5px bottom .5px;
}

.lbl, .dim, .box-head, .cell i {
  font-size: 9.5px; letter-spacing: .13em; text-transform: uppercase;
}
.dim { color: var(--muted); }

/* intestazione e piede di ogni casella */
.box-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  height: 28px; padding: 0 11px;
  border-bottom: 1px solid var(--line);
  color: var(--ink); background: var(--surface-2);
  font-weight: 500; flex-shrink: 0;
}
.box-foot {
  border-top: 1px solid var(--line); padding: 11px;
  display: flex; align-items: center; gap: 9px; flex-shrink: 0;
}
.box-foot.small { padding: 8px 11px; color: var(--muted); font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase; }

/* bottoni */
.btn {
  height: 28px; padding: 0 11px;
  border: 1px solid var(--line); background: var(--surface);
  font-size: 10px; letter-spacing: .11em; text-transform: uppercase;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  transition: background var(--t) var(--ease), border-color var(--t) var(--ease), color var(--t) var(--ease);
  white-space: nowrap;
}
.btn:hover { border-color: var(--ink); }
.btn[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.btn.icon { width: 28px; padding: 0; }
:root[data-theme="light"] .i-sun,
:root[data-theme="dark"]  .i-moon { display: none; }
.btn.icon svg { width: 14px; height: 14px; }
.btn svg { width: 13px; height: 13px; }
.btn.solid {
  background: var(--ink); border-color: var(--ink); color: var(--bg);
  height: 38px; padding: 0 18px; font-size: 10.5px; letter-spacing: .16em;
}
.btn.solid:hover { opacity: .86; }
.btn.solid:disabled { opacity: .5; cursor: progress; }

/* Liberi Network e Arcadia alla pari: stesso colore, pieni, e scritte della
   stessa misura. Le altezze restano diverse apposta (Arcadia a due terzi):
   nel file di Liberi Network le maiuscole occupano metà immagine perché c'è il
   colibrì, in quello di Arcadia le lettere la riempiono quasi tutta. */
.logo-ln  { height: 19px; width: auto; display: block; }
.logo-arc { height: 13px; width: auto; display: block; }
:root[data-theme="light"] .dark-only,
:root[data-theme="dark"]  .light-only { display: none; }

/* ════════════════════════════════════════════════════════════ INTRO */
/* Il nome si scrive, grande e senza box, con i due loghi sotto alla stessa
   misura; poi il velo si apre sulla mappa, dove graph.js disegna la griglia di
   sfondo prima della rete. La regia sta nello script dopo il blocco, in
   index.html. */
.gate {
  position: fixed; inset: 0; z-index: 90;
  background: var(--bg);
  display: grid; place-items: center; padding: 24px;
  transition: opacity 420ms var(--ease), visibility 420ms;
}
.gate.gone { opacity: 0; visibility: hidden; }
.gate.senza-intro .apertura { visibility: hidden; }

.apertura {
  display: flex; flex-direction: column; align-items: center; gap: 28px;
  max-width: 100%; text-align: center;
}
.apertura h1 {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(54px, 9.4vw, 146px); line-height: .86; letter-spacing: .004em;
  text-transform: uppercase; color: var(--ink); margin: 0;
}
/* le lettere occupano già il loro posto: il titolo non si sposta scrivendo */
.gate.intro-on .apertura h1 .ch:not(.on) { visibility: hidden; }
.apertura .cursore {
  position: relative; display: inline-block; width: 0; height: .7em;
}
.apertura .cursore::after {
  content: ''; position: absolute; left: .05em; bottom: 0;
  width: max(3px, .035em); height: 100%; background: var(--accent);
  animation: cpt-caret 1s steps(1) infinite;
}
.gate.scrive .apertura .cursore::after { animation: none; }

/* i due loghi alla pari, pieni: nessuno dei due un passo indietro. Le altezze
   sono diverse apposta: nel file di Liberi Network le maiuscole occupano metà
   immagine (c'è il colibrì), in quello di Arcadia le lettere quasi tutta; così
   le scritte escono della stessa misura. */
.apertura-loghi {
  display: flex; align-items: center; justify-content: center;
  flex-wrap: wrap; gap: 10px 18px;
}
.apertura-loghi img { width: auto; display: block; }
.apertura-loghi .ln  { height: 30px; }
.apertura-loghi .arc { height: 20px; }
.apertura-loghi .withtxt { font-size: 10px; }
.apertura-loghi > * { transition: opacity 400ms var(--ease), transform 400ms var(--ease); }
.gate.intro-on:not(.scritto) .apertura-loghi > * { opacity: 0; transform: translateY(5px); }
.apertura-loghi > :nth-child(3) { transition-delay: 120ms; }
.apertura-loghi > :nth-child(n+4) { transition-delay: 240ms; }

/* uscita: il blocco sale appena mentre il velo si dissolve sulla griglia */
.gate.gone .apertura { animation: apertura-via 420ms var(--ease) forwards; }
@keyframes apertura-via { to { transform: translateY(-14px); } }

/* mentre la griglia si disegna, sullo schermo c'è solo il canvas: testata,
   riquadri e pulsanti arrivano dopo, con la composizione di sempre */
body.attesa > :not(.gate):not(.stage),
body.attesa .stage > :not(canvas) { visibility: hidden; }

.apertura-ns { font-family: var(--font-body); font-size: 12.5px; color: var(--muted); max-width: 40ch; }
.apertura-ns a { color: var(--accent); }

@media (max-width: 560px) {
  .apertura { gap: 22px; }
  .apertura-loghi .ln  { height: 24px; }
  .apertura-loghi .arc { height: 16px; }
}

.field { display: block; margin: 24px 0 14px; }
.field .lbl { display: block; color: var(--muted); margin-bottom: 7px; }
.field input {
  width: 100%; height: 38px; padding: 0 12px;
  background: var(--surface-2); border: 1px solid var(--line);
  font-family: var(--font-mono); font-size: 13px; letter-spacing: .24em;
  transition: border-color var(--t) var(--ease), box-shadow var(--t) var(--ease);
}
.field input:focus {
  outline: 0; border-color: var(--ink);
  box-shadow: inset 0 -2px 0 0 var(--accent);
}

.err {
  min-height: 0; margin-top: 10px; color: var(--accent);
  font-size: 9.5px; letter-spacing: .13em; text-transform: uppercase;
}
.err:empty { display: none; }

.logo-ln-gate { height: 18px; width: auto; display: block; }
.logo-arcadia { height: 12px; width: auto; display: block; }

/* fuori dalla vista, non dai lettori di schermo né dai motori: l'alternativa
   testuale della mappa (generata da seo.py) */
.vh {
  position: absolute !important; width: 1px; height: 1px; margin: -1px;
  padding: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%);
  white-space: nowrap; border: 0;
}

/* ══════════════════════════════════════════════════════════ TESTATA
   Niente più fascia: titolo e loghi stanno direttamente sullo sfondo della
   mappa, e ricerca, Confronta e Reset sono un riquadro come gli altri, in
   alto al centro. La riga è alta 40px a 12px dal bordo; i pannelli partono
   da --bar-h (52px) + 18px, come prima. */
.bar {
  position: fixed; inset: 0 0 auto 0; z-index: 60;
  /* se la pagina viene ingrandita, la testata segue la parte visibile (vedi
     "VIEWPORT (iOS)" in graph.js): senza, resterebbe fuori schermo */
  top: calc(var(--vv-top, 0px) + 12px); left: var(--vv-left, 0px);
  height: calc(var(--bar-h) - 12px); display: flex; align-items: center; gap: 16px;
  padding: 0 18px;
}
/* la riga in sé è vuota: lì sotto si deve poter trascinare la mappa */
.bar, .bar .id, .bar .partners { pointer-events: none; }
.bar .id-txt, .bar .mid, .bar .vmenu, .bar .partners > * { pointer-events: auto; }
/* testo direttamente sulla mappa: un alone del colore di fondo lo tiene
   leggibile anche quando ci passa sotto un pezzo di rete */
.bar .id-txt, .bar .withtxt { text-shadow: 0 0 3px var(--bg), 0 0 7px var(--bg), 0 0 12px var(--bg); }
/* col compass aperto, dietro la testata continua il fondo a quadrati della
   pagina: stessa griglia, spostata perché le righe cadano allineate a quelle
   del compass (che comincia a --bar-h). Così non si vede una fascia, e i
   contenuti che scorrono spariscono sotto la testata invece di passarle dietro. */
body.cp-on .bar::before {
  content: ''; position: fixed; z-index: -1; pointer-events: none;
  inset: 0 0 auto 0; height: var(--bar-h);
  background-color: var(--bg);
  background-image:
    linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
  background-size: 48px 48px;
  background-position: 0 calc(var(--bar-h) - 48px);
}
/* tre blocchi: titolo a sinistra, comandi al centro, loghi a destra. I due
   laterali hanno lo stesso flex, così il centro è centrato davvero. */
.id { display: flex; align-items: center; flex: 1 1 0; min-width: 0; }
/* ricerca, Confronta e Reset: un riquadro a sé, come Vista e la colonna */
.mid {
  display: flex; align-items: center; gap: 6px; flex: 0 0 auto;
  padding: 5px; background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.id-txt { display: flex; flex-direction: column; line-height: 1.25; }
.id-txt strong { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; font-weight: 600; }
.id-txt .dim { font-size: 9px; }

.partners {
  display: flex; align-items: center; justify-content: flex-end; gap: 7px;
  flex: 1 1 0; min-width: 0;
  font-size: 10px; color: var(--muted);
}
.withtxt {
  font-size: 8.5px; letter-spacing: .09em; text-transform: uppercase;
  color: var(--muted); white-space: nowrap;
}

/* ricerca */
.search { position: relative; flex: 0 1 300px; width: 300px; display: flex; align-items: center; }
.search .pfx {
  position: absolute; left: 10px; color: var(--muted); font-size: 12px; pointer-events: none;
}
.search input {
  width: 100%; height: 28px; padding: 0 26px 0 22px;
  background: var(--surface-2); border: 1px solid var(--line);
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .04em;
}
.search input::placeholder { color: var(--muted); letter-spacing: .12em; text-transform: uppercase; font-size: 9.5px; }
.search input:focus { outline: 0; border-color: var(--accent); }
.search .clear {
  position: absolute; right: 6px; width: 18px; height: 18px; color: var(--muted);
  display: none; align-items: center; justify-content: center; font-size: 14px;
}
.search.has-value .clear { display: flex; }
.search .clear:hover { color: var(--ink); }

.suggest {
  position: absolute; top: calc(100% + 7px); left: 0; right: 0;
  background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow); display: none; max-height: 320px; overflow-y: auto; z-index: 5;
}
.suggest.open { display: block; }
.suggest button {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 7px 10px; text-align: left; border-bottom: 1px solid var(--line-soft);
  font-size: 11px;
}
.suggest button:last-child { border-bottom: 0; }
.suggest button:hover, .suggest button.active { background: var(--surface-2); }
.suggest .sw { width: 8px; height: 8px; flex-shrink: 0; }
.suggest .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggest .cnt { color: var(--muted); font-size: 10px; }

.tools { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }


/* ══════════════════════════════════════════════════════════ MENÙ VISTE (mobile) */
.vmenu { position: relative; display: none; flex-shrink: 0; }

.vmenu-btn {
  height: 28px; padding: 0 8px 0 9px;
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--line); background: var(--ink); color: var(--bg);
  font-size: 10px; letter-spacing: .11em; text-transform: uppercase;
  max-width: 148px;
}
.vmenu-btn .vmenu-lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vmenu-btn .vmenu-ico { display: flex; }
.vmenu-btn svg { width: 14px; height: 14px; flex-shrink: 0; }
.vmenu-btn .chev { width: 12px; height: 12px; transition: transform 260ms var(--ease); }
.vmenu-btn[aria-expanded="true"] .chev { transform: rotate(180deg); }

.vmenu-panel {
  position: absolute; z-index: 50; top: calc(100% + 9px); right: 0;
  width: 280px; max-width: calc(100vw - 24px);
  max-height: calc(100vh - var(--bar-h) - 24px);
  max-height: calc(100dvh - var(--bar-h) - 24px);
  overflow-y: auto; overscroll-behavior: contain;
  background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.vmenu-panel .sect {
  padding: 7px 11px; border-bottom: 1px solid var(--line-soft);
  background: var(--surface-2);
  font-size: 9px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted);
}
.vmenu-panel > button {
  display: flex; align-items: flex-start; gap: 10px; width: 100%;
  padding: 9px 11px; text-align: left;
  border-bottom: 1px solid var(--line-soft);
  /* comparsa sfalsata, come nel componente originale */
  opacity: 0; transform: translateY(-6px); filter: blur(6px);
  transition: opacity 260ms var(--ease), transform 260ms var(--ease), filter 260ms var(--ease),
              background var(--t) var(--ease);
}
.vmenu-panel.open > button { opacity: 1; transform: none; filter: none; }
.vmenu-panel > button:active { background: var(--surface-2); }
.vmenu-panel > button.on { background: var(--ink); color: var(--bg); }
.vmenu-panel > button.on .d { color: var(--bg); opacity: .6; }
.vmenu-panel > button svg { width: 15px; height: 15px; flex-shrink: 0; margin-top: 1px; }
.vmenu-panel .t { display: block; font-size: 11.5px; letter-spacing: .04em; }
.vmenu-panel .d { display: block; font-size: 9.5px; color: var(--muted); margin-top: 3px; }
.vmenu-panel .txt { min-width: 0; }

/* su telefono la ricerca vive in cima al menù (la sposta graph.js) */
.vmenu-cerca {
  padding: 10px 11px 11px; border-bottom: 1px solid var(--line);
  background: var(--surface);
}
/* il campo occupa la prima riga, i suggerimenti vanno a capo sotto: il "/" e
   la × hanno quindi un'altezza fissa, se no scivolerebbero al centro del blocco */
.vmenu-cerca .search { width: 100%; flex: none; flex-wrap: wrap; align-items: flex-start; }
.vmenu-cerca .search input { height: 40px; }
.vmenu-cerca .search .pfx { top: 11px; }
.vmenu-cerca .search .clear { top: 11px; }
.vmenu-cerca .suggest {
  position: static; flex: 0 0 100%; margin-top: 8px; box-shadow: none;
  max-height: 42vh;
}

/* fondo che intercetta i tocchi fuori dal menù: sta sotto la barra (60),
   così pulsante e voci restano cliccabili davvero */
.vmenu-back {
  position: fixed; inset: 0; z-index: 55;
}


/* ══════════════════════════════════════════════════════════ MAPPA */
.stage { position: fixed; inset: 0 0 var(--status-h) 0; }   /* tutto lo schermo: la testata ci sta sopra */
#graph { display: block; width: 100%; height: 100%; cursor: crosshair; touch-action: none; }
#graph.grabbing { cursor: grabbing; }
#graph.pointing { cursor: pointer; }

.zoom {
  position: absolute; left: 18px; bottom: 18px; z-index: 12;
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line);
}
.zoom .zlev {
  height: 20px; display: grid; place-items: center;
  border-top: 1px solid var(--line); background: var(--surface-2);
  font-size: 8.5px; letter-spacing: .06em; color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.zoom button {
  width: 28px; height: 26px; display: grid; place-items: center;
  border-bottom: 1px solid var(--line-soft); color: var(--muted); font-size: 13px;
}
.zoom button:last-child { border-bottom: 0; font-size: 11px; }
.zoom button:hover { background: var(--surface-2); color: var(--ink); }

.tip {
  position: fixed; z-index: 70; pointer-events: none;
  background: var(--ink); color: var(--bg);
  padding: 5px 9px; font-size: 10.5px; letter-spacing: .06em; white-space: nowrap;
  opacity: 0; transform: translate(-50%, -160%);
  transition: opacity 110ms var(--ease);
}
.tip.show { opacity: 1; }
.tip em { font-style: normal; opacity: .6; margin-left: 8px; }

/* ══════════════════════════════════════════════════════════ CLUSTER */
.rail {
  position: fixed; z-index: 20;
  right: 18px; top: calc(var(--bar-h) + 18px); bottom: calc(var(--status-h) + 18px);
  width: var(--rail-w);
  background: var(--surface); border: 1px solid var(--line);
  display: flex; flex-direction: column;
  box-shadow: var(--shadow);
  transition: transform 320ms var(--ease), opacity 320ms var(--ease);
}
.rail.off { transform: translateX(14px); opacity: 0; pointer-events: none; }
/* scheda, confronto o info aperti: la colonna si fa da parte, stesso lato */
body:has(.card.open) .rail { transform: translateX(18px); opacity: 0; pointer-events: none; }
body.alt .rail, body.alt .zoom, body.alt .card, body.alt .hint { display: none; }
@media (min-width: 761px) { body.alt .view { left: calc(var(--opts-w) + 30px); } }
.rail-list { overflow-y: auto; flex: 1; }
.rail-list button {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 7px 11px; text-align: left; font-size: 11px;
  border-bottom: 1px solid var(--line-soft);
  transition: background var(--t) var(--ease);
}
.rail-list button:hover { background: var(--surface-2); }
.rail-list button.on { background: var(--ink); color: var(--bg); }
.rail-list button.on .n { color: var(--bg); opacity: .65; }
.rail-list .sw { width: 9px; height: 9px; flex-shrink: 0; }
.rail-list .lb { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-list .n { color: var(--muted); font-size: 10px; }

/* ══════════════════════════════════════════════════════════ SCHEDA */
.card {
  position: fixed; z-index: 30;
  right: 18px; top: calc(var(--bar-h) + 18px); bottom: calc(var(--status-h) + 18px);
  width: var(--card-w);
  background: var(--surface); border: 1px solid var(--line);
  display: flex; flex-direction: column;
  box-shadow: var(--shadow);
  transform: translateX(calc(100% + 26px));
  transition: transform 340ms var(--ease);
}
.card.open { transform: none; }
.card .box-head { text-transform: uppercase; }
.x-btn { width: 20px; height: 20px; display: grid; place-items: center; font-size: 15px; color: var(--muted); }
.x-btn:hover { color: var(--ink); }

.card-id { padding: 16px 14px 14px; border-bottom: 1px solid var(--line); }
.card-who { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.card-who .who-tx { min-width: 0; flex: 1; }
.card-id h2 {
  font-size: 18px; font-weight: 600; letter-spacing: -.01em; line-height: 1.15;
  word-break: break-word;
}
.card-id .dn {
  display: block; margin-top: 3px;
  font-family: var(--font-body); font-size: 12.5px; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.card-id .dn:empty { display: none; }
.catchip {
  display: inline-block; margin-top: 7px; padding: 2px 7px;
  border: 1px solid var(--line); background: var(--surface-2);
  font-size: 9px; letter-spacing: .1em; text-transform: uppercase;
}
.catchip i { width: 7px; height: 7px; display: inline-block; margin-right: 6px; font-style: normal; }

.face {
  width: 58px; height: 58px; flex-shrink: 0;
  border: 1px solid var(--line); background-color: var(--surface-2);
  background-repeat: no-repeat; background-image: none;
  display: grid; place-items: center;
  font-size: 15px; letter-spacing: .04em; color: var(--muted); text-transform: uppercase;
}
.face.has { color: transparent; }
.btn.ig { border-color: var(--line); }
.btn.ig:hover { background: var(--accent); border-color: var(--accent); color: #fff; }

.metrics { display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid var(--line); }
.metrics.quad { grid-template-columns: repeat(2, 1fr); }
.metrics.quad div:nth-child(2n) { border-right: 0; }
.metrics.quad div:nth-child(-n+2) { border-bottom: 1px solid var(--line-soft); }
.metrics.quad b { font-size: 17px; }
.metrics b.up { color: #2E9E4C; }
:root[data-theme="dark"] .metrics b.up { color: #48D97C; }
.metrics b.down { color: #C82638; }
:root[data-theme="dark"] .metrics b.down { color: #FF5F74; }
.metrics div { padding: 10px 11px; border-right: 1px solid var(--line-soft); }
.metrics div:last-child { border-right: 0; }
.metrics .lbl { display: block; color: var(--muted); margin-bottom: 5px; }
.metrics b {
  font-size: 19px; font-weight: 600; font-variant-numeric: tabular-nums;
  letter-spacing: -.01em; cursor: help;
}
.metrics b[data-exact]:hover { text-decoration: underline dotted; text-underline-offset: 4px; }
.metrics b.na { color: var(--line); font-weight: 400; }

.card-body { flex: 1; overflow-y: auto; padding: 14px; }
.desc { font-family: var(--font-body); font-size: 12.5px; color: var(--ink-2); margin-bottom: 18px; }
.desc.empty { color: var(--muted); }

.sect-h {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 9.5px; letter-spacing: .13em; text-transform: uppercase;
  color: var(--muted); padding-bottom: 8px; margin-bottom: 10px;
  border-bottom: 1px solid var(--line-soft);
}
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; max-width: 100%;
  padding: 4px 9px; border: 1px solid var(--line-soft); background: var(--surface-2);
  font-size: 10.5px;
  transition: border-color var(--t) var(--ease), background var(--t) var(--ease);
}
.chip:hover { border-color: var(--ink); background: var(--surface); }
.chip i { width: 7px; height: 7px; flex-shrink: 0; }
.chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }



/* ══════════════════════════════════════════════════════════ VISTE */

.view {
  position: absolute; inset: 0; z-index: 16; padding-top: var(--bar-h);
  background: var(--bg); display: flex; flex-direction: column;
  overflow: hidden;
}
.view-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 24px;
  padding: 20px 24px 16px; border-bottom: 1px solid var(--line); flex-shrink: 0;
}
.view-head h2 {
  font-size: 12px; letter-spacing: .14em; text-transform: uppercase; font-weight: 600;
  margin-bottom: 7px;
}
.view-head p {
  font-family: var(--font-body); font-size: 12.5px; color: var(--muted); max-width: 66ch;
}
.view-body { flex: 1; overflow: auto; padding: 18px 24px; display: flex; }
.view-body .wrap { margin: auto; max-width: 100%; }
.view-body .wrap.wide { width: min(100%, 1080px); }
.view-foot {
  border-top: 1px solid var(--line); padding: 11px 24px; flex-shrink: 0;
  display: flex; flex-wrap: wrap; gap: 22px;
  font-size: 10.5px; color: var(--muted);
}
.view-foot b { color: var(--ink); font-weight: 600; }
.view-legend { display: flex; align-items: center; gap: 8px; font-size: 9.5px;
  letter-spacing: .1em; text-transform: uppercase; color: var(--muted); flex-shrink: 0; }
.view-legend .ramp { display: flex; }
.view-legend .ramp s { width: 15px; height: 11px; text-decoration: none; }

/* --- riquadro di lettura, comune alle due viste --- */
.brief {
  margin: 14px 24px 0; padding: 10px 14px;
  border: 1px solid var(--line); background: var(--surface);
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 26px;
}
.brief .key { display: flex; align-items: center; gap: 9px; font-size: 11px; }
.brief .key .box {
  width: 22px; height: 15px; flex-shrink: 0; border: 1px solid var(--line);
  display: grid; place-items: center; font-size: 8px; color: var(--muted);
}
.brief .key b { font-weight: 600; }
.brief .key span { color: var(--muted); }
.brief .say {
  flex: 1 1 260px; min-width: 220px; padding-left: 20px;
  border-left: 1px solid var(--line-soft);
  font-family: var(--font-body); font-size: 12.5px; line-height: 1.5; color: var(--ink-2);
}
.brief .say b { color: var(--ink); font-weight: 600; }

/* --- matrice cluster × cluster --- */
.cx { border-collapse: collapse; font-size: 10px; }
.cx th, .cx td { border: 1px solid var(--line-soft); }
.cx th {
  font-weight: 400; font-size: 9.5px; letter-spacing: .05em; color: var(--muted);
  padding: 4px 6px; white-space: nowrap;
}
.cx th.rowh { text-align: right; color: var(--ink); max-width: 190px;
  overflow: hidden; text-overflow: ellipsis; }
.cx th.rowh i, .cx th.colh i { display: inline-block; width: 8px; height: 8px; margin-right: 6px; }
.cx th.colh { height: 118px; vertical-align: bottom; padding: 0 0 7px; }
.cx th.colh span {
  display: block; writing-mode: vertical-rl; transform: rotate(180deg);
  max-height: 104px; overflow: hidden; text-overflow: ellipsis; color: var(--ink);
}
.cx td {
  width: 42px; height: 32px; text-align: center; cursor: pointer;
  font-variant-numeric: tabular-nums; position: relative;
}
.cx td span { position: relative; z-index: 1; }
.cx td.zero { color: var(--line); cursor: default; }
.cx td.self { outline: 1px solid var(--line); }
.cx td:not(.zero):hover { outline: 2px solid var(--ink); outline-offset: -1px; }
.cx td b { position: absolute; inset: 0; z-index: 0; display: block; }
.cx tfoot th, .cx .tot { color: var(--muted); font-size: 9.5px; background: var(--surface-2); }
.cx .tot { cursor: default; }

@media (min-width: 1280px) {
  .cx { font-size: 11px; }
  .cx td { width: 52px; height: 34px; }
  .cx th.colh { height: 112px; }
  .cx th { font-size: 10px; }
}
@media (min-height: 1000px) {
  .cx td { height: 42px; }
  .cx th.colh { height: 130px; }
}

/* --- scala delle dimensioni (modalità interazioni) --- */
.scale {
  position: absolute; z-index: 12; left: 58px; bottom: 18px;
  background: var(--surface); border: 1px solid var(--line);
  padding: 9px 12px 10px;
  box-shadow: var(--shadow);
  transition: transform 340ms var(--ease);
}


.scale .ttl {
  font-size: 9px; letter-spacing: .13em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 8px;
}
.scale .row { display: flex; align-items: flex-end; gap: 12px; }
.scale .item { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.scale .sq { background: var(--muted); }
.scale .sq.none { background: none; border: 1px solid var(--muted); }
.scale .v { font-size: 9px; color: var(--muted); font-variant-numeric: tabular-nums; }
.scale .note {
  margin-top: 8px; padding-top: 7px; border-top: 1px solid var(--line-soft);
  font-size: 9px; color: var(--muted);
}

/* --- schede della colonna di destra --- */
.box-head.tabs { padding: 0; gap: 0; }
.box-head .tab {
  flex: 1 1 0; min-width: 0; height: 27px; padding: 0 4px;
  border-right: 1px solid var(--line); text-align: center;
  font-size: 8.5px; letter-spacing: .05em; text-transform: uppercase; color: var(--muted);
  transition: background var(--t) var(--ease), color var(--t) var(--ease);
}
.box-head .tab:last-child { border-right: 0; }
.box-head .tab.on { background: var(--ink); color: var(--bg); }
.box-head .tab:not(.on):hover { color: var(--ink); }
.rail-sub {
  padding: 6px 11px; border-bottom: 1px solid var(--line-soft);
  background: var(--surface-2); flex-shrink: 0;
}
.rail-list .sw.round { border-radius: 50%; }
/* intestazione di gruppo politico nella scheda Cluster: cliccabile, accende
   tutto il gruppo; la barretta mostra in fila le sfumature dei suoi cluster */
.rail-list button.grp {
  padding: 10px 11px 6px; gap: 9px;
  background: var(--surface-2); border-bottom: 1px solid var(--line-soft);
  font-size: 8.5px; letter-spacing: .15em; text-transform: uppercase; color: var(--ink-2);
}
.rail-list button.grp:not(:first-child) { border-top: 1px solid var(--line); }
.rail-list button.grp .tn { width: 26px; height: 7px; flex-shrink: 0; }
.rail-list button.grp .n { font-size: 9px; letter-spacing: .04em; }
.rail-list button.grp:hover { color: var(--ink); background: var(--surface-2); }
.rail-list button.grp.on { background: var(--ink); color: var(--bg); }

.rail-list .bx { display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 7px 11px; text-align: left; border-bottom: 1px solid var(--line-soft); }
.rail-list .bx:hover { background: var(--surface-2); }
.rail-list .bx .rk { width: 16px; color: var(--muted); font-size: 10px; text-align: right; flex-shrink: 0; }
.rail-list .bx .nm { flex: 1; min-width: 0; font-size: 11px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-list .bx .cut { font-size: 9.5px; color: var(--muted); flex-shrink: 0; }
.rail-list .bx .cut b { color: var(--accent); font-weight: 600; }
.rail-list .meter { height: 3px; background: var(--line-soft); margin: 0 11px 7px; }
.rail-list .meter s { display: block; height: 100%; background: var(--ink);
  transform-origin: left center; }

/* riga "ponte" nella scheda del profilo */
.bridge-line {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 10px; margin-bottom: 16px;
  border: 1px solid var(--line-soft); background: var(--surface-2); font-size: 10.5px;
}
.bridge-line b { font-weight: 600; }
.bridge-line .warn { color: var(--accent); }

/* ══════════════════════════════════════════════════════════ CONFRONTO */
.card-actions { display: flex; flex-wrap: wrap; gap: 6px; }

.hint {
  position: absolute; z-index: 14; left: 50%; top: calc(var(--bar-h) + 16px); transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px;
  background: var(--ink); color: var(--bg);
  padding: 0 8px 0 14px; height: 32px;
  font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase;
  box-shadow: var(--shadow);
}
.hint::after { display: none; }
.hint button {
  height: 22px; padding: 0 9px; border: 1px solid rgba(150,150,150,.45);
  font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase;
}
.hint button:hover { background: rgba(150,150,150,.22); }

.card.cmp { z-index: 31; }

.slots { display: flex; flex-direction: column; border-bottom: 1px solid var(--line-soft); }
.slot-row {
  display: flex; align-items: center; gap: 9px; min-width: 0;
  padding: 8px 11px; border-bottom: 1px solid var(--line-soft);
}
.slot-row:last-child { border-bottom: 0; }
.slot-row i { width: 10px; height: 10px; flex-shrink: 0; }
.slot-row .nm {
  flex: 1; min-width: 0; font-size: 12px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.slot-row .deg { color: var(--muted); font-size: 10px; }
.slot-row .rm {
  width: 18px; height: 18px; display: grid; place-items: center;
  color: var(--muted); font-size: 14px; flex-shrink: 0;
}
.slot-row .rm:hover { color: var(--accent); }
.slot-add {
  display: block; width: 100%; padding: 9px 11px; text-align: left;
  border-bottom: 1px solid var(--line);
  font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted);
  transition: background var(--t) var(--ease), color var(--t) var(--ease);
}
.slot-add:hover { background: var(--surface-2); color: var(--ink); }
.slot-add.on { background: var(--ink); color: var(--bg); }

/* pastiglia colore a segmenti: un segmento per profilo collegato */
.sw-mix { display: flex; width: 12px; height: 10px; flex-shrink: 0; }
.sw-mix s { flex: 1; text-decoration: none; }

/* matrice di sovrapposizione */
.matrix { width: 100%; table-layout: fixed; border-collapse: collapse;
  margin-bottom: 18px; font-size: 10px; }
.matrix th, .matrix td {
  border: 1px solid var(--line-soft); padding: 4px 5px; text-align: center;
  font-weight: 400; font-variant-numeric: tabular-nums;
}
.matrix th { color: var(--muted); font-size: 9px; letter-spacing: .06em; }
.matrix tr:first-child th:first-child { width: 46%; }
.matrix th.row { width: 46%; text-align: left; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.matrix th i { display: inline-block; width: 7px; height: 7px; margin-right: 5px; }
.matrix td.diag { color: var(--muted); background: var(--surface-2); }
.matrix td.mx { cursor: pointer; }
.matrix td.mx:hover { outline: 1px solid var(--ink); }
.matrix td.hot { color: var(--ink); font-weight: 600; }

.metrics.four { grid-template-columns: repeat(4, 1fr); }
.metrics .hi { background: var(--surface-2); }
.metrics .hi b { color: var(--accent); }

.cmp-note {
  display: block; line-height: 1.5;
  padding: 8px 10px; margin-bottom: 16px;
  border: 1px solid var(--line-soft); background: var(--surface-2);
  font-size: 10.5px; color: var(--ink-2);
}
.cmp-note b { color: var(--ink); }
.cmp-empty { color: var(--muted); font-size: 11.5px; padding: 4px 0 14px; }

.chip.strong { border-color: var(--ink); background: var(--surface); font-weight: 600; }

.more {
  margin-top: 9px; font-size: 9.5px; letter-spacing: .11em; text-transform: uppercase;
  color: var(--muted); border-bottom: 1px solid var(--line-soft);
}
.more:hover { color: var(--ink); border-color: var(--ink); }
.sect-h + .chips { margin-bottom: 4px; }
.sect-h.mt { margin-top: 22px; }

/* ══════════════════════════════════════════════════════════ AVVISO MOBILE */
.notice {
  position: fixed; z-index: 38;
  left: 12px; right: 12px; top: calc(var(--bar-h) + 12px);
  display: none; align-items: flex-start; gap: 10px;
  padding: 9px 8px 9px 12px;
  background: var(--ink); color: var(--bg);
  font-size: 10.5px; line-height: 1.45;
  box-shadow: var(--shadow);
  animation: notice-in 420ms var(--ease) both;
}
@keyframes notice-in { from { opacity: 0; transform: translateY(-8px); } }
.notice button {
  width: 20px; height: 20px; flex-shrink: 0; font-size: 15px;
  display: grid; place-items: center; opacity: .7;
}
.notice button:hover { opacity: 1; }
@media (max-width: 760px) { .notice:not([hidden]) { display: flex; } }

/* ══════════════════════════════════════════════════════════ INFO */
#infoBox { z-index: 32; }
.info-p {
  font-family: var(--font-body); font-size: 12.5px; line-height: 1.55;
  color: var(--ink-2); margin-bottom: 10px;
}
.info-p b { color: var(--ink); font-weight: 600; }
#infoBox .box-foot { gap: 8px; flex-wrap: wrap; }
/* seconda riga del piede: chi ha disegnato i dati */
.box-foot .a-capo { flex-basis: 100%; height: 0; }
/* la stella di Under The Stars segue i loghi accanto: bianca sul tema scuro,
   inchiostro sul chiaro (bianca lì sparirebbe nel fondo del riquadro) */
.logo-uts { height: 15px; width: auto; display: block; fill: #14161A; }
:root[data-theme="dark"] .logo-uts { fill: #FFFFFF; }
/* la stella porta al sito di Under The Stars: al passaggio ruota appena */
.link-uts { display: block; padding: 3px; margin: -3px; border-radius: 2px; }
.link-uts .logo-uts { transition: transform 260ms var(--ease), opacity 200ms var(--ease); }
.link-uts:hover .logo-uts { transform: rotate(-12deg) scale(1.12); }
.link-uts:focus-visible { outline: 1px solid var(--accent); outline-offset: 2px; }

/* modulo segnalazioni */
.fb { margin-top: 4px; }
.fb .field { margin: 0 0 12px; }
.fb select, .fb textarea, .fb input {
  width: 100%; padding: 8px 10px;
  background: var(--surface-2); border: 1px solid var(--line);
  font-family: var(--font-mono); font-size: 11.5px; color: var(--ink);
  transition: border-color var(--t) var(--ease);
}
.fb select { height: 34px; appearance: none; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-size: 5px 5px, 5px 5px;
  background-position: calc(100% - 14px) 15px, calc(100% - 9px) 15px;
  background-repeat: no-repeat; padding-right: 28px; }
.fb input { height: 34px; }
.fb .field input { letter-spacing: .02em; }      /* la spaziatura larga è della password, non di qui */
.fb textarea { resize: vertical; min-height: 74px; line-height: 1.5; }
.fb select:focus, .fb textarea:focus, .fb input:focus {
  outline: 0; border-color: var(--ink); box-shadow: inset 0 -2px 0 0 var(--accent);
}
.fb .btn.solid { width: 100%; }
.fb-note {
  min-height: 14px; margin-top: 9px;
  font-size: 9.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
}
.fb-note.ok { color: var(--accent); }
/* la conferma contiene l'indirizzo email: niente maiuscoletto, va letto bene */
.fb-note.ok { text-transform: none; letter-spacing: .01em; font-size: 11.5px; line-height: 1.45;
  font-family: var(--font-body); user-select: text; }
.fb-priv { margin-top: 6px; font-family: var(--font-body); font-size: 11px;
  line-height: 1.45; color: var(--muted); }

/* ══════════════════════════════════════════════════════════ OPZIONI */
.opts {
  position: fixed; z-index: 22;
  left: 18px; top: calc(var(--bar-h) + 18px);
  width: var(--opts-w); max-height: calc(100vh - var(--bar-h) - 100px);
  background: var(--surface); border: 1px solid var(--line);
  display: flex; flex-direction: column;
  box-shadow: var(--shadow);
  transition: transform 320ms var(--ease), opacity 320ms var(--ease);
}
.opts .box-head { text-transform: uppercase; }
.x-btn.fold { font-size: 17px; line-height: 0; }
.opts-body { overflow-y: auto; }
.opts.folded .opts-body, .opts.folded .opts-stats, .opts.folded .opts-foot { display: none; }

.opts-sect {
  padding: 9px 11px 6px;
  font-size: 8.5px; letter-spacing: .15em; text-transform: uppercase; color: var(--muted);
}
.opts-sect + .opt { border-top: 1px solid var(--line-soft); }

.opt {
  display: flex; align-items: flex-start; gap: 9px; width: 100%;
  padding: 8px 11px; text-align: left;
  border-bottom: 1px solid var(--line-soft);
  transition: background var(--t) var(--ease);
}
.opt:hover { background: var(--surface-2); }
.opt .sw {
  width: 11px; height: 11px; flex-shrink: 0; margin-top: 2px;
  border: 1px solid var(--line); background: var(--surface-2);
  transition: background var(--t) var(--ease), border-color var(--t) var(--ease);
}
.opt .tx { min-width: 0; }
.opt b { display: block; font-size: 11px; font-weight: 500; letter-spacing: .01em; }
.opt i { display: block; font-style: normal; font-size: 9.5px; color: var(--muted); margin-top: 2px; }
.opt[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.opt[aria-pressed="true"] i { color: var(--bg); opacity: .6; }
.opt[aria-pressed="true"] .sw { background: var(--bg); border-color: var(--bg); }

.opts-stats {
  display: grid; grid-template-columns: 1fr 1fr;
  border-top: 1px solid var(--line); flex-shrink: 0;
}
.cell {
  display: flex; flex-direction: column; gap: 2px; min-width: 0;
  padding: 6px 11px; font-size: 10px;
  border-right: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft);
}
.cell:nth-child(2n) { border-right: 0; }
.cell.wide { grid-column: 1 / -1; border-right: 0; }
.cell i {
  color: var(--muted); font-style: normal;
  font-size: 8.5px; letter-spacing: .1em; text-transform: uppercase;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cell b {
  font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
#sTotWrap b { color: var(--accent); }
#sSel { font-size: 10px; }

.opts-foot {
  display: flex; align-items: center; gap: 6px; padding: 9px 11px;
  border-top: 1px solid var(--line); flex-shrink: 0;
}
.opts-foot .upd { margin-left: auto; font-size: 8.5px; }
#btnTheme .i-sun, #btnTheme .i-moon { width: 14px; height: 14px; }

/* ══════════════════════════════════════════════════════════ MOBILE */
@media (max-width: 760px) {
  :root { --card-w: 100%; --rail-w: 100%; }
  .partners { display: none; }
  .id-txt .dim { display: none; }
  .tools, .opts, .mid { display: none; } /* comandi e ricerca raccolti nel menù a tendina */
  .vmenu { display: block; margin-left: auto; }   /* a destra: il riquadro della ricerca qui non c'è */
  .bar { gap: 10px; }
  /* senza min-width:0 l'input non si restringe e spinge il menù fuori schermo */
  .mid { flex: 1 1 auto; min-width: 0; }
  .id { flex: 0 1 auto; }
  .search { flex: 1 1 auto; width: auto; min-width: 0; }
  .search #q { min-width: 0; }
  .tools .btn { padding: 0 9px; }
  .rail {
    left: 12px; right: 12px; width: auto; top: auto;
    bottom: calc(var(--status-h) + 12px); max-height: 46%;
  }
  .hint { top: calc(var(--bar-h) + 10px); font-size: 9.5px; padding-left: 10px; gap: 8px; }
  .card {
    right: 0; left: 0; width: 100%; top: auto;
    bottom: var(--status-h); height: 62%;
    border-left: 0; border-right: 0; border-bottom: 0;
    transform: translateY(calc(100% + 26px));
  }
  .card::after { display: none; }
  .zoom { display: none; }
  .view-head { flex-direction: column; gap: 10px; padding: 14px 14px 12px; }
  .view-head p { font-size: 11.5px; }
  .view-body { padding: 14px; }
  .brief { margin: 12px 14px 0; padding: 10px 12px; gap: 8px 16px; }
  .brief .say { padding-left: 0; border-left: 0; border-top: 1px solid var(--line-soft);
    padding-top: 8px; flex-basis: 100%; font-size: 12px; }
  .view-foot { padding: 9px 14px; gap: 12px; }
  .scale { right: 10px; top: calc(var(--bar-h) + 10px); bottom: auto; padding: 5px 7px 6px; max-width: 44vw; }
  .scale .ttl { font-size: 8px; letter-spacing: .09em; margin-bottom: 5px; }
  .scale .row { gap: 7px; }
  .scale .item { gap: 3px; }
  .scale .v { font-size: 8px; }
  .scale .note { margin-top: 5px; padding-top: 4px; font-size: 8px; line-height: 1.3; }
  body:has(.card.open) .scale { transform: none; }
}
@media (max-width: 560px) {
  .id-txt strong { font-size: 10.5px; }
  .tools .btn .lab { display: none; }
  .tools .btn { width: 28px; padding: 0; }
  .hide-s { display: none; }
  .bar { gap: 7px; padding: 0 12px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* ══════════════════════════════════════════════════════════ COMPOSIZIONE
   All'apertura i due riquadri si disegnano: prima i quattro filetti, uno per
   lato, poi le croci di registro agli angoli, poi il testo che si scrive riga
   per riga. Finita la composizione la classe `boot` sparisce e resta il CSS
   normale, così niente di tutto questo tocca l'uso quotidiano. */

body.boot .opts, body.boot .rail, body.boot .bar .mid {
  border-color: transparent;
  box-shadow: none;
  background-color: transparent;                 /* prima la cornice, poi il foglio */
  animation: fondo-in 220ms var(--ease) 540ms forwards;
}
@keyframes fondo-in { to { background-color: var(--surface); } }
.opts, .rail { transition: transform 320ms var(--ease), opacity 320ms var(--ease),
                           box-shadow 420ms var(--ease), border-color 200ms linear; }

/* il contenuto entra quando la cornice è chiusa, poi le righe si scrivono */
body.boot .opts > *:not(.rule), body.boot .rail > *:not(.rule), body.boot .bar .mid > *:not(.rule) {
  opacity: 0;
  animation: box-in 180ms var(--ease) 570ms forwards;
}
@keyframes box-in { to { opacity: 1; } }

/* le croci arrivano dopo i filetti */
body.boot .opts::after, body.boot .rail::after, body.boot .bar .mid::after {
  opacity: 0;
  animation: cross-in 240ms var(--ease) 560ms forwards;
}
@keyframes cross-in { to { opacity: 1; } }

/* i quattro filetti: si tirano in senso orario partendo da sinistra in alto */
.rule { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
.rule i { position: absolute; display: block; background: var(--line); }
.rule i:nth-child(1) { top: -1px;    left: -1px; right: -1px;  height: 1px;
  transform: scaleX(0); transform-origin: left;
  animation: ln-x 210ms var(--ease) 0ms forwards; }
.rule i:nth-child(2) { top: -1px;    right: -1px; bottom: -1px; width: 1px;
  transform: scaleY(0); transform-origin: top;
  animation: ln-y 210ms var(--ease) 175ms forwards; }
.rule i:nth-child(3) { bottom: -1px; left: -1px; right: -1px;  height: 1px;
  transform: scaleX(0); transform-origin: right;
  animation: ln-x 210ms var(--ease) 350ms forwards; }
.rule i:nth-child(4) { top: -1px;    left: -1px; bottom: -1px; width: 1px;
  transform: scaleY(0); transform-origin: bottom;
  animation: ln-y 210ms var(--ease) 525ms forwards; }
@keyframes ln-x { to { transform: scaleX(1); } }
@keyframes ln-y { to { transform: scaleY(1); } }

/* il testo si scrive: la riga viene scoperta a scatti da sinistra a destra.
   Non serve solo all'apertura: la usano anche le schede della colonna quando
   si passa da Cluster a Categorie, Ponti o Classifica. */
.type {
  clip-path: inset(0 100% 0 0);
  animation: scrivi 230ms steps(18, end) forwards;
}
@keyframes scrivi { to { clip-path: inset(0 -3px 0 0); } }

@media (prefers-reduced-motion: reduce) {
  .type { clip-path: none; animation: none; }
  .rule { display: none; }
}

/* ══════════════════════════════════════════════════════════ TABLET
   Fra telefono e desktop la barra a tre blocchi non ci sta: titolo e loghi
   restavano schiacciati in un centinaio di pixel. Qui si tolgono le parole che
   si possono togliere — etichette dei pulsanti, sottotitolo, "in collaborazione
   con" — e la ricerca si stringe. Restano icone, titolo e i due loghi. */
@media (min-width: 761px) and (max-width: 1000px) {
  .search { flex-basis: 220px; width: 220px; }
  .tools .btn .lab { display: none; }
  .tools .btn { width: 30px; padding: 0; justify-content: center; }
  .id-txt .dim, .partners .withtxt { display: none; }
}

/* ══════════════════════════════════════════════════════════ iOS: ZOOM DEI CAMPI
   Safari su iPhone ingrandisce la pagina da solo quando si tocca un campo con
   il testo sotto i 16px, e lo zoom resta. Il campo password era a 13px: 16/13 =
   1,23, esattamente la scala misurata sul telefono che «perdeva» la barra. Su
   touch e schermi stretti ogni campo sta quindi a 16px. */
@media (pointer: coarse), (max-width: 760px) {
  input, select, textarea { font-size: 16px !important; }
  .field input { letter-spacing: .16em; }
}

/* ══════════════════════════════════════════════════════════ MEDIA COMPASS
   Una pagina a sé, sopra la mappa: si apre dal blocco in basso, dalla scheda
   di un profilo o dal menù su telefono. Stessa grammatica del resto — caselle,
   filetti, croci di registro — con un grafico a bolle al posto della rete. */

/* --- il blocco d'ingresso: staccato da tutto, si riscrive da solo --- */
.cpt {
  position: absolute; z-index: 13; bottom: 18px; left: 50%;
  width: 318px; height: 74px;
  display: flex; align-items: center; gap: 13px; padding: 0 14px 0 13px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
  text-align: left; cursor: pointer; text-decoration: none; color: inherit;
  opacity: 0; transform: translateY(12px);
  transition: opacity 460ms var(--ease), transform 460ms var(--ease),
              border-color var(--t) var(--ease);
}
.cpt.in { opacity: 1; transform: none; }
.cpt.off { opacity: 0; transform: translateY(12px); pointer-events: none; }
body.boot .cpt { opacity: 0; transform: translateY(12px); }   /* entra a composizione finita */
.cpt:hover { border-color: var(--ink); }
.cpt:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.cpt-ico { width: 44px; height: 44px; flex-shrink: 0; overflow: visible; }
.cpt-ico .fr  { fill: var(--surface-2); stroke: var(--line); stroke-width: 1; }
.cpt-ico .ax  { stroke: var(--line); stroke-width: 1; fill: none; }
.cpt-ico .mil { fill: var(--accent); opacity: .09; }
.cpt-ico .pt  { transition: transform 1000ms var(--ease), fill 400ms linear; }
.cpt-ico .ring {
  fill: none; stroke: var(--accent); stroke-width: 1.3;
  transition: transform 1000ms var(--ease);
}
.cpt-ico .ring.go { animation: cpt-pulse 1800ms ease-out 1000ms infinite; }
@keyframes cpt-pulse {
  0%   { stroke-opacity: .9; stroke-width: 1.3; r: 3.2; }
  100% { stroke-opacity: 0;  stroke-width: .4;  r: 11; }
}

.cpt-tx { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.cpt-k {
  display: flex; align-items: center; gap: 6px;
  font-size: 8.5px; letter-spacing: .15em; text-transform: uppercase; color: var(--muted);
}
.cpt-k::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--accent);
  animation: cpt-led 2.4s ease-in-out infinite;
}
@keyframes cpt-led { 50% { opacity: .25; } }
.cpt-h {
  display: flex; align-items: center; min-height: 22px;
  font-family: var(--font-display); font-weight: 700; font-size: 24px; line-height: 1;
  letter-spacing: .01em; text-transform: uppercase; white-space: nowrap; overflow: hidden;
}
.cpt .caret {
  display: inline-block; width: 2px; height: 17px; margin-left: 3px; flex-shrink: 0;
  background: var(--accent); animation: cpt-caret 1s steps(1) infinite;
}
.cpt.typing .caret { animation: none; }
@keyframes cpt-caret { 50% { opacity: 0; } }
.cpt-s { font-size: 9.5px; letter-spacing: .06em; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cpt-go { width: 16px; height: 16px; flex-shrink: 0; color: var(--muted);
  transition: transform 260ms var(--ease), color var(--t) var(--ease); }
.cpt:hover .cpt-go { transform: translateX(4px); color: var(--accent); }
.cpt.stretto { gap: 10px; }
.cpt.stretto .cpt-s { display: none; }
.cpt.stretto .cpt-h { font-size: 21px; }

/* --- la pagina --- */
.cp {
  position: fixed; z-index: 45; inset: var(--bar-h) 0 0 0;
  display: flex; flex-direction: column;
  overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain;
  background-color: var(--bg);
  background-image:
    linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
  background-size: 48px 48px;
  opacity: 0; transform: translateY(10px);
  transition: opacity 300ms var(--ease), transform 300ms var(--ease);
}
.cp.in { opacity: 1; transform: none; }
body.cp-on .bar .tools { display: none; }

.cp-head {
  display: flex; align-items: flex-end; gap: 26px;
  padding: 20px 24px 16px; flex-shrink: 0;
}
.cp-lato { align-self: flex-start; margin-top: 2px; display: flex; flex-direction: column;
  align-items: stretch; gap: 7px; }
.cp-lato .btn { justify-content: flex-start; }
#cpTema .i-sun, #cpTema .i-moon { width: 14px; height: 14px; }
.cp-tt { flex: 1; min-width: 0; }
.cp-tt h2 {
  font-family: var(--font-display); font-weight: 700; text-transform: uppercase;
  font-size: clamp(36px, 4.2vw, 56px); line-height: .88; letter-spacing: .004em;
  margin: 7px 0 9px;
}
.cp-tt p { font-family: var(--font-body); font-size: 12.5px; line-height: 1.5;
  color: var(--muted); max-width: 72ch; }
.cp-tt p b { color: var(--ink); font-weight: 600; }
.cp-nums {
  display: grid; grid-template-columns: repeat(3, auto); flex-shrink: 0;
  background: var(--surface); border: 1px solid var(--line);
}
.cp-nums .cell { padding: 9px 16px 10px; border-bottom: 0; border-right: 1px solid var(--line-soft); }
.cp-nums .cell:last-child { border-right: 0; }
.cp-nums .cell b { font-size: 20px; letter-spacing: -.01em; }
.cp-nums .cell:last-child b { color: var(--accent); }

.cp-main {
  flex: none; display: flex; gap: 18px;
  height: clamp(560px, calc(100vh - var(--bar-h) - 170px), 1000px);
  padding: 2px 24px 22px;
}
.cp-plot, .cp-side {
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
  display: flex; flex-direction: column; min-height: 0;
}
.cp-plot { flex: 1; min-width: 0; }
.cp-plot > .box-head, .cp-side > .box-head { text-transform: uppercase; }
.cp-plot-body { flex: 1; min-height: 0; position: relative; }
#cpSvg { position: absolute; inset: 0; display: block; }
.cp-side { width: var(--card-w); flex-shrink: 0; }
.cp-side > .rail-list, .cp-side > .card-body { flex: 1; overflow-y: auto; }
.cp-side .box-head .cl { display: flex; align-items: center; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-side .box-head .sw { width: 8px; height: 8px; flex-shrink: 0; margin-right: 7px; }

/* interruttori a segmenti */
.cp-seg { display: flex; align-items: center; }
.cp-seg .dim { margin-right: 8px; font-size: 8.5px; }
.cp-seg button {
  height: 20px; padding: 0 8px; margin-left: -1px;
  border: 1px solid var(--line); background: var(--surface);
  font-size: 9px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
  transition: background var(--t) var(--ease), color var(--t) var(--ease);
}
.cp-seg button:hover { color: var(--ink); }
.cp-seg button[aria-pressed="true"] {
  position: relative; z-index: 1;
  background: var(--ink); border-color: var(--ink); color: var(--bg);
}
.cp-foot { gap: 16px; flex-wrap: wrap; padding: 8px 11px; }
.cp-tog {
  display: inline-flex; align-items: center; gap: 7px; height: 20px;
  font-size: 9px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
}
.cp-tog .sw { width: 11px; height: 11px; border: 1px solid var(--line); background: var(--surface-2); }
.cp-tog[aria-pressed="true"] { color: var(--ink); }
.cp-tog[aria-pressed="true"] .sw { background: var(--ink); border-color: var(--ink); }
.cp-legend {
  margin-left: auto; display: flex; align-items: center; flex-wrap: wrap; gap: 6px 14px;
  font-size: 9px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2);
}
.cp-legend span { display: inline-flex; align-items: center; }
.cp-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.cp-legend i.o { border: 1px solid var(--muted); background: none; margin-right: 4px; }
.cp-legend i.o.s { width: 5px; height: 5px; }
.cp-legend i.o.l { width: 11px; height: 11px; margin-right: 7px; }

/* il grafico */
#cpSvg text { font-family: var(--font-mono); }
#cpSvg path { fill: none; }
#cpSvg .band.mis { fill: var(--surface-2); }
#cpSvg .band.mil { fill: var(--accent); fill-opacity: .045; }
#cpSvg .gl  { stroke: var(--line-soft); stroke-width: 1; }
#cpSvg .mid { stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 3; }
#cpSvg .ax  { stroke: var(--muted); stroke-width: 1; fill: none; }
#cpSvg .strip { stroke: var(--line); stroke-width: 1; stroke-dasharray: 1 3; }
#cpSvg .tk { font-size: 9px; fill: var(--muted); }
#cpSvg .bl { font-size: 9px; letter-spacing: .16em; fill: var(--muted); }
#cpSvg .bl.hot { fill: var(--accent); }
#cpSvg .at { font-size: 9px; letter-spacing: .12em; fill: var(--ink-2); }
.cp-fondo.entra { opacity: 0; animation: box-in 500ms var(--ease) 380ms forwards; }

.cp-b { cursor: pointer; transition: transform 720ms var(--ease), opacity 280ms var(--ease); }
.cp-b .dot { fill: var(--c); fill-opacity: .8; stroke: var(--surface); stroke-width: 1;
  transition: fill 360ms linear, stroke-width 160ms; }
.cp-b .dot.nd { fill: none; stroke: var(--c); stroke-width: 1.3; }
.cp-b .rim { fill: none; stroke: var(--c); stroke-width: 2; transition: stroke 360ms linear; }
.cp-b .hit { fill: transparent; }
.cp-b.hov .dot { stroke: var(--ink); stroke-width: 1.6; }
.cp-b.hov .rim { stroke: var(--ink); }
#cpSvg.has-sel .cp-b:not(.on) { opacity: .26; }
.cp-b.on .dot, .cp-b.on .rim { stroke: var(--ink); stroke-width: 2.4; fill-opacity: 1; }

.cp-nomi text {
  font-size: 9.5px; fill: var(--ink-2); pointer-events: none;
  paint-order: stroke; stroke: var(--surface); stroke-width: 3px; stroke-linejoin: round;
  transition: opacity 240ms var(--ease);
}
.cp-nomi text.fade { opacity: .28; }
.cp-nomi text.sel { fill: var(--ink); font-size: 10.5px; font-weight: 600; }
.cp-nomi.entra text { opacity: 0; animation: box-in 420ms var(--ease) var(--nomi, 1500ms) forwards; }
#cpSvg .wm { animation: wm-in 520ms var(--ease) both; }
@keyframes wm-in { from { fill-opacity: 0; transform: translateY(8px); } }

/* la scheda del profilo nel compass */
.cp-say { font-family: var(--font-body); font-size: 12.5px; line-height: 1.5;
  color: var(--ink-2); margin-bottom: 9px; }
.cp-say b { color: var(--ink); font-weight: 600; }
.cp-say.dim2 { color: var(--muted); }
.metrics b.acc { color: var(--accent); }
.cp-bars .r {
  display: grid; grid-template-columns: 1fr auto; gap: 3px 10px; align-items: baseline;
  margin-bottom: 8px; font-size: 10.5px;
}
.cp-bars .r .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-bars .r b { font-weight: 600; font-variant-numeric: tabular-nums; font-size: 10px; }
.cp-bars .trk { display: block; grid-column: 1 / -1; height: 3px; background: var(--line-soft); }
.cp-bars .trk s { display: block; height: 100%; background: var(--ink); transform-origin: left center; }
.cp-bars.b .trk s { background: var(--accent); }
.cp-tutti {
  display: block; width: 100%; padding: 11px; text-align: center;
  font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted);
  border-bottom: 1px solid var(--line-soft);
}
.cp-tutti:hover { color: var(--ink); background: var(--surface-2); }
.cp-vuoto { font-size: 10.5px; color: var(--muted); margin-bottom: 6px; }
.cp-mesi { display: flex; gap: 6px; height: 70px; }
.cp-mesi .c { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.cp-mesi .h { flex: 1; width: 100%; display: flex; align-items: flex-end;
  background: var(--surface-2); border-bottom: 1px solid var(--line); }
.cp-mesi .h s { display: block; width: 100%; background: var(--accent); transform-origin: bottom; }
.cp-mesi i { font-style: normal; font-size: 9px; color: var(--muted); }

/* composizione all'apertura, come i riquadri della mappa */
.cp.boot .cp-plot, .cp.boot .cp-side {
  border-color: transparent; box-shadow: none; background-color: transparent;
  animation: fondo-in 220ms var(--ease) 540ms forwards;
}
.cp.boot .cp-plot > *:not(.rule), .cp.boot .cp-side > *:not(.rule) {
  opacity: 0; animation: box-in 180ms var(--ease) 570ms forwards;
}
.cp.boot .cp-plot::after, .cp.boot .cp-side::after {
  opacity: 0; animation: cross-in 240ms var(--ease) 560ms forwards;
}

/* --- il mini-compass nella scheda di un profilo della rete --- */
#pCompass:empty { display: none; }
#pCompass { margin-bottom: 18px; }
.cp-mini {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 8px; text-align: left;
  border: 1px solid var(--line-soft); background: var(--surface-2);
  transition: border-color var(--t) var(--ease);
}
.cp-mini:hover { border-color: var(--ink); }
.cp-mini svg { flex-shrink: 0; background: var(--surface); border: 1px solid var(--line-soft); }
.cp-mini svg .ax  { stroke: var(--muted); stroke-width: 1; fill: none; }
.cp-mini svg .gl  { stroke: var(--line); stroke-width: 1; stroke-dasharray: 2 2; }
.cp-mini svg .mil { fill: var(--accent); fill-opacity: .07; }
.cp-mini svg .o   { fill: var(--node-off); }
.cp-mini svg .me-r { fill: none; stroke: var(--ink); stroke-width: 1.2; }
.cp-mini svg .me  { stroke: var(--surface); stroke-width: 1; }
.cp-mini .tx { display: flex; flex-direction: column; gap: 2px; min-width: 0;
  font-size: 10.5px; color: var(--ink-2); }
.cp-mini .tx b { font-size: 10.5px; font-weight: 600; letter-spacing: .1em;
  text-transform: uppercase; color: var(--ink); margin-bottom: 2px; }
.cp-mini .go { margin-top: 5px; font-size: 9px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--accent); }

/* --- tablet e telefono --- */
@media (min-width: 761px) and (max-width: 1100px) {
  .cp-side { width: 300px; }
  .cp-head { flex-wrap: wrap; }
  .cp-nums { order: 3; }
}
@media (max-width: 760px) {
  .cp { overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
  .cp-head { flex-direction: column; align-items: stretch; gap: 12px; padding: 14px 12px 12px; }
  .cp-tt h2 { font-size: 40px; }
  .cp-tt p { font-size: 12px; }
  .cp-nums { grid-template-columns: repeat(3, 1fr); }
  .cp-nums .cell { padding: 7px 10px 8px; }
  .cp-nums .cell b { font-size: 16px; }
  .cp-main { flex: none; flex-direction: column; gap: 16px; padding: 2px 12px 28px; }
  .cp-plot { flex: none; }
  .cp-plot > .box-head { height: auto; min-height: 28px; flex-wrap: wrap; padding: 6px 11px; gap: 6px; }
  .cp-plot-body { flex: none; height: min(112vw, 540px); }
  .cp-legend { margin-left: 0; width: 100%; }
  .cp-side { width: 100%; }
  .cp-side > .rail-list, .cp-side > .card-body { overflow: visible; }
  .cp-side > .rail-list { max-height: none; }

  /* il blocco d'ingresso diventa una pastiglia in basso */
  .cpt.mini {
    left: 12px !important; right: 12px; width: auto !important; bottom: 12px;
    height: 56px; gap: 11px; padding: 0 12px 0 10px;
  }
  .cpt.mini .cpt-ico { width: 34px; height: 34px; }
  .cpt.mini .cpt-s { display: none; }
  .cpt.mini .cpt-h { font-size: 21px; min-height: 20px; }
}

/* --- filtro attivo, scritto accanto al titolo del grafico --- */
.cp-chip {
  display: inline-flex; align-items: center; gap: 6px; margin-left: 10px;
  padding: 1px 3px 1px 7px; background: var(--accent); color: #fff;
  font-size: 8.5px; letter-spacing: .1em;
}
.cp-chip button { width: 15px; height: 15px; color: #fff; font-size: 12px; line-height: 1; }

/* --- il tempo: mesi con la loro barretta, e il tasto ▶ --- */
.cp-tempo {
  display: flex; align-items: flex-end; gap: 4px; flex-shrink: 0;
  padding: 8px 11px 9px; border-top: 1px solid var(--line-soft);
}
.cp-play {
  width: 30px; height: 44px; flex-shrink: 0; margin-right: 4px;
  display: grid; place-items: center;
  border: 1px solid var(--ink); background: var(--ink); color: var(--bg);
}
.cp-play svg { width: 13px; height: 13px; fill: currentColor; }
.cp-play .pa, .cp-tempo.suona .cp-play .pl { display: none; }
.cp-tempo.suona .cp-play .pa { display: block; }
.cp-play:hover { opacity: .85; }
.cp-tempo .tm {
  flex: 1 1 0; min-width: 0; max-width: 92px; height: 44px;
  display: grid; grid-template-rows: 1fr auto; grid-template-columns: 1fr auto;
  column-gap: 5px; row-gap: 3px; padding: 4px 6px 3px;
  border: 1px solid var(--line-soft); background: var(--surface); text-align: left;
  transition: background var(--t) var(--ease), border-color var(--t) var(--ease);
}
.cp-tempo .tm:hover { border-color: var(--ink); }
.cp-tempo .tm .h { grid-column: 1 / -1; display: flex; align-items: flex-end;
  background: var(--surface-2); min-height: 14px; }
.cp-tempo .tm .h s { display: block; width: 100%; background: var(--accent); opacity: .75;
  transform-origin: bottom; transition: opacity var(--t); }
.cp-tempo .tm i { font-style: normal; font-size: 8.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.cp-tempo .tm b { font-size: 8.5px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.cp-tempo .tm[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); }
.cp-tempo .tm[aria-pressed="true"] i, .cp-tempo .tm[aria-pressed="true"] b { color: var(--bg); }
.cp-tempo .tm[aria-pressed="true"] .h { background: rgba(128,128,128,.25); }
.cp-tempo .tm[aria-pressed="true"] .h s { opacity: 1; }
.cp-tempo-k { margin-left: auto; align-self: center; font-size: 8.5px; max-width: 120px; line-height: 1.35; }

#cpSvg .wm {
  font-family: var(--font-display); font-weight: 700; font-size: 58px; letter-spacing: .01em;
  text-transform: uppercase; fill: var(--ink); fill-opacity: .07; pointer-events: none;
}
#cpSvg.play .cp-nomi { opacity: 0; }
.cp-b.assente { opacity: .06; pointer-events: none; }
#cpSvg.filtrato .cp-b.fuori { opacity: .1; }
#cpSvg.filtrato .cp-b.fuori .hit { pointer-events: none; }

/* --- le sezioni sotto il grafico --- */
.cp-due {
  display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 18px;
  padding: 0 24px 22px; flex: none;
}
.cp-box {
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
  display: flex; flex-direction: column; min-width: 0;
}
.cp-box > .box-head { text-transform: uppercase; }
.cp-box.attesa > * { opacity: 0; }
.cp-sez-body { padding: 14px; }
.cp-elenco { margin: 0 24px 34px; flex: none; }

/* su quali temi */
.cp-temi { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; }
.cp-tr {
  display: grid; grid-template-columns: 150px minmax(60px, 1fr) 42px 74px;
  align-items: center; column-gap: 12px; row-gap: 3px;
  padding: 7px 8px; cursor: pointer; font-size: 11px;
  border-left: 2px solid transparent;
  transition: background var(--t) var(--ease), border-color var(--t) var(--ease);
}
.cp-tr:hover { background: var(--surface-2); }
.cp-tr.on { background: var(--surface-2); border-left-color: var(--accent); }
.cp-tr .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-tr .trk { position: relative; height: 8px; background: var(--line-soft); }
.cp-tr .trk s { display: block; height: 100%; background: var(--accent); transform-origin: left center; }
.cp-tr .trk u { position: absolute; top: -3px; bottom: -3px; width: 1px; background: var(--ink); }
.cp-tr b { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.cp-tr .n { font-size: 9.5px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.cp-tr .chi { grid-column: 2 / -1; font-size: 9.5px; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-tr .chi a { color: var(--ink-2); text-decoration: underline dotted; text-underline-offset: 3px; cursor: pointer; }
.cp-tr .chi a:hover { color: var(--accent); }

/* chi attacca chi: barre che partono dal centro */
.cp-legenda2 { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 4px 0 12px;
  font-size: 9.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); }
.cp-legenda2 span { display: inline-flex; align-items: center; gap: 7px; }
.cp-legenda2 i { width: 12px; height: 8px; display: inline-block; }
.cp-legenda2 i.g, .cp-lr s.g { background: var(--accent); }
.cp-legenda2 i.o, .cp-lr s.o { background: var(--accent-2); }
.cp-lati { display: flex; flex-direction: column; }
.cp-lr {
  display: grid; grid-template-columns: 138px minmax(80px, 1fr) 40px; align-items: center;
  column-gap: 10px; padding: 4px 6px; cursor: pointer; font-size: 10.5px;
  transition: background var(--t) var(--ease);
}
.cp-lr:hover { background: var(--surface-2); }
.cp-lr .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-lr .dv { display: grid; grid-template-columns: 1fr 1fr; height: 10px; position: relative; }
.cp-lr .dv::after { content: ''; position: absolute; left: 50%; top: -3px; bottom: -3px;
  width: 1px; background: var(--ink); }
.cp-lr .l { display: flex; justify-content: flex-end; }
.cp-lr .l s { display: block; height: 100%; transform-origin: right center; }
.cp-lr .r s { display: block; height: 100%; transform-origin: left center; }
.cp-lr .q { font-size: 9.5px; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }

/* tutti i profili: strumenti e schede */
.cp-tool {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  padding: 10px 11px; border-bottom: 1px solid var(--line);
}
.cp-q { position: relative; display: flex; align-items: center; flex: 1 1 200px; max-width: 280px; }
.cp-q span { position: absolute; left: 9px; color: var(--muted); font-size: 12px; pointer-events: none; }
.cp-q input, .cp-tool select {
  height: 28px; border: 1px solid var(--line); background: var(--surface-2);
  font-family: var(--font-mono); font-size: 11px; color: var(--ink);
}
.cp-q input { width: 100%; padding: 0 9px 0 21px; }
.cp-q input::placeholder { color: var(--muted); letter-spacing: .1em; text-transform: uppercase; font-size: 9.5px; }
.cp-q input:focus, .cp-tool select:focus { outline: 0; border-color: var(--accent); }
.cp-tool select {
  padding: 0 26px 0 9px; appearance: none; cursor: pointer; max-width: 230px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-size: 5px 5px, 5px 5px;
  background-position: calc(100% - 13px) 12px, calc(100% - 8px) 12px;
  background-repeat: no-repeat;
}
.cp-reset { font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
.cp-griglia {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 12px; padding: 14px;
}
.cp-card {
  display: flex; flex-direction: column; gap: 10px; min-width: 0;
  padding: 12px; cursor: pointer;
  border: 1px solid var(--line-soft); background: var(--surface);
  transition: border-color var(--t) var(--ease), background var(--t) var(--ease);
}
.cp-card:hover { border-color: var(--ink); }
.cp-card.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.cp-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cc-top { display: flex; align-items: flex-start; gap: 10px; }
.cp-card .face { width: 40px; height: 40px; font-size: 12px; }
.cc-id { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cc-id b { font-size: 12px; font-weight: 600; line-height: 1.25; word-break: break-word; }
.cc-id a, .cc-id span { font-size: 10px; color: var(--muted); text-decoration: none;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cc-id a:hover { color: var(--accent); }
.cc-tono {
  flex-shrink: 0; display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 6px; border: 1px solid var(--line); background: var(--surface-2);
  font-size: 8.5px; letter-spacing: .1em; text-transform: uppercase;
}
.cc-tono::before { content: ''; width: 6px; height: 6px; background: var(--t); }
.cc-meta { display: flex; align-items: center; gap: 7px; min-width: 0;
  font-size: 9.5px; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cc-meta i { width: 8px; height: 8px; flex-shrink: 0; }
.cc-num { display: grid; grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); }
.cc-num span { display: flex; flex-direction: column; gap: 1px; padding: 5px 0 5px 8px;
  border-right: 1px solid var(--line-soft); }
.cc-num span:first-child { padding-left: 0; }
.cc-num span:last-child { border-right: 0; }
.cc-num i { font-style: normal; font-size: 8px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.cc-num b { font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.cc-num b.acc { color: var(--accent); }
.cc-temi { display: flex; flex-wrap: wrap; gap: 4px; }
.pill { padding: 2px 6px; border: 1px solid var(--line-soft); background: var(--surface-2);
  font-size: 9.5px; color: var(--ink-2); }
.pill b { font-weight: 600; color: var(--ink); }
.pill.on { border-color: var(--accent); }
.cc-bers .r { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px;
  margin-bottom: 5px; font-size: 10px; }
.cc-bers .r span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cc-bers .r b { font-weight: 600; font-size: 9.5px; font-variant-numeric: tabular-nums; }
.cc-bers .trk { display: block; grid-column: 1 / -1; height: 2px; background: var(--line-soft); }
.cc-bers .trk s { display: block; height: 100%; background: var(--accent-2); }
.cp-elenco > .cp-vuoto { padding: 0 14px 16px; }

@media (min-width: 761px) and (max-width: 1100px) {
  .cp-due { grid-template-columns: 1fr; }
  .cp-tempo-k { display: none; }
}
@media (max-width: 760px) {
  .cp-lato { flex-direction: row; }
  .cp-main { height: auto; }
  .cp-tempo { flex-wrap: wrap; gap: 3px; }
  .cp-tempo .tm { max-width: none; padding: 3px 4px 2px; }
  .cp-tempo .tm b { display: none; }
  .cp-tempo-k { display: none; }
  .cp-due { grid-template-columns: 1fr; gap: 16px; padding: 0 12px 16px; }
  .cp-elenco { margin: 0 12px 28px; }
  .cp-sez-body { padding: 12px; }
  .cp-tr { grid-template-columns: minmax(0, 1fr) 42px; }
  .cp-tr .trk { grid-column: 1 / -1; grid-row: 2; }
  .cp-tr .n { display: none; }
  .cp-tr .chi { grid-column: 1 / -1; }
  .cp-lr { grid-template-columns: 96px minmax(60px, 1fr) 34px; column-gap: 7px; }
  .cp-q { max-width: none; flex-basis: 100%; }
  .cp-tool select { flex: 1 1 140px; max-width: none; }
  .cp-griglia { grid-template-columns: 1fr; padding: 12px; }
}

/* ══════════════════════════════════════════════════════════ SEGNALAZIONI
   Il pulsante sta di fianco alla colonna di destra, alla stessa altezza del
   suo bordo in alto: la faccina «=)» che si guarda intorno (gli occhi li muove
   graph.js) e due righe piccole, come i titoli della colonna. Se la colonna è
   chiusa va nell'angolo; con una scheda aperta si sposta alla sua sinistra. */
:root { --fbb-h: 44px; }
#fbBox { z-index: 32; }
.fbb {
  position: fixed; z-index: 21;
  top: calc(var(--bar-h) + 18px); right: calc(18px + var(--rail-w) + 12px);
  height: var(--fbb-h);
  display: flex; align-items: center; gap: 0; padding: 0 6px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
  text-align: left;
  transition: right 340ms var(--ease), border-color var(--t) var(--ease), opacity 300ms var(--ease),
              padding 320ms var(--ease);
}
/* a riposo solo la faccina; col puntatore sopra (o col fuoco da tastiera) il
   riquadro si allunga verso sinistra — è ancorato a destra — e compare la scritta */
/* si apre con un attimo di ritardo (passandoci sopra per caso non scatta),
   si richiude subito */
.fbb:hover, .fbb:focus-visible {
  padding-right: 13px;
  transition: right 340ms var(--ease), border-color var(--t) var(--ease), opacity 300ms var(--ease),
              padding 320ms var(--ease) 180ms;
}
body:has(#legend.off) .fbb { right: 18px; }
body:has(.card.open) .fbb { right: calc(18px + var(--card-w) + 12px); }
body.alt .fbb, body.cp-on .fbb { opacity: 0; pointer-events: none; }
body.boot .fbb { opacity: 0; }
.fbb:hover, .fbb[aria-pressed="true"] { border-color: var(--ink); }
.fbb:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.fbb-faccia { width: 30px; height: 30px; flex-shrink: 0; overflow: visible; }
.fbb-faccia .cella { fill: var(--surface-2); stroke: var(--line); stroke-width: 1.2; }
.fbb-faccia .pupilla { fill: var(--ink); transition: transform 260ms var(--ease); }
.fbb-faccia .occhio { transform-box: fill-box; transform-origin: center; transition: transform 80ms linear; }
.fbb-faccia .occhio.chiuso { transform: scaleY(.15); }
.fbb-faccia .bocca { fill: none; stroke: var(--ink); stroke-width: 2.6; stroke-linecap: round;
  transition: stroke var(--t) var(--ease); }
.fbb:hover .fbb-faccia .bocca, .fbb[aria-pressed="true"] .fbb-faccia .bocca { stroke: var(--accent); }
.fbb:hover .fbb-faccia { animation: fbb-scuoti 460ms var(--ease); }
@keyframes fbb-scuoti { 25% { transform: rotate(-5deg); } 60% { transform: rotate(4deg); } }
.fbb-tx {
  display: flex; flex-direction: column; gap: 4px; white-space: nowrap; overflow: hidden;
  max-width: 0; margin-left: 0; opacity: 0;
  transition: max-width 340ms var(--ease), margin-left 340ms var(--ease), opacity 180ms var(--ease);
}
.fbb:hover .fbb-tx, .fbb:focus-visible .fbb-tx {
  max-width: 230px; margin-left: 10px; opacity: 1;
  transition: max-width 340ms var(--ease) 180ms, margin-left 340ms var(--ease) 180ms,
              opacity 220ms var(--ease) 270ms;
}
.fbb-h { font-size: 9.5px; letter-spacing: .13em; text-transform: uppercase; font-weight: 500; }
/* la seconda riga come i sottotitoli della colonna («categorie dichiarate…») */
.fbb-s { font-size: 8.5px; letter-spacing: .13em; text-transform: uppercase;
  color: var(--muted); white-space: nowrap; }

@media (max-width: 760px) {
  .fbb { top: auto; bottom: 12px; right: 12px !important; width: auto; height: 56px; padding: 0 12px; }
  .fbb-faccia { width: 32px; height: 32px; }
  .fbb-tx { display: none; }
  body:has(.card.open) .fbb, body:has(#legend:not(.off)) .fbb { opacity: 0; pointer-events: none; }
  .cpt.mini { right: 76px; }
}
