/* Keep the name, connection state and graph actions in a single bar. */
.hero-network:not(.is-theater) .graph-head-actions {
  grid-template-columns: minmax(0,1fr) auto auto auto;
  gap: 4px;
  padding: 4px 8px;
  border-bottom: 1px solid var(--ui-border);
}
.hero-network:not(.is-theater) .graph-top {
  grid-area: 1 / 1;
  justify-content: space-between;
  gap: 8px;
  padding: 0 2px;
  background: transparent;
  border: 0;
}
.hero-network:not(.is-theater) .graph-top .eyebrow {
  white-space: nowrap;
}
.hero-network:not(.is-theater) .network-layout { grid-area: 1 / 2; }
.hero-network:not(.is-theater) .graph-head-actions .graph-sharing { grid-column: 3; }
.hero-network:not(.is-theater) .graph-watch { grid-column: 4; }
.network-layout-toggle {
  width: 40px;
  min-height: 40px;
}

@container kaspa-network (max-width: 430px) {
  .hero-network:not(.is-theater) .graph-top {
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 3px;
  }
  .hero-network:not(.is-theater) .graph-top .connection {
    white-space: normal;
    font-size: 10px;
  }
}

@container kaspa-network (max-width: 320px) {
  .hero-network:not(.is-theater) .graph-head-actions { gap: 3px; padding-inline: 6px; }
  .hero-network:not(.is-theater) :is(.network-layout-toggle,.graph-watch,.graph-share-actions [data-network-share]) {
    width: 34px;
  }
  .hero-network:not(.is-theater) .graph-share-actions .network-reaction { padding-inline: 5px; }
}

.network-layout-toggle,
.network-layout-presets button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 5px;
  min-height: 40px;
  padding: 4px 8px;
  border: 1px solid var(--ui-border);
  border-radius: 7px;
  background: var(--ui-bg);
  color: var(--ui-text);
  font: 500 11px/1.2 var(--font);
  text-align: center;
  cursor: pointer;
}
.network-layout-toggle svg {
  flex: none;
  width: 16px;
  height: 16px;
}
.network-layout-toggle:is(:hover,[aria-expanded=true]),
.network-layout-presets button:is(:hover,[aria-pressed=true]) {
  border-color: var(--ui-accent);
  background: var(--ui-selected);
}
.network-layout-toggle:focus-visible,
.network-layout-panel :is(button,input):focus-visible {
  outline: 2px solid var(--ui-accent);
  outline-offset: 2px;
}
.network-layout-panel {
  position: absolute;
  inset-block-start: calc(100% + 5px);
  inset-inline-end: 8px;
  width: min(288px,calc(100% - 16px));
  max-height: min(390px,68dvh);
  overflow: auto;
  overscroll-behavior: contain;
  padding: 10px;
  border: 1px solid var(--ui-border);
  border-radius: 12px;
  background: var(--ui-bg);
  color: var(--ui-text);
  box-shadow: 0 12px 28px #0008;
}

.network-layout-panel .graph-palette-group {
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}
.network-layout-panel #graph-palette-toggle {
  width: 100%;
  min-height: 42px;
  justify-content: flex-start;
  padding: 5px 8px;
}
.network-layout-panel #graph-palette-picker {
  position: static;
  width: 100%;
  max-height: none;
  overflow: visible;
  box-shadow: none;
}
.network-layout-panel .graph-palette-title {
  position: static;
}

.network-layout-panel[hidden] {
  display: none;
}
.network-layout-presets {
  display: grid;
  grid-template-columns: 1fr 1.4fr 1fr;
  gap: 4px;
}
.network-layout-presets button {
  min-height: 40px;
  padding-inline: 4px;
}
.network-layout-sections {
  min-width: 0;
  margin: 10px 0 0;
  padding: 3px 4px 0;
  border: 0;
  border-top: 1px solid var(--ui-border);
  font: 500 12px/1.4 var(--font);
}
.network-layout-sections legend {
  padding-inline: 4px;
  color: var(--ui-muted);
}
.network-layout-sections label {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 34px;
  cursor: pointer;
}
.network-layout-sections input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--ui-accent);
}
.hero-network:not(.is-theater)[data-layout-hide-controls] .graph-tools,
.hero-network:not(.is-theater)[data-layout-hide-details] :is(.graph-bottom,.graph-meta,.graph-instructions,.graph-hud,.graph-axis),
.hero-network:not(.is-theater)[data-layout-hide-legend] .graph-activity-legend,
.hero-network:not(.is-theater)[data-layout-hide-activity] .graph-activity-summary {
  display: none !important;
}
.hero-network[data-layout-hide-controls][data-layout-hide-details]:not(.is-theater) .graph-space {
  height: clamp(350px,76cqi,570px);
}
.hero-network[data-layout-hide-controls][data-layout-hide-details]:not(.is-theater,[data-layout-hide-activity]) .graph-space {
  height: clamp(280px,min(75cqi,49dvh),490px);
}
body.live-app-page .hero-network[data-layout-hide-controls][data-layout-hide-details]:not(.is-theater,[data-layout-hide-activity]) .graph-space {
  height: clamp(280px,calc(var(--live-app-viewport-height,100dvh) * .42),460px);
}
body.live-app-page .hero-network[data-layout-hide-controls][data-layout-hide-details][data-layout-hide-activity]:not(.is-theater) .graph-space {
  height: clamp(350px,calc(var(--live-app-viewport-height,100dvh) - 105px),1200px);
}
.hero-network.is-theater .network-layout {
  display: none;
}
@media (pointer: coarse) {
  .network-layout-toggle,.network-layout-presets button,.network-layout-sections label {
    min-height: 44px;
  }
}
