/* plg_content_wiregasm – viewer styles (all scoped to .nc-wiregasm) */
.nc-wiregasm {
  --nc-wg-height: 520px;
  --nc-wg-border: #d0d5dd;
  --nc-wg-bg: #ffffff;
  --nc-wg-bar: #f4f6f8;
  --nc-wg-text: #1d2733;
  --nc-wg-muted: #5b6673;
  --nc-wg-accent: #c7000b;
  --nc-wg-sel: #2c64c4;
  --nc-wg-hi: #ffd84d;
  --nc-wg-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  position: relative;
  box-sizing: border-box;
  margin: 1.25rem 0;
  border: 1px solid var(--nc-wg-border) !important;
  border-radius: 6px;
  background: var(--nc-wg-bg) !important;
  color: var(--nc-wg-text);
  font: 13px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  overflow: hidden;
  text-align: left;
  container: nc-wg / inline-size;
}
.nc-wiregasm *, .nc-wiregasm *::before, .nc-wiregasm *::after { box-sizing: border-box; }
.nc-wiregasm:fullscreen { --nc-wg-height: 100vh; border-radius: 0; margin: 0; overflow: auto; }

/* placeholder */
.nc-wiregasm .nc-wg-placeholder {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: 1rem 1.25rem; background: var(--nc-wg-bar);
}
.nc-wiregasm .nc-wg-icon { font-size: 1.6rem; line-height: 1; }
.nc-wiregasm .nc-wg-meta { flex: 1 1 14rem; min-width: 0; }
.nc-wiregasm .nc-wg-title { font-weight: 600; word-break: break-all; }
.nc-wiregasm .nc-wg-hint { color: var(--nc-wg-muted); font-size: 12px; }
.nc-wiregasm .nc-wg-error {
  padding: .75rem 1rem; color: #8a1f11; background: #fdecea;
}

/* buttons */
.nc-wiregasm .nc-wg-btn,
.nc-wiregasm a.nc-wg-btn,
.nc-wiregasm button.nc-wg-btn {
  /* hard reset: templates style <button> and <a> differently */
  -webkit-appearance: none !important; appearance: none !important;
  display: inline-flex !important; align-items: center !important; justify-content: center !important;
  box-sizing: border-box !important;
  width: auto !important; min-width: 0 !important; max-width: none !important;
  height: 30px !important; min-height: 30px !important; max-height: 30px !important;
  padding: 0 12px !important; margin: 0 !important;
  border: 1px solid var(--nc-wg-border) !important; border-radius: 4px !important;
  background: #fff !important; background-image: none !important; color: var(--nc-wg-text) !important;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif !important;
  font-size: 12.5px !important; font-weight: 500 !important; font-style: normal !important;
  line-height: 1 !important; letter-spacing: normal !important; text-transform: none !important;
  text-align: center !important; text-decoration: none !important; text-shadow: none !important;
  white-space: nowrap !important; vertical-align: middle !important;
  float: none !important; position: static !important; top: auto !important; transform: none !important;
  cursor: pointer; box-shadow: none !important; outline-offset: 2px;
}
.nc-wiregasm .nc-wg-btn::before,
.nc-wiregasm .nc-wg-btn::after { content: none !important; display: none !important; }
.nc-wiregasm a.nc-wg-btn:focus, .nc-wiregasm a.nc-wg-btn:active,
.nc-wiregasm button.nc-wg-btn:not(.nc-wg-btn-primary):not(.nc-wg-start):focus,
.nc-wiregasm button.nc-wg-btn:not(.nc-wg-btn-primary):not(.nc-wg-start):active { color: var(--nc-wg-text) !important; text-decoration: none !important; box-shadow: none !important; }
.nc-wiregasm .nc-wg-btn:focus-visible { outline: 2px solid var(--nc-wg-sel) !important; }
.nc-wiregasm .nc-wg-btn:hover,
.nc-wiregasm a.nc-wg-btn:hover,
.nc-wiregasm button.nc-wg-btn:hover { background: #eef1f4 !important; color: var(--nc-wg-text) !important; }
.nc-wiregasm button.nc-wg-btn:disabled,
.nc-wiregasm button.nc-wg-btn:disabled:hover { opacity: .45 !important; cursor: default; background: #fff !important; }
.nc-wiregasm .nc-wg-btn.nc-wg-btn-primary,
.nc-wiregasm button.nc-wg-btn.nc-wg-btn-primary,
.nc-wiregasm button.nc-wg-btn.nc-wg-start {
  background: var(--nc-wg-accent) !important; border-color: var(--nc-wg-accent) !important; color: #fff !important;
}
.nc-wiregasm button.nc-wg-btn.nc-wg-btn-primary:focus, .nc-wiregasm button.nc-wg-btn.nc-wg-btn-primary:active,
.nc-wiregasm button.nc-wg-btn.nc-wg-start:focus, .nc-wiregasm button.nc-wg-btn.nc-wg-start:active { color: #fff !important; }
.nc-wiregasm button.nc-wg-btn.nc-wg-btn-primary:hover,
.nc-wiregasm button.nc-wg-btn.nc-wg-start:hover { filter: brightness(.92); background: var(--nc-wg-accent) !important; color: #fff !important; }

/* layout */
.nc-wiregasm .nc-wg-ui {
  display: flex; flex-direction: column; height: var(--nc-wg-height); min-height: 320px;
}
.nc-wiregasm .nc-wg-bar {
  display: flex; flex-wrap: wrap; gap: .4rem; align-items: center;
  padding: .45rem .5rem; background: var(--nc-wg-bar); border-bottom: 1px solid var(--nc-wg-border);
}
.nc-wiregasm .nc-wg-filterform { display: flex; flex: 1 1 18rem; gap: .3rem; margin: 0; min-width: 0; }
.nc-wiregasm .nc-wg-filter {
  flex: 1 1 auto; min-width: 0; width: auto !important; height: 30px !important; min-height: 30px !important; margin: 0 !important; padding: 0 8px !important;
  line-height: 28px !important; font-size: 12.5px !important; box-sizing: border-box !important;
  border: 1px solid var(--nc-wg-border) !important; border-radius: 4px; background: #fff !important;
  color: var(--nc-wg-text); font: 12.5px/1 var(--nc-wg-mono); box-shadow: none !important;
}
.nc-wiregasm .nc-wg-filter.nc-wg-valid { background: #e7f7e7 !important; border-color: #6cbf6c !important; }
.nc-wiregasm .nc-wg-filter.nc-wg-invalid { background: #fde8e8 !important; border-color: #d9534f !important; }
.nc-wiregasm .nc-wg-tools { display: flex; gap: .3rem; margin-left: auto; }
.nc-wiregasm .nc-wg-status {
  padding: .2rem .6rem; font-size: 12px; color: var(--nc-wg-muted);
  border-bottom: 1px solid var(--nc-wg-border); min-height: 1.6em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.nc-wiregasm .nc-wg-status.nc-wg-err { color: #b42318; white-space: normal; }
.nc-wiregasm .nc-wg-status.nc-wg-busy::before {
  content: ""; display: inline-block; width: 10px; height: 10px; margin-right: .45rem; vertical-align: -1px;
  border: 2px solid var(--nc-wg-border); border-top-color: var(--nc-wg-accent); border-radius: 50%;
  animation: nc-wg-spin .8s linear infinite;
}
@keyframes nc-wg-spin { to { transform: rotate(360deg); } }

/* packet list */
.nc-wiregasm .nc-wg-list {
  flex: 0 0 40%; overflow: auto; border-bottom: 3px double var(--nc-wg-border); outline: none;
}
.nc-wiregasm .nc-wg-list:focus-visible { box-shadow: inset 0 0 0 2px var(--nc-wg-sel); }
.nc-wiregasm table.nc-wg-table {
  width: 100%; margin: 0 !important; border-collapse: collapse !important; border: 0 !important;
  font: 12px/1.35 var(--nc-wg-mono); table-layout: auto; background: transparent !important;
}
.nc-wiregasm table.nc-wg-table th,
.nc-wiregasm table.nc-wg-table td {
  padding: 1px 8px !important; border: 0 !important; white-space: nowrap; text-align: left; vertical-align: top;
  background: transparent; color: inherit;
}
.nc-wiregasm table.nc-wg-table thead th {
  position: sticky; top: 0; z-index: 1; background: var(--nc-wg-bar) !important; color: var(--nc-wg-text) !important;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; font-weight: 600;
  border-bottom: 1px solid var(--nc-wg-border) !important;
}
.nc-wiregasm table.nc-wg-table td.nc-wg-c0,
.nc-wiregasm table.nc-wg-table td.nc-wg-c5 { text-align: right; }
.nc-wiregasm table.nc-wg-table td.nc-wg-c6 { width: 100%; }
.nc-wiregasm table.nc-wg-table tbody tr { cursor: default; }
.nc-wiregasm table.nc-wg-table tbody tr:hover td { box-shadow: inset 0 0 0 999px rgba(0,0,0,.04); }
.nc-wiregasm table.nc-wg-table tbody tr.nc-wg-sel,
.nc-wiregasm table.nc-wg-table tbody tr.nc-wg-sel td { background: var(--nc-wg-sel) !important; color: #fff !important; box-shadow: none; }

/* lower: tree + hex */
.nc-wiregasm .nc-wg-lower { flex: 1 1 auto; display: flex; min-height: 0; }
.nc-wiregasm .nc-wg-tree {
  flex: 1 1 auto; min-width: 0; overflow: auto; border-right: 1px solid var(--nc-wg-border);
  font: 12px/1.45 var(--nc-wg-mono);
}
.nc-wiregasm .nc-wg-tree ul { list-style: none !important; margin: 0 !important; padding: 0 !important; }
.nc-wiregasm .nc-wg-tree li { margin: 0 !important; padding: 0 !important; background: none !important; }
.nc-wiregasm .nc-wg-tree li::before { content: none !important; }
.nc-wiregasm .nc-wg-sub { display: none; }
.nc-wiregasm .nc-wg-node.nc-wg-open > .nc-wg-sub { display: block; }
.nc-wiregasm .nc-wg-row { display: flex; white-space: nowrap; cursor: default; padding-right: 8px; }
.nc-wiregasm .nc-wg-row:hover { background: #f0f3f6; }
.nc-wiregasm .nc-wg-row.nc-wg-sel { background: var(--nc-wg-sel); color: #fff; }
.nc-wiregasm .nc-wg-tog { flex: 0 0 14px; width: 14px; color: var(--nc-wg-muted); cursor: pointer; user-select: none; }
.nc-wiregasm .nc-wg-row.nc-wg-sel .nc-wg-tog { color: #fff; }
.nc-wiregasm .nc-wg-link { text-decoration: underline; cursor: pointer; }

.nc-wiregasm .nc-wg-hexwrap { flex: 0 0 auto; max-width: 60%; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.nc-wiregasm .nc-wg-tabs[hidden] { display: none !important; }
.nc-wiregasm .nc-wg-tabs { display: flex; gap: 2px; padding: 3px 4px 0; background: var(--nc-wg-bar); border-bottom: 1px solid var(--nc-wg-border); }
.nc-wiregasm button.nc-wg-tab {
  -webkit-appearance: none !important; appearance: none !important;
  height: auto !important; min-height: 0 !important; width: auto !important;
  padding: 2px 8px !important; margin: 0 !important;
  border: 1px solid var(--nc-wg-border) !important; border-bottom: 0 !important;
  border-radius: 4px 4px 0 0 !important; background: #e9edf1 !important; color: var(--nc-wg-text) !important;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif !important;
  font-size: 11.5px !important; font-weight: 400 !important; line-height: 1.4 !important;
  text-transform: none !important; box-shadow: none !important; cursor: pointer;
}
.nc-wiregasm button.nc-wg-tab.nc-wg-tab-active { background: #fff !important; font-weight: 600 !important; }
.nc-wiregasm .nc-wg-hex { flex: 1 1 auto; overflow: auto; padding: 4px 16px 4px 8px; font: 12px/1.45 var(--nc-wg-mono); white-space: pre; }
.nc-wiregasm .nc-wg-hl { display: flex; gap: 1.2ch; }
.nc-wiregasm .nc-wg-off { color: var(--nc-wg-muted); }
.nc-wiregasm .nc-wg-hexb .nc-wg-b { margin-right: .5ch; }
.nc-wiregasm .nc-wg-b { cursor: pointer; }
.nc-wiregasm .nc-wg-pad { cursor: default; }
.nc-wiregasm .nc-wg-b.nc-wg-hi { background: var(--nc-wg-hi); color: #000; }

/* narrow: stack packet list, detail tree and hex dump vertically.
   Container query = width of the viewer itself (narrow lesson columns, too);
   media query = fallback for browsers without container queries. */
@container nc-wg (max-width: 760px) {
  .nc-wiregasm .nc-wg-ui { height: auto !important; min-height: 0; }
  .nc-wiregasm .nc-wg-filterform { flex: 1 1 100%; }
  .nc-wiregasm .nc-wg-tools { margin-left: 0; }
  .nc-wiregasm .nc-wg-list { flex: none; height: 34vh; min-height: 150px; max-height: 320px; }
  .nc-wiregasm .nc-wg-lower { flex: none; flex-direction: column; min-height: 0; }
  .nc-wiregasm .nc-wg-tree {
    flex: none; height: 40vh; min-height: 180px; max-height: 420px;
    border-right: 0; border-bottom: 3px double var(--nc-wg-border);
  }
  .nc-wiregasm .nc-wg-hexwrap { flex: none; max-width: none; min-height: 0; }
  .nc-wiregasm .nc-wg-hex { flex: none; height: 30vh; min-height: 140px; max-height: 300px; font-size: 11px; }
  .nc-wiregasm:fullscreen .nc-wg-list { height: 30vh; max-height: none; }
  .nc-wiregasm:fullscreen .nc-wg-tree { height: 38vh; max-height: none; }
  .nc-wiregasm:fullscreen .nc-wg-hex { height: 26vh; max-height: none; }
}
@supports not (container-type: inline-size) {
  @media (max-width: 760px) {
    .nc-wiregasm .nc-wg-ui { height: auto !important; min-height: 0; }
    .nc-wiregasm .nc-wg-filterform { flex: 1 1 100%; }
    .nc-wiregasm .nc-wg-tools { margin-left: 0; }
    .nc-wiregasm .nc-wg-list { flex: none; height: 34vh; min-height: 150px; max-height: 320px; }
    .nc-wiregasm .nc-wg-lower { flex: none; flex-direction: column; min-height: 0; }
    .nc-wiregasm .nc-wg-tree {
      flex: none; height: 40vh; min-height: 180px; max-height: 420px;
      border-right: 0; border-bottom: 3px double var(--nc-wg-border);
    }
    .nc-wiregasm .nc-wg-hexwrap { flex: none; max-width: none; min-height: 0; }
    .nc-wiregasm .nc-wg-hex { flex: none; height: 30vh; min-height: 140px; max-height: 300px; font-size: 11px; }
    .nc-wiregasm:fullscreen .nc-wg-list { height: 30vh; max-height: none; }
    .nc-wiregasm:fullscreen .nc-wg-tree { height: 38vh; max-height: none; }
    .nc-wiregasm:fullscreen .nc-wg-hex { height: 26vh; max-height: none; }
  }
}
