/*
 * Ağda paket yolculuğu (BT Atölyesi) — yalnızca bu araca özgü stiller.
 * Düzen, kontroller, anlatım kutusu, tam ekran çekirdekte (core/theme.css). Renkler çekirdek değişkenlerinden
 * (`--lab-*`): ayrı koyu mod seçicisi gerekmez.
 * Burada: SVG ağ haritası (bağlantı, düğüm, paket), gönderen/alıcı panelleri, olay günlüğü, akıllı tahta ölçekleri.
 */

/* --------------------------------------------------------------- ağ haritası */

.net-visual {
  padding: 12px;
  border-radius: var(--lab-radius-lg);
  background: var(--lab-bg-sunken);
}

.net-map {
  display: block;
  width: 100%;
  height: auto;
  max-height: 70vh;
  overflow: visible;
  font-family: var(--lab-font);
  touch-action: manipulation;
  user-select: none;
}

.net-hint {
  margin: 0;
  font-size: 13px;
  color: var(--lab-text-2);
  text-align: center;
}

.net-link {
  cursor: pointer;
  outline: none;
}

.net-link__hit {
  stroke: transparent;
  stroke-width: 28;
  stroke-linecap: round;
}

.net-link__line {
  stroke: var(--lab-text-2);
  stroke-width: 2;
  stroke-linecap: round;
  transition: stroke var(--lab-dur) var(--lab-ease);
}

@media (hover: hover) {
  .net-link:hover .net-link__line {
    stroke: var(--lab-text);
  }
}

.net-link:focus-visible .net-link__line {
  stroke: var(--lab-focus);
  stroke-width: 5;
}

.net-link__cut {
  stroke: var(--lab-text);
  stroke-width: 3;
  stroke-linecap: round;
  opacity: 0;
}

.net-link.is-cut .net-link__line {
  stroke-dasharray: 6 9;
  opacity: 0.55;
}

.net-link.is-cut .net-link__cut {
  opacity: 1;
}

.net-node__shape {
  fill: var(--lab-bg);
  stroke: var(--lab-text-2);
  stroke-width: 2;
  transition: stroke var(--lab-dur) var(--lab-ease);
}

.net-node--pc .net-node__shape,
.net-node--server .net-node__shape {
  stroke: var(--lab-text);
}

.net-node.is-hop .net-node__shape {
  stroke: var(--lab-accent);
  stroke-width: 4;
}

.net-node__label {
  fill: var(--lab-text);
  font-size: 22px;
  font-weight: 600;
  text-anchor: middle;
}

.net-node--router .net-node__label {
  font-size: 20px;
}

.net-node__ip {
  fill: var(--lab-text-2);
  font-size: 16px;
  text-anchor: middle;
  font-variant-numeric: tabular-nums;
}

/* Dikey düzende harita küçülür: yazılar oransal büyüsün. */
.net-map.is-vertical .net-node__label {
  font-size: 26px;
}

.net-map.is-vertical .net-node__ip {
  font-size: 17px;
}

.net-pkt__box {
  fill: var(--lab-text);
  stroke: var(--lab-text);
  stroke-width: 2;
}

.net-pkt__text {
  fill: var(--lab-bg);
  font-size: 15px;
  font-weight: 600;
  text-anchor: middle;
}

.net-pkt.is-resent .net-pkt__box {
  fill: var(--lab-accent-fill);
  stroke: var(--lab-accent-fill);
}

.net-pkt.is-resent .net-pkt__text {
  fill: var(--lab-accent-text);
}

.net-pkt.is-dns .net-pkt__box {
  fill: var(--lab-bg);
  stroke-dasharray: 4 3;
}

.net-pkt.is-dns .net-pkt__text {
  fill: var(--lab-text);
}

.net-pkt.is-lost {
  opacity: 0.45;
}

.net-pkt__x {
  stroke: var(--lab-text);
  stroke-width: 3;
  stroke-linecap: round;
}

/* Telefonda harita uzun ve dikey: yapışık sahne altındaki her şeyi kapatırdı. */
@container lab (max-width: 560px) {
  .net .lab-visual {
    position: static;
    margin-inline: 0;
    padding: 8px;
    background: var(--lab-bg-sunken);
  }
}

/* ------------------------------------------------------ gönderen / alıcı */

.net-panels {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: auto;
}

/* Geniş ekranda sağ sütun kendi boyunda (çekirdekte sol sütun boyuna kırpılıp iç kaydırmalıydı:
   asıl sonuç "Birleşen mesaj" ve "Olaylar" ilk bakışta görünmüyordu). Harita kendi boyunda kalır,
   durum alanı hemen altında; artan yükseklik sol sütunun altında boşluk olur. */
@container lab (min-width: 900px) {
  .lab-layout.net {
    grid-template-rows: auto 1fr auto auto;
  }

  .net .net-panels {
    contain: none;
    overflow: visible;
  }

  .net > .lab-visual,
  .net > .lab-status {
    align-self: start;
  }
}

.net-panel {
  padding: 14px 16px;
  border-radius: var(--lab-radius);
  background: var(--lab-bg-sunken);
}

.net-panel__title {
  margin: 0 0 4px;
  font-size: 17px;
  font-weight: 600;
}

.net-panel__note,
.net-panel__label {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--lab-text-2);
}

.net-panel__label {
  margin-top: 12px;
  font-weight: 600;
}

.net-packet-list,
.net-log {
  margin: 0;
  padding: 0;
  list-style: none;
}

.net-packet {
  display: grid;
  grid-template-columns: 4.2em minmax(0, 1fr) auto;
  gap: 2px 10px;
  padding: 8px 0;
  border-top: 1px solid var(--lab-separator);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.net-packet__head {
  font-weight: 600;
}

.net-packet__data {
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.net-packet__state {
  font-size: 13px;
  color: var(--lab-text-2);
  text-align: right;
}

.net-packet__route {
  grid-column: 2 / -1;
  font-size: 13px;
  color: var(--lab-text-2);
}

.net-packet.is-lost .net-packet__data {
  color: var(--lab-text-2);
  text-decoration: line-through;
}

.net-packet.is-resent .net-packet__head,
.net-packet.is-arrived .net-packet__state {
  color: var(--lab-accent);
}

.net-empty {
  font-size: 15px;
  color: var(--lab-text-2);
}

.net-chips,
.net-slots {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 32px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.net-chip {
  display: grid;
  place-items: center;
  min-width: 32px;
  height: 28px;
  padding: 0 8px;
  border-radius: var(--lab-radius-pill);
  background: var(--lab-text);
  color: var(--lab-bg);
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.net-slot {
  display: grid;
  min-width: 44px;
  padding: 6px 10px;
  border: 1px dashed var(--lab-text-2);
  border-radius: var(--lab-radius-sm);
  font-variant-numeric: tabular-nums;
}

.net-slot.is-filled {
  border-style: solid;
  border-color: var(--lab-text);
}

.net-slot__n {
  font-size: 12px;
  color: var(--lab-text-2);
}

.net-slot__data {
  font-family: var(--lab-font-mono);
  font-size: 15px;
  white-space: pre;
}

.net-assembled {
  min-height: 1.5em;
  margin: 0;
  font-family: var(--lab-font-mono);
  font-size: 18px;
  overflow-wrap: anywhere;
  color: var(--lab-text-2);
}

.net-assembled.is-complete {
  color: var(--lab-text);
  font-weight: 600;
}

.net-log li {
  padding: 6px 0;
  border-top: 1px solid var(--lab-separator);
  font-size: 14px;
  color: var(--lab-text-2);
}

.net-log li:first-child {
  color: var(--lab-text);
}

.net-how > summary {
  display: flex;
  align-items: center;
  min-height: 36px;
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
}

.net-how p,
.net-how ul {
  margin: 0 0 10px;
  font-size: 15px;
  line-height: 1.5;
}

.net-how ul {
  padding-left: 1.2em;
}

/* ----------------------------------------------------- akıllı tahta (tam ekran) */

.net-board:not(.lab--app) .net-map {
  max-height: none;
  height: 100%;
}

.net-board:not(.lab--app) .net-hint {
  font-size: 16px;
}

/* ----------------------------------------------- ortak şablon (core/app-layout.js) */
/* Harita sahnenin kalan yüksekliğine sığar (viewBox oranını korur). */
.lab--app .net-map {
  flex: 1 1 0; /* yükseklik içerikten değil sahneden gelir */
  min-height: 0;
  height: 0;
  max-height: none;
}
