/* Netzwerk-Status (Infos-Seite) – Serverliste im Stil des Minecraft-Mehrspieler-Menüs.
   Gerendert von assets/js/network-status.js in #network-status-root; nutzt die Variablen aus v2.css
   (--tex-*, --px-*, --v2-*). Alle Klassen mit Präfix ns-. Ecken eckig (v2: border-radius 0), kein Orange. */

.ns {
  --ns-green: #4ade80;
  --ns-green-dark: #15803d;
  --ns-yellow: #fde047;
  --ns-red: #ff5f6d;
  --ns-violet: #d8b4fe;
  --ns-idle: #8f84a6;
  --ns-slot: rgba(0, 0, 0, 0.46);
  display: grid;
  gap: 14px;
  min-width: 0;
}
.ns-head { margin: 0; }

.ns-sr { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }

/* ---------- Kopfleiste: Gesamtzustand, Spieler, Aktualisierung ---------- */
.ns-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 10px 12px;
  background: var(--px-card); image-rendering: pixelated; clip-path: var(--px-clip);
  box-shadow: inset 0 0 0 3px var(--v2-edge), var(--px-bevel);
}
.ns-overall {
  display: inline-flex; align-items: center; gap: 10px; min-height: 38px; padding: 0 14px;
  background: rgba(0, 0, 0, 0.5); color: #fff; font-weight: 900; letter-spacing: 0.02em;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.6); box-shadow: inset 0 0 0 2px #2a2138, inset 3px 3px 0 rgba(0, 0, 0, 0.45);
}
.ns-led { width: 12px; height: 12px; flex: none; background: var(--ns-idle); box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.6), inset -3px -3px 0 rgba(0, 0, 0, 0.28); }
.ns-overall[data-tone="ok"] { box-shadow: inset 0 0 0 2px rgba(74, 222, 128, 0.55), inset 3px 3px 0 rgba(0, 0, 0, 0.45); }
.ns-overall[data-tone="ok"] .ns-led { background: var(--ns-green); animation: ns-led 2.4s steps(2, jump-none) infinite; }
.ns-overall[data-tone="warn"] { box-shadow: inset 0 0 0 2px rgba(253, 224, 71, 0.55), inset 3px 3px 0 rgba(0, 0, 0, 0.45); }
.ns-overall[data-tone="warn"] .ns-led { background: var(--ns-yellow); }
.ns-overall[data-tone="down"] { box-shadow: inset 0 0 0 2px rgba(255, 95, 109, 0.6), inset 3px 3px 0 rgba(0, 0, 0, 0.45); }
.ns-overall[data-tone="down"] .ns-led { background: var(--ns-red); }
.ns-overall[data-tone="maint"] { box-shadow: inset 0 0 0 2px rgba(216, 180, 254, 0.6), inset 3px 3px 0 rgba(0, 0, 0, 0.45); }
.ns-overall[data-tone="maint"] .ns-led { background: var(--ns-violet); }
@keyframes ns-led { 0% { filter: brightness(1); } 100% { filter: brightness(1.45); } }

.ns-total { display: inline-flex; align-items: center; gap: 8px; color: var(--v2-muted); font-weight: 800; }
.ns-total .mc-ico { width: 22px; height: 22px; }
.ns-total-num { color: #fff; font-size: 1.35rem; font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.6); }
.ns[data-overall="online"] .ns-total-num, .ns[data-overall="partial"] .ns-total-num { color: var(--ns-green); }
.ns-bar-end { display: inline-flex; align-items: center; gap: 10px; margin-left: auto; }
.ns-updated { color: var(--v2-muted); font-size: 0.86rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.ns-refresh, .ns-retry {
  display: inline-grid; place-items: center; min-width: 38px; height: 38px; padding: 0 10px; border: 0; cursor: pointer;
  background: rgba(0, 0, 0, 0.5); color: #e9d5ff; font: inherit; font-weight: 900;
  box-shadow: inset 0 0 0 2px #2a2138, inset 3px 3px 0 rgba(0, 0, 0, 0.45); transition: color 0.12s ease, box-shadow 0.12s ease, transform 0.12s ease;
}
.ns-refresh:hover, .ns-retry:hover { color: #fff; box-shadow: inset 0 0 0 2px var(--v2-amethyst), inset 3px 3px 0 rgba(0, 0, 0, 0.45); transform: translateY(-1px); }
.ns-refresh:disabled { cursor: progress; opacity: 0.7; transform: none; }
.ns-refresh.is-spinning i { animation: ns-spin 0.8s steps(8) infinite; }
@keyframes ns-spin { to { transform: rotate(360deg); } }

.ns-notice {
  margin: 0; padding: 10px 14px; color: #f3e8ff; font-weight: 700; line-height: 1.45;
  background: rgba(155, 92, 246, 0.16); box-shadow: inset 4px 0 0 var(--v2-amethyst), inset 0 0 0 2px rgba(192, 132, 252, 0.28);
}
.ns-notice[hidden] { display: none; }

/* ---------- Gruppen ---------- */
.ns-groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 14px; align-items: start; }
.ns-group { display: grid; gap: 8px; min-width: 0; }
.ns-group.is-modes, .ns-error { grid-column: 1 / -1; }
.ns-group-title {
  display: flex; align-items: center; gap: 10px; margin: 0; color: #fff; font-size: 0.95rem; font-weight: 900;
  letter-spacing: 0.08em; text-transform: uppercase; text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.6);
}
.ns-group-count { margin-left: auto; padding: 2px 9px; color: var(--v2-muted); font-size: 0.76rem; letter-spacing: 0.04em; background: rgba(0, 0, 0, 0.5); box-shadow: inset 0 0 0 2px #2a2138; }
.ns-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.ns-group.is-modes .ns-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* ---------- Server-Zeile ---------- */
.ns-row {
  position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 12px;
  min-height: 68px; padding: 8px 12px 8px 8px; background: var(--ns-slot);
  box-shadow: inset 0 0 0 2px #241b31, inset 4px 4px 0 rgba(0, 0, 0, 0.35), inset -2px -2px 0 rgba(255, 255, 255, 0.03);
  transition: box-shadow 0.15s ease, background 0.15s ease, transform 0.15s ease;
}
.ns-row:not(.is-skeleton):hover {
  background: rgba(20, 12, 30, 0.72); transform: translateY(-1px);
  box-shadow: inset 0 0 0 2px #e9d5ff, inset 4px 4px 0 rgba(0, 0, 0, 0.3), 0 0 0 2px rgba(155, 92, 246, 0.35), 0 0 22px rgba(155, 92, 246, 0.45);
}
.ns-row.is-offline:not(:hover), .ns-row.is-unknown:not(:hover) { background: rgba(0, 0, 0, 0.36); }

.ns-icon {
  position: relative; display: grid; place-items: center; width: 48px; height: 48px; flex: none;
  background: var(--tex-blackstone) center / 48px 48px; image-rendering: pixelated;
  box-shadow: inset 0 0 0 2px var(--v2-edge), inset 3px 3px 0 rgba(255, 255, 255, 0.12), inset -3px -3px 0 rgba(0, 0, 0, 0.45);
}
.ns-icon .mc-ico { width: 32px; height: 32px; filter: drop-shadow(2px 2px 0 rgba(0, 0, 0, 0.65)); }
.ns-icon[data-icon="proxy"] { background-image: url("../img/minecraft/block/crying_obsidian.png"); }
.ns-icon[data-icon="lobby"] { background-image: url("../img/minecraft/block/amethyst_block.png"); }
.ns-icon[data-icon="smp"] { background-image: url("../img/minecraft/block/grass_block_side.png"); }
.ns-icon[data-icon="freebuild"] { background-image: url("../img/minecraft/block/bricks.png"); }
.ns-icon[data-icon="farmwelt"] { background-image: url("../img/minecraft/block/deepslate_iron_ore.png"); }
.ns-icon[data-icon="duel"] { background-image: url("../img/minecraft/block/red_nether_bricks.png"); }
.ns-icon[data-icon="event"] { background-image: url("../img/minecraft/block/purpur_block.png"); }
.ns-row.is-offline .ns-icon, .ns-row.is-unknown .ns-icon, .ns-row.is-idle .ns-icon { filter: grayscale(0.85) brightness(0.7); }

.ns-main { display: grid; gap: 3px; min-width: 0; }
.ns-line1 { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ns-name { flex: 1 1 auto; min-width: 0; color: #fff; font-weight: 900; font-size: 1.02rem; text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.65); overflow-wrap: anywhere; }
.ns-side { display: inline-flex; align-items: center; gap: 10px; flex: none; }
.ns-players { color: #9d94ad; font-weight: 800; font-size: 0.92rem; font-variant-numeric: tabular-nums; text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.6); white-space: nowrap; }
.ns-players b { color: #e6def4; font-weight: 900; }
.ns-players .ns-slash { color: #5f566f; margin: 0 1px; }
.ns-players.is-empty { color: #5f566f; }
.ns-motd { color: #b3a9c9; font-size: 0.88rem; line-height: 1.35; text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.6); overflow-wrap: anywhere; }
.ns-status { font-size: 0.82rem; font-weight: 800; line-height: 1.3; text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.6); color: var(--v2-muted); }
.ns-row.is-online .ns-status { color: var(--ns-green); }
.ns-row.is-degraded .ns-status { color: var(--ns-yellow); }
.ns-row.is-maintenance .ns-status { color: var(--ns-violet); }
.ns-row.is-starting .ns-status, .ns-row.is-restarting .ns-status, .ns-row.is-stopping .ns-status { color: #a5b4fc; }
.ns-row.is-offline .ns-status { color: var(--ns-red); }
.ns-row.is-idle .ns-status, .ns-row.is-unknown .ns-status { color: var(--ns-idle); }

/* ---------- Signalbalken (5 Balken; grau mit rotem X = keine Verbindung) ---------- */
.ns-signal { position: relative; display: inline-flex; align-items: flex-end; gap: 1px; width: 21px; height: 16px; flex: none; }
.ns-signal i { width: 3px; background: #2c2438; box-shadow: 1px 1px 0 rgba(0, 0, 0, 0.7); }
.ns-signal i:nth-child(1) { height: 4px; }
.ns-signal i:nth-child(2) { height: 7px; }
.ns-signal i:nth-child(3) { height: 10px; }
.ns-signal i:nth-child(4) { height: 13px; }
.ns-signal i:nth-child(5) { height: 16px; }
.ns-signal.is-ok i.is-on { background: linear-gradient(var(--ns-green) 0 calc(100% - 2px), var(--ns-green-dark) calc(100% - 2px)); }
.ns-signal.is-low i.is-on { background: linear-gradient(var(--ns-yellow) 0 calc(100% - 2px), #a16207 calc(100% - 2px)); }
.ns-signal.is-maint i { background: linear-gradient(var(--ns-violet) 0 calc(100% - 2px), #7e22ce calc(100% - 2px)); opacity: 0.75; }
.ns-signal.is-off::after, .ns-signal.is-idle::after {
  content: ""; position: absolute; left: 3px; top: 1px; width: 14px; height: 14px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 7 7' shape-rendering='crispEdges'%3E%3Cpath fill='%23ff5f6d' d='M0 0h1v1H0zM1 1h1v1H1zM2 2h1v1H2zM3 3h1v1H3zM4 4h1v1H4zM5 5h1v1H5zM6 6h1v1H6zM6 0h1v1H6zM5 1h1v1H5zM4 2h1v1H4zM2 4h1v1H2zM1 5h1v1H1zM0 6h1v1H0z'/%3E%3C/svg%3E") 0 0 / 14px 14px no-repeat;
  filter: drop-shadow(1px 1px 0 rgba(0, 0, 0, 0.8));
}
.ns-signal.is-idle::after { opacity: 0.35; filter: grayscale(1) drop-shadow(1px 1px 0 rgba(0, 0, 0, 0.8)); }
.ns-signal.is-pinging i { animation: ns-ping 1.25s steps(1, end) infinite; }
.ns-signal.is-pinging i:nth-child(2) { animation-delay: 0.25s; }
.ns-signal.is-pinging i:nth-child(3) { animation-delay: 0.5s; }
.ns-signal.is-pinging i:nth-child(4) { animation-delay: 0.75s; }
.ns-signal.is-pinging i:nth-child(5) { animation-delay: 1s; }
@keyframes ns-ping { 0% { background: #a5b4fc; } 20%, 100% { background: #2c2438; } }

/* ---------- Laden / Fehler ---------- */
.ns-row.is-skeleton .ns-icon { background: rgba(255, 255, 255, 0.05); }
.ns-skel-line { display: block; height: 12px; width: 62%; background: rgba(255, 255, 255, 0.07); animation: ns-pulse 1.4s ease-in-out infinite; }
.ns-skel-line.is-short { width: 38%; }
@keyframes ns-pulse { 50% { opacity: 0.45; } }
.ns[aria-busy="true"] .ns-overall-text { color: var(--v2-muted); }

.ns-error {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 14px 16px;
  background: rgba(225, 29, 72, 0.12); box-shadow: inset 4px 0 0 var(--v2-crimson), inset 0 0 0 2px rgba(225, 29, 72, 0.32);
}
.ns-error .mc-ico { width: 28px; height: 28px; }
.ns-error-text { flex: 1 1 220px; margin: 0; color: #ffe4e6; font-weight: 700; line-height: 1.45; }
.ns-retry { padding: 0 14px; }

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .ns-group.is-modes .ns-list { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .ns-groups { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .ns-bar { padding: 10px; gap: 8px 10px; }
  .ns-overall { min-height: 34px; padding: 0 10px; font-size: 0.92rem; }
  .ns-bar-end { width: 100%; justify-content: space-between; margin-left: 0; }
  .ns-row { gap: 10px; min-height: 64px; padding: 7px 9px 7px 7px; }
  .ns-line1 { gap: 8px; }
  .ns-name { font-size: 0.96rem; }
  .ns-side { gap: 8px; }
  .ns-players { font-size: 0.84rem; }
  .ns-motd { font-size: 0.82rem; }
}
@media (prefers-reduced-motion: reduce) {
  .ns-overall .ns-led, .ns-skel-line, .ns-refresh.is-spinning i { animation: none !important; }
  .ns-signal.is-pinging i { animation: none !important; }
  .ns-signal.is-pinging i:nth-child(-n+2) { background: #a5b4fc; }
  .ns-row, .ns-refresh, .ns-retry { transition: none; }
  .ns-row:not(.is-skeleton):hover { transform: none; }
}
