/* Ping tool — extends tools-engine */
.pt-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 4px;
}

.pt-form .te-input,
.pt-host-input {
  flex: 1;
  min-width: 180px;
  text-align: left;
  color: #1e293b !important;
  -webkit-text-fill-color: #1e293b !important;
}

.pt-host-input::placeholder {
  color: #64748b !important;
  opacity: 1;
}

.pt-mode {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.pt-mode-btn {
  flex: 1;
  height: 36px;
  border: 1px solid var(--te-border);
  border-radius: 8px;
  background: var(--te-card);
  color: var(--te-muted);
  font-size: 12px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.pt-mode-btn.active {
  border-color: var(--te-accent);
  color: var(--te-accent);
  background: var(--te-accent-dim);
}

/* Topology diagram */
.pt-topology {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 24px;
  padding: 20px 12px;
  background: linear-gradient(180deg, rgba(0, 147, 233, 0.04) 0%, rgba(67, 86, 163, 0.03) 100%);
  border: 1px solid var(--te-border);
  border-radius: 14px;
}

.pt-node {
  flex: 0 0 38%;
  max-width: 38%;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 8px 6px;
}

.pt-node-icon {
  color: #4356a3;
  margin-bottom: 8px;
  position: relative;
}

.pt-node-icon--server {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.pt-topo-flag {
  border-radius: 3px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

.pt-server-svg {
  color: #0093e9;
}

.pt-node-title {
  font-size: 13px;
  font-weight: 800;
  color: #4356a3;
  line-height: 1.3;
  margin-bottom: 2px;
}

.pt-node-sub {
  font-size: 11px;
  color: var(--te-muted);
  margin-bottom: 8px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pt-node-ips {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pt-ip-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 11px;
}

.pt-ip-label {
  color: var(--te-muted);
  font-weight: 600;
}

.pt-ip-row code {
  font-family: ui-monospace, 'Cascadia Code', monospace;
  font-size: 11px;
  background: rgba(67, 86, 163, 0.08);
  padding: 3px 6px;
  border-radius: 4px;
  color: #1e293b;
  word-break: break-all;
}

.pt-link {
  flex: 1;
  min-width: 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 4px;
}

.pt-link-track {
  position: relative;
  width: 100%;
  height: 6px;
  background: rgba(67, 86, 163, 0.12);
  border-radius: 3px;
  transition: opacity 0.3s;
}

.pt-link--active .pt-link-track {
  background: rgba(67, 86, 163, 0.18);
}

.pt-packet {
  position: absolute;
  top: 50%;
  left: 0;
  width: 12px;
  height: 12px;
  margin-top: -6px;
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
  background: #7c3aed;
  box-shadow: 0 0 10px rgba(124, 58, 237, 0.55);
}

.pt-link--active .pt-packet {
  animation: pt-packet-round 1.1s ease-in-out infinite;
}

.pt-link--pulse .pt-packet {
  animation: pt-packet-round-once 0.9s ease-in-out;
}

@keyframes pt-packet-round {
  0% {
    left: 0;
    opacity: 0;
    background: #7c3aed;
    box-shadow: 0 0 10px rgba(124, 58, 237, 0.55);
  }
  8% { opacity: 1; }
  48% {
    left: calc(100% - 12px);
    opacity: 1;
    background: #7c3aed;
    box-shadow: 0 0 10px rgba(124, 58, 237, 0.55);
  }
  52% {
    left: calc(100% - 12px);
    background: #0093e9;
    box-shadow: 0 0 10px rgba(0, 147, 233, 0.55);
  }
  92% {
    left: 0;
    opacity: 1;
    background: #0093e9;
    box-shadow: 0 0 10px rgba(0, 147, 233, 0.55);
  }
  100% {
    left: 0;
    opacity: 0;
    background: #0093e9;
  }
}

@keyframes pt-packet-round-once {
  0% {
    left: 0;
    opacity: 0;
    background: #7c3aed;
  }
  10% { opacity: 1; }
  45% {
    left: calc(100% - 12px);
    background: #7c3aed;
  }
  55% {
    left: calc(100% - 12px);
    background: #0093e9;
  }
  90% {
    left: 0;
    opacity: 1;
    background: #0093e9;
  }
  100% {
    left: 0;
    opacity: 0;
  }
}

.pt-link-ms {
  font-size: 14px;
  font-weight: 800;
  color: var(--te-accent);
  font-variant-numeric: tabular-nums;
  min-height: 20px;
}

.pt-link-ms.pt-link-ms--fail {
  color: var(--te-danger);
  font-size: 11px;
}

.pt-stats {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin: 24px 0 12px;
}

.pt-stat {
  text-align: center;
  padding: 12px 6px;
  background: var(--te-card);
  border: 1px solid var(--te-border);
  border-radius: 10px;
}

.pt-stat-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--te-muted);
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

.pt-stat-value {
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--te-text);
}

.pt-stat-value--accent {
  color: var(--te-accent);
}

.pt-loss {
  text-align: center;
  font-size: 13px;
  color: var(--te-muted);
  margin-bottom: 16px;
}

.pt-loss strong {
  color: var(--te-text);
  font-weight: 800;
}

.pt-chart-wrap {
  background: var(--te-card);
  border: 1px solid var(--te-border);
  border-radius: 10px;
  padding: 12px 12px 8px;
  margin-bottom: 16px;
}

.pt-chart-wrap canvas {
  width: 100%;
  height: 120px;
  display: block;
}

/* Windows-style ping console */
.pt-console-wrap {
  height: 220px;
  min-height: 220px;
  max-height: 220px;
  margin-bottom: 16px;
  border: 1px solid var(--te-border);
  border-radius: 10px;
  background: #0c1222;
  overflow: hidden;
}

.pt-console {
  height: 100%;
  overflow-y: auto;
  overflow-x: auto;
  padding: 12px 14px;
  font-family: Consolas, 'Cascadia Mono', 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.55;
  color: #e2e8f0;
  scroll-behavior: smooth;
}

.pt-console-line {
  white-space: pre-wrap;
  word-break: break-word;
}

.pt-console-line--hint {
  color: #94a3b8;
}

.pt-console-line--ok {
  color: #86efac;
}

.pt-console-line--fail {
  color: #fca5a5;
}

.pt-console-line--stat {
  color: #93c5fd;
  margin-top: 6px;
}

.pt-note {
  margin-top: 8px;
  font-size: 12px;
  color: var(--te-accent);
  opacity: 0.9;
}

.pt-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
  justify-content: center;
  align-items: center;
}

.pt-continuous-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--te-muted);
  font-size: 13px;
  cursor: pointer;
}

/* Share dialog */
.pt-share-dialog {
  border: none;
  border-radius: 16px;
  padding: 0;
  max-width: 400px;
  width: calc(100% - 32px);
  background: #fff;
  color: #1e293b;
  box-shadow: 0 24px 64px rgba(67, 86, 163, 0.2);
  overflow: hidden;
}

.pt-share-dialog::backdrop {
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
}

.pt-share-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  background: linear-gradient(135deg, #4356a3 0%, #0093e9 100%);
}

.pt-share-head h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  color: #fff;
}

.pt-share-head .te-dialog-close {
  color: rgba(255, 255, 255, 0.85);
}

.pt-share-head .te-dialog-close:hover {
  color: #fff;
}

.pt-share-preview-wrap {
  padding: 20px;
  text-align: center;
  background: #f1f5f9;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pt-share-preview-wrap img {
  max-width: 100%;
  max-height: 420px;
  width: auto;
  height: auto;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(67, 86, 163, 0.18);
}

.pt-share-loading {
  color: #64748b;
  font-size: 14px;
  font-weight: 600;
}

.pt-share-actions {
  display: flex;
  gap: 10px;
  padding: 16px 20px 20px;
  background: #fff;
}

.pt-share-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 46px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #4356a3, #0093e9);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: opacity 0.15s, background 0.2s, color 0.2s, border-color 0.2s;
}

.pt-share-btn:hover:not(:disabled) {
  opacity: 0.92;
}

.pt-share-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.pt-share-btn--ghost {
  background: #fff;
  color: #4356a3;
  border: 1.5px solid rgba(67, 86, 163, 0.28);
}

.pt-share-btn--copied {
  background: #059669 !important;
  color: #fff !important;
  border-color: #059669 !important;
}

@media (max-width: 560px) {
  .pt-topology {
    flex-direction: column;
    align-items: center;
    padding: 16px 12px;
  }

  .pt-node {
    flex: none;
    max-width: 100%;
    width: 100%;
  }

  .pt-link {
    width: 100%;
    flex-direction: row;
    padding: 8px 0;
  }

  .pt-link-track {
    flex: 1;
  }

  .pt-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .pt-stat-value {
    font-size: 18px;
  }

  .pt-console-wrap {
    height: 180px;
    min-height: 180px;
    max-height: 180px;
  }

  .pt-console {
    font-size: 12px;
  }
}
