@import url('https://fonts.googleapis.com/css2?family=Rajdhani:wght@300;400;500;600;700&display=swap');

:root {
  --bg: #000000;
  --bg-tp: #00000033;
  --panel: rgba(255, 255, 255, .07);
  --panel2: rgba(255, 255, 255, .05);
  --border: rgba(255, 255, 255, .12);
  --accent: #5ee3a6;
  --accent2: #a8ff60;
  --text: #e8f1f8;
  --muted: #a9b6c3;
  --ok: #7dffb0;
  --warn: #f9c846;
  --err: #ff6b6b;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --r: 16px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35), inset 0 0 1px var(--border)
}

* {
  box-sizing: border-box;
}

*::-webkit-scrollbar {
  display: none;
  width: 0;
  /* Ensures the scrollbar takes up no width */
  height: 0;
  /* Ensures the scrollbar takes up no height for horizontal scrollbars */
}

* {
  font-family: "Rajdhani", sans-serif !important;
  letter-spacing: 0.04em;
  scrollbar-width: none;
  line-height: normal;
  /* Hides the scrollbar in Firefox */
}

body {
  background-color: black;
  margin: 0;
  color: var(--text);
  touch-action: none;
  font: 14px/1.35 system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background: black;
}

body.graph-drop-hover::before {
  content: 'Release file to load graph';
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(6, 12, 18, 0.78);
  backdrop-filter: blur(20px);
  color: #eef6ff;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  pointer-events: none;
  opacity: 1;
  animation: fadeIn 0.3s ease 1;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    backdrop-filter: blur(0px);
  }

  to {
    opacity: 1;
    backdrop-filter: blur(20px);
  }
}

main {
  background-color: var(--bg);
}


.slider {
  padding: unset !important;
  -webkit-appearance: none;
  width: 100%;
  height: 1px;
  background: #555;
  outline: none;
  border-radius: 1rem;
  opacity: 1;
  -webkit-transition: .2s;
  transition: opacity .2s;
  transition: background 0.2s ease;
}

.slider:hover {
  opacity: 1;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 10px;
  height: 10px;
  border-radius: 1rem;
  border: 2px solid #555;
  background: #000000;
  cursor: pointer;
  transition: background 0.2s ease;

}

.slider:active {
  padding: unset !important;
  -webkit-appearance: none;
  width: 100%;
  height: 1px;
  background: #aaa;
  outline: none;
  border-radius: 1rem;
  opacity: 1;
  -webkit-transition: .2s;
  transition: opacity .2s;
}

.slider:hover::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 10px;
  height: 10px;
  border-radius: 1rem;
  border: 2px solid #fff;
  background: #000000;
  cursor: pointer;
  transition: background 0.2s ease;

}

.slider::-moz-range-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 10px;
  height: 10px;
  border-radius: 1rem;
  border: 2px solid #fff;
  background: #000000;
  cursor: pointer;
  transition: background 0.2s ease;

}

.hidden {
  display: none !important;
}

#nodeMenuList button:hover::after {
  content: '+';
  margin-left: auto;
}

#nodeMenuToggle {
  border: 1px solid white;
}


.model-picker-buttons {
  display: flex;
  flex-flow: wrap;
  gap: 0.5rem;
}

.icon {
  line-height: 1;
  height: 1.5rem;
  margin: -4px;
  width: 1.5rem;
}

.icon.inverted {
  filter: invert(1)
}

.node-row {
  display: flex;
  flex-flow: row;
  gap: 0.5rem;
  pointer-events: all !important;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px
}

.header-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  pointer-events: all !important;
}

.menu-row {
  user-select: none;
  padding: 0.5rem;
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  position: fixed;
  width: 100vw;
  top: 0px;
  z-index: 10;
  pointer-events: none;
}

.menu-row::after {
  content: '';
  position: absolute;
  height: 150%;
  width: 100%;
  pointer-events: none;
  top: 0px;
  left: 0px;
  display: block;
  mask: linear-gradient(to bottom, black, black, transparent);
  backdrop-filter: blur(20px);
  z-index: -1;
}

.logdata {
  position: absolute;
  bottom: 0px;
  max-height: 500px;
  width: 100vw;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  z-index: 2;
  pointer-events: none;
  user-select: none;
}

.logdata::after {
  content: '';
  position: absolute;
  height: 150%;
  width: 100%;
  pointer-events: none;
  bottom: 0px;
  display: block;
  mask: linear-gradient(to top, black, black, transparent);
  backdrop-filter: blur(20px);
  z-index: -1;
}

.logdata .code {
  mask: linar-gradient(to top, transparent, black);
  background: unset;
  border: unset;
  max-width: calc(100vw - 350px);
  opacity: 0.2;
  width: auto;
  user-select: none !important;
}

.logdata .log-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 0.5rem;
  pointer-events: auto;
}

.logdata .log-controls button {
  pointer-events: auto;
}

.logdata .history-buttons {
  display: flex;
  align-items: center;
  gap: 6px;
}

.logdata .log-panels {
  display: flex;
  gap: 16px;
}

.logdata.collapsed .log-panels {
  display: none;
}

.logdata #wiresBox {
  width: max-content;
}

#syncQrCanvas {
  background: white;
  border-radius: 12px;
  padding: 12px;
  width: 280px;
  height: 280px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

#syncQrLink {
  font-family: var(--mono);
  font-size: 12px;
}

.media-preview,
.media-remote-frame {
  width: 100%;
  min-height: 120px;
  background: rgba(0, 0, 0, .35);
  border: 1px solid var(--border);
  border-radius: 4px;
  object-fit: cover;
}

.media-remote-frame[data-empty="true"] {
  opacity: 0.4;
}

.media-preview-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.media-preview-wrap .media-preview {
  display: block;
}

.media-flash {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 4px 8px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, .2);
  background: rgba(0, 0, 0, 0.6);
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
  transition: background .2s ease, border .2s ease;
}

.media-flash:hover {
  background: rgba(0, 0, 0, 0.8);
  border-color: rgba(255, 255, 255, .4);
}

.media-targets {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.media-target-entry {
  display: flex;
  gap: 6px;
  align-items: center;
}

.media-target-entry input {
  flex: 1;
  padding: 6px 8px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, .18);
  background: rgba(255, 255, 255, .04);
  color: var(--text);
  font-size: 13px;
}

.media-target-entry input:focus {
  outline: 1px solid rgba(255, 255, 255, .4);
  background: rgba(255, 255, 255, .08);
}

.media-target-entry button {
  padding: 6px 6px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, .2);
  background: rgba(255, 255, 255, .08);
  color: var(--text);
  cursor: pointer;
  line-height: 1;
  font-size: 14px;
}

.media-target-entry button:hover {
  background: rgba(255, 255, 255, .15);
}

.media-target-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.media-target-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .18);
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
  transition: background .2s ease, color .2s ease, border .2s ease, box-shadow .2s ease;
}

.media-target-chip.status-offline {
  border-color: rgba(232, 77, 77, 0.6);
  background: rgba(232, 77, 77, 0.18);
  color: #ffdede;
}

.media-target-chip.status-idle {
  border-color: rgba(247, 181, 0, 0.65);
  background: rgba(247, 181, 0, 0.16);
  color: #f7edc4;
}

.media-target-chip.status-active {
  border-color: rgba(48, 207, 107, 0.7);
  background: rgba(48, 207, 107, 0.2);
  color: #d5ffe6;
}

.media-target-chip.is-selected {
  background: rgba(255, 255, 255, .95);
  color: #111;
  border-color: rgba(255, 255, 255, .85);
  box-shadow: 0 2px 10px rgba(0, 0, 0, .25);
}

.media-target-chip.is-selected.status-active {
  border-color: rgba(48, 207, 107, 0.85);
  box-shadow: 0 0 14px rgba(48, 207, 107, 0.45);
}

.media-target-chip.is-selected.status-offline {
  border-color: rgba(232, 77, 77, 0.75);
  box-shadow: 0 0 12px rgba(232, 77, 77, 0.35);
}

.media-target-chip.has-offer:not(.is-selected) {
  border-style: dashed;
}

.media-target-chip.pending-handshake {
  box-shadow: 0 0 12px rgba(247, 181, 0, 0.35);
  background: rgba(247, 181, 0, 0.18);
  border-color: rgba(247, 181, 0, 0.65);
}

.media-target-chip-actions {
  display: none;
  gap: 4px;
  align-items: center;
  margin-left: 4px;
}

.media-target-chip-actions.hidden {
  display: none !important;
}

.media-target-chip.pending-handshake .media-target-chip-actions {
  display: inline-flex;
}

.media-target-chip-actions button {
  border: 1px solid rgba(255, 255, 255, .25);
  background: rgba(255, 255, 255, .08);
  color: var(--text);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 12px;
  cursor: pointer;
  transition: background .2s ease, border .2s ease;
  min-width: 24px;
  line-height: 1;
}

.media-target-chip-actions button:hover {
  background: rgba(255, 255, 255, .18);
  border-color: rgba(255, 255, 255, .45);
}

.media-target-chip .status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  box-shadow: 0 0 0 rgba(0, 0, 0, 0.2);
}

.media-target-chip.status-offline .status-dot {
  background: #e84d4d;
  box-shadow: 0 0 8px rgba(232, 77, 77, 0.45);
}

.media-target-chip.status-idle .status-dot {
  background: #f7b500;
  box-shadow: 0 0 8px rgba(247, 181, 0, 0.35);
}

.media-target-chip.status-active .status-dot {
  background: #30cf6b;
  box-shadow: 0 0 10px rgba(48, 207, 107, 0.45);
}

.media-target-chip-label {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.media-target-chip-remove {
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 0 2px;
  font-size: 12px;
}

.media-target-chip-remove:hover {
  color: var(--text);
}

.media-remote-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}

.media-remote-empty {
  color: var(--muted);
}

.media-remote-tile {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 6px;
  border-radius: 8px;
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .14);
}

.media-remote-tile.pending-handshake .media-remote-frame {
  filter: grayscale(0.7);
  opacity: 0.6;
}

.media-remote-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
}

.media-remote-info {
  min-height: 14px;
  color: var(--muted);
  font-size: 12px;
}

.media-remote-tile.has-audio .media-remote-info {
  color: var(--text);
}

.media-remote-controls {
  display: none;
  gap: 6px;
  justify-content: flex-end;
}

.media-remote-tile.pending-handshake .media-remote-controls {
  display: flex;
}

.media-remote-controls button {
  border: 1px solid rgba(255, 255, 255, .2);
  background: rgba(255, 255, 255, .08);
  color: var(--text);
  border-radius: 4px;
  padding: 4px 8px;
  cursor: pointer;
  transition: background .2s ease, border .2s ease;
  line-height: 1;
}

.media-remote-controls button:hover {
  background: rgba(255, 255, 255, .18);
  border-color: rgba(255, 255, 255, .4);
}

.media-remote-audio {
  display: none;
}

.media-remote-tile.has-audio .media-remote-audio {
  display: block;
  width: 100%;
}

.dot-bg {
  --dot-spacing: 2rem;
  /* distance between dots */
  --dot-size: 1px;
  /* dot radius */
  --dot-color: rgba(255, 255, 255, 0.14);
  /* muted white */

  background:
    radial-gradient(circle at var(--dot-size) var(--dot-size),
      var(--dot-color) var(--dot-size),
      transparent 0) 0 0 / var(--dot-spacing) var(--dot-spacing) repeat;
}

.transport-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-flow: row-reverse;
  gap: 8px;
  height: 34px;
  padding: 10px 12px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, .25);
  background: transparent;
  color: var(--text);
  font-weight: 800;
  cursor: pointer;
  z-index: 1001;
  transition: background .2s ease, color .2s ease, border .2s ease, box-shadow .2s ease;
}

.transport-btn.transport-locked {
  cursor: default;
}

.transport-btn .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  box-shadow: 0 0 12px currentColor;
}

.transport-btn.active {
  border-color: rgba(255, 255, 255, .65);
}

.router-download button {
  border: 1px solid white;
}

@media screen and (max-width:740px) {}

@media(max-width: 640px) {
  .brand-text {
    display: none;
  }


  .router-download {
    display: none;
  }

  .logdata {
    position: absolute;
    bottom: 0px;
    pointer-events: none;
    max-height: 150px;
    width: 100vw;
    height: max-content;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .logdata::after {
    content: '';
    position: absolute;
    height: 150%;
    width: 100%;
    pointer-events: none;
    bottom: 0px;
    display: block;
    mask: linear-gradient(to top, black, black, transparent);
    backdrop-filter: blur(5px);
    z-index: -1;
  }

  .logdata .code {
    background: unset;
    border: unset;
    max-width: 100%;
    height: 50%;
    opacity: 0.2;
    width: auto;
  }

  .logdata .log-controls {
    margin: 0px;
  }

  .logdata #wiresBox {}

  .card {
    padding: unset !important;
    border: 0px !important;
    background: unset !important;
  }
}

option {
  background: #000a;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center
}

.logo {
  width: 36px;
  height: 36px
}

.brand-text h1 {
  margin: 0;
  font-size: 18px
}

.brand-text .hint {
  color: var(--muted);
  font-size: 12px
}

.badge {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .15);
  background: rgba(255, 255, 255, .06)
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%
}

.dot.ok {
  background: var(--ok);
  box-shadow: 0 0 10px var(--ok);
  animation: emit 2s ease infinite;
}

@keyframes emit {
  0% {
    box-shadow: 0 0 0px 0px #7dffb0;

  }

  100% {
    box-shadow: 0 0 20px 5px #7dffb000;

  }

}

.dot.warn {
  background: var(--warn);
  box-shadow: 0 0 10px var(--warn)
}

.dot.err {
  background: var(--err);
  box-shadow: 0 0 10px var(--err)
}

.card {
  background: var(--panel);
}

@media(min-width:980px) {
  .span-4 {
    grid-column: span 4
  }

  .span-8 {
    grid-column: span 8
  }
}

h2 {
  margin: 0 0 8px;
  font-size: 15px
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center
}

.node-menu {
  position: relative;
}

.node-menu-list {
  position: absolute;
  top: calc(100% + 6px);
  max-height: calc(100vh - 100px);
  overflow: auto;
  left: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 170px;
  padding: 10px;
  border-radius: 12px;
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  box-shadow: 0 12px 28px rgba(0, 0, 0, .45);
  z-index: 40;
}

.node-menu-list button {
  width: 100%;
  justify-content: flex-start;
}

.node-menu-list button:active {
  width: 100%;
  background: white;
  color: black;
  justify-content: flex-start;
}

label {
  font-size: 12px;
  color: var(--muted);
  margin-right: 6px
}

input,
select,
textarea {
  width: 100%;
  background: var(--panel2);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, .15);
  border-radius: 4px;
  padding: 8px;
  outline: none
}

textarea {
  min-height: 84px;
  resize: vertical
}

.logic-rules-editor {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.logic-rules-items {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.logic-rules-empty {
  font-size: 12px;
  color: var(--muted);
  padding: 6px 0;
}

.logic-rules-note {
  font-size: 12px;
  color: var(--muted);
}

.logic-rules-controls {
  display: flex;
  justify-content: flex-end;
}

.logic-rule-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.logic-rule-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.logic-rule-title {
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
}

.logic-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
}

.logic-field>span {
  color: var(--muted);
  font-weight: 600;
}

.logic-field.hidden {
  display: none;
}

.logic-output-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.input-with-btn {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-flow: wrap;
}

.input-with-btn> :first-child {
  flex: 1 1 auto
}

.input-with-btn button {
  flex: 0 0 auto;
}

.relay-input-wrap .endpoint-mode-btn {
  min-width: 120px;
}

input.relay-disabled {
  opacity: 0.6;
}

.filter-token-editor {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.filter-token-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.filter-token-input-row input {
  flex: 1 1 auto;
}

.filter-token-note {
  font-size: 12px;
  color: var(--muted);
}

.filter-token-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 26px;
}

.filter-token-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  font-size: 12px;
  line-height: 1.2;
  color: var(--text);
}

.filter-token-label {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filter-token-remove {
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  padding: 0;
  line-height: 1;
}

.filter-token-remove:hover {
  color: var(--text);
}

.filter-token-empty {
  font-size: 12px;
  color: var(--muted);
}

.model-picker {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.model-picker-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.model-picker-button {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  padding: 6px 10px;
  color: var(--text);
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}

.model-picker-button:hover {
  background: rgba(255, 255, 255, 0.12);
}

.model-picker-button.selected {
  background: var(--accent);
  border-color: rgba(0, 0, 0, 0.1);
  color: black;
}

.model-fetch-row {
  display: flex;
  justify-content: flex-end;
}

.model-fetch-button {
  text-transform: capitalize;
}

.model-picker-status,
.model-picker-empty {
  font-size: 12px;
  color: var(--muted);
}

.model-picker-detail {
  max-height: 200px;
  overflow: auto;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  padding: 8px;
  margin: 0px 0px;
  font-size: 12px;
  white-space: pre-wrap;
}

.model-picker-capabilities {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  font-size: 12px;
}

.model-picker-capabilities-label {
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.model-cap-chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: var(--text);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  cursor: default;
}

.model-cap-chip.muted {
  background: transparent;
  border-style: dashed;
  color: var(--muted);
}

.model-cap-chip.pending {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
  color: var(--muted);
}

.model-cap-chip.error {
  background: rgba(255, 107, 107, 0.18);
  border-color: rgba(255, 107, 107, 0.4);
  color: #ffc7c7;
}

.model-pull {
  display: flex;
  flex-flow: wrap;
  gap: 8px;
  align-items: center;
}

.model-fetch-row {
  justify-content: flex-start;
}

.model-pull-log {
  height: 34px;
  overflow: auto;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  padding: 8px;
  margin: 0px 0px;
  font-size: 12px;
  white-space: pre-wrap;
}

.image-input {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.image-input-drop {
  position: relative;
  border: 1px dashed rgba(255, 255, 255, 0.35);
  border-radius: 10px;
  padding: 18px;
  text-align: center;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.05);
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.image-input-drop.dragover {
  border-color: var(--accent);
  background: rgba(102, 224, 255, 0.15);
  color: var(--text);
}

.image-input-drop input {
  display: none;
}

.image-input-instructions {
  font-size: 13px;
  line-height: 1.4;
}

.image-input-preview {
  width: 100%;
  max-height: 280px;
  object-fit: contain;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 10px;
}

.llm-controls {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 6px;
  font-size: 12px;
  color: var(--muted);
}

.llm-capabilities {
  font-weight: 600;
}

.llm-think {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  color: var(--text);
}

.llm-image-note {
  font-size: 11px;
  opacity: 0.75;
}

.llm-think.hidden,
.llm-image-note.hidden {
  display: none;
}

#qrModal video {
  width: 100%;
  max-height: 320px;
  border-radius: 12px;
  background: black
}

#qrModal canvas {
  display: none
}

#syncShareModal {
  z-index: 2;
}

.qr-body {
  display: flex;
  flex-direction: column;
  gap: 12px
}

button {
  background: white;
  color: #000000;
  border: 0;
  border-radius: 4px;
  line-height: 1;
  display: flex;
  padding: 8px 8px;
  font-weight: 700;
  cursor: pointer;
  align-items: center;
}

.toggle-boolean-wrap {
  display: flex;
  align-items: center;
}

button.toggle-boolean {
  justify-content: center;
  min-width: 72px;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--text);
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

button.toggle-boolean[data-state="true"] {
  background: white;
  color: #000000;
  border-color: white;
}

button.toggle-boolean[data-state="false"] {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.2);
}

button.toggle-boolean:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button:hover {
  opacity: 0.8;
  user-select: none;
  cursor: pointer;
}

button.secondary {
  background: white;
  color: #000000
}

button.ghost {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, .2);
  color: var(--text)
}

button.danger {
  background: indianred;
  color: #280a0a
}

.code {
  font-family: var(--mono);
  font-size: 12px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 10px;
  white-space: pre-wrap;
  max-height: 260px;
  overflow: auto
}

.bubble {
  background: rgba(0, 0, 0, .25);
  max-height: 360px;
  overflow: auto;
  border: 1px solid var(--border);
  padding: 6px;
  min-height: 32px;
  border-radius: 4px
}

.bubble[data-state="ready"] {
  border-color: rgba(125, 255, 176, .55);
  box-shadow: inset 0 0 0 1px rgba(125, 255, 176, .18);
}

.bubble[data-state="error"] {
  border-color: rgba(255, 107, 107, .6);
  box-shadow: inset 0 0 0 1px rgba(255, 107, 107, .16);
}

.bubble[data-state="loading"] {
  border-color: rgba(249, 200, 70, .55);
  box-shadow: inset 0 0 0 1px rgba(249, 200, 70, .14);
}

.bubble.busy::after {
  content: '⏳';
  margin-left: 6px;
  opacity: .8;
}

.node[data-busy="busy"] .title {
  color: var(--warn);
}

.node[data-busy="busy"] {
  box-shadow: inset 0 0 0 1px rgba(249, 200, 70, .15);
}

.muted {
  color: var(--muted);
  font-size: 12px
}

.vu {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .15);
  overflow: hidden
}

.vu>b {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #22c55e, #eab308, #ef4444)
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 999px;
  background: rgba(255, 255, 255, .06);
  font-family: var(--mono);
  font-size: 12px
}

/* Workspace */
#workspaceWrap {
  position: relative;
  height: 100vh;
  overflow: hidden;
  touch-action: none;
}

#workspace {
  position: absolute;
  inset: 0;
  touch-action: none;
  overflow: hidden;
  --dot-spacing: 2rem;
  --dot-size: 1px;
  --dot-color: rgba(255, 255, 255, 0.14);
  --grid-scale: 1;
  --grid-offset-x: 0px;
  --grid-offset-y: 0px;
}

#workspace::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at calc(var(--dot-size) * var(--grid-scale)) calc(var(--dot-size) * var(--grid-scale)),
      var(--dot-color) calc(var(--dot-size) * var(--grid-scale)),
      transparent 0);
  background-repeat: repeat;
  background-size: calc(var(--dot-spacing) * var(--grid-scale)) calc(var(--dot-spacing) * var(--grid-scale));
  background-position: var(--grid-offset-x) var(--grid-offset-y);
}

#wsCanvas {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  transform-origin: 0 0;
  will-change: transform;
  touch-action: none;
  z-index: 1;
  background: transparent;
}

#graphCard {
  background-image: radial-gradient(at bottom right, #040a10, #05080c), radial-gradient(at bottom left, #07111b, #121b27);
}

#linksSvg {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

#linksSvg path.wire {
  transition: stroke 0.2s ease, opacity 0.2s ease;
  stroke-dasharray: 0;
  stroke-dashoffset: 0;
}

#linksSvg path.wire-active {
  stroke: rgba(125, 255, 176, 0.95);
  stroke-dasharray: 12 6;
  animation: wire-dash 0.6s linear infinite;
}

@keyframes wire-dash {
  to {
    stroke-dashoffset: -18;
  }
}

/* Node */
.node {
  position: absolute;
  min-width: 230px;
  min-height: 230px;
  min-height: min-content;
  max-height: fit-content !important;
  border-radius: 14px;
  box-sizing: border-box;
  user-select: none;
  container-type: inline-size;
  container-name: node;
  z-index: 2;
}

.body::after {
  content: '';
  pointer-events: none;
  border-radius: 14px;
  width: 100%;
  height: 100%;
  position: absolute;
  bottom: 0px;
  left: 0px;
  mix-blend-mode: color-burn;
  z-index: -1;
  opacity: 0;
  transition: all 0.5s ease;
  background-image: radial-gradient(at bottom center, #0f21, transparent);
}

.node.selected {
  z-index: 4;
}

.node.selected .body::after {
  content: '';
  pointer-events: none;
  border-radius: 14px;
  width: 100%;
  height: 100%;
  position: absolute;
  bottom: 0px;
  left: 0px;
  mix-blend-mode: color-burn;
  z-index: -1;
  opacity: 1;
  animation: glow 2s ease infinite;
  background-image: radial-gradient(at bottom center, #0fa1, transparent);
}

.node .body::after {
  content: '';
  pointer-events: none;
  border-radius: 14px;
  width: 100%;
  height: 100%;
  position: absolute;
  bottom: 0px;
  left: 0px;
  mix-blend-mode: color-burn;
  z-index: -1;
  opacity: 0;
  transition: opacity 0.5s ease;
  background-image: radial-gradient(at bottom center, #0fa1, transparent);
}

@keyframes glow {
  0% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }

  100% {
    opacity: 1;
  }

}

.node:active {
  z-index: 3;
}

.node:hover {
  z-index: 3;
}

.node input,
.node textarea {
  user-select: text;
  -webkit-user-select: text;
  touch-action: manipulation;
}

.node__frame {
  border-radius: 14px;
  box-sizing: border-box;
  backdrop-filter: blur(10px);
  clip-path: polygon(8.6rem 36px, calc(100% - 8.6rem) 36px, calc(100% - 6.4rem) 0, 100% 0, 100% 100%, 0 100%, 0 0, 6.4rem 0);
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  padding: 1px;
}

.node__frame>.head {
  flex: 0 0 auto;
}

.node__frame>.body {
  flex: 1 1 auto;
  min-height: 0;
}

/* hide ::after when .node < 260px wide */
@container node (max-width: 300px) {

  .node__frame {
    clip-path: none !important;
  }

  .node .head::before {
    display: none !important;
  }

  .node .head::after {
    display: none !important;
  }

  .node .head {
    border-top-left-radius: 14px;
    border-top-right-radius: 14px;
    border: 1px solid white;
    border-bottom-width: 0px;
  }

  .node .head>.row::before {
    display: none !important;

  }

  .node .head>.titleRow::after {
    display: none !important;

  }


  .node .head>.titleRow::before {
    display: none !important;

  }

}

.node .resizeHandle {
  border-color: #ffffff55;
  transition: all 0.5s ease;
}

.node .resizeHandle:hover {
  border-color: var(--accent) !important;

  width: 4rem !important;
  height: 4rem !important;

}

.node .head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  position: relative;
  padding: 0.5rem;
  cursor: grab;
  min-height: 40px;
  border-top-left-radius: 14px;
  border-top-right-radius: 14px;
}

.node .head::before {
  pointer-events: none !important;
  content: '';
  width: 80px;
  background-size: contain;
  background-position: top left;
  background-repeat: no-repeat;
  transform-origin: top left;
  top: 0px;
  transform: scale(100%);
  background-image: url('/img/left.svg');
  height: 40px;
  position: absolute;
  left: 4.8rem;
}

.node .head::after {
  pointer-events: none !important;
  content: '';
  background-repeat: no-repeat;
  width: 80px;
  transform-origin: top right;
  top: 0px;
  transform: scale(100%);
  background-image: url('/img/right.svg');
  background-size: contain;
  background-position: top right;
  height: 40px;
  position: absolute;
  right: 4.8rem;
}

.node .head>.row {
  margin-bottom: auto;
}

.node .head>.row::before {
  pointer-events: none !important;
  content: '';
  width: 4.8rem;
  border-left: 1px solid rgba(255, 255, 255, 1);
  border-top: 1px solid rgba(255, 255, 255, 1);
  height: 100%;
  position: absolute;
  left: 0px;
  top: 0px;
  border-top-left-radius: 14px;
}

.node .head>.titleRow::after {
  pointer-events: none !important;
  content: '';
  width: 4.8rem;
  border-right: 1px solid rgba(255, 255, 255, 1);
  border-top: 1px solid rgba(255, 255, 255, 1);
  height: 100%;
  position: absolute;
  right: 0px;
  top: 0px;
  border-top-right-radius: 14px;
}


.node .head>.titleRow::before {
  pointer-events: none !important;
  content: '';
  width: calc(100% - 19.6rem);
  border-bottom: 1px solid rgba(255, 255, 255, 1);
  height: 1px;
  position: absolute;
  left: 9.8rem;
  top: 38px;
  border-top-right-radius: 14px;
}


.node .titleRow {
  display: flex;
  flex-flow: wrap;
  align-items: center;
  gap: 8px;
  max-width: 6rem;
}

.node .node-transport {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 4px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, .25);
  background: transparent;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  margin-top: auto;
  transition: background .2s ease, color .2s ease, border .2s ease, box-shadow .2s ease;
}

.node .node-transport .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  box-shadow: 0 0 10px currentColor;
}

.node .node-transport.active {
  border-color: rgba(255, 255, 255, .65);
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.25);
}

.node .body::before {
  content: '';
  pointer-events: none;
  border-radius: 14px;
  width: 100%;
  height: 100%;
  position: absolute;
  bottom: 0px;
  left: 0px;
  z-index: -1;
  opacity: 0;
  background-image: radial-gradient(at bottom center, #fff1, transparent);
  transition: all 0.5s ease;
}

.node:hover .body::before {
  content: '';
  pointer-events: none;
  border-radius: 14px;
  width: 100%;
  height: 100%;
  position: absolute;
  bottom: 0px;
  left: 0px;
  mix-blend-mode: color-burn;
  z-index: -1;
  opacity: 1;
  background-image: radial-gradient(at bottom center, #fff1, transparent);
}

.node .head:active {
  cursor: grabbing
}

.node .title {
  font-weight: 700;
  font-size: 13px
}

.node .gear {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  padding: 0;
  line-height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--text)
}

.node .gear:hover {
  background: rgba(255, 255, 255, .08)
}

.node .body {
  border-bottom-right-radius: 14px;
  border-bottom-left-radius: 14px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 1);
  border-top-width: 0px !important;
  cursor: grab;
  display: flex;
  flex-flow: column;
  gap: 0.5rem;
}

.node .body * {
  cursor: initial;
}

.node .body::after {
  content: '';
  bottom: 1px;
  left: 1px;
  mask: linear-gradient(to top, black, #000e, #000a, transparent);
  backdrop-filter: blur(20px);
  border-radius: 14px;
  position: absolute;
  width: calc(100% - 2px);
  height: 100%;
  z-index: -1;
}

.node .logic-gate-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
  max-height: 240px;
  overflow: auto;
  padding-right: 2px;
}

.node .logic-gate-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  gap: 8px;
  align-items: center;
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 12px;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.node .logic-gate-row[data-state='true'] {
  border-color: rgba(125, 255, 176, 0.45);
  background: rgba(125, 255, 176, 0.12);
}

.node .logic-gate-row[data-state='false'] {
  border-color: rgba(255, 160, 160, 0.45);
  background: rgba(255, 160, 160, 0.12);
}

.node .logic-gate-name {
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.node .logic-gate-operator {
  font-family: var(--mono);
  font-size: 11px;
  color: rgba(255, 255, 255, 0.7);
}

.node .logic-gate-path {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.55);
  justify-self: end;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.node .logic-gate-value {
  font-family: var(--mono);
  font-size: 11px;
  color: rgba(255, 255, 255, 0.85);
  justify-self: end;
  white-space: nowrap;
}

.node .logic-gate-empty {
  font-size: 12px;
  padding: 6px 0;
}

.node .wp-port.out[data-logic-variant='true'] .dot {
  background: rgba(125, 255, 176, 0.9);
}

.node .wp-port.out[data-logic-variant='false'] .dot {
  background: rgba(255, 140, 140, 0.9);
}

.node .wp-port.out[data-logic-variant='mixed'] .dot {
  background: rgba(255, 255, 255, 0.7);
}

.node .file-transfer {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 6px;
}

.node .file-transfer-send,
.node .file-transfer-receive {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.node .file-drop {
  border: 1px dashed rgba(255, 255, 255, 0.4);
  border-radius: 8px;
  padding: 18px;
  text-align: center;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.85);
  background: rgba(255, 255, 255, 0.05);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.node .file-drop:hover,
.node .file-drop.dragover {
  border-color: rgba(125, 255, 176, 0.8);
  background: rgba(125, 255, 176, 0.08);
}

.node .file-progress {
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  overflow: hidden;
  padding: 6px 8px;
  background: rgba(255, 255, 255, 0.04);
  display: flex;
  align-items: center;
  gap: 8px;
}

.node .file-progress.hidden {
  display: none;
}

.node .file-progress-bar {
  position: relative;
  height: 6px;
  flex: 1 1 auto;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.node .file-progress-bar::after {
  content: '';
  position: absolute;
  inset: 0;
  width: var(--pct, 0%);
  background: linear-gradient(90deg, rgba(125, 255, 176, 0.85), rgba(68, 188, 255, 0.85));
  border-radius: inherit;
  transition: width 0.2s ease;
}

.node .file-transfer-info {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.75);
  white-space: pre-wrap;
}

.node .file-transfer-receive .tiny {
  color: rgba(255, 255, 255, 0.75);
}

.model-pull-form {
  display: flex;
  flex-flow: column;
  gap: 8px;
}

.tts-volume input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 120px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.35);
  cursor: pointer;
}

.tts-volume input[type="range"]:focus {
  outline: none;
}

.tts-volume input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.45);
}

.tts-volume input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: none;
  background: #fff;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.45);
}

.asr-partial-row {
  font-size: 12px;
  margin-bottom: 6px;
}

.asr-partial-row [data-asr-partial-flag] {
  font-weight: 500;
  transition: color 0.2s ease;
}

.asr-partial-row [data-asr-partial-flag][data-state='live'] {
  color: rgba(255, 255, 255, 0.7);
}

.asr-partial-row [data-asr-partial-flag][data-state='final'] {
  color: var(--ok);
}

.asr-partial-row [data-asr-partial-flag][data-state='idle'] {
  color: rgba(255, 255, 255, 0.45);
}

.asr-rms {
  font-family: var(--mono);
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.85);
  transition: color 0.2s ease, background 0.2s ease;
}

.asr-rms[data-state='active'] {
  color: var(--ok);
  background: rgba(125, 255, 176, 0.12);
}

.asr-rms[data-state='idle'] {
  color: var(--err);
  background: rgba(255, 107, 107, 0.12);
}

.node .text-input-area textarea {
  min-height: 96px;
  resize: vertical;
}

.node .text-input-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
}

.node .template-editor {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.node .template-editor textarea {
  min-height: 110px;
}

.node .template-preview {
  font-family: var(--mono);
  font-size: 12px;
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 10px;
  padding: 8px;
  min-height: 54px;
  white-space: pre-wrap;
  overflow: auto;
  line-break: anywhere;
}

.dm-address-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.dm-address-row .bubble {
  flex: 1 1 auto;
}

.dm-peer-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.dm-peer-row .bubble {
  flex: 1 1 auto;
}

.dm-spinner {
  width: 16px;
  height: 16px;
  aspect-ratio: 1/1;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: rgba(255, 255, 255, 0.9);
  animation: dm-spin 0.9s linear infinite;
}

.dm-peer-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.node button.ghost.active {
  background: rgba(125, 255, 176, 0.12);
  border-color: rgba(125, 255, 176, 0.4);
}

.dm-indicator {
  width: 12px;
  height: 12px;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.4);
}

.dm-indicator.online {
  background: var(--ok);
  box-shadow: 0 0 10px var(--ok);
  animation: dm-blink 1.2s ease-in-out infinite alternate;
}

.dm-indicator.pending {
  background: var(--warn);
  box-shadow: 0 0 10px var(--warn);
  animation: dm-blink 1.6s ease-in-out infinite alternate;
}

.dm-indicator.warning {
  background: var(--warn);
  box-shadow: 0 0 10px var(--warn);
  animation: dm-blink 1.6s ease-in-out infinite alternate;
}

.dm-indicator.critical {
  background: var(--err);
  box-shadow: 0 0 10px var(--err);
  animation: dm-blink 1s ease-in-out infinite alternate;
}

.dm-indicator.offline {
  background: rgba(255, 255, 255, 0.2);
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.35);
}

@keyframes dm-blink {
  from {
    opacity: 0.55;
  }

  to {
    opacity: 1;
  }
}

@keyframes dm-spin {
  to {
    transform: rotate(360deg);
  }
}

.nkndm-settings-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.nkndm-settings-row input {
  flex: 1 1 auto;
}

.nkndm-settings-control {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nkndm-settings-status {
  min-width: 1.5em;
  text-align: center;
  font-weight: 600;
}

.nkndm-settings-status.ok {
  color: var(--ok);
}

.nkndm-settings-status.err {
  color: var(--err);
}

.nkndm-settings-status.pending {
  color: var(--warn);
}

.nkndm-settings-peer {
  font-size: 0.85em;
  color: rgba(255, 255, 255, 0.65);
  word-break: break-all;
}

.media-settings {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.media-settings-add {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.media-settings-input {
  flex: 1 1 220px;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, .18);
  background: rgba(255, 255, 255, .06);
  color: var(--text);
}

.media-settings-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.media-settings-empty {
  font-size: 0.85em;
  color: rgba(255, 255, 255, 0.55);
}

.media-settings-item {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-start;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, .04);
  border-radius: 8px;
  padding: 8px 10px;
}

.media-settings-item-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1 1 200px;
}

.media-settings-item-address {
  font-weight: 600;
  word-break: break-all;
}

.media-settings-status {
  font-size: 0.85em;
  color: rgba(255, 255, 255, 0.7);
}

.media-settings-status.status-accepted {
  color: var(--ok);
}

.media-settings-status.status-pending {
  color: var(--warn);
}

.media-settings-status.status-declined {
  color: var(--err);
}

.media-settings-status.status-idle {
  color: rgba(255, 255, 255, 0.7);
}

.media-settings-active {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: 12px;
  background: rgba(48, 207, 107, 0.16);
  color: var(--ok);
  font-size: 0.75em;
  font-weight: 600;
  width: fit-content;
}

.media-settings-item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.media-settings-item-actions button {
  min-width: 60px;
}

.node .ports {
  display: flex;
  justify-content: space-between;
  gap: 10px
}

.node .side {
  display: flex;
  flex-direction: column;
  gap: 8px
}

.wp-port {
  --sz: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 12px;
  cursor: pointer
}

.wp-port .dot {
  width: var(--sz);
  height: var(--sz);
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .8);
  background: rgba(255, 255, 255, .15)
}

.wp-port.drop-hover {
  border-radius: 999px;
  outline: 2px solid rgba(0, 204, 255, 0.6);
  outline-offset: 3px;
}

.wp-port.drop-hover .dot {
  box-shadow: 0 0 12px rgba(102, 224, 255, .8);
}

.wp-port.out .dot {
  box-shadow: 0 0 0 2px rgba(102, 224, 255, .25)
}

.right .out {
  justify-content: flex-end;
}

.wp-port.in .dot {
  box-shadow: 0 0 0 2px rgba(168, 255, 96, .25)
}

.wp-port.sel .dot {
  background: var(--accent)
}

/* Modal */
.modal.hidden {
  display: none
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 1
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .5);
  backdrop-filter: blur(20px)
}

.modal-panel {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(880px, calc(100% - 28px));
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 16px;
  padding: 14px;
  max-height: calc(100vh - 10rem);
  overflow: auto
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px
}

.modal-head>button {
  height: 30px;
  width: 30px;
}

.modal-title {
  font-weight: 800;
  font-size: 15px;
  align-self: normal;
}

.form-grid {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 8px
}

.help {
  font-size: 11px;
  color: var(--muted)
}

audio {
  width: 100%;
  height: 32px
}

.peer-modal-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.peer-modal-body.two-col {
  display: flex;
  flex-direction: row;
  gap: 16px;
}

.peer-left {
  flex: 1 1 45%;
  display: flex;
  gap: 0.5rem;
  min-width: 280px;
  flex-flow: column;
  flex-direction: column;
}

.peer-right {
  flex: 1 1 55%;
  min-width: 320px;
  gap: 0.5rem;
  display: flex;
  flex-flow: column;
  flex-direction: column;
}

.peer-tabs {
  display: none;
  gap: 6px;
  margin-bottom: 4px;
}

.peer-tab {
  flex: 1 1 50%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border, rgba(255, 255, 255, .12));
  background: rgba(255, 255, 255, .06);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background .2s ease, border .2s ease, color .2s ease;
}

.peer-tab.active {
  background: var(--accent, #2ecc71);
  border-color: var(--accent, #2ecc71);
  color: #0b1c12;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

#chatFavoriteBtn.active {
  color: var(--accent, #2ecc71);
}

.chat-status {
  min-height: 20px;
}

.chat-messages {
  flex: 1;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  background: var(--panel2);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chat-input {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.chat-message {
  margin: 6px 0;
  max-width: 80%;
  padding: 6px 8px;
  border-radius: 10px;
}

.chat-message.in {
  background: var(--bg-tp);
  align-self: flex-start;
}

.chat-message.out {
  background: var(--bg-tp);
  align-self: flex-end;
}

.chat-message .time {
  opacity: .6;
  font-size: 12px;
  margin-left: 6px;
}

.chat-typing {
  margin-top: 6px;
}

.peer-self {
  font-size: 11px;
  color: var(--muted);
  word-break: break-all;
}

.peer-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 360px;
  overflow-y: auto;
}

.peer-identity {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 6px 0 12px;
}

.peer-identity label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.peer-identity-row {
  display: flex;
  gap: 8px;
}

.peer-identity-row input {
  flex: 1;
  background: rgba(255, 255, 255, .07);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font: inherit;
  padding: 6px 8px;
}

.peer-filters {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

#peerSearchInput {
  flex: 1;
  background: rgba(255, 255, 255, .07);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font: inherit;
  padding: 6px 8px;
}

#peerSearchInput::placeholder {
  color: rgba(255, 255, 255, .4);
}

#peerFavoritesToggle.active {
  color: var(--accent, #2ecc71);
}

.peer-self-name {
  font-size: 11px;
  color: var(--muted);
}

@media (max-width: 768px) {
  .peer-modal-body.two-col {
    flex-direction: column;
  }

  .peer-tabs {
    display: flex;
  }

  .peer-modal-body.two-col .peer-left,
  .peer-modal-body.two-col .peer-right {
    min-width: 0;
  }

  .peer-modal-body.two-col.mobile-pane-list .peer-left {
    display: block;
  }

  .peer-modal-body.two-col.mobile-pane-list .peer-right {
    display: none;
  }

  .peer-modal-body.two-col.mobile-pane-chat .peer-left {
    display: none;
  }

  .peer-modal-body.two-col.mobile-pane-chat .peer-right {
    display: flex;
  }
}

.peer-entry {
  display: flex;
  align-items: flex-start;
  flex-flow: column;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.peer-entry.offline {
  opacity: 0.45;
}

.peer-entry.probing {
  opacity: 0.65;
}

.peer-entry.peer-highlight {
  box-shadow: 0 0 0 2px rgba(94, 227, 166, .6);
}

.peer-entry .peer-shared {
  font-size: 10px;
  color: var(--muted);
  margin-top: 2px;
  display: flex;
  flex-flow: column;
  gap: 0.5rem;
}

.peer-entry .peer-shared button {
  background: var(--accent);
  padding: 8px;
  border: none;
  color: black;
  display: block;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  text-decoration: unset;
  max-width: 200px;
  text-overflow: ellipsis;
  overflow: hidden;
}

.peer-entry .peer-shared button:hover {
  opacity: 0.8;
}

.peer-address {
  font-size: 10px;
  color: var(--muted);
  word-break: break-all;
  margin-top: 2px;
}

.peer-actions {
  display: flex;
  flex-flow: row;
  gap: 6px;
}

.peer-meta {
  flex: 1;
  min-width: 0;
  pointer-events: none;
  user-select: none;
}

.peer-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  word-break: break-word;
}

.peer-info {
  margin-top: 2px;
  font-size: 11px;
  color: var(--muted);
  word-break: break-all;
}

.peer-empty {
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  padding: 20px 0;
}

.payment-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  margin-top: 12px;
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.payment-summary {
  font-weight: 600;
  font-size: 12px;
  color: var(--text);
}

.payment-wallet {
  font-size: 11px;
  color: var(--muted);
}

.payment-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.payment-actions button {
  min-width: 120px;
}

.payment-invoices {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.payment-invoice {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  background: rgba(12, 15, 20, 0.6);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.payment-invoice[data-status="paid"] {
  border-color: rgba(94, 227, 166, .65);
}

.payment-invoice[data-status="failed"] {
  border-color: rgba(255, 107, 107, .6);
}

.payment-invoice-title {
  font-weight: 600;
  font-size: 12px;
  color: var(--text);
}

.payment-invoice-details {
  font-size: 11px;
  color: var(--muted);
}

.payment-invoice-status {
  font-size: 11px;
}

.payment-invoice-actions {
  margin-top: 4px;
  display: flex;
  gap: 6px;
}

.payment-invoice-empty {
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  padding: 16px 0;
}

.peer-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: 8px;
  min-width: 16px;
  height: 16px;
  padding: 0 5px;
  border-radius: 2px;
  background: var(--text);
  color: #000;
  font-weight: bold;
  ;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}

#peerListButton {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  position: relative;
}

#peerListButton.poke-notice::after {
  content: '🔔';
  position: absolute;
  right: -4px;
  top: -4px;
  font-size: 16px;
  line-height: 1;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .25));
}

.face-viewer {
  position: relative;
  margin-top: 12px;
  background: rgba(12, 16, 22, 0.7);
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 10px;
  overflow: hidden;
  min-height: 200px;
}

.face-viewer canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.face-viewer-status {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--muted);
  background: rgba(8, 12, 16, 0.75);
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.face-viewer-ready .face-viewer-status {
  opacity: 0;
}

.llm-memory-section {
  margin-top: 16px;
}

.llm-memory-section.llm-memory-hidden {
  display: none;
}

.llm-memory-details {
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0 12px 12px;
}

.llm-memory-summary {
  list-style: none;
  padding: 12px 4px;
  font-weight: 600;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.llm-memory-note {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
}

.llm-memory-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.llm-memory-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, .05);
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 8px;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.llm-memory-item.dragging {
  opacity: 0.6;
}

.llm-memory-item.drag-over {
  border-color: var(--accent);
  background: rgba(94, 227, 166, 0.12);
}

.llm-memory-item.editing {
  border-style: dashed;
}

.llm-memory-handle {
  cursor: grab;
  font-size: 16px;
  line-height: 1;
  user-select: none;
  color: var(--muted);
  padding-top: 2px;
  margin: auto;
  opacity: 0.5;
}

.llm-memory-item.editing .llm-memory-handle {
  display: none;
}

.llm-memory-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.llm-memory-meta {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.llm-memory-content {
  font-size: 13px;
  white-space: pre-wrap;
  word-break: break-word;
}

.llm-memory-actions {
  display: flex;
  flex-flow: row;
  gap: 6px;
}

.llm-memory-actions button {
  min-width: 30px;
  text-align: center;
  margin: auto;
  display: flex;
  flex-flow: column;
}

.llm-memory-actions.editing {
  flex-direction: row;
  justify-content: flex-end;
}

.llm-memory-editor-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.llm-memory-role-select {
  width: 160px;
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .15);
  border-radius: 6px;
  color: var(--text);
  padding: 6px 8px;
  font: inherit;
}

.llm-memory-editor {
  width: 100%;
  min-height: 96px;
  resize: vertical;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, .15);
  background: rgba(255, 255, 255, .04);
  color: var(--text);
  padding: 8px;
  font: inherit;
}

.llm-memory-empty {
  font-size: 12px;
  color: var(--muted);
  padding: 4px 2px 0;
}

.llm-memory-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

button.ghost.danger {
  background: transparent;
  color: var(--err);
}

button.ghost.danger:disabled {
  border-color: var(--border);
  color: rgba(255, 255, 255, .3);
}

.wscraper {
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: auto;
}

.wscraper-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.wscraper-buttons {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.wscraper-buttons.secondary {
  justify-content: flex-start;
}

.wscraper-session {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--font-small);
}

.wscraper-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.wscraper-input-row {
  display: flex;
  gap: 6px;
}

.wscraper-input-row input {
  flex: 1 1 auto;
}

.wscraper-field-grid {
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.wscraper-field-grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.wscraper-preview {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  min-height: 160px;
  overflow: hidden;
  touch-action: none;
}

.wscraper-preview img {
  display: none;
  width: 100%;
  height: auto;
  cursor: crosshair;
  user-select: none;
  -webkit-user-drag: none;
  touch-action: none;
}

.wscraper-preview img.active {
  display: block;
}

.wscraper-preview-placeholder {
  font-size: var(--font-small);
  color: rgba(255, 255, 255, 0.6);
  text-align: center;
  padding: 12px;
}

.wscraper-preview-placeholder.hidden {
  display: none;
}

.wscraper-log {
  min-height: 48px;
  max-height: 180px;
  overflow: auto;
  white-space: pre-wrap;
}