.soglia-viewer {
  margin: 1.15rem 0 0;
  overflow: hidden;
  border: 1px solid #264c69;
  border-radius: .82rem;
  color: #eef7ff;
  background:
    linear-gradient(#83b8e016 1px, transparent 1px) 0 0 / 28px 28px,
    linear-gradient(90deg, #83b8e016 1px, transparent 1px) 0 0 / 28px 28px,
    radial-gradient(ellipse at 50% 0, #1a3e58, #091a2a 74%);
}
.soglia-viewer-head, .soglia-summary, .soglia-inbound { padding: .9rem clamp(.8rem, 3vw, 1.65rem); }
.soglia-viewer-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; border-bottom: 1px solid #83b8e039; }
.soglia-viewer figcaption { font-size: clamp(1.05rem, 2.4vw, 1.4rem); font-weight: 750; }
.soglia-viewer-head p { color: #92ecdb; font-size: .88rem; font-weight: 650; }
.soglia-pause { padding: .43rem .62rem; border: 1px solid #729db8; border-radius: .42rem; background: #102a3f; color: #f0f9ff; font: inherit; font-size: .83rem; cursor: pointer; }
.soglia-pause[hidden] { display: none; }
.soglia-viewer :is(button, summary):focus-visible { outline: 2px solid #9bf7e3; outline-offset: 3px; }
.soglia-topology { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 2.25fr) minmax(0, .9fr); align-items: center; padding: 1.3rem clamp(.7rem, 3vw, 1.65rem); }
.soglia-lanes { display: grid; gap: .7rem; }
.soglia-lane { --route: #839eb3; display: grid; grid-template-columns: minmax(.7rem, 1fr) minmax(9rem, 2fr) minmax(.7rem, 1fr); align-items: center; }
.soglia-lane[data-route-state=established] { --route: #6bc7ff; }
.soglia-lane[data-route-state=new] { --route: #64e6ac; }
.soglia-lane[data-route-state=uncertain] { --route: #ffd28b; }
.soglia-lane:is([data-route-state=blocked], [data-route-state=offline]) { --route: #ff9a9a; }
.soglia-node {
  display: grid;
  min-width: 0;
  justify-items: center;
  align-content: center;
  gap: .24rem;
  padding: .7rem .44rem;
  border: 1px solid #406783;
  border-radius: .57rem;
  background: linear-gradient(165deg, #1c3c52, #102436);
  text-align: center;
}
.soglia-node h3 { margin: 0; font-size: clamp(.85rem, 1.6vw, 1rem); }
.soglia-node p { color: #c4deed; font-size: .73rem; }
#simula .soglia-viewer code { color: #e6f4ff; font-size: .78rem; font-variant-numeric: tabular-nums; background: transparent; padding: 0; }
.soglia-gateway { grid-template-columns: auto minmax(0, 1fr); justify-items: start; gap: .25rem .55rem; padding: .6rem .65rem; border-color: var(--route); text-align: start; }
.soglia-gateway p { grid-column: 1 / -1; color: var(--route); }
.soglia-line { position: relative; overflow: hidden; border-top: 2px dashed var(--route); }
.soglia-lane:is([data-route-state=established], [data-route-state=new]) .soglia-line { border-top-style: solid; overflow: visible; }
.soglia-lane:is([data-route-state=established], [data-route-state=new]) .soglia-line::after {
  content: '';
  position: absolute;
  top: -4px;
  inset-inline-start: 0;
  width: 7px;
  height: 6px;
  border-radius: 999px;
  background: #f7fdff;
  box-shadow: 0 0 7px 2px var(--route);
  animation: soglia-packet 1.85s linear infinite;
}
.soglia-lane[data-route-state=new] .soglia-line::after { animation-delay: .35s; }
.soglia-viewer[data-paused=true] .soglia-line::after { animation-play-state: paused; }
@keyframes soglia-packet { from { inset-inline-start: 0; opacity: 0; } 15%, 85% { opacity: 1; } to { inset-inline-start: calc(100% - 7px); opacity: 0; } }
.soglia-hardware { display: block; position: relative; width: 30px; height: 21px; margin-block: .1rem .24rem; color: #9bd8f1; }
.soglia-computer { border: 2px solid currentColor; border-radius: 3px; background: #489aca25; }
.soglia-computer::after { content: ''; position: absolute; width: 16px; height: 2px; left: 5px; bottom: -6px; background: currentColor; }
.soglia-server { width: 25px; height: 20px; border: 2px solid var(--route); border-radius: 4px; background: repeating-linear-gradient(to bottom, transparent 0 4px, #accfe044 4px 5px); }
.soglia-server::after { content: ''; position: absolute; inset: 3px 4px auto auto; width: 3px; height: 3px; background: var(--route); box-shadow: 0 5px 0 var(--route), 0 10px 0 var(--route); border-radius: 50%; }
.soglia-cloud { border: 2px solid currentColor; border-radius: 40% 60% 40% 30%; height: 17px; margin-top: .35rem; background: #489aca25; }
.soglia-summary { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); gap: .7rem; border-top: 1px solid #83b8e039; }
.soglia-summary p { font-size: .86rem; }
.soglia-summary span { display: block; color: #a7c7da; font-size: .75rem; }
.soglia-inbound { border-top: 1px solid #83b8e039; }
.soglia-inbound summary { cursor: pointer; font-weight: 650; }
.soglia-inbound p { font-size: .84rem; color: #c4deed; margin-top: .35rem; }
.soglia-inbound-flow { display: flex; align-items: center; gap: .42rem; flex-wrap: wrap; margin-top: .68rem; font-size: .82rem; }
.soglia-inbound-flow strong { color: #ffc0c0; }
.soglia-inbound-line { display: inline-block; width: clamp(1rem, 6vw, 4rem); border-top: 2px dashed #ff9a9a; position: relative; }
.soglia-inbound-line::after { content: ''; position: absolute; inset-inline-end: 0; top: -5px; height: 8px; border-inline-end: 2px solid #ff9a9a; }
@media (max-width: 680px) {
  .soglia-topology { grid-template-columns: 1fr; gap: .65rem; }
  .soglia-lane { grid-template-columns: minmax(1rem, 1fr) minmax(9rem, 3fr) minmax(1rem, 1fr); }
  .soglia-summary { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { .soglia-line::after { display: none; animation: none; } }
